From b19780eb82cc16d24c685192a0c8055f954558ec Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 03:17:46 +0000 Subject: [PATCH 1/6] pm: seat readers accept LANE@ACCOUNT beside LANE#N (core grammar, mailbox key, doorbell) The seat signature, the claim Seat line, the seat post title, seatKey and the doorbell seat fields read a seat named by its account. Writers keep their LANE#N default. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01FEkQ5oPfjnm2yWHEwkiYrn --- scripts/pm/check-half-states.mjs | 95 +++++++++++++++++++++++++------ scripts/pm/mailbox-open.mjs | 23 ++++++-- scripts/pm/record-recognisers.mjs | 21 ++++--- 3 files changed, 112 insertions(+), 27 deletions(-) diff --git a/scripts/pm/check-half-states.mjs b/scripts/pm/check-half-states.mjs index 8c39144e7de..b261c9fbe6a 100644 --- a/scripts/pm/check-half-states.mjs +++ b/scripts/pm/check-half-states.mjs @@ -1295,6 +1295,11 @@ export const RELEASE_COMMENT_MARKER = /^\s*>?\s*Release\s*:/mi; // name (`domain:engine-core` carries a hyphen, measured on the label set), // `epic:#` plus the parent card, `triage`, `director`, `coordinator`, `security`, `l2-review` (old spelling `review`), `qa`, `eval` or `queue` // N the seat number, from 1 +// @ACCOUNT in place of `#N` is the SECOND accepted seat mark (ruling record 7249169754): a seat named by +// the account that holds it, `repo:objectstack@os-justin · os-justin · session_01…`. Its account is +// the signing ACCOUNT, compared lower-cased; under another account the line is a near miss. Readers +// accept both marks; every writer's default is still `#N`. A seat is its lane AND its mark: `#N` +// reads as that numbered seat, `@ACCOUNT` as that account's, and neither is read as the other. // ACCOUNT the login a claim's `Account:` line carries — GitHub's own login rule // SESSION the full id, in the relay envelope's shape (`SESSION_SHAPE`, fleet-write/ops.mjs, // mirrored here because this module may not import that one; the record-recognisers @@ -1319,6 +1324,8 @@ export const RELEASE_COMMENT_MARKER = /^\s*>?\s*Release\s*:/mi; /** The four parts' patterns, unanchored, in order — the ONE spelling every reader and writer composes from. */ const SIGNATURE_LANE_SOURCE = '(?:domain:[a-z][a-z0-9-]*|repo:[a-z][a-z0-9-]*|epic:#[1-9][0-9]*|triage|director|coordinator|security|l2-review|review|qa|eval|queue)'; const SIGNATURE_ACCOUNT_SOURCE = '[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}'; +/** The seat mark after the lane, capture-free: `#N`, or `@ACCOUNT` (the banner's second accepted mark). */ +export const SEAT_MARK_SOURCE = `(?:#[1-9][0-9]*|@${SIGNATURE_ACCOUNT_SOURCE})`; /** The relay envelope's session shape without its anchors — `SESSION_SHAPE` in `fleet-write/ops.mjs`. */ export const SEAT_SIGNATURE_SESSION_SOURCE = 'session_[A-Za-z0-9]{6,}'; /** The separator, exactly. */ @@ -1326,17 +1333,36 @@ export const SEAT_SIGNATURE_SEPARATOR = ' · '; /** The signature line's pattern, unanchored and capture-free — what a marker composes when it admits one leading signature. */ export const SEAT_SIGNATURE_SOURCE = - `${SIGNATURE_LANE_SOURCE}#[1-9][0-9]*${SEAT_SIGNATURE_SEPARATOR}${SIGNATURE_ACCOUNT_SOURCE}${SEAT_SIGNATURE_SEPARATOR}${SEAT_SIGNATURE_SESSION_SOURCE}`; + `${SIGNATURE_LANE_SOURCE}${SEAT_MARK_SOURCE}${SEAT_SIGNATURE_SEPARATOR}${SIGNATURE_ACCOUNT_SOURCE}${SEAT_SIGNATURE_SEPARATOR}${SEAT_SIGNATURE_SESSION_SOURCE}`; -/** ONE line, whitespace around it trimmed, is a signature — with the four parts captured. ⛔ No `g` or `m` flag. */ +/** + * ONE line, whitespace around it trimmed, is a signature — with the four parts captured; the second is the seat mark + * as written, `#N` or `@ACCOUNT` (`seatMark` reads it). ⛔ No `g` or `m` flag. The pattern alone does not hold an + * `@ACCOUNT` mark to the signing account: `readSignatureLine` does, so a writer's gate asks that reader. + */ export const SEAT_SIGNATURE_LINE = new RegExp( - `^(${SIGNATURE_LANE_SOURCE})#([1-9][0-9]*)${SEAT_SIGNATURE_SEPARATOR}(${SIGNATURE_ACCOUNT_SOURCE})${SEAT_SIGNATURE_SEPARATOR}(${SEAT_SIGNATURE_SESSION_SOURCE})$`, + `^(${SIGNATURE_LANE_SOURCE})(${SEAT_MARK_SOURCE})${SEAT_SIGNATURE_SEPARATOR}(${SIGNATURE_ACCOUNT_SOURCE})${SEAT_SIGNATURE_SEPARATOR}(${SEAT_SIGNATURE_SESSION_SOURCE})$`, 'u', ); /** The shape, as a refusal prints it — placeholders only, so it survives a GitHub body unchanged. */ export const SEAT_SIGNATURE_SHAPE = 'LANE#N · ACCOUNT · SESSION — e.g. `domain:skills#2 · os-justin · session_01…`'; +/** + * A seat mark as every reader carries it: the NUMBER for `#N`, the string `@account` (lower-cased, GitHub logins + * fold case) for `@ACCOUNT`, null for anything else. Two marks name one seat exactly when they are `===`. Pure. + * + * @returns {number | string | null} + */ +export function seatMark(text) { + const m = new RegExp(`^${SEAT_MARK_SOURCE}$`, 'u').exec(String(text ?? '').trim()); + if (!m) return null; + return m[0].startsWith('#') ? Number(m[0].slice(1)) : m[0].toLowerCase(); +} + +/** A seat's id from its lane and its mark (`seatMark`'s reading): `LANE#N` or `LANE@account`. Pure. */ +export const seatIdOf = (lane, mark) => (typeof mark === 'string' ? `${lane}${mark}` : `${lane}#${mark}`); + /** The index of a line list's first non-blank line, or -1. */ function firstNonBlankIndex(lines) { return lines.findIndex((line) => line.trim() !== ''); @@ -1347,7 +1373,10 @@ function firstNonBlankIndex(lines) { * not one (an empty body included). Pure. * * @param {string} body - * @returns {{ lane: string, seat: number, account: string, session: string, line: string } | null} + * `seat` is the seat mark (`seatMark`): the number for `#N`, `@account` for a seat named by its account — and such + * a line is a signature only under that same account. + * + * @returns {{ lane: string, seat: number | string, account: string, session: string, line: string } | null} */ export function readSignatureLine(body) { const lines = String(body ?? '').split(/\r?\n/); @@ -1355,7 +1384,10 @@ export function readSignatureLine(body) { if (at < 0) return null; const line = lines[at].trim(); const m = SEAT_SIGNATURE_LINE.exec(line); - return m ? { lane: m[1], seat: Number(m[2]), account: m[3], session: m[4], line } : null; + if (!m) return null; + const seat = seatMark(m[2]); + if (typeof seat === 'string' && seat !== `@${m[3].toLowerCase()}`) return null; + return { lane: m[1], seat, account: m[3], session: m[4], line }; } /** @@ -1385,11 +1417,11 @@ export function signatureRefusal(body) { const at = firstNonBlankIndex(lines); const line = at < 0 ? '(the body is empty)' : lines[at].trim(); // A line naming a seat number AND a session id is a signature typed wrong — named as such, so the fix is the spelling. - const near = at >= 0 && /#[1-9]/u.test(line) && /\bsession_/u.test(line); + const near = at >= 0 && /#[1-9]|\S@[A-Za-z0-9]/u.test(line) && /\bsession_/u.test(line); return { line: line.length > 160 ? `${line.slice(0, 160)}…` : line, why: near - ? 'the first non-empty line reads like a signature and is not one — check the lane, the `#N` seat number, the login, the full session id, and that each separator is exactly ` · `' + ? 'the first non-empty line reads like a signature and is not one — check the lane, the `#N` seat number (or an `@ACCOUNT` seat, which only that same account signs), the login, the full session id, and that each separator is exactly ` · `' : 'the first non-empty line is not a signature — the reader cannot tell which lane, seat, account or session wrote this', }; } @@ -8101,6 +8133,20 @@ export function seatDeclaresWait(markerBody) { return SEAT_WAIT_MARKERS.some((term) => text.includes(term)); } +/** A seat title's lane half that opens `LANE@ACCOUNT`, the account attached with no space on either side. */ +const SEAT_TITLE_ACCOUNT = new RegExp(`^([^\\s@]+)@(${SIGNATURE_ACCOUNT_SOURCE})(?=\\s|$)`, 'u'); + +/** + * The account a seat title's lane half names its seat by, or null: `{ lane, mark, rest }`, `mark` the seat mark + * `@account` and `rest` the half with the account taken off, so every reader below sees the text a bare post + * carries. `domain:ui @ objectui` (a space before the `@`) names a board, not an account, and reads null. Pure. + */ +export function seatTitleAccount(half) { + const text = String(half ?? '').trim(); + const m = SEAT_TITLE_ACCOUNT.exec(text); + return m ? { lane: m[1], mark: `@${m[2].toLowerCase()}`, rest: `${m[1]}${text.slice(m[0].length)}` } : null; +} + /** * The lane a seat post speaks for, parsed from its title, plus whether that * lane is READABLE FROM THIS BOARD. @@ -8122,6 +8168,11 @@ export function seatDeclaresWait(markerBody) { * bare post does, and seat 1 keeps the bare title (an absent suffix reads as * seat 1 — every seat post written before the suffix existed is seat 1). * + * A seat named by its account opens `LANE@ACCOUNT`, the account attached to + * the lane with no space (`seatTitleAccount`): that is its seat mark + * (`@account`, `seatMark`'s spelling), never seat 1 and never a board. The + * board suffix above is written after a space on every measured post. + * * The `foreign` flag is the load-bearing half and it exists for the same reason * H19 refuses to guess at a cross-repo 404: this sweep reads ONE repo. A seat * whose lane lives in a sibling repo has an inventory this patrol cannot see at @@ -8131,19 +8182,22 @@ export function seatDeclaresWait(markerBody) { * changes. `repo:*`-scoped and lane-less seats (`triage`) are foreign for the * same reason: there is no `domain:*` label to count a lane inventory against. * - * @returns {{ lane: string|null, foreign: boolean, seat: number|null }} — - * `seat` is the seat number (1 when the title carries no `· seat N`), or - * null when the title does not parse as a seat post at all. + * @returns {{ lane: string|null, foreign: boolean, seat: number|string|null }} — + * `seat` is the seat mark: the number (1 when the title carries no + * `· seat N`), `@account` for a `LANE@ACCOUNT` title, or null when the title + * does not parse as a seat post at all. */ export function seatLane(issue) { const m = /^\[PM seat\]\s*(.*?)\s*—\s*(.*)$/u.exec(issue?.title ?? ''); if (!m) return { lane: null, foreign: true, seat: null }; let raw = m[1].trim(); + const named = seatTitleAccount(raw); + if (named) raw = named.rest; // The `· seat N` suffix (free-claim multi-seat) is a seat NUMBER, wherever // it sits in the lane half; taken out first so the lane test below sees the // same text a bare post would. Absent ⇒ seat 1. const seatM = /\s*·\s*seat\s+(\d+)\b/iu.exec(raw); - const seat = seatM ? Number(seatM[1]) : 1; + const seat = named ? named.mark : seatM ? Number(seatM[1]) : 1; if (seatM) raw = (raw.slice(0, seatM.index) + raw.slice(seatM.index + seatM[0].length)).trim(); // An `@ ` suffix names the board the lane lives on. Present ⇒ the lane // is only READABLE there, whatever its `domain:*` spelling says here. @@ -8164,7 +8218,7 @@ export function seatLane(issue) { * for each `epic #N` / `epic:#N` (`· epic #34571`). * * Only a seat on THIS board's repo lane has an intake here: `repo:NAME` - * (`#N` or `· seat N` beside it) whose NAME is the swept repo's, with no + * (`#N`, `@ACCOUNT` or `· seat N` beside it) whose NAME is the swept repo's, with no * `@ elsewhere`. A `repo:cloud` seat's cards live on another board, and a * `domain:*` seat post takes no card by label any more, so both answer `[]` * — never guessed. Pure. @@ -8177,7 +8231,7 @@ export function seatIntakeKeys(issue, repo = SWEEP_REPO.repo) { const title = String(issue?.title ?? ''); const m = /^\[PM seat\]\s*(.*?)\s*—\s*(.*)$/u.exec(title); if (!m) return []; - const name = m[1].trim(); + const name = seatTitleAccount(m[1])?.rest ?? m[1].trim(); const lane = /^repo:([A-Za-z0-9._-]+)/u.exec(name); const own = String(repo).split('/')[1] ?? ''; const at = /@\s*(\S+)/u.exec(name); @@ -9556,6 +9610,11 @@ export function seatPostLastEventMs(seat, commentRows) { * · Otherwise the number the line names: the FIRST `#` of the payload, so a * trailing note (`… (#35205)`) never moves it — except the epic shape * `epic:##`, whose first `#` is the epic and whose seat is `k`. + * · A seat named by its account (`Seat: repo:@`, the lane and + * the account attached) answers the seat mark `@account` (`seatMark`'s + * spelling), never a number: it is no numbered seat's claim, seat 1's least + * of all. Read before the number, so an epic seat's `epic:#@` + * is not seat N. * * ⚠️ The second spelling of the second answer is the repair, and the cost it * removes is measured: a wrong answer that is a REAL seat does not surface as @@ -9581,14 +9640,18 @@ const CLAIM_SEAT_KEY_LINE = /^[ \t]*(?:[-*+][ \t]+)?>?[ \t]*(?:\*\*)?`?Seat`?(?: * Pinned to the measured shapes; an unmeasured variant it misses falls back to * 1, which is the defect, so widen it on evidence rather than narrowing it. */ -const CLAIM_SEAT_DECLARATION_ANYWHERE = /(?:\*\*)?`?Seat`?(?:\*\*)?[ \t]*:[ \t]*`?(?:domain:[a-z0-9_-]+|repo:[A-Za-z0-9._-]+|epic:#[1-9][0-9]*)[ \t]*#\d/; +const CLAIM_SEAT_DECLARATION_ANYWHERE = /(?:\*\*)?`?Seat`?(?:\*\*)?[ \t]*:[ \t]*`?(?:domain:[a-z0-9_-]+|repo:[A-Za-z0-9._-]+|epic:#[1-9][0-9]*)(?:[ \t]*#\d|@[A-Za-z0-9])/; +/** A `Seat:` payload naming its seat by account: the lane, then `@ACCOUNT` attached. */ +const CLAIM_SEAT_ACCOUNT = new RegExp(`^\`?(?:epic:#[1-9][0-9]*|[A-Za-z][A-Za-z0-9:._-]*)@(${SIGNATURE_ACCOUNT_SOURCE})(?![A-Za-z0-9@-])`, 'u'); -/** @returns {number|null} the seat number, 1 when NO declaration is present at all, null when one is present but unreadable. */ +/** @returns {number|string|null} the seat mark — the seat number, or `@account` for a seat named by its account; 1 when NO declaration is present at all, null when one is present but unreadable. */ export function claimSeatNumber(body) { const text = String(body ?? ''); const m = CLAIM_SEAT_KEY_LINE.exec(text); if (!m) return CLAIM_SEAT_DECLARATION_ANYWHERE.test(text) ? null : 1; const payload = String(m[1] ?? ''); + const named = CLAIM_SEAT_ACCOUNT.exec(payload); + if (named) return `@${named[1].toLowerCase()}`; // An epic seat names its epic first: `epic:##` is seat k, never seat N. const epic = /^`?epic:#[1-9][0-9]*#(\d+)\b/.exec(payload); if (epic) return Number(epic[1]); @@ -9631,7 +9694,7 @@ export function claimSeatNumber(body) { * a lone key may be passed bare. * @param {Iterable} issues — open cards this sweep already listed. * @param {Map} commentsByNumber — threads already in the cache. - * @param {number} [seat=1] — the seat number whose claims count (`seatLane(post).seat`). + * @param {number|string} [seat=1] — the seat mark whose claims count (`seatLane(post).seat`): a number, or `@account`. * @returns {{ number: number, at: number }|null} the newest claim, or null. */ export function newestLaneClaim(intake, issues, commentsByNumber, seat = 1) { diff --git a/scripts/pm/mailbox-open.mjs b/scripts/pm/mailbox-open.mjs index bda4f3c3c63..9531430e93a 100644 --- a/scripts/pm/mailbox-open.mjs +++ b/scripts/pm/mailbox-open.mjs @@ -55,6 +55,15 @@ * lane may be named `triage`, `director`, `security`, `l2-review`, `review`, `qa`, `eval`, `queue`, `repo-…` or `epic-…` — `seatKey` * refuses one — which keeps the slug one-to-one. * + * `LANE@ACCOUNT` is the second accepted spelling (ruling record 7249169754; the + * grammar's banner is `check-half-states.mjs`'s): a seat named by the account + * that holds it, `repo:objectstack@os-bill`. Its key keeps that spelling, + * lower-cased, and is its own seat: never the numbered seat its account sits, + * and never another account's. Its slug is the lane's, `_`, the account, then + * `-0` (`repo-objectstack_os-bill-0`): a login carries no `_`, so the last one + * splits lane from account, and no numbered slug ends in `-0`. Such a seat's + * mailbox opens only under its own `--login`. + * * ## What it does, in order (open) * * ① READ the open pulls and REFUSE (exit 4) when one already carries @@ -214,7 +223,7 @@ export const L2_REVIEW_LANE_WORDS = Object.freeze([L2_REVIEW_LANE, 'review']); export const isL2ReviewLane = (lane) => L2_REVIEW_LANE_WORDS.includes(String(lane ?? '').trim().toLowerCase()); /** The epic lane's kind: `epic:#` names the `pm:epic` parent card's number, never a word (`epic:#27293#1`). */ export const SEAT_EPIC_KIND = 'epic'; -const SEAT_SHAPE = new RegExp(`^((?:${SEAT_LANE_KINDS.join('|')}):[a-z0-9._-]+|${SEAT_EPIC_KIND}:#[1-9][0-9]*|${SEAT_BARE_LANES.join('|')})(?:#([1-9][0-9]*))?$`); +const SEAT_SHAPE = new RegExp(`^((?:${SEAT_LANE_KINDS.join('|')}):[a-z0-9._-]+|${SEAT_EPIC_KIND}:#[1-9][0-9]*|${SEAT_BARE_LANES.join('|')})(?:#([1-9][0-9]*)|@(${LOGIN_SHAPE.source.slice(1, -1).replace(/A-Z/g, '')}))?$`); // What a `domain:` lane may NOT be named, so the slug stays one-to-one (header): a bare lane word (`domain:triage` // would slug to `triage-1`, the triage seat's), or another kind's name with its colon turned into the hyphen the slug // uses (`domain:repo-cloud` would slug to `repo-cloud-1`, `repo:cloud#1`'s; `domain:epic-12` to `epic-12-1`, `epic:#12#1`'s). @@ -229,14 +238,17 @@ const LEGACY_OWNER_LINE = /^(?:To|Mailbox-of):[ \t]*(\S+)$/; * number always spelled (`triage` → `triage#1`); `slug` is the key as one ref segment (header). A `domain:` lane * named after a reserved lane word (`domain:triage`, `domain:repo-cloud`) is not a seat either: its slug would be * another seat's, and the header's one-to-one promise is kept here, not assumed. This is the fleet's ONE seat - * grammar — the mailbox `To:` line and the doorbell keys' `LANE#N` fields read with it, never a second shape. Pure. + * grammar — the mailbox `To:` line and the doorbell keys' `LANE#N` fields read with it, never a second shape. A + * seat spelled `LANE@ACCOUNT` (header) reads `{ key, slug, account }`, the account lower-cased. Pure. */ export function seatKey(text) { const m = SEAT_SHAPE.exec(String(text ?? '').trim().toLowerCase()); if (!m) return null; if (m[1].startsWith('domain:') && RESERVED_DOMAIN_LANE.test(m[1].slice('domain:'.length))) return null; + const lane = m[1].replace(/^domain:/, '').replace(/:#?/g, '-'); + if (m[3] !== undefined) return { key: `${m[1]}@${m[3]}`, slug: `${lane}_${m[3]}-0`, account: m[3] }; const n = m[2] ?? '1'; - return { key: `${m[1]}#${n}`, slug: `${m[1].replace(/^domain:/, '').replace(/:#?/g, '-')}-${n}` }; + return { key: `${m[1]}#${n}`, slug: `${lane}-${n}` }; } /** `mailbox//`; `seat` is a `seatKey` reading. */ @@ -286,6 +298,7 @@ export function parseArgs(argv) { else if (!seat) opts.errors.push(`--seat ${JSON.stringify(opts.seat)} is not a seat — spell it LANE#N, e.g. domain:ui#4 or epic:#27293#1`); if (!opts.login) opts.errors.push('--login is required to open a mailbox'); else if (!LOGIN_SHAPE.test(opts.login)) opts.errors.push(`--login ${JSON.stringify(opts.login)} is not a GitHub login`); + else if (seat?.account !== undefined && seat.account !== opts.login.toLowerCase()) opts.errors.push(`--seat ${JSON.stringify(opts.seat)} is named by another account than --login ${JSON.stringify(opts.login)} — a seat named by an account opens under that account only`); else if (seat && opts.head === null && !BRANCH_SHAPE.test(mailboxBranch(opts.login, seat))) opts.errors.push(`the seat's branch ${JSON.stringify(mailboxBranch(opts.login, seat))} is not a legal ref`); if (opts.head !== null && !BRANCH_SHAPE.test(opts.head)) opts.errors.push(`--head ${JSON.stringify(opts.head)} is not a branch name`); if (opts.base !== null && !BRANCH_SHAPE.test(opts.base)) opts.errors.push(`--base ${JSON.stringify(opts.base)} is not a branch name`); @@ -377,7 +390,9 @@ export function mailboxOwner(pr) { if (!labelNames(pr).includes(MAILBOX_LABEL)) return null; const first = firstLine(pr?.body); const perSeat = MAILBOX_OF_LINE.exec(first); - const seat = perSeat && LOGIN_SHAPE.test(perSeat[2]) ? seatKey(perSeat[1]) : null; + const named = perSeat && LOGIN_SHAPE.test(perSeat[2]) ? seatKey(perSeat[1]) : null; + // A seat named by an account is that account's alone: under another login the line names no seat. + const seat = named && (named.account === undefined || named.account === perSeat[2].toLowerCase()) ? named : null; if (seat) return { seat: seat.key, slug: seat.slug, login: perSeat[2] }; const ref = String(pr?.head?.ref ?? ''); const parts = ref.startsWith(MAILBOX_BRANCH_PREFIX) ? ref.slice(MAILBOX_BRANCH_PREFIX.length).split('/') : []; diff --git a/scripts/pm/record-recognisers.mjs b/scripts/pm/record-recognisers.mjs index 3f2723b3882..52759c559e8 100644 --- a/scripts/pm/record-recognisers.mjs +++ b/scripts/pm/record-recognisers.mjs @@ -102,6 +102,7 @@ import { directiveValues, labelNames, readSignatureLine, + seatIdOf, refsTargets, RELEASE_COMMENT_MARKER, releaseAnswersClaim, @@ -906,9 +907,11 @@ const CONTRACT_REVIEW_HANDOFF_MARKER = new RegExp(CONTRACT_REVIEW_HANDOFF_LINE.s * `repo:#N` (a repo name may carry `.` and `-`, `repo:www.objectos.ai#2`), an epic seat `epic:##` (seat * k of epic N, both numbers required) or a retired domain seat `domain:#N`, the seat number required -- a * separator (an em dash, a hyphen pair, a hyphen or a colon), then the rest. `triage` and every other seat word - * match nothing. + * match nothing. Each lane also reads with the second seat mark, `@ACCOUNT` in place of `#N` (`l2-review@os-bill`, + * `repo:objectstack@os-bill`; `check-half-states.mjs`'s banner): that account's seat, lower-cased like the rest. */ -const HANDOFF_TARGET = new RegExp(`^((?:${L2_REVIEW_LANE_WORDS.join('|')})#[1-9][0-9]*|(?:repo:[a-z0-9][a-z0-9._-]*|domain:[a-z][a-z0-9._-]*|epic:#[1-9][0-9]*)#[1-9][0-9]*)(?![0-9])[ \\t]*(?:—|--|-|:)?[ \\t]*(.*)$`, 'i'); +const HANDOFF_SEAT_MARK = '(?:#[1-9][0-9]*(?![0-9])|@[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}(?![A-Za-z0-9]))'; +const HANDOFF_TARGET = new RegExp(`^((?:${L2_REVIEW_LANE_WORDS.join('|')}|repo:[a-z0-9][a-z0-9._-]*|domain:[a-z][a-z0-9._-]*|epic:#[1-9][0-9]*)${HANDOFF_SEAT_MARK})[ \\t]*(?:—|--|-|:)?[ \\t]*(.*)$`, 'i'); /** `(reason, UTC time)` then ` · head SHA` -- the time is the LAST comma-separated item in the parentheses. */ const HANDOFF_TAIL = /^\(([^()]*?)[ \t]*,[ \t]*([^,()]+)\)[ \t]*·[ \t]*head[ \t]+`?([0-9a-fA-F]{7,40})`?[ \t]*$/; @@ -1451,11 +1454,13 @@ const FOOTER_LINE = /^_Generated by \[Claude Code\]\(https:\/\/claude\.ai\/code( * A key's `LANE#N` field → `{ key, lane, n }`, or null. Read with `seatKey`, the ONE seat grammar (#27891): the * lane is `domain:`, `repo:`, `triage` or `director`, so the short form `skills#2` is refused here exactly * as on the `To:` line, an absent number is seat 1 (`triage` → `triage#1`), and a `domain:` lane named after a - * reserved lane word is no seat. `key` is the canonical spelling; `lane` and `n` are its two halves. + * reserved lane word is no seat. `key` is the canonical spelling; `lane` and `n` are its two halves. A seat named + * by its account (`LANE@ACCOUNT`, `seatKey`'s second spelling) has no number: `n` is null and `account` names it. */ function readSeat(part) { const s = seatKey(part); if (!s) return null; + if (s.account !== undefined) return { key: s.key, lane: s.key.slice(0, s.key.lastIndexOf('@')), n: null, account: s.account }; const at = s.key.lastIndexOf('#'); return { key: s.key, lane: s.key.slice(0, at), n: Number(s.key.slice(at + 1)) }; } @@ -1571,6 +1576,8 @@ const MAILBOX_FIELD_READERS = Object.freeze({ const mailbox = MAILBOX_REF.exec(p[3]); const patrol = PATROL_REF.exec(p[4]); const takes = readList(p[5], 'takes'); + // A seat named by an account comes online under that account only. + if (seat?.account !== undefined && seat.account !== String(login ?? '').toLowerCase()) return null; return seat && login && mailbox && patrol && takes ? { seat, login, mailbox: Number(mailbox[1]), patrol: patrol[1], takes, numbers: [Number(mailbox[1]), ...takes] } : null; }, 'notify:seat-offline': (p) => { @@ -1843,7 +1850,7 @@ function claimDelegate(card, rows) { const { row, index } = live[newest.index]; if (releaseAnswersClaim(latestMarkedComment(rows, RELEASE_COMMENT_MARKER), { ...newest, index })) return null; const signed = readSignatureLine(row?.body); - const seat = signed ? seatKey(`${signed.lane}#${signed.seat}`) : null; + const seat = signed ? seatKey(seatIdOf(signed.lane, signed.seat)) : null; const session = claimThreadSession(row?.body); if (!seat || !session) return null; return { seat: seat.key, session, where: `claim on #${card.number} (comment ${row?.id ?? '?'}) Thread session` }; @@ -1898,7 +1905,7 @@ export function seatSessionRoster({ posts, mailboxes, claims = [] } = {}) { for (const post of posts) { if (!post || post.state !== 'open' || post.pull_request || !labelNames(post).includes('pm:seat') || !seatOnDuty(post)) continue; const signed = readSignatureLine(post.body); - const seat = signed ? seatKey(`${signed.lane}#${signed.seat}`) : null; + const seat = signed ? seatKey(seatIdOf(signed.lane, signed.seat)) : null; if (!seat) continue; list(seat.key, signed.session, `seat post #${post.number}`); for (const value of directiveValues(post.body, 'Successor-of')) { @@ -1936,8 +1943,8 @@ export function knockSignature(body, roster) { } const signed = readSignatureLine(body); if (!signed) return unlisted('the knock opens with no seat signature line'); - const seat = seatKey(`${signed.lane}#${signed.seat}`)?.key ?? null; - if (!seat) return unlisted(`\`${signed.lane}#${signed.seat}\` names no seat a mailbox serves`); + const seat = seatKey(seatIdOf(signed.lane, signed.seat))?.key ?? null; + if (!seat) return unlisted(`\`${seatIdOf(signed.lane, signed.seat)}\` names no seat a mailbox serves`); const listed = roster.seats.get(seat); if (!listed || listed.size === 0) return unlisted(`${seat} lists no session (no held seat post signed by it, no open mailbox opening, no open claim naming its card thread)`); if (!listed.has(signed.session)) return unlisted(`${signed.session} is not a session ${seat} lists`); From b217c57a2626879124f248c390447fb724a5ae7a Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 03:21:44 +0000 Subject: [PATCH 2/6] pm: the remaining seat readers take the account mark (pick, round, roster, relay, owed reviews, handover) Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01FEkQ5oPfjnm2yWHEwkiYrn --- scripts/pm/card-pick.mjs | 14 +++++--- scripts/pm/check-handover.mjs | 3 +- scripts/pm/check-owed-reviews.mjs | 14 ++++---- scripts/pm/fleet-roster.mjs | 55 ++++++++++++++++++----------- scripts/pm/fleet-write/dispatch.mjs | 8 ++--- scripts/pm/fleet-write/ops.mjs | 17 +++++---- scripts/pm/round-open.mjs | 29 +++++++++------ 7 files changed, 87 insertions(+), 53 deletions(-) diff --git a/scripts/pm/card-pick.mjs b/scripts/pm/card-pick.mjs index 98613497bad..11e83ff4e92 100644 --- a/scripts/pm/card-pick.mjs +++ b/scripts/pm/card-pick.mjs @@ -105,6 +105,8 @@ import { labelNames, markerMatches, readSignatureLine, + seatIdOf, + seatMark, subIssueParentPath, } from './check-half-states.mjs'; import { ghApi, readAllPages } from './gh-pages.mjs'; @@ -181,13 +183,14 @@ export function parseOrder(text) { /** * `--seat LANE#N` parsed by the seat signature's own grammar (`SEAT_SIGNATURE_LINE`, borrowed, never re-spelled), so - * every lane a signature can carry is accepted, an epic seat's `epic:#N#1` included. Pure. + * every lane a signature can carry is accepted, an epic seat's `epic:#N#1` included — and both seat marks: + * `LANE@ACCOUNT` names the seat by its account (`seat` is then `@account`, `seatMark`'s reading). Pure. */ export function parseSeat(text) { const v = String(text ?? ''); if (/\s/.test(v)) return null; const m = SEAT_SIGNATURE_LINE.exec(`${v}${SEAT_SIGNATURE_SEPARATOR}seat${SEAT_SIGNATURE_SEPARATOR}session_parseseat`); - return m ? { lane: m[1], seat: Number(m[2]), name: `${m[1]}#${m[2]}` } : null; + return m ? { lane: m[1], seat: seatMark(m[2]), name: seatIdOf(m[1], seatMark(m[2])) } : null; } const GRADE_NAMES = Object.freeze(['p0', 'p1', 'p2', 'p3']); @@ -309,7 +312,8 @@ export function claimReason(comments, seat) { if (own === null || own.kind === 'release') return null; const sig = own.signature; if (!sig) return 'Claim: (unsigned) — another session holds it unless the claim names you'; - const who = `${sig.lane}#${sig.seat}`; + // Lane AND mark: a `#N` claim is that numbered seat's, an `@ACCOUNT` claim that account's — never each other's. + const who = seatIdOf(sig.lane, sig.seat); if (seat && seat.name === who) return `Claim: by this seat (${who}) — already yours, not a new pick`; return `Claim: by ${who}`; } @@ -588,7 +592,7 @@ export function fixtureGet(fixture, repo) { const USAGE = [ 'card-pick — which ready cards a seat takes next (read-only; the claim re-read still arbitrates).', '', - ' node scripts/pm/card-pick.mjs --order epic:#N,area:NAME,… [--seat LANE#N] [--repo OWNER/NAME]', + ' node scripts/pm/card-pick.mjs --order epic:#N,area:NAME,… [--seat LANE#N|LANE@ACCOUNT] [--repo OWNER/NAME]', ' [--limit N] [--why] [--json] [--fixture FILE] [--now ISO]', ' node scripts/pm/card-pick.mjs --self-test', '', @@ -620,7 +624,7 @@ export function parseArgs(argv) { } else if (flag === '--seat') { const v = take(); opts.seat = parseSeat(v); - if (!opts.seat) return { error: `--seat must be LANE#N (a seat signature's first part), got \`${v}\`` }; + if (!opts.seat) return { error: `--seat must be LANE#N or LANE@ACCOUNT (a seat signature's first part), got \`${v}\`` }; } else if (flag === '--limit') { const v = take(); if (!/^[1-9][0-9]*$/.test(String(v ?? ''))) return { error: `--limit must be a positive integer, got \`${v}\`` }; diff --git a/scripts/pm/check-handover.mjs b/scripts/pm/check-handover.mjs index 5e24a5df90e..974dff53076 100644 --- a/scripts/pm/check-handover.mjs +++ b/scripts/pm/check-handover.mjs @@ -181,6 +181,7 @@ import { proxyRearmPlan, readSignatureLine, resolveSweepRepo, + seatIdOf, stripMarkdownCode, stripSignatureLine, } from './check-half-states.mjs'; @@ -872,7 +873,7 @@ export function inflightSurface(issue, comments) { const paths = [...current]; const excluded = [...excludedAll]; const sig = readSignatureLine(String(claim?.body ?? '')); - return { verdict: 'held', claim, session: claimSession(claim?.body), seat: sig ? `${sig.lane}#${sig.seat}` : null, declared, paths, excluded }; + return { verdict: 'held', claim, session: claimSession(claim?.body), seat: sig ? seatIdOf(sig.lane, sig.seat) : null, declared, paths, excluded }; } /** `--paths=a,b` → the dispatch's surface entries (code-span backticks tolerated), or the usage error. */ diff --git a/scripts/pm/check-owed-reviews.mjs b/scripts/pm/check-owed-reviews.mjs index 3d61702e249..9d55dfb8e67 100644 --- a/scripts/pm/check-owed-reviews.mjs +++ b/scripts/pm/check-owed-reviews.mjs @@ -110,7 +110,7 @@ import process from 'node:process'; import { isEntrypoint } from '../invoked-as.mjs'; -import { cardIntakeKeys, CONTRACT_REVIEW_HEADING_MARKER, contractReviewVerdictLines, latestMarkedComment, readSignatureLine, seatIntakeKeys } from './check-half-states.mjs'; +import { cardIntakeKeys, CONTRACT_REVIEW_HEADING_MARKER, contractReviewVerdictLines, latestMarkedComment, readSignatureLine, seatIdOf, seatIntakeKeys } from './check-half-states.mjs'; import { repoIdForSlug } from './check-governed-merges.mjs'; import { GOVERNED_APPROVERS, NARROWING_FACE_LINE, narrowingDeclarationsIn, recordAuthorTrusted, recordTrustedAuthors } from './check-governed-queue-guard.mjs'; import { FLEET_BOT_LOGIN } from './check-handover.mjs'; @@ -283,12 +283,13 @@ export function recordReading(pull, trusted = RECORD_AUTHORS) { } /** - * The seat that signed a record — its first line's seat signature (`readSignatureLine`), as `lane#N`, - * the spelling `reviewSeatsOf` names a seat with — or null when it carries none. Pure. + * The seat that signed a record — its first line's seat signature (`readSignatureLine`), as `lane#N` (or + * `lane@account` for a seat named by its account), the spelling `reviewSeatsOf` names a seat with — or null when + * it carries none. Pure. */ export function signerSeatOf(body) { const sig = readSignatureLine(body); - return sig === null ? null : `${sig.lane}#${sig.seat}`; + return sig === null ? null : seatIdOf(sig.lane, sig.seat); } /** The limbs owe on the declaration face ALONE (`Clause-②: yes`, no schema and no governed path): `TIER_DEFAULT`. Pure. */ @@ -323,7 +324,8 @@ export function laneSeatOf(cardKeys, seats) { export function reviewSeatsOf(seats) { if (!Array.isArray(seats)) return { state: 'unknown', seated: [] }; const rows = seats.filter((s) => isL2ReviewLane(s?.lane)); - const name = (s) => `${String(s.lane).trim().toLowerCase()}#${Number(s.seat) > 0 ? Number(s.seat) : 1}`; + // A seat named by its account (`seat` is `@account`, fleet-roster's `parseSeat`) keeps that name: ⛔ never seat 1. + const name = (s) => (typeof s.seat === 'string' && s.seat.startsWith('@') ? seatIdOf(String(s.lane).trim().toLowerCase(), s.seat) : `${String(s.lane).trim().toLowerCase()}#${Number(s.seat) > 0 ? Number(s.seat) : 1}`); // `lanes/l2-review.md` 独立性: the pair is two SESSIONS, ⛔ never two accounts (ruling A on #33258) — // a seat's account is not read, so one on the PR's own implementing or dispatching account is seated like any other. const seated = rows.filter((s) => s.status === 'seated').map(name).sort(); @@ -416,7 +418,7 @@ export function takerOf(status, handoff, lane, review = { state: 'unknown', seat const seat = lane?.lane ? `the ${lane.lane} seat` : 'the lane seat'; const laneGone = lane?.seat === 'stood-down' || lane?.seat === 'absent'; const laneTaker = laneGone ? `${seat} next on duty` : seat; - const isL2 = (name) => typeof name === 'string' && isL2ReviewLane(name.split('#')[0]); + const isL2 = (name) => typeof name === 'string' && isL2ReviewLane(name.split(/[#@]/)[0]); const handedTo = handoff?.state === 'handed' && typeof handoff.to === 'string' ? handoff.to : null; if (declarationFaceOnly(limbs)) { if (handedTo !== null && !isL2(handedTo)) return handedTo; diff --git a/scripts/pm/fleet-roster.mjs b/scripts/pm/fleet-roster.mjs index 20fa09b1c62..c0ea2a5f98f 100644 --- a/scripts/pm/fleet-roster.mjs +++ b/scripts/pm/fleet-roster.mjs @@ -58,7 +58,10 @@ * lane = the name's first token (`domain:x`, `repo:x`, * `director`, `triage`); seat = `· seat N` or `repo:x#N`, * else 1; repo = `repo:x`'s repo, else `@ `, else the - * repo the post lives on. + * repo the post lives on. A name opening `LANE@ACCOUNT` (the + * account attached, `seatTitleAccount`) is a seat named by + * its account: seat = `@account`, a row of its own, never + * seat 1 and never a board. * epic rows an open `pm:epic` PARENT — sub-issues under it AND a * `session_…` registration in its body, the paired * delegation signal (`seat-lifecycle.md` 〈Epic 子树车道〉; @@ -173,7 +176,7 @@ import { isL2ReviewLane, L2_REVIEW_LANE, LEDGER_EXCLUSION, MAILBOX_BRANCH_PREFIX // re-spells it. The relay that imports `ROSTER_MARKER` from here (`fleet-write/dispatch.mjs`) already imports // check-half-states itself, so this import loads nothing new there. The opener's lane-word lists cannot import it // (the patrol loads the opener lazily, so that edge would be a cycle); the self-test holds the two equal. -import { GOVERNED_PR_AWAITING_MERGE_LABEL, SEAT_SIGNATURE_LINE } from './check-half-states.mjs'; +import { GOVERNED_PR_AWAITING_MERGE_LABEL, readSignatureLine, SEAT_SIGNATURE_LINE, seatIdOf, seatTitleAccount } from './check-half-states.mjs'; // `--health`'s reverse read and the inbox label: the shared `Blocked-by:` reader (body and thread, cross-repo keyed) // and the decision label, imported, never re-spelled. import { blockerTargetsFor, DECISION_INBOX_LABEL } from './check-half-states.mjs'; @@ -271,10 +274,13 @@ export function parseSeat(post, board) { if (!m) return null; const [, name, statusText] = m; const owner = board.split('/')[0]; - const token = SEAT_TITLE_TOKEN.exec(name)?.[1] ?? name.split(/\s/)[0]; + // `LANE@ACCOUNT`: the seat's mark is its account, and the rest reads as a bare post's name does. + const named = seatTitleAccount(name); + const read = named ? named.rest : name; + const token = SEAT_TITLE_TOKEN.exec(read)?.[1] ?? read.split(/\s/)[0]; const lane = token.replace(/#\d+$/, ''); - const seat = Number(/·\s*seat\s+(\d+)/.exec(name)?.[1] ?? /^repo:[A-Za-z0-9._-]+#(\d+)/.exec(name)?.[1] ?? 1); - const at = /@\s*([A-Za-z0-9._/-]+)/.exec(name)?.[1] ?? null; + const seat = named ? named.mark : Number(/·\s*seat\s+(\d+)/.exec(read)?.[1] ?? /^repo:[A-Za-z0-9._-]+#(\d+)/.exec(read)?.[1] ?? 1); + const at = /@\s*([A-Za-z0-9._/-]+)/.exec(read)?.[1] ?? null; const repo = lane.startsWith('repo:') ? `${owner}/${lane.slice(5)}` : at ? (at.includes('/') ? at : `${owner}/${at}`) : board; const mark = Object.keys(STATUS_BY_MARK).find((k) => statusText.startsWith(k)) ?? null; const status = mark ? STATUS_BY_MARK[mark] : 'unknown'; @@ -343,23 +349,29 @@ const isEpicRegistered = (i) => /session_[A-Za-z0-9]{4,}/.test(String(i?.body ?? export const isSeatedFreshEpic = (i, held) => held.size > 0 && isEpicRegistered(i); /** * Epic `lane`'s seats holding an open mailbox, seat → login, matched by `seatKey`'s slug `epic--` exactly as the - * mailbox column matches — a `Mailbox-of:` line or a head-only `mailbox//epic--` alike. Pure. + * mailbox column matches — a `Mailbox-of:` line or a head-only `mailbox//epic--` alike. A seat named + * by its account (`epic:#@`) is matched the same way, by that key's own slug, and maps its mark. Pure. */ export function epicSeatsHeld(lane, mailboxes) { const stem = seatKey(lane).slug.replace(/1$/, ''); return new Map(mailboxes.flatMap((m) => { + const named = m.login ? seatKey(`${lane}@${m.login}`) : null; + if (named && named.slug === m.slug) return [[`@${named.account}`, m.login]]; const k = m.slug?.startsWith(stem) ? m.slug.slice(stem.length) : null; return k !== null && seatKey(`${lane}#${k}`)?.slug === m.slug ? [[Number(k), m.login]] : []; })); } const isEpicLane = (lane) => lane.startsWith(`${SEAT_EPIC_KIND}:`); -/** The seat a body is signed by — its FIRST non-empty line, `readSignatureLine`'s reading — as `LANE#N`, or null. Pure. */ +/** The seat a body is signed by — its FIRST non-empty line, `readSignatureLine`'s reading — as `LANE#N` or `LANE@account`, or null. Pure. */ export function signedSeatOf(body) { - const line = String(body ?? '').split(/\r?\n/).find((l) => l.trim() !== ''); - const m = line === undefined ? null : SEAT_SIGNATURE_LINE.exec(line.trim()); - return m ? `${m[1]}#${m[2]}` : null; + const signed = readSignatureLine(body); + return signed ? seatIdOf(signed.lane, signed.seat) : null; } +/** A seat id's lane: everything before its mark, `#N` or `@account`. */ +const laneOfSeatId = (id) => id.slice(0, Math.max(id.lastIndexOf('#'), id.lastIndexOf('@'))); +/** Seat marks in row order: the numbered seats by number, then the seats named by an account, by name. */ +const bySeatMark = (a, b) => (typeof a === typeof b ? (a < b ? -1 : a > b ? 1 : 0) : typeof a === 'number' ? -1 : 1); /** The newest signed-comment time per seat, `LANE#N` → ISO, over every repo's `recentComments`. Pure. */ export function signedActivity(snapshot) { @@ -391,7 +403,7 @@ export function reviewClaims(snapshot, { now }) { const heads = new Map((s.pulls ?? []).filter((p) => p.state !== 'closed' && p?.head?.sha).map((p) => [p.number, p.head.sha])); for (const c of s.recentComments ?? []) { const seat = signedSeatOf(c?.body); - if (seat === null || !isL2ReviewLane(seat.slice(0, seat.lastIndexOf('#')))) continue; + if (seat === null || !isL2ReviewLane(laneOfSeatId(seat))) continue; const number = Number(/\/issues\/(\d+)$/.exec(String(c?.issue_url ?? ''))?.[1]); const claim = readContractReviewClaim(c?.body); if (!heads.has(number) || claim.state !== 'read') continue; @@ -406,7 +418,7 @@ export function reviewClaims(snapshot, { now }) { export const activitySince = (now) => new Date(Date.parse(now) - STALE_HOURS * 3_600_000).toISOString().replace(/\.\d{3}Z$/, 'Z'); /** A seat row's mailbox slug — its `LANE#N` as the opener spells it in a ref — or null. Pure. */ -const seatSlugOf = (row) => seatKey(`${row.lane}#${row.seat}`)?.slug ?? null; +const seatSlugOf = (row) => seatKey(seatIdOf(row.lane, row.seat))?.slug ?? null; /** Every open `pm:mailbox` pull in the snapshot, with whose it is (`mailboxOwner`), ordered by ref. Pure. */ export function readMailboxes(snapshot) { @@ -484,7 +496,7 @@ export function buildRows(snapshot, { now }) { pullUpdatedAt.set(keyOf(ref(repo, p.number)), p.updated_at ?? null); } } - rows.sort((a, b) => (a.repo !== b.repo ? (a.repo < b.repo ? -1 : 1) : a.lane !== b.lane ? (a.lane < b.lane ? -1 : 1) : a.seat !== b.seat ? a.seat - b.seat : a.post - b.post)); + rows.sort((a, b) => (a.repo !== b.repo ? (a.repo < b.repo ? -1 : 1) : a.lane !== b.lane ? (a.lane < b.lane ? -1 : 1) : a.seat !== b.seat ? bySeatMark(a.seat, b.seat) : a.post - b.post)); const landing = new Map(); // card key → [pull refs] for (const { repo, pr, comments } of pulls) { @@ -503,7 +515,7 @@ export function buildRows(snapshot, { now }) { const out = rows.map((row) => { const acct = lc(row.account); // An L2 seat's claims are signed per seat, so it never shares: its in-flight is the pulls its live claims hold. - const claims = isL2ReviewLane(row.lane) ? (claimed.get(`${row.lane}#${row.seat}`) ?? []).sort(byRef) : null; + const claims = isL2ReviewLane(row.lane) ? (claimed.get(seatIdOf(row.lane, row.seat)) ?? []).sort(byRef) : null; // One account on two seats of one lane: the cards cannot say which seat, so the lowest seat shows them once. const first = row.account && claims === null ? rows.find((r) => r.repo === row.repo && r.lane === row.lane && lc(r.account) === acct) : row; const sharesWith = first !== row ? first.seat : null; @@ -513,7 +525,7 @@ export function buildRows(snapshot, { now }) { // Per seat, never per account: one account holds several seats, and each seat opens its own. const mailbox = mailboxes.filter((m) => m.slug !== null && m.slug === seatSlugOf(row)).map((m) => m.ref); // The seat's own traces: a seat sharing its lane's account with a lower seat has no in-flight cards of its own. - const times = [row.updatedAt, ...inFlight.map((c) => c.updatedAt), ...(claims ?? []).map((m) => pullUpdatedAt.get(keyOf(m))), ...mailbox.map((m) => pullUpdatedAt.get(keyOf(m))), signed.get(`${row.lane}#${row.seat}`)].filter(Boolean).sort(); + const times = [row.updatedAt, ...inFlight.map((c) => c.updatedAt), ...(claims ?? []).map((m) => pullUpdatedAt.get(keyOf(m))), ...mailbox.map((m) => pullUpdatedAt.get(keyOf(m))), signed.get(seatIdOf(row.lane, row.seat))].filter(Boolean).sort(); const lastActivity = times.at(-1) ?? null; const ageHours = lastActivity && Number.isFinite(nowMs) ? (nowMs - Date.parse(lastActivity)) / 3_600_000 : null; return { @@ -596,9 +608,11 @@ export function renderBody(rows, { now, repos, session = null, unassigned = [], const who = r.routine ? 'Routine' : r.account ? `\`${r.account}\`` : '—'; const account = `${r.mark ?? '?'} ${who}${r.project ? ` · 由 ${r.project} 账户的项目负责` : ''}`; const wall = r.wallNote ?? (r.suspectedWall ? `⚠️ ${SUSPECTED_WALL}` : '—'); - const inFlight = r.sharesWith !== null ? `= seat ${r.sharesWith}` : refs(r.inFlight); + // A seat named by an account prints its mark in a code span: a loose `@login` in an issue body is a mention. + const mark = (seat) => (typeof seat === 'string' ? `\`${seat}\`` : seat); + const inFlight = r.sharesWith !== null ? `= seat ${mark(r.sharesWith)}` : refs(r.inFlight); lines.push( - `| ${r.repo.split('/')[1]} | ${cell(r.lane)} | [${r.seat}](https://github.com/${r.board}/issues/${r.post}) | ${cell(account)} | ${inFlight} | ${refs(r.awaitingRuling)} | ${refs(r.awaitingMerge)} | ${refs(r.awaitingLanding)} | ${cell(wall)} | ${age(r.lastActivity, now)} | ${refs(r.mailbox)} |`, + `| ${r.repo.split('/')[1]} | ${cell(r.lane)} | [${mark(r.seat)}](https://github.com/${r.board}/issues/${r.post}) | ${cell(account)} | ${inFlight} | ${refs(r.awaitingRuling)} | ${refs(r.awaitingMerge)} | ${refs(r.awaitingLanding)} | ${cell(wall)} | ${age(r.lastActivity, now)} | ${refs(r.mailbox)} |`, ); } const seated = rows.filter((r) => r.status === 'seated'); @@ -1286,14 +1300,13 @@ async function selfTest() { return [line.includes('| = seat 1 |'), line.includes(SUSPECTED_WALL)]; })(), [true, false]); t('the comment read starts STALE_HOURS before now, and the footer names it', [activitySince(NOW), readsFor([R]).some((q) => q.startsWith(`GET /repos/${R}/issues/comments?since=`))], ['2026-11-01T22:00:00Z', true]); - const { readSignatureLine } = await import('./check-half-states.mjs'); - t('the signature pattern is check-half-states\' SEAT_SIGNATURE_LINE, imported — no second spelling of the lane alternation in this file (and the awaiting-merge label rides the same import, no second spelling of it either)', [/^import \{ GOVERNED_PR_AWAITING_MERGE_LABEL, SEAT_SIGNATURE_LINE \} from '\.\/check-half-states\.mjs';$/mu.test(readFileSync(SELF_PATH, 'utf8')), readFileSync(SELF_PATH, 'utf8').includes(['triage', 'director', 'coordinator'].join('|')), readFileSync(SELF_PATH, 'utf8').includes(["'pm:", 'awaiting-merge', "'"].join(''))], [true, false, false]); + t('the signature pattern is check-half-states\' SEAT_SIGNATURE_LINE, imported — no second spelling of the lane alternation in this file (and the awaiting-merge label rides the same import, no second spelling of it either)', [/^import \{ GOVERNED_PR_AWAITING_MERGE_LABEL, readSignatureLine, SEAT_SIGNATURE_LINE, seatIdOf, seatTitleAccount \} from '\.\/check-half-states\.mjs';$/mu.test(readFileSync(SELF_PATH, 'utf8')), readFileSync(SELF_PATH, 'utf8').includes(['triage', 'director', 'coordinator'].join('|')), readFileSync(SELF_PATH, 'utf8').includes(["'pm:", 'awaiting-merge', "'"].join(''))], [true, false, false]); // The lane grammar's two remaining owners, held equal here (the only file that imports both): the signature's // alternation and the opener's lane-word lists. `coordinator` is the one lane that signs and has no mailbox. - const signatureLanes = (/^\^\(\(\?:([^()]*)\)\)#/u.exec(SEAT_SIGNATURE_LINE.source)?.[1] ?? '').split('|'); + const signatureLanes = (/^\^\(\(\?:([^()]*)\)\)\(/u.exec(SEAT_SIGNATURE_LINE.source)?.[1] ?? '').split('|'); t('⭐ the lane grammar is ONE set: the signature\'s kinds are the opener\'s kinds plus `epic`, its bare words the opener\'s bare lanes plus `coordinator` — a lane added to one side alone reds here', [signatureLanes.filter((a) => a.includes(':')).map((a) => a.slice(0, a.indexOf(':'))).sort(), signatureLanes.filter((a) => !a.includes(':')).sort(), signatureLanes.length], [[...mailboxOpen.SEAT_LANE_KINDS, SEAT_EPIC_KIND].sort(), [...mailboxOpen.SEAT_BARE_LANES, 'coordinator'].sort(), mailboxOpen.SEAT_LANE_KINDS.length + 1 + mailboxOpen.SEAT_BARE_LANES.length + 1]); const corpus = ['', sig('domain:server#2'), `\n\n ${sig('domain:engine-core#3')}\r\nbody`, `body\n${sig('triage#1')}`, sig('security#1'), 'epic:#27293#1 · sunhaolin · session_017xRBcVBKAFk1ntXSjvPt7U', 'domain:server#0 · os-pm · session_01SharedSeatSess', 'domain:server#2 · os-pm · cse_01SharedSeatSess']; - t('signedSeatOf reads every body as readSignatureLine does', corpus.map(signedSeatOf), corpus.map((b) => { const r = readSignatureLine(b); return r ? `${r.lane}#${r.seat}` : null; })); + t('signedSeatOf reads every body as readSignatureLine does', corpus.map(signedSeatOf), corpus.map((b) => { const r = readSignatureLine(b); return r ? seatIdOf(r.lane, r.seat) : null; })); } battery('the rendered body: marker, columns, footer, determinism'); diff --git a/scripts/pm/fleet-write/dispatch.mjs b/scripts/pm/fleet-write/dispatch.mjs index b6fc55d0388..ed54551c146 100644 --- a/scripts/pm/fleet-write/dispatch.mjs +++ b/scripts/pm/fleet-write/dispatch.mjs @@ -941,7 +941,7 @@ function trailerWhy(body) { if (read === null) return { line: '(the body is empty)', why: 'there is no last line to carry the trailer' }; const line = read.line.length > 160 ? `${read.line.slice(0, 160)}…` : read.line; return read.shaped - ? { line, why: "the last non-empty line is the trailer's comment, but its inside is not a signature — check the lane, the `#N` seat number, the login, the full session id, and that each separator is exactly ` · `" } + ? { line, why: "the last non-empty line is the trailer's comment, but its inside is not a signature — check the lane, the `#N` seat number (or an `@ACCOUNT` seat, which only that same account signs), the login, the full session id, and that each separator is exactly ` · `" } : { line, why: 'the last non-empty line is not the trailer' }; } @@ -1718,7 +1718,7 @@ const strictNoteUtf8 = new TextDecoder('utf-8', { fatal: true }); /** * Why `section` is not a note's section, or null when it is (`ops.mjs`, "The one row that APPENDS"): line 1 the seat's - * signature line (`SEAT_SIGNATURE_LINE`, exactly), line 2 a stamp in `ADVISORY_NOTE_STAMP_SHAPE`, line 3 blank, then + * signature line (`SEAT_SIGNATURE_LINE`, exactly, and a signature to `readSignatureLine`: either seat mark), line 2 a stamp in `ADVISORY_NOTE_STAMP_SHAPE`, line 3 blank, then * a note that is not blank and ends in no whitespace; no control character but the tab and the newline; at most * `MAX_ADVISORY_NOTE_BYTES`. This door judges it before the seal and the executor again after the open — so ⛔ no * sentence carries a byte of it: the executor's lines reach a public log. Pure. @@ -1729,7 +1729,7 @@ export function advisoryNoteSectionFailure(section) { if (bytes > MAX_ADVISORY_NOTE_BYTES) return `the section is ${bytes} bytes, over its cap of ${MAX_ADVISORY_NOTE_BYTES}`; if (NOTE_CONTROL_SHAPE.test(section)) return 'the section carries a control character other than a tab or a newline (a carriage return among them)'; const lines = section.split('\n'); - if (!SEAT_SIGNATURE_LINE.test(lines[0])) return `its first line is not a seat signature line — ${SEAT_SIGNATURE_SHAPE}`; + if (!SEAT_SIGNATURE_LINE.test(lines[0]) || readSignatureLine(lines[0]) === null) return `its first line is not a seat signature line — ${SEAT_SIGNATURE_SHAPE}`; if (lines.length < 4 || !ADVISORY_NOTE_STAMP_SHAPE.test(lines[1])) return 'its second line is not the UTC stamp the door writes, YYYY-MM-DDThh:mm:ssZ'; if (lines[2] !== '') return 'its third line is not blank'; const note = lines.slice(3).join('\n'); @@ -1748,7 +1748,7 @@ export function advisoryNoteSection(text, stamp) { if (text.includes('\r')) return { refusal: 'it carries a carriage return — save it with LF line endings' }; const lines = text.split('\n'); const signature = lines[0].trim(); - if (!SEAT_SIGNATURE_LINE.test(signature)) return { refusal: `its first line is not your signature line — write ${SEAT_SIGNATURE_SHAPE} as the FIRST line, alone` }; + if (readSignatureLine(signature) === null) return { refusal: `its first line is not your signature line — write ${SEAT_SIGNATURE_SHAPE} as the FIRST line, alone` }; const rest = lines.slice(1); while (rest.length && rest[0].trim() === '') rest.shift(); if (rest.length && TYPED_STAMP_SHAPE.test(rest[0].trim())) return { refusal: 'the line after the signature is a typed stamp — delete it: this door writes the stamp from its own clock' }; diff --git a/scripts/pm/fleet-write/ops.mjs b/scripts/pm/fleet-write/ops.mjs index cb4d12bdc06..5c21491f9b0 100644 --- a/scripts/pm/fleet-write/ops.mjs +++ b/scripts/pm/fleet-write/ops.mjs @@ -1676,7 +1676,7 @@ export function enqueueFrontSizeLift({ verdict = null, headSha = null, comment = if (typeof signatureOf !== 'function') return { lifts: false, way: null, reading: `${earlier}; the approval_comment's lines were not judged for a seat signature` }; // Every line is read, not only the first: a signature lower down is a seat's record all the same (header). const seat = String(c.body ?? '').split(/\r?\n/u).map((line) => signatureOf(line)).find(Boolean) ?? null; - 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` }; + if (seat) return { lifts: false, way: null, reading: `${earlier}; the approval_comment by ${author} holds the seat signature ${seatOf(seat)} — a seat's comment is no carried approval` }; const tokens = String(c.body ?? '').match(/\b[0-9a-f]{7,40}\b/giu) ?? []; const carries = head !== '' && tokens.some((tok) => tok.length >= CARRIED_HEAD_MIN_CHARS && head.startsWith(tok.toLowerCase())); if (!carries) return { lifts: false, way: null, reading: `${earlier}; the approval_comment by ${author} names no prefix of the current head` }; @@ -1704,11 +1704,15 @@ export const DEQUEUE_FAILED_ROLLUPS = Object.freeze(['FAILURE', 'ERROR']); export const MAX_DEQUEUE_REASON_BYTES = 1000; const entryOf = (c) => (c.queue?.entries ?? []).find((e) => e.number === c.number) ?? null; -const seatOf = (sig) => `${sig.lane}#${sig.seat} · ${sig.account}`; +/** A signature reading's seat and account as text; `seat` is the reader's seat mark — a number (`#N`) or `@account`. */ +function seatOf(sig) { + return `${sig.lane}${typeof sig.seat === 'string' ? sig.seat : `#${sig.seat}`} · ${sig.account}`; +} /** - * Is `signature` (a `readSignatureLine` reading) the pull's landing seat — the same lane, seat number and account - * as `landing`, the reading of the pull body's signed trailer — under `session`? The `seat-asks` proof (header). Pure. + * Is `signature` (a `readSignatureLine` reading) the pull's landing seat — the same lane, seat mark (the number, or + * `@account` for a seat named by its account: the two never match each other) and account as `landing`, the + * reading of the pull body's signed trailer — under `session`? The `seat-asks` proof (header). Pure. */ export function signedByLandingSeat(signature, landing, session) { return Boolean(signature && landing) && signature.session === session && signature.lane === landing.lane && signature.seat === landing.seat && signature.account === landing.account; @@ -2243,14 +2247,15 @@ const publishes = (c) => c.to === ADVISORY_PUBLISHED_STATE; export const ADVISORY_NOTE_STAMP_SHAPE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/; /** - * A seat signature line in ANY lane — `LANE#N · ACCOUNT · SESSION`, the lane any word without a space. A superset of + * A seat signature line in ANY lane — `LANE#N · ACCOUNT · SESSION`, or `LANE@ACCOUNT` as its seat (the second + * accepted seat mark), the lane any word without a space. A superset of * `SEAT_SIGNATURE_LINE` (`check-half-states.mjs`): every line that check accepts, this one does too * (`validate.mjs --self-test` pins it). Looser on purpose: retiring a lane word from that list would let notes already * signed under it pass a fence that read the live list, so lane words are only ever added there, and this shape does * not depend on them. Public text carries no signature line (the rewrite's contract), so the extra reach refuses no * legitimate publish. */ -export const ADVISORY_SEAT_SIGNATURE_SHAPE = /^\S+#[1-9][0-9]* · [A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38} · session_[A-Za-z0-9]{6,}$/u; +export const ADVISORY_SEAT_SIGNATURE_SHAPE = /^\S+(?:#[1-9][0-9]*|@[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}) · [A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38} · session_[A-Za-z0-9]{6,}$/u; /** * How many seat signature lines `description` carries (header: "The rows that write a security advisory", the diff --git a/scripts/pm/round-open.mjs b/scripts/pm/round-open.mjs index 94aad98b48d..4b3de02695d 100644 --- a/scripts/pm/round-open.mjs +++ b/scripts/pm/round-open.mjs @@ -80,6 +80,10 @@ import { labelNames, markerMatches, readSignatureLine, + SEAT_MARK_SOURCE, + seatIdOf, + seatMark, + seatTitleAccount, seatIntakeKeys, } from './check-half-states.mjs'; import { ghApi, readAllPages } from './gh-pages.mjs'; @@ -126,18 +130,23 @@ export const UNREAD_LEGS = Object.freeze([ // The pure core // --------------------------------------------------------------------------- -/** `LANE#N`: an executing seat — `repo:NAME#N`, `epic:#N#k` or a retired `domain:LANE#N`. `null` otherwise. Pure. */ +/** + * `LANE#N`: an executing seat — `repo:NAME#N`, `epic:#N#k` or a retired `domain:LANE#N` — or the same lane with the + * second seat mark, `LANE@ACCOUNT`, a seat named by its account (`seat` is then `@account`). `null` otherwise. Pure. + */ export function parseSeat(text) { const v = String(text ?? '').trim().toLowerCase(); - const m = /^(repo:[a-z0-9][a-z0-9._-]*|epic:#[1-9][0-9]*|domain:[a-z][a-z0-9-]*)#([1-9][0-9]*)$/u.exec(v); - return m ? { lane: m[1], seat: Number(m[2]), name: `${m[1]}#${m[2]}` } : null; + const m = new RegExp(`^(repo:[a-z0-9][a-z0-9._-]*|epic:#[1-9][0-9]*|domain:[a-z][a-z0-9-]*)(${SEAT_MARK_SOURCE})$`, 'u').exec(v); + return m ? { lane: m[1], seat: seatMark(m[2]), name: `${m[1]}${m[2]}` } : null; } -/** The seat a `[PM seat] …` title names — `LANE · seat N`, `LANE#N`, or bare `LANE` for seat 1. Pure. */ +/** The seat a `[PM seat] …` title names — `LANE@ACCOUNT`, `LANE · seat N`, `LANE#N`, or bare `LANE` for seat 1. Pure. */ export function seatOfPostTitle(title) { const m = /^\[PM seat\]\s*(.*?)\s*—/u.exec(String(title ?? '')); if (!m) return null; const half = m[1].trim(); + const named = seatTitleAccount(half); + if (named) return `${named.lane.toLowerCase()}${named.mark}`; const numbered = /^(\S+?)\s*·\s*seat\s+([1-9][0-9]*)\b/iu.exec(half); if (numbered) return `${numbered[1].toLowerCase()}#${numbered[2]}`; const hashed = /^(\S+?)#([1-9][0-9]*)(?:\s|$)/u.exec(half); @@ -162,13 +171,13 @@ const stampOf = (row) => { return Number.isFinite(ms) ? ms : null; }; -/** The seat a claim declares: its `Seat:` line, else its signature's `LANE#N`; `null` when neither reads. Pure. */ +/** The seat a claim declares: its `Seat:` line, else its signature's `LANE#N` or `LANE@ACCOUNT`; `null` when neither reads. Pure. */ export function claimSeat(body) { const text = String(body ?? ''); - const keyed = /^[ \t]*(?:[-*+][ \t]+)?>?[ \t]*(?:\*\*)?`?Seat`?(?:\*\*)?[ \t]*:[ \t]*`?((?:repo:[A-Za-z0-9._-]+|epic:#[1-9][0-9]*|domain:[a-z0-9_-]+)#[1-9][0-9]*)/imu.exec(text); + const keyed = new RegExp(`^[ \\t]*(?:[-*+][ \\t]+)?>?[ \\t]*(?:\\*\\*)?\`?Seat\`?(?:\\*\\*)?[ \\t]*:[ \\t]*\`?((?:repo:[A-Za-z0-9._-]+|epic:#[1-9][0-9]*|domain:[a-z0-9_-]+)${SEAT_MARK_SOURCE})`, 'imu').exec(text); if (keyed) return keyed[1].toLowerCase(); const sig = readSignatureLine(text); - return sig ? `${sig.lane}#${sig.seat}`.toLowerCase() : null; + return sig ? seatIdOf(sig.lane, sig.seat).toLowerCase() : null; } /** The session a comment speaks for: a `Session:` line, else its signature's, else the first session id; or null. */ @@ -193,7 +202,7 @@ export function postReadings(rows, seatName, own = new Set()) { for (const row of list) { if (row === brief || !after(row)) continue; const sig = readSignatureLine(String(row?.body ?? '')); - if (!sig || `${sig.lane}#${sig.seat}`.toLowerCase() !== seatName || own.has(sig.session)) continue; + if (!sig || seatIdOf(sig.lane, sig.seat).toLowerCase() !== seatName || own.has(sig.session)) continue; if (marker === null || (stampOf(row) ?? 0) >= (stampOf(marker) ?? 0)) marker = row; } return { brief, marker }; @@ -471,7 +480,7 @@ export function fixtureGet(fixture, repo) { const USAGE = [ 'round-open — the round-open mutex at fire start, before the first write (read-only).', '', - ' node scripts/pm/round-open.mjs --seat LANE#N --session SESSION [--own SESSION,…] [--post N]', + ' node scripts/pm/round-open.mjs --seat LANE#N|LANE@ACCOUNT --session SESSION [--own SESSION,…] [--post N]', ' [--intake area:NAME,epic:#N] [--round-minutes N] [--repo OWNER/NAME]', ' [--json] [--fixture FILE] [--now ISO]', ' node scripts/pm/round-open.mjs --self-test', @@ -500,7 +509,7 @@ export function parseArgs(argv) { } else if (flag === '--seat') { const v = take(); opts.seat = parseSeat(v); - if (!opts.seat) return { error: `--seat must be an executing seat, repo:NAME#N or epic:#N#k (the director and the review chains hold no round mutex), got \`${v}\`` }; + if (!opts.seat) return { error: `--seat must be an executing seat, repo:NAME#N or epic:#N#k, or either lane with @ACCOUNT in place of the number (the director and the review chains hold no round mutex), got \`${v}\`` }; } else if (flag === '--session') { const v = String(take() ?? ''); if (!SESSION_ONLY.test(v)) return { error: `--session must be ONE session id, got \`${v}\`` }; From 4015722fa486c2bbd08b19611337f1631178010a Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 03:26:36 +0000 Subject: [PATCH 3/6] pm: self-test rows for both seat marks (recognisers, mailbox, half-states, pick, round, roster) Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01FEkQ5oPfjnm2yWHEwkiYrn --- scripts/pm/card-pick.mjs | 10 ++++++-- scripts/pm/check-half-states.mjs | 22 +++++++++++++++++ scripts/pm/fleet-roster.mjs | 30 +++++++++++++++++++++++- scripts/pm/mailbox-open.mjs | 16 ++++++++++++- scripts/pm/record-recognisers.mjs | 39 ++++++++++++++++++++++++++++++- scripts/pm/round-open.mjs | 12 ++++++++-- 6 files changed, 122 insertions(+), 7 deletions(-) diff --git a/scripts/pm/card-pick.mjs b/scripts/pm/card-pick.mjs index 11e83ff4e92..c752c9f6aca 100644 --- a/scripts/pm/card-pick.mjs +++ b/scripts/pm/card-pick.mjs @@ -686,9 +686,9 @@ const SELF_TEST_BATTERIES = Object.freeze({ "p3: an area's close-out after every p2 of that item; an epic's children keep their child order": 7, 'Blocked-by: an open target holds, a closed-unmerged PR holds, a merged PR and a closed issue release, cross-repo is read': 7, 'the same-grade order and the epic child order': 5, - 'the candidate definition: label reasons, claims and the triage audit': 9, + 'the candidate definition: label reasons, claims and the triage audit': 12, 'the walk: every page, the count checked, the limit and --why': 11, - 'the CLI: usage, exits and the footer': 13, + 'the CLI: usage, exits and the footer': 14, }); const SELF_TEST_BATTERY_FLOOR = 8; const UNATTRIBUTED_BATTERY = '(unattributed)'; @@ -863,6 +863,11 @@ export async function selfTest() { t('⭐ another seat\'s Claim: excludes', claimReason([claim(SIG)], parseSeat('repo:objectstack#5')), 'Claim: by repo:objectstack#1'); t('this seat\'s own Claim: reads as already yours', claimReason([claim(SIG)], parseSeat('repo:objectstack#1')), 'Claim: by this seat (repo:objectstack#1) — already yours, not a new pick'); t('a Release: after the Claim: frees the card', claimReason([claim(SIG), { body: 'Release: session gone · back to queue', created_at: '2026-11-18T05:00:00Z' }], null), null); + // The second seat mark (ruling record 7249169754): a seat is its lane AND its mark, `#N` or `@ACCOUNT`. + const ACC = 'repo:objectstack@os-bill · os-bill · session_01ABCDEFGH'; + t('⭐ a claim signed `LANE@ACCOUNT` reads as that account\'s seat: already yours for it, another seat\'s for everyone else', [claimReason([claim(ACC)], parseSeat('repo:objectstack@os-bill')), claimReason([claim(ACC)], parseSeat('repo:objectstack@OS-Bill')), claimReason([claim(ACC)], parseSeat('repo:objectstack#5'))], ['Claim: by this seat (repo:objectstack@os-bill) — already yours, not a new pick', 'Claim: by this seat (repo:objectstack@os-bill) — already yours, not a new pick', 'Claim: by repo:objectstack@os-bill']); + t('⛔ account X\'s claim is not read as account Y\'s seat of the same lane — and X signing Y\'s seat is no signature at all', [claimReason([claim(ACC)], parseSeat('repo:objectstack@os-warren')), claimReason([claim('repo:objectstack@os-bill · os-warren · session_01ABCDEFGH')], parseSeat('repo:objectstack@os-bill'))], ['Claim: by repo:objectstack@os-bill', 'Claim: (unsigned) — another session holds it unless the claim names you']); + t('⭐ CONTROL — a `#1` claim by a vacant seat still reads as seat 1\'s: ⛔ not as the account seat of the login on it, nor of any other account', [claimReason([claim(SIG)], parseSeat('repo:objectstack@os-warren')), claimReason([claim(SIG)], parseSeat('repo:objectstack@os-bill')), claimReason([claim(SIG)], parseSeat('repo:objectstack#1'))], ['Claim: by repo:objectstack#1', 'Claim: by repo:objectstack#1', 'Claim: by this seat (repo:objectstack#1) — already yours, not a new pick']); const fleetCard = card(['area:ux', 'priority:p2'], { user: APP }); const r = await run({ issues: [fleetCard], comments: { [fleetCard.number]: [{ body: 'just a note' }] } }); t('⭐ a fleet card with no triage audit record is not a candidate', r.others[0]?.reasons, ['no triage audit — knock triage']); @@ -906,6 +911,7 @@ export async function selfTest() { t('both spellings of an option are read', [parseArgs(['--order=area:ux', '--limit=2']).opts.limit, parseArgs(['--order', 'epic:#7']).opts.order[0].number], [2, 7]); t('--order as the last argument with no value is a usage error; --order "" is the p0/p1-only order', [Boolean(parseArgs(['--order']).error), parseArgs(['--order', '']).opts?.order], [true, []]); t('--seat reads every lane a seat signature carries, an epic seat\'s epic:#N included', [parseSeat('epic:#35205#1')?.name, parseSeat('domain:ui#2')?.name, parseSeat('area:ux#1'), parseSeat('repo:objectstack#5 x')], ['epic:#35205#1', 'domain:ui#2', null, null]); + t('--seat reads both seat marks: `LANE@ACCOUNT` names the seat by its account, lower-cased, an epic seat\'s included; `LANE@` and both marks at once are refused', [parseSeat('repo:objectstack@OS-Bill'), parseSeat('epic:#35205@os-bill')?.name, parseSeat('repo:objectstack#5')?.seat, parseSeat('repo:objectstack@'), parseSeat('repo:objectstack#5@os-bill'), Boolean(parseArgs(['--order', 'area:ux', '--seat', 'repo:objectstack@os-bill']).opts?.seat), parseArgs(['--order', 'area:ux', '--seat', 'os-bill']).error?.includes('LANE#N or LANE@ACCOUNT')], [{ lane: 'repo:objectstack', seat: '@os-bill', name: 'repo:objectstack@os-bill' }, 'epic:#35205@os-bill', 5, null, null, true, true]); t('⭐ the footer names lane ownership and the sub-epic an area item holds, beside the five legs it named before', [UNREAD_LEGS.length, UNREAD_LEGS.some((l) => l.startsWith('lane ownership — ')), UNREAD_LEGS.some((l) => l.startsWith('an area item that holds a sub-epic — '))], [7, true, true]); t('⛔ the lane-ownership leg reads `domain:*` as file ownership, never as the seat\'s lane: lanes are seats and epics', [UNREAD_LEGS.some((l) => /outside this seat's lane|against your lane/.test(l)), UNREAD_LEGS.some((l) => l.startsWith('lane ownership — ') && l.includes('file ownership only'))], [false, true]); const c = card(['area:ux', 'priority:p2', 'domain:ui']); diff --git a/scripts/pm/check-half-states.mjs b/scripts/pm/check-half-states.mjs index b261c9fbe6a..0201a4ef30a 100644 --- a/scripts/pm/check-half-states.mjs +++ b/scripts/pm/check-half-states.mjs @@ -33530,6 +33530,28 @@ async function selfTest() { t('H38 seat: a seat-2 post behind a same-seat claim -> finding', typeof h38SeatPostStale(seat38(seat2Area), SEAT_AT_38, claim38(13398, '2026-08-30T07:30:00Z')), 'string'); t('H38 seat: …and the finding names the seat', h38row(seat38(seat2Area), SEAT_AT_38, claim38(13398, '2026-08-30T07:30:00Z')).includes('seat 2'), true); t('H38 seat: …while the bare post names seat 1', h38row(seat38(), SEAT_AT_38, claim38(13398, '2026-08-30T07:30:00Z')).includes('seat 1'), true); + // The second seat mark (ruling record 7249169754): `LANE@ACCOUNT` names a seat by its account. Readers take both + // marks; a seat is its lane AND its mark, so `#N` keeps reading as that numbered seat and `@ACCOUNT` as that + // account's — neither as the other. Every writer's default is still `#N`. + const J38 = (v) => JSON.stringify(v); + const acctArea = `[PM seat] repo:${OWN_BOARD}@os-b — 🟢 os-b (session_y) · area:data`; + t('H38 seat (account mark): a `LANE@ACCOUNT` title carries the mark `@account`, lower-cased — ⛔ never seat 1', J38([seatLane(seat38(acctArea)).seat, seatLane(seat38(`[PM seat] repo:${OWN_BOARD}@OS-B — 🟢 os-b`)).seat]), J38(['@os-b', '@os-b'])); + t('H38 seat (account mark): …a `domain:` lane named by account reads as its lane, on this board', J38([seatLane(seat38('[PM seat] domain:services@os-b — 🟢 os-b')).lane, seatLane(seat38('[PM seat] domain:services@os-b — 🟢 os-b')).foreign, seatLane(seat38('[PM seat] domain:services@os-b — 🟢 os-b')).seat]), J38(['domain:server', false, '@os-b'])); + t('H38 seat (account mark): …while the board suffix, written after a space, is still a board and still seat 1', J38([seatLane(seat38('[PM seat] domain:ui @ objectui — 🟢 os-b')).foreign, seatLane(seat38('[PM seat] domain:ui @ objectui — 🟢 os-b')).seat, seatTitleAccount('domain:ui @ objectui')]), J38([true, 1, null])); + t('H38 seat (account mark): `seatTitleAccount` takes the account off the lane and leaves the rest as a bare post carries it', J38([seatTitleAccount('repo:objectstack@OS-B · area:data'), seatTitleAccount('repo:objectstack · seat 2'), seatTitleAccount('repo:objectstack@os-b.x')]), J38([{ lane: 'repo:objectstack', mark: '@os-b', rest: 'repo:objectstack · area:data' }, null, null])); + t('H38 seat (account mark): the intake of an account seat reads as the numbered post\'s does — its account is no board', J38(seatIntakeKeys(seat38(acctArea), `objectstack-ai/${OWN_BOARD}`)), J38(['area:data'])); + t('H38 seat (account mark): `Seat: repo:NAME@ACCOUNT` reads the mark `@account`', J38([claimSeatNumber('Claim: x\nSeat: `repo:objectstack@os-b`'), claimSeatNumber('- > **Seat**: repo:objectstack@OS-B (was seat 2, #35205)')]), J38(['@os-b', '@os-b'])); + t('H38 seat (account mark): an epic seat named by account is ⛔ not seat N of its epic', claimSeatNumber('Claim: x\nSeat: epic:#31527@os-b'), '@os-b'); + t('H38 seat (account mark): a mid-line account declaration is unreadable, ⛔ not seat 1', claimSeatNumber('**Claim:** by the seat. `Seat: repo:objectstack@os-b` · claimed'), null); + const acctClaim = new Map([[1, seatRow('Seat: `repo:objectstack@os-b`', '2026-08-30T00:00:00Z')]]); + t('H38 seat (account mark): the account seat\'s post sees its own account\'s claim', newestLaneClaim('area:data', oneCard, acctClaim, seatLane(seat38(acctArea)).seat).number, 1); + t('H38 seat (account mark): ⛔ account X\'s claim is not read as account Y\'s seat of the same lane', newestLaneClaim('area:data', oneCard, acctClaim, '@os-c'), null); + t('H38 seat (account mark): ⛔ …nor as any numbered seat\'s, seat 1 included', J38([newestLaneClaim('area:data', oneCard, acctClaim, 1), newestLaneClaim('area:data', oneCard, acctClaim, 2)]), J38([null, null])); + // CONTROL: vacant seat 1's standing `#1` claim (declared, or with no `Seat:` line at all) is seat 1's and stays so. + const vacantSeat1 = new Map([[1, seatRow('Seat: `repo:objectstack#1`', '2026-08-30T00:00:00Z')]]); + t('H38 seat (account mark): CONTROL — a `#1` claim by a vacant seat still reads as seat 1\'s', J38([newestLaneClaim('area:data', oneCard, vacantSeat1, 1).number, newestLaneClaim('area:data', oneCard, seat1Claim, 1).number]), J38([1, 1])); + t('H38 seat (account mark): CONTROL — …and ⛔ never as the account seat\'s, so the new account\'s post is not rowed over it', J38([newestLaneClaim('area:data', oneCard, vacantSeat1, '@os-b'), newestLaneClaim('area:data', oneCard, seat1Claim, '@os-b'), newestLaneClaim('area:data', oneCard, seat2Claim, '@os-b')]), J38([null, null, null])); + t('H38 seat (account mark): the finding on an account seat\'s post names its mark', h38row(seat38(acctArea), SEAT_AT_38, claim38(13398, '2026-08-30T07:30:00Z')).includes('(seat @os-b)'), true); t('H38 seat: a seat-2 post with no same-seat claim -> clean', h38SeatPostStale(seat38(seat2Area), SEAT_AT_38, newestLaneClaim('area:data', oneCard, seat1Claim, 2)), null); // -- Lane label aliases — the domain:server merge (maintainer ruling 2026-10-22, letter 乙) -- diff --git a/scripts/pm/fleet-roster.mjs b/scripts/pm/fleet-roster.mjs index c0ea2a5f98f..f977729dbfd 100644 --- a/scripts/pm/fleet-roster.mjs +++ b/scripts/pm/fleet-roster.mjs @@ -1107,6 +1107,7 @@ const SELF_TEST_BATTERIES = Object.freeze({ 'a repo-lane seat owns its repo\'s cards by account: in flight, landing, merge, ruling': 7, // 13 → 14: the lane-grammar pin (the signature alternation equals the opener's lane-word lists, `coordinator` aside). 'one account on two seats of a lane: the second seat reads its own traces': 14, + 'a seat named by its account: `LANE@ACCOUNT` is a row of its own, read by lane AND account beside `LANE#N` (ruling record 7249169754)':10, 'the rendered body: marker, columns, footer, determinism': 11, 'refusing to overwrite what is not the roster': 6, 'the CLI: fixture runs offline, usage errors are exit 2': 6, @@ -1115,7 +1116,7 @@ const SELF_TEST_BATTERIES = Object.freeze({ // 25 → 28: 发版阻塞 reads the two release boards whatever `--repos` holds; a board that does not answer is a gap. '--health: five indicators off one walk, every count checked, every gap named': 28, }); -const SELF_TEST_BATTERY_FLOOR = 12; +const SELF_TEST_BATTERY_FLOOR = 13; async function selfTest() { let failed = 0; @@ -1309,6 +1310,33 @@ async function selfTest() { t('signedSeatOf reads every body as readSignatureLine does', corpus.map(signedSeatOf), corpus.map((b) => { const r = readSignatureLine(b); return r ? seatIdOf(r.lane, r.seat) : null; })); } + battery('a seat named by its account: `LANE@ACCOUNT` is a row of its own, read by lane AND account beside `LANE#N` (ruling record 7249169754)'); + { + const NOW = '2026-11-02T04:00:00Z'; + const R = 'objectstack-ai/objectstack'; + const fresh = '2026-11-02T03:00:00Z'; // 1 h before NOW + const sig = (laneSeat, account) => `${laneSeat} · ${account} · session_01AccountSeatSess`; + const named = seat('[PM seat] repo:objectstack@OS-Bill — 🟢 os-bill · area:fleet'); + t('⭐ the title `LANE@ACCOUNT`: lane, the seat mark `@account` (lower-cased), the lane\'s repo — ⛔ never seat 1, and its account is no board', [named.lane, named.seat, named.repo, named.status, named.account], ['repo:objectstack', '@os-bill', 'objectstack-ai/objectstack', 'seated', 'os-bill']); + t('…on a `domain:` lane and a bare lane too, while a board suffix written after a space is still a board and still seat 1', [seat('[PM seat] domain:ui@os-bill — 🟢 os-bill').seat, seat('[PM seat] domain:ui@os-bill — 🟢 os-bill').repo, seat('[PM seat] l2-review@os-bill — 🟢 os-bill').lane, seat('[PM seat] l2-review@os-bill — 🟢 os-bill').seat, ui.seat, ui.repo], ['@os-bill', 'objectstack-ai/objectstack', 'l2-review', '@os-bill', 5, 'objectstack-ai/objectui']); + // Seat 1 is vacant with its old `#1` traces standing; os-bill's seat and os-elon's are named by their accounts. + const snap = (comments = [], pulls = []) => ({ repos: { [R]: { seats: [ + { number: 500, title: '[PM seat] repo:objectstack@os-elon — 🟢 os-elon', body: '', labels: ['pm:seat'], assignees: ['os-elon'], updated_at: '2026-10-30T00:00:00Z' }, + { number: 400, title: '[PM seat] repo:objectstack@os-bill — 🟢 os-bill', body: '', labels: ['pm:seat'], assignees: ['os-bill'], updated_at: '2026-10-30T00:00:00Z' }, + { number: 100, title: '[PM seat] repo:objectstack — ⏳ vacant', body: '', labels: ['pm:seat'], assignees: [], updated_at: '2026-10-30T00:00:00Z' }, + { number: 200, title: '[PM seat] repo:objectstack · seat 2 — 🟢 os-pm', body: '', labels: ['pm:seat'], assignees: ['os-pm'], updated_at: '2026-10-30T00:00:00Z' }, + ], dispatched: [], rulings: [], pulls, comments: {}, recentComments: comments } } }); + const rowOf = (s, post) => buildRows(s, { now: NOW }).find((r) => r.post === post); + t('the rows order the numbered seats by number, then the seats named by an account, by name', buildRows(snap(), { now: NOW }).map((r) => r.seat), [1, 2, '@os-bill', '@os-elon']); + t('⭐ a comment signed `LANE@ACCOUNT` is that seat\'s trace — and ⛔ not account Y\'s seat of the same lane, nor a numbered seat\'s', (() => { const s = snap([{ body: sig('repo:objectstack@os-bill', 'os-bill'), updated_at: fresh }]); return [rowOf(s, 400).lastActivity, rowOf(s, 500).lastActivity, rowOf(s, 100).lastActivity, rowOf(s, 200).lastActivity]; })(), [fresh, '2026-10-30T00:00:00Z', '2026-10-30T00:00:00Z', '2026-10-30T00:00:00Z']); + t('⛔ account X signing account Y\'s seat signs nothing: no seat reads the trace', (() => { const s = snap([{ body: sig('repo:objectstack@os-bill', 'os-elon'), updated_at: fresh }]); return [rowOf(s, 400).lastActivity, rowOf(s, 500).lastActivity]; })(), ['2026-10-30T00:00:00Z', '2026-10-30T00:00:00Z']); + t('⭐ CONTROL — a `#1` comment by the vacant seat still reads as seat 1\'s, whoever signed it: ⛔ not as that login\'s account seat', (() => { const s = snap([{ body: sig('repo:objectstack#1', 'os-elon'), updated_at: fresh }]); return [rowOf(s, 100).lastActivity, rowOf(s, 500).lastActivity, signedSeatOf(sig('repo:objectstack#1', 'os-elon')), signedSeatOf(sig('repo:objectstack@os-elon', 'os-elon'))]; })(), [fresh, '2026-10-30T00:00:00Z', 'repo:objectstack#1', 'repo:objectstack@os-elon']); + t('⭐ the mailbox column by lane AND account: the account seat\'s own mailbox, read off the body line or the head, and never seat 1\'s nor another account\'s', (() => { const s = snap([], [{ number: 601, state: 'open', head: { ref: 'claude/project-thread-1' }, body: 'Mailbox-of: repo:objectstack@os-bill · os-bill', labels: ['pm:mailbox'], updated_at: fresh }, { number: 602, state: 'open', head: { ref: 'mailbox/os-elon/repo-objectstack_os-elon-0' }, body: '', labels: ['pm:mailbox'], updated_at: fresh }, { number: 603, state: 'open', head: { ref: 'mailbox/os-old/repo-objectstack-1' }, body: 'Mailbox-of: repo:objectstack#1 · os-old', labels: ['pm:mailbox'], updated_at: fresh }]); return [400, 500, 100, 200].map((post) => rowOf(s, post).mailbox.map((m) => m.number)); })(), [[601], [602], [603], []]); + t('⭐ an L2 seat named by its account holds its own claims\' pulls, under either lane word — keyed `LANE@account`, ⛔ never a numbered review seat\'s', [...reviewClaims({ repos: { r: { pulls: [{ number: 1, state: 'open', head: { sha: 'a'.repeat(40) } }], recentComments: ['l2-review@os-bill', 'review@os-bill', 'l2-review#2'].map((laneSeat) => ({ issue_url: 'x/issues/1', created_at: NOW, body: `${sig(laneSeat, 'os-bill')}\n\nContract-review-claim: session_01AccountSeatSess · head ${'a'.repeat(40)} · ${NOW}` })) } } }, { now: NOW }).entries()].map(([k, v]) => `${k}=${v.map((x) => x.number)}`), ['l2-review@os-bill=1', 'review@os-bill=1', 'l2-review#2=1']); + t('⭐ an epic seat named by its account is that epic\'s seat, matched by its own slug under its own login; the numbered epic seat reads as before', [...epicSeatsHeld(`${SEAT_EPIC_KIND}:#27293`, [{ slug: 'epic-27293_sunhaolin-0', login: 'sunhaolin' }, { slug: 'epic-27293-2', login: 'os-x' }, { slug: 'epic-27293_other-0', login: 'sunhaolin' }])], [['@sunhaolin', 'sunhaolin'], [2, 'os-x']]); + t('the rendered seat cell prints an account mark in a code span — ⛔ never a loose `@login`, which an issue body turns into a mention', (() => { const line = renderBody(buildRows(snap(), { now: NOW }), { now: NOW, repos: [R] }).split('\n').find((l) => l.includes('/issues/400)')); return [line.includes('[`@os-bill`](https://github.com/objectstack-ai/objectstack/issues/400)'), / @os-/.test(line)]; })(), [true, false]); + } + battery('the rendered body: marker, columns, footer, determinism'); const body = renderBody(rows, { now: fixture.now, repos: Object.keys(fixture.repos).sort(), session: 'cse_01ABC', inboxes: inboxTotals(fixture) }); t('the body opens with the marker', body.split('\n')[0], ROSTER_MARKER); diff --git a/scripts/pm/mailbox-open.mjs b/scripts/pm/mailbox-open.mjs index 9531430e93a..0cda3fa773c 100644 --- a/scripts/pm/mailbox-open.mjs +++ b/scripts/pm/mailbox-open.mjs @@ -590,12 +590,13 @@ const SELF_TEST_BATTERIES = Object.freeze({ 'the close plan: comment then close, then the delete of a claude/mailbox-* head, judged by the validator': 7, 'whose mailbox a pull is: the seat on the body line or the head, a legacy login, neither': 8, "finding a seat's open mailbox: by seat, never by login": 10, + 'a seat named by its account: `LANE@ACCOUNT` is its own key and slug beside `LANE#N` (ruling record 7249169754)': 9, 'refusing to close what is not an open mailbox': 4, 'the ledger exclusion and the footer': 4, 'the CLI: dry run prints the actions file and sends nothing': 8, 'paging: a three-page read through the loop equals the slurped array': 4, }); -const SELF_TEST_BATTERY_FLOOR = 10; +const SELF_TEST_BATTERY_FLOOR = 11; async function selfTest() { let failed = 0; @@ -716,6 +717,19 @@ async function selfTest() { t('without the label it is not a mailbox', openMailboxesOf([pr({ labels: [], head: { ref: 'mailbox/os-bill/ui-4' } })], UI4).length, 0); t('a closed one does not block a new one', openMailboxesOf([pr({ state: 'closed', head: { ref: 'mailbox/os-bill/ui-4' } })], UI4).length, 0); + battery('a seat named by its account: `LANE@ACCOUNT` is its own key and slug beside `LANE#N` (ruling record 7249169754)'); + t('⭐ both forms read: the account form keeps its spelling, lower-cased, and names its account; the numbered form is unchanged, no account on it', [seatKey('Repo:ObjectStack@OS-Bill'), seatKey('epic:#27293@sunhaolin'), seatKey('l2-review@os-bill'), seatKey('repo:objectstack#5'), seatKey('triage')], [{ key: 'repo:objectstack@os-bill', slug: 'repo-objectstack_os-bill-0', account: 'os-bill' }, { key: 'epic:#27293@sunhaolin', slug: 'epic-27293_sunhaolin-0', account: 'sunhaolin' }, { key: 'l2-review@os-bill', slug: 'l2-review_os-bill-0', account: 'os-bill' }, { key: 'repo:objectstack#5', slug: 'repo-objectstack-5' }, { key: 'triage#1', slug: 'triage-1' }]); + t('⛔ what is not an account seat: no account, a space, a doubled or edge hyphen, both marks, a reserved `domain:` lane, a login alone', ['repo:objectstack@', 'repo:objectstack @os-bill', 'repo:objectstack@os--bill', 'repo:objectstack@-os', 'repo:objectstack@os-', 'repo:objectstack#1@os-bill', 'repo:objectstack@os-bill#1', 'domain:triage@os-bill', '@os-bill', 'os-bill'].map(seatKey), [null, null, null, null, null, null, null, null, null, null]); + t('⭐ the slug stays one-to-one across BOTH forms — a login carries no `_` and no numbered slug ends in `-0`, so the look-alikes differ', (() => { const keys = ['repo:objectstack@os-bill', 'repo:objectstack#1', 'repo:objectstack#10', 'domain:ui@bill-3', 'domain:ui_bill#3', 'domain:ui_bill-3@a', 'domain:ui-os@bill', 'domain:ui@os-bill', 'domain:ui@os', 'epic:#12@os-bill', 'epic:#12#1', 'triage@a', 'triage#1']; const slugs = keys.map((k) => seatKey(k)?.slug); return [slugs.every(Boolean), new Set(slugs).size]; })(), [true, 13]); + t('the slug is a legal ref segment on both heads: the default mailbox// and a cloud seat\'s claude/mailbox-', [mailboxBranch('os-bill', seatKey('repo:objectstack@os-bill')), BRANCH_SHAPE.test(mailboxBranch('os-bill', seatKey('repo:objectstack@os-bill'))), MAILBOX_BRANCH_SHAPE.test(`claude/mailbox-${seatKey('repo:objectstack@os-bill').slug}`), MAILBOX_BRANCH_SHAPE.test(`claude/mailbox-${seatKey('epic:#27293@sunhaolin').slug}`)], ['mailbox/os-bill/repo-objectstack_os-bill-0', true, true, true]); + t('⭐ --seat takes either form; an account seat opens under its own --login only (case folded) — ⛔ account X never opens account Y\'s seat', [parseArgs(['--repo', 'o/r', '--seat', 'repo:objectstack@os-bill', '--login', 'OS-Bill']).errors, parseArgs(['--repo', 'o/r', '--seat', 'repo:objectstack@os-bill', '--login', 'os-elon']).errors.some((e) => e.includes('named by another account')), parseArgs(['--repo', 'o/r', '--seat', 'repo:objectstack#5', '--login', 'os-elon']).errors], [[], true, []]); + const ACC = planOpen({ repo: 'objectstack-ai/objectstack', seat: 'repo:objectstack@os-bill', login: 'os-bill', session: 'cse_01ABC' }); + t('the open plan of an account seat: its branch, its title, a body the owner reader reads back as that seat, and a stroke the relay validator accepts', [ACC.errors, ACC.branch, ACC.actions[0].title, ACC.actions[0].body.split('\n')[0], mailboxOwner(pr({ body: ACC.actions[0].body, head: { ref: 'claude/project-thread-1' } }))], [[], 'mailbox/os-bill/repo-objectstack_os-bill-0', 'pm:mailbox — repo:objectstack@os-bill · os-bill', 'Mailbox-of: repo:objectstack@os-bill · os-bill', { seat: 'repo:objectstack@os-bill', slug: 'repo-objectstack_os-bill-0', login: 'os-bill' }]); + t('⛔ a `Mailbox-of:` line naming account Y\'s seat under login X names NO seat — never Y\'s, never X\'s', mailboxOwner(pr({ body: 'Mailbox-of: repo:objectstack@os-bill · os-elon', head: { ref: 'claude/project-thread-2' } })), { seat: null, slug: null, login: null }); + const BOXES = [opened('repo:objectstack@os-bill', 'os-bill', 21), opened('repo:objectstack#1', 'os-elon', 22)]; + t('⭐ found by lane AND account: os-bill\'s seat finds its own mailbox, and neither another account\'s seat of the lane nor a numbered seat finds it', [openMailboxesOf(BOXES, seatKey('repo:objectstack@os-bill')).map((x) => x.number), openMailboxesOf(BOXES, seatKey('repo:objectstack@os-elon')).length, openMailboxesOf(BOXES, seatKey('repo:objectstack#5')).length, openMailboxesOf([pr({ head: { ref: ACC.branch } })], seatKey('repo:objectstack@os-bill')).length], [[21], 0, 0, 1]); + t('⭐ CONTROL — vacant seat 1\'s `#1` mailbox still reads as seat 1\'s, whoever opened it: found by `repo:objectstack#1` (and the bare lane), ⛔ not by the account seat of the login on it', [openMailboxesOf(BOXES, seatKey('repo:objectstack#1')).map((x) => x.number), openMailboxesOf(BOXES, seatKey('repo:objectstack')).map((x) => x.number), openMailboxesOf(BOXES, seatKey('repo:objectstack@os-elon')).length, mailboxOwner(BOXES[1]).seat], [[22], [22], 0, 'repo:objectstack#1']); + battery('refusing to close what is not an open mailbox'); t('an open pm:mailbox PR may be closed', closeRefusal(pr({}), 1), null); t('a PR without the label is refused', /does not carry pm:mailbox/.test(closeRefusal(pr({ labels: [{ name: 'bug' }] }), 1)), true); diff --git a/scripts/pm/record-recognisers.mjs b/scripts/pm/record-recognisers.mjs index 52759c559e8..8a7d3204248 100644 --- a/scripts/pm/record-recognisers.mjs +++ b/scripts/pm/record-recognisers.mjs @@ -2919,6 +2919,8 @@ const SELF_TEST_BATTERIES = Object.freeze({ // The card-thread delegate (#34013 remainder 2): a claim's `Thread session:` line, one spelling, joins its signing seat's roster. '⭐ the card-thread delegate: the session an open claim names on its `Thread session:` line joins the roster of the seat that signed it — one spelling, dropped when released, superseded or closed': 17, '⭐ the signature line: the reader reads LANE#N · ACCOUNT · SESSION exactly, and one leading signature changes no first-line reading': 22, + // Readers first: every writer's default is still `#N`. + '⭐ the seat mark: `LANE@ACCOUNT` reads beside `LANE#N` (ruling record 7249169754) — a seat is its lane AND its mark, and neither mark reads as the other': 16, '⭐ the `Contract-review-claim:` line — session, FULL head, time; lapses on a moved head or after two hours; the earliest live claim holds': 24, '⭐ the `Contract-review-hold:` line — session, head, reason, until; a new head clears it; at 24 hours it reads overdue and still holds': 23, // The tie relation: the cards a fold's equal closing keywords deliver, for the `--land` dogfood gate, which reads @@ -2949,7 +2951,8 @@ const SELF_TEST_BATTERIES = Object.freeze({ // Raised 17 → 18 with the knock-signature battery (#33789 item 3, split to #34013): one battery, one row. // Raised 18 → 19 with the card-thread delegate battery (#34013 remainder 2): one battery, one row. // Raised 19 → 20 with the tie-relation battery (`deliveredCardsAtStrongest`): one battery, one row. -const SELF_TEST_BATTERY_FLOOR = 20; +// Raised 20 → 21 with the seat-mark battery (`LANE@ACCOUNT` beside `LANE#N`, ruling record 7249169754): one battery, one row. +const SELF_TEST_BATTERY_FLOOR = 21; // The key an assertion is filed under when no battery is open. It is not a // declared battery, so it reds by the same set difference rather than silently @@ -3828,6 +3831,40 @@ export async function selfTest() { t('the act\'s OPENING-line stamp (H56, which post-stamped\'s positional refusal imports) is the same reading under a signature', hs.h56StampedReadings('Claim: x · 2026-10-28T12:44Z\nbody').length === 1 && same(hs.h56StampedReadings, 'Claim: x · 2026-10-28T12:44Z\nbody')); } + battery('⭐ the seat mark: `LANE@ACCOUNT` reads beside `LANE#N` (ruling record 7249169754) — a seat is its lane AND its mark, and neither mark reads as the other'); + { + const hs = await import('./check-half-states.mjs'); + const SESS = 'session_01QSeKYmhU5KEj1nukYhp1Tg'; + const NUM = `repo:objectstack#1 · os-elon · ${SESS}`; + const ACC = `repo:objectstack@os-justin · os-justin · ${SESS}`; + const J = (v) => JSON.stringify(v); + t('⭐ both forms read: `#N` gives the seat number, `@ACCOUNT` the mark `@account`, lower-cased — lane, account and session as before', J([hs.readSignatureLine(NUM), hs.readSignatureLine(ACC), hs.readSignatureLine(`repo:objectstack@OS-Justin · os-justin · ${SESS}`)?.seat]) === J([{ lane: 'repo:objectstack', seat: 1, account: 'os-elon', session: SESS, line: NUM }, { lane: 'repo:objectstack', seat: '@os-justin', account: 'os-justin', session: SESS, line: ACC }, '@os-justin'])); + t('every lane a signature carries reads with the account mark — a hyphenated lane, an epic (its `#N` is the epic, never a seat), triage, the L2 seat under both words, coordinator', ['domain:engine-core', 'repo:cloud', 'epic:#26000', 'triage', 'l2-review', 'review', 'coordinator'].every((lane) => { const r = hs.readSignatureLine(`${lane}@os-zhuang · os-zhuang · ${SESS}`); return r?.lane === lane && r.seat === '@os-zhuang' && hs.seatIdOf(r.lane, r.seat) === `${lane}@os-zhuang`; })); + t('⛔ account X signing account Y\'s seat is NOT a signature — never read as Y\'s seat, nor as X\'s — and the writers\' refusal names the cause', hs.readSignatureLine(`repo:objectstack@os-justin · os-elon · ${SESS}`) === null && hs.signatureRefusal(`repo:objectstack@os-justin · os-elon · ${SESS}\nbody`)?.why.includes('only that same account signs') === true && hs.signatureRefusal(`${ACC}\nbody`) === null); + t('⛔ the near misses of the account mark: no account, a space around the `@`, a doubled or trailing hyphen, both marks at once', [`repo:objectstack@ · os-justin · ${SESS}`, `repo:objectstack @os-justin · os-justin · ${SESS}`, `repo:objectstack@ os-justin · os-justin · ${SESS}`, `repo:objectstack@os--justin · os--justin · ${SESS}`, `repo:objectstack@os-justin- · os-justin · ${SESS}`, `repo:objectstack#1@os-justin · os-justin · ${SESS}`].every((line) => hs.readSignatureLine(line) === null)); + t('⭐ CONTROL — a `#N` signature keeps reading as that numbered seat: seat 1\'s line is `repo:objectstack#1`, whoever signed it, and is no account\'s seat; the two ids of one lane differ', hs.seatIdOf('repo:objectstack', hs.readSignatureLine(NUM).seat) === 'repo:objectstack#1' && hs.seatIdOf('repo:objectstack', hs.readSignatureLine(`repo:objectstack#1 · os-justin · ${SESS}`).seat) === 'repo:objectstack#1' && hs.seatIdOf('repo:objectstack', hs.readSignatureLine(ACC).seat) === 'repo:objectstack@os-justin' && hs.seatMark('#1') !== hs.seatMark('@1')); + t('`seatMark` reads the two marks and nothing else: a number, `@account`, else null', J(['#12', '@Os-Bill', '#0', '@', 'os-bill', '#1@a', ''].map(hs.seatMark)) === J([12, '@os-bill', null, null, null, null, null])); + t('one leading account-seat signature changes no first-line reading: the strip, the `os-dev-report` marker, the doorbell', hs.stripSignatureLine(`${ACC}\n\nClaim: x`) === 'Claim: x' && hs.OS_DEV_REPORT_MARKER.test(`${ACC}\nos-dev-report\n{}`) && JSON.stringify(readMailboxLine(`${ACC}\n${DB.cr}`)) === JSON.stringify(readMailboxLine(DB.cr))); + const claimOf = (seatLine) => `Claim: PM loop round 1 · 2026-11-29T03:08Z\nSession: \`${SESS}\`\n${seatLine}\nBranch: \`claude/issue-1-x\``; + t('⭐ the claim\'s `Seat:` line reads both forms: `repo:NAME#5` is 5, `repo:NAME@ACCOUNT` is `@account`, and an epic seat named by account is ⛔ never seat N of its epic', J([hs.claimSeatNumber(claimOf('Seat: `repo:objectstack#5`')), hs.claimSeatNumber(claimOf('Seat: `repo:objectstack@os-justin`')), hs.claimSeatNumber(claimOf('Seat: epic:#35205@OS-Justin (see #12)')), hs.claimSeatNumber(claimOf('Seat: repo:objectstack#5 (asked by os@example)'))]) === J([5, '@os-justin', '@os-justin', 5])); + t('⛔ an account-seat declaration off the line start is present-but-unreadable (null), ⛔ never seat 1', hs.claimSeatNumber('Claim: round 1 — dispatched. Seat: repo:objectstack@os-justin — R1.') === null && hs.claimSeatNumber('Claim: round 1 — dispatched.') === 1); + t('⭐ `seatKey` — the doorbell\'s ONE grammar — reads the account form as its own key, lower-cased; the numbered key, and a bare lane as seat 1, read as before', J([seatKey('Repo:ObjectStack@OS-Bill')?.key, seatKey('epic:#12@os-bill')?.key, seatKey('repo:objectstack#5')?.key, seatKey('triage')?.key, seatKey('repo:objectstack@')]) === J(['repo:objectstack@os-bill', 'epic:#12@os-bill', 'repo:objectstack#5', 'triage#1', null])); + t('⭐ `To: LANE@ACCOUNT` addresses that seat, and a key\'s seat field reads it: no number, the account named', (() => { const r = readMailboxLine(MSG('Notify: split · repo:objectstack@os-bill · takes: #27077 · leaves: none', 'repo:objectstack@os-bill')); return r.state === 'read' && r.to === 'repo:objectstack@os-bill' && SAME(r.seat, { key: 'repo:objectstack@os-bill', lane: 'repo:objectstack', n: null, account: 'os-bill' }); })()); + t('⛔ `Notify: seat-online` of an account seat reads under that account only — another login on the line is unreadable', [readMailboxLine(MSG('Notify: seat-online · repo:objectstack@os-bill · OS-Bill · mailbox #27120 · patrol none · takes: none')).state, readMailboxLine(MSG('Notify: seat-online · repo:objectstack@os-bill · os-elon · mailbox #27120 · patrol none · takes: none')).state].join() === 'read,unreadable'); + const HO = (to) => readContractReviewHandoff(`${CONTRACT_REVIEW_HANDOFF_KEY}: ${to} — ${CONTRACT_REVIEW_TIER_NAME} unavailable (HTTP 429, 2026-11-29T03:00Z) · head 1b03a9c3`); + t('⭐ a hand-off target reads with either mark, lower-cased: an L2 seat, a repo seat and an epic seat named by account — and `triage@ACCOUNT` stays unreadable, as `triage#1` is', J([HO('l2-review@OS-Bill').to, HO('review@os-bill').to, HO('repo:objectstack@os-bill').to, HO('epic:#35205@os-bill').to, HO('l2-review#2').to, HO('triage@os-bill').state, HO('l2-review@').state]) === J(['l2-review@os-bill', 'review@os-bill', 'repo:objectstack@os-bill', 'epic:#35205@os-bill', 'l2-review#2', 'unreadable', 'unreadable'])); + // The knock roster: seat 1 is vacant with its old `#1` record standing; os-bill's seat is named by its account. + const S_OLD = 'session_01SeatOneVacantAaaaaaaa'; + const S_NEW = 'session_01AccountSeatBbbbbbbbbb'; + const SIGN = (seat, account, session) => `${seat} · ${account} · ${session}`; + const POST = (number, title, body) => ({ number, state: 'open', title, labels: [{ name: 'pm:seat' }], body }); + const roster = seatSessionRoster({ posts: [POST(34366, '[PM seat] repo:objectstack — 🟢 os-elon', `${SIGN('repo:objectstack#1', 'os-elon', S_OLD)}\n`), POST(35217, '[PM seat] repo:objectstack@os-bill — 🟢 os-bill', `${SIGN('repo:objectstack@os-bill', 'os-bill', S_NEW)}\n`)], mailboxes: [] }); + const knock = (seat, account, session) => readMailboxComment(DB_ROW(`${SIGN(seat, account, session)}\n${MSG('Notify: landed · #28562', 'repo:objectstack#1')}`), roster).signature; + t('⭐ the roster keys each post by the seat its signature names: the account seat lists its session under `LANE@account`, the numbered seat under `LANE#1`', J([...roster.seats.keys()].sort()) === J(['repo:objectstack#1', 'repo:objectstack@os-bill']) && knock('repo:objectstack@os-bill', 'os-bill', S_NEW).state === 'listed' && knock('repo:objectstack@os-bill', 'os-bill', S_NEW).seat === 'repo:objectstack@os-bill'); + t('⭐ CONTROL — seat 1\'s `#1` record still reads as seat 1\'s: its session is listed by `repo:objectstack#1` alone, and ⛔ not by the account seat of the same lane', knock('repo:objectstack#1', 'os-elon', S_OLD).state === 'listed' && knock('repo:objectstack#1', 'os-elon', S_OLD).seat === 'repo:objectstack#1' && roster.seats.get('repo:objectstack@os-bill').has(S_OLD) === false); + t('⛔ account X\'s knock is never read as account Y\'s seat: os-elon signing `@os-bill` is no signature at all, and os-elon\'s OWN account seat — a different seat of the same lane — lists nothing', knock('repo:objectstack@os-bill', 'os-elon', S_NEW).reason?.includes('opens with no seat signature line') === true && knock('repo:objectstack@os-elon', 'os-elon', S_NEW).reason?.includes('repo:objectstack@os-elon lists no session') === true); + } + // -- #18042: the copyable record TEMPLATE ---------------------------------- // // `references/contract-review.md` DESCRIBES the record in prose and once diff --git a/scripts/pm/round-open.mjs b/scripts/pm/round-open.mjs index 4b3de02695d..389a7635b99 100644 --- a/scripts/pm/round-open.mjs +++ b/scripts/pm/round-open.mjs @@ -589,8 +589,8 @@ export function main(argv, deps = {}) { const SELF_TEST_BATTERIES = Object.freeze({ // 3 → 4 (#35237 item 21c): the exported ROUND_RULE is stateless — no `g`, so repeated `.test()` answers the same. 'the rule text: every phrase this file is built from is in the file that writes it': 4, - 'readings 1 and 2: the newest stand-down brief, the newest seat-signed comment after it': 7, - 'reading 3: the newest claim of this seat by another session, and a push on a lane branch': 10, + 'readings 1 and 2: the newest stand-down brief, the newest seat-signed comment after it': 10, + 'reading 3: the newest claim of this seat by another session, and a push on a lane branch': 12, 'reading 4: the first closed lane card with a claim of this seat, timed by its session': 4, 'the verdict: foreign, un-clocked-out and under a round yields; own, clocked-out or older does not; a gap is never clear': 8, 'the CLI: usage, exits and the footer': 8, @@ -676,12 +676,20 @@ export function selfTest() { t('⭐ a seat-signed comment after the brief is reading 2, whatever its headline', postReadings([BRIEF, late], 'repo:objectstack#8').marker?.id, late.id); t('N1 — an OWN comment newer than another session\'s marker does not hide it: reading 2 is the newest by a session outside own', postReadings([BRIEF, late, c(`${sig(ME)}\n\nSeat audit`, 10)], 'repo:objectstack#8', new Set([ME])).marker?.id, late.id); t('the seat a post title names: `LANE · seat N`, `LANE#N`, bare LANE for seat 1', [seatOfPostTitle(POST.title), seatOfPostTitle('[PM seat] repo:cloud#1 — 🟢 os-warren'), seatOfPostTitle('[PM seat] review — ⏳ vacant'), seatOfPostTitle('not a post')], ['repo:objectstack#8', 'repo:cloud#1', 'review#1', null]); + // The second seat mark (ruling record 7249169754): `LANE@ACCOUNT`. A seat is its lane AND its mark. + const ASEAT = 'repo:objectstack@os-mickey'; + t('⭐ both seat marks read: `--seat LANE@ACCOUNT` names the seat by its account, lower-cased, and a `LANE@ACCOUNT` post title names that seat — ⛔ never seat 1, while a board suffix after a space still does', [parseSeat('Repo:ObjectStack@OS-Mickey'), parseSeat('epic:#35205@os-mickey')?.name, parseSeat('repo:objectstack#8')?.seat, parseSeat('repo:objectstack@'), parseSeat('review@os-mickey'), seatOfPostTitle('[PM seat] repo:objectstack@OS-Mickey — 🟢 os-mickey · area:fleet'), seatOfPostTitle('[PM seat] domain:ui @ objectui — 🟢 os-b')], [{ lane: 'repo:objectstack', seat: '@os-mickey', name: ASEAT }, 'epic:#35205@os-mickey', 8, null, null, ASEAT, 'domain:ui#1']); + const amark = c(`${sig(OTHER, ASEAT)}\n\n## Seated`, 30); + t('⭐ reading 2 by lane AND account: the account seat reads its own signed comment; ⛔ account X\'s seat does not read account Y\'s, and seat 8 does not read either', [postReadings([BRIEF, amark], ASEAT).marker?.id, postReadings([BRIEF, amark], 'repo:objectstack@os-other').marker, postReadings([BRIEF, amark], 'repo:objectstack#8').marker, postReadings([BRIEF, c(`${sig(OTHER, ASEAT, 'os-other')}\n\n## Seated`, 20)], ASEAT).marker], [amark.id, null, null, null]); + t('⭐ CONTROL — a `#8` comment keeps reading as seat 8\'s: ⛔ not as the account seat of the login that signed it', [postReadings([BRIEF, late], 'repo:objectstack#8').marker?.id, postReadings([BRIEF, late], ASEAT).marker], [late.id, null]); } battery('reading 3: the newest claim of this seat by another session, and a push on a lane branch'); { t('a claim\'s seat is its `Seat:` line, else its signature; its session the `Session:` line, else the signature', [claimSeat(claim(OTHER, 5).body), claimSeat(`${sig(OTHER, 'epic:#35205#1')}\n\nClaim: x`), claimSeat('Claim: x'), commentSession(`${sig(OTHER)}\n\nClaim: x`)], ['repo:objectstack#8', 'epic:#35205#1', null, OTHER]); + t('a claim\'s seat reads with either mark, from the `Seat:` line or the signature, lower-cased', [claimSeat(claim(OTHER, 5, 'repo:objectstack@os-mickey').body), claimSeat('Claim: x\nSeat: `epic:#35205@OS-Mickey`'), claimSeat(`${sig(OTHER, 'epic:#35205@os-mickey')}\n\nClaim: x`), claimSeat('Claim: x\nSeat: `repo:objectstack#8`')], ['repo:objectstack@os-mickey', 'epic:#35205@os-mickey', 'epic:#35205@os-mickey', 'repo:objectstack#8']); const own = new Set([ME]); + t('⭐ CONTROL — reading 3 by lane AND mark: a `#8` claim by another session is seat 8\'s activity and ⛔ not the account seat\'s; the account seat\'s claim is its own and ⛔ not seat 8\'s nor another account\'s', [claimReadings([claim(OTHER, 30)], 'repo:objectstack#8', own).foreign?.created_at, claimReadings([claim(OTHER, 30)], 'repo:objectstack@os-mickey', own).foreign ?? null, claimReadings([claim(OTHER, 20, 'repo:objectstack@os-mickey')], 'repo:objectstack@os-mickey', own).foreign?.created_at, claimReadings([claim(OTHER, 20, 'repo:objectstack@os-mickey')], 'repo:objectstack#8', own).foreign ?? null, claimReadings([claim(OTHER, 20, 'repo:objectstack@os-mickey')], 'repo:objectstack@os-other', own).foreign ?? null], [ago(30), null, ago(20), null, null]); const cr = claimReadings([claim(OTHER, 30), claim(ME, 10), claim(OTHER, 5, 'repo:objectstack#3')], 'repo:objectstack#8', own); t('⭐ the newest claim of THIS seat by ANOTHER session — the own session\'s and another seat\'s are not it', cr.foreign?.created_at, ago(30)); const live = card(['pm:dispatched', 'area:fleet'], 20); From 08071cd3a467e8eba827a003ee24608d717dbf90 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 03:32:38 +0000 Subject: [PATCH 4/6] pm: self-test rows for both seat marks (relay, writers, prior rulings, owed reviews, handover) Each row pairs the account mark with a control: a numbered record stays the numbered seat's, and an account seat's line is not read as another account's. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01FEkQ5oPfjnm2yWHEwkiYrn --- scripts/pm/check-handover.mjs | 4 +++- scripts/pm/check-owed-reviews.mjs | 6 +++++- scripts/pm/check-prior-rulings.mjs | 5 ++++- scripts/pm/fleet-write/dispatch.mjs | 11 ++++++++--- scripts/pm/fleet-write/execute.mjs | 7 +++++-- scripts/pm/fleet-write/validate.mjs | 4 +++- scripts/pm/issue-create.mjs | 7 ++++++- scripts/pm/post-stamped.mjs | 9 ++++++++- 8 files changed, 42 insertions(+), 11 deletions(-) diff --git a/scripts/pm/check-handover.mjs b/scripts/pm/check-handover.mjs index 974dff53076..e083c2af4bf 100644 --- a/scripts/pm/check-handover.mjs +++ b/scripts/pm/check-handover.mjs @@ -454,7 +454,7 @@ export function stayBehindText(reported) { export const EXIT_SURFACE_UNREAD = 5; /** How many `inflight: ` self-test cases must register — the mode's battery floor (AGENTS.md, writing a `--self-test`). */ -const INFLIGHT_CASE_FLOOR = 46; +const INFLIGHT_CASE_FLOOR = 47; /** * The claim template's `File surface:` key line (SKILL.md 〈模板与表〉), read one line at a time. A qualifier in @@ -1579,6 +1579,8 @@ export function selfTest() { const IF_CARD = (labels = ['pm:dispatched'], extra = {}) => ({ number: 37064, title: 'dispatch-gates', state: 'open', labels: labels.map((name) => ({ name })), assignees: [{ login: 'os-tesla' }], ...extra }); const heldIf = inflightSurface(IF_CARD(), [IF_CLAIM('File surface: `scripts/pm/dispatch-gates.mjs`, `scripts/pm/dispatch-gates.data.mjs`. (stop on breach)')]); t('inflight: ⭐ a held claim names its session (the `Session:` line), its seat (the signature) and its paths', heldIf.verdict === 'held' && heldIf.session === 'session_01L9qibyUSf2nKJWW6qBemSU' && heldIf.seat === 'repo:objectstack#3' && heldIf.paths.join() === 'scripts/pm/dispatch-gates.mjs,scripts/pm/dispatch-gates.data.mjs'); + const acctClaim = (sig) => inflightSurface(IF_CARD(), [comment(40, 0, `${sig}\n\nClaim: PM loop round 1 · 2026-11-27T07:39Z\nSession: \`session_01L9qibyUSf2nKJWW6qBemSU\`\nFile surface: \`scripts/pm/dispatch-gates.mjs\``)]); + t('inflight: ⭐ a held claim signed by a seat named by its account names that seat `lane@account` (ruling record 7249169754); ⛔ a `#N` claim stays the numbered seat\'s, and a line signed for another account\'s seat names no seat', acctClaim('repo:objectstack@os-tesla · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU').seat === 'repo:objectstack@os-tesla' && acctClaim('repo:objectstack@Os-Tesla · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU').seat === 'repo:objectstack@os-tesla' && heldIf.seat === 'repo:objectstack#3' && acctClaim('repo:objectstack@os-bill · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU').seat === null); const amended = inflightSurface(IF_CARD(), [IF_CLAIM('File surface: `scripts/pm/card-pick.mjs`'), comment(41, 60, `${IF_SIG}\n\nClaim amendment: slice 2 · 2026-11-19T15:06Z\nFile surface: slice 2 only: \`scripts/pm/landing-k.mjs\` (new). Not \`card-pick.mjs\`.`)]); t('inflight: a later `Claim amendment` re-declares the surface — its paths join the claim\'s, its fence (a bare name too) removes from the union', amended.paths.join() === 'scripts/pm/landing-k.mjs' && amended.excluded.join() === 'card-pick.mjs' && inflightSurface(IF_CARD(), [IF_CLAIM('File surface: `scripts/pm/card-pick.mjs`'), comment(41, 60, `${IF_SIG}\n\nClaim amendment: rider\nFile surface: \`package.json\` added.`)]).paths.join() === 'scripts/pm/card-pick.mjs,package.json'); t('inflight: ⛔ not in flight — a `Release:` newer than the claim (whoever wrote it), no claim, another state, a closed card', inflightSurface(IF_CARD(), [IF_CLAIM('File surface: `a/b.mjs`'), comment(42, 90, 'Release: back to the queue')]).verdict === 'released' && inflightSurface(IF_CARD(), [comment(43, 0, 'a note')]).verdict === 'unclaimed' && inflightSurface(IF_CARD(['pm:queue']), [IF_CLAIM('File surface: `a/b.mjs`')]).verdict === 'out' && inflightSurface(IF_CARD(undefined, { state: 'closed' }), [IF_CLAIM('File surface: `a/b.mjs`')]).verdict === 'out'); diff --git a/scripts/pm/check-owed-reviews.mjs b/scripts/pm/check-owed-reviews.mjs index 9d55dfb8e67..82a46d6d0ff 100644 --- a/scripts/pm/check-owed-reviews.mjs +++ b/scripts/pm/check-owed-reviews.mjs @@ -637,7 +637,7 @@ const SELF_TEST_BATTERIES = Object.freeze({ // 24 → 18 (#34400, ruling A on #33258): the account bar is gone — its eight cases (S2, S4, the area-lease note, the // own delta of a now-barred signer) retire with it; one case pins same account, different session ⇒ seated and named, // and one keeps the unread-card-thread reading (the record unjudged, no own delta), which never needed the bar. - 'the L2 seat is the fallback: named by a hand-off or on its own delta, never on (b), (c), the label or the TIER_DEFAULT face': 18, + 'the L2 seat is the fallback: named by a hand-off or on its own delta, never on (b), (c), the label or the TIER_DEFAULT face': 21, 'a live claim holds the head and a record settles it; a lapsed claim holds nothing': 6, 'the live instance: two Tier H drafts with a hand-off on the current head list as TAKE under (a)': 4, 'the live read: every read through one reader; a failed read is INCOMPLETE, never clean': 6, @@ -776,6 +776,10 @@ export function selfTest() { t('the TIER_DEFAULT face: a hand-off to a SIBLING lane seat still names it; its own delta and (b) name the lane; the face is read off the limbs — the label beside it keeps it, a schema or governed path beside it ends it', rv({ ...DECLARED, headCommittedAt: fresh, comments: [handoff(HEAD, '2026-10-28T12:40:00Z', 'domain:ui#2')] }).taker === 'domain:ui#2' && rv({ ...DECLARED, comments: [signed(HEAD2, MICKEY)] }).taker === `the area:ux seat (${TIER_DEFAULT_FACE_NOTE})` && rv({ ...DECLARED, headCommittedAt: oneRound }).taker === `the area:ux seat (${TIER_DEFAULT_FACE_NOTE})` && [['declaration'], ['declaration', 'label'], ['rules', 'declaration'], ['schema', 'declaration'], ['label'], [], null].map(declarationFaceOnly).join() === 'true,true,false,false,false,false,false'); t('⭐ the delta of its OWN record: a record on an earlier head signed by a seated L2 seat ⇒ that seat takes the head; with no record on an earlier head the same row ⇒ the lane', (() => { const r = rv({ comments: [signed(HEAD2, MICKEY)] }); return r.status === 'TAKE' && r.record.state === 'stale' && r.record.seat === 'review#1' && r.taker === 'review#1 (the delta of its own record 6911000001)' && rv({}).taker === LANE_TAKES; })()); t('⛔ not its own delta ⇒ the lane: the signer stood down or is not seated, the record signed by a lane seat, or carrying no signature; the signer read off the first line, a signature the reader refuses naming nobody', rv({ comments: [signed(HEAD2, MICKEY)] }, [...SEATED, { lane: 'review', seat: 1, status: 'paused' }, { lane: 'review', seat: 2, status: 'seated' }]).taker === LANE_TAKES && rv({ comments: [signed(HEAD2, `domain:ui#1 · os-bill · ${LANE}`)] }).taker === LANE_TAKES && rv({ comments: [recordRow(HEAD2, 'FAIL', 11)] }).taker === LANE_TAKES && signerSeatOf(signed(HEAD2, `review#2 · os-mickey · ${REVIEWER}`).body) === 'review#2' && signerSeatOf(signed(HEAD2, `Review#2 · os-mickey · ${REVIEWER}`).body) === null && signerSeatOf(recordRow(HEAD).body) === null); + const ACCT_REVIEW = [...SEATED, { lane: 'l2-review', seat: '@os-mickey', status: 'seated' }, { lane: 'review', seat: 1, status: 'seated' }]; + t('⭐ a seat named by its account (ruling record 7249169754): the roster names it `lane@account` beside the numbered one, never as seat 1; a hand-off naming it names it and is an L2 seat on the TIER_DEFAULT face', (() => { const s = reviewSeatsOf(ACCT_REVIEW); const h = rv({ headCommittedAt: fresh, comments: [handoff(HEAD, '2026-10-28T12:40:00Z', 'l2-review@os-mickey')] }, ACCT_REVIEW); const d = rv({ ...DECLARED, headCommittedAt: fresh, comments: [handoff(HEAD, '2026-10-28T12:40:00Z', 'l2-review@os-mickey')] }, ACCT_REVIEW); return s.state === 'seated' && s.seated.join() === 'l2-review@os-mickey,review#1' && h.status === 'TAKE' && h.taker === 'l2-review@os-mickey' && d.taker === `the area:ux seat (${TIER_DEFAULT_FACE_NOTE})`; })()); + t('⭐ its own delta by either mark: a record signed `l2-review@os-mickey · os-mickey` is that seat\'s and it takes the head; the signer is read off the first line in both forms', (() => { const r = rv({ comments: [signed(HEAD2, `l2-review@os-mickey · os-mickey · ${REVIEWER}`)] }, ACCT_REVIEW); return r.record.seat === 'l2-review@os-mickey' && r.taker === 'l2-review@os-mickey (the delta of its own record 6911000001)' && signerSeatOf(signed(HEAD2, `l2-review@Os-Mickey · os-mickey · ${REVIEWER}`).body) === 'l2-review@os-mickey' && signerSeatOf(signed(HEAD2, MICKEY).body) === 'review#1'; })()); + t('⛔ control — neither mark reads as the other: a `review#1` record stays the numbered seat\'s when only an account seat is seated (the lane takes), an `l2-review@os-mickey` record is not `l2-review@os-bill`\'s, and a line signed for another account\'s seat names nobody', (() => { const ONLY_ACCT = [...SEATED, { lane: 'review', seat: '@os-mickey', status: 'seated' }]; const BILL = [...SEATED, { lane: 'l2-review', seat: '@os-bill', status: 'seated' }]; return rv({ comments: [signed(HEAD2, MICKEY)] }, ONLY_ACCT).taker === LANE_TAKES && reviewSeatsOf(ONLY_ACCT).seated.join() === 'review@os-mickey' && rv({ comments: [signed(HEAD2, `l2-review@os-mickey · os-mickey · ${REVIEWER}`)] }, BILL).taker === LANE_TAKES && signerSeatOf(signed(HEAD2, `l2-review@os-bill · os-mickey · ${REVIEWER}`).body) === null; })()); t('a record on THIS head is DONE — no taker at all, the signer\'s or anyone\'s', (() => { const r = rv({ comments: [signed(HEAD, MICKEY)] }); return r.status === 'DONE' && r.taker === null && r.record.seat === 'review#1'; })()); const ATTR = '\n_Requested by **Y**_\n\nPart of #25922\n\nClause-②: no\nMetadata-protocol: none'; const CLAIMED = [{ id: 7, created_at: '2026-10-28T09:00:00Z', body: 'domain:skills#3 · os-zhuang · session_01Abcdefgh\n\nClaim: PM loop round 1 · 2026-10-28T09:00Z\nBranch: `claude/x`' }]; diff --git a/scripts/pm/check-prior-rulings.mjs b/scripts/pm/check-prior-rulings.mjs index 3d09c88f943..3e5a3ab8c3f 100644 --- a/scripts/pm/check-prior-rulings.mjs +++ b/scripts/pm/check-prior-rulings.mjs @@ -1092,7 +1092,9 @@ const ownerOf = (repo) => String(repo).split('/')[0].toLowerCase(); /** * Every issue or PR a card's body and thread name, in order, deduplicated, the card itself left out. A bare `#N` - * must not touch a word character on its left, so a seat signature's `LANE#N` and a `repo:x#5` name nothing. Each + * must not touch a word character on its left, so a seat signature's `LANE#N` and a `repo:x#5` name nothing; a + * seat named by its account, `LANE@ACCOUNT`, carries no `#N` and names nothing either (an epic seat's + * `epic:#N@ACCOUNT` names its epic, as `epic:#N#k` does). Each * ref carries its scope against the swept repository: `local` (that repository), `sameOwner` (another repository of * its owner), `foreign` (any other owner) or `rejected` (an `owner/repo` that is not two plain names). Pure. */ @@ -2144,6 +2146,7 @@ export async function selfTest() { t('--paths: readRefRow refuses a name that is not plain without a request', J([refused.ok, calls.length]), J([false, 0])); t('--paths: ⭐ the unread faces are named under the run, URL refs and refs on ruling-hit lines by number', J([UNREAD_FACES.every((f) => text.includes(f)), text.includes('URL refs: #77'), text.includes('refs on ruling-hit lines: #31491')]), J([true, true, true])); t('--paths: card refs — a signature\'s LANE#N names nothing, dedup, scope per ref, the card itself out', J(cardRefs(['repo:objectstack#5 · os-bill · session_01ABCDEF\nsee #12 and #12, epic:#35205#1, objectstack-ai/cloud#7, PR #99 and #500 itself'], 'objectstack-ai/objectstack', 500).map((r) => [r.key, r.scope])), J([['objectstack-ai/objectstack#12', 'local'], ['objectstack-ai/objectstack#35205', 'local'], ['objectstack-ai/cloud#7', 'sameOwner'], ['objectstack-ai/objectstack#99', 'local']])); + t('--paths: card refs — both seat marks name nothing: a signature\'s `LANE@ACCOUNT` like its `LANE#N`, an account with digits included; an epic seat names its epic once under either mark', J(cardRefs(['repo:objectstack@os-bill · os-bill · session_01ABCDEF\nrepo:objectstack#5 · os-bill · session_01ABCDEF\nTo: repo:cloud@user-42, by review@os-9 — see #12, epic:#35205@os-bill and epic:#35205#1'], 'objectstack-ai/objectstack', 500).map((r) => r.key)), J(['objectstack-ai/objectstack#12', 'objectstack-ai/objectstack#35205'])); t('--paths: a PR is read as merged, closed unmerged or open; an issue names its assignees', J([refStateOf({ state: 'closed', pull_request: { merged_at: 'x' } }).state, refStateOf({ state: 'closed', pull_request: { merged_at: null } }).state, refStateOf({ state: 'open', assignees: [{ login: 'os-bill' }] }).assignees]), J(['merged', 'closed unmerged', ['os-bill']])); const cap = Array.from({ length: SURFACE_HIT_NAME_CAP + 3 }, (_, k) => h(k + 1, 'a ruling')); const capText = renderPremise({ paths: ['a/**'], rev: 'origin/main', todayUtc: '2000-01-01', byPattern: { ruling: cap, 'Ruling-ref': [], maintainer: [], '⛔': [] }, unmatchedPaths: [], verdict: surfaceVerdict({ ruling: cap }), log: { commits: [], sameDay: [] }, refs: null }); diff --git a/scripts/pm/fleet-write/dispatch.mjs b/scripts/pm/fleet-write/dispatch.mjs index ed54551c146..19fc658f7d1 100644 --- a/scripts/pm/fleet-write/dispatch.mjs +++ b/scripts/pm/fleet-write/dispatch.mjs @@ -2783,8 +2783,8 @@ const SELF_TEST_BATTERIES = Object.freeze({ "the started run: an action naming a workflow is read back as the newest workflow_dispatch run of that file created since the dispatch — the target repo's run list, read after the relay run completed and re-read within a bounded window; found is success naming id, url and actor; none in the window or an unreadable list is UNCONFIRMED (6) after ONE dispatch; a stroke naming no workflow reads none": 13, "the release.yml refresh at the seat: the stroke packs with inputs refresh_version_pr true and travels in ONE dispatch; its started run is read back from release.yml's own run list; force, false, absent or any other input is refused before anything is sent, exit 2": 6, "the batch gap at the seat: content creation read off the op table; a stroke at or above write-pace's threshold is batched through its last content-creating write and waited for exactly that much longer; a stroke whose pacing the relay job cannot hold is refused before anything is sent, naming the per-op doors; the job's timeout mirrors the workflow's": 13, - "the signature at the seat's door: a comment_edit or issue_patch body opens with the seat's signature line or the file is usage (2), nothing packed; generated, body-less and the other doors' ops are left alone": 13, - "the pull request body at the seat's door: an issue_patch body signed only by its LAST-line trailer passes when the platform answers its target is a pull request, before the dry-run exit; an issue, an unread target and a trailer-less body are refused; comment_edit takes no trailer": 19, + "the signature at the seat's door: a comment_edit or issue_patch body opens with the seat's signature line or the file is usage (2), nothing packed; generated, body-less and the other doors' ops are left alone": 15, + "the pull request body at the seat's door: an issue_patch body signed only by its LAST-line trailer passes when the platform answers its target is a pull request, before the dry-run exit; an issue, an unread target and a trailer-less body are refused; comment_edit takes no trailer": 20, "the kind rule at the relay's adding doors: a pm state on pr_create or on a labels_add whose target READS as a pull request, and pm:awaiting-merge on issue_create or on a labels_add whose target reads as an issue, are refused before the dry-run exit with label-write's own sentence, case-insensitively and for the whole file; an unread kind is never a pass; labels_remove and an ungoverned labels_add read nothing": 18, "the run_rerun_failed stroke at the seat: it packs as ONE action carrying run_id alone and travels in ONE dispatch; beside any other action, or with a key that widens it, it is refused before anything is sent; it creates no content, carries no body and names no workflow, so nothing is read back here — a success run is the executor's confirmation; a run that failed at the relay's fence is exit 5 after ONE dispatch, never re-sent": 6, "the hierarchy link at the seat: an epic's children pack as sub_issue_add actions carrying the parent and the child by number alone, beside other issue ops in ONE dispatch; a self-link, an id or a replace_parent is refused before anything is sent; neither row creates content, carries a body or names a workflow, so the stroke is paced at rule ①'s gap and nothing is read back here — a success run is the executor's confirmation; a run that failed at the relay's fence is exit 5 after ONE dispatch, never re-sent": 5, @@ -2792,7 +2792,7 @@ const SELF_TEST_BATTERIES = Object.freeze({ "retired lane aliases at the seat's door: a domain:engine / services / cli / rest label on labels_add, issue_create or pr_create is written as domain:server and said on stderr, a dry run included; a live domain:* label, a non-lane label and labels_remove pass untouched; the rewrite never refuses": 13, "advisory_read at the seat: the key pair made in this process per read — its public half in the action, its private half a KeyObject never exported, written or printed, and a key from the file refused; no byte read-back, said where the read-back is decided; the run's notice parts read back exactly, reassembled 1..n once each and opened with that key byte for byte, end to end through the real executor; what does not open is UNVERIFIED (6) with nothing printed; the text reaches this process's stdout on --reveal alone, never stderr or --json": 17, "advisory_list at the seat: derived from the table into the sealed-read path, so its key pair is made here and a key from the file refused, with no byte read-back, said where the read-back is decided; the real executor's ten notice parts read back, reassembled and opened under the listing's own associated data — never a read's — byte for byte on the padded plaintext; what does not open is UNVERIFIED (6) with nothing printed; --reveal alone prints it, its pad trimmed for that op's display alone, never on stderr or --json": 9, - "advisory_note at the seat: the note read from the file note_file names, composed under the seat's signature line and this door's own stamp, judged, then sealed HERE with a one-time digest key to the relay's committed half under the stroke's request id — the payload carrying the seal alone; a seal from the file, a file inside any git repository, and a missing, unreadable or unjudged one refused and a null committed half a prerequisite, all before anything is sent; the run's ONE notice confirmed against the byte count and keyed digest only this process holds, anything else UNVERIFIED, exit 6 — and no byte of the note on any line the seat prints": 22, + "advisory_note at the seat: the note read from the file note_file names, composed under the seat's signature line and this door's own stamp, judged, then sealed HERE with a one-time digest key to the relay's committed half under the stroke's request id — the payload carrying the seal alone; a seal from the file, a file inside any git repository, and a missing, unreadable or unjudged one refused and a null committed half a prerequisite, all before anything is sent; the run's ONE notice confirmed against the byte count and keyed digest only this process holds, anything else UNVERIFIED, exit 6 — and no byte of the note on any line the seat prints": 23, "advisory_rewrite at the seat: the summary and/or description read from the files summary_file and description_file name, each placed outside every git repository by the note's own check, spelled as one JSON object with no signature or stamp and judged — an empty description refused — then sealed HERE through the note's path with a one-time digest key under the rewrite's own associated data, the payload carrying the seal alone; the real executor's ONE notice confirmed against that digest, a mismatch UNVERIFIED, exit 6 — and no byte of either text on any line the seat prints": 12, }); // Raised 21 → 22 with the run_rerun_failed seat battery, 22 → 23 with the signature battery, 23 → 24 with the @@ -3990,6 +3990,7 @@ export async function selfTest() { // The section. t("the stamp is this door's clock read to the second in UTC, in the one spelling the section's check reads", [advisoryNoteStamp(NOW), ADVISORY_NOTE_STAMP_SHAPE.test(advisoryNoteStamp(NOW))], [STAMP, true]); t("⭐ the section: the file's first line — the seat's signature line, trimmed — then this door's stamp, a blank line and the rest of the file, its leading blank lines and trailing whitespace dropped; the check passes it", [advisoryNoteSection(FILE_TEXT, STAMP), advisoryNoteSectionFailure(SECTION)], [{ section: SECTION }, null]); + t("⭐ both seat marks sign a note: a file opening `LANE@ACCOUNT` composes and passes the check as the `LANE#N` one does; ⛔ that seat under another account is no signature line, at the door and at the check", (() => { const ACC = `security@os-dev-a · os-dev-a · ${SESSION}`; const OTHER = `security@os-dev-a · os-dev-b · ${SESSION}`; const made = advisoryNoteSection(`${ACC}\n${MARKER}`, STAMP); return [made.section === `${ACC}\n${STAMP}\n\n${MARKER}`, advisoryNoteSectionFailure(made.section ?? ''), advisoryNoteSection(`${OTHER}\n${MARKER}`, STAMP).refusal?.includes('not your signature line'), advisoryNoteSectionFailure(`${OTHER}\n${STAMP}\n\n${MARKER}`)?.includes('not a seat signature line')]; })(), [true, null, true, true]); const sectionRefusals = [ `${SIG}\r\n${MARKER}`, `${MARKER}\n${SIG}`, @@ -4513,6 +4514,9 @@ export async function selfTest() { t('…each row carries the line it read and why', unsignedEditBodies([{ op: 'comment_edit', comment_id: 7, body: '\n\nEdited.' }])[0]?.line, 'Edited.'); t('signed bodies pass, blank lines above the signature included', ROWS([{ op: 'comment_edit', comment_id: 7, body: `${SIG}\nEdited.` }, { op: 'issue_patch', issue: 3, body: `\n${SIG}\n\nSeat post` }]), []); t('⛔ a signature on a LATER line is not one: the first non-empty line decides', ROWS([{ op: 'issue_patch', issue: 3, body: `Seat post\n${SIG}` }]), ['1:issue_patch']); + // The second seat mark (ruling record 7249169754): `LANE@ACCOUNT` is read beside `LANE#N`; the shape the refusal prints is still `#N`. + t('⭐ both seat marks open an edit body: one signed `LANE@ACCOUNT` passes as the `LANE#N` one does', ROWS([{ op: 'comment_edit', comment_id: 7, body: `repo:objectstack@os-justin · os-justin · ${SESSION}\nEdited.` }, { op: 'issue_patch', issue: 3, body: `repo:objectstack#5 · os-justin · ${SESSION}\nSeat post` }]), []); + t('⛔ account X signing account Y\'s seat is refused, named a near miss — the body is never packed as Y\'s seat', (() => { const rows = unsignedEditBodies([{ op: 'issue_patch', issue: 3, body: `repo:objectstack@os-justin · os-elon · ${SESSION}\nSeat post` }]); return [rows.map((r) => `${r.action}:${r.op}`), rows[0]?.why.includes('only that same account signs')]; })(), [['1:issue_patch'], true]); t('an issue_patch that carries no body (a close) is not judged', ROWS([{ op: 'issue_patch', issue: 3, state: 'closed', state_reason: 'completed' }]), []); t("the other doors' ops are not judged here — comment and issue_create refuse at post-stamped and issue-create, pr_create's first line is `Fixes #n`", ROWS([{ op: 'comment', issue: 1, body: 'x' }, { op: 'issue_create', title: 't', body: 'x' }, { op: 'pr_create', title: 't', head: 'h', base: 'main', body: 'Fixes #1' }]), []); t('the roster body is generated, and exempt by the marker its generator writes — imported, never restated', [GENERATED_BODY_MARKERS.includes(ROSTER_MARKER), ROWS([{ op: 'issue_patch', issue: 9, body: `${ROSTER_MARKER}\n\n| seat | holder |` }])], [true, []]); @@ -4616,6 +4620,7 @@ export async function selfTest() { const CANDS = (actions) => pullRequestBodyCandidates(actions).map((r) => `${r.action}:${r.issue}`); t('the trailer parses with the existing signature reader: the same four parts as the bare line', [readPrBodyTrailer(PR_BODY)?.shaped, readPrBodyTrailer(PR_BODY)?.signature], [true, readSignatureLine(SIG)]); t('…trailing blank lines are not the last line, and spaces inside the comment are trimmed', readPrBodyTrailer(`x\n\n\n\n`)?.signature?.session, SESSION); + t('⭐ the trailer reads both seat marks: `LANE@ACCOUNT` names the landing seat by its account (`@account`), and under another account it is shaped but no signature', [readPrBodyTrailer(`x\n`)?.signature?.seat, readPrBodyTrailer(`x\n`)?.signature?.seat, readPrBodyTrailer(`x\n`)?.shaped, readPrBodyTrailer(`x\n`)?.signature], ['@marchtian', 5, true, null]); t('⛔ the trailer on an EARLIER line is not one: the last non-empty line decides', readPrBodyTrailer(`${TRAILER}\nMore prose`)?.signature ?? null, null); t('⛔ a bare signature on the last line, or the comment around a near miss, is no trailer — the near miss still reads as shaped', [readPrBodyTrailer(`x\n${SIG}`)?.shaped, readPrBodyTrailer(`x\n`)?.shaped, readPrBodyTrailer(`x\n`)?.signature], [false, true, null]); t('a trailer-only issue_patch body is a candidate for the platform read, and not a first-line refusal', [CANDS([{ op: 'issue_patch', issue: 29200, body: PR_BODY }]), ROWS([{ op: 'issue_patch', issue: 29200, body: PR_BODY }])], [['1:29200'], []]); diff --git a/scripts/pm/fleet-write/execute.mjs b/scripts/pm/fleet-write/execute.mjs index 92817b6061b..5eae3d4f9fb 100644 --- a/scripts/pm/fleet-write/execute.mjs +++ b/scripts/pm/fleet-write/execute.mjs @@ -2928,12 +2928,12 @@ const SELF_TEST_BATTERIES = Object.freeze({ "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, // 9 → 12 with a carrying comment that opens with a seat signature refused, its other way, and no reader carrying nothing; // the other way flipped (still 12) when a signature on ANY line refused the carry, not only the first. - "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, + "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": 13, // 16 → 27 with seat-asks bound to the landing seat (another seat, the relay's own audit, no trailer, the pure match), // the pull read back open and unmerged (merged, closed, a late read, the pure reading) and the node id from the first read; // 27 → 28 with the second pull read one interval later, a merge that shows only there refused; // 28 → 29 with a failed second pull read starting the pair over. - "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, + "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": 30, "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, "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": 46, "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, @@ -3949,6 +3949,8 @@ export async function selfTest() { 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]); const signedLower = commentOf({ body: `The approval carries to ${HEAD.slice(0, 9)}.\n\ntriage#1 · ${APPROVER} · session_01ABCDEFGHJKMNPQRSTVWXYZ` }); 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]); + const signedNamed = commentOf({ body: `The approval carries to ${HEAD.slice(0, 9)}.\n\nrepo:objectstack@${APPROVER} · ${APPROVER} · session_01ABCDEFGHJKMNPQRSTVWXYZ` }); + t('⛔ CARRIED, refused under the second seat mark too: a comment holding a `LANE@ACCOUNT` signature is a seat\'s comment — the reading naming that seat', [await verdict({ [REVIEWS]: reviewsOf(review(APPROVER, EARLIER)), [COMMENT]: signedNamed }, { approval_comment: 71 }), (await run(stroke({ approval_comment: 71 }), { ...happy, [REVIEWS]: reviewsOf(review(APPROVER, EARLIER)), [COMMENT]: signedNamed })).rows[0]?.result.includes(`holds the seat signature repo:objectstack@${APPROVER.toLowerCase()} · ${APPROVER}`)], [refused, true]); const pastApproval = { state: 'approved', approvals: [{ login: APPROVER, commitId: EARLIER }] }; 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]); 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]); @@ -4014,6 +4016,7 @@ export async function selfTest() { const noTrailer = await run(stroke({ cause: 'seat-asks' }), { ...happy, ...asks(signed(RELAY_COMMENT_AUTHOR, SESSION)), [PULL_GET]: pullAt({ mergeable: true, mergeable_state: 'blocked', body: prBody.replace(//u, '') }) }); t('⛔ seat-asks, refused: a pull body whose last line is no signed trailer names no landing seat — refused unread, its comments never walked, the sentence naming the trailer', [noTrailer.exit, writes(noTrailer.seen).filter((x) => x.call !== GQL).length, noTrailer.seen.filter((x) => x.call === COMMENTS).length, noTrailer.rows[0]?.result.includes("signed trailer names no seat")], [EXIT_ACTION_FAILED, 0, 0, true]); t('signedByLandingSeat: one seat, account and session holds; any one of the four parts different, or either reading missing, does not', [signedByLandingSeat({ lane: 'domain:server', seat: 5, account: 'a', session: 's' }, { lane: 'domain:server', seat: 5, account: 'a', session: 'other' }, 's'), ...[{ lane: 'queue' }, { seat: 6 }, { account: 'b' }, { session: 't' }].map((d) => signedByLandingSeat({ lane: 'domain:server', seat: 5, account: 'a', session: 's', ...d }, { lane: 'domain:server', seat: 5, account: 'a' }, 's')), signedByLandingSeat(null, { lane: 'x', seat: 1, account: 'a' }, 's'), signedByLandingSeat({ lane: 'x', seat: 1, account: 'a', session: 's' }, null, 's')], [true, false, false, false, false, false, false]); + t('⭐ signedByLandingSeat reads both seat marks, by lane AND mark: an account seat\'s signature is its own landing seat\'s; ⛔ never a numbered seat\'s of the lane (CONTROL: a `#5` signature stays seat 5\'s, whoever signed it), nor another account\'s', (() => { const acct = readSignatureLine('repo:objectstack@os-a · os-a · session_01ABCDEF'); const num = readSignatureLine('repo:objectstack#5 · os-a · session_01ABCDEF'); const other = readSignatureLine('repo:objectstack@os-b · os-b · session_01ABCDEF'); return [signedByLandingSeat(acct, acct, 'session_01ABCDEF'), signedByLandingSeat(num, num, 'session_01ABCDEF'), signedByLandingSeat(num, acct, 'session_01ABCDEF'), signedByLandingSeat(acct, num, 'session_01ABCDEF'), signedByLandingSeat(other, acct, 'session_01ABCDEF'), readSignatureLine('repo:objectstack@os-a · os-b · session_01ABCDEF')]; })(), [true, true, false, false, false, null]); const unreadComments = await run(stroke({ cause: 'seat-asks' }), { ...happy, ...asks({ status: 502, json: { message: 'Bad Gateway' } }) }); t('⛔ seat-asks with the comments unread: nothing written, the read named — an unread list is never unsigned', [unreadComments.exit, writes(unreadComments.seen).filter((x) => x.call !== GQL).length, mutations(unreadComments.seen).length, unreadComments.rows[0]?.result.includes('comments could not be read')], [EXIT_ACTION_FAILED, 0, 0, true]); const noAudit = await run(stroke(), { ...happy, [AUDIT]: { status: 403, json: { message: 'Resource not accessible by integration' } } }); diff --git a/scripts/pm/fleet-write/validate.mjs b/scripts/pm/fleet-write/validate.mjs index f8fdf5c9b1e..eb32e586bdb 100644 --- a/scripts/pm/fleet-write/validate.mjs +++ b/scripts/pm/fleet-write/validate.mjs @@ -1183,7 +1183,7 @@ const SELF_TEST_BATTERIES = Object.freeze({ "the pr_dequeue row: pull, expected_head_sha, a cause from the closed three and a bounded reason, and nothing that widens them; ONE dequeuePullRequest mutation behind the pull's node id; a stroke of exactly that one action; merge-queues write minted for that stroke, EMPTY for every other; contents and issues its literal alsoSpends; the fences on the pull, its queue and the cause named and left to the executor": 11, "the hierarchy rows: sub_issue_add and sub_issue_remove name a parent and a child by NUMBER — two different positive integers and nothing that widens them; one POST to the parent's sub_issues and one DELETE to its sub_issue, the body left to the executor; issues write, riding any stroke on the literal grants; the fences on the two cards, each accepted and refused — an issue on the repository, never a pull or a transferred card, the child free of any other parent or listed by this one; and the read-back's judgment by the child's id": 23, "the event file: the workflow carries client_payload in no step's env, and the payload is read from GITHUB_EVENT_PATH": 6, - "the advisory rows: advisory_report, advisory_create, advisory_collaborators_add, advisory_versions and advisory_state — closed keys, a malformed id, package or versions entry refused before any request, a refusal that names the key and the byte count and never echoes a value, published reached by advisory_state alone, from draft alone and through the versions fence; one request each, the draft's and the versions' bodies naming no state and the two other PATCH bodies left to the executor; each a stroke of its own, repository-advisories write minted for it and EMPTY for every other; the bare collection reached by the draft's POST alone and every other security-advisories path refused; the fences, the transitions, the merge and the five read-backs, printing nothing of an answer but the id, the state, the logins and counts": 90, + "the advisory rows: advisory_report, advisory_create, advisory_collaborators_add, advisory_versions and advisory_state — closed keys, a malformed id, package or versions entry refused before any request, a refusal that names the key and the byte count and never echoes a value, published reached by advisory_state alone, from draft alone and through the versions fence; one request each, the draft's and the versions' bodies naming no state and the two other PATCH bodies left to the executor; each a stroke of its own, repository-advisories write minted for it and EMPTY for every other; the bare collection reached by the draft's POST alone and every other security-advisories path refused; the fences, the transitions, the merge and the five read-backs, printing nothing of an answer but the id, the state, the logins and counts": 91, "advisory_read: ghsa_id and public_key alone — the key its own kind, an X25519 key in base64 SPKI DER; a malformed key or id refused before any request and never echoed; ONE GET of one advisory; a stroke of its own whose token alone carries repository-advisories READ; the seal opening byte for byte for its own read and key alone, the parts inside the runner's caps, the sender gate's one setting with every other closed, and the fences, printing no id, state or field": 28, "advisory_list: public_key alone — no state, page, cursor or query the caller can pass; a stroke of its own whose token alone carries repository-advisories READ under the read's sender gate; the listing page's one path shape per listed state; the next cursor taken only from one rel=next link on this API's collection and this state, in its closed shape; each page fenced; each advisory projected to five fields before the seal; the JSON padded to one constant sealed size, ten parts, whatever the count, and one more advisory than fits refused; the shared associated data, advisory_read's byte for byte; and no id, count, state or cursor in any sentence": 28, "advisory_note: ghsa_id and sealed_note alone — the note its own kind, ciphertext of a capped length in canonical base64url, refused before any request and never echoed or opened here; ONE PATCH of one advisory whose body is the executor's; a stroke of its own minting repository-advisories write and marked advisory_note=yes, EMPTY for every other; the workflow handing the relay's note key to the execute step for that stroke alone, and no artifact; the seal opening for its own request, action, advisory and key alone and never as a read; the key judged against the committed half; the fences, the description, the read-back and the keyed digest, printing no byte of either text": 22, @@ -2268,6 +2268,8 @@ export async function selfTest() { const { SEAT_SIGNATURE_LINE } = await import('../check-half-states.mjs'); const LIVE = ['domain:security#2 · os-dev-a · session_01ABCDEFGHJKMNPQRSTVWXYZ', 'triage#1 · sunhaolin · session_01ABCDEF', 'epic:#36662#3 · os-x · session_ABCDEFG', 'l2-review#12 · a-b-c · session_0123456789', 'repo:hotcrm#2 · x · session_abcdef']; t('the shape is a SUPERSET of the live signature check: every line SEAT_SIGNATURE_LINE accepts is counted — so retiring a lane word from that list never lets a note signed under it through', [LIVE.map((l) => SEAT_SIGNATURE_LINE.test(l)), LIVE.map((l) => advisoryNoteSectionCount(`public text\n${l}`))], [LIVE.map(() => true), LIVE.map(() => 1)]); + const NAMED = ['repo:objectstack@os-dev-a · os-dev-a · session_01ABCDEFGHJKMNPQRSTVWXYZ', 'security@a-b-c · a-b-c · session_0123456789', 'epic:#36662@os-x · os-x · session_ABCDEFG', 'repo:objectstack@os-dev-a · os-dev-b · session_01ABCDEFGHJKMNPQRSTVWXYZ']; + t('⭐ …and of BOTH seat marks: a note signed `LANE@ACCOUNT` (ruling record 7249169754) is counted as the `LANE#N` one is, that seat under another account — which no reader takes for a signature — included, so no note leaves by the second mark', [NAMED.map((l) => SEAT_SIGNATURE_LINE.test(l)), NAMED.map((l) => advisoryNoteSectionCount(`public text\n${l}`)), advisoryNoteSectionCount('mail os@example · me · session_none'), advisoryNoteSectionCount('ping @os-dev-a · os-dev-a · session_01ABCDEF')], [NAMED.map(() => true), NAMED.map(() => 1), 0, 0]); const publishFence = (description, to = 'published') => advisoryFenceFailures({ ghsaId: GHSA, answer: answer(advisory({ state: to === 'published' ? 'draft' : 'closed', description, vulnerabilities: onWire(VERSION) })), from: ADVISORY_TRANSITIONS[to], to }); const noted = publishFence(`NOTES MARKER: the finder's text${ADVISORY_NOTE_SEPARATOR}${SECTION(1)}`); t("⛔ fence notes, judged for a publish alone: a draft whose description still carries a seat signature line is refused by the notes fence, naming the count and no byte of the text; a description that is neither text nor none is refused too; the same draft rewritten passes; a reopen to draft with a note in it is not judged by it", [noted.map((f) => f.fence), advisoryFenceText(noted).includes('still carries 1 seat signature line(s)'), advisoryFenceText(noted).includes('MARKER'), publishFence(['NOTES MARKER']).map((f) => f.fence), advisoryFenceText(publishFence({ text: 'NOTES MARKER' })).includes('is object, so it cannot be judged free of seat notes'), publishFence('NOTES MARKER: the public text').map((f) => f.fence), publishFence(null).map((f) => f.fence), publishFence(SECTION(1), 'draft').map((f) => f.fence)], [['notes'], true, false, ['notes'], true, [], [], []]); diff --git a/scripts/pm/issue-create.mjs b/scripts/pm/issue-create.mjs index ef76dcbc7ec..ad166e34a1a 100644 --- a/scripts/pm/issue-create.mjs +++ b/scripts/pm/issue-create.mjs @@ -453,7 +453,7 @@ export async function relayMissProbe({ route, send, pace }) { const SELF_TEST_BATTERIES = Object.freeze({ 'the arguments: files not argv for prose, exactly one title source, a repo shape': 10, 'the payload: title trimmed to one line, labels and assignees de-duplicated, nothing invented': 5, - "the signature: a card body opens with the seat's signature line, or the plan is refused before any request": 8, + "the signature: a card body opens with the seat's signature line, or the plan is refused before any request": 10, 'the transport: a fake platform, and what each answer does to the exit code': 9, 'dry-run: no request leaves, and the plan is printed': 4, 'the wiring: both halves around the one POST, on the write verb only': 4, @@ -494,6 +494,9 @@ export async function selfTest() { 'unsigned.md': 'Evidence: a repro.\n\n- step one\n', 'unsigned-stamped.md': 'Reading time {{NOW}}\n', 'near-miss.md': 'domain:skills#2 - os-justin - session_01ABCDEFGHJKMNPQRSTVWXYZ\nEvidence.\n', + // The second seat mark (ruling record 7249169754): a seat named by its account, and that seat under another account. + 'account-seat.md': 'repo:objectstack@os-justin · os-justin · session_01ABCDEFGHJKMNPQRSTVWXYZ\nEvidence: a repro.\n', + 'account-seat-other.md': 'repo:objectstack@os-justin · os-elon · session_01ABCDEFGHJKMNPQRSTVWXYZ\nEvidence.\n', 'second-line.md': 'Evidence: a repro.\n\ndomain:skills#2 · os-justin · session_01ABCDEFGHJKMNPQRSTVWXYZ\n', }; const read = (p) => { @@ -540,6 +543,8 @@ export async function selfTest() { t('…and the refusal names the shape to write and the line it read', unsigned.errors.some((e) => e.includes('no signature line') && e.includes('LANE#N · ACCOUNT · SESSION') && e.includes('`Evidence: a repro.`'))); t('a signed body plans, and the signature is SENT as written — nothing stripped, nothing inserted', [plan('body.md').ok, plan('body.md').payload.body.split('\n')[0]], [true, SIG]); t('a near miss (hyphens for the ` · ` separator) is refused, and named as one', plan('near-miss.md').errors.some((e) => e.includes('reads like a signature and is not one'))); + t('⭐ both seat marks are accepted: a body signed `LANE@ACCOUNT` plans as one signed `LANE#N` does, sent as written', [plan('account-seat.md').ok, plan('account-seat.md').payload.body.split('\n')[0], plan('body.md').ok], [true, 'repo:objectstack@os-justin · os-justin · session_01ABCDEFGHJKMNPQRSTVWXYZ', true]); + t('⛔ account X signing account Y\'s seat is refused as a near miss — never posted as Y\'s seat', [plan('account-seat-other.md').ok, plan('account-seat-other.md').errors.some((e) => e.includes('reads like a signature and is not one') && e.includes('only that same account signs'))], [false, true]); t('⛔ a signature on a LATER line is not a signature: the first non-empty line decides', plan('second-line.md').ok, false); const both = plan('unsigned-stamped.md').errors; t('a body breaking BOTH rules hears both, in one refusal', [both.some((e) => e.includes('{{NOW}}')), both.some((e) => e.includes('no signature line'))], [true, true]); diff --git a/scripts/pm/post-stamped.mjs b/scripts/pm/post-stamped.mjs index 317422baf0e..d4aaa252941 100644 --- a/scripts/pm/post-stamped.mjs +++ b/scripts/pm/post-stamped.mjs @@ -4362,7 +4362,7 @@ const SELF_TEST_BATTERIES = Object.freeze({ 'the relay transport: the same act as one op, the comment found on the board, the exit register kept apart': 13, "the size route: over the relay's body cap under auto THIS write goes direct with one line naming bytes, cap and identity; at or under it the relay; explicit dispatch refuses naming the bytes; nothing else re-routes": 13, 'the signature: every body opens with LANE#N · ACCOUNT · SESSION or is refused, beside the stamp contract; one leading signature changes no reading': 11, - 'the one judge: every body refusal on ONE path — `main` and `label-write.mjs --comment-file` call `judgeBody`, never a copy': 8, + 'the one judge: every body refusal on ONE path — `main` and `label-write.mjs --comment-file` call `judgeBody`, never a copy': 11, 'the review route: a `Request: contract-review` knock addressed to triage is refused; to a review or sibling seat, and every other key to triage, it passes': 10, 'the record tier: a record naming `CONTRACT_REVIEW_TIER` is written only on a transcript `verify-review-tier.mjs` passes; another tier and a non-record comment are untouched': 16, 'the claim stroke: a comment opening `Claim:` is refused on every route but `direct`, pointing at the `label-write` fold; the same body through that fold passes': 21, @@ -5913,6 +5913,13 @@ export function selfTest() { const SIG = 'domain:skills#2 · os-justin · session_01QSeKYmhU5KEj1nukYhp1Tg'; const ok = judgeBody(`${SIG}\nClaim: PM loop round 1 · {{NOW}}\nSeat: \`domain:skills#2\`\nContainer & model: \`S\`, \`mode:subagent\`, \`model: ${TIER_DEFAULT}\`, \`effort: medium\``, { mode: 'comment' }, NOW_MS); t('⭐ a signed, stamped claim passes and comes back RENDERED — the clock this act read is in it', ok.ok && ok.rendered.substituted === 1 && ok.rendered.body.includes(ok.rendered.stamp) && !ok.rendered.body.includes(STAMP_TOKEN)); + // The second seat mark (ruling record 7249169754): readers take `LANE@ACCOUNT` beside `LANE#N`; the writers' printed shape is still `#N`. + const ACC = 'repo:objectstack@os-justin · os-justin · session_01QSeKYmhU5KEj1nukYhp1Tg'; + const claimOf = (sig, seat) => `${sig}\nClaim: PM loop round 1 · {{NOW}}\nSeat: \`${seat}\`\nContainer & model: \`S\`, \`mode:subagent\`, \`model: ${TIER_DEFAULT}\`, \`effort: medium\``; + t('⭐ both seat marks pass the one judge: a claim signed `LANE@ACCOUNT` whose `Seat:` line names that seat is accepted exactly as the `LANE#N` one is — signature and keyed line both read', [judgeBody(claimOf(ACC, 'repo:objectstack@os-justin'), { mode: 'comment' }, NOW_MS).ok, judgeBody(claimOf(ACC, 'repo:objectstack@os-justin'), { mode: 'body' }, NOW_MS).ok, claimKeyedLineRefusals(claimOf(ACC, 'repo:objectstack@os-justin')).length, claimSeatNumber(claimOf(ACC, 'repo:objectstack@os-justin')), claimSeatNumber(claimOf(SIG, 'domain:skills#2'))].join() === [true, true, 0, '@os-justin', 2].join()); + const other = judgeBody(claimOf('repo:objectstack@os-justin · os-elon · session_01QSeKYmhU5KEj1nukYhp1Tg', 'repo:objectstack@os-justin'), { mode: 'comment' }, NOW_MS); + t('⛔ account X signing account Y\'s seat is REFUSED before the write, as a near miss — it is never posted as Y\'s seat', !other.ok && other.text.includes('reads like a signature and is not one') && other.text.includes('only that same account signs')); + t('⛔ a `Seat:` line naming an account seat off the line start is still refused by its owner — present, unreadable, ⛔ never seat 1', claimKeyedLineRefusals(`${ACC}\nClaim: PM loop round 1 — dispatched. Seat: repo:objectstack@os-justin — R1.`).some((r) => r.key === 'Seat') && !claimKeyedLineRefusals(claimOf(ACC, 'repo:objectstack@os-justin')).some((r) => r.key === 'Seat')); const unsigned = judgeBody('Claim: PM loop round 1 · {{NOW}}', { mode: 'comment' }, NOW_MS, 'label-write'); t('⭐ an unsigned comment is refused, and the refusal names the SENDER it was handed', !unsigned.ok && unsigned.text.startsWith('label-write: REFUSED') && unsigned.text.includes('opens with no signature line')); const typed = judgeBody(`${SIG}\nClaim: PM loop round 1 · 2026-09-10T06:37Z`, { mode: 'comment' }, NOW_MS); From b96b0eb440fe7c0adfa7ce7a6e0ea54321ccaa17 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 03:35:01 +0000 Subject: [PATCH 5/6] pm: the seat grammar names LANE@ACCOUNT as an accepted reading (seat-post protocol, dev agent) Readers only: writers keep emitting LANE#N. Each file pays its added clause by a deletion in the same file, and both ratchet rows drop to the landed size. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01FEkQ5oPfjnm2yWHEwkiYrn --- .claude/agents/os-dev.md | 4 ++-- .claude/skills/pm-dispatch/references/seat-post-protocol.md | 4 ++-- scripts/pm/check-skill-line-ratchet.mjs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.claude/agents/os-dev.md b/.claude/agents/os-dev.md index 4c1071ee066..566257b11f3 100644 --- a/.claude/agents/os-dev.md +++ b/.claude/agents/os-dev.md @@ -85,7 +85,7 @@ model: opus 1. **重活串行,共享验证锁只有一个入口。** 每次 build/test 都从这里走。 - `bash scripts/pm/os-verify-lock.sh -c ''`(或 `-- `);⛔ 永不手搓 `flock`/lockfile。 - - 一次前台调用领全部等待预算,阻塞到拿锁或 99;⛔ 不轮询重试,恒设 `OS_VERIFY_LOCK_SLOT`。 + - 一次前台调用领全部等待预算,阻塞到拿锁或 99;⛔ 不轮询重试。 - 它不保证机器空闲:`check:*` 门禁、install、dev server 不走它,与持锁同核并跑。 - 超前台上限者(`check:pm-dispatch-gates`、全量 dogfood):`nohup … > LOG 2>&1 &` 后 `tail --pid`。 - 锁下墙钟绝对值是共享盒读数;只包命令本身,不包你的阅读与判断。 @@ -270,7 +270,7 @@ model: opus - 全文 ⛔ 不出现 HTML 注释:sanitizer 落库后吃短尖括号片段,连反引号里的也吃。 - 例外二:harness 自写 PR 正文首行归属注释原样留、只报,`Fixes #` 紧随;派发令要求才独占 - 末个非空行写 ``(`PR_BODY_TRAILER_SHAPE`);其余 dev 自写仍禁。 + 末个非空行写 ``(`PR_BODY_TRAILER_SHAPE`,读方亦认 `LANE@ACCOUNT`);其余 dev 自写仍禁。 - 凡要上 GitHub 的文本,尖括号形状片段一律改占位词拼写(`FIELD`、`IDENT.MEMBER` 一类)。 - 各派发模式(`mode:subagent`、`mode:cloud`、`mode:thread`)下 GitHub 都是报告的权威源。 - 评论、PR 正文都读回到尾:只认首行标记保不住正文,sanitizer 可从首个 tag 形片段吃到尾。 diff --git a/.claude/skills/pm-dispatch/references/seat-post-protocol.md b/.claude/skills/pm-dispatch/references/seat-post-protocol.md index 071e661bca2..0cefb947285 100644 --- a/.claude/skills/pm-dispatch/references/seat-post-protocol.md +++ b/.claude/skills/pm-dispatch/references/seat-post-protocol.md @@ -26,7 +26,7 @@ - 会话座位查最新产出评论的时间戳;回收 = 改正文 + 审计评论。 - 可跑读法:本车道 `pm:dispatched` 卡按 `updated_at` 降序一搜,或读最新认领评论。 - 写侧刷新三时刻:派发、收班、暂停或交接前;时间戳恒取自 `post-stamped.mjs`。 -- 帖与卡正文首行恒为署名 `LANE#N · ACCOUNT · SESSION`;缺即写工具拒发(`post-stamped.mjs` 头注)。 +- 帖与卡正文首行恒为署名 `LANE#N · ACCOUNT · SESSION`(读方亦认 `LANE@ACCOUNT`);缺即写工具拒发(`post-stamped.mjs` 头注)。 - PR 正文末非空行署 ``,整篇经 `dispatch.mjs` 的 `issue_patch`。 - 刷新前回执敲门;`--body` 拦截:评论晚于末次戳 ⇒ `--ack-through=ID`;空座欠账无卡号 ⇒ 拒写。 - 耐久状态只住正文或以 App 写入;正文守中继上限 60,000 字节,超大贴由半状态巡查浮出。 @@ -43,7 +43,7 @@ - 巡查改绑 = 继任自建自绑并删旧,`Patrol:` 换号;前任笔迹归继任不自退,旧会话即结束。 - 上下文读数:`get_session`(无参)`external_metadata.context_usage.used_tokens`;读不到或 0 归协调者读。 -## 交接收尾清单(漏一步就是留残缺现场) +## 交接收尾清单 1. 立即停止新派发。 2. 认领卡落地,或同笔 `Release:`+`Resume-from:`+清 assignee 交回 `pm:queue`;`needs_decision` 进决策箱。 diff --git a/scripts/pm/check-skill-line-ratchet.mjs b/scripts/pm/check-skill-line-ratchet.mjs index 503f487f638..54ca2b291be 100644 --- a/scripts/pm/check-skill-line-ratchet.mjs +++ b/scripts/pm/check-skill-line-ratchet.mjs @@ -101,7 +101,7 @@ export const CEILINGS = new Map([ ['.claude/skills/pm-dispatch/references/review-checklist.md', 79], ['.claude/skills/pm-dispatch/references/landing-operations.md', 10705], ['.claude/skills/pm-dispatch/references/release-aftercare.md', 3526], - ['.claude/skills/pm-dispatch/references/seat-post-protocol.md', 7720], + ['.claude/skills/pm-dispatch/references/seat-post-protocol.md', 7716], // lowered 7720 → 7716 by the #38415 seat-mark readers PR (the signature line names `LANE@ACCOUNT` as a reading, paid by the checklist heading's aside; the file's landed size, headroom 0) ['.claude/skills/pm-dispatch/references/true-green.md', 2068], ['.claude/skills/pm-dispatch/references/compile-surfaces.md', 2488], ['.claude/skills/pm-dispatch/references/seat-lifecycle.md', 9070], // raised 9070 → 9076 (+6) by ruling record 7075909669 (#36203 items 1-5: 「同意五条都改」): card-pick --why every patrol round; lowered 9076 → 9070 by the PR that moved the tier and effort values to the one home @@ -136,7 +136,7 @@ export const CEILINGS = new Map([ ['.claude/skills/pm-dispatch/references/lanes/queue.md', 2003], ['.claude/skills/pm-dispatch/references/lanes/cloud.md', 1232], ['.claude/skills/pm-dispatch/references/lanes/objectstack.md', 2540], // raised 2270 → 2540 by the ruled text (one seat per lane by default; a new `area:*` is a partition of that seat), ruling record 7030459053 - ['.claude/agents/os-dev.md', 33492], // lowered 33500 → 33492 by the #35237 slice-13 PR (rule 1's probe line spells its --branch; the file's landed size, headroom 0); before that: lowered 33504 → 33500 by the #35237 slice-10 entry-pointers PR (the file's landed size, headroom 0); before that: lowered 38986 → 33504 by the entry-file slimming PR (four one-path blocks moved verbatim to references/dev-traps.md and references/dev-ablation.md, one pointer line left for each); before that: lowered 39008 → 38848 by the re-basing PR's own edit; raised 38848 → 38986 (+138) by ruling record 7076315104 (Q13, the decision card 「定一下:五条新增规则要不要写进技能」: 「五条都写」): a card thread's first step reads the tier it is served and compares it with the order + ['.claude/agents/os-dev.md', 33491], // lowered 33492 → 33491 by the #38415 seat-mark readers PR (the trailer line names `LANE@ACCOUNT` as a reading, paid by the lock entry's second copy of the slot rule; the file's landed size, headroom 0); before that: lowered 33500 → 33492 by the #35237 slice-13 PR (rule 1's probe line spells its --branch; the file's landed size, headroom 0); before that: lowered 33504 → 33500 by the #35237 slice-10 entry-pointers PR (the file's landed size, headroom 0); before that: lowered 38986 → 33504 by the entry-file slimming PR (four one-path blocks moved verbatim to references/dev-traps.md and references/dev-ablation.md, one pointer line left for each); before that: lowered 39008 → 38848 by the re-basing PR's own edit; raised 38848 → 38986 (+138) by ruling record 7076315104 (Q13, the decision card 「定一下:五条新增规则要不要写进技能」: 「五条都写」): a card thread's first step reads the tier it is served and compares it with the order ['.claude/skills/checklist-test/SKILL.md', 14209], // lowered 19558 → 14209 by the entry-file slimming PR (the bodies of §5 and §6 moved verbatim to the two reference files below, one pointer line left in each section) ['.claude/skills/checklist-test/references/closure.md', 4553], // new row, landed size, headroom 0 ['.claude/skills/checklist-test/references/standing-regression.md', 1261], // new row, landed size, headroom 0 From c299a96daec541743d97a16b02bf478d56ade7ea Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 05:11:39 +0000 Subject: [PATCH 6/6] pm: the triage knock refusal and the stale-seat-post row read the account mark The contract-review knock check judges the target by its lane word before either seat mark, so a knock to a triage seat named by its account is refused as the numbered one is. The stale-seat-post finding prints an account mark in a code span, since the row is written into an issue body. The half-states self-test now pins the cross-account guard of the signature reader itself. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01FEkQ5oPfjnm2yWHEwkiYrn --- scripts/pm/check-half-states.mjs | 9 +++++++-- scripts/pm/post-stamped.mjs | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/scripts/pm/check-half-states.mjs b/scripts/pm/check-half-states.mjs index 0201a4ef30a..d99a068a201 100644 --- a/scripts/pm/check-half-states.mjs +++ b/scripts/pm/check-half-states.mjs @@ -9745,8 +9745,11 @@ export function h38SeatPostStale(seat, seatAt, claim) { if (claim.at <= seatAt) return null; const behindHours = (claim.at - seatAt) / 3_600_000; + // An account mark is printed in a code span: this row is written into the patrol's anchor issue, where a loose + // `@login` is a mention. A seat number is printed bare, as it always was. + const seatWord = typeof seatNo === 'string' ? `\`${seatNo}\`` : seatNo; return ( - `\`pm:seat\` post is STALE — its intake ${lane} (seat ${seatNo}) carries a \`Claim:\` on #${claim.number} written ` + + `\`pm:seat\` post is STALE — its intake ${lane} (seat ${seatWord}) carries a \`Claim:\` on #${claim.number} written ` + `${behindHours.toFixed(1)}h AFTER this post's last event (claim ${new Date(claim.at).toISOString()}, ` + `post ${new Date(seatAt).toISOString()}). A shift dispatched work and did not record it, so every ` + 'number the post states — 在飞 / 队列 / 决策箱 / the round number — describes a round that has since ' + @@ -33551,7 +33554,9 @@ async function selfTest() { const vacantSeat1 = new Map([[1, seatRow('Seat: `repo:objectstack#1`', '2026-08-30T00:00:00Z')]]); t('H38 seat (account mark): CONTROL — a `#1` claim by a vacant seat still reads as seat 1\'s', J38([newestLaneClaim('area:data', oneCard, vacantSeat1, 1).number, newestLaneClaim('area:data', oneCard, seat1Claim, 1).number]), J38([1, 1])); t('H38 seat (account mark): CONTROL — …and ⛔ never as the account seat\'s, so the new account\'s post is not rowed over it', J38([newestLaneClaim('area:data', oneCard, vacantSeat1, '@os-b'), newestLaneClaim('area:data', oneCard, seat1Claim, '@os-b'), newestLaneClaim('area:data', oneCard, seat2Claim, '@os-b')]), J38([null, null, null])); - t('H38 seat (account mark): the finding on an account seat\'s post names its mark', h38row(seat38(acctArea), SEAT_AT_38, claim38(13398, '2026-08-30T07:30:00Z')).includes('(seat @os-b)'), true); + t('H38 seat (account mark): the finding on an account seat\'s post names its mark in a code span — ⛔ never a loose `@login`, which the anchor issue turns into a mention', J38([h38row(seat38(acctArea), SEAT_AT_38, claim38(13398, '2026-08-30T07:30:00Z')).includes('(seat `@os-b`)'), /(? clean', h38SeatPostStale(seat38(seat2Area), SEAT_AT_38, newestLaneClaim('area:data', oneCard, seat1Claim, 2)), null); // -- Lane label aliases — the domain:server merge (maintainer ruling 2026-10-22, letter 乙) -- diff --git a/scripts/pm/post-stamped.mjs b/scripts/pm/post-stamped.mjs index d4aaa252941..d8f056505f8 100644 --- a/scripts/pm/post-stamped.mjs +++ b/scripts/pm/post-stamped.mjs @@ -962,6 +962,7 @@ import { H56_STAMP_TOLERANCE_MIN, ISSUE_BODY_LIMIT, PROXY_FLAG, + SEAT_MARK_SOURCE, claimSeatNumber, contractReviewHeadSha, h56EstimatedStamp, @@ -2680,6 +2681,9 @@ export function decisionFacetRefusalText(rows) { ); } +/** The triage lane's seat key under either seat mark: the lane word, then `check-half-states.mjs`'s `SEAT_MARK_SOURCE`. */ +const TRIAGE_SEAT_KEY = new RegExp(`^triage${SEAT_MARK_SOURCE}$`, 'u'); + /** * A contract-review knock addressed to triage — the route the rule text closes (`references/contract-review.md` * 〈L2 归属与资格〉): a lane that cannot take `CONTRACT_REVIEW_TIER` sends `Request: contract-review` to a seated @@ -2691,11 +2695,14 @@ export function decisionFacetRefusalText(rows) { * `id` and `to` parsed before the template failed, and a malformed knock to triage is still a knock to triage. A * comment the reader refuses outright (no `To:` seat, a key outside the table) names no contract-review knock at * all and passes, as it does today. Comments only. Answers the reading, or null. Pure. + * + * The target is judged by its LANE WORD, before either seat mark (`TRIAGE_SEAT_KEY`): a triage seat named by its + * account (`triage@ACCOUNT`) is triage exactly as `triage#N` is. */ export function triageContractReviewKnock(body) { const knock = readMailboxLine(String(body ?? '')); if ((knock.state !== 'read' && knock.state !== 'unreadable') || knock.id !== 'request:contract-review') return null; - return /^triage#/u.test(knock.to) ? knock : null; + return TRIAGE_SEAT_KEY.test(knock.to) ? knock : null; } /** The refusal a caller reads, from `triageContractReviewKnock`'s reading. */ @@ -4363,7 +4370,7 @@ const SELF_TEST_BATTERIES = Object.freeze({ "the size route: over the relay's body cap under auto THIS write goes direct with one line naming bytes, cap and identity; at or under it the relay; explicit dispatch refuses naming the bytes; nothing else re-routes": 13, 'the signature: every body opens with LANE#N · ACCOUNT · SESSION or is refused, beside the stamp contract; one leading signature changes no reading': 11, 'the one judge: every body refusal on ONE path — `main` and `label-write.mjs --comment-file` call `judgeBody`, never a copy': 11, - 'the review route: a `Request: contract-review` knock addressed to triage is refused; to a review or sibling seat, and every other key to triage, it passes': 10, + 'the review route: a `Request: contract-review` knock addressed to triage is refused; to a review or sibling seat, and every other key to triage, it passes': 13, 'the record tier: a record naming `CONTRACT_REVIEW_TIER` is written only on a transcript `verify-review-tier.mjs` passes; another tier and a non-record comment are untouched': 16, 'the claim stroke: a comment opening `Claim:` is refused on every route but `direct`, pointing at the `label-write` fold; the same body through that fold passes': 21, }); @@ -6010,6 +6017,9 @@ export function selfTest() { t('⭐ …and the refusal names the L2 seat\'s mailbox, the sibling fallback, the owed-review list and the rule\'s home', refused.text.includes('`To: l2-review#N`') && refused.text.includes('`Mailbox:`') && refused.text.includes('sibling lane seat') && refused.text.includes('check-owed-reviews.mjs') && refused.text.includes('references/contract-review.md') && refused.text.includes('Nothing was written')); t('⭐ a MALFORMED knock to triage is refused too — no reason, a bare PR number, a second line: the reader\'s unreadable reading still names the key and the seat', [`Request: contract-review · PR #26766 · head ${HEAD}`, 'Request: contract-review · 26766 · rationed', `Request: contract-review · PR #26766 · head ${HEAD} · rationed\nbecause fable is short today`].every((key) => { const r = judged('triage#1', key); return !r.ok && r.text.includes('`To: triage#1`'); }) && judged('review#1', `Request: contract-review · PR #26766 · head ${HEAD}`).ok); t('a bare `To: triage` reads as `triage#1` (the doorbell reader\'s seat spelling) and is refused the same way', !judged('triage').ok && !judged('Triage#2').ok); + t('⭐ both seat marks: the same knock addressed to a triage seat named by its account (`triage@ACCOUNT`) is refused exactly as `triage#1` is, whatever the case of the account, and the refusal names the seat as addressed', (() => { const r = judged('triage@os-help'); return !r.ok && r.text.startsWith('post-stamped: REFUSED') && r.text.includes('`To: triage@os-help`') && !judged('Triage@OS-Help').ok && !judged('triage#1').ok; })()); + t('⭐ …a MALFORMED knock to it is refused too, and every other key to it passes, as for the numbered seat', !judged('triage@os-help', `Request: contract-review · PR #26766 · head ${HEAD}`).ok && judged('triage@os-help', 'Request: urgent-triage · #26766 · main red on Test Core').ok && judged('triage@os-help', 'Request: triage · #26766 · which lane takes it').ok); + t('⛔ control — the lane word is what is judged, not the mark: an L2 or a sibling lane seat named by its account passes as its numbered seat does, and a lane that only starts with the word is not triage', judged('l2-review@os-bill').ok && judged('review@os-bill').ok && judged('domain:server@os-bill').ok && judged('repo:objectstack@os-help').ok && ['triage#1', 'triage@os-help'].every((to) => triageContractReviewKnock(KNOCK(to))?.to === to) && [KNOCK('l2-review@os-help'), KNOCK('repo:triage@os-help'), KNOCK('repo:triage#1')].every((b) => triageContractReviewKnock(b) === null)); t('⭐ the same knock addressed to an L2 seat passes — under its lane word `l2-review` and under the old spelling `review`', judged('l2-review#1').ok && judged('l2-review#2').ok && judged('review#1').ok && judged('review#2').ok); t('…and to a sibling lane seat, the fallback while no L2 seat is seated', judged('domain:server#2').ok); t('⛔ every other key to triage is untouched: `Request: urgent-triage` and `Request: triage` pass', judged('triage#1', 'Request: urgent-triage · #26766 · main red on Test Core').ok && judged('triage#1', 'Request: triage · #26766 · which lane takes it').ok);