@feigi/fleet-ctl 0.0.0 → 3.16.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/agents/{fleet-implementer.agent.md → fleet-implementer-slow-high.agent.md} +23 -2
  2. package/agents/fleet-implementer-slow-medium.agent.md +231 -0
  3. package/agents/fleet-implementer-smol-high.agent.md +231 -0
  4. package/agents/{fleet-implementer-alt.agent.md → fleet-implementer-task-high.agent.md} +23 -2
  5. package/agents/fleet-implementer-task-max.agent.md +231 -0
  6. package/agents/fleet-review-comments.agent.md +4 -2
  7. package/agents/fleet-review-correctness.agent.md +2 -1
  8. package/agents/fleet-review-runner.agent.md +14 -10
  9. package/agents/fleet-review-silent-failure.agent.md +4 -3
  10. package/agents/fleet-review-simplify.agent.md +2 -1
  11. package/agents/fleet-review-snapshot.agent.md +2 -1
  12. package/agents/fleet-review-test-run.agent.md +29 -0
  13. package/agents/fleet-review-tests.agent.md +10 -5
  14. package/agents/fleet-review-types.agent.md +4 -2
  15. package/agents/fleet-review-verifier.agent.md +4 -3
  16. package/commands/review-and-fix.md +7 -6
  17. package/commands/run-merge-bot.md +14 -4
  18. package/package.json +4 -2
  19. package/scripts/agent-test.test.mjs +36 -32
  20. package/scripts/ambient-git-vars-mjs-prose.test.mjs +23 -13
  21. package/scripts/apply-ruleset.test.mjs +4 -3
  22. package/scripts/arg-header-probes-prose.test.mjs +1 -0
  23. package/scripts/arg.test.mjs +18 -18
  24. package/scripts/board-cli.test.mjs +18 -21
  25. package/scripts/board-identity.test.mjs +9 -9
  26. package/scripts/board-liveness-banner.test.mjs +6 -6
  27. package/scripts/board-prev-shape.test.mjs +12 -13
  28. package/scripts/board-tryparse-null.test.mjs +7 -7
  29. package/scripts/board.mjs +4 -7
  30. package/scripts/board.test.mjs +57 -61
  31. package/scripts/candidates.test.mjs +228 -17
  32. package/scripts/ci-completes-premise-prose.test.mjs +1 -1
  33. package/scripts/ci-state-prose.test.mjs +2 -2
  34. package/scripts/ci-state.mjs +389 -187
  35. package/scripts/ci-state.test.mjs +458 -165
  36. package/scripts/claim-lifecycle.test.mjs +2 -1
  37. package/scripts/claim-ticket.test.mjs +35 -34
  38. package/scripts/closing-keyword-prose.test.mjs +1 -1
  39. package/scripts/cockpit-tick-nonblocking.test.mjs +8 -8
  40. package/scripts/compute-board.mjs +13 -3
  41. package/scripts/compute-board.test.mjs +64 -1
  42. package/scripts/compute-spend.mjs +46 -8
  43. package/scripts/compute-spend.test.mjs +64 -10
  44. package/scripts/cross-repo-citation-prose.test.mjs +18 -19
  45. package/scripts/delete-merged-branch.sh +218 -0
  46. package/scripts/delete-merged-branch.test.mjs +576 -0
  47. package/scripts/derive-testcmd.sh +18 -7
  48. package/scripts/derive-testcmd.test.mjs +9 -8
  49. package/scripts/diff-stats.mjs +2 -2
  50. package/scripts/diff-stats.test.mjs +7 -11
  51. package/scripts/dispatch-block-golden-prose.test.mjs +111 -6
  52. package/scripts/dispatch-block-pins-prose.test.mjs +5 -5
  53. package/scripts/dispositions-check.mjs +507 -0
  54. package/scripts/dispositions-check.test.mjs +843 -0
  55. package/scripts/dispositions-gate-prose.test.mjs +114 -0
  56. package/scripts/drop-merged-label.test.mjs +3 -4
  57. package/scripts/exec-stub.mjs +93 -0
  58. package/scripts/exec-stub.test.mjs +69 -0
  59. package/scripts/filing-bar-seat-prose.test.mjs +1 -1
  60. package/scripts/finisher-test-verdict-prose.test.mjs +102 -0
  61. package/scripts/fix-applier-correction-rules-prose.test.mjs +11 -10
  62. package/scripts/fleet-bootstrap +5 -20
  63. package/scripts/fleet-bootstrap.test.mjs +75 -0
  64. package/scripts/fleet-heartbeat.mjs +2 -2
  65. package/scripts/fleet-provenance +15 -24
  66. package/scripts/fleet-provenance.test.mjs +86 -12
  67. package/scripts/fleet-run.test.mjs +5 -5
  68. package/scripts/fleet-state.mjs +33 -11
  69. package/scripts/fleet-state.test.mjs +90 -3
  70. package/scripts/fleet-tick.mjs +346 -70
  71. package/scripts/fleet-tick.test.mjs +566 -16
  72. package/scripts/force-with-lease-reason-prose.test.mjs +1 -1
  73. package/scripts/frontmatter-check.mjs +3 -2
  74. package/scripts/frontmatter-check.test.mjs +6 -6
  75. package/scripts/immutable-body-claim-prose.test.mjs +53 -262
  76. package/scripts/implementer-model-tier.test.mjs +98 -506
  77. package/scripts/inflight.test.mjs +18 -127
  78. package/scripts/is-cli.mjs +26 -0
  79. package/scripts/is-cli.test.mjs +99 -0
  80. package/scripts/json.test.mjs +3 -3
  81. package/scripts/ledger-dispatch.test.mjs +368 -7
  82. package/scripts/ledger-grammar.mjs +85 -1
  83. package/scripts/ledger-grammar.test.mjs +86 -1
  84. package/scripts/ledger-read-require-file.test.mjs +7 -7
  85. package/scripts/ledger-rotate.test.mjs +142 -0
  86. package/scripts/ledger.mjs +181 -17
  87. package/scripts/ledger.test.mjs +12 -130
  88. package/scripts/main-checkout.mjs +312 -0
  89. package/scripts/main-checkout.test.mjs +332 -0
  90. package/scripts/member-outcomes-header.test.mjs +3 -3
  91. package/scripts/member-outcomes.mjs +4 -5
  92. package/scripts/member-outcomes.test.mjs +92 -18
  93. package/scripts/member-prompt-prose.test.mjs +17 -13
  94. package/scripts/member-record.mjs +8 -3
  95. package/scripts/member-record.test.mjs +5 -5
  96. package/scripts/member-write-guard.mjs +5 -5
  97. package/scripts/member-write-guard.test.mjs +6 -3
  98. package/scripts/no-undo-audit.sh +24 -21
  99. package/scripts/no-undo-audit.test.mjs +9 -13
  100. package/scripts/pointer-target-prose.test.mjs +1 -1
  101. package/scripts/pr-overlap.test.mjs +6 -9
  102. package/scripts/prompt-renderer.mjs +10 -9
  103. package/scripts/prose-pin.mjs +10 -11
  104. package/scripts/prove-merge.test.mjs +3 -3
  105. package/scripts/quiet-payload-prose.test.mjs +1 -1
  106. package/scripts/reap.test.mjs +3 -4
  107. package/scripts/release-label-split-prose.test.mjs +17 -2
  108. package/scripts/release-ticket.test.mjs +35 -44
  109. package/scripts/review-core-cwd-isolation.test.mjs +7 -6
  110. package/scripts/review-core-reads.test.mjs +1 -1
  111. package/scripts/review-core-scratch-refusal.test.mjs +64 -0
  112. package/scripts/review-core-shared-test-run.test.mjs +238 -0
  113. package/scripts/review-core-snapshot-path.test.mjs +59 -12
  114. package/scripts/review-core-specialist-scratch.test.mjs +12 -10
  115. package/scripts/review-core-testcmd.test.mjs +76 -45
  116. package/scripts/review-core-unrun.test.mjs +154 -168
  117. package/scripts/review-core.mjs +250 -56
  118. package/scripts/review-eval.mjs +11 -4
  119. package/scripts/review-host-fixture.mjs +12 -3
  120. package/scripts/review-in-run-retry.test.mjs +27 -3
  121. package/scripts/review-runner-spawns.test.mjs +5 -3
  122. package/scripts/review-runner.test.mjs +14 -3
  123. package/scripts/review-tier-audit.test.mjs +1 -1
  124. package/scripts/run-merge-bot-prose.test.mjs +29 -6
  125. package/scripts/scratch-partition-invariant-prose.test.mjs +1 -1
  126. package/scripts/section-between-guard-prose.test.mjs +4 -3
  127. package/scripts/select-dimensions.test.mjs +1 -1
  128. package/scripts/shell-traps-prose.test.mjs +6 -9
  129. package/scripts/shortlist.mjs +4 -1
  130. package/scripts/shortlist.test.mjs +30 -16
  131. package/scripts/snapshot-repo.test.mjs +177 -4
  132. package/scripts/stash-prohibition-prose.test.mjs +1 -1
  133. package/scripts/temp-dir.mjs +47 -0
  134. package/scripts/tier-check.mjs +95 -28
  135. package/scripts/tier-check.test.mjs +131 -29
  136. package/scripts/tier-outcomes-header.test.mjs +11 -54
  137. package/scripts/tier-outcomes.mjs +34 -12
  138. package/scripts/tier-outcomes.test.mjs +157 -4
  139. package/scripts/tier-roles.mjs +118 -29
  140. package/scripts/tier-roles.test.mjs +226 -61
  141. package/scripts/tracker-block-copy-prose.test.mjs +3 -3
  142. package/scripts/verify-sha.test.mjs +4 -5
  143. package/scripts/watcher-degraded-block.test.mjs +5 -8
  144. package/scripts/within-run-pair-prose.test.mjs +43 -75
  145. package/scripts/worktree-audit.test.mjs +2 -1
  146. package/skills/next-ticket/SKILL.md +2 -2
  147. package/skills/run-team/SKILL.md +433 -303
  148. package/skills/run-team/references/ci-and-staleness.md +7 -6
  149. package/skills/run-team/references/correction-tickets.md +3 -3
  150. package/skills/run-team/references/isolation.md +1 -1
  151. package/skills/sizing-a-ticket/SKILL.md +8 -8
  152. package/scripts/tier-guard-gate-prose.test.mjs +0 -216
