Skip to content

Commit 7b9e229

Browse files
feat(pm): first-touch-sweep lists a card whose area:* is not exactly one North Star area (#36378)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbCxiFE11rsKwyNffJZKYqJs)_ Fixes #36220 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户无感:分诊每轮的首触扫描多出一行,列出领域标签不在北极星八个领域之内、或同时挂了两个领域的公开卡,并算进“待首触”的总数。 - 属于车队工具;替分诊和按领域取卡的席位解决领域统计被拆成多行、卡片漏派给负责该领域的席位的问题。 - 出错时只是分诊多看或少看几张卡;这次改动只读看板、不写任何东西,可以直接撤回。 - 无 ## What changes `scripts/pm/first-touch-sweep.mjs` gains one row, the **area list**, and it counts in the verdict: - The area labels are **read** from `docs/NORTH-STAR.md`'s *Product areas* table on every run (`northStarAreas`): the table opens at the line starting `| Area |`, ends at the first non-row line, and a row whose first cell opens with a backticked `area:` label names one (the Security row carries none). No area name is spelled in the code; the self-test asserts the code above it spells no area label at all. - `offListArea` lists every settled open card whose `area:*` set is non-empty and is not exactly one of those labels: a retired label (`area:studio`), two areas, or both. Same exclusions as every other row, plus `security` (a security card carries no area by rule), plus the ~2 min settle (a relabel is two writes). A card with no `area:*` stays on rows one and two and on the area backstop, not here. - Those cards join the `owed` set. The verdict names them: `sweep FOUND n card(s) owed a first touch — k of them off the North Star area list`. A sweep is CLEAN only when this row is empty too. Exit codes keep their meaning (0 = a whole sweep). - The text output prints the row, with each card's area labels, after the five disjunctions and before the two backstops. `--json` adds `north_star_areas` (the list read) and `off_list_area`. - A North Star the checkout cannot read, or one with no readable area table, is `PREREQUISITE NOT MET` (exit 3). A broken table never turns into a row that passes every card. - The row is asked only on `objectstack-ai/objectstack`. The North Star says cloud "follows these rules with its own areas", and the self-test pins that sentence. On any other board the row prints `not asked` and the file is not read. Not built: retiring the legacy labels from the repository (the card's optional item). That is the maintainer's call. **Read first** (riskiest first): 1. `sweep()`: the North Star read at the top (a prerequisite return before any page is walked), and `offList` joining `hits`. This is the one place the new row changes the verdict. 2. `northStarAreas()`: the table boundary (first line starting `| Area |`, stops at the first line not starting with a pipe). If the North Star's table moves or is reshaped, this is what breaks loudly. 3. `verdictLine()`: the PARTIAL and FOUND strings. Nothing else in the repo parses them (`git grep` for the verdict prefixes outside this file: no hit). **Two-minute verification:** `node scripts/pm/first-touch-sweep.mjs --self-test` should print `✓ first-touch-sweep self-test: 85 cases pass across 7 batteries — offline, no network.` ## Tests <details><summary>Self-test (0bdb095)</summary> ``` $ node scripts/pm/first-touch-sweep.mjs --self-test ✓ first-touch-sweep self-test: 85 cases pass across 7 batteries — offline, no network. exit 0 (base 3a81fb7: 69 cases across 6 batteries) ``` The new battery pins the card's three cases against the real `docs/NORTH-STAR.md` table: a legacy-area card (`area:studio`, asserted absent from the list read), a two-area card (the first two labels read) and a one-area clean control (the first label read). The result is `offList` = the first two cards, the verdict `sweep FOUND 2 card(s) owed a first touch — 2 of them off the North Star area list`, and exit 0. It also pins the synthetic-table parse, the three parse refusals, the exclusions, security and settle, the not-asked board, and both prerequisite paths. </details> <details><summary>Importer self-test: fleet-roster (imports sweep())</summary> ``` $ node scripts/pm/fleet-roster.mjs --self-test ✓ fleet-roster self-test: 150 cases in 12 batteries pass. exit 0 ``` </details> <details><summary>Live read-only run (0bdb095)</summary> ``` $ node scripts/pm/first-touch-sweep.mjs --since=2026-11-22T00:00:00Z first-touch-sweep — objectstack-ai/objectstack · now 2026-11-22T08:37Z · window since 2026-11-22T00:00Z enumerated 473 open issue(s) over 6 page(s) · the platform counts 473 ① bare — no pm:*, no needs-user-decision, no area:*: 1 ② pm:queue with no area:* (multi-lane board): 3 ③ area:* with no pm state: 7 ④ pm:queue + area:* with no priority:*: 0 ⑤ 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): 66 area list (docs/NORTH-STAR.md: 8 areas) — an area:* set that is not exactly one of the North Star areas: 0 area:* backstop (daily, not part of the verdict) — open cards with no area:*: 4 · all of them: #36355 #36361 #36369 #36375 issue type backstop (daily, not part of the verdict) — open cards with no issue type: 18 · all of them: #36353 #36355 #36356 #36360 #36361 #36362 #36363 #36364 #36365 #36366 #36367 #36369 #36370 #36371 #36372 #36373 #36374 #36375 sweep FOUND 68 card(s) owed a first touch exit 0 ``` The board shows 0 off-list cards today because the 46 the card measured were relabelled by hand earlier on 2026-11-22. So the live run proves the read and the row's wiring, and the self-test proves that a positive is found. The cloud board answers HTTP 403 to this container's token at both base and head (exit 3, before the new code runs), so its `not asked` path is proven by the self-test only. </details> ## Acceptance notes - **Boundary, by design:** the row takes the sweep's exclusions (`tracking`, `status:parked`, `pm:seat`, `qa-run`, `eval-run`) like every other row. So a `tracking` coordination parent that carries a retired area is not listed. Widening that is a one-line change if the seat wants it. - **The sweep's self-test is not run by CI.** No root `package.json` alias and no workflow step runs `first-touch-sweep.mjs --self-test`. `check-self-test-wired` does not see the script because CI never runs the script itself. So this pin, like the 69 cases before it, guards only a hand run. This was already true before this PR. Wiring it is a `package.json` alias plus a `lint.yml` step, outside this claim's file surface, so it is reported to the seat and not done here. - No `.claude/**` text changed. The North Star's one-area sentence and triage's existing first-touch duty to re-check the area already require this row. `triage-duties.md` still says "five disjunctions" and is not wrong: this is a sixth printed row, not a sixth disjunction of that rule. - `skip-changeset`: `scripts/pm/**` publishes nothing. ## Verification <details><summary>Targeted gates (dispatch-gates --commands, reconciled with --ran), 0bdb095</summary> ``` head 0bdb095 (branch tip b75c0a7 + merge of origin/main 3faabd2; the derivation is byte-identical before and after the merge) dispatch-gates --ran: 63 derived famil(ies) accounted for — 62 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3). 61 of 63 exit 0. exit 1 node scripts/check-self-test-workflow-commands.mjs — REFUSED: scripts/check-adr-0087-registration.mjs --self-test could not be run: spawnSync node ETIMEDOUT (its 120 s spawn cap vs a shared box at load ~12; that self-test run directly took 1m49s and exited 0; the file is untouched by this diff). NOT MEASURED locally, CI owns it. exit 3 pnpm check:i18n-coverage — PREREQUISITE NOT MET: the workspace CLI is not built (a 15-package build closure; nothing in this diff is in its population). NOT MEASURED locally, CI owns it. Re-run on 0bdb095 after the merge: first-touch-sweep --self-test 0 · fleet-roster --self-test 0 · check-skills-token-ratchet 0 · check:nul-bytes 0 · check:ratchet-remedy-authority 0 · check:commit-card-trailers 0 Outside the derivation, run: first-touch-sweep.mjs --self-test (the edited script), fleet-roster.mjs --self-test (its one importer). ``` </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- signed: repo:objectstack#7 · zhuangjianguo · session_01QsR2jTeURPvEm465RcoYEC --> Co-authored-by: Claude <noreply@anthropic.com>
1 parent cb5a975 commit 7b9e229

1 file changed

Lines changed: 139 additions & 9 deletions

File tree

‎scripts/pm/first-touch-sweep.mjs‎

Lines changed: 139 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
* ceiling with a full last page is INCOMPLETE too.
2828
* 3. for ⑤ only, each candidate's label events (`GET /repos/{repo}/issues/{n}/events`, every page); a card whose
2929
* events cannot be read is UNJUDGED, which makes the run INCOMPLETE.
30+
* 4. on a board `docs/NORTH-STAR.md` governs, that file from this checkout: its area table is the area list.
3031
*
3132
* ## The five disjunctions — the rule text's, nothing narrower
3233
*
@@ -67,11 +68,28 @@
6768
* is owed through that disjunction already; the two rows add no debt of their own, so old cards still missing a type
6869
* do not turn every fire's sweep into FOUND.
6970
*
71+
* ## The North Star area list — one more row, and IN the verdict
72+
*
73+
* `docs/NORTH-STAR.md` (`NORTH_STAR_PATH`) says every public card carries exactly one `area:*`
74+
* (`NORTH_STAR_AREA_RULE`), from the labels its *Product areas* table names. ①–④ and the area backstop ask only
75+
* whether a card has AN `area:*`, so a card filed with a retired label (`area:studio`) or with two areas passed every
76+
* row as touched, and triage's own first touch accepted it. This row lists every open card whose `area:*` set is
77+
* non-empty and is not exactly one of the table's labels. The labels are READ from that table on every run
78+
* (`northStarAreas`) — ⛔ never copied here — so a ninth area, or a renamed one, needs no edit to this file; a
79+
* table this file cannot read is PREREQUISITE NOT MET (exit 3), never a row that silently passes everything.
80+
*
81+
* It is a first-touch debt (triage-duties.md: the first touch re-checks the area and corrects it), so its cards join
82+
* the `owed` set and the verdict names how many of them it found; the exit code keeps its meaning (0 = a whole sweep).
83+
* It takes the sweep's exclusions, `security` (a security card carries no area at all) and the ~2 min settle (a
84+
* relabel is two writes, and the card carries both labels in between). A card with no `area:*` is not on it: that
85+
* card is ①/② and the area backstop's. Asked only on the boards this North Star governs (`NORTH_STAR_REPOS`): cloud
86+
* follows the same rule with its own areas (`NORTH_STAR_OTHER_REPOS_PHRASE`), which this table does not list.
87+
*
7088
* ## Exit codes — capture them BEFORE any pipe
7189
*
7290
* 0 the walk is complete and all five ran; the lines say what each disjunction found (zero or more)
7391
* 2 usage
74-
* 3 PREREQUISITE NOT MET — a read refused or unanswered
92+
* 3 PREREQUISITE NOT MET — a read refused or unanswered, or the North Star area table unreadable
7593
* 4 not a whole sweep: INCOMPLETE — the walk's count is not the platform's, a page ceiling was hit, or a ⑤ card
7694
* went unread — or PARTIAL — no `--since`, so ⑤ did not run
7795
*
@@ -125,6 +143,17 @@ export const MULTI_LANE_REPOS = Object.freeze(['objectstack-ai/objectstack']);
125143
export const MULTI_LANE_RULE_PATH = '.claude/skills/pm-dispatch/references/cross-repo-coordination.md';
126144
export const MULTI_LANE_RULE = '多车道仓 `objectstack`';
127145

