diff --git a/.claude/skills/pm-dispatch/references/triage-duties.md b/.claude/skills/pm-dispatch/references/triage-duties.md index 6813d8b45bf..33b18b01930 100644 --- a/.claude/skills/pm-dispatch/references/triage-duties.md +++ b/.claude/skills/pm-dispatch/references/triage-duties.md @@ -13,8 +13,8 @@ - 每日看板与轮次记录列「待维护者」:当前里程碑已清的专题,注小结贴否;读数非门禁。 - 「待维护者」另逐张列 open `needs-user-decision` 与 `pm:awaiting-maintainer` 卡,注入态以来卡龄。 - UTC 3 倍数时的轮次记录报 24h 流量:卡新建/关闭/净增,合并 PR 数,open p1,引 L2 审核新卡数。 -- 析取 ①全裸(无 `pm:*`/`needs-user-decision`/`domain:*`);② `pm:queue` 无 `domain:*`(仅多车道仓); -- ③ `domain:*` 无 pm-state;④ `pm:queue`+`domain:*` 无 `priority:*`;②③④ 只取 `updated_at` 早于 ~2min。 +- 析取 ①全裸(无 `pm:*`/`needs-user-decision`/`area:*`);② `pm:queue` 无 `area:*`(仅多车道仓); +- ③ `area:*` 无 pm-state;④ `pm:queue`+`area:*` 无 `priority:*`;②③④ 只取 `updated_at` 早于 ~2min。 - 排除 `tracking`、`status:parked`、全部 `pm:seat` 贴、`qa-run` 记录。 - 析取 ⑤:窗内新建且 `pm:queue`/`priority:*` 与建卡同分钟,谁打都首触;人定的级只补不改。 - 首触定级与五析取 sweep 每 fire 跑到清空,先于旧卡重验:⛔ 无每轮预算、无逐卡豁免评论。 @@ -64,7 +64,7 @@ - 先修复:正文被 sanitizer 截断的卡不可派发,评论修复指令后跳过。 - 停摆指令判据必须比其它分类更硬(双读取),事后证伪同处公开作废。 - 首触复核 area、type(中继 `issue_patch` 写)、级与 `Source:`(核不出即 `fleet`),错即改并留原值。 -- 维护者或外部人立的卡首触补齐(照 `filing-gate.md`);日对账 fire 扫无 `area:*` 的公开卡补齐。 +- 维护者或外部人立卡首触补齐(照 `filing-gate.md`);日对账扫缺 `area:*` 或 type 的公开卡补齐。 - 预授权 `Feature` 免裁:`Source: topic` 子卡、北极星路行已断言能力、既裁执行、有先例新键。 - 余 `fleet` 源者 ⛔ 不派发、不立决策卡、不自动关;分诊每周列单,维护者挑、并专题或关。 - `Bug` 只修到卡面症状消失、同 PR 文档改成实情并写明未覆盖处;长远序只在其内排形状。 diff --git a/scripts/pm/check-half-states.mjs b/scripts/pm/check-half-states.mjs index a1b55a00b0b..029cc2dad14 100644 --- a/scripts/pm/check-half-states.mjs +++ b/scripts/pm/check-half-states.mjs @@ -217,10 +217,13 @@ * review ACCEPT, so ready = reviewed by construction; a reviewed PR * that left the merge queue (or never entered it) with nobody handling * it would otherwise wait silently forever. Patrol input, not a gate. - * H13 a card carrying `domain:*` with NO pm-state label, aged past one + * H13 a card carrying `area:*` with NO pm-state label, aged past one * sweep cycle — the half-annotated shape the protocol's own * single-label writes produce by design, which the triage sweep's - * disjunct ③ ("有 domain:* 无 pm-state") exists to heal hourly. In that + * disjunct ③ ("`area:*` 无 pm-state") exists to heal hourly. `area:*` is + * the routing label triage's first touch writes; a `domain:*` label + * routes nothing (file ownership is derived from the paths a change + * touches), so a card carrying only one is out of H13's scope. In that * shape the card is invisible to every seat's candidate query (routing * landed, the state machine never did), and it is ALSO invisible to * every label-scoped listing in this sweep — the shape is defined by @@ -3768,8 +3771,9 @@ export function h12OrphanLanding(pr, nowMs = Date.now()) { } // --------------------------------------------------------------------------- -// H13 — domain:* without any pm-state label, aged past one sweep cycle -// (maintainer-reported incident, 2026-08-19). +// H13 — area:* without any pm-state label, aged past one sweep cycle +// (maintainer-reported incident, 2026-08-19; read `domain:*` until the +// area labels replaced it as triage's routing label). // --------------------------------------------------------------------------- /** @@ -3810,7 +3814,7 @@ export const PM_STATE_LABELS = [ export const TRACKING_ANCHOR_LABEL = 'tracking'; /** - * Labels whose NORMAL shape is domain-without-pm-state, excluded by the + * Labels whose NORMAL shape is area-without-pm-state, excluded by the * sweep's own protocol text (SKILL.md, Backlog sweep): flagging them would * report the protocol's design as a defect. */ @@ -3821,14 +3825,14 @@ export const H13_EXEMPT_LABELS = [TRACKING_ANCHOR_LABEL, 'status:parked', 'qa-ru * disjunct ③ heals exactly this shape every round, so a card still in it * after 2h has survived at least one full healing round it should not have — * the alarm reads a failure of the healing loop, never routine intake - * latency (a just-landed domain label sits here only for the sweep's own + * latency (a just-landed area label sits here only for the sweep's own * ~2-minute settle window, two orders of magnitude under the threshold). * Age reads `updated_at`: it needs no timeline fetch, and every healing * write would bump it, so a stale `updated_at` in this shape means nothing * touched the card at all. The measured specimen sat ~26h; at 2h it would * have been flagged a day earlier. */ -export const DOMAIN_HALF_STATE_STALE_HOURS = 2; +export const AREA_HALF_STATE_STALE_HOURS = 2; /** * The prefix H13 stamps on a self-declared-P0 row. Exported because a SECOND @@ -3859,23 +3863,23 @@ export function h13SelfDeclaredP0(issue) { * `updated_at` flags rather than reads as fresh (#4690 direction, same as * H10/H11/H12). */ -export function h13DomainWithoutPmState(issue, nowMs = Date.now()) { +export function h13AreaWithoutPmState(issue, nowMs = Date.now()) { const labels = labelNames(issue); - if (!labels.some((l) => l.startsWith('domain:'))) return null; + if (!labels.some((l) => l.startsWith('area:'))) return null; if (labels.some((l) => PM_STATE_LABELS.includes(l))) return null; if (labels.some((l) => H13_EXEMPT_LABELS.includes(l))) return null; const updated = Date.parse(issue.updated_at ?? ''); const ageHours = Number.isFinite(updated) ? (nowMs - updated) / 3_600_000 : null; - if (ageHours !== null && ageHours <= DOMAIN_HALF_STATE_STALE_HOURS) return null; + if (ageHours !== null && ageHours <= AREA_HALF_STATE_STALE_HOURS) return null; const reading = ageHours === null ? 'an unreadable `updated_at` (which must not read as fresh)' - : `~${Math.round(ageHours)}h without activity (threshold ${DOMAIN_HALF_STATE_STALE_HOURS}h)`; + : `~${Math.round(ageHours)}h without activity (threshold ${AREA_HALF_STATE_STALE_HOURS}h)`; const base = - `\`domain:*\` with no pm-state label and ${reading} — routing landed, the state machine ` + + `\`area:*\` with no pm-state label and ${reading} — routing landed, the state machine ` + `never did, so the card is invisible to every seat's candidate query. A half-state older ` + `than one sweep cycle is a defect of the healing loop (triage sweep disjunct ③), not ` + - `inventory: pair the domain label with its pm-state in one write, oldest first.`; + `inventory: pair the area label with its pm-state in one write, oldest first.`; if (!h13SelfDeclaredP0(issue)) return base; return ( `${P0_SUSPECT_MARKER} the card's own title/body self-declares P0/data-integrity, and for that ` + @@ -4355,7 +4359,7 @@ export function h15OldestUnclaimedBlocking(issues, nowMs = Date.now()) { * overlap, push — and a lane PM's landing window turns over far faster than * that. 2h leaves a normal resolution a full window while catching the * measured incident (~4h unnoticed) at roughly half its life. It matches - * `DOMAIN_HALF_STATE_STALE_HOURS` for the same underlying reason rather than + * `AREA_HALF_STATE_STALE_HOURS` for the same underlying reason rather than * by coincidence: both measure a loop that should already have turned over, * not intake latency. */ @@ -4892,14 +4896,14 @@ function readTrackedFiles() { /** * H18 threshold — one triage-Routine cycle, the same reasoning as - * `DOMAIN_HALF_STATE_STALE_HOURS`: the Routine fires HOURLY and ANSWERS the + * `AREA_HALF_STATE_STALE_HOURS`: the Routine fires HOURLY and ANSWERS the * question on every `pm:retriage` card each fire (SKILL.md, 「`pm:retriage` 每 * fire 先答异议评论所求,答后同笔摘标;须维护者答的进收件箱,标照摘」), so a card * still carrying the label after 2h has survived at least one answer pass it * should not have. Age is read from `updated_at` rather than a per-card * timeline fetch for the label-APPLICATION event: this sweep makes that fetch * for no item (H13's same proxy choice, for the same reason — see - * `h13DomainWithoutPmState`), and every triage write on the card (whatever + * `h13AreaWithoutPmState`), and every triage write on the card (whatever * the answer) bumps `updated_at`, so a stale reading here means nothing * touched the card since any triage pass at all, which is exactly the failure * this item exists to name. @@ -23341,7 +23345,7 @@ async function listRecentDefaultBranchCommits(stats = {}, nowMs = Date.now()) { } /** - * The unscoped listing H13 needs: the domain-without-pm-state shape is + * The unscoped listing H13 needs: the area-without-pm-state shape is * DEFINED by the absence of every label the listings below key on, so no * label page can ever return it — the very property that hides it from seat * queries hides it from a label-scoped sweep too. The same @@ -24582,7 +24586,7 @@ async function sweepInto(findings, seen, seenPrs, seenMerged, seenUnscoped, seen const unscoped = await listAllOpenIssues(stats); for (const issue of unscoped) { seenUnscoped.set(issue.number, issue); - const halfState = h13DomainWithoutPmState(issue); + const halfState = h13AreaWithoutPmState(issue); if (halfState) findings.push([issue, 'H13', halfState]); // H18 — same population: `pm:retriage` can coexist with a label this // sweep's label pages never fetch (e.g. `pm:blocking`) or with none at @@ -25995,7 +25999,7 @@ async function selfTest() { const h10row = (...args) => String(h10StaleUnclaimedP0(...args) ?? ''); const h11row = (...args) => String(h11ImportantParked(...args) ?? ''); const h12row = (...args) => String(h12OrphanLanding(...args) ?? ''); - const h13row = (...args) => String(h13DomainWithoutPmState(...args) ?? ''); + const h13row = (...args) => String(h13AreaWithoutPmState(...args) ?? ''); const h14row = (...args) => String(h14BlockingCacheIncoherent(...args) ?? ''); const h16row = (...args) => String(h16StuckMergeConflict(...args) ?? ''); const h18row = (...args) => String(h18RetriageAged(...args) ?? ''); @@ -27527,76 +27531,81 @@ async function selfTest() { t('H12: missing draft field is out of scope', h12OrphanLanding({ auto_merge: null, updated_at: hoursAgo(50) }, NOW), null); t('H12: merged row is out of scope', h12OrphanLanding({ ...openPr({ updated: hoursAgo(50) }), merged_at: '2026-08-13T10:00:00Z' }, NOW), null); - // -- H13: domain:* without any pm-state label, aged (2026-08-19 incident) -- - const domainCard = (labels, updatedAt, extra = {}) => ({ + // -- H13: area:* without any pm-state label, aged (2026-08-19 incident) -- + const labelledCard = (labels, updatedAt, extra = {}) => ({ ...issue(labels), updated_at: updatedAt, ...extra, }); - t('H13: aged domain card with no pm-state -> finding', typeof h13DomainWithoutPmState(domainCard(['domain:engine-core', 'bug', 'regression'], hoursAgo(26)), NOW), 'string'); - t('H13: …and the finding names the threshold', h13row(domainCard(['domain:engine-core'], hoursAgo(26)), NOW).includes(`${DOMAIN_HALF_STATE_STALE_HOURS}h`), true); - t('H13: …and blames the healing loop, not inventory', h13row(domainCard(['domain:engine-core'], hoursAgo(26)), NOW).includes('healing loop'), true); - t('H13: pm:queue pairs the domain label -> clean', h13DomainWithoutPmState(domainCard(['domain:engine-core', 'pm:queue'], hoursAgo(26)), NOW), null); - t('H13: needs-user-decision is a state (the inbox reads it) -> clean', h13DomainWithoutPmState(domainCard(['domain:spec', 'needs-user-decision'], hoursAgo(200)), NOW), null); - t('H13: finding is a state (the grading round reads it) -> clean', h13DomainWithoutPmState(domainCard(['domain:cli', 'finding'], hoursAgo(200)), NOW), null); + t('H13: aged area card with no pm-state -> finding', typeof h13AreaWithoutPmState(labelledCard(['area:data', 'bug', 'regression'], hoursAgo(26)), NOW), 'string'); + t('H13: …and the finding names the threshold', h13row(labelledCard(['area:data'], hoursAgo(26)), NOW).includes(`${AREA_HALF_STATE_STALE_HOURS}h`), true); + t('H13: …and blames the healing loop, not inventory', h13row(labelledCard(['area:data'], hoursAgo(26)), NOW).includes('healing loop'), true); + t('H13: pm:queue pairs the area label -> clean', h13AreaWithoutPmState(labelledCard(['area:data', 'pm:queue'], hoursAgo(26)), NOW), null); + t('H13: needs-user-decision is a state (the inbox reads it) -> clean', h13AreaWithoutPmState(labelledCard(['area:build', 'needs-user-decision'], hoursAgo(200)), NOW), null); + t('H13: finding is a state (the grading round reads it) -> clean', h13AreaWithoutPmState(labelledCard(['area:package', 'finding'], hoursAgo(200)), NOW), null); // `pm:blocking` is a derived priority cache, not a state — a card carrying // only it is exactly as invisible to candidate queries, so it still flags. - t('H13: pm:blocking alone is NOT a state -> still a finding', typeof h13DomainWithoutPmState(domainCard(['domain:services', 'pm:blocking'], hoursAgo(26)), NOW), 'string'); - t('H13: status:parked exemption (its normal shape IS this one)', h13DomainWithoutPmState(domainCard(['domain:services', 'status:parked'], hoursAgo(200)), NOW), null); - t('H13: tracking exemption', h13DomainWithoutPmState(domainCard(['domain:devx', 'tracking'], hoursAgo(200)), NOW), null); - t('H13: qa-run exemption', h13DomainWithoutPmState(domainCard(['domain:cli', 'qa-run'], hoursAgo(200)), NOW), null); - t('H13: no domain label is out of scope however bare', h13DomainWithoutPmState(domainCard(['bug'], hoursAgo(200)), NOW), null); - t('H13: fresh half-state is intake latency, not a finding', h13DomainWithoutPmState(domainCard(['domain:engine-core'], hoursAgo(1)), NOW), null); - t('H13: exactly at the threshold -> clean (strictly beyond fires)', h13DomainWithoutPmState(domainCard(['domain:engine-core'], hoursAgo(DOMAIN_HALF_STATE_STALE_HOURS)), NOW), null); + t('H13: pm:blocking alone is NOT a state -> still a finding', typeof h13AreaWithoutPmState(labelledCard(['area:workflow', 'pm:blocking'], hoursAgo(26)), NOW), 'string'); + t('H13: status:parked exemption (its normal shape IS this one)', h13AreaWithoutPmState(labelledCard(['area:workflow', 'status:parked'], hoursAgo(200)), NOW), null); + t('H13: tracking exemption', h13AreaWithoutPmState(labelledCard(['area:fleet', 'tracking'], hoursAgo(200)), NOW), null); + t('H13: qa-run exemption', h13AreaWithoutPmState(labelledCard(['area:package', 'qa-run'], hoursAgo(200)), NOW), null); + t('H13: no area label is out of scope however bare', h13AreaWithoutPmState(labelledCard(['bug'], hoursAgo(200)), NOW), null); + // The routing reading moved from `domain:*` to `area:*`: a card carrying + // only the old lane label is unrouted (the sweep's ① owns it), not H13's. + t('H13: ⛔ a domain:* label alone routes nothing -> out of scope', h13AreaWithoutPmState(labelledCard(['domain:skills', 'bug'], hoursAgo(200)), NOW), null); + t('H13: …while the same card with an area:* is the finding', typeof h13AreaWithoutPmState(labelledCard(['domain:skills', 'area:fleet', 'bug'], hoursAgo(200)), NOW), 'string'); + t('H13: the row names area:*', h13row(labelledCard(['area:data'], hoursAgo(26)), NOW).includes('`area:*`'), true); + t('H13: …and never domain:*', h13row(labelledCard(['area:data'], hoursAgo(26)), NOW).includes('domain'), false); + t('H13: fresh half-state is intake latency, not a finding', h13AreaWithoutPmState(labelledCard(['area:data'], hoursAgo(1)), NOW), null); + t('H13: exactly at the threshold -> clean (strictly beyond fires)', h13AreaWithoutPmState(labelledCard(['area:data'], hoursAgo(AREA_HALF_STATE_STALE_HOURS)), NOW), null); // #4690 in miniature, same as H10/H11/H12: unreadable must not read as fresh. - t('H13: unreadable updated_at -> finding, not fresh', typeof h13DomainWithoutPmState(domainCard(['domain:engine-core'], 'not-a-date'), NOW), 'string'); - t('H13: absent updated_at -> finding, not fresh', typeof h13DomainWithoutPmState(domainCard(['domain:engine-core'], undefined), NOW), 'string'); + t('H13: unreadable updated_at -> finding, not fresh', typeof h13AreaWithoutPmState(labelledCard(['area:data'], 'not-a-date'), NOW), 'string'); + t('H13: absent updated_at -> finding, not fresh', typeof h13AreaWithoutPmState(labelledCard(['area:data'], undefined), NOW), 'string'); // The louder line — the measured card carried its trigger in its own body. const p0Body = { body: 'P0 checklist-item failure (data-integrity DELETE regression) — priority label is triage’s to set' }; - t('H13: body self-declaring P0 -> louder line', h13row(domainCard(['domain:engine-core'], hoursAgo(26), p0Body), NOW).includes('P0-SUSPECT'), true); - t('H13: …which prescribes the emergency-triage channel', h13row(domainCard(['domain:engine-core'], hoursAgo(26), p0Body), NOW).includes('emergency-triage'), true); + t('H13: body self-declaring P0 -> louder line', h13row(labelledCard(['area:data'], hoursAgo(26), p0Body), NOW).includes('P0-SUSPECT'), true); + t('H13: …which prescribes the emergency-triage channel', h13row(labelledCard(['area:data'], hoursAgo(26), p0Body), NOW).includes('emergency-triage'), true); t('H13: data-integrity phrasing alone fires the louder line', h13SelfDeclaredP0({ title: '', body: 'a data integrity regression in DELETE' }), true); t('H13: the title is scanned too', h13SelfDeclaredP0({ title: 'p0 suspect: rows vanish', body: '' }), true); // Strip reuse (H7 reading 4): quoting the token in backticks is not a // self-declaration, and `P0` inside a word is not the token. t('H13: P0 only inside backticks is not a self-declaration', h13SelfDeclaredP0({ title: '', body: 'the card quotes `P0` in passing' }), false); t('H13: P0 inside a word does not fire', h13SelfDeclaredP0({ title: '', body: 'the HTTP0 protocol note' }), false); - t('H13: a quiet body stays on the base line', h13row(domainCard(['domain:engine-core'], hoursAgo(26), { body: 'ordinary defect' }), NOW).includes('P0-SUSPECT'), false); + t('H13: a quiet body stays on the base line', h13row(labelledCard(['area:data'], hoursAgo(26), { body: 'ordinary defect' }), NOW).includes('P0-SUSPECT'), false); // -- H18: `pm:retriage` aged past one triage cycle (2026-08-19/20 ruling) -- - // Reuses `domainCard` — a generic (labels, updated_at, extra) issue builder, - // not a domain-specific one despite the name. - t('H18: retriage past the threshold, coexisting pm:queue -> finding', typeof h18RetriageAged(domainCard(['pm:retriage', 'pm:queue'], hoursAgo(3)), NOW), 'string'); - t('H18: …and the finding names the threshold', h18row(domainCard(['pm:retriage', 'pm:queue'], hoursAgo(3)), NOW).includes(`${RETRIAGE_STALE_HOURS}h`), true); - t('H18: …and names the coexisting standing label', h18row(domainCard(['pm:retriage', 'pm:queue'], hoursAgo(3)), NOW).includes('`pm:queue`'), true); - t('H18: multiple coexisting labels are all named', h18row(domainCard(['pm:retriage', 'pm:blocked', 'pm:blocking'], hoursAgo(3)), NOW).includes('`pm:blocked`') && h18row(domainCard(['pm:retriage', 'pm:blocked', 'pm:blocking'], hoursAgo(3)), NOW).includes('`pm:blocking`'), true); + // Reuses `labelledCard` — the generic (labels, updated_at, extra) issue builder. + t('H18: retriage past the threshold, coexisting pm:queue -> finding', typeof h18RetriageAged(labelledCard(['pm:retriage', 'pm:queue'], hoursAgo(3)), NOW), 'string'); + t('H18: …and the finding names the threshold', h18row(labelledCard(['pm:retriage', 'pm:queue'], hoursAgo(3)), NOW).includes(`${RETRIAGE_STALE_HOURS}h`), true); + t('H18: …and names the coexisting standing label', h18row(labelledCard(['pm:retriage', 'pm:queue'], hoursAgo(3)), NOW).includes('`pm:queue`'), true); + t('H18: multiple coexisting labels are all named', h18row(labelledCard(['pm:retriage', 'pm:blocked', 'pm:blocking'], hoursAgo(3)), NOW).includes('`pm:blocked`') && h18row(labelledCard(['pm:retriage', 'pm:blocked', 'pm:blocking'], hoursAgo(3)), NOW).includes('`pm:blocking`'), true); // The label is a QUESTION put to the triage seat, not a request to re-grade // (SKILL.md 「`pm:retriage` 每 fire 先答异议评论所求,答后同笔摘标;须维护者答的进收件箱,标照摘」): // the row says the question is unanswered, and the remedy is to answer what // the objection comment asks and drop the label in the same write. - t('H18: the row reads the label as an unanswered question', h18row(domainCard(['pm:retriage', 'pm:queue'], hoursAgo(3)), NOW).includes('is still unanswered past one triage cycle'), true); - t('H18: …and the remedy is answer + drop the label in the same write', h18row(domainCard(['pm:retriage', 'pm:queue'], hoursAgo(3)), NOW).includes('answer what the comment asks and drop the label in the same write'), true); - t('H18: …and an answer that needs the maintainer still drops the label', h18row(domainCard(['pm:retriage', 'pm:queue'], hoursAgo(3)), NOW).includes('needs the maintainer goes to the inbox with the label still removed'), true); + t('H18: the row reads the label as an unanswered question', h18row(labelledCard(['pm:retriage', 'pm:queue'], hoursAgo(3)), NOW).includes('is still unanswered past one triage cycle'), true); + t('H18: …and the remedy is answer + drop the label in the same write', h18row(labelledCard(['pm:retriage', 'pm:queue'], hoursAgo(3)), NOW).includes('answer what the comment asks and drop the label in the same write'), true); + t('H18: …and an answer that needs the maintainer still drops the label', h18row(labelledCard(['pm:retriage', 'pm:queue'], hoursAgo(3)), NOW).includes('needs the maintainer goes to the inbox with the label still removed'), true); // The retired re-grade vocabulary is gone from BOTH row shapes. - t('H18: no re-grade vocabulary in the coexisting row', /re-judg|grade \(keep or change\)/.test(h18row(domainCard(['pm:retriage', 'pm:queue'], hoursAgo(3)), NOW)), false); - t('H18: …nor in the ALONE row', /re-judg|grade \(keep or change\)/.test(h18row(domainCard(['pm:retriage'], hoursAgo(3)), NOW)), false); + t('H18: no re-grade vocabulary in the coexisting row', /re-judg|grade \(keep or change\)/.test(h18row(labelledCard(['pm:retriage', 'pm:queue'], hoursAgo(3)), NOW)), false); + t('H18: …nor in the ALONE row', /re-judg|grade \(keep or change\)/.test(h18row(labelledCard(['pm:retriage'], hoursAgo(3)), NOW)), false); // Under-threshold: fresh objection is normal intake latency, not a finding. - t('H18: retriage under the threshold -> clean', h18RetriageAged(domainCard(['pm:retriage', 'pm:queue'], hoursAgo(1)), NOW), null); - t('H18: exactly at the threshold -> clean (strictly beyond fires)', h18RetriageAged(domainCard(['pm:retriage', 'pm:queue'], hoursAgo(RETRIAGE_STALE_HOURS)), NOW), null); + t('H18: retriage under the threshold -> clean', h18RetriageAged(labelledCard(['pm:retriage', 'pm:queue'], hoursAgo(1)), NOW), null); + t('H18: exactly at the threshold -> clean (strictly beyond fires)', h18RetriageAged(labelledCard(['pm:retriage', 'pm:queue'], hoursAgo(RETRIAGE_STALE_HOURS)), NOW), null); // No `pm:retriage` label at all is out of scope, however old. - t('H18: no pm:retriage label -> out of scope however old', h18RetriageAged(domainCard(['pm:queue'], hoursAgo(200)), NOW), null); + t('H18: no pm:retriage label -> out of scope however old', h18RetriageAged(labelledCard(['pm:queue'], hoursAgo(200)), NOW), null); // The disputed-target variant: `pm:retriage` alone, no coexisting `pm:*`. - t('H18: retriage ALONE (no coexisting pm:* label) -> finding', typeof h18RetriageAged(domainCard(['pm:retriage'], hoursAgo(3)), NOW), 'string'); - t('H18: …and names the disputed-target note', h18row(domainCard(['pm:retriage'], hoursAgo(3)), NOW).includes('异议对象不明'), true); - t('H18: …and does not claim a coexisting label it does not have', h18row(domainCard(['pm:retriage'], hoursAgo(3)), NOW).includes('alongside its standing'), false); + t('H18: retriage ALONE (no coexisting pm:* label) -> finding', typeof h18RetriageAged(labelledCard(['pm:retriage'], hoursAgo(3)), NOW), 'string'); + t('H18: …and names the disputed-target note', h18row(labelledCard(['pm:retriage'], hoursAgo(3)), NOW).includes('异议对象不明'), true); + t('H18: …and does not claim a coexisting label it does not have', h18row(labelledCard(['pm:retriage'], hoursAgo(3)), NOW).includes('alongside its standing'), false); // A non-`pm:*` label (e.g. `domain:*`) never counts as the coexisting label. - t('H18: a domain: label is not counted as a coexisting pm:* label', h18row(domainCard(['pm:retriage', 'domain:skills'], hoursAgo(3)), NOW).includes('异议对象不明'), true); + t('H18: a domain: label is not counted as a coexisting pm:* label', h18row(labelledCard(['pm:retriage', 'domain:skills'], hoursAgo(3)), NOW).includes('异议对象不明'), true); // #4690 in miniature, same as H10–H13: unreadable must not read as fresh. - t('H18: unreadable updated_at -> finding, not fresh', typeof h18RetriageAged(domainCard(['pm:retriage'], 'not-a-date'), NOW), 'string'); - t('H18: absent updated_at -> finding, not fresh', typeof h18RetriageAged(domainCard(['pm:retriage'], undefined), NOW), 'string'); + t('H18: unreadable updated_at -> finding, not fresh', typeof h18RetriageAged(labelledCard(['pm:retriage'], 'not-a-date'), NOW), 'string'); + t('H18: absent updated_at -> finding, not fresh', typeof h18RetriageAged(labelledCard(['pm:retriage'], undefined), NOW), 'string'); // Report-only, ordinary row in both media — never loud (H14–H16's own // property, and the card's explicit requirement for this item). - t('H18: not a loud finding', isLoudFinding(h18RetriageAged(domainCard(['pm:retriage', 'pm:queue'], hoursAgo(3)), NOW)), false); + t('H18: not a loud finding', isLoudFinding(h18RetriageAged(labelledCard(['pm:retriage', 'pm:queue'], hoursAgo(3)), NOW)), false); // -- H14: `pm:blocking` cache coherence, both directions (2026-08-19) ------ // The fixtures below are REAL lines from the 2026-08-19 census of this board @@ -29117,7 +29126,7 @@ async function selfTest() { // ── ⛔ The three `pm:*` sets stay four different questions ──────────────── t('H63: H13\'s visibility set carries the marker — which is why H13 is silent on a graded carrier', PM_STATE_LABELS.includes(STALE_FINDING_LABEL), true); - t('H63 control: …and H13 really is silent on one, because a pm-state is present', h13DomainWithoutPmState({ ...gradedCarrier(['finding', 'pm:queue', 'domain:skills']), updated_at: daysAgo(9) }, NOW), null); + t('H63 control: …and H13 really is silent on one, because a pm-state is present', h13AreaWithoutPmState({ ...gradedCarrier(['finding', 'pm:queue', 'area:fleet']), updated_at: daysAgo(9) }, NOW), null); t('H63: H22\'s residue set drops the marker — a fine state to close in', PM_RESIDUE_LABELS.includes(STALE_FINDING_LABEL), false); t('H63: H29\'s exclusivity set drops it too — a card KIND, ⛔ not a position', PM_EXCLUSIVE_STATE_LABELS.includes(STALE_FINDING_LABEL), false); t('H63 control: …and H29 stays silent on a carrier with exactly one position', h29PmStateExclusivity(gradedCarrier(['finding', 'pm:queue', 'priority:p3'])), null); @@ -30409,8 +30418,8 @@ async function selfTest() { // The loudness contract between H13 and the renderer — one constant, two // readers. If the prefix ever drifts, this pair fails rather than the alarm // going quietly unsorted. - t('loudness: H13\'s P0 line is recognised by the renderer', isLoudFinding(h13DomainWithoutPmState(domainCard(['domain:engine-core'], hoursAgo(26), p0Body), NOW)), true); - t('loudness: H13\'s base line is not', isLoudFinding(h13DomainWithoutPmState(domainCard(['domain:engine-core'], hoursAgo(26)), NOW)), false); + t('loudness: H13\'s P0 line is recognised by the renderer', isLoudFinding(h13AreaWithoutPmState(labelledCard(['area:data'], hoursAgo(26), p0Body), NOW)), true); + t('loudness: H13\'s base line is not', isLoudFinding(h13AreaWithoutPmState(labelledCard(['area:data'], hoursAgo(26)), NOW)), false); // Fold discipline: loud first, issue-number order within each band. const mixed = renderMarkdown([quietRow, loudRow, finding(100, 'H1', '`pm:dispatched` with no assignee')], counts); @@ -31388,8 +31397,8 @@ async function selfTest() { t('the ruled spelling is pm:-prefixed', AWAITING_MAINTAINER_LABEL, 'pm:awaiting-maintainer'); // The readers the new state joins — each pinned in BOTH directions, so // the vocabulary cannot be half-added (the defect class this family is about). - t('vocabulary: H13 treats awaiting as a real state -> clean', h13DomainWithoutPmState(domainCard(['domain:skills', AWAITING_MAINTAINER_LABEL], hoursAgo(200)), NOW), null); - t('vocabulary: …while the same card without it is still H13', typeof h13DomainWithoutPmState(domainCard(['domain:skills'], hoursAgo(200)), NOW), 'string'); + t('vocabulary: H13 treats awaiting as a real state -> clean', h13AreaWithoutPmState(labelledCard(['area:fleet', AWAITING_MAINTAINER_LABEL], hoursAgo(200)), NOW), null); + t('vocabulary: …while the same card without it is still H13', typeof h13AreaWithoutPmState(labelledCard(['area:fleet'], hoursAgo(200)), NOW), 'string'); t('vocabulary: H22 counts awaiting as residue on a closed card', h22labels(closedCard([AWAITING_MAINTAINER_LABEL])), AWAITING_MAINTAINER_LABEL); t('vocabulary: …and an open card carrying it is not H22 residue', h22ClosedCardPmResidue(queued([AWAITING_MAINTAINER_LABEL])), null); t('vocabulary: H11 sees awaiting as a PARKED state', typeof h11ImportantParked(parkedCard(['bug', AWAITING_MAINTAINER_LABEL]), NOW), 'string'); diff --git a/scripts/pm/first-touch-sweep.mjs b/scripts/pm/first-touch-sweep.mjs index bf4ce2d7336..ba8debf3e4a 100644 --- a/scripts/pm/first-touch-sweep.mjs +++ b/scripts/pm/first-touch-sweep.mjs @@ -32,15 +32,19 @@ * * Excluded from every disjunction first: `tracking`, `status:parked`, every `pm:seat` post, `qa-run` records. * - * ① bare — no `pm:*` label, no `needs-user-decision`, no `domain:*` (other labels, `finding` among them, do not + * ① bare — no `pm:*` label, no `needs-user-decision`, no `area:*` (other labels, `finding` among them, do not * make a card "touched": ① is NOT "no labels"); - * ② `pm:queue` with no `domain:*` — on a multi-lane board only (`MULTI_LANE_REPOS`); - * ③ a `domain:*` with no pm state (`PM_EXCLUSIVE_STATE_LABELS`, `needs-user-decision` included); - * ④ `pm:queue` + `domain:*` with no `priority:*`; + * ② `pm:queue` with no `area:*` — on a multi-lane board only (`MULTI_LANE_REPOS`); + * ③ an `area:*` with no pm state (`PM_EXCLUSIVE_STATE_LABELS`, `needs-user-decision` included); + * ④ `pm:queue` + `area:*` with no `priority:*`; * ⑤ created inside the window (`--since`) and carrying `pm:queue` or a `priority:*` that was applied in the same * minute the card was created — listed whoever applied it; the touch it is owed adds area and type, and a * grade a person set stays (`references/filing-gate.md`: the hand-set grade). * + * `area:*` is the routing reading: the label triage's first touch writes. A `domain:*` label is read by none of the + * five — which files a change owns is derived from the paths it touches, never from a label — so a card carrying only + * a `domain:*` is as unrouted as one carrying nothing. + * * ②③④ take only cards whose `updated_at` is older than `SETTLE_MS` (~2 min): a card being labelled right now is * mid-write, not owed. ⑤ needs a window; without `--since` it is NOT RUN, the verdict is PARTIAL and the exit 4 — * ⛔ never clean, never 0. @@ -48,14 +52,17 @@ * Report-only: ⛔ this file writes nothing. Each hit is a card triage owes a first touch this fire; the order of the * touches (newest first when the sweep clears, oldest first when it does not) is triage's, not this file's. * - * ## The area backstop — a sixth row, daily, and NOT part of the verdict + * ## The area and type backstop — two more rows, daily, and NOT part of the verdict * - * Every public card carries exactly one `area:*`, set at filing or at triage's first touch. The backstop is the - * daily read that catches the card neither reached (`AREA_BACKSTOP_PHRASE`, pinned like the disjunctions): every - * open card of the same walk that carries no `area:*`, with the sweep's own exclusions plus `security` — a security - * card owes no area. It rides the walk already paid for, so it costs no request. ⛔ It is a DAILY duty, not a - * first-touch debt: it is printed after the five rows and never enters the `owed` set, the verdict or the exit code, - * so a board that is mid-backfill does not turn every fire's sweep into FOUND. + * Every public card carries exactly one `area:*` and an issue type, set at filing or at triage's first touch. The + * backstop is the daily read that catches the card neither reached (`AREA_BACKSTOP_PHRASE`, pinned like the + * disjunctions): every open card of the same walk that carries no `area:*`, and every one whose issue type (the REST + * row's `type`) is empty, with the sweep's own exclusions — plus `security` on the area row only: a security card + * owes no area, and nothing excuses a type. It rides the walk already paid for, so it costs no request. + * ⛔ It is a DAILY duty, not a first-touch debt: it is printed after the five rows and never enters the `owed` set, + * the verdict or the exit code. A listed card that IS owed a first touch — bare (①), or queued with no `area:*` (②) — + * is owed through that disjunction already; the two rows add no debt of their own, so old cards still missing a type + * do not turn every fire's sweep into FOUND. * * ## Exit codes — capture them BEFORE any pipe * @@ -92,18 +99,18 @@ export const EXIT_INCOMPLETE = 4; /** Where the five disjunctions are written, and the phrases this file is built from (the self-test pins each). */ export const TRIAGE_RULE_PATH = '.claude/skills/pm-dispatch/references/triage-duties.md'; export const TRIAGE_RULE_PHRASES = Object.freeze([ - '①全裸(无 `pm:*`/`needs-user-decision`/`domain:*`)', - '② `pm:queue` 无 `domain:*`(仅多车道仓)', - '③ `domain:*` 无 pm-state', - '④ `pm:queue`+`domain:*` 无 `priority:*`', + '①全裸(无 `pm:*`/`needs-user-decision`/`area:*`)', + '② `pm:queue` 无 `area:*`(仅多车道仓)', + '③ `area:*` 无 pm-state', + '④ `pm:queue`+`area:*` 无 `priority:*`', '②③④ 只取 `updated_at` 早于 ~2min', '排除 `tracking`、`status:parked`、全部 `pm:seat` 贴、`qa-run` 记录', '析取 ⑤:窗内新建且 `pm:queue`/`priority:*` 与建卡同分钟', '不等 ⇒ 报 `sweep INCOMPLETE`', ]); -/** The daily backstop's sentence in the same rule file (the self-test pins it), and the labels that owe no area. */ -export const AREA_BACKSTOP_PHRASE = '日对账 fire 扫无 `area:*` 的公开卡'; +/** The daily backstop's sentence in the same rule file (the self-test pins it), and how many cards a row prints. */ +export const AREA_BACKSTOP_PHRASE = '日对账扫缺 `area:*` 或 type 的公开卡'; export const AREA_BACKSTOP_LIST_CAP = 30; /** The multi-lane boards (`cross-repo-coordination.md`: 「多车道仓 `objectstack`」); ② runs on these alone. */ @@ -118,10 +125,10 @@ export const PAGE_CEILING = 60; export const EVENT_PAGE_CEILING = 10; export const DISJUNCTIONS = Object.freeze({ - 1: 'bare — no pm:*, no needs-user-decision, no domain:*', - 2: 'pm:queue with no domain:* (multi-lane board)', - 3: 'domain:* with no pm state', - 4: 'pm:queue + domain:* with no priority:*', + 1: 'bare — no pm:*, no needs-user-decision, no area:*', + 2: 'pm:queue with no area:* (multi-lane board)', + 3: 'area:* with no pm state', + 4: 'pm:queue + area:* with no priority:*', 5: 'created in the window with pm:queue / priority:* applied in the creation minute (the touch adds area and type; a grade a person set stays)', }); @@ -141,15 +148,15 @@ export function classify(issue, { repo, nowMs }) { if (labels.some((l) => EXCLUDED_LABELS.includes(l))) return []; const has = (l) => labels.includes(lower(l)); const anyPm = labels.some((l) => l.startsWith('pm:')); - const domain = labels.some((l) => l.startsWith('domain:')); + const area = labels.some((l) => l.startsWith('area:')); const priority = labels.some((l) => l.startsWith('priority:')); const state = PM_EXCLUSIVE_STATE_LABELS.some(has); const settled = Date.parse(issue?.updated_at ?? '') < nowMs - SETTLE_MS; const hits = []; - if (!anyPm && !has(DECISION_INBOX_LABEL) && !domain) hits.push(1); - if (settled && MULTI_LANE_REPOS.includes(lower(repo)) && has('pm:queue') && !domain) hits.push(2); - if (settled && domain && !state) hits.push(3); - if (settled && has('pm:queue') && domain && !priority) hits.push(4); + if (!anyPm && !has(DECISION_INBOX_LABEL) && !area) hits.push(1); + if (settled && MULTI_LANE_REPOS.includes(lower(repo)) && has('pm:queue') && !area) hits.push(2); + if (settled && area && !state) hits.push(3); + if (settled && has('pm:queue') && area && !priority) hits.push(4); return hits; } @@ -163,6 +170,23 @@ export function lacksArea(issue) { return !labels.some((l) => l.startsWith('area:')); } +/** The issue type's name as the REST row carries it (`type.name`; a bare string is read the same), or `null`. Pure. */ +export function issueTypeOf(issue) { + const t = issue?.type; + const name = typeof t === 'string' ? t : t?.name; + return typeof name === 'string' && name.trim() ? name.trim() : null; +} + +/** + * The type backstop: an open card with no issue type. The sweep's exclusions apply; no label excuses a type (the rule + * line scans every public card with none). Pure. + */ +export function lacksType(issue) { + const labels = labelsOf(issue); + if (labels.some((l) => EXCLUDED_LABELS.includes(l))) return false; + return issueTypeOf(issue) === null; +} + /** ⑤'s first half: created at or after the window's start, not excluded, carrying `pm:queue` or a `priority:*`. Pure. */ export function fifthCandidate(issue, { sinceMs }) { if (!Number.isFinite(sinceMs)) return false; @@ -257,7 +281,8 @@ export async function sweep({ repo, nowMs, sinceMs = NaN, get }) { const hits = new Set(Object.values(found).flat().map((i) => i.number)); const noArea = issues.filter(lacksArea); - return { repo, nowMs, sinceMs, pages, enumerated: issues.length, totalCount, complete: why.length === 0, why, found, fifthRun, hits, unjudged, noArea }; + const noType = issues.filter(lacksType); + return { repo, nowMs, sinceMs, pages, enumerated: issues.length, totalCount, complete: why.length === 0, why, found, fifthRun, hits, unjudged, noArea, noType }; } export function renderText(r) { @@ -278,9 +303,12 @@ export function renderText(r) { lines.push(`${marks[d]} ${DISJUNCTIONS[d]}: ${cards.length}`); for (const c of cards) lines.push(` #${c.number} · updated ${String(c.updated_at ?? '').slice(0, 16)}Z · ${String(c.title ?? '').slice(0, 100)}`); } - const bare = (r.noArea ?? []).map((i) => i.number).sort((a, b) => a - b); - const listed = bare.length > AREA_BACKSTOP_LIST_CAP ? `the first ${AREA_BACKSTOP_LIST_CAP} of them (--json lists all)` : 'all of them'; - lines.push(`area backstop (daily, not part of the verdict) — open cards with no area:*: ${bare.length}${bare.length ? ` · ${listed}: ${bare.slice(0, AREA_BACKSTOP_LIST_CAP).map((n) => `#${n}`).join(' ')}` : ''}`); + const backstop = (what, rows) => { + const bare = (rows ?? []).map((i) => i.number).sort((a, b) => a - b); + const listed = bare.length > AREA_BACKSTOP_LIST_CAP ? `the first ${AREA_BACKSTOP_LIST_CAP} of them (--json lists all)` : 'all of them'; + return `${what} backstop (daily, not part of the verdict) — open cards with no ${what}: ${bare.length}${bare.length ? ` · ${listed}: ${bare.slice(0, AREA_BACKSTOP_LIST_CAP).map((n) => `#${n}`).join(' ')}` : ''}`; + }; + lines.push(backstop('area:*', r.noArea), backstop('issue type', r.noType)); lines.push(verdictLine(r)); return lines.join('\n'); } @@ -297,6 +325,7 @@ export function renderJson(r) { disjunctions: { 1: ids(1), 2: ids(2), 3: ids(3), 4: ids(4), 5: ids(5) }, owed: [...r.hits].sort((a, b) => a - b), no_area: (r.noArea ?? []).map((i) => i.number).sort((a, b) => a - b), + no_type: (r.noType ?? []).map((i) => i.number).sort((a, b) => a - b), verdict: verdictLine(r), }; } @@ -402,11 +431,11 @@ function rearmThroughProxy(args) { const SELF_TEST_BATTERIES = Object.freeze({ 'the rule text: every phrase this file is built from is in the file that writes it': 3, - 'the classifier: ①–④ exactly as written — ① is not "no labels", ③ is asked, exclusions first, ②③④ settle': 16, + 'the classifier: ①–④ exactly as written — ① is not "no labels", ③ is asked, exclusions first, ②③④ settle': 18, 'the fifth: created in the window, pm:queue or priority:* applied in the creation minute, whoever applied it — the touch it is owed adds area and type and keeps a grade a person set': 8, 'the walk: every page, pull requests dropped, the count checked — INCOMPLETE on any gap, never clean': 10, 'the CLI: what a typo must never mean, and the exits a patrol reads': 9, - 'the area backstop: an open card with no area:* is listed daily, and never moves the first-touch verdict': 9, + 'the area and type backstop: an open card with no area:* or no issue type is listed daily, and never moves the first-touch verdict': 14, }); const SELF_TEST_BATTERY_FLOOR = 6; const UNATTRIBUTED_BATTERY = '(unattributed)'; @@ -443,26 +472,29 @@ export async function selfTest() { battery('the classifier: ①–④ exactly as written — ① is not "no labels", ③ is asked, exclusions first, ②③④ settle'); t('① a card with no labels', c([]), [1]); - t('⭐ ① a `finding` card with no domain is bare too — ① is NOT "no labels"', c(['finding', 'enhancement']), [1]); + t('⭐ ① a `finding` card with no area is bare too — ① is NOT "no labels"', c(['finding', 'enhancement']), [1]); t('① any pm:* label is a touch', c(['pm:retriage']), []); t('① needs-user-decision is a touch', c(['needs-user-decision']), []); - t('① a domain:* is a touch', c(['domain:skills', 'pm:queue', 'priority:p2']), []); - t('② pm:queue with no domain on the multi-lane board', c(['pm:queue', 'priority:p2']), [2]); + t('① an area:* is a touch', c(['area:fleet', 'pm:queue', 'priority:p2']), []); + t('⭐ ① a domain:* alone is NOT a touch any more — ownership is read from paths, never from a label', c(['domain:skills']), [1]); + t('② pm:queue with no area on the multi-lane board', c(['pm:queue', 'priority:p2']), [2]); + t('⭐ …a domain:* does not stand in for the missing area', c(['domain:skills', 'pm:queue', 'priority:p2']), [2]); t('…not asked on a single-lane board', classify(card(1, ['pm:queue', 'priority:p2']), { repo: 'objectstack-ai/hotcrm', nowMs: NOW }), []); - t('⭐ ③ a domain with no state — the stateless strip this card was filed for', c(['domain:skills', 'priority:p1']), [3]); - t('③ needs-user-decision IS a state', c(['domain:skills', 'needs-user-decision']), []); - t('③ pm:awaiting-maintainer IS a state', c(['domain:skills', 'pm:awaiting-maintainer']), []); - t('④ queued, routed, ungraded', c(['domain:spec', 'pm:queue']), [4]); - t('a routed, graded, queued card is owed nothing', c(['domain:spec', 'pm:queue', 'priority:p3']), []); - t('②③④ wait ~2 min after the last update: a card mid-write is not owed', [c(['domain:skills'], { updated_at: FRESH }), c(['pm:queue'], { updated_at: FRESH })], [[], []]); + t('⭐ ③ an area with no state — the stateless strip', c(['area:fleet', 'priority:p1']), [3]); + t('③ needs-user-decision IS a state', c(['area:fleet', 'needs-user-decision']), []); + t('③ pm:awaiting-maintainer IS a state', c(['area:fleet', 'pm:awaiting-maintainer']), []); + t('④ queued, routed, ungraded', c(['area:data', 'pm:queue']), [4]); + t('a routed, graded, queued card is owed nothing', c(['area:data', 'pm:queue', 'priority:p3']), []); + t('②③④ wait ~2 min after the last update: a card mid-write is not owed', [c(['area:fleet'], { updated_at: FRESH }), c(['pm:queue'], { updated_at: FRESH })], [[], []]); t('…while ① is asked at once', c([], { updated_at: FRESH }), [1]); t('exclusions come first: tracking, status:parked, pm:seat, qa-run', ['tracking', 'status:parked', 'pm:seat', 'qa-run'].map((x) => c([x]).length), [0, 0, 0, 0]); - t('labels compare case-insensitively', c(['Domain:Skills', 'PM:Queue']), [4]); + t('labels compare case-insensitively', c(['Area:Fleet', 'PM:Queue']), [4]); + t('the issue type routes nothing: a typed card with no area is still bare', c(['finding'], { type: { name: 'Bug' } }), [1]); battery('the fifth: created in the window, pm:queue or priority:* applied in the creation minute, whoever applied it — the touch it is owed adds area and type and keeps a grade a person set'); { const SINCE = Date.parse('2026-11-14T20:00:00Z'); - const born = card(9, ['pm:queue', 'domain:ui', 'priority:p2'], { created_at: '2026-11-14T21:10:07Z' }); + const born = card(9, ['pm:queue', 'area:ux', 'priority:p2'], { created_at: '2026-11-14T21:10:07Z' }); t('a card created in the window carrying pm:queue is a candidate', fifthCandidate(born, { sinceMs: SINCE })); t('…one created before the window is not', fifthCandidate({ ...born, created_at: '2026-11-14T19:00:00Z' }, { sinceMs: SINCE }), false); t('…no window, no candidate', fifthCandidate(born, { sinceMs: NaN }), false); @@ -470,12 +502,12 @@ export async function selfTest() { t('⭐ pm:queue applied in the creation minute is ⑤, whoever applied it', sameMinuteLabelled(born, [{ event: 'labeled', label: { name: 'pm:queue' }, created_at: '2026-11-14T21:10:59Z', actor: { login: 'objectstack-fleet[bot]' } }])); t('⭐ …a person\'s hand in the creation minute is ⑤ as well: the card is listed for area and type, and the sweep says the grade stays', [sameMinuteLabelled(born, [{ event: 'labeled', label: { name: 'priority:p2' }, created_at: '2026-11-14T21:10:30Z', actor: { login: 'os-warren', type: 'User' }, performed_via_github_app: null }]), DISJUNCTIONS[5].includes('a grade a person set stays')], [true, true]); t('…a priority applied a minute later is a touch, not ⑤', sameMinuteLabelled(born, [{ event: 'labeled', label: { name: 'priority:p2' }, created_at: '2026-11-14T21:11:00Z' }]), false); - t('…another label in the minute is not ⑤', sameMinuteLabelled(born, [{ event: 'labeled', label: { name: 'domain:ui' }, created_at: '2026-11-14T21:10:08Z' }]), false); + t('…another label in the minute is not ⑤', sameMinuteLabelled(born, [{ event: 'labeled', label: { name: 'area:ux' }, created_at: '2026-11-14T21:10:08Z' }]), false); } battery('the walk: every page, pull requests dropped, the count checked — INCOMPLETE on any gap, never clean'); { - const page = (n, from) => Array.from({ length: n }, (_, k) => card(from + k, ['domain:server', 'pm:queue', 'priority:p2'])); + const page = (n, from) => Array.from({ length: n }, (_, k) => card(from + k, ['area:data', 'pm:queue', 'priority:p2'])); const board = (pages, total, extra = {}) => { const seen = []; const get = async (path) => { @@ -488,7 +520,7 @@ export async function selfTest() { }; return { get, seen }; }; - const two = [page(100, 1), [...page(30, 101), { number: 999, pull_request: {}, labels: [] }, card(500, ['domain:skills'])]]; + const two = [page(100, 1), [...page(30, 101), { number: 999, pull_request: {}, labels: [] }, card(500, ['area:fleet'])]]; const ok = board(two, 131); const r = await sweep({ repo: REPO, nowMs: NOW, get: ok.get }); t('every page is read until a short one', r.pages, 2); @@ -504,26 +536,32 @@ export async function selfTest() { const refused = await sweep({ repo: REPO, nowMs: NOW, get: async () => ({ status: 403, json: { message: 'nope' } }) }); t('a refused page is a prerequisite, never a verdict', typeof refused.prerequisite, 'string'); const SINCE = Date.parse('2026-11-14T20:00:00Z'); - const born = card(77, ['pm:queue', 'domain:ui', 'priority:p2'], { created_at: '2026-11-14T21:10:07Z' }); + const born = card(77, ['pm:queue', 'area:ux', 'priority:p2'], { created_at: '2026-11-14T21:10:07Z' }); const fifth = board([[born]], 1, { [`/repos/${REPO}/issues/77/events?per_page=100&page=1`]: { status: 500, json: null } }); const unread = await sweep({ repo: REPO, nowMs: NOW, sinceMs: SINCE, get: fifth.get }); t('⭐ a ⑤ card whose events cannot be read is UNJUDGED and the run INCOMPLETE', [unread.complete, unread.unjudged], [false, [77]]); } - battery('the area backstop: an open card with no area:* is listed daily, and never moves the first-touch verdict'); + battery('the area and type backstop: an open card with no area:* or no issue type is listed daily, and never moves the first-touch verdict'); { + const BUG = { type: { name: 'Bug' } }; t('the backstop sentence is a substring of triage-duties.md (a reworded rule reds here)', readFileSync(new URL(TRIAGE_RULE_PATH, REPO_ROOT), 'utf8').includes(AREA_BACKSTOP_PHRASE)); - t('a routed, graded, queued card with no area:* is listed', lacksArea(card(1, ['domain:spec', 'pm:queue', 'priority:p2']))); - t('…and the same card carrying one is not', lacksArea(card(1, ['domain:spec', 'pm:queue', 'priority:p2', 'area:data'])), false); + t('a graded, queued card with no area:* is listed', lacksArea(card(1, ['pm:queue', 'priority:p2']))); + t('…and the same card carrying one is not', lacksArea(card(1, ['pm:queue', 'priority:p2', 'area:data'])), false); + t('⛔ a domain:* is no area', lacksArea(card(1, ['domain:spec', 'pm:queue', 'priority:p2']))); t('the label compares case-insensitively', lacksArea(card(1, ['Area:UX'])), false); t('⛔ a security card owes no area', lacksArea(card(1, ['security', 'pm:queue'])), false); t('the sweep\'s exclusions apply here too: tracking, status:parked, pm:seat, qa-run', ['tracking', 'status:parked', 'pm:seat', 'qa-run'].map((x) => lacksArea(card(1, [x]))), [false, false, false, false]); - const rows = [card(41, ['domain:spec', 'pm:queue', 'priority:p2', 'area:build']), card(42, ['domain:spec', 'pm:queue', 'priority:p2']), card(43, ['security', 'domain:server', 'pm:queue', 'priority:p1'])]; - const get = async (p) => (p.startsWith('/search') ? { status: 200, json: { total_count: 3, incomplete_results: false } } : { status: 200, json: p.endsWith('page=1') ? rows : [] }); + t('the type is read from the REST row\'s `type.name`', [issueTypeOf(card(1, [], BUG)), issueTypeOf(card(1, [], { type: 'Task' })), issueTypeOf(card(1, [])), issueTypeOf(card(1, [], { type: { name: ' ' } }))], ['Bug', 'Task', null, null]); + t('⭐ an area-routed card with no issue type is listed for its type', [lacksArea(card(1, ['area:data', 'pm:queue'])), lacksType(card(1, ['area:data', 'pm:queue']))], [false, true]); + t('…and the same card carrying one is not', lacksType(card(1, ['area:data', 'pm:queue'], BUG)), false); + t('the exclusions apply to the type row too', ['tracking', 'status:parked', 'pm:seat', 'qa-run'].map((x) => lacksType(card(1, [x]))), [false, false, false, false]); + const rows = [card(41, ['pm:queue', 'priority:p2', 'area:build'], BUG), card(42, ['domain:spec', 'pm:queue', 'priority:p2'], BUG), card(43, ['security', 'pm:dispatched', 'priority:p1']), card(44, ['pm:queue', 'priority:p2', 'area:data'])]; + const get = async (p) => (p.startsWith('/search') ? { status: 200, json: { total_count: 4, incomplete_results: false } } : { status: 200, json: p.endsWith('page=1') ? rows : [] }); const r = await sweep({ repo: REPO, nowMs: NOW, sinceMs: Date.parse('2026-11-14T20:00:00Z'), get }); - t('the walk lists exactly the card with no area', [r.noArea.map((i) => i.number), renderJson(r).no_area], [[42], [42]]); - t('⭐ …and it is NOT a first-touch debt: nothing is owed and the verdict is CLEAN', [[...r.hits], verdictLine(r), sweepExit(r)], [[], 'sweep CLEAN — no card owed a first touch', EXIT_OK]); - t('the text names the count and the card, after the five rows and before the verdict', renderText(r).split('\n').slice(-2)[0], 'area backstop (daily, not part of the verdict) — open cards with no area:*: 1 · all of them: #42'); + t('the walk lists exactly the card with no area and exactly the cards with no type — a security card among them', [r.noArea.map((i) => i.number), renderJson(r).no_area, r.noType.map((i) => i.number), renderJson(r).no_type], [[42], [42], [43, 44], [43, 44]]); + t('⭐ …and neither is a first-touch debt beyond ②: only the domain-only card is owed, and the verdict counts it alone', [[...r.hits], verdictLine(r), sweepExit(r)], [[42], 'sweep FOUND 1 card(s) owed a first touch', EXIT_OK]); + t('the text names each count and card, after the five rows and before the verdict', renderText(r).split('\n').slice(-3, -1), ['area:* backstop (daily, not part of the verdict) — open cards with no area:*: 1 · all of them: #42', 'issue type backstop (daily, not part of the verdict) — open cards with no issue type: 2 · all of them: #43 #44']); } battery('the CLI: what a typo must never mean, and the exits a patrol reads');