Repository navigation
run-ci-tests --affected: rebuild unlanded derived files before the suites, as CI does - #2430
Merged
Merged
Conversation
…ites, as CI does The pre-push hook runs `run-ci-tests.sh --affected`, but CI runs `regen-unlanded.sh origin/main` before any gate (ci.yml "Regenerate derived files"). Lane PRs do not commit INDEX*.md, SHA256SUMS or size rows, so a PR that adds a script failed low-context-index.sh locally (STALE INDEX.md) and passed in CI. --affected now runs `regen-unlanded.sh origin/main` (CI's ref, not the push BASE: an older BASE after a land would skip the rebuild) after selection and before the suites. It snapshots the working tree (lkg.py tree) first and hashes the rebuilt tree after. It then restores every file that differs between the two whose bytes are still the rebuild's, before the receipt is hashed and again from the EXIT trap. An already-dirty file keeps its edit, a file the rebuild created is removed, and a file edited after the rebuild is kept with a note. TERM/INT during the rebuild is deferred until it exits, then the EXIT trap restores (it re-hashes the tree when the signal came before the post-rebuild hash). Selection, the privacy scan and the receipt tree are the pre-rebuild tree; --list-affected stays dry. No regen-unlanded.sh or no tree hash: no rebuild (old behavior). Verified: test-run-ci-tests-affected.sh 30/30 (5 new cases: rebuild against origin/main, exact restore, dry --list-affected, edit-after-rebuild kept, TERM during the rebuild; the rebuild, edit-after-rebuild and TERM cases fail on the old runner, 27/30 there; exact restore and dry --list-affected are guards that pass on both), bash -n, shellcheck no new warnings. The previous revision also passed a real run-ci-tests.sh --affected (13 suites, incl. low-context-index.sh with a new script present). Tests: 30/30 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ved files Three follow-ups to the pre-suite rebuild of derived files: - Compare against the merge-base of HEAD and origin/main instead of origin/main. CI rebuilds on its merge ref, whose VERSION is origin/main's, so a branch cut before the latest land must still count as unlanded locally. With no merge-base, origin/main is used as before. - land-release.sh --regen now runs before the land lock is taken. A rebuild writes only its own worktree, so a land in progress or a leftover lock no longer fails every push in every worktree. - The post-suite restore only touches paths that match GENERATED in land-release.sh (read the same way train_land.sh reads it). Any other file changed while the rebuild ran keeps its new bytes. Each fix has a regression case that fails with that fix reverted. Tests: 43/43 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
run-ci-tests.sh --affectednow rebuilds unlanded derived files before the suites, comparing against the merge-base of HEAD andorigin/main, the same way CI does. A lane PR that adds a script no longer failslow-context-index.shlocally (STALE INDEX.md) while passing in CI.Why
The pre-push hook runs
--affected, but CI runsregen-unlanded.sh origin/mainbefore every gate. Lane PRs never commit INDEX*.md, SHA256SUMS or size rows, so the local gate and CI disagreed on any PR that adds a file.What changed
scripts/run-ci-tests.sh: after selection and before the suites,--affectedrunsregen-unlanded.sh origin/main. If the ref is stale or missing, it skips the rebuild and checks strictly (fail-closed).--list-affectedstays dry.scripts/test-run-ci-tests-affected.sh: 5 new cases. Three of them (rebuild, edit after rebuild, TERM) fail on the old runner, which passes 27/30. The other two (exact restore, dry list) are guards and pass on both.Review
An independent review found 0 🔴 and 2 🟡: a signal during the rebuild, and a rebuild against a stale base. Both are fixed, and a re-review of the amend found 0 🔴 and 0 🟡. A second independent review of the PR found 0 🔴 and 3 🟡, all now fixed in 0902751, each with a test that fails when its fix is reverted:
origin/mainand skipped the rebuild. It now compares at the merge-base, matching CI's merge ref.land-release.sh --regentook the land lock, so every pre-push failed during a land or after a crash that left the lock behind.--regennow runs before the lock.GENERATEDinland-release.sh, which is read from that file rather than copied.One 🔵 is logged for a follow-up: a SIGKILL during the rebuild leaves the derived files dirty.
Tests
Tests: 43/43 (test-run-ci-tests-affected.sh, test-land-release.sh).
bash -npasses, with no new shellcheck warnings and 0 privacy-grep hits.CI-parity pre-push on 0902751:
scripts/run-ci-tests.sh --affectedran 26 suites with 0 failures.Rollback
A single
git revert:--affectedgoes back to skipping the rebuild.🤖 Generated with Claude Code