Skip to content

Commit 6a83f0c

Browse files
fix(pm): dequeue read-back pins and jsdocs; a carried approval refused on a seat signature on any line (#34037)
<!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9N1Z1u2rEtm3MkQHMEhxcoQ)_ Part of #33768 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:给中继出队(dequeue)补一条自测——出队后第二次读 PR 失败时不算确认、整对重读;两处函数注释改成"读两次";插队的"携带批准"评论只要任一行带席位签名就拒收(原来只看首行)。 - 为什么改:这是 PR #33732 复审留下的三条小尾巴(E2、E3、D3),注释与文件头不一致,签名藏在第二行就能绕过"席位评论不算维护者批准"。 - 风险与回滚:只动 `scripts/pm/fleet-write/` 两个脚本,不发布;D3 只会让更多评论被拒、不会放宽;回滚 = revert 本 PR。 - 先看:`scripts/pm/fleet-write/ops.mjs` 的 `enqueueFrontSizeLift`(逐行读签名那一行);`execute.mjs` 自测里新增的 "a SECOND pull read that fails" 一行。 - 两分钟验证:`node scripts/pm/fleet-write/execute.mjs --self-test`,应看到 "424 cases pass across 31 batteries"。 - 需要你做的:无,席位落地。 ## What changes Three items of the #33768 checklist (review follow-ups of PR #33732). The rest stay open on the card: the `fleet-write.yml` comment and the AGENTS.md sentence (Tier H, a later governed batch), N1/E1 (measured at the first live stroke), D2, D4 and N2 (each needs a budget or a ruling). - **E2** (`execute.mjs` self-test). The rows near the dequeue read-back pinned a failed FIRST pull read (`pullLate`: 502, ok) and a merge that shows only on the second read (`mergedLate`), but no failed SECOND read. New row: pull reads ok, 502, ok, ok. The 502 confirms nothing, so the queue is read again at the interval and the pair starts over. It lands at three polls (clock `3 * DEQUEUE_POLL_MS`), with 5 pull GETs and 4 GraphQL calls. The pr_dequeue battery pin goes 28 → 29, with a roster comment. - **E3** (jsdocs). `dequeueAction` now says the pull's own GET reads it open and unmerged TWICE, one `pollMs` apart, and that a failed second read starts the pair over. `dequeuePullAfter` now says it judges ONE of the two reads and the executor lands only when both are `ok`. Both match the file headers. - **D3** (optional hardening, taken: it stays inside `scripts/pm/fleet-write/**`). `enqueueFrontSizeLift` runs the passed-in signature reader on every line of the `approval_comment`, not only the first non-empty one. A seat signature on any line refuses the carry, and the reading says "holds the seat signature". The row "⭐ CARRIED, the other way: … signature line further down … still carries it" flips to "⛔ CARRIED, refused on ANY line", which also checks that the reading names the seat. The SIZE lift battery stays at 12 cases; its name ("holding a seat signature on any line"), the `ops.mjs` header paragraph and the `execute.mjs` header sentence now say any line. The reader stays passed in, so `ops.mjs` still imports no guard. No changeset: the diff is `scripts/pm/**` only and publishes nothing (`skip-changeset`). ## Tests At head 1c433b2: - `node scripts/pm/fleet-write/execute.mjs --self-test`: 424 cases pass across 31 batteries (423 at base c3c0c30). - Forced test edit: the D3 row "signature line further down still carries it" is flipped to a refusal, as the card asks. <details><summary>Ablations (both red on exactly the new pin, restored, `git diff HEAD` empty)</summary> Run with `node scripts/ablation-replace.mjs` (the anchor must hit, restore is checked on disk) after the fix was committed. - E2: the second read's `if (after.ok) return` changed to `if (after.ok || after.pending) return`. Result: `✗ a SECOND pull read that fails (ok, 502) … — got [0,3000,3,3], want [0,9000,5,4]`, 1 of 424 failed. - D3: the line scan changed back to `signatureOf(c.body)` (first line only). Result: `✗ ⛔ CARRIED, refused on ANY line … — got [[0,1,200],false], want [[5,0,"not sent"],true]`, 1 of 424 failed. </details> ## Acceptance notes - Concurrency: PR #33975 (self-test fixtures near L2909–2962) and PR #34022 (removes the mailbox lock rows and battery, so the battery floor goes 31 → 30) also touch `execute.mjs`. Their hunks do not overlap these. Whichever lands later rebases; the floor and the per-battery pins here move independently of #34022's. ## Verification <details><summary>Derived gates (37 of 37 exit 0, at head 1c433b2)</summary> `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` listed 37 commands; each one exited 0: check-closing-keyword-parity (+ self-test), check-comment-mask-corpus, check-declaration-mirrors (+ self-test), check-self-test-wired (+ self-test), check-self-test-workflow-commands (+ self-test), check-whole-set-label-write (+ self-test), plan-test-core-shards self-test, bare-root-worklist self-test, and the pnpm checks agent-test-spelling, bash32-floor, ci-filter-parity, cli-command-ids, cross-package-test-inputs, driver-memory-census, entry-guard, gitlink-declared, nul-bytes, parse-guard, pm-close-cards, pm-dispatch-gates, pm-fleet-write-dispatch, pm-fleet-write-execute, pm-fleet-write-validate, pm-issue-transfer, pm-post-stamped, pm-record-recognisers, pm-write-pace, pnpm-filter-targets, pnpm-flag-spellings, refd-timer-probe, scripts-symbol-anchors, watch-hint-literal. `--ran` reconciliation: `✓ dispatch-gates --ran: 37 derived famil(ies) accounted for — 37 run, 0 NOT-MEASURED (a DERIVED zero — all 37 recorded an exit code and none of them is 3).` </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ADHkmPoZhhhS5uc7UQqwZ7 --- _Generated by [Claude Code](https://claude.ai/code/session_01ADHkmPoZhhhS5uc7UQqwZ7)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent d3bea96 commit 6a83f0c

