Repository navigation
Commit cd7ea2e
feat(pm): H82 reads claimed card PRs CI cannot see; post-stamped refuses a lone Claim: comment (#36434)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbCxiFE11rsKwyNffJZKYqJs)_
Fixes #36203
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户无感:这是车队内部工具。巡查脚本现在会标出"已认领卡的草稿 PR 有冲突,或推上去后 CI
根本没跑";发评论的工具不再接受单独发出的认领评论,会提示改用连标签一起改的一笔写法。
- 属于"派发为什么会出现疏漏"那张卡的最后两条脚本项(技能文字五条已合入),替席位和卡线程解决"互相等 CI、其实 CI 根本没开跑"的问题。
- 出错最坏是巡查报告多一行或少一行提醒,或某条认领评论被拒、换一种写法重发;不改任何数据,可以直接撤回。
- 无
## What changes
Items 6 and 7 of the card's To do (items 1-5, the skill text, merged in
#36205). Script-only: `scripts/pm/check-half-states.mjs` and
`scripts/pm/post-stamped.mjs`, each with its self-test battery. No skill
text, no ceiling, no workflow.
**Item 6 — new row H82 in the half-state patrol: a claimed card's PR
that CI cannot see.** The release note offered "widen H12/H16 to claimed
drafts, or a new row"; this takes the new row. H16's pinned non-draft
scope stays true for every other PR, H12 (orphan landing of a *ready*
PR) has no meaning on a draft, and the second signal the card asks for
(no Actions ever ran) is a read neither row makes.
- Population: an open PR whose body binds (closing keyword or `Part of`,
H16's extractor) a card the sweep holds under `pm:dispatched` — the
state model's claimed bit, free from the label pages the sweep already
lists. Silent past 30 min by `updated_at` (H16's age proxy), the
card-thread wake rule's own number (`dispatch-runbook.md`, 卡线程: 推后 30
分钟零 Actions、`dirty`).
- Leg 1: a DRAFT with `mergeable_state: dirty`. A non-draft dirty PR
stays H16's row alone, never reported twice.
- Leg 2: any claimed PR, draft or ready, not dirty, whose head answers
`total_count: 0` on `/commits/SHA/check-suites?app_id=15368` (the GitHub
Actions app). The filter is load-bearing: measured on the incident head
`473c7ff4` (PR #35923), the unfiltered read answers 5 suites (deploy
previews, the fleet app) and the Actions-filtered one 0; a head CI ran
on answers 10 Actions suites of 15.
- Reads: the PR row (reused from H16's pass when both want it) and one
check-suites page, for candidates only. A failed PR-row read drops that
PR, all-failed rethrows (H16's posture). A failed check-suites read is
UNJUDGED, counted on the summary line, never a zero and never rethrown.
- Registered as a `stall` band row, four count keys on the sweep
contract, one summary clause (`Claimed card PRs (H82): …`) with its
anchor.
**Item 7 — `post-stamped.mjs` refuses a comment whose first keyed line
is `Claim:`** (exit 2, zero writes). The first line after the signature
is read through the patrol's own marker (`CLAIM_COMMENT_MARKER`,
`markerMatches`, so `> Claim:` counts as it does for H2). The refusal
prints the stroke that folds the same comment: `label-write.mjs --issue
N --comment-file PATH --add pm:dispatched --remove pm:queue --assign
LOGIN`.
- Judged in `main` after the route is resolved, deliberately NOT in
`judgeBody`: `judgeBody` is the path `label-write --comment-file` folds
the comment through, and that fold is the remedy.
- One arm is route-aware. `label-write`'s header says `--comment-file`
is RELAY-ONLY and that on a route resolved `direct` the claim goes
"through post-stamped and the labels here, as before". Refusing there
would leave no claim route at all, so on `direct` the claim is still
written, with a stderr note that the labels follow as a second write.
Every other route refuses, an undecidable one included (it cannot prove
the fold absent).
## Tests
<details><summary>Self-tests, at the head that also ran the gates
(6efbcf5)</summary>
- `pnpm check:pm-half-states`: exit 0, `check-half-states self-test:
5420 cases pass`, battery `H82 claimed card PR CI cannot see 24/24` (pin
at the count). Each leg's firing case sits beside the control that
silences it: the dirty draft vs. the same draft clean; H16 silent on the
dirty draft H82 fires on; zero suites vs. an unread (null) reading; a
non-draft dirty PR left to H16 while H16 does fire on it; unclaimed vs.
claimed; the 30-minute boundary; the gate never narrower than the
predicate; band, summary pair, count keys, wiring.
- `pnpm check:pm-post-stamped`: exit 0, `post-stamped self-test: 802
cases pass across 30 batteries` (787 / 29 before). New battery, 15
cases: refused on the relay route and on an undecidable one; the
`direct` control; a `Claim:` quoted further down a round report, a card
body and a non-claim comment pass; the refusal text; **control: the same
claim through `judgeBody` (label-write's fold path) passes**; CLI dry
runs (refused exit 2 off `direct`, rendered exit 0 on `direct`, a
non-claim body exit 0 on the same route); structural placement.
- `pnpm check:pm-label-write`: exit 0, `398 cases pass across 19
batteries` (its fold battery folds a signed `Claim:` through
`judgeBody`).
</details>
<details><summary>Live reads (read-only, this container)</summary>
- Live patrol sweep (`node scripts/pm/check-half-states.mjs`, no flags,
report-only, writes nothing): `Claimed card PRs (H82): PR row read on 15
of 15 open PR(s) bound to a pm:dispatched card and silent past 30 min,
and the Actions check suites read on 15 of 15 head(s) not in conflict.`
No H82 row today: no claimed card PR on the board is currently blind.
- `post-stamped.mjs --dry-run --comment=36203` with a signed claim:
route `dispatch`, exit 2, the refusal naming the fold stroke.
- `label-write.mjs --issue 36203 --add pm:dispatched --comment-file SAME
--dry-run`: exit 0, packed as ONE relay dispatch with the comment,
nothing sent.
</details>
## Acceptance notes
- **Third wake trigger not read.** The runbook's third trigger (2 h with
no push and no report) is still read by nobody mechanically; seat 1's
release note names item 6 as the place to close it. This PR reads only
the two signals the dispatch names (dirty, zero Actions suites).
- **The patrol workflow grants no `checks:` scope.**
`half-state-patrol.yml` lists `contents`, `issues`, `pull-requests`. If
its `GITHUB_TOKEN` cannot read check suites, the runner's leg 2 reads
UNJUDGED (said on the summary line) and leg 1 still runs. Not measured
on a runner, because the workflow is on demand only. The seat-container
sweep, the live consumer, reads them (15 of 15 above).
- **Population is the label, not the claim comment.** "Claimed" is a
bound card under `pm:dispatched`. A label without its claim is H1/H2's
row, and re-reading every bound card's thread would cost requests.
- **Age proxy.** `updated_at`, as H16. A quiet PR whose base just moved
flags at once. A comment on the PR defers the row by one threshold.
## Verification
- Targeted gates (`dispatch-gates --commands`, 70 families, at
`6efbcf556bd`): 68 exit 0. `--ran` reconciliation: 70 derived, 69 run, 1
NOT-MEASURED. NOT MEASURED, `pnpm check:i18n-coverage`, exit 3:
prerequisite not met (no package `dist/` built, and the diff touches no
package). Red locally but NOT MEASURED, `node
scripts/check-self-test-workflow-commands.mjs`: an unrelated child
self-test (`check-adr-0087-registration.mjs --self-test`) runs past its
120 s spawn budget on the shared box (measured 3 min 1 s standalone,
exit 0). CI owns both.
- `overlap-check.mjs`: clean against `origin/main`, 0 PR heads.
**Read first:** `check-half-states.mjs`, the H82 sweep pass after H16's
rethrow (the two read postures). `h82ClaimedPrBlind` (the leg split with
H16). `post-stamped.mjs`, `main`'s `claimStrokeRefusal` call and its
`direct` arm.
**Two-minute check:** `node scripts/pm/post-stamped.mjs --self-test 2>&1
| grep "claim stroke\|refuses the claim"` lists the claim-stroke cases,
every one ✓.
🤖 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 635b0a6 commit cd7ea2e
2 files changed
Lines changed: 374 additions & 1 deletion
0 commit comments