fix(gates): stop an eager-closure approval from turning main red on merge - #2375
Merged
Conversation
…erge `no APPROVED_OVER_CEILING row is stale` reads the introduced-entry set, which is derived from `git merge-base origin/main HEAD`. On a push to main the merge-base IS the head, so nothing is first-introduced and every approval row reads as stale whatever its real state. That is exactly the shape of the approving PR's own merge commit: #2329 added the `packages/command-registry/src/planned-operations.ts` row to merge, and the merge that followed it called the row dead. Coverage has been red on main since (run 34099687663), and every branch cut from main after it inherits the same failure. - `staleApprovalRows` makes the verdict a named rule and defers it when the merge-base is the head, where no row is readable at all. Enforcement is not lost: a row that outlives its PR is still reported on the first branch whose merge-base could have read it, and the rule is pinned in both directions. - The `planned-operations.ts` row goes, which is what the rule asks for now that main carries the entry: its closure (74) is governed by the no-growth rule from here on, not by the domain-facade ceiling. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SfQqXj7JKQVgBA8eg9SMVB
Size Report
Startup median (7 runs, lower is better):
|
Member
Author
|
Reviewed d920f2. The main-branch deferral fixes the false stale-approval failure while subsequent branches still reject obsolete approvals. The regression covers both directions, and all checks pass. Ready for human review; this also includes the removal in #2373. |
|
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.
The failure
Coverage is red on
main(run 34099687663), one test:Why it fires, and why it was guaranteed to
The staleness rule reads
introduced, which is derived fromgit merge-base origin/main HEAD. On a push tomainthe merge-base IS the head, so no entry is first-introduced — and everyAPPROVED_OVER_CEILINGrow reads as stale whatever its real state.That is exactly the shape of the approving PR's own merge commit. #2329 had to add the
planned-operations.tsrow to merge (its closure is 74, over the domain-facade ceiling of 20), and the merge that followed it was the run that called the row dead.mainhas been red since, and every branch cut frommainafterwards inherits the same failure — so this is not one bad row, it is a rule that cannot be satisfied by any approval.The fix
staleApprovalRowsmakes the verdict a named rule ineager-closure-budgets.tsand defers it when the merge-base is the head, where no row is readable at all. Enforcement is not lost: a row that outlives its PR is still reported on the first branch whose merge-base could have read it.planned-operations.tsrow goes, which is what the rule asks for now thatmaincarries the entry — its closure is governed by the no-growth rule from here on, not by the ceiling.headCommitjoinsmergeBaseWithMainincommitted-source-tree.ts, the one owner of that git question.Validation
Both directions proven against the real tree, not just the unit rule:
main)packages/does-not-exist/src/gone.tsscripts/__tests__/eager-closure-budgets.test.ts: 479 passed (was 1 failed / 478).NEW_ENTRY_CEILINGS, so the deferral cannot silently swallow a genuinely stale row.test:coverage:ci,check:coverage-changed:test,check:tmpdir-leaks, plusformat:check,lint,typecheck,check:fallow.durable-captureadoption tests fail in my container both with and without this change, and passed on CI ate7a5b8b— they chmod a path unwritable and this sandbox runs as root, which ignores permission bits. Not touched by this PR.Co-Authored-By: Claude Opus 5 noreply@anthropic.com
🤖 Generated with Claude Code
https://claude.ai/code/session_01SfQqXj7JKQVgBA8eg9SMVB
Generated by Claude Code