Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3d7effe
test(FIX-2087): the closure's goal and the task-surface sweep in CI
claude Oct 23, 2026
63da04f
test(FIX-2087): the closure's first verdicts
claude Oct 23, 2026
f6d06f1
test(FIX-2087): the sweep reads tools and endings by symbol; controls…
claude Oct 23, 2026
b6f75bf
test(FIX-2087): a forwarder exempts only its forwarding; every block …
claude Oct 23, 2026
fdb18c5
Merge remote-tracking branch 'origin/main' into fix/FIX-2087
claude Oct 23, 2026
b76f76b
test(FIX-2087): j1 counts only notice requests that ran a turn; j1:he…
claude Oct 23, 2026
e7c24c7
Merge remote-tracking branch 'origin/main' into fix/FIX-2087
claude Oct 23, 2026
7e07954
Merge remote-tracking branch 'origin/main' into fix/FIX-2087
claude Oct 23, 2026
deaccbd
test(FIX-2087): row 3 grades the closure's own findings
claude Oct 23, 2026
1ba899d
test(FIX-2087): classify the closure goal in FIX-1792's census
claude Oct 23, 2026
89217e4
test(FIX-2087): the closure's verdict on main with every closure fix …
claude Oct 23, 2026
024a259
Merge remote-tracking branch 'origin/main' into fix/FIX-2087
claude Oct 23, 2026
5e5ee0e
test(FIX-2087): row 3 grades FIX-2123, FIX-2135 and FIX-2136
claude Oct 23, 2026
455b3fb
test(FIX-2087): a hearing is a notice admitted, not a request started
claude Oct 23, 2026
1defdcc
Merge remote-tracking branch 'origin/main' into fix/FIX-2087
claude Oct 23, 2026
e51ac8b
test(FIX-2087): row 3 runs FIX-2138's regression test
claude Oct 23, 2026
cde0a95
test(FIX-2087): round 3's verdicts
claude Oct 23, 2026
46a6629
Merge origin/main into fix/FIX-2087
claude Oct 23, 2026
4ec08e6
test(goals): grade FIX-2147, FIX-2149 and FIX-2150 in the closure's r…
claude Oct 23, 2026
8a5ed55
refactor(goals): fold the shorter one-task notes from #3790 (083cef8a…
claude Oct 23, 2026
77dd49e
fix(goals): the closure fails closed, and grades a word-for-word foll…
claude Oct 23, 2026
683c151
fix(goals): every control's tags must go red, and the door rule reads…
claude Oct 23, 2026
9a35628
fix(goals): read a control's red from its tagged failures, and bring …
claude Oct 24, 2026
b6516a8
docs(goals): the closure's goal states how a control is read and what…
claude Oct 24, 2026
eb33735
docs(goals): round 4's verdicts in the closure's log (FIX-2087)
claude Oct 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(goals): read a control's red from its tagged failures, and bring …
…three controls up to date (FIX-2087)

From Codex's third review of #3692, and round 4's row 3:
- a control is red only when its goal exits 1, every required tag has a
  FAIL bullet of its own (the whole tag, bare or bracketed), and no bullet
  is the goal saying a control of its own didn't go red. A diagnostic like
  'control no-plan: a1:x did NOT fail' names the tag but is no red state.
- in a forwarder, ref.fail.call(...) and ref.complete.apply(...) are writes
  made there, not forwarding; --control plants both inside guarded (19
  plants, 27 lines; the plain sweep is still 0 live lines). A plant's
  findings are matched by path, not substring.
- j1:tools fails on any tool offered beyond the allow list and the roster's
  two own tools, not only one named like a task tool.

Controls out of date (the goals, not the product):
- files-tasks-down-the-owners-chain no-follow-up: Workforce's conversation
  board maps the notice decision to a line itself for a turn-filed and an
  unrouted failure (FIX-2115, FIX-2122), so leg e's failure was still said.
  The control now patches both maps; e:one-notice red 2 of 2.
- a-worker-plans-its-own-steps no-plan: a1:no-child-session needs the
  planless model to file for itself, which it no longer does (4 of 4); only
  a1:steps-in-task-session is required.
- hands-each-post-to-its-delegates no-self-choice: best fit places the
  project ask on the EM now, not the hire (4 of 4); any of leg h's own-job
  asks counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VaN4uTiYqiabCbsFLWM52A
  • Loading branch information
