Repository navigation
Commit 27298b8
pm: the low-risk arm reads the record's Security-touching line and the card's security label; absent is Tier H (#34133)
Fixes #33601
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9EjHJNDm9zkroCRfi1hziRF)_
Clause-②: no
Metadata-protocol: none
## 维护者速读
- **改了什么**:低风险技能臂(技能措辞、只增的 ADR 注记可免人工批准落地)落地前多读两样:复核记录里一行
`Security-touching: no`,以及 PR 点名的每一张卡片(关闭关键字、`Part of`、`Refs`
指向的卡,和分支名对应的卡)有没有、或曾经有过 `security` 标签。缺行、读不出、不是 `no`、任一张卡带过该标签、另外点名的卡超过
8 张,一律回到 Tier H 等人批。
- **为什么改**:此前臂只看 PR 自身(路径、正文声明行、PR
上的标签),「这次改动教不教安全行为」没有人明文表态;现在由复核者在记录里明说,没说就按最严处理。
- **风险与回滚**:只收紧不放宽,最坏是本可免批的措辞 PR 多等一次人批。在途的臂 PR 需复核者重贴带该行的记录才回 Tier
S。回滚即 revert 本 PR,无数据迁移。
- **先看**:① `scripts/pm/check-governed-merges.mjs` 的 `lowRiskArmVerdict`
尾部(记录阶段)与 `readArmLanding`(事后巡检只对带规则的落地套用);②
`scripts/pm/check-governed-queue-guard.mjs` 的 `readLowRiskRecordStage` 与
`readCardLabels`;③ `scripts/pm/check-half-states.mjs` 的
`contractReviewRecordReading`。
- **两分钟验证**:`node scripts/pm/record-recognisers.mjs --template`,预期模板里
`Scope:` 的下一行是 `Security-touching: yes`(不改就粘贴即按最严处理)。
- **需要你做的**:无,席位达档复核后落地。
## What changes
The low-risk skills arm (`lowRiskArmVerdict`) gains a **record stage**,
read last and only when every pull-read condition already holds. It is
two conjuncts:
1. the contract-review record of record on this head carries exactly one
bare `Security-touching: no` line. The line reads when it is bare,
behind a list bullet, in bold, or with its value alone in a code span.
An absent line, an unreadable one and `yes` are each Tier H with the
reason printed. Unreadable shapes: two lines, a quoted line, a fenced or
code-indented line, the key inside a code span (the spelling prose uses
to mention the line), trailing words, any other value, a near-miss key;
2. no card the PR names carries the `security` label or ever had it
removed (each card's labels and its timeline). The cards a PR names are
every closing-keyword target, every `Part of` target, every `Refs`
target and the card its branch is named for. A PR that names no card, a
card that could not be read, a reading that does not say it read the
other cards, and a PR that names more than eight cards beyond the first
are each Tier H; past that limit nothing more is read.
The verdict now says how far the stage got (`recordStage`:
`not-reached`, `pending`, `read`). A reading that hands in no stage
never answers Tier S: with every pull-read condition holding it reads
Tier H on one reason, `pending`, and the caller reads the stage and asks
again. No stand-in read answers the stage.
By file:
- `scripts/pm/check-half-states.mjs`: `contractReviewRecordReading`
returns `securityTouching` (`missing`, `read` with `no` or `yes`, or
`unreadable` with its reason), beside the existing recognisers. The key
and its two values are exported once.
- `scripts/pm/record-recognisers.mjs`: `--template` prints
`Security-touching: yes` under `Scope:` (an unedited paste fails
closed), the legend says when `no` may be written, and the review brief
hands the reviewer the line. It re-exports the reader's key and values.
`namedCardNumbers` lists every card a pull request names.
- `scripts/pm/check-governed-merges.mjs` (the register): the stage in
`lowRiskArmVerdict`, judged over the first card and every other named
card; `--pr` reads it through `pullRecordStage`; the post-merge sweep
reads it in `readArmLanding`, with each card's labels rebuilt as they
stood at the landing (`cardLabelsAsLanded`), and only for a landing
whose own tree carries the stage (`armRecordStageBound`).
- `scripts/pm/check-governed-queue-guard.mjs`: one reader for every
site, `readLowRiskRecordStage` (threads through `readRecordThreads`, the
line through `lowRiskRecordStage`, the cards through `readCardLabels`
and `makeLabelReader`). `readCardLabels` reads the first card as before
and every other named card under `others`, up to
`LOW_RISK_NAMED_CARD_LIMIT` (8). The queue leg reads the stage for an
arm entry nothing else cleared. `makeTimelineReader` now follows the
`Link` header past a short page.
- `scripts/pm/fleet-write/execute.mjs` (the relay): `lowRiskReadingFor`
reads the stage before `governedReviewPlan` decides to request nobody,
so `pr_ready` on an arm PR whose record lacks the line, or that names a
labelled card, requests the approvers as for any Tier H pull request.
- `.claude/skills/pm-dispatch/references/contract-review.md`: one line
now names the `Security-touching:` line next to the independence pair
and points at `--template` for the values. Same line count (63), same
file family. The words that line gave up are the two key spellings
`Implemented-by:` and `Reviewed-by:`, which stay spelled in
`references/lanes/review.md` and in the `--template` output.
Where the arm is read, and what each site answers:
| Site | Reader | An arm PR whose record lacks the line | An arm PR that
names a second card carrying `security` |
|:--|:--|:--|:--|
| queue guard | `readLowRiskTier` with the stage from
`readLowRiskRecordStage` | Tier H: the entry is refused unless an
authorized approval or enqueue cleared it | the same |
| relay, on `pr_ready` | `lowRiskReadingFor` | Tier H: the approvers are
requested | the same |
| `--pr N` | `pullRecordStage` | Tier H with the reason | Tier H, both
cards read |
| post-merge sweep | `readArmLanding` | BREACH on the record stage, for
a landing whose tree carries the stage | BREACH when the label stood at
the landing; a label added afterwards is not one |
At the sweep, a landing that names more cards than the leg reads is a
stage BREACH (the queue counted the same names and refused it), and
another named card that cannot be read is NOT MEASURED.
## Why
The arm lands a pull request with no human approval, on what the pull
request itself shows: its paths, its body's declaration lines, its
labels and its changesets. Whether the change teaches security behaviour
was nobody's written statement: the seat was expected to add the
`security` label, and a forgotten label read as clean. The record is the
one artefact a reviewer at the review tier writes on the head, so the
statement belongs there, and its absence has to read as the strictest
answer. The card's label is read as well, as the card asks: a label put
on the card is not inherited by a pull request opened later. Every named
card is read, not only the one the delivery relation ranks first,
because a `Part of` card beside a closing-keyword card, or the card a
branch is named for, can carry the label too.
## Tests
Self-tests on the head `13c0c84ffe4f15a9fd50d8588c46f61f9f122c6c`, all
exit 0:
| File | Result | Battery floors moved by this PR |
|:--|:--|:--|
| `check-half-states.mjs` | 5293 cases | `H43 hand-off timing` 88 to 103
(94 for this PR's rows, then 103 for the nine verdict-reader rows `main`
added with no pin; the battery registers 126) |
| `record-recognisers.mjs` | 430 cases | template 32 to 38, thread set
19 to 22, letter-C scope 22 to 24 |
| `check-governed-queue-guard.mjs` | 581 cases | arm at the queue 54 to
84, ADR leg at the queue 12 to 14, enqueue leg 28 to 30 |
| `check-governed-merges.mjs` | 908 assertions | arm 74 to 100, sweep 51
to 71 |
| `fleet-write/execute.mjs` | 424 cases, 30 batteries | governed review
45 to 52 |
### Forced test edits (named)
Each of these rows pinned Tier S, a reading shape or a wording that this
PR changes by design.
- `check-half-states.mjs`:
- the row that pins the template record's whole reading as JSON (`… the
template record reads one PASS, no FAIL, no grade`) gains
`"securityTouching":{"state":"missing"}`.
- the row for the one bare line read behind a bullet, in bold or in a
code span now says the VALUE alone may sit in a span; its
whole-line-in-a-span sample moved to the new unreadable row.
- `record-recognisers.mjs`: the template-legend row expects the legend's
new wording.
- `check-governed-queue-guard.mjs`:
- `⛔ CONTROL:
the-same-skills-PR-with-NO-record-is-REFUSED-Tier-S-without-its-record`
is now `…-REFUSED-Tier-H-on-the-record-stage`: with no record the arm
itself reads Tier H.
- `⛔ a-record-on-an-OLDER-head-is-REFUSED` is now
`…-REFUSED-Tier-H-its-line-does-not-carry-forward`.
- `⛔
a-recogniser-set-without-the-verdict-reader-REFUSES-the-arm-fail-closed`
is now `⛔
a-recogniser-set-without-the-record-reader-REFUSES-fail-closed-the-arm-at-Tier-H-every-other-Tier-S-leg-on-its-verdict`.
- the two `⛔ SF1-a-record-carried-over-a-hop-…` rows (rewritten
changeset, moved catalog text) keep their names and are re-pinned to
Tier H with no record read.
- `⛔ CONTROL:
the-same-ADR-note-with-NO-record-is-REFUSED-Tier-S-without-its-record`
is now `…-REFUSED-Tier-H-on-the-record-stage`.
- the arm fixtures' records carry `Security-touching: no`.
-
`readCardLabels-never-throws-and-counts-its-reads-a-card-nobody-could-name-reads-nothing`
hands in the named cards and its reading gains `others`;
`readLowRiskRecordStage-derives-the-card-…` gains `others` in its card
reading.
- `check-governed-merges.mjs`:
- `⭐ --pr-carries-the-arm-reading-…-it-answers-Tier-S` is now
`…-its-record-stage-is-PENDING-at-Tier-H`.
- both arm fixtures hand in a favourable record stage with an empty
measured `others`; the sweep fixture's record carries the line, its
readers answer the cards' labels and timelines, and its git answers the
landed tree's copy of the register.
- `the-Tier-S-words-name-the-record-line-and-the-card` expects "the PR
or a card it names".
- `fleet-write/execute.mjs`: `⭐ low-risk-skills-pull-requests-no-one`
also pins the four stage reads on the relay's token; its fixture answers
them, and its card reading gains `others`.
The merge of `main` forced no test edit: its one conflict was between
two sets of added rows in the `H43` battery, and both sets are kept.
### Ablations (each mutation went red and was restored)
Run through `scripts/ablation-replace.mjs`; after each, `git diff HEAD`
was empty.
<details><summary>Thirty mutations and the rows that went red</summary>
| # | Mutation | Red rows |
|:--|:--|:--|
| A1 | the record-line conjunct dropped | register 12, guard 15, relay 2
|
| A2 | the card-label conjunct dropped | register 10, guard 5, relay 2 |
| A3 | a pending stage pushes no reason (reads Tier S) | register 2,
relay 1 |
| A4 | a favourable stand-in read may settle a pending stage | register
6 |
| A5 | the recogniser reads a missing line as `no` | half-states 2,
guard 6, relay 1, register 4 (run again on the merged head) |
| A6 | the guard hands in a stand-in `no` | guard 8, relay 1, register 3
(run again on the merged head) |
| A7 | the card's labels are not read | guard 6, relay 2, register 6 |
| A8 | the sweep skips the record stage | register 6 |
| A9 | the sweep reads the card's labels as they are now, not as landed
| register 2 |
| A10 | the thread walk keeps untrusted authors | guard 11, relay 1,
register 1 |
| A11 | the template stops printing the line | recognisers 5 |
| A12 | the sweep reads the stage for every landing, whatever its tree
carries | register 2 |
| A13 | a landed tree that cannot be read is taken as carrying the stage
| register 1 |
| A14 | a quoted copy of the stage's declaration counts as the
declaration | register 2 |
| A15 | the reader reads the first card only and says it read the others
| guard 9, register 5, relay 2 |
| A16 | the conjunct judges the first card only | register 5, guard 5,
relay 1 |
| A17 | a reading that does not say it read the other cards reads as
none named | register 1 |
| A18 | `namedCardNumbers` drops the card the branch is named for |
recognisers 2, guard 4, register 1, relay 2 |
| A19 | `namedCardNumbers` drops the `Part of` targets | recognisers 2,
guard 7, register 5, relay 2 |
| A20 | `namedCardNumbers` drops the `Refs` targets | recognisers 2,
guard 3, register 1 |
| A21 | the sweep reads the other cards as they stand today, not as
landed | register 2 |
| A22 | no limit on the cards a pull request may name | guard 2,
register 1 |
| A23 | a code span holding the key is read again | half-states 1 (run
again on the merged head) |
| A24 | the sweep judges an unread other card instead of NOT MEASURED |
register 1 |
| A25 | a git read that failed on the second pass is judged, not NOT
MEASURED | register 1 |
| A26 | a stage whose line could not be read is judged, not NOT MEASURED
| register 1 |
| A27 | the queue leg reads the stage for an entry an authorized enqueue
already cleared | guard 1 |
| A28 | the sweep reads an over-limit landing as a failed read, not a
BREACH | register 1 |
| A29 | the merged reader's return line drops the `Security-touching`
reading | register 29, relay 5; the half-states and guard self-tests
exit 1 on a thrown read |
| A30 | the timeline walk ends at the first short page, whatever the
`Link` header says | guard 2 |
A4's first run was a no-op and is reported as one: its replacement text
was a substring of the anchor, the tool refused the mutation (exit 1),
and nothing was tested. It was run again with a replacement the anchor
does not contain, and that run is the row above. A1 to A4 and A7 to A14
ran on the round-1 head, A15 to A22 and A24 to A28 on the round-2 head;
A5, A6, A23, A29 and A30 ran on the merged head.
</details>
## Acceptance notes
Behaviour a reviewer should judge, each chosen toward Tier H:
- The template ships `Security-touching: yes`, so a record pasted
without editing the line fails closed.
- Each named card's timeline is read as well as its labels: a `security`
label that was ever removed from a card keeps Tier H. This goes one step
past the card's wording (the label on the linked card) and mirrors what
the arm already does for the PR's own label.
- Every card the PR names is read, which is wider than the cards it
delivers: a `Refs` target and the card a branch is named for count. The
card whose thread may carry the record is still the one the delivery
relation answers, and no other named card is searched for a record.
- A PR that names no card reads Tier H on the arm, and so does one that
names more than eight cards beyond the first.
- The cards are the ones the PR body names when the leg reads it, at the
queue and again at the sweep. An edit to the body after the review
changes which cards are read; that is the same trust the PASS record
itself stands on, and the conjunct is not tamper-proof.
- The line reader does not judge how GitHub renders the record. A bare
line inside an HTML comment, inside a `pre` element, after a code span
opened on an earlier line, or directly under a quoted line still reads.
Only an author the guard trusts can write a record.
- An arm entry whose record thread cannot be read refuses as Tier H.
- The stage is never read for an entry the maintainer cleared, and its
outcome is unchanged. An entry an authorized enqueue cleared prints Tier
H with the pending reason. An entry an approval cleared stops one
conjunct earlier, on the timeline the leg never read.
- In-flight arm pull requests return to Tier S only when their record is
posted again with the line. No record written before this change carries
it.
- The sweep applies the stage only to a landing whose own tree declares
it. The queue leg runs the register from the merge group's tree, so an
earlier landing was judged without the stage and stays a pass on its
record alone, with a note in its row. A landed tree that cannot be read
is NOT MEASURED.
- The timeline reader ends its walk on a short page only when the
answer's `Link` header names no next page. Whether the timeline route
ever answers a short page that is not the last was not measured; the
header settles it either way. The comment, review and label readers keep
the short-page rule.
- Cost: for an arm entry that reaches the stage the queue leg spends two
more reads per named card (its labels and its timeline); the relay
spends two thread reads and two per named card on `pr_ready`. `GET
/repos/OWNER/REPO/issues/N/labels` accepts `pull_requests=read`, so no
workflow permission moves.
Outside this card's file surface, noted and not changed:
- `AGENTS.md`, the register's parenthetical naming `lowRiskArmVerdict`,
still says only that the seat labels unnamed security teaching. It does
not mention the record stage.
- `.github/workflows/fleet-patrols.yml`, the sweep job's comment, still
defines a BREACH as an arm landing without a same-head at-tier PASS
record. A record stage at Tier H is now a BREACH too.
- Both are carried by a comment on card #33768.
- In `armSettledWithoutUnread` the disjunct
`guard.landsOnLowRiskArm(work)` can no longer be true on a first read.
It is left in place: this PR adds one condition on that line and does
not touch `favourableArmGitRead` next to it, which another card in
flight is editing. Whichever lands second merges the neighbouring line.
## Verification
Local gates, derived on the head
`13c0c84ffe4f15a9fd50d8588c46f61f9f122c6c` with `node
scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` and run one by one, each exit code captured
before any pipe:
- 76 derived, 76 run. On the first pass 75 exit 0 and `pnpm
check:i18n-coverage` exits 3, prerequisite not met: the workspace CLI
was not built. After that gate's own one-command build closure under the
verify lock (`VERDICT command-exit 0`) it exits 0. `--ran` on the final
record answers `76 derived, 76 run, 0 NOT-MEASURED, 0 UNRUN`. The list
was 64 commands until `main` taught the deriver to follow the import
graph of `scripts/pm`; those 64 ran too, every one exit 0, on the head
before the third merge.
- `pnpm --filter @objectstack/lint run check:doc-formula-expressions`
needs `@objectstack/formula` and `@objectstack/lint` built. They were
built under the verify lock in round 1; the merges since changed neither
package's source.
- `pnpm check:pm-skill-ratchet` and `pnpm check:pm-skill-id-lint` are in
the list and exit 0: `references/contract-review.md` stays at 63 lines.
- Outside the derived list, run by hand: `node
scripts/check-commit-card-trailers.mjs --range origin/main..HEAD`, exit
0 on 11 commit messages. `pnpm check:adr-anchors` is in the derived list
now.
- `node scripts/pm/check-governed-merges.mjs --pr 34133` on the pushed
head reads GOVERNED, Tier S, through its one `.claude/**` path; the five
`scripts/pm` files are not on the register.
- Changed lines against `main`: 1709 (+1577 / -132) over 6 files, under
the 3000-line human-merge line.
- `main` was merged in three times. The second merge (`86350e12`) had
one conflict, in the self-test of `check-half-states.mjs`; the reader
itself merged cleanly, and the five self-tests, the ablations that touch
the reader and the 64 gates derived then ran after it, all exit 0. The
third merge (`b4eea885`, fetched right before the push) had no conflict;
the five self-tests and the gate list above ran on it.
The families only CI runs (the type-check lanes, the Test Core shards,
the artifact rosters) are left to this PR's check runs.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(No schema and no `packages/spec` file is touched.)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes. (No formatter ran. ESLint
with `pnpm lint`'s own flags is clean on the five changed scripts; the
whole-repository run is left to CI.)
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset. (Nothing
published changes: `scripts/pm/**` and `.claude/**` ship in no package,
so the PR carries `skip-changeset`.)
- [x] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed. (Not touched.)
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English. (The `维护者速读` block is
the maintainer's Chinese channel.)
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01ADHkmR2U8dFkRvc5DvUz1W
<!-- signed: domain:skills#1 · os-steve ·
session_01ADHkmPd7uRqHauEehGPr19 -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 5092581 commit 27298b8
6 files changed
Lines changed: 1577 additions & 132 deletions
File tree
- .claude/skills/pm-dispatch/references
- scripts/pm
- fleet-write
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
0 commit comments