Repository navigation
Commit 5e37a35
feat(pm): label-write --handoff — the seat's Tier H hand-off (comment + pm:awaiting-merge + review request) as one relay stroke (#36214)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbCxiFE11rsKwyNffJZKYqJs)_
Fixes #35948
Clause-②: no
Metadata-protocol: none
Rule-change: yes
## 维护者速读
- 用户能看到什么变化:用户无感。车队内部:座位把需要你批的 PR
交给你时,交接评论、等你合并的标签和给你的审核请求改成一条命令一次完成,并当场回读核对。
- 为什么做:前天有三个需要你批的 PR 只收到评论提醒,没进你的待合并清单和审核队列,空等了约四个半小时;这是座位交接流程的修补。
- 出错会怎样:最坏是某次交接被这条命令拒绝、座位改回手工补写;它不合并、不放行任何东西,可整体撤回。
- 要你做什么:批准本 PR(它改了座位交接流程的条文,按规则须你批)。
## What changes
- `scripts/pm/label-write.mjs --issue PR --comment-file request.md
--handoff` makes the seat's Tier H hand-off (pm-dispatch 〈路径分叉〉 ② and ③)
ONE relay stroke: the request comment, then `labels_add
pm:awaiting-merge`, then `assign` for an approver who is the pull's
author, then `pr_request_reviewers` for every other `GOVERNED_APPROVERS`
account not already requested, assigned or holding a submitted review.
- Refused with zero writes (exit 2) unless:
- `check-governed-merges.mjs --pr OWNER/NAME#N --json` (spawned, so
every split it chains, `Rule-change:` included, is the one reading)
reads Tier H, or the size limb fires, or a narrowing is declared
(`narrowed` route: the queue guard's `narrowingDeclarationsIn` over the
PR body and the head's committed changesets; admitted whatever the
register reads, Tier S included). Tier S, ungoverned and fork pulls are
refused. An unanswered reading is exit 3.
- The newest `## 席位核对` reads ACCEPT and is newer than the head's
committer date (H69's comparison).
gpgsig -----BEGIN PGP SIGNATURE-----
wsFcBAABCAAQBQJrAqPoCRC1aQ7uu5UhlAAAcDkQABanMSL67Qxn6nKK97I3RRME
mrJrr2uOBgXv2AEnydWp7XH26Tp3Hsip9P2TSmV6RxBFDuj64YCCos3y5nS63Iek
UX4IjeA/DdDklofAZcYHpNNbBgkAGf7fhQJI9NzpsLaPhljTqPc/JUuML9L7tEx6
zJptVvvJONR1SGPO7zOdu4VDMe0NlPMqDtszRLbfz+xOiKLeD9fU9uyc32XIlTI+
LkjaHQHZ0m7cZ+wDJDqaYUmauHJ+10Q4mlvnvK4RMiAJQQ2cAifK6lSmFm6qUsgd
YEmmJ0D/IRZrd/V2Ym2sR0z/+co8UHL3oH5rqzDqslO3rPGHafoRe0jN9hoOai1Y
4Ena7K2B7gryXAeDTrx7mscwI+oAjmRS5AUrbLFCX5/r/qMQ+js/t3jfXf32PWNk
DYBm02Kn4OuhKNwCat+W7VhRj2ACRYD4d6hViMxWJb0anpycR6Vf974WTTa7QZCr
KJsT6/8dF9dxQ31fUlh19P5y62W3xi7yqiBpPUBt6E5xXDv7ApMutoUkXXl17xty
DJfk7cSqvXXq6RJ243oxr43fOSCLXLAlvtdlqIV8jxQMA5wPDSxCORlKlDbQjWsZ
RhdY8Z1SiygxKArQgviIiLBTk6Xvi1ZXJUaiEEDeteBWReG6Hd+49ddzUgBfX9U1
qjLD6O4QLkMthm8BiI5W
=wIzx
-----END PGP SIGNATURE-----
- The newest trusted `## Contract review` naming the head reads PASS,
and its `Served-tier:` stands.
- A `## 维护者速读` comment is on the thread, or is the request itself (H48's
brief half).
- Read-back: labels, assignees and comment (the fold's lines), plus `④
reviewers`, `④ H43` and `④ H48`. The last two call the patrol rows
themselves (`h43GovernedReviewRequestGap`,
`h48GovernedVerdictWithoutBrief`) on the pull as read back, using the
tier tool's post-split slice. Any ✗ is exit 4, not repaired.
- `--handoff --dry-run` may omit `--comment-file`. It reads everything,
prints `now H43` / `now H48` for the pull as it stands and the stroke it
would send, and sends nothing. This is the shape chosen for To-do 3: the
per-round reading of a seat's own governed pulls, without a
check-half-states run (over two minutes) and without a new `--rows` mode
there.
- `.claude/skills/pm-dispatch/SKILL.md` 〈路径分叉〉 ③: one line now points at
the command (`同轮一笔 label-write.mjs --handoff 交②③`). The file is 4 bytes
smaller (33863 to 33859, ceiling 33872 unchanged).
Read first, by risk:
1. `scripts/pm/label-write.mjs`, `handoffGate`: the refusal order and
the record readings it reuses.
2. `scripts/pm/label-write.mjs`, `foldStroke`'s `--handoff` hunks: the
action order and the `④ H43` / `④ H48` read-back.
3. `.claude/skills/pm-dispatch/SKILL.md` line 203.
4. `.claude/skills/pm-dispatch/references/execution-duties.md` line 17:
the per-round 四件读数器 now names `label-write.mjs --issue PR --handoff
--dry-run` (exit 7 = a piece is missing) in place of the full
`check-half-states.mjs` run; rewritten in place, 20148 to 20143 bytes,
ceiling unchanged.
## Tests
<details><summary>label-write self-test at 27e6000: 398 cases across 19
batteries, exit 0 (was 339 across 18)</summary>
The new battery `--handoff: …` is pinned at 59 cases (32 at 26da765, 43
at d513fbc). It shows:
- `--handoff` writes all three in one dispatch, in this order: `comment`
→ `labels_add` → `assign` → `pr_request_reviewers`.
- The author-approver is ASSIGNED and never requested.
- Control: the fixture pull fires BOTH H43 and H48 before the hand-off,
and the same row functions read `null` on the board after it.
- Refusals with zero sends, one each: Tier S, ungoverned, a PASS on an
older head, no PASS, a same-head FAIL, a PASS whose Served-tier does not
stand, an untrusted PASS author, REWORK, an ACCEPT older than the head,
no brief, an issue, a closed pull, an unsigned request, and the direct
route.
- An unanswered tier reading is exit 3.
- Idempotence: a covered approver, or the label already on, costs no
action.
- A relay that skips a part reads `④ reviewers ✗` / `④ H43 ✗` or `④
labels ✗` / `④ H48 ✗`, exit 4.
- The dry run sends nothing, both before and after the hand-off.
- SKILL.md carries the pointer and the author-assign rule as substrings.
- Rework at d513fbc. The PASS is read the queue guard's way, over the
pull AND the card it delivers: a same-head PASS on the card clears the
gate; the same PASS by an untrusted author is refused; a pull that
delivers no card does not read the card. The size-limb face: a code-only
size-limb pull is judged on the declaration face (a TIER_DEFAULT PASS is
handed off, a CONTRACT_REVIEW_TIER PASS is refused); a committed
changeset declaring `(narrowing)` moves the face. The register's own
slice is empty on that pull and both rows read null; the hand-off slice
fires both rows before the hand-off and reads null after. A pull already
whole sends nothing. A request signed by an uncovered approver is
refused.
</details>
<details><summary>Ablation, one-time, at 26da765, through
scripts/ablation-replace.mjs (restore verified: blob == HEAD, git diff
HEAD empty)</summary>
- `handoffReviewPlan` made to request the author (`toRequest: missing,
toAssign: []`): the self-test went red on 3 cases (the plan, the stroke
and the author-assigned case), then was restored.
- The `!handoff.passed` refusal disabled: the self-test went red on the
same-head FAIL case (exit 0 and one send instead of exit 2 and zero),
then was restored.
- At d513fbc: `handoffSlice` made to ignore the size limb went red on 2
cases; the card thread read as empty went red on the card-PASS case; the
changeset texts dropped from `declaredOn` went red on the narrowing-face
case. Each restored (blob == HEAD, `git diff HEAD` empty).
</details>
A read-only check of the spawn half on a merged pull: `readGovernedTier`
on objectstack-ai/objectstack 35610 answered exit 3, Tier H, 5 matched
rows. Per the dispatch, `--handoff` itself was never run against a real
pull.
Round 3 at 27e6000 (contract review 7075527312 FAIL at d513fbc): M1 a
declared narrowing is a hand-off population (`narrowed` route,
CONTRACT_REVIEW_TIER face), control: `none` refused; S1 a deleted or
renamed-away changeset (404 at the head) declares nothing, any other
failed read is exit 3, the Tier H route reads no changeset; S2 "already
handed off" needs a `## 维护者速读` on the thread, else a comment-only stroke
goes out; S3 `reviewFace` gets every pre-lift path (hit, clear,
exceptions) and, on the size route, `narrowingDeclared` and the
changeset texts; N1 the guard's `LOW_RISK_CHANGESET_PATH` is reused; N4
`--handoff --dry-run` exits 7 while a `now` row reads ✗. Ablations (each
restored, blob == HEAD): M1 red on 7, S2 on 2, S1 on 1, S3a and S3b red,
N4 red, tier-route read red on 1.
## Acceptance notes
- Mechanism readings, measured against origin/main `cbd582f4`:
- `--land` does NOT read ACCEPT + same-head PASS. Its only gate is the
dogfood battery gate. The reading lives in `check-half-states.mjs`
`h43HandoffReading`, which this mode calls.
- `fleet-write/execute.mjs` `governedReviewPlan` is not reused. Since PR
#36215 (`b78b14cc`, Part of #35612) it chains the `.claude/**` split
too, but this mode still takes its tier from `check-governed-merges
--pr` and its coverage union from H43's own reading, so there is one
reading for both, not two kept in step. (Earlier text here called that
split missing; it was true when written and is not on `main` now.)
- For the same reason, H43 and H48 on a full patrol run still stand down
on such a pull. `--handoff`'s read-back asks the same rows on the tool's
post-split slice, so they judge it.
- The seat's own account is not excluded from the request:
`GOVERNED_APPROVERS` holds only the maintainer's account today. A seat
whose login is in that set would be requested.
- `execution-duties.md` line 17 is now in this PR (the review would not
accept "noted, not filed"): the card's To-do 3 pointer.
- New exit code 7 (`EXIT_HANDOFF_OWED`) for the dry run only, declared
in the header's exit-code table.
## Verification
Two minutes: `node scripts/pm/label-write.mjs --self-test` should print
`✓ label-write self-test: 398 cases pass across 19 batteries`.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01QsR2jTeURPvEm465RcoYEC
<!-- signed: repo:objectstack#7 · zhuangjianguo ·
session_01QsR2jTeURPvEm465RcoYEC -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 0f29688 commit 5e37a35
3 files changed
Lines changed: 696 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | | - | |
| 203 | + | |
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
0 commit comments