claude committed Oct 24, 2026
commit 9a35628da8021bae483d68edd5ae0b374be2103d
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
**Controls:** each is scratch patches to Workforce modules, applied as the process under test loads them (`goals/lib/module-patch.mjs` through `NODE_OPTIONS`); printed in full by the run, and refused when they never reached the code.

- `GOAL_CONTROL=unpartitioned`: one ledger for all of a user's conversations (`conversation-board/ledger.ts`: the partition the board's drain claims in, and every other read or write of the ledger at whatever partition its caller names; and the task entry's check that a task session works only its own conversation's partition). Patching each caller instead missed the ones FIX-1802 P2 added, and the control went green (FIX-1992). Leg c must fail **`c:runs-its-own`** (the first conversation's assign and dispatch reach the other's task, and its board runs it) and **`c:lists-its-own`** (each list holds every task: a control that leaves the lists apart never merged the ledger). `c:found-its-own` goes red with them. `c:drain-returns` goes red too, but not on the wait: the task it measures ran under the other conversation, so it was never running when the measure starts. It has no isolating red state.
- `GOAL_CONTROL=no-follow-up`: a task's ending reaches the conversation that filed it and nothing follows, no line and no turn (orchestration's `tasks/notice/task-notice.ts`); a retried attempt still runs again. Legs a and e must fail **`a:one-notice`** and **`e:one-notice`**. In leg e, `e:refiled` and `e:reply-names` go red with it: no turn, so nothing is filed again.
- `GOAL_CONTROL=no-follow-up`: a task's ending reaches the conversation that filed it and nothing follows, no line and no turn (orchestration's `tasks/notice/task-notice.ts`, and the two places Workforce's `conversation-board/task-settled.ts` maps that decision to a turn or a line itself, for a turn-filed failure and an unrouted one); a retried attempt still runs again. Legs a and e must fail **`a:one-notice`** and **`e:one-notice`**. In leg e, `e:refiled` and `e:reply-names` go red with it: no turn, so nothing is filed again.

**Before-state:** `GOAL_COMMIT=84e9e072e` is `main` just before FIX-1794's second PR merged (#2935, merge `1854a84f0`). Every leg must fail there.

