Skip to content

fix(pm): label-write --handoff hands the PASS reader a git reader and the base ref - #37032

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-wn0hqz
Nov 24, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-wn0hqz

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Irene · project thread
Fixes #36537
Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:用户无感;席位在合入主干后把受管 PR 交给维护者时,已由重生成说明续管的审核记录不再被误拒。
  • 为什么做:车队交接工具的缺陷——交接时读不到合法的重生成续管记录,席位只能多请一轮审核。
  • 出错会怎样:最坏是交接被拒(与今天相同),不会把没审过的改动交给维护者;可直接撤回。
  • 要你做什么:无。

What changes

scripts/pm/label-write.mjs --handoff (and its --dry-run per-round reading) now hands the queue guard's PASS reader the two things its regenCarry needs to judge a PASS carried from an older head by a Regen-provenance: line:

  • runGit — handoffGitReader(repo): this checkout's git (checkoutGit: argv plus optional stdin, stdout back, throws on any failure), the shape check-governed-queue-guard.mjs passes. It is null when the pull's repository is not this checkout's origin, as check-governed-merges.mjs --pr hands 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 own base.sha from the same pull read, null when it is not a full sha.

The injectable seam is handoffDeps.gitReader (default handoffGitReader); the self-test's driveOffline defaults it to "no reader", so the suite stays offline. No regen-carry logic is re-spelled here: record-recognisers.mjs decides, 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 pair without runGit or baseRef, 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 head bf71994326, second parent 0b2118f4), through the guard's own unexplainedPathsBetween / regenCarry against this checkout:

base handed unexplained paths regenCarry
pull.base.sha = 0b2118f4 (the merged main) 0 carried, record 7083451259
a base older than the merge (e4e3bcfe, what a stale origin/main would hold) 14 (main's own files read as hand edits) refused
origin/main in this shallow checkout git throws unreadable
none (before this change) n/a unreadable, "holds no git reader"

base.sha is an immutable commit from the same pull read, and the base --pr and the guard's pull_request leg 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-base throws 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-test at head 4c0570e0: ✓ label-write self-test: 407 cases pass across 19 batteries (was 398). The --handoff battery gains nine cases and its pin goes 59 → 68:

  1. a PASS on an older head carried by Regen-provenance:, fake git clean (main brought AGENTS.md, the pull touched nothing hand-written) ⇒ records ✓, handed off, exit 0; plus a check that the reader's merge-base got base.sha;
  2. the same chain with the pull's own hand-written path ⇒ no same-head PASS, refused, exit 2, zero sends;
  3. a git reader that throws ⇒ PREREQUISITE, exit 3, zero sends, with the guard's fetch hint;
  4. no reader ⇒ the guard's "holds no git reader" gap, exit 3; no base sha ⇒ the "base ref" gap, exit 3;
  5. --dry-run reads the carried PASS through the same reader (records ✓, exit 7, nothing sent);
  6. handoffGitReader origin matching (spelling and case, another repository gives null, an unreadable remote gives null), and the real checkoutGit hands git its stdin (check-attr --stdin answers os-regen for a literal .gitattributes row).
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 read got [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 HEAD empty):

  • runGit changed to runGit: null in the pair ⇒ 6 of 407 failed;
  • baseRef changed to 'origin/main' ⇒ 2 of 407 failed (the base-sha check and the no-base control);
  • input removed from the checkoutGit spawn ⇒ 1 of 407 failed (the stdin case).

Acceptance notes

  • The changes are in one file: scripts/pm/label-write.mjs. The guard instruments were read but not edited.
  • On a sibling-repository pull (the run's checkout is not that repo), the hand-off still reads a carried PASS as unreadable ("holds no git reader"). That matches --pr. Run it from that repository's checkout.
  • When the base commit is missing, the guard's fetch hint names the pull head and the old head but not the base. That text belongs to record-recognisers.mjs, so this PR leaves it alone.
  • No changeset: scripts/pm/** publishes nothing from any released package, so this PR carries skip-changeset.

Verification

Read first: the pair line in handoffGate (the risk hunk: runGit and baseRef added), checkoutGit / handoffGitReader above it, then the R1 cases in the --handoff battery.

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 --commands derived 64 commands. Each ran with its exit code captured before any pipe. 63 exited 0. pnpm check:i18n-coverage exited 3 (PREREQUISITE NOT MET: no built dist/ for the configs it lints; it does not read scripts/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-check VERDICT clean exit 0; check-commit-card-trailers --range origin/main..HEAD ✓.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (not touched)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint is left to CI.
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. Publishes nothing: skip-changeset; both declaration lines are above.
  • 6. packages/spec not touched.
  • 7. No hand edits to generated docs, changelogs or release notes.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_01J8VVAm5Tp3iBkiJk6nMwa5

… 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>
@objectstack-fleet objectstack-fleet Bot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Nov 24, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · huangyiirene · session_01J8VVAm5Tp3iBkiJk6nMwa5

Final green head for L1: 4c0570e0f921e72d82d970b460e3723d497319ae
Checks at that head: 25 success · 24 expected skip · 0 failed · 0 pending (pr-state.mjs --pr 37032); check-expected-skips.mjs --pr 37032: OK, exit 0. mergeable_state clean.
Diff: scripts/pm/label-write.mjs only, +88/−8; not a governed path, no guard instrument edited. Review route: L1-a (over 50 lines).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · huangyiirene · session_01J8VVAkBhKxchpbbRXtA3Mf

L1 review · ACCEPT

Head-sha: 4c0570e0f921e72d82d970b460e3723d497319ae · read 2026-11-24T17:33Z

席位核对

  1. 形态. l1-face.mjs --pr 37032 at 4c0570e0f9: 13 items read, none flagged. It is a draft against main. The first line is Fixes #36537, and merging delivers the whole card: the card asks that a PASS carried by Regen-provenance: stop reading "holds no git reader", and nothing else. No closing keyword sits next to another card number (read by eye as well). Clause-②: no · Metadata-protocol: none. One file, scripts/pm/label-write.mjs, inside the f2-C lease. skip-changeset is right because no published package is touched. The mergeable_state read came back unknown once, so it is not counted as a reading.
  2. 前提实测. I re-ran the guard's own unexplainedPathsBetween on PR fix(service-analytics): list_datasets asks nothing when a word that falls back stands beside a grouping word #36509's real trees, from 4342cf00921f to bf7199432678, through this PR's checkoutGit. With base = the pull's base.sha 0b2118f49c0f, 0 paths are unexplained, so the record carries. With a base 3 commits older (e4e3bcfe73), main's own files read as hand edits. That matches the PR's table, and it is why the base is base.sha and not a remote-tracking ref. Provenance shas are hex-fenced by REGEN_PROVENANCE_LINE ([0-9a-fA-F]{7,40}) before they reach git, and spawnSync runs without a shell, so no comment text can become a git option. The reader is null when origin is another repository, which matches check-governed-merges --pr. No regen logic is spelled out again here: regenCarry decides.
  3. 门禁 check-runs. At 4c0570e0f9: 25 success, 24 expected skip, 0 unexpected skip, 0 failed, 0 pending. Lint & Repo Gates and TypeScript Type Check both success. I re-ran label-write.mjs --self-test on the head: 407 cases pass across 19 batteries. The new cases cover both directions: carried when clean, refused on a hand-written path, unreadable when the reader throws, when there is no reader and when there is no base sha. One case pins the real reader passing STDIN to check-attr. The ablations in the body each turn their own cases red.
  4. 接受的偏差. None to accept. The fetch hint of the missing-base case names no base. The PR leaves that text alone because record-recognisers.mjs owns it, outside this lease. I accept that.
  5. 范围外去向. None filed. Skills-docs: not owed (kind none). check-governed-merges --pr 37032: NOT governed, 96 changed lines.
  6. 落地条款. L2 is not owed: no Clause-②: yes, no narrowing, no published schema, no governed rule text, so CI and this read are the whole review. Non-governed Tier S: f2-C lands it per landing-operations.md. Fixes closes label-write --handoff cannot read a Regen-provenance carry: the PASS reader is given no git reader #36537 on merge.

席位意见: ACCEPT.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · huangyiirene · session_01J8VVAm5Tp3iBkiJk6nMwa5

Landing · f2-C

Probe Reading at 4c0570e0f921e72d82d970b460e3723d497319ae
check-governed-merges.mjs --pr 37032 NOT governed · 96 changed lines (+88/−8) ≤ 3000
landing-k.mjs --pr 37032 K = 12 < 15 (PRBASE a73edb3) · no locale pack · no shared book moved

Status: L1-a ACCEPT 7139378974 on this head, all checks green (25 success · 24 expected skip · 0 failed); ready + auto-merge now. Fixes #36537 closes the card on merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s skip-changeset PR has no user-facing published change; bypasses the changeset gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

label-write --handoff cannot read a Regen-provenance carry: the PASS reader is given no git reader

2 participants