146+
/**
147+
* The North Star's area table: where the labels live, the sentence that makes them the only ones (the self-test pins
148+
* both), the boards it governs, and the sentence that leaves cloud's areas to cloud. The labels themselves are read.
149+
*/
150+
export const NORTH_STAR_PATH = 'docs/NORTH-STAR.md';
151+
export const NORTH_STAR_AREA_RULE = 'every public card carries exactly one `area:*` label';
152+
export const NORTH_STAR_TABLE_HEADER = '| Area |';
153+
export const NORTH_STAR_REPOS = Object.freeze(['objectstack-ai/objectstack']);
154+
export const NORTH_STAR_OTHER_REPOS_PHRASE = 'The cloud repository follows these rules with its own areas';
155+
export const AREA_LIST_ROW = 'an area:* set that is not exactly one of the North Star areas';
156+
128157
export const EXCLUDED_LABELS = Object.freeze(['tracking', 'status:parked', 'pm:seat', ...RUN_RECORD_LABELS]);
129158
export const SETTLE_MS = 2 * 60 * 1000;
130159
export const PAGE_SIZE = 100;
@@ -179,6 +208,46 @@ export function lacksArea(issue) {
179208
return !labels.some((l) => l.startsWith('area:'));
180209
}
181210

211+
/**
212+
* The `area:*` labels of the North Star's *Product areas* table, in table order: the table opens at the line that
213+
* starts `NORTH_STAR_TABLE_HEADER` and ends at the first line that is not a table row; a row whose first cell opens
214+
* with a backticked `area:*` names one, and a row without one (Security carries no label) names none. Pure.
215+
* Answers `{ ok: true, areas }` or `{ ok: false, error }` — no table, no labelled row, or a label named twice.
216+
*/
217+
export function northStarAreas(text) {
218+
const lines = String(text ?? '').split('\n');
219+
const start = lines.findIndex((l) => l.startsWith(NORTH_STAR_TABLE_HEADER));
220+
if (start < 0) return { ok: false, error: `${NORTH_STAR_PATH} has no line starting \`${NORTH_STAR_TABLE_HEADER}\` (the Product areas table)` };
221+
const areas = [];
222+
for (const line of lines.slice(start + 1)) {
223+
if (!line.startsWith('|')) break;
224+
const m = /^\|\s*`(area:[^`\s]+)`/i.exec(line);
225+
if (!m) continue;
226+
const name = lower(m[1]);
227+
if (areas.includes(name)) return { ok: false, error: `${NORTH_STAR_PATH}'s area table names \`${name}\` twice` };
228+
areas.push(name);
229+
}
230+
if (!areas.length) return { ok: false, error: `${NORTH_STAR_PATH}'s area table names no \`area:*\` label` };
231+
return { ok: true, areas: Object.freeze(areas) };
232+
}
233+
234+
/** An open card's `area:*` labels, lower-cased, in the order the row carries them. Pure. */
235+
export const areasOf = (issue) => labelsOf(issue).filter((l) => l.startsWith('area:'));
236+
237+
/**
238+
* The area-list row: a settled open card whose `area:*` set is non-empty and is not exactly one of `areas` — a
239+
* retired label, two areas, or both. The sweep's exclusions apply, and a `security` card carries no area by rule.
240+
* A card with no `area:*` is not this row's (①/② and the area backstop list it). Pure.
241+
*/
242+
export function offListArea(issue, { areas, nowMs }) {
243+
const labels = labelsOf(issue);
244+
if (labels.some((l) => EXCLUDED_LABELS.includes(l) || l === 'security')) return false;
245+
if (!(Date.parse(issue?.updated_at ?? '') < nowMs - SETTLE_MS)) return false;
246+
const own = areasOf(issue);
247+
if (own.length === 0) return false;
248+
return !(own.length === 1 && areas.includes(own[0]));
249+
}
250+
182251
/** The issue type's name as the REST row carries it (`type.name`; a bare string is read the same), or `null`. Pure. */
183252
export function issueTypeOf(issue) {
184253
const t = issue?.type;
@@ -218,11 +287,13 @@ export function sameMinuteLabelled(issue, events) {
218287
}
219288

220289
/** The verdict line, from the counts. Pure. */
221-
export function verdictLine({ complete, why = [], hits, fifthRun }) {
290+
export function verdictLine({ complete, why = [], hits, fifthRun, offListRun = false, offList = [] }) {
222291
if (!complete) return `sweep INCOMPLETE — ${why.join('; ')}. ⛔ Not a clean sweep: re-run when the reads answer.`;
223292
const n = hits.size;
224-
if (!fifthRun) return `sweep PARTIAL — ⑤ NOT RUN: no --since window; ①–④ found ${n} card(s) owed a first touch. ⛔ Not a clean sweep: re-run with --since=ISO.`;
225-
return n === 0 ? 'sweep CLEAN — no card owed a first touch' : `sweep FOUND ${n} card(s) owed a first touch`;
293+
const k = offList.length;
294+
const ofThem = k ? ` — ${k} of them off the North Star area list` : '';
295+
if (!fifthRun) return `sweep PARTIAL — ⑤ NOT RUN: no --since window; ①–④${offListRun ? ' and the area list' : ''} found ${n} card(s) owed a first touch${ofThem}. ⛔ Not a clean sweep: re-run with --since=ISO.`;
296+
return n === 0 ? 'sweep CLEAN — no card owed a first touch' : `sweep FOUND ${n} card(s) owed a first touch${ofThem}`;
226297
}
227298

228299
/** The exit a patrol reads: 0 only for a complete walk on which all five ran. Pure. */
@@ -234,11 +305,27 @@ export function sweepExit({ complete, fifthRun }) {
234305
// The walk — `get` is injected so the self-test drives every branch
235306
// ---------------------------------------------------------------------------
236307

308+
/** The North Star as this checkout carries it; `sweep` takes another reader so the self-test drives each answer. */
309+
export const readNorthStarFile = () => readFileSync(new URL(NORTH_STAR_PATH, REPO_ROOT), 'utf8');
310+
237311
/**
238312
* The sweep. `get(path)` answers `{ status, json }`. Returns the report object; never throws on a platform answer.
239313
*/
240-
export async function sweep({ repo, nowMs, sinceMs = NaN, get }) {
314+
export async function sweep({ repo, nowMs, sinceMs = NaN, get, readNorthStar = readNorthStarFile }) {
241315
const why = [];
316+
const offListRun = NORTH_STAR_REPOS.includes(lower(repo));
317+
let areas = null;
318+
if (offListRun) {
319+
let text;
320+
try {
321+
text = readNorthStar();
322+
} catch (e) {
323+
return { prerequisite: `${NORTH_STAR_PATH} could not be read (${e?.message ?? 'read threw'}), so the area list is unknown` };
324+
}
325+
const parsed = northStarAreas(text);
326+
if (!parsed.ok) return { prerequisite: `${parsed.error}, so the area list is unknown` };
327+
areas = parsed.areas;
328+
}
242329
const issues = [];
243330
let pages = 0;
244331
let exhausted = false;
@@ -289,10 +376,11 @@ export async function sweep({ repo, nowMs, sinceMs = NaN, get }) {
289376
if (unjudged.length) why.push(`⑤ could not read the label events of ${unjudged.map((n) => `#${n}`).join(', ')}`);
290377
}
291378

292-
const hits = new Set(Object.values(found).flat().map((i) => i.number));
379+
const offList = offListRun ? issues.filter((i) => offListArea(i, { areas, nowMs })) : [];
380+
const hits = new Set([...Object.values(found).flat(), ...offList].map((i) => i.number));
293381
const noArea = issues.filter(lacksArea);
294382
const noType = issues.filter(lacksType);
295-
return { repo, nowMs, sinceMs, pages, enumerated: issues.length, totalCount, complete: why.length === 0, why, found, fifthRun, hits, unjudged, noArea, noType };
383+
return { repo, nowMs, sinceMs, pages, enumerated: issues.length, totalCount, complete: why.length === 0, why, found, fifthRun, hits, unjudged, noArea, noType, offListRun, areas, offList };
296384
}
297385

298386
export function renderText(r) {
@@ -313,6 +401,12 @@ export function renderText(r) {
313401
lines.push(`${marks[d]} ${DISJUNCTIONS[d]}: ${cards.length}`);
314402
for (const c of cards) lines.push(` #${c.number} · updated ${String(c.updated_at ?? '').slice(0, 16)}Z · ${String(c.title ?? '').slice(0, 100)}`);
315403
}
404+
if (!r.offListRun) lines.push(`area list — ${AREA_LIST_ROW}: not asked — ${r.repo}'s areas are not ${NORTH_STAR_PATH}'s`);
405+
else {
406+
const cards = [...r.offList].sort((a, b) => a.number - b.number);
407+
lines.push(`area list (${NORTH_STAR_PATH}: ${r.areas.length} areas) — ${AREA_LIST_ROW}: ${cards.length}`);
408+
for (const c of cards) lines.push(` #${c.number} · ${areasOf(c).join(', ')} · ${String(c.title ?? '').slice(0, 100)}`);
409+
}
316410
const backstop = (what, rows) => {
317411
const bare = (rows ?? []).map((i) => i.number).sort((a, b) => a - b);
318412
const listed = bare.length > AREA_BACKSTOP_LIST_CAP ? `the first ${AREA_BACKSTOP_LIST_CAP} of them (--json lists all)` : 'all of them';
@@ -336,6 +430,8 @@ export function renderJson(r) {
336430
owed: [...r.hits].sort((a, b) => a - b),
337431
no_area: (r.noArea ?? []).map((i) => i.number).sort((a, b) => a - b),
338432
no_type: (r.noType ?? []).map((i) => i.number).sort((a, b) => a - b),
433+
north_star_areas: r.offListRun ? [...r.areas] : null,
434+
off_list_area: (r.offList ?? []).map((i) => i.number).sort((a, b) => a - b),
339435
verdict: verdictLine(r),
340436
};
341437
}
@@ -447,8 +543,9 @@ const SELF_TEST_BATTERIES = Object.freeze({
447543
'the walk: every page, pull requests dropped, the count checked — INCOMPLETE on any gap, never clean': 10,
448544
'the CLI: what a typo must never mean, and the exits a patrol reads': 9,
449545
'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': 17,
546+
'the North Star area list: the labels are read from its table, and a retired or a second area:* is owed a first touch in the verdict': 16,
450547
});
451-
const SELF_TEST_BATTERY_FLOOR = 6;
548+
const SELF_TEST_BATTERY_FLOOR = 7;
452549
const UNATTRIBUTED_BATTERY = '(unattributed)';
453550
const batteryCases = new Map();
454551
let openBattery = null;
@@ -541,7 +638,7 @@ export async function selfTest() {
541638
t('pull requests are dropped from the count', r.enumerated, 131);
542639
t('a count equal to the platform\'s is complete', r.complete);
543640
t('⭐ ③ found the stateless card on page two — no cut at twelve', r.found[3].map((i) => i.number), [500]);
544-
t('⭐ …and with no window the verdict is PARTIAL, never FOUND or CLEAN, ⑤ NOT RUN named', verdictLine(r), 'sweep PARTIAL — ⑤ NOT RUN: no --since window; ①–④ found 1 card(s) owed a first touch. ⛔ Not a clean sweep: re-run with --since=ISO.');
641+
t('⭐ …and with no window the verdict is PARTIAL, never FOUND or CLEAN, ⑤ NOT RUN named', verdictLine(r), 'sweep PARTIAL — ⑤ NOT RUN: no --since window; ①–④ and the area list found 1 card(s) owed a first touch. ⛔ Not a clean sweep: re-run with --since=ISO.');
545642
const short = await sweep({ repo: REPO, nowMs: NOW, get: board(two, 140).get });
546643
t('⭐ a walk short of the platform\'s count is INCOMPLETE, naming both numbers', [short.complete, short.why[0]], [false, 'the walk returned 131 open issue(s) and the platform counts 140']);
547644
t('…and its verdict is never clean', verdictLine(short).startsWith('sweep INCOMPLETE'));
@@ -581,6 +678,39 @@ export async function selfTest() {
581678
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']);
582679
}
583680

681+
battery('the North Star area list: the labels are read from its table, and a retired or a second area:* is owed a first touch in the verdict');
682+
{
683+
const northStar = readNorthStarFile();
684+
t('the one-area sentence is a substring of the North Star (a reworded rule reds here)', northStar.includes(NORTH_STAR_AREA_RULE));
685+
t('…and so is the sentence that leaves cloud\'s areas to cloud, which is why the row is asked on this board alone', [northStar.includes(NORTH_STAR_OTHER_REPOS_PHRASE), NORTH_STAR_REPOS], [true, [REPO]]);
686+
const live = northStarAreas(northStar);
687+
t('⭐ the live table reads: at least one label, every one an area:* — read, never copied into this file', [live.ok, live.ok && live.areas.length > 0, live.ok && live.areas.every((a) => /^area:[a-z0-9-]+$/.test(a))], [true, true, true]);
688+
const code = readFileSync(SELF_PATH, 'utf8').split('\n// Self-test — floor')[0];
689+
t('⛔ the code above the self-test spells no area label at all — the list lives only in the table', [code.length < readFileSync(SELF_PATH, 'utf8').length, code.match(/'area:[a-z]/gi)], [true, null]);
690+
const table = ['intro', '| Area | What | Status |', '|:--|:--|:--|', '| `area:alpha` Alpha | a | stable |', '| Security (no label) | private | — |', '| `Area:Beta` Beta | b | stable |', '', '| `area:gamma` | another table | — |'].join('\n');
691+
t('a synthetic table: labels in table order, lower-cased, the unlabelled row skipped, the table ending at its first non-row line', northStarAreas(table), { ok: true, areas: ['area:alpha', 'area:beta'] });
692+
t('⛔ no table, no labelled row, or a label named twice is an error, never an empty list', [northStarAreas('no table here').ok, northStarAreas('| Area | x |\n|:--|:--|\n| Security | x |').ok, northStarAreas('| Area | x |\n| `area:alpha` | 1 |\n| `area:alpha` | 2 |').ok], [false, false, false]);
693+
const AREAS = ['area:alpha', 'area:beta'];
694+
const off = (labels, extra) => offListArea(card(1, labels, extra), { areas: AREAS, nowMs: NOW });
695+
t('⭐ a legacy area is off the list', off(['area:studio', 'pm:queue', 'priority:p2']));
696+
t('⭐ two areas are off the list, even when both are on it', off(['area:alpha', 'area:beta', 'pm:queue', 'priority:p2']));
697+
t('…a listed area beside a legacy one is off it too', off(['area:alpha', 'area:studio']));
698+
t('⭐ control: exactly one listed area is clean, case-insensitively', [off(['area:alpha', 'pm:queue', 'priority:p2']), off(['Area:Beta'])], [false, false]);
699+
t('a card with no area:* is not this row\'s (①/② and the area backstop list it)', off(['pm:queue', 'priority:p2']), false);
700+
t('the sweep\'s exclusions and a security card are not on the row; a card mid-relabel is not yet', [...['tracking', 'status:parked', 'pm:seat', 'qa-run', 'eval-run', 'security'].map((x) => off(['area:studio', x])), off(['area:alpha', 'area:beta'], { updated_at: FRESH })], [false, false, false, false, false, false, false]);
701+
const [first, second] = live.ok ? live.areas : [];
702+
const rows = [card(61, ['area:studio', 'pm:queue', 'priority:p2']), card(62, [first, second, 'pm:queue', 'priority:p2'].filter(Boolean)), card(63, [first, 'pm:queue', 'priority:p2'].filter(Boolean))];
703+
const boardOf = (list) => async (p) => (p.startsWith('/search') ? { status: 200, json: { total_count: list.length, incomplete_results: false } } : { status: 200, json: p.endsWith('page=1') ? list : [] });
704+
const r = await sweep({ repo: REPO, nowMs: NOW, sinceMs: Date.parse('2026-11-14T20:00:00Z'), get: boardOf(rows) });
705+
t('⭐ against the live table: the legacy-area card and the two-area card are listed, the one-area control is not, and the verdict counts them', [live.ok && !live.areas.includes('area:studio'), r.offList.map((i) => i.number), [...r.hits].sort(), verdictLine(r), sweepExit(r)], [true, [61, 62], [61, 62], 'sweep FOUND 2 card(s) owed a first touch — 2 of them off the North Star area list', EXIT_OK]);
706+
t('the text prints the row with each card\'s areas, before the backstops; the JSON carries the list read and the cards', [renderText(r).split('\n').filter((l) => l.startsWith('area list') || l.startsWith(' #61')), renderJson(r).off_list_area, renderJson(r).owed, renderJson(r).north_star_areas], [[`area list (${NORTH_STAR_PATH}: ${live.ok ? live.areas.length : 0} areas) — ${AREA_LIST_ROW}: 2`, ' #61 · area:studio · card 61'], [61, 62], [61, 62], live.ok ? [...live.areas] : null]);
707+
const elsewhere = await sweep({ repo: 'objectstack-ai/cloud', nowMs: NOW, sinceMs: Date.parse('2026-11-14T20:00:00Z'), get: boardOf(rows), readNorthStar: () => { throw new Error('must not be read'); } });
708+
t('⛔ another board\'s areas are its own: the row is not asked, the North Star not read, and its cards owe nothing here', [elsewhere.prerequisite, elsewhere.offListRun, elsewhere.offList, [...elsewhere.hits], renderJson(elsewhere).north_star_areas, renderText(elsewhere).includes('area list — ' + AREA_LIST_ROW + ': not asked')], [undefined, false, [], [], null, true]);
709+
const unread = await sweep({ repo: REPO, nowMs: NOW, get: boardOf(rows), readNorthStar: () => { throw new Error('ENOENT'); } });
710+
const tableless = await sweep({ repo: REPO, nowMs: NOW, get: boardOf(rows), readNorthStar: () => 'a North Star with no area table' });
711+
t('⭐ a North Star that cannot be read, or carries no table, is PREREQUISITE NOT MET — never a row that passes every card', [typeof unread.prerequisite, typeof tableless.prerequisite, String(tableless.prerequisite).includes(NORTH_STAR_TABLE_HEADER)], ['string', 'string', true]);
712+
}
713+
584714
battery('the CLI: what a typo must never mean, and the exits a patrol reads');
585715
{
586716
t('an unknown flag is refused', parseOptions(['--sinse=2026-11-14T00:00:00Z']).ok, false);

0 commit comments

Comments
 (0)