Repository navigation
fix(ci): compare repository checks against the tested merge's target - #2591
Conversation
A pull request's size-ratchet and migration checks compared its merge commit with the payload's base.sha. That SHA can be older than the target tip the merge was built on, so a PR opened before main moved was charged with every file main grew since. #1661 failed the size ratchet on eight files it never touched. Both steps now pass origin/<target branch>, and the make targets take its merge base with HEAD, which is the commit the PR was merged onto. The contract checks already compare this way, and Go lint uses the merge commit's first parent since #2521. Closes #2404 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 15 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
Closes #2404
Related issue: N/A
Validation tasks: none
Pull requests fail the size-ratchet check on files they never touched. On a pull request, the size-ratchet and migration checks run on the merge with the target's current tip, but they compare it with
github.event.pull_request.base.sha. That SHA can be older than the tip, so every file the target grew since then counts as the PR's change. #1661 changes twointernal/blobstorefiles, and its latest run failed on eight others, among theminternal/recommendations/worker.go(572 → 1,546 lines), which grew onmain.This is the bug #2404 reported for Go lint. #2521 fixed it there by comparing with the merge commit's first parent; the two checks #2522 added still used the payload SHA.
Approach
Both steps now set
BASE_REFtoorigin/<target branch>. Their make targets already takegit merge-base "$BASE_REF" HEAD, which for a tested merge is the commit the PR was merged onto, even if the target moved again after the merge was built. The contract checks already compare this way. Push runs keep comparing with the default branch, as before.Validation
mainand ranmake verify-size-ratchet. With the payload base it fails on files frommain; withorigin/mainit passes.main, still fails with0 -> 1006 lines crosses limit 1000.trusted-linux-ci.ymlfrommain, so they do not exercise this change. It takes effect for pull requests after merge.Evidence
Evidence: none, no user-visible change
Risks
None identified. The checkout in this job already fetches full history and every branch, so
origin/<target branch>is always present.Checklist
AI Disclosure
claude-opus-5-5🤖 Generated with Claude Code
Note
Fix trusted CI merge-base to compare against the target branch ref
Changes
BASE_REFin the file line limits / bidi controls and migration verification steps from the pull request payload's base SHA toorigin/<target branch>viagithub.base_ref, falling back to the default branch for non-PR runs. This avoids computing the merge base against an outdated payload SHA in trusted-linux-ci.yml. Behavioral Change: PR runs now fetch the target branch ref before the merge-base calculation instead of trusting the payload's base commit SHA.Macroscope summarized 3a08c3a.