Skip to content

Commit 81182b0

Browse files
committed
feat(pm): a claim's Thread session line lists its card thread on the seat roster
The claim template gains one key, `Thread session:`, paid by deleting the report-contract line that restated the os-dev final report's out_of_scope_findings shape (its home is os-dev.md rule 3 and the JSON shape). record-recognisers reads that key in its one spelling (claimThreadSession) and seatSessionRoster lists the session for the seat that signed the open card's newest, unreleased claim. H72 hands the roster the claimed cards' threads it already caches; a thread not held whole reads unjudged. Claude-Session: https://claude.ai/code/session_01ADHkmSx7z6GRueigx6aDsA Co-authored-by: Claude <noreply@anthropic.com>
1 parent babda9d commit 81182b0

3 files changed

Lines changed: 182 additions & 30 deletions

File tree

‎.claude/skills/pm-dispatch/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,6 @@ PM 的工作是循环:选卡 → 认领 → 派发 → 收集 → L1 审核 →
289289

290290
- 终报 JSON 形状住 `.claude/agents/os-dev.md`,⛔ 不抄第二份;`needs_decision` 时 `open_questions` 非空。
291291
- `premise_still_valid: false` + `pr: null` 是合法终报,当再分诊输入作 L1 审核,永不当失败派发。
292-
- `out_of_scope_findings` 每条 `class: a|b|c`+`reach:`+证据,或 `carrier:`(承接者);皆无 ⇒ Acceptance notes。
293292
- dev 不立卡;ACCEPT 逐条一行 `filed #N`/`Acceptance notes`/`dropped — 因`;三类由席位立在修复仓。
294293
- 席位读 PR `## Acceptance notes`,实属三类的经立卡门补立、归挂;门外已立卡关 not planned。
295294
- 同族发现并入收口卡(一卡覆盖全族位置,带枚举钉子),⛔ 不开单点卡;无则第二次即开。
@@ -312,6 +311,7 @@ PM 的工作是循环:选卡 → 认领 → 派发 → 收集 → L1 审核 →
312311
```text
313312
Claim: PM loop round N
314313
Session: `session_<id>`
314+
Thread session: `session_<id>` (mode:thread only: the card thread's own session, which knocks the seat mailbox as its delegate; omit otherwise)
315315
Account: `<github-login>` (the seat's linked user as `GET /user` answers it; always the card's assignee)
316316
Branch: `claude/issue-<n>-<slug>`
317317
Worktree: `<repo>-issue-<n>`

‎scripts/pm/check-half-states.mjs‎

Lines changed: 57 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15988,11 +15988,15 @@ export function h71UnclaimedOnDutyLane(issue, onDutyLanes, nowMs = Date.now()) {
1598815988
// `knockSignature`): a knock whose signed session the seat it names does not list
1598915989
// reads `unlisted`, and the seat the mailbox serves ⛔ does not act on it
1599015990
// (`untrusted-text.md`). Without this row nobody was told one arrived. The sweep
15991-
// builds the roster ONCE, from the two listings it already holds — the open
15992-
// `pm:seat` posts (`SEEN_LABEL_PAGES`) and the open pulls (H7's) — and hands it
15993-
// to the same `mailboxEvents` call: ⛔ no second signature or roster parser here.
15994-
// A roster that cannot be read — a listing truncated at the page ceiling, which
15995-
// would make a seat whose post sat on an unread page look unlisted — makes every
15991+
// builds the roster ONCE, from the listings it already holds — the open
15992+
// `pm:seat` posts (`SEEN_LABEL_PAGES`), the open pulls (H7's) and the open
15993+
// `pm:dispatched` cards' threads H2's claim read already put in `commentCache`
15994+
// (a card thread its seat's open claim names knocks as that seat's delegate) —
15995+
// and hands it to the same `mailboxEvents` call: ⛔ no second signature or roster
15996+
// parser here, and the claim join buys NOTHING (`commentCache.get`, never a fetch).
15997+
// A roster that cannot be read — a listing truncated at the page ceiling, or a
15998+
// claimed card's thread the cache does not hold whole, which would make a seat
15999+
// whose post sat on an unread page, or its card thread, look unlisted — makes every
1599616000
// knock read `unlisted` by the reader's fail-closed rule; this row reads that as
1599716001
// UNJUDGED, lists nothing, and the summary says NOT MEASURED. A `listed` knock is
1599816002
// a consistency reading inside the fleet's trust root, never proof of who rang,
@@ -16069,8 +16073,8 @@ export function h72OffTableMailboxLines(reading, nowMs = Date.now()) {
1606916073
);
1607016074
}
1607116075

16072-
/** The open listing names `noteOpenListing` records for the two listings the H72 roster is read from. */
16073-
export const H72_ROSTER_LISTINGS = Object.freeze({ posts: 'listIssues(pm:seat)', mailboxes: 'listOpenPullRequests' });
16076+
/** The open listing names `noteOpenListing` records for the listings the H72 roster is read from. */
16077+
export const H72_ROSTER_LISTINGS = Object.freeze({ posts: 'listIssues(pm:seat)', mailboxes: 'listOpenPullRequests', claims: 'listIssues(pm:dispatched)' });
1607416078

1607516079
/**
1607616080
* The two listings the sweep hands `seatSessionRoster` (record-recognisers.mjs): the open `pm:seat` posts and the open
@@ -16079,18 +16083,34 @@ export const H72_ROSTER_LISTINGS = Object.freeze({ posts: 'listIssues(pm:seat)',
1607916083
* array. A partial roster would read a knock from a seat whose post sat on an unread page as `unlisted`: a finding
1608016084
* made up from a page nobody read. So it fails to UNJUDGED, never to a smaller roster. Pure.
1608116085
*
16086+
* The third listing is the open `pm:dispatched` cards, each with its WHOLE thread (`{ card, rows }`): the roster
16087+
* lists the card thread a seat's open claim names (record-recognisers.mjs `claimThreadSession`). The threads are
16088+
* the ones the sweep already holds; ⛔ a card whose thread is missing or not whole (`complete` not true — a first
16089+
* page that came back full may hide the newest claim) makes `claims` null, and so does a truncated
16090+
* `pm:dispatched` listing: a card thread nobody read would read its delegate's knock `unlisted`. Pure.
16091+
*
1608216092
* @param {object[]} issues — the open issue rows the sweep listed (every label page; `pm:seat` rows are kept).
1608316093
* @param {object[]} pulls — the open pull rows the sweep listed.
1608416094
* @param {string[]} [truncated] — the listing names `noteOpenListing` recorded as truncated.
16095+
* @param {Map<number, { rows: object[], complete: boolean }>} [threads] — the comment threads the sweep holds, by card.
1608516096
*/
16086-
export function h72RosterListings(issues, pulls, truncated = []) {
16097+
export function h72RosterListings(issues, pulls, truncated = [], threads = new Map()) {
1608716098
const cut = new Set(Array.isArray(truncated) ? truncated : []);
16099+
const held = (issue) => {
16100+
const thread = threads instanceof Map ? threads.get(issue.number) : undefined;
16101+
return thread?.complete === true && Array.isArray(thread.rows) ? { card: issue, rows: thread.rows } : null;
16102+
};
16103+
const dispatched = Array.isArray(issues)
16104+
? issues.filter((issue) => issue && issue.state === 'open' && labelNames(issue).includes('pm:dispatched'))
16105+
: null;
16106+
const claims = dispatched === null || cut.has(H72_ROSTER_LISTINGS.claims) ? null : dispatched.map(held);
1608816107
return {
1608916108
posts:
1609016109
!Array.isArray(issues) || cut.has(H72_ROSTER_LISTINGS.posts)
1609116110
? null
1609216111
: issues.filter((issue) => labelNames(issue ?? {}).includes('pm:seat')),
1609316112
mailboxes: !Array.isArray(pulls) || cut.has(H72_ROSTER_LISTINGS.mailboxes) ? null : pulls,
16113+
claims: claims === null || claims.includes(null) ? null : claims,
1609416114
};
1609516115
}
1609616116

@@ -16123,8 +16143,9 @@ export function h72UnlistedKnockLines(reading, roster, nowMs = Date.now()) {
1612316143
`\`pm:mailbox\` PR with ${knocks.length} knock(s) in the last ${MAILBOX_OFF_TABLE_WINDOW_HOURS}h whose signed ` +
1612416144
`session the seat it names does not list (\`unlisted\`): ${listed}${more}. Remedy — WHO and HOW: the seat this ` +
1612516145
'mailbox serves ⛔ does not act on an `unlisted` knock (untrusted-text.md), whatever its key says; the seat ' +
16126-
'the signature names rings from a session it lists — its held seat post (`Successor-of:` included) or its open ' +
16127-
'mailbox opening (`node scripts/pm/record-recognisers.mjs --mailbox-keys` prints the rule). A `listed` knock is ' +
16146+
'the signature names rings from a session it lists — its held seat post (`Successor-of:` included), its open ' +
16147+
'mailbox opening, or for a card thread the `Thread session:` line of the seat\'s open claim on that card ' +
16148+
'(`node scripts/pm/record-recognisers.mjs --mailbox-keys` prints the rule). A `listed` knock is ' +
1612816149
'a consistency reading inside the fleet\'s trust root, never proof of who rang, and is not listed here. ' +
1612916150
`⛔ Report-only: nothing is written from this script. Out of scope: a knock older than ` +
1613016151
`${MAILBOX_OFF_TABLE_WINDOW_HOURS}h, a maintainer's knock (not signature-checked), a comment the author fence ` +
@@ -24246,9 +24267,19 @@ async function sweepInto(findings, seen, seenPrs, seenMerged, seenUnscoped, seen
2424624267
stats.mailboxReaderReason = `the doorbell reader did not load (${String(err?.message ?? err).split('\n')[0]})`;
2424724268
}
2424824269
if (reader) {
24249-
// The signature half's roster, ONCE per sweep, off the two listings held
24250-
// above; a truncated one reads `unreadable` and the row goes UNJUDGED.
24251-
const roster = reader.seatSessionRoster(h72RosterListings([...seen.values()], [...seenPrs.values()], stats.openListingsTruncated));
24270+
// The signature half's roster, ONCE per sweep, off the listings held above
24271+
// and the claimed cards' threads H2's claim read cached — `commentCache.get`,
24272+
// ⛔ never a fetch. A thread whose first page came back full is not whole
24273+
// until H50's walk below, so it is not `complete` here; a truncated listing
24274+
// or a thread not held whole reads `unreadable` and the row goes UNJUDGED.
24275+
const claimThreads = new Map();
24276+
for (const issue of seen.values()) {
24277+
if (!labelNames(issue).includes('pm:dispatched')) continue;
24278+
const rows = commentCache.get(issue.number);
24279+
const walk = threadWalks.get(issue.number);
24280+
claimThreads.set(issue.number, { rows, complete: Array.isArray(rows) && (walk ? walk.complete : rows.length < H50_COMMENTS_PAGE_SIZE) });
24281+
}
24282+
const roster = reader.seatSessionRoster(h72RosterListings([...seen.values()], [...seenPrs.values()], stats.openListingsTruncated, claimThreads));
2425224283
if (roster?.state !== 'read') stats.mailboxRosterReason = `the seat roster could not be read (${(roster?.gaps ?? ['no reading']).join(', ')})`;
2425324284
const since = new Date(nowMs - MAILBOX_OFF_TABLE_WINDOW_HOURS * 3_600_000).toISOString();
2425424285
for (const pr of seenPrs.values()) {
@@ -25824,8 +25855,10 @@ export const SELF_TEST_BATTERIES = Object.freeze({
2582425855
// because this self-test cannot import that module (H62's banner). RAISED 20 → 33
2582525856
// with the signature half (#34013): its predicate both ways, the unjudged roster,
2582625857
// the window, the cap, the text, the roster listings and their truncation names,
25827-
// the wiring and the summary clause.
25828-
'H72 mailbox off-table bells': 33,
25858+
// the wiring and the summary clause. RAISED 33 → 37 with the claim listing
25859+
// (#34013 remainder 2): the listing, its unread and truncated cases, its
25860+
// truncation name and the cache-only wiring.
25861+
'H72 mailbox off-table bells': 37,
2582925862
// Registered with the unowned-PR row, pin just under the count: the firing, the assignee/mailbox/closed
2583025863
// exemptions, the unread-label UNJUDGED leg, the text, the band and the wiring.
2583125864
'H76 unowned open PR': 11,
@@ -29196,7 +29229,15 @@ async function selfTest() {
2919629229
b(BATTERY28675, '⭐ H72 roster listings: the open `pm:seat` rows and the open pulls the sweep holds, other cards dropped', (() => { const seat = { number: 1, labels: [{ name: 'pm:seat' }] }; const card = { number: 2, labels: [{ name: 'pm:queue' }] }; const pull = { number: 3 }; const l = h72RosterListings([seat, card, null], [pull]); return l.posts.length === 1 && l.posts[0] === seat && l.mailboxes.length === 1 && l.mailboxes[0] === pull; })(), true);
2919729230
b(BATTERY28675, '⛔ H72 roster listings: a listing truncated at the page ceiling, or not an array, hands the roster NULL — read as unreadable, never as a smaller roster', (() => { const both = h72RosterListings([], [], [H72_ROSTER_LISTINGS.posts, H72_ROSTER_LISTINGS.mailboxes]); const other = h72RosterListings([], [], ['listIssues(pm:queue)']); const bad = h72RosterListings(undefined, 'x'); return both.posts === null && both.mailboxes === null && Array.isArray(other.posts) && Array.isArray(other.mailboxes) && bad.posts === null && bad.mailboxes === null; })(), true);
2919829231
b(BATTERY28675, '⭐ H72 roster listings: the truncation names are the ones the two listings record — `listIssues(pm:seat)` off a label page this sweep lists, `listOpenPullRequests` off the pulls', (() => { const src = SRC72; return SRC72.length > 0 && SEEN_LABEL_PAGES.includes('pm:seat') && src.includes('noteOpenListing(stats, `listIssues(${label})`') && src.includes(`noteOpenListing(stats, '${H72_ROSTER_LISTINGS.mailboxes}'`) && H72_ROSTER_LISTINGS.posts === 'listIssues(pm:seat)'; })(), true);
29199-
b(BATTERY28675, '⭐ H72 wiring: the sweep reads the roster ONCE through the reader\'s `seatSessionRoster`, hands it to the same `mailboxEvents` call both rows judge, and parses no signature or roster of its own', (() => { const src = SRC72; return SRC72.length > 0 && src.includes('reader.seatSessionRoster(h72RosterListings([...seen.values()], [...seenPrs.values()], stats.openListingsTruncated))') && src.includes('const reading = reader.mailboxEvents(rows, roster);') && src.includes('h72OffTableMailboxLines(reading, nowMs)') && src.includes('h72UnlistedKnockLines(reading, roster, nowMs)') && !/function (?:seatSessionRoster|knockSignature|readMailboxComment)\b/u.test(src); })(), true);
29232+
// -- the claim listing (#34013 remainder 2): the open `pm:dispatched` cards with the WHOLE thread the sweep holds;
29233+
// the real reader's join of them is pinned in record-recognisers.mjs's card-thread delegate battery. ----
29234+
const CARD72 = (number, o = {}) => ({ number, state: 'open', labels: [{ name: 'pm:dispatched' }], ...o });
29235+
const HELD72 = (...pairs) => new Map(pairs.map(([n, complete = true]) => [n, { rows: [{ id: n, body: 'Claim: x' }], complete }]));
29236+
b(BATTERY28675, '⭐ H72 claim listing: each open `pm:dispatched` card with the whole thread the sweep holds, as `{ card, rows }` — other labels and a closed row dropped', (() => { const a = CARD72(1); const l = h72RosterListings([a, { number: 2, state: 'open', labels: [{ name: 'pm:queue' }] }, CARD72(3, { state: 'closed' }), null], [], [], HELD72([1])); return Array.isArray(l.claims) && l.claims.length === 1 && l.claims[0].card === a && l.claims[0].rows[0].id === 1; })(), true);
29237+
b(BATTERY28675, '⛔ H72 claim listing: a card whose thread is missing or NOT whole, a truncated `pm:dispatched` listing, or no issue array hands the roster NULL — unread, never a smaller roster', (() => { const cards = [CARD72(1), CARD72(2)]; return [h72RosterListings(cards, [], [], HELD72([1])).claims, h72RosterListings(cards, [], [], HELD72([1], [2, false])).claims, h72RosterListings(cards, [], [H72_ROSTER_LISTINGS.claims], HELD72([1], [2])).claims, h72RosterListings(undefined, []).claims, h72RosterListings(cards, []).claims].every((c) => c === null) && Array.isArray(h72RosterListings(cards, [], [], HELD72([1], [2])).claims) && JSON.stringify(h72RosterListings([], []).claims) === "[]"; })(), true);
29238+
b(BATTERY28675, '⭐ H72 claim listing: the truncation name is the one the `pm:dispatched` label page records, a page this sweep lists', SEEN_LABEL_PAGES.includes('pm:dispatched') && H72_ROSTER_LISTINGS.claims === 'listIssues(pm:dispatched)' && SRC72.includes('noteOpenListing(stats, `listIssues(${label})`'), true);
29239+
b(BATTERY28675, '⭐ H72 claim wiring: the threads come out of `commentCache` — H2\'s claim read, `.get`, never a fetch — and a full first page is whole only once H50\'s walk says so', (() => { const at = SRC72.indexOf('const claimThreads = new Map();'); const block = at < 0 ? '' : SRC72.slice(at, SRC72.indexOf('const roster = reader.seatSessionRoster(', at)); return block.includes('commentCache.get(issue.number)') && block.includes('threadWalks.get(issue.number)') && block.includes('rows.length < H50_COMMENTS_PAGE_SIZE') && !/\brest\(|commentRowsFor|completeCardThread|commentCache\.set/u.test(block); })(), true);
29240+
b(BATTERY28675, '⭐ H72 wiring: the sweep reads the roster ONCE through the reader\'s `seatSessionRoster`, hands it to the same `mailboxEvents` call both rows judge, and parses no signature or roster of its own', (() => { const src = SRC72; return SRC72.length > 0 && src.includes('reader.seatSessionRoster(h72RosterListings([...seen.values()], [...seenPrs.values()], stats.openListingsTruncated, claimThreads))') && src.includes('const reading = reader.mailboxEvents(rows, roster);') && src.includes('h72OffTableMailboxLines(reading, nowMs)') && src.includes('h72UnlistedKnockLines(reading, roster, nowMs)') && !/function (?:seatSessionRoster|knockSignature|readMailboxComment)\b/u.test(src); })(), true);
2920029241
b(BATTERY28675, '⛔ H72 summary: a roster that was not read renders NOT MEASURED for the signature half, a read one says it buys no fetch — and the key rides the forwarding contract', (() => { const no = saidBy('h72Mailbox', summaryLine({ mailboxRead: 1, mailboxCandidates: 1, mailboxRosterReason: 'the seat roster could not be read (x)' }, 0)); const yes = saidBy('h72Mailbox', summaryLine({ mailboxRead: 1, mailboxCandidates: 1 }, 0)); return no.includes('Unlisted knock signatures: NOT MEASURED — the seat roster could not be read (x)') && yes.includes('Unlisted knock signatures: judged on the same pages') && SWEEP_COUNT_KEYS.includes('mailboxRosterReason'); })(), true);
2920129242
b(BATTERY28675, '⭐ H72: the sweep takes the ONE reader and the opener\'s label LAZILY — `mailboxEvents` from record-recognisers.mjs, MAILBOX_LABEL from mailbox-open.mjs — and spells no doorbell key of its own', (() => { const src = readFileSync(fileURLToPath(import.meta.url), 'utf8'); return src.includes("import('./record-recognisers.mjs')") && src.includes("import('./mailbox-open.mjs')") && !/^import [^\n]*from '\.\/(?:record-recognisers|mailbox-open)\.mjs'/mu.test(src) && !src.includes(['MAILBOX_KEYS', '='].join(' ')); })(), true);
2920229243
b(BATTERY28675, 'floor: this battery is DECLARED on the roster, with a positive pin', Object.prototype.hasOwnProperty.call(SELF_TEST_BATTERIES, BATTERY28675) && SELF_TEST_BATTERIES[BATTERY28675] > 0, true);

0 commit comments

Comments
 (0)