Repository navigation
Conversation
A pull_request run checks out GitHub's test merge commit but hands the diff-scoped gates pull_request.base.sha, which a re-run keeps from the original event while the merge commit is rebuilt on the current base. At depth 1 there is no merge-base to correct that, so every base-branch change in between was charged to the PR. On a PR far behind main the vitest [vs-base] gate then re-scanned over a thousand files and timed out at 15 s on a diff with no frontend change. resolve-i18n-base.sh now measures from the merge commit's first parent when HEAD's second parent is the PR head. A checkout of the PR head itself, and every push, keeps the base it was given. Fixes kirodotdev#33167 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 11, 2026
Contributor
|
Thanks @leonlaiyc. This fix is now urgent: since the emoji-icon gate landed in #38097, every re-run or stale-base PR fails Source Gates on lines it never touched. A fork PR that changes AI-assisted, sent by Bolin Review bot |
This was referenced Nov 17, 2026
Contributor
|
Closing in favour of #38678, which merged with your commit and authorship kept. Thanks @leonlaiyc for the fix. AI-assisted, sent by Bolin Review bot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem / Motivation
Goal: On a pull request, the diff-scoped CI gates measure only the PR's own changes, even on a re-run or when the PR is far behind main.
src/i18n/localeFormatting.test.ts > [vs-base] no file this branch touched gained a host-locale calltimed out at 15 s on #31540, a PR that changes one Python comment and nowebsite/file (#33167, two runs linked there). The reporter traced it in the issue: the run checks out the PR's merge ref built on current main (43ac0cd051), butI18N_BASE_REFispull_request.base.sha(89a61071c5), which a re-run keeps from the original event. At depth 1merge-basefails,diffScope()falls back to that old base, and the test re-scans 1238website/srcfiles main changed in between. As the issue asks, this fixes the scope, not the timeout.Why it matters
Any PR whose base has fallen behind can fail Frontend Tests on a re-run whatever it changes, and a re-run is exactly what a contributor reaches for after an unrelated red. Every other gate fed by
.github/scripts/resolve-i18n-base.sh(the brand, comment-history, focus-cue, feature-map, changelog, decisions, harness-parity and memstore gates infast-gate.yml, plus the i18n gates inci.yml) charges the same foreign lines to the PR, so it can also fail on lines it never touched.Not a goal
diffScope()faster.I18N_BASE_REFexpressions inci.yml/fast-gate.yml.What changed (motivation → approach → change)
pull_requestrun checks out GitHub's test merge commit, while the base it is handed ispull_request.base.sha. The two disagree whenever the merge commit was built on a newer base, and with a depth-1 checkout nothing reconciles them..github/scripts/resolve-i18n-base.sh, the one resolver every caller already runs, now replaces the base with HEAD's first parent when the event ispull_requestand HEAD's second parent is the PR head (pull_request.head.shafrom$GITHUB_EVENT_PATH). That is the issue's proposal: the merge commit's first parent IS the base it was built on, sofirst parent..HEADis exactly the PR. It reads the parents withgit cat-file -p HEAD, because a shallow checkout grafts them away fromHEAD^1. The existing fetch then pulls that one commit at depth 1. Everything else is unchanged:docs/ci/i18n-gates.mddescribes the rule beside the resolver's existing paragraph.Backwards compatibility
Compatible: the resolver still prints a commit the callers resolve and fetch the same way; on a pull_request merge checkout it is now the merge's first parent, and every other run gets the value it got before.
Removes nothing: the resolver only picks a different, narrower base commit on one event shape; no gate, input or output is removed.
Tests
test/test_resolve_i18n_base.py, three new cases against real git. The fixture is an origin whoserefs/pull/1/mergewas built on a main two commits ahead of the event's base, checked out at depth 1 the wayactions/checkoutdoes:test_a_pull_request_merge_checkout_measures_from_the_merge_commits_first_parent: resolves to the commit the merge was built on, andgit diff --name-onlyfrom it to HEAD is exactly the PR's one file.test_a_pr_head_checkout_keeps_the_base_it_was_given: HEAD is a merge whose second parent is not the PR head, so the given base is kept.test_a_push_keeps_the_base_it_was_given: apushevent with the same checkout keeps its base._git_envalso drops the host'sGITHUB_EVENT_*variables, so the existing two tests cannot pick up the CI run's own event.The file skips on Windows. I ran it through Git Bash on this Windows host with the skip lifted: branch 5 passed; with the script reverted to
origin/main, the first new test fails (assert <stale base> == <built_on>) and the other 4 pass.Proof: not provable -- other: the changed tests skip on Windows (prove.py's host); negative control above was run by hand through Git Bash
Manual verification
N/A — unit coverage sufficient: the tests drive the real script against a real shallow merge-ref checkout, which is the CI shape.
check_comment_history.py,check_brand_name.py, black/isort/flake8 on the test file andtest_flake_pattern_ratchet.py(68 passed) are clean. The run on GitHub's own runners comes from this PR's CI.Related Issues
Fixes #33167
Sibling sweep
Swept: git grep -n "BASE_REF" -- .github/workflows (every diff-scoped gate that takes a base on a pull_request run)
Sibling: .github/workflows/fast-gate.yml -- changed here -- its eight diff-scoped steps all pass their base through resolve-i18n-base.sh, so they get the same fix
Sibling: .github/workflows/ci.yml -- changed here -- its four resolver calls (frontend-ratchets' i18n and phantom-classes steps, frontend-tests, the e2e render gate) get the same fix
Pattern harvest
Rule candidate: review-prompt
Pattern: a CI diff base taken from github.event.pull_request.base.sha while the job checks out the PR merge ref, whose first parent can be a newer base
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
🤖 Generated with Claude Code