Repository navigation
fix(pm): label-write --handoff hands the PASS reader a git reader and the base ref - #37032
Conversation
… the base ref A PASS carried from an older head by a `Regen-provenance:` line is re-tested by the queue guard's own `regenCarry`, which needs `pair.runGit` and `pair.baseRef`. The hand-off built its pair with neither, so every carried PASS read as unreadable and a valid record refused the hand-off. The pair now carries this checkout's git (args + stdin, throws on failure; none when the pull's repository is not this checkout's origin) and the pull's own `base.sha`, the base `check-governed-merges.mjs --pr` and the guard's pull_request leg hand the same reader. The `--dry-run` reading goes through the same gate. Nine self-test cases cover the carry both ways, the unreachable tree, the missing reader and base, and the reader's stdin. Claude-Session: https://claude.ai/code/session_01J8VVAm5Tp3iBkiJk6nMwa5 Co-Authored-By: Claude <noreply@anthropic.com>
|
repo:objectstack#2 · huangyiirene · session_01J8VVAm5Tp3iBkiJk6nMwa5 Final green head for L1: |
|
repo:objectstack#2 · huangyiirene · session_01J8VVAkBhKxchpbbRXtA3Mf L1 review · ACCEPTHead-sha: 席位核对
席位意见: ACCEPT. |
|
repo:objectstack#2 · huangyiirene · session_01J8VVAm5Tp3iBkiJk6nMwa5 Landing · f2-C
Status: L1-a ACCEPT 7139378974 on this head, all checks green (25 success · 24 expected skip · 0 failed); ready + auto-merge now. |
Requested by Irene · project thread
Fixes #36537
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
scripts/pm/label-write.mjs --handoff(and its--dry-runper-round reading) now hands the queue guard's PASS reader the two things itsregenCarryneeds to judge a PASS carried from an older head by aRegen-provenance:line:runGit—handoffGitReader(repo): this checkout's git (checkoutGit: argv plus optional stdin, stdout back, throws on any failure), the shapecheck-governed-queue-guard.mjspasses. It is null when the pull's repository is not this checkout'sorigin, ascheck-governed-merges.mjs --prhands none outside its own checkout; the guard's reader then reads the carry as a gap (exit 3), never as clean.baseRef— the pull's ownbase.shafrom the same pull read, null when it is not a full sha.The injectable seam is
handoffDeps.gitReader(defaulthandoffGitReader); the self-test'sdriveOfflinedefaults it to "no reader", so the suite stays offline. No regen-carry logic is re-spelled here:record-recognisers.mjsdecides, and its pins (no reader is unreadable, no base ref is unreadable, an unreachable tree is unreadable) are untouched.Why
The card: the hand-off built its
pairwithoutrunGitorbaseRef, so every carried PASS read "this run holds no git reader" and a valid record refused the hand-off (measured on PR #36509).Which base ref, measured. Real trees of PR #36509 (old head
4342cf009, merge-of-main headbf71994326, second parent0b2118f4), through the guard's ownunexplainedPathsBetween/regenCarryagainst this checkout:regenCarrypull.base.sha=0b2118f4(the merged main)carried, record 7083451259e4e3bcfe, what a staleorigin/mainwould hold)refusedorigin/mainin this shallow checkoutunreadableunreadable, "holds no git reader"base.shais an immutable commit from the same pull read, and the base--prand the guard'spull_requestleg hand the same reader. A remote-tracking ref is shared by every worktree and may be stale, and a stale base turns main's carry-over into "hand edits". If the checkout lacks that commit,merge-basethrows and the guard reads it as unreadable with its own fetch hint, so it is never carried.Tests
node scripts/pm/label-write.mjs --self-testat head4c0570e0:✓ label-write self-test: 407 cases pass across 19 batteries(was 398). The--handoffbattery gains nine cases and its pin goes 59 → 68:Regen-provenance:, fake git clean (main broughtAGENTS.md, the pull touched nothing hand-written) ⇒ records ✓, handed off, exit 0; plus a check that the reader'smerge-basegotbase.sha;--dry-runreads the carried PASS through the same reader (records ✓, exit 7, nothing sent);handoffGitReaderorigin matching (spelling and case, another repository gives null, an unreadable remote gives null), and the realcheckoutGithands git its stdin (check-attr --stdinanswersos-regenfor a literal.gitattributesrow).Red before the fix, and three ablations after it
Before the implementation (tests in place, fix absent):
✗ label-write self-test: 7 of 406 case(s) failed. Case 1 readgot [3,0,false,false], want [0,1,true,true]with② PREREQUISITE NOT MET — PR #7's Regen-provenance: chain — this run holds no git reader.After committing the fix, each mutation went through
scripts/ablation-replace.mjs(the anchor hit on disk, restored blob equal to HEAD,git diff HEADempty):runGitchanged torunGit: nullin the pair ⇒ 6 of 407 failed;baseRefchanged to'origin/main'⇒ 2 of 407 failed (the base-sha check and the no-base control);inputremoved from thecheckoutGitspawn ⇒ 1 of 407 failed (the stdin case).Acceptance notes
scripts/pm/label-write.mjs. The guard instruments were read but not edited.--pr. Run it from that repository's checkout.record-recognisers.mjs, so this PR leaves it alone.scripts/pm/**publishes nothing from any released package, so this PR carriesskip-changeset.Verification
Read first: the
pairline inhandoffGate(the risk hunk:runGitandbaseRefadded),checkoutGit/handoffGitReaderabove it, then theR1cases in the--handoffbattery.Two-minute check:
node scripts/pm/label-write.mjs --self-test. Expected output:✓ label-write self-test: 407 cases pass across 19 batteries.Local gates at 4c0570e
node scripts/pm/dispatch-gates.mjs --commandsderived 64 commands. Each ran with its exit code captured before any pipe. 63 exited 0.pnpm check:i18n-coverageexited 3 (PREREQUISITE NOT MET: no builtdist/for the configs it lints; it does not readscripts/pm; left to CI).dispatch-gates --ran:64 derived famil(ies) accounted for — 63 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3). Also:overlap-checkVERDICT clean exit 0;check-commit-card-trailers --range origin/main..HEAD✓.Human Minimum
packages/specholds no runtime logic. (not touched)pnpm lintis left to CI.main, one pull request.skip-changeset; both declaration lines are above.packages/specnot touched.🤖 Generated with Claude Code
https://claude.ai/code/session_01J8VVAm5Tp3iBkiJk6nMwa5