2 files changed

Lines changed: 24 additions & 15 deletions

File tree

‎scripts/pm/fleet-write/execute.mjs‎

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@
191191
* full page read as unreadable) and reduced by the queue guard's
192192
* `authorizedApprovalVerdict`; an approval that is not on the head reads the
193193
* action's `approval_comment` by its own GET. Unread, unauthorised, elsewhere,
194-
* carried by nobody or by a comment opening with a seat signature
194+
* carried by nobody or by a comment holding a seat signature on any line
195195
* (`readSignatureLine`, passed in), the line holds and the mutation is NOT SENT.
196196
*
197197
* ## The dequeue — `pr_dequeue`, fenced on the PULL, its QUEUE and its CAUSE, audited, and read back
@@ -1420,7 +1420,8 @@ export async function dequeuePreflight(req, payload, api, t) {
14201420
* ONE dequeue (header: "The dequeue"): the fences, then the ONE audit comment (paced; a comment that does not answer
14211421
* 201 with an id stops the action, the mutation NOT SENT), then the mutation behind the node id the preflight's own
14221422
* pull read answered, then the queue read back until the entry is gone and the pull's own GET reads it open and
1423-
* unmerged. Returns `{ ok, call, status, result | why }` for the row. Never throws on a status.
1423+
* unmerged TWICE, one `pollMs` apart — a second read that fails is no confirmation: the queue is read again and the
1424+
* pair starts over. Returns `{ ok, call, status, result | why }` for the row. Never throws on a status.
14241425
*/
14251426
export async function dequeueAction(req, { payload, api, t, sleep, now, windowMs = DEQUEUE_WINDOW_MS, pollMs = DEQUEUE_POLL_MS }) {
14261427
const { pull, reason, cause } = req.dequeue;
@@ -2555,12 +2556,14 @@ const SELF_TEST_BATTERIES = Object.freeze({
25552556
// 17 → 21 with the head fence: a stale head, the embedded copy never trusted, a run naming no pull, a pull unread.
25562557
"the run_rerun_failed: the five fences judged HERE on the run and its pull, read immediately before ONE bodiless POST — the pull's current head by its own GET, never the run's embedded copy, and a run naming no pull refused by name; each refused with the POST not sent and accepted on the measured run; a run, pull, baseline or fence that fails is zero writes; the 201 confirmed only by reading attempt 2 back with its failed jobs queued or in progress, naming their job ids; attempt 2 never seen, a failed job completed, or a job list unread is FAILED; no annotation": 21,
25572558
"the pr_enqueue_front: the pull's own GET, its whole file list and its base's queue read immediately before ONE enqueuePullRequest mutation with jump true and the expected head — open, ready, its head, not Version Packages, no governed path, at most the human-merge line count, a queue read whole with no jumped entry; each fence refused with the mutation not sent; GraphQL errors FAILED naming the missing grant; the 200 confirmed only by reading the queue back with the pull jumped and nothing ahead; queued without the jump or behind another is FAILED, never re-sent; the queue read unpaced; no annotation": 20,
2558-
// 9 → 12 with a carrying comment that opens with a seat signature refused, its other way, and no reader carrying nothing.
2559-
"the pr_enqueue_front SIZE lift: a pull over the human-merge line is jumped only on an authorised APPROVED review on its current head, or an earlier one carried to the head by an authorised comment on the pull naming it — the reviews read only over the line, a full page or an unread list lifting nothing, a non-approver, an approval elsewhere, a comment naming another head or pull or opening with a seat signature refused with the mutation not sent": 12,
2559+
// 9 → 12 with a carrying comment that opens with a seat signature refused, its other way, and no reader carrying nothing;
2560+
// the other way flipped (still 12) when a signature on ANY line refused the carry, not only the first.
2561+
"the pr_enqueue_front SIZE lift: a pull over the human-merge line is jumped only on an authorised APPROVED review on its current head, or an earlier one carried to the head by an authorised comment on the pull naming it — the reviews read only over the line, a full page or an unread list lifting nothing, a non-approver, an approval elsewhere, a comment naming another head or pull or holding a seat signature on any line refused with the mutation not sent": 12,
25602562
// 16 → 27 with seat-asks bound to the landing seat (another seat, the relay's own audit, no trailer, the pure match),
25612563
// the pull read back open and unmerged (merged, closed, a late read, the pure reading) and the node id from the first read;
2562-
// 27 → 28 with the second pull read one interval later, a merge that shows only there refused.
2563-
"the pr_dequeue: the pull's own GET, its base's queue with each entry's merge-group rollup and, for seat-asks alone, its comments read before ONE audit comment and ONE dequeuePullRequest mutation — open, its head, not Version Packages, a queue read whole that lists it, and the cause holding on those reads (conflict: dirty; own-failure: UNMERGEABLE or a failing rollup, never an unread one; seat-asks: a relay comment signed by the landing seat its body's trailer names, under the dispatching session — another seat's comment refused); each fence refused with nothing written; no audit comment, no mutation; GraphQL errors FAILED naming the grant; the 200 confirmed only by reading the queue back without the pull and the pull still open and unmerged on two reads one interval apart, a merge or close inside the window FAILED, UNCONFIRMED after the window": 28,
2564+
// 27 → 28 with the second pull read one interval later, a merge that shows only there refused;
2565+
// 28 → 29 with a failed second pull read starting the pair over.
2566+
"the pr_dequeue: the pull's own GET, its base's queue with each entry's merge-group rollup and, for seat-asks alone, its comments read before ONE audit comment and ONE dequeuePullRequest mutation — open, its head, not Version Packages, a queue read whole that lists it, and the cause holding on those reads (conflict: dirty; own-failure: UNMERGEABLE or a failing rollup, never an unread one; seat-asks: a relay comment signed by the landing seat its body's trailer names, under the dispatching session — another seat's comment refused); each fence refused with nothing written; no audit comment, no mutation; GraphQL errors FAILED naming the grant; the 200 confirmed only by reading the queue back without the pull and the pull still open and unmerged on two reads one interval apart, a merge or close inside the window FAILED, UNCONFIRMED after the window": 29,
25642567
"the hierarchy link: sub_issue_add and sub_issue_remove read the parent's and the child's own answers, then the child's parent (add) or the parent's whole list (remove), immediately before ONE write whose body is the child's REST id from its own answer — never its number, never replace_parent; a pull, a transferred or unread card, a child under another parent, one the parent does not list, or a read that is neither answer is zero writes; a child already under this parent is a no-op landed on the list; the answer confirmed only when the parent's list reads the child back (or no longer does) inside the window; a refused write, a list that never settles or never reads whole is FAILED; no annotation, and the rows ride a stroke beside other ops": 20,
25652568
"the advisory rows: advisory_report and advisory_create are ONE POST of their body each, landed on a 2xx carrying an id — a draft's reading state draft — that the row and a notice annotation name; advisory_collaborators_add, advisory_versions and advisory_state read the advisory first and send ONE PATCH — every existing login kept with the missing ones added, an all-present list a no-op, the versions entries alone, or the one state a legal transition reaches, the reopen and the publish among them — or nothing at all on a fence: an unread, other or wrong-state advisory, an illegal move, a list the versions may not replace or a publish whose versions are not set; each lands only when its answer shows the result, a publish only read back as published with the versions it was sent, and a landed publish alone is annotated with its id; ⛔ the marker in a report's or a draft's summary, description and packages and in every advisory answer's summary, description and vulnerabilities reaches no log line, row, step summary or annotation": 41,
25662569
"the mailbox branch delete: the pull's own answer, the open pulls on its head and the ref read immediately before ONE DELETE of the ref under the App token — an open, unlabelled, other-headed or forked pull, an open pull on that head, a ref moved off the pull's head, or a read that does not answer is zero writes with every failing fence named; the DELETE lands only when the ref reads back absent, a ref already gone an idempotent landing and one still there FAILED; and mailbox-open's close stroke — comment, close, delete — leaves no branch, while a head outside claude/mailbox-* sends no DELETE": 7,
@@ -3381,7 +3384,7 @@ export async function selfTest() {
33813384
}
33823385

33833386
// ── the jump's SIZE lift ────────────────────────────────────────────────
3384-
battery("the pr_enqueue_front SIZE lift: a pull over the human-merge line is jumped only on an authorised APPROVED review on its current head, or an earlier one carried to the head by an authorised comment on the pull naming it — the reviews read only over the line, a full page or an unread list lifting nothing, a non-approver, an approval elsewhere, a comment naming another head or pull or opening with a seat signature refused with the mutation not sent");
3387+
battery("the pr_enqueue_front SIZE lift: a pull over the human-merge line is jumped only on an authorised APPROVED review on its current head, or an earlier one carried to the head by an authorised comment on the pull naming it — the reviews read only over the line, a full page or an unread list lifting nothing, a non-approver, an approval elsewhere, a comment naming another head or pull or holding a seat signature on any line refused with the mutation not sent");
33853388
{
33863389
const PULL = 3227;
33873390
const HEAD = '7a1e2d3c4b5a69788796a5b4c3d2e1f00f1e2d3c';
@@ -3423,7 +3426,8 @@ export async function selfTest() {
34233426
], [refused, refused, refused, refused, refused]);
34243427
const seatSigned = commentOf({ body: `triage#1 · ${APPROVER} · session_01ABCDEFGHJKMNPQRSTVWXYZ\n\nHead-sha: ${HEAD.slice(0, 9)}` });
34253428
t('⛔ CARRIED, refused: the approver\'s comment naming the head but opening with a SEAT signature (an agent-operated account\'s knock or record) carries nothing, the reading naming the seat', [await verdict({ [REVIEWS]: reviewsOf(review(APPROVER, EARLIER)), [COMMENT]: seatSigned }, { approval_comment: 71 }), (await run(stroke({ approval_comment: 71 }), { ...happy, [REVIEWS]: reviewsOf(review(APPROVER, EARLIER)), [COMMENT]: seatSigned })).rows[0]?.result.includes('a seat\'s comment is no carried approval')], [refused, true]);
3426-
t('⭐ CARRIED, the other way: the same approver\'s comment with the signature line further down, not first, still carries it', [await verdict({ [REVIEWS]: reviewsOf(review(APPROVER, EARLIER)), [COMMENT]: commentOf({ body: `The approval carries to ${HEAD.slice(0, 9)}.\n\ntriage#1 · ${APPROVER} · session_01ABCDEFGHJKMNPQRSTVWXYZ` }) }, { approval_comment: 71 })], [landed]);
3429+
const signedLower = commentOf({ body: `The approval carries to ${HEAD.slice(0, 9)}.\n\ntriage#1 · ${APPROVER} · session_01ABCDEFGHJKMNPQRSTVWXYZ` });
3430+
t('⛔ CARRIED, refused on ANY line: the same approver\'s comment with the seat signature further down, not first, carries nothing either — the reading naming the seat', [await verdict({ [REVIEWS]: reviewsOf(review(APPROVER, EARLIER)), [COMMENT]: signedLower }, { approval_comment: 71 }), (await run(stroke({ approval_comment: 71 }), { ...happy, [REVIEWS]: reviewsOf(review(APPROVER, EARLIER)), [COMMENT]: signedLower })).rows[0]?.result.includes('holds the seat signature triage#1')], [refused, true]);
34273431
const pastApproval = { state: 'approved', approvals: [{ login: APPROVER, commitId: EARLIER }] };
34283432
t('enqueueFrontSizeLift with no signature reader carries nothing — the opening line unjudged is never a pass', [enqueueFrontSizeLift({ verdict: pastApproval, headSha: HEAD, comment: commentOf(), pull: PULL, approvers: GOVERNED_APPROVERS }).lifts, enqueueFrontSizeLift({ verdict: pastApproval, headSha: HEAD, comment: commentOf(), pull: PULL, approvers: GOVERNED_APPROVERS, signatureOf: () => null }).lifts], [false, true]);
34293433
t('⛔ an approval by an account outside GOVERNED_APPROVERS, or one the approver later dismissed, lifts nothing even on the head', [await verdict({ [REVIEWS]: reviewsOf(review('os-support-ai', HEAD)) }), await verdict({ [REVIEWS]: reviewsOf(review(APPROVER, HEAD), review(APPROVER, HEAD, 'DISMISSED')) })], [refused, refused]);
@@ -3510,6 +3514,9 @@ export async function selfTest() {
35103514
const pullLate = await run(stroke(), { ...happy, [PULL_GET]: [pullAt(), { status: 502, json: { message: 'Bad Gateway' } }, pullAt()] }, timing);
35113515
t('a pull read that fails after the queue reads it gone is read again at the interval, and lands when it reads open and unmerged', [pullLate.exit, clock], [EXIT_OK, 2 * DEQUEUE_POLL_MS]);
35123516
clock = 0;
3517+
const secondFails = await run(stroke(), { ...happy, [PULL_GET]: [pullAt(), pullAt(), { status: 502, json: { message: 'Bad Gateway' } }, pullAt()] }, timing);
3518+
t('a SECOND pull read that fails (ok, 502) confirms nothing: the queue is read again at the interval and the pair starts over (ok, ok), landing at three polls', [secondFails.exit, clock, secondFails.seen.filter((x) => x.call === PULL_GET).length, secondFails.seen.filter((x) => x.call === GQL).length], [EXIT_OK, 3 * DEQUEUE_POLL_MS, 5, 4]);
3519+
clock = 0;
35133520
const mergedLate = await run(stroke(), { ...happy, [PULL_GET]: [pullAt(), pullAt(), pullAt({ state: 'closed', merged: true, merged_at: '2026-11-15T08:40:15Z' })] }, timing);
35143521
const mergedLateClock = clock;
35153522
const mergedAtOnly = await run(stroke(), { ...happy, [PULL_GET]: [pullAt(), pullAt(), pullAt({ merged: false, merged_at: '2026-11-15T08:40:15Z' })] }, timing);

‎scripts/pm/fleet-write/ops.mjs‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,8 @@
363363
* more leading hex characters of it) — the maintainer's confirmation that
364364
* the approval carries to this head. The comment is read by its own GET
365365
* (`/repos/{repo}/issues/comments/{id}`); a comment on another pull, by
366-
* another author, or naming another head lifts nothing. Nor does one whose
367-
* first non-empty line is a seat signature (`LANE#N · ACCOUNT · SESSION`):
366+
* another author, or naming another head lifts nothing. Nor does one with
367+
* a seat signature (`LANE#N · ACCOUNT · SESSION`) on ANY line, not only the first:
368368
* an authorised account is agent-operated too (AGENTS.md Prime Directive
369369
* #14), and a seat's knock or record quoting the head is no confirmation
370370
* by the maintainer's own hand.
@@ -1441,9 +1441,10 @@ export function enqueueFrontSizeLift({ verdict = null, headSha = null, comment =
14411441
const author = c.user?.login ?? null;
14421442
if (!approvers.includes(author)) return { lifts: false, way: null, reading: `${earlier}; the approval_comment's author ${author ?? 'unread'} is not an authorised approver` };
14431443
if (!new RegExp(`/issues/${pull}$`).test(String(c.issue_url ?? ''))) return { lifts: false, way: null, reading: `${earlier}; the approval_comment is not on #${pull}` };
1444-
if (typeof signatureOf !== 'function') return { lifts: false, way: null, reading: `${earlier}; the approval_comment's opening line was not judged` };
1445-
const seat = signatureOf(c.body);
1446-
if (seat) return { lifts: false, way: null, reading: `${earlier}; the approval_comment by ${author} opens with the seat signature ${seat.lane}#${seat.seat} · ${seat.account} — a seat's comment is no carried approval` };
1444+
if (typeof signatureOf !== 'function') return { lifts: false, way: null, reading: `${earlier}; the approval_comment's lines were not judged for a seat signature` };
1445+
// Every line is read, not only the first: a signature lower down is a seat's record all the same (header).
1446+
const seat = String(c.body ?? '').split(/\r?\n/u).map((line) => signatureOf(line)).find(Boolean) ?? null;
1447+
if (seat) return { lifts: false, way: null, reading: `${earlier}; the approval_comment by ${author} holds the seat signature ${seat.lane}#${seat.seat} · ${seat.account} — a seat's comment is no carried approval` };
14471448
const tokens = String(c.body ?? '').match(/\b[0-9a-f]{7,40}\b/giu) ?? [];
14481449
const carries = head !== '' && tokens.some((tok) => tok.length >= CARRIED_HEAD_MIN_CHARS && head.startsWith(tok.toLowerCase()));
14491450
if (!carries) return { lifts: false, way: null, reading: `${earlier}; the approval_comment by ${author} names no prefix of the current head` };
@@ -1598,8 +1599,9 @@ export function dequeueReadBack({ pull, queue } = {}) {
15981599
}
15991600

16001601
/**
1601-
* The second half of a dequeue's landing (header): the pull's own GET once the queue no longer lists it — still open
1602-
* and `merged` false, so it left the queue without landing. `{ ok, pending, why }`: a read that is not a 200 object
1602+
* The second half of a dequeue's landing (header): ONE of the pull's own GETs once the queue no longer lists it —
1603+
* still open and `merged` false, so it left the queue without landing. The executor takes TWO such reads, one poll
1604+
* apart, and lands only when both are `ok`. `{ ok, pending, why }` for each read: a read that is not a 200 object
16031605
* is `pending` (read again inside the window); a merged pull, or one closed unmerged, is a terminal failure. Pure.
16041606
*/
16051607
export function dequeuePullAfter(answer) {

0 commit comments

Comments
 (0)