Expand Down
8 changes: 8 additions & 0 deletions goals/coordinators/files-tasks-down-the-owners-chain/run.mts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ const CONTROLS: Record<string, Control> = {
from: String.raw`return policy === "judgment" \? \{ act: "wake-turn" \} : \{ act: "line" \};`,
to: 'return { act: "none" };',
},
{
// Workforce's conversation board maps the decision to a turn or a line itself for a
// turn-filed failure (FIX-2115) and an unrouted one (FIX-2122), so `none` there read as a
// line, and leg e's failure was still said: both maps say nothing too.
module: "packages/workforce/src/conversation-board/task-settled.ts",
from: String.raw`const act = (unrouted && )?decideNotice\(notice, options\.policy\(ctx\)\)\.act === "wake-turn" \? "wake-turn" : "line";`,
to: 'const act = "none" as const;',
},
],
does: "a task's ending reaches the conversation that filed it, and nothing follows: no line and no coordinator turn (a retried attempt still runs again)",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
* worker's defaults, not the conversation's list. Leg d must fail on *the
* reply equals the list*.
* - `no-self-choice`: best fit never offers the coordinator itself. Leg h
* must fail on *a hire reaches the chief of staff's own turn*: the EM, its
* one choice, is picked at full confidence.
* must fail on one of its own-job asks: the EM, its one choice, takes
* whichever the evaluation places on it (the hire, when this was written;
* the project since).
* - `no-floor`: a delegate pick below `minConfidence:` is used. Leg e must
* fail on *a pick below the floor goes to the fallback*, and nothing else:
* a pick with no confidence is still a miss.
Expand Down Expand Up @@ -48,6 +49,8 @@ export interface Control {
leg: "a" | "d" | "e" | "f" | "h";
/** The assertion, by name, that must go red. */
assertion: string;
/** When which assertion goes red is best fit's call: any one of these, `assertion` among them. */
anyOf?: readonly string[];
/** The module, from the checkout root. */
module: string;
from: string;
Expand Down Expand Up @@ -88,6 +91,9 @@ export const CONTROLS: Record<ControlName, Control> = {
name: "no-self-choice",
leg: "h",
assertion: "h:hire-turn",
// Which of leg h's asks best fit now places on the EM is the evaluation's call: on
// 2026-10-24 it was the project ask, 4 of 4 runs, and the hire missed back to the turn.
anyOf: ["h:hire-turn", "h:fire-turn", "h:who-turn", "h:project-turn"],
module: "packages/workforce/src/coordinator/coordinator-flow.ts",
from: String.raw`const offersSelf = post\.round === 0 && worker\.description !== null;`,
to: "const offersSelf = false;",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
- `GOAL_CONTROL=no-round-limit`: a coordinator whose `rounds:` is above 0 runs to the ceiling of 3 (`coordinator-flow.ts`, the worker's config read). Leg e must fail **`e:four-then-none`**, and nothing else: the patch leaves `rounds: 0` alone.
- `GOAL_CONTROL=no-delegate-read`: the delegate read answers from the worker's defaults, not the conversation's list (`delegates/worker-delegates.ts`). Leg d must fail **`d:reply-equals-list`** (*the reply equals the list*), with `d:read-equals-list`.

- `GOAL_CONTROL=no-self-choice`: best fit never offers the coordinator itself (`coordinator-flow.ts`). Leg h must fail **`h:hire-turn`**: the EM, its one choice, takes the hire.
- `GOAL_CONTROL=no-self-choice`: best fit never offers the coordinator itself (`coordinator-flow.ts`). Leg h must fail one of its own-job asks (**`h:hire-turn`**, `h:fire-turn`, `h:who-turn`, `h:project-turn`): the EM, its one choice, takes whichever the evaluation places on it. That was the hire when this was written; on 2026-10-24 it was the project, 4 of 4 runs, with the hire missing back to the coordinator's turn.
- `GOAL_CONTROL=no-floor`: a delegate pick below `minConfidence:` is used (`best-fit.ts`); a pick with no confidence is still a miss. Leg e must fail **`e:below-floor`**, and nothing else.
- `GOAL_CONTROL=turn-after-route`: the coordinator's own turn also runs on a post best fit placed (`coordinator-flow.ts`). Leg a must fail **`a:no-turn`**.

Expand Down
9 changes: 5 additions & 4 deletions goals/coordinators/hands-each-post-to-its-delegates/run.mts
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,12 @@ await runGoal(async () => {
failures.push(...r.failures);
}
if (control !== undefined) {
const named = failures.some((f) => f.startsWith(`${control.assertion} `));
const wanted = control.anyOf ?? [control.assertion];
const named = wanted.find((a) => failures.some((f) => f.startsWith(`${a} `)));
failures.unshift(
named
? `control ${control.name}: leg ${control.leg} failed on ${control.assertion}, as it must`
: `control ${control.name}: leg ${control.leg} did NOT fail on ${control.assertion}, so the check can't see what the control removes`,
named !== undefined
? `control ${control.name}: leg ${control.leg} failed on ${named}, as it must`
: `control ${control.name}: leg ${control.leg} did NOT fail on ${wanted.join(" or ")}, so the check can't see what the control removes`,
);
}
return { failures, evidence: `legs ${[...legs].sort().join(", ")} PASS; ${evidence.join("; ")}` };
Expand Down
2 changes: 1 addition & 1 deletion goals/task-board/a-worker-plans-its-own-steps/goal.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

**Run:** `pnpm tsx goals/task-board/a-worker-plans-its-own-steps/run.mts`. `GOAL_LEGS=a1,a2` runs some legs. On demand only, never a CI gate.

**Controls:** `GOAL_CONTROL=no-plan` is today's `main` as a scratch patch applied as the process loads (`goals/lib/module-patch.mts`): the agent's turn runs without its plan, and a filing naming the worker is a task handed to a session of its own. Leg a1 must fail **`a1:steps-in-task-session`** and **`a1:no-child-session`**.
**Controls:** `GOAL_CONTROL=no-plan` is today's `main` as a scratch patch applied as the process loads (`goals/lib/module-patch.mts`): the agent's turn runs without its plan, and a filing naming the worker is a task handed to a session of its own. Leg a1 must fail **`a1:steps-in-task-session`**. `a1:no-child-session` goes red with it when the planless model files steps for itself, as it did on 2026-10-21; on 2026-10-24 it answered in one turn instead (4 of 4 runs), so it isn't required.

A step that fails, and the answer naming it, is proven in CI by `packages/workforce/test/worker-plans-its-steps.test.ts`: a real model won't fail a step on cue. FIX-2080 had not landed when this did, so a failed attempt's open steps stay open for the next attempt rather than ending `cancelled`; that assertion joins this leg with FIX-2080.

Expand Down
4 changes: 3 additions & 1 deletion goals/task-board/a-worker-plans-its-own-steps/run.mts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ const CONTROLS: Record<string, { patches: ModulePatch[]; assertions: string[] }>
// Today's main: the agent's turn runs without its plan, and a filing that
// names the worker is a task like any other, handed to a session of itself.
"no-plan": {
assertions: ["a1:steps-in-task-session", "a1:no-child-session"],
// `a1:no-child-session` goes red with it only when the model, planless, files for itself;
// since 2026-10-24 it mostly answers in one turn instead (4 of 4 runs), so it isn't required.
assertions: ["a1:steps-in-task-session"],
patches: [
{
module: "packages/workforce/src/agent-worker-flow.ts",
Expand Down
39 changes: 31 additions & 8 deletions goals/workforce-coordination/runs-on-one-task/children.mts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export interface Check {
/** Each child's checks, by issue id. */
export const CHECKS: Record<string, Check[]> = {
"FIX-2076": [
{ goal: "task-board/a-worker-plans-its-own-steps", controls: { "no-plan": ["a1:steps-in-task-session", "a1:no-child-session"] }, walked: "a: writer's plan step" },
{ goal: "task-board/a-worker-plans-its-own-steps", controls: { "no-plan": ["a1:steps-in-task-session"] }, walked: "a: writer's plan step" },
{ goal: "task-board/refuses-a-board-built-wrong", controls: { "no-fence": ["b:refused"] } },
],
"FIX-2077": [{ goal: "task-board/settles-when-its-work-is-over", controls: { "settle-at-return": ["a:after-the-side-chains"] }, walked: "a: writer's task stays running on its research" }],
Expand Down Expand Up @@ -135,7 +135,8 @@ export const NAMED: Check[] = [
"no-roster-check": ["f:bobs-worker-refused"],
"no-round-limit": ["e:four-then-none"],
"no-delegate-read": ["d:reply-equals-list", "d:read-equals-list"],
"no-self-choice": ["h:hire-turn"],
// One of leg h's own-job asks, whichever best fit places on the EM (its goal.md).
"no-self-choice": ["h:"],
"no-floor": ["e:below-floor"],
"turn-after-route": ["a:no-turn"],
},
Expand Down Expand Up @@ -187,8 +188,30 @@ function checkBy(owner: string, check: Check, tags: readonly string[], failures:
export const RAN = new Map<string, boolean>();
const record = (key: string, ok: boolean) => RAN.set(key, (RAN.get(key) ?? true) && ok);

/** Whether a goal's output has `tag` red: a bullet of its `FAIL —` list starting with the tag (with a leg, `d:`, any bullet in that leg). */
const redTag = (text: string, tag: string) => text.split("\n").some((line) => /^\s*- /.test(line) && line.replace(/^\s*- /, "").startsWith(tag));
/**
* The bullets of a goal's `FAIL —` list (goals/lib/verdict.mts prints each failure as a line
* starting ` - `), each the text after its dash, a leading `[` dropped. Lines indented further
* continue a bullet and are not bullets.
*/
function failureBullets(text: string): string[] {
return text.split("\n").flatMap((line) => (/^ {2}- /.test(line) ? [line.slice(4).replace(/^\[/, "")] : []));
}

/** Whether a bullet is `tag`'s failure: it starts with the whole tag (`a:x — …`, `[a:x] …`); a leg tag (`d:`), any bullet in that leg. */
const bulletIs = (bullet: string, tag: string) => bullet.startsWith(tag) && (tag.endsWith(":") || /^($|[\s\]·:])/.test(bullet.slice(tag.length)));

/**
* A control run's verdict: red only when the goal exits 1, every required tag has a failure
* bullet of its own, and no bullet is the goal saying a control of its own didn't go red
* (`control <name>: <tag> did NOT fail …`, or red outside its expected set). Such a bullet
* carries the tag in its text, so reading the output for the tag anywhere would take it for red.
*/
export function controlVerdict(text: string, status: number | null, tags: readonly string[]): { red: boolean; green: string[]; broken: string[] } {
const bullets = failureBullets(text);
const green = tags.filter((t) => !bullets.some((b) => bulletIs(b, t)));
const broken = bullets.filter((b) => /^control\b/i.test(b) && /did not fail|stayed green|is broken|red outside/i.test(b));
return { red: status === 1 && green.length === 0 && broken.length === 0, green, broken };
}

/** Run one check (and its controls); push a failure per red run or control that stayed green. */
function runCheck(owner: string, check: Check, failures: string[], report: string[], say: (s: string) => void): void {
Expand Down Expand Up @@ -224,11 +247,11 @@ function runCheck(owner: string, check: Check, failures: string[], report: strin
else for (const file of check.vitest!.files) record(`${check.vitest!.filter} ${file}`, out.status === 0);
} else {
const tags = check.controls![run.control]!;
const green = tags.filter((t) => !redTag(text, t));
const red = out.status === 1 && green.length === 0;
const { red, green, broken } = controlVerdict(text, out.status, tags);
record(`${check.goal} GOAL_CONTROL=${run.control}`, red);
report.push(` ${red ? "FAIL (expected)" : "CONTROL BROKEN"} ${label} (${secs}s): wanted every one of ${tags.join(", ")} red${green.length > 0 ? `; green: ${green.join(", ")}` : ""}; ${verdict}`);
if (!red) failures.push(`children:${owner} — control ${run.control} of ${check.goal} did not fail as documented (exit ${out.status}; still green: ${green.join(", ") || "none"}): ${text.slice(-800).replace(/\n/g, " | ")}`);
const why = [green.length > 0 ? `green: ${green.join(", ")}` : "", ...broken.map((b) => `the goal says: ${b.slice(0, 160)}`)].filter(Boolean).join("; ");
report.push(` ${red ? "FAIL (expected)" : "CONTROL BROKEN"} ${label} (${secs}s): wanted every one of ${tags.join(", ")} red${why === "" ? "" : `; ${why}`}; ${verdict}`);
if (!red) failures.push(`children:${owner} — control ${run.control} of ${check.goal} did not fail as documented (exit ${out.status}; ${why || "no failure list"}): ${text.slice(-800).replace(/\n/g, " | ")}`);
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion goals/workforce-coordination/runs-on-one-task/engine.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,10 @@ export function sweepTaskSurface({ repo, plants = [], tracked: given, table: tab
let forwards = false;
if (ts.isPropertyAccessExpression(node) && ENDS.includes(node.name.text) && onCollection(node.expression, node.name)) {
ending = `${node.getText(sf)}`;
forwards = !(ts.isCallExpression(node.parent) && node.parent.expression === node);
// Called, or called through `.call`/`.apply` (`ref.fail.call(ref, …)`), is a write made
// here; only a reference handed on (`.bind`, passed as a value) forwards.
const viaCall = ts.isPropertyAccessExpression(node.parent) && node.parent.expression === node && ["call", "apply"].includes(node.parent.name.text) && ts.isCallExpression(node.parent.parent) && node.parent.parent.expression === node.parent;
forwards = !((ts.isCallExpression(node.parent) && node.parent.expression === node) || viaCall);
} else if (ts.isElementAccessExpression(node) && isCollection(checker.getTypeAtLocation(node.expression))) {
const arg = node.argumentExpression;
if (!ts.isStringLiteralLike(arg) || ENDS.includes(arg.text)) ending = `${node.getText(sf)} (element access)`;
Expand Down
9 changes: 6 additions & 3 deletions goals/workforce-coordination/runs-on-one-task/run.mts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ interface Swept {
const sweepJson = (): Swept => JSON.parse(spawnSync(process.execPath, [join(HERE, "sweep.mjs"), "--json"], { encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }).stdout) as Swept;
let swept: Swept | undefined;
const allowedTools = () => new Set((swept ??= sweepJson()).allowed);
/** The tools a Lab worker's turn is handed that aren't task tools: the delegate read and the worker-to-worker message. */
const NOT_TASK_TOOLS = new Set(["listDelegates", "messageWorker"]);

// ---- D1: every assertion's kind ---------------------------------------------------------------

Expand Down Expand Up @@ -247,10 +249,11 @@ function gradeJ1(store: string, j: Awaited<ReturnType<typeof journeyHandsOut>>,
"j1 · tool lists the engine handed a task turn",
readNdjson<{ who: string; tools: string[] }>(`${store}.tools.ndjson`).filter((c) => c.who === CAST.editor || c.who === CAST.writer),
);
const taskish = new Set(offered.flatMap((c) => c.tools).filter((n) => /Tasks?$|_tasks$|^(reportProgress|parkOnQuestion)$/.test(n)));
// Every tool offered is either on the allow list or one of the roster's own (NOT_TASK_TOOLS),
// so a new task tool fails here whatever it is called, not only one named like a task tool.
const allowed = allowedTools();
const beyond = [...taskish].filter((n) => !allowed.has(n));
if (beyond.length > 0) f.push(`j1:tools — a task turn was offered ${beyond.join(", ")}, beyond the allow list`);
const beyond = [...new Set(offered.flatMap((c) => c.tools))].filter((n) => !allowed.has(n) && !NOT_TASK_TOOLS.has(n));
if (beyond.length > 0) f.push(`j1:tools — a task turn was offered ${beyond.join(", ")}, beyond the allow list and the roster's own tools`);
if (linesBy(store, j.conv, CAST.editor).filter((m) => textOf(m) === outputText(E.output)).length !== 1) f.push(`j1:once — editor's answer did not land once in Alice's conversation with chief`);
return f;
}
Expand Down
12 changes: 8 additions & 4 deletions goals/workforce-coordination/runs-on-one-task/sweep.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,15 @@ function doorPlants(root) {
];
}

/** A direct write planted inside a collection wrapper: only its forwarding is exempt, so this is reported. */
/** Writes planted inside a collection wrapper: only its forwarding is exempt, so each is reported. */
const BOARD = "packages/workforce/src/conversation-board/board.ts";
function forwarderPlant(root) {
const board = readFileSync(join(root, BOARD), "utf8");
const anchor = " const ending =\n (write:";
if (!board.includes(anchor)) throw new Error(`the control can't plant: ${BOARD} has no \`const ending =\` in guarded`);
return { rule: "endings", path: BOARD, text: board.replace(anchor, ' void ref.fail("planted", "a direct write in a forwarder");\n' + anchor) };
// A direct call, and calls through `.call` and `.apply`: each a write made in the forwarder, not a forwarding.
const writes = ' void ref.fail("planted", "a direct write in a forwarder");\n' + ' void ref.fail.call(ref, "planted", "a write through .call");\n' + ' void ref.complete.apply(ref, ["planted", 1] as any);\n';
return { rule: "endings", path: BOARD, text: board.replace(anchor, writes + anchor), expect: 3 };
}

function floorPlant(root) {
Expand Down Expand Up @@ -229,9 +231,11 @@ if (control) {
const key = (f) => `${f.rule} ${f.where} ${f.what}`;
const before = new Set(plain.findings.map(key));
const added = result.findings.filter((f) => !before.has(key(f)));
const of = (p) => added.filter((f) => f.rule === p.rule && f.where.includes(p.path));
// A finding's place is `path:line`, or several joined by " and " (a key naming two functions).
const at = (f, p) => f.rule === p.rule && f.where.split(" and ").some((w) => w.startsWith(`${p.path}:`));
const of = (p) => added.filter((f) => at(f, p));
const missed = PLANTS.filter((p) => of(p).length !== (p.expect ?? 1));
const stray = added.filter((f) => !PLANTS.some((p) => f.rule === p.rule && f.where.includes(p.path)));
const stray = added.filter((f) => !PLANTS.some((p) => at(f, p)));
for (const p of PLANTS) console.log(` plant ${p.rule.padEnd(8)} ${p.path}: ${of(p).length} of ${p.expect ?? 1} reported${missed.includes(p) ? " MISSED" : ""}`);
for (const f of stray) console.log(` stray ${f.rule} ${f.where} ${f.what}`);
const wantCantTell = plain.cantTell.length + PLANTS.reduce((n, p) => n + (p.cantTell ?? 0), 0);
Expand Down