@@ -34,12 +34,13 @@
34
34
  import { test } from "node:test";
35
35
  import assert from "node:assert/strict";
36
36
  import { spawnSync } from "node:child_process";
37
- import { mkdtempSync, readFileSync, rmSync, writeFileSync, chmodSync } from "node:fs";
37
+ import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
38
38
  import { tmpdir } from "node:os";
39
39
  import { join } from "node:path";
40
40
  import { fileURLToPath } from "node:url";
41
41
  import { stripComments } from "./strip-comments.mjs";
42
- import { between } from "./prose-pin.mjs";
42
+ import { between, phrase } from "./prose-pin.mjs";
43
+ import { writeExecStub } from "./exec-stub.mjs";
43
44
 
44
45
  const SCRIPT = fileURLToPath(new URL("./candidates.mjs", import.meta.url));
45
46
  const ARG_MODULE = fileURLToPath(new URL("./arg.mjs", import.meta.url));
@@ -145,8 +146,7 @@ function run(issues, args = ["--require-label", "ready-for-agent"], unfiltered =
145
146
  const fixture = join(dir, "issues.json");
146
147
  writeFileSync(fixture, JSON.stringify(issues));
147
148
  const gh = join(dir, "gh");
148
- writeFileSync(gh, STUB);
149
- chmodSync(gh, 0o755);
149
+ writeExecStub(gh, STUB);
150
150
  const engineLog = join(dir, "engine-version");
151
151
  const env = { ...process.env, PATH: `${dir}:${process.env.PATH}`, FIXTURE: fixture, ENGINE_LOG: engineLog, ...extraEnv };
152
152
  if (unfiltered) {
@@ -179,8 +179,7 @@ function run(issues, args = ["--require-label", "ready-for-agent"], unfiltered =
179
179
  function runWithGh(script) {
180
180
  const dir = mkdtempSync(join(tmpdir(), "candidates-gh-"));
181
181
  const gh = join(dir, "gh");
182
- writeFileSync(gh, script);
183
- chmodSync(gh, 0o755);
182
+ writeExecStub(gh, script);
184
183
  const env = { ...process.env, PATH: `${dir}:${process.env.PATH}` };
185
184
  const r = spawnSync(process.execPath, [SCRIPT, "--require-label", "ready-for-agent"], {
186
185
  encoding: "utf8",
@@ -1971,6 +1970,30 @@ function declaredLabelFlag() {
1971
1970
  return flags[0][1];
1972
1971
  }
1973
1972
 
1973
+ // Which carriers of this flag's spelling carry a pin through this function,
1974
+ // and what a rename owes the ones that deliberately do not (#1196).
1975
+ //
1976
+ // The line is LIVE versus FROZEN, never value-bearing versus bare. Every live
1977
+ // carrier is pinned — a shipped skill or command, a live doc, and a contract
1978
+ // table edited in place, which is live whatever date its file is named for —
1979
+ // and a bare `candidates.mjs --<flag>` counts as much as one carrying a value:
1980
+ // left behind by a rename, it still names a flag that no longer exists, in a
1981
+ // file that is read as current. A rename edits each live carrier in place,
1982
+ // with no note, and its pin reds until it does.
1983
+ //
1984
+ // Frozen records — an accepted ADR's body, a dated spec's narrative, a
1985
+ // supersession note — stay unpinned, because a rename's correct handling of
1986
+ // them never touches the line a pin would read, so a pin there could only red
1987
+ // on a rename it cannot see handled. What a rename owes each kind:
1988
+ // - a dated spec: a supersession note, never a silent swap. The old spelling
1989
+ // now names an invocation this script refuses at exit 2, which is the
1990
+ // behavioural contradiction #257 lets a dated record be corrected for —
1991
+ // the note at the head of the run-team design spec (#240) is the shape.
1992
+ // - an accepted ADR: an `Amended by #N: …` on its `**Status:**` line, its
1993
+ // body left as ruled (AGENTS.md, *ADR amendments*).
1994
+ // The one pin on a dated spec below stays: it protects a correction #240
1995
+ // already made in place, rather than freezing a record.
1996
+
1974
1997
  test("the run-team design spec's candidate-scan step names the flag this script declares", () => {
1975
1998
  const DECLARED_LABEL_FLAG = declaredLabelFlag();
1976
1999
  // The step alone, for the reason the run-team pin above gives: a match
@@ -1998,17 +2021,16 @@ test("the run-team design spec's candidate-scan step names the flag this script
1998
2021
  );
1999
2022
  });
2000
2023
 
2001
- // --- #851: another live carrier of the flag spelling, and not the last
2002
- // carrier nothing asserts on. `git grep -l -- --require-label docs skills`
2003
- // lists the carriers; several are unpinned, filed as #1196 — measured by
2004
- // rewriting `docs/specs/2026-07-23-fleet-plugin-design.md`'s value-bearing
2005
- // `[--require-label L]` synopsis row to `[--label L]`, which leaves this whole
2006
- // suite green. `next-ticket/SKILL.md` earns a pin here because it is what a
2007
- // solo caller reads to run the scan, and `--label` is what `gh issue list`
2008
- // accepts, so it is the plausible thing to write and the thing this script
2009
- // refuses at exit 2. Derived from `OPTIONS`, through the same guarded
2010
- // `declaredLabelFlag()` the run-team design-spec pin uses, so a rename of the
2011
- // flag reddens here instead of minting the next hand-copied spelling.
2024
+ // --- #851: the next-ticket carrier. `git grep -n -- --require-label docs
2025
+ // plugin` lists every carrier of this flag's spelling, pinned and unpinned
2026
+ // alike; which ones carry a pin, and why the rest deliberately do not, is the
2027
+ // rule above `declaredLabelFlag()`. `next-ticket/SKILL.md` earns a pin here
2028
+ // because it is what a solo caller reads to run the scan, and `--label` is
2029
+ // what `gh issue list` accepts, so it is the plausible thing to write and the
2030
+ // thing this script refuses at exit 2. Derived from `OPTIONS`, through the
2031
+ // same guarded `declaredLabelFlag()` the run-team design-spec pin uses, so a
2032
+ // rename of the flag reddens here instead of minting the next hand-copied
2033
+ // spelling.
2012
2034
  //
2013
2035
  // What gets pinned is the TOKEN inside the candidate step, not the invocation
2014
2036
  // that carries it. Measured, both legs: deleting that step's only fenced block
@@ -2088,6 +2110,195 @@ test("the next-ticket pin reds on the refused spelling and stays green on text i
2088
2110
  assertScanRunsDeclaredFlag(rewrapped, "a rewrapped next-ticket/SKILL.md");
2089
2111
  });
2090
2112
 
2113
+ // --- #1196: the remaining live carriers, one pin each, by the rule above
2114
+ // `declaredLabelFlag()`. Each pin takes the text rather than reading the file,
2115
+ // for the reason `assertScanRunsDeclaredFlag` gives, and each has a
2116
+ // discrimination test that reds it on the refused spelling and keeps it green
2117
+ // on the real text.
2118
+ //
2119
+ // The fleet-plugin design spec's script-surface table is a live contract,
2120
+ // edited in place row by row, not a dated record — so its `candidates.mjs` row
2121
+ // is pinned like any shipped file, and a rename edits it with no note.
2122
+ const SPEC_PLUGIN_DESIGN = readFileSync(
2123
+ fileURLToPath(new URL("../../docs/specs/2026-07-23-fleet-plugin-design.md", import.meta.url)),
2124
+ "utf8",
2125
+ );
2126
+
2127
+ // The lookup candidates-exit3-prose.test.mjs's `candidatesRow()` makes, over
2128
+ // a text passed in. A local copy rather than an import: importing a test
2129
+ // module registers every test in it a second time in this process.
2130
+ function candidatesRow(text, where) {
2131
+ const line = text.split("\n").find((l) => l.startsWith("| `candidates.mjs` |"));
2132
+ assert.ok(line, `${where}'s script-surface table no longer has a \`candidates.mjs\` row — update this test`);
2133
+ return line;
2134
+ }
2135
+
2136
+ // The declared flag as a whole token: `--<flag>` with nothing word-like after
2137
+ // it, so `--<flag>s` or `--<flag>-x` is not it.
2138
+ const labelFlagToken = () => new RegExp(`--${declaredLabelFlag()}(?![\\w-])`);
2139
+
2140
+ // Two tokens, both pinned: the In cell's synopsis and the Non-zero cell's
2141
+ // exit-2 cause. Either one alone renamed is a refused spelling in the row a
2142
+ // reader copies, and a positive on one cannot see the other. Each positive
2143
+ // reads the TOKEN inside its own cell, never the cell's wording around it
2144
+ // (#1196: "pin the token, not … the synopsis row's shape"), so a new
2145
+ // placeholder or a reworded exit-2 cause stays green.
2146
+ function assertRowNamesDeclaredFlag(text, where) {
2147
+ const flag = declaredLabelFlag();
2148
+ const token = labelFlagToken();
2149
+ const row = candidatesRow(text, where);
2150
+ const [, , inCell, , nonZeroCell] = row.split("|");
2151
+ assert.match(
2152
+ inCell,
2153
+ token,
2154
+ `${where}'s candidates row no longer names --${flag} in its In cell, the label flag candidates.mjs' OPTIONS declares`,
2155
+ );
2156
+ assert.match(
2157
+ nonZeroCell ?? "",
2158
+ token,
2159
+ `${where}'s candidates row no longer names --${flag} in its Non-zero cell, where \`--allow-fallback\` needs it`,
2160
+ );
2161
+ // The row carries no `gh` invocation, so nothing in it spells `--label`
2162
+ // correctly and a row-wide negative is safe.
2163
+ assert.doesNotMatch(row, /--label\b/, `${where}'s candidates row names \`--label\`, which candidates.mjs refuses at exit 2`);
2164
+ }
2165
+
2166
+ test("the fleet-plugin design spec's candidates row names the flag this script declares", () => {
2167
+ assertRowNamesDeclaredFlag(SPEC_PLUGIN_DESIGN, "the fleet-plugin design spec");
2168
+ });
2169
+
2170
+ // The spec's text with its `candidates.mjs` row's cells rewritten by `edit`.
2171
+ // Mutants and controls are built from the cells rather than from quoted row
2172
+ // wording, so a row edit that keeps the token cannot strand them.
2173
+ function withRowCells(text, edit) {
2174
+ const row = candidatesRow(text, "the fleet-plugin design spec");
2175
+ const cells = row.split("|");
2176
+ edit(cells);
2177
+ return text.replace(row, cells.join("|"));
2178
+ }
2179
+
2180
+ test("the candidates-row pin reds on either token renamed alone and stays green on the real row", () => {
2181
+ const flag = declaredLabelFlag();
2182
+ for (const [cell, which] of [
2183
+ [2, "the In cell"],
2184
+ [4, "the Non-zero cell"],
2185
+ ]) {
2186
+ const mutant = withRowCells(SPEC_PLUGIN_DESIGN, (cells) => {
2187
+ cells[cell] = cells[cell].replace(labelFlagToken(), "--label");
2188
+ });
2189
+ assert.notEqual(mutant, SPEC_PLUGIN_DESIGN, `${which} no longer carries --${flag} — this mutant now tests nothing`);
2190
+ assert.throws(
2191
+ () => assertRowNamesDeclaredFlag(mutant, "the mutant"),
2192
+ /the mutant's candidates row/,
2193
+ `the pin does not red when only ${which} is given the spelling this script refuses`,
2194
+ );
2195
+ }
2196
+ // GREEN on a row that keeps the flag's spelling but not its wording — a new
2197
+ // placeholder, a reworded exit-2 cause — the inputs a shape pin wrongly
2198
+ // refuses.
2199
+ for (const [cell, text, which] of [
2200
+ [2, ` \`[--${flag} LABEL] [--limit N]\` `, "the In cell's placeholder"],
2201
+ [4, ` exit 2 when \`--allow-fallback\` is given unless \`--${flag}\` is `, "the Non-zero cell's wording"],
2202
+ ]) {
2203
+ assertRowNamesDeclaredFlag(
2204
+ withRowCells(SPEC_PLUGIN_DESIGN, (cells) => {
2205
+ cells[cell] = text;
2206
+ }),
2207
+ `the spec with ${which} reworded`,
2208
+ );
2209
+ }
2210
+ assertRowNamesDeclaredFlag(SPEC_PLUGIN_DESIGN, "the real spec");
2211
+ });
2212
+
2213
+ // The two component docs, each sliced to its candidate-scan list item. Matched
2214
+ // through `phrase()` so a rewrap of the item stays green; the negative names
2215
+ // `candidates.mjs` so it reads the invocation, not any `--label` near it.
2216
+ const COMPONENT_SCANS = [
2217
+ ["next-ticket.md", "1. **List candidates**", "\n2. **Filter.**"],
2218
+ ["supply-and-shortlist.md", "1. **Scan.**", "\n2. **Filter**"],
2219
+ ].map(([file, from, to]) => ({
2220
+ where: `docs/components/${file}`,
2221
+ text: readFileSync(fileURLToPath(new URL(`../../docs/components/${file}`, import.meta.url)), "utf8"),
2222
+ from,
2223
+ to,
2224
+ }));
2225
+
2226
+ function assertComponentScanNamesDeclaredFlag({ text, from, to }, where) {
2227
+ const flag = declaredLabelFlag();
2228
+ const item = between(text, from, to, where);
2229
+ assert.match(
2230
+ item,
2231
+ phrase(`candidates.mjs --${flag} ready-for-agent`),
2232
+ `${where}'s candidate-scan item no longer runs the label flag candidates.mjs' OPTIONS declares`,
2233
+ );
2234
+ assert.doesNotMatch(
2235
+ item,
2236
+ /candidates\.mjs\s+--label\b/,
2237
+ `${where}'s candidate-scan item names \`candidates.mjs --label\`, which candidates.mjs refuses at exit 2`,
2238
+ );
2239
+ }
2240
+
2241
+ for (const doc of COMPONENT_SCANS) {
2242
+ test(`${doc.where}'s candidate scan names the flag this script declares`, () => {
2243
+ assertComponentScanNamesDeclaredFlag(doc, doc.where);
2244
+ });
2245
+
2246
+ test(`the ${doc.where} pin reds on the refused spelling and stays green on the real text`, () => {
2247
+ assert.throws(
2248
+ () =>
2249
+ assertComponentScanNamesDeclaredFlag(
2250
+ { ...doc, text: doc.text.replaceAll(`--${declaredLabelFlag()}`, "--label") },
2251
+ "the mutant",
2252
+ ),
2253
+ /the mutant's candidate-scan item/,
2254
+ "the pin does not red when the candidate-scan item is given the spelling this script refuses",
2255
+ );
2256
+ assertComponentScanNamesDeclaredFlag(doc, doc.where);
2257
+ });
2258
+ }
2259
+
2260
+ // review-and-fix step 5 names the flag BARE — `candidates.mjs --<flag>`, no
2261
+ // value — and is pinned all the same: live, shipped, read as current. The
2262
+ // negative names `candidates.mjs` rather than `/--label\b/`, because this same
2263
+ // step correctly runs `gh issue create --label`, `gh`'s own flag.
2264
+ const REVIEW_AND_FIX = readFileSync(join(import.meta.dirname, "..", "commands", "review-and-fix.md"), "utf8");
2265
+
2266
+ function assertDeferralStepNamesDeclaredFlag(text, where) {
2267
+ const flag = declaredLabelFlag();
2268
+ const step5 = between(text, "5. File each deferred finding", "\n6. Diff-check green", `${where} step 5`);
2269
+ assert.match(
2270
+ step5,
2271
+ new RegExp(`${phrase(`candidates.mjs --${flag}`).source}(?![\\w-])`),
2272
+ `${where}'s step 5 no longer names the label flag candidates.mjs' OPTIONS declares`,
2273
+ );
2274
+ assert.doesNotMatch(
2275
+ step5,
2276
+ /candidates\.mjs\s+--label\b/,
2277
+ `${where}'s step 5 names \`candidates.mjs --label\`, which candidates.mjs refuses at exit 2`,
2278
+ );
2279
+ }
2280
+
2281
+ test("review-and-fix's deferral step names the flag this script declares", () => {
2282
+ assertDeferralStepNamesDeclaredFlag(REVIEW_AND_FIX, "review-and-fix.md");
2283
+ });
2284
+
2285
+ test("the review-and-fix pin reds on the refused spelling and stays green beside gh's own --label", () => {
2286
+ assert.throws(
2287
+ () =>
2288
+ assertDeferralStepNamesDeclaredFlag(REVIEW_AND_FIX.replaceAll(`--${declaredLabelFlag()}`, "--label"), "the mutant"),
2289
+ /the mutant's step 5/,
2290
+ "the pin does not red when step 5 is given the spelling this script refuses",
2291
+ );
2292
+ // GREEN on the real step, which carries a legitimate `--label` — the input
2293
+ // a looser negative would wrongly refuse.
2294
+ assert.match(
2295
+ between(REVIEW_AND_FIX, "5. File each deferred finding", "\n6. Diff-check green", "review-and-fix.md step 5"),
2296
+ /gh issue create --label/,
2297
+ "review-and-fix step 5 no longer carries gh's own `--label` — this control now proves nothing",
2298
+ );
2299
+ assertDeferralStepNamesDeclaredFlag(REVIEW_AND_FIX, "review-and-fix.md");
2300
+ });
2301
+
2091
2302
  test("the cockpit spec's gh invocation keeps the flag gh accepts", () => {
2092
2303
  // The other half of the same class, and the one a fix for it can break:
2093
2304
  // `--label` is correct for `gh issue list`, so a sweep for the wrong spelling
@@ -185,7 +185,7 @@ test("the controller records the bound run identifier under a named field, not j
185
185
  );
186
186
  assert.match(
187
187
  s,
188
- phrase("`row` **replaces the whole line** (above), so repeat `class=`, `ports=` and `→ PR#`"),
188
+ phrase("`row` **replaces the whole line** (above), so repeat `ports=` and `→ PR#`"),
189
189
  "the instruction no longer cross-references the replace-whole-line warning, so a controller following it will silently destroy the row's other tokens",
190
190
  );
191
191
  assert.match(
@@ -24,9 +24,9 @@ const RUN_MERGE_BOT = readFileSync(join(REPO, "commands", "run-merge-bot.md"), "
24
24
  // The reason string belongs to ci-state.mjs, so read it from ci-state.mjs: renaming
25
25
  // it there reddens these pins too, instead of leaving both documents quoting a
26
26
  // string the source no longer emits. Captures the template's literal head only —
27
- // everything before `${missing.join(...)}`, which no document can contain.
27
+ // everything before the `${missing…}` interpolation, which no document can contain.
28
28
  const CI_STATE = readFileSync(join(import.meta.dirname, "ci-state.mjs"), "utf8");
29
- const ABSENT_REASON = (CI_STATE.match(/reasons\.push\(`([^`$]+)\$\{missing\.join/) ?? [])[1];
29
+ const ABSENT_REASON = (CI_STATE.match(/reasons\.push\(`([^`$]+)\$\{missing\./) ?? [])[1];
30
30
 
31
31
  // Each claim is ONE contiguous span (prose-pin.mjs's convention), because
32
32
  // keywords bound only by the slice were not enough: with the `pending`