I2I: AMP Bundle Size GitHub App #19146
Labels
INTENT TO IMPLEMENT
Proposes implementation of a significant new feature. https://bit.ly/amp-contribute-code
Type: Feature Request
WG: infra
Milestone
Objective
Create a GitHub app to replace the existing bundle-size check, and make the check differential instead of absolute.
Background
This design doc supersedes the changes proposed for the bundle size checks in #17043, which proved insufficient to resolve developers' complaints
The AMP project checks the size of the compiled JavaScript bundle with every pull request to the GitHub project, as part of the promise to keep the size bundle size small. This check runs on the Travis continuous integration platform, executed by the gulp task executor.
The existing check is not well liked, since it blocks when a PR pushes the bundle size above a certain absolute maximum size. It also reports of changes only in the Travis logs, reducing visibility on the bundle size growth.
This document summarizes offline discussions on a solution to both of these issues in the form of a GitHub app.
Overview
The GitHub app will be written using Probot and will run on AppEngine. The app will have the following API points:
POST /v0/commit/<commit_sha>/report
POST /v0/commit/<commit_sha>/skip
POST /v0/webhook
(GitHub webhook)See security considerations in the section below.
Messages
The status messages on the app should be concise, since there is not a lot of space in the UI
The text of the comment given a large increase in the bundle size:
Changes to
gulp bundle-size
Modify the
gulp bundle-size
action with the following flags. Remove all other actions that this check performs:--store
(maybe rename to--master
?)--skip <commit_sha>
/v0/commit/<commit_sha>/skip
; this should be called from Travis checks that would not, in the existing implementation, run the bundle-size check. This is required so that the GitHub app can be set as a required check.--report <commit_sha>
/v0/pr/<commit_sha>/report
using the existing method of determining the bundle size and the delta. Note that sometimes the PR's branching point will be missing from ampproject/amphtml-build-artifacts. Possible solutions:Open sourcing & future work
GitHub Checks can give us a lot of power and expose more information to contributors. We'll create a new GitHub repository (
ampproject/amphtml-github-bots
) to maintain the code for this and all new GitHub bots that we intend to write, and to document their deployment and development.Security Consideration
The GitHub app should be secured to prevent malicious users from modifying PR statuses, by using the Travis IP addresses to validate that the requests are coming from Travis, especially for the
/v0/commit/*
API points, and by using secret tokens on the app server to validate GitHub webhook requests. This is a minor security consideration, and an unlikely vector of attack (the gain for the attacker is minimal, and can be easily reverted.)The GitHub app will not have access to read or modify the source code or approve the PR. Regardless, Probot will have to go through a security review.
Privacy Considerations
No PII is involved.
The text was updated successfully, but these errors were encountered: