Skip to content

feat: check large pull request approvals in git node land - #1173

Open
zeexzeex wants to merge 1 commit into
nodejs:mainfrom
zeexzeex:feat/large-pr-checks
Open

feat: check large pull request approvals in git node land#1173
zeexzeex wants to merge 1 commit into
nodejs:mainfrom
zeexzeex:feat/large-pr-checks

Conversation

@zeexzeex

Copy link
Copy Markdown

Node.js requires two TSC approvals for pull requests over 5000 lines of net change, but nothing enforces it at land time. This adds that check to git node land.

A pull request over the threshold that does not carry two TSC approvals is now reported and blocked.

The check is separate from the existing semver-major one rather than folded into it. The two happen to share an approval requirement today, but they are different rules: they need distinct messages and reason codes so a failure tells the author what to actually do, the reason payload carries a line count that means nothing for semver-major, and the exemptions below apply only to the size rule. A semver-major pull request is skipped here so the two never fire at once.

The policy also exempts routine dependency updates, WPT imports, bot-issued pull requests and test-only refactors. Whether a change is routine or functional is not something this can decide from the pull request data, so it only skips the categories a label identifies on its own, meaning dependencies and release. Everything else is reported rather than silently allowed, and a reviewer can still tell an exempt pull request apart.

release matters more than it looks. Release proposals run to hundreds of thousands of lines, and blocking one would stall a release. checkReviewsAndWait() does take an isReleaseProposal argument, but it is only passed from promote_release.js; on the git node land path it is undefined, so the label is what identifies them here.

Missing line counts leave the check inactive rather than treating the pull request as small, so a query made before additions/deletions were added to PR.gql does not silently pass a large pull request through.

I ran the check against the last 500 merged pull requests in nodejs/node. Four were exempt, all of them release proposals. Two were reported: nodejs/node#64339 (zlib ZIP support, +9679) and nodejs/node#63696 (Windows PGO workload scripts, +5643). Both are the kind of pull request the policy targets.

Refs: https://github.com/nodejs/node/blob/main/doc/contributing/large-pull-requests.md
Fixes: #1063

Node.js requires two TSC approvals for pull requests over 5000 lines of
net change, but nothing enforces it at land time.

Report a pull request that exceeds the threshold and does not carry two
TSC approvals. semver-major pull requests are already held to the same
requirement, so they are left to the existing check.

The policy also exempts routine dependency updates, WPT imports,
bot-issued pull requests and test-only refactors. Whether a change is
routine or functional is not something this can decide from the pull
request data, so it only skips the categories a label identifies on its
own, meaning `dependencies` and `release`. A release proposal is the
case that matters most here, since those run to hundreds of thousands
of lines and blocking one would stall a release.

Missing line counts leave the check inactive rather than treating the
pull request as small, so a query that predates the new fields does not
silently pass a large pull request through.

Refs: https://github.com/nodejs/node/blob/main/doc/contributing/large-pull-requests.md
Refs: nodejs#1063
Signed-off-by: Avocado <ujubongbong@gmail.com>
@zeexzeex
zeexzeex force-pushed the feat/large-pr-checks branch from 2149ab7 to f8afeef Compare August 31, 2026 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add large pull request checks in git node land

1 participant