@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
@@ -4,7 +4,7 @@ import { readFileSync } from "node:fs";
4
4
  import { join } from "node:path";
5
5
  import { stripComments } from "./strip-comments.mjs";
6
6
  import { between, paragraph, phrase, stripSlashGutter } from "./prose-pin.mjs";
7
- import { unrunReason, unrunEntries, unrunCrashed, FINDINGS_SCHEMA } from "./review-core.mjs";
7
+ import { unrunReason, unrunEntries, unrunCrashed, sharedRunNote, FINDINGS_SCHEMA, CRASHED_REASON } from "./review-core.mjs";
8
8
 
9
9
  // A dimension that crashed and a dimension that ran clean returned BYTE-
10
10
  // IDENTICAL shapes: `findings: []` either way, with the key listed in
@@ -13,6 +13,12 @@ import { unrunReason, unrunEntries, unrunCrashed, FINDINGS_SCHEMA } from "./revi
13
13
  // review branch at all — so a green run said nothing about it. This file is
14
14
  // that missing eye.
15
15
  //
16
+ // #2315: every run-quality verdict reads the review's ONE shared test run —
17
+ // `unrunReason(run, findings)`, `findings` being every finding that reached
18
+ // the payload, across all selected dimensions — because no specialist runs the
19
+ // full suite any more. The fixtures below are that run's shape: the caller's
20
+ // `command` plus the test-run agent's exit status and counts.
21
+ //
16
22
  // Pins read CODE, not SOURCE, wherever they read source text at all:
17
23
  // `stripComments` exists because two pins in this directory were MEASURED
18
24
  // vacuous against a field commented out with `/* */` (see strip-comments.mjs),
@@ -22,66 +28,50 @@ const REPO = join(import.meta.dirname, "..");
22
28
  const SOURCE = readFileSync(join(REPO, "scripts", "review-core.mjs"), "utf8");
23
29
  const CODE = stripComments(SOURCE);
24
30
 
25
- // #138's case. The `review &&` guard the ticket cites proves the author already
26
- // expects a falsy return here — spend limit, timeout, terminal error — and the
27
- // `[]` it produced was indistinguishable from a clean pass.
28
- test("a reviewer that returned nothing is unrun, and says why it might have", () => {
31
+ // #2315's no-counts case, from its two causes: the test-run dispatch returned
32
+ // nothing at all, or it returned without a count (crash, deadline, no
33
+ // summary). Neither is ever a pass.
34
+ test("a shared run that returned nothing is unrun, and says why", () => {
29
35
  for (const dead of [null, undefined, false, 0, ""]) {
30
- const reason = unrunReason(dead);
31
- assert.equal(typeof reason, "string", `a falsy review (${JSON.stringify(dead)}) must yield a reason`);
32
- assert.match(reason, /returned nothing/, "the reason no longer names a reviewer that returned nothing");
36
+ const reason = unrunReason(dead, []);
37
+ assert.equal(typeof reason, "string", `a falsy shared run (${JSON.stringify(dead)}) must yield a reason`);
38
+ assert.match(reason, /returned nothing/, "the reason no longer names a test run that returned nothing");
33
39
  }
34
40
  });
35
41
 
36
- // #137's case: the `'tests 0'` reading rule the specialist prompt already
37
- // states, given somewhere to land. The reason names the COMMAND, because
38
- // "0 tests" without it sends a reader hunting for which command produced them.
42
+ // #137's case: the `'tests 0'` reading rule, given somewhere to land. The
43
+ // reason names the COMMAND, because "0 tests" without it sends a reader
44
+ // hunting for which command produced them.
39
45
  test("a zero-test run is unrun, naming the command that produced no tests", () => {
40
- const reason = unrunReason({
41
- dimension: "tests",
42
- scope_searched: "the whole snapshot",
43
- findings: [],
44
- test_run: { command: "npm test --", tests: 0, pass: 0, fail: 0 },
45
- });
46
+ const reason = unrunReason({ command: "npm test --", tests: 0, pass: 0, fail: 0 }, []);
46
47
  assert.equal(typeof reason, "string", "a zero-test run must yield a reason");
47
48
  assert.match(reason, /npm test --/, "the reason no longer names the command that produced no tests");
49
+ assert.match(reason, /0 tests/);
48
50
  });
49
51
 
50
- // ABSENT or null is the same fact as `tests: 0` — nothing ran — and it is the
51
- // whole reason the check is `!run.tests` rather than `run.tests === 0`. Measured
52
- // unpinned: the narrower comparison passed all 737 tests in the repo.
53
- test("a test_run that reported no count at all is unrun", () => {
52
+ // ABSENT or null is "no counts", not `tests: 0`: the test-run agent is told to
53
+ // omit a count the log does not state, so an absent one is a run that printed
54
+ // no summary — and its `error` says why, which the reason must carry.
55
+ test("a shared run that reported no count at all is unrun, carrying the agent's error", () => {
54
56
  for (const run of [{ command: "npm test --" }, { command: "npm test --", tests: null }]) {
55
- const reason = unrunReason({ dimension: "tests", scope_searched: "x", findings: [], test_run: run });
56
- assert.equal(typeof reason, "string", `a countless test_run (${JSON.stringify(run)}) must yield a reason`);
57
+ const reason = unrunReason(run, [{ severity: "critical", claim: "x", evidence: "y" }]);
58
+ assert.equal(typeof reason, "string", `a countless run (${JSON.stringify(run)}) must yield a reason`);
59
+ assert.match(reason, /no counts/);
57
60
  }
58
- });
59
-
60
- // A specialist that ignored the schema is the same fact from a different
61
- // cause, and must not read as covered because the field it skipped is the one
62
- // being tested.
63
- test("a review reporting no test run at all is unrun", () => {
64
- const reason = unrunReason({ dimension: "types", scope_searched: "src/", findings: [] });
65
- assert.equal(typeof reason, "string", "a missing test_run must yield a reason");
66
- assert.match(reason, /no test run/, "the reason no longer says the reviewer reported no test run");
61
+ assert.match(unrunReason({ command: "npm test --", error: "hit the 1800 s deadline" }, []), /hit the 1800 s deadline/);
67
62
  });
68
63
 
69
64
  // THE REFUSAL SURFACE, and the half a suite fed only broken input cannot pin.
70
65
  // A new required field and a new unrun predicate are both refusal surfaces: a
71
- // specialist that legitimately has nothing to report must still come back
66
+ // review that legitimately has nothing to report must still come back
72
67
  // clean. Marking a genuinely clean dimension unrun re-runs work that was done
73
68
  // and teaches a controller to ignore the field — the same end state as not
74
69
  // having it.
75
- test("a clean review with an empty findings list is NOT unrun", () => {
70
+ test("a clean run with every dimension's findings list empty is NOT unrun", () => {
76
71
  assert.equal(
77
- unrunReason({
78
- dimension: "silent-failure",
79
- scope_searched: "grep -rn 'catch' over the diff's 4 files",
80
- findings: [],
81
- test_run: { command: "npm test --", tests: 12, pass: 12, fail: 0 },
82
- }),
72
+ unrunReason({ command: "npm test --", exitCode: 0, tests: 12, pass: 12, fail: 0 }, []),
83
73
  null,
84
- "a dimension that ran the suite and found nothing is clean, not unrun",
74
+ "a review whose shared run passed and found nothing is clean, not unrun",
85
75
  );
86
76
  });
87
77
 
@@ -89,38 +79,30 @@ test("a clean review with an empty findings list is NOT unrun", () => {
89
79
  // one class of test result that most needs reporting.
90
80
  test("a run with failing tests is NOT unrun", () => {
91
81
  assert.equal(
92
- unrunReason({
93
- dimension: "tests",
94
- scope_searched: "the snapshot's own suite",
95
- findings: [{ severity: "critical", claim: "x", evidence: "y" }],
96
- test_run: { command: "npm test --", tests: 14, pass: 11, fail: 3 },
97
- }),
82
+ unrunReason({ command: "npm test --", exitCode: 1, tests: 14, pass: 11, fail: 3 }, [{ severity: "critical", claim: "x", evidence: "y" }]),
98
83
  null,
99
84
  "a suite that reported failures still ran",
100
85
  );
101
86
  });
102
87
 
103
88
  // #143's all-skipped case, and the reason the clause reads `pass === 0 && !fail`
104
- // rather than the bare "zero passes" #143's body proposes. `skipped` is NOT a
105
- // declared field of `test_run` (see the schema pin below), and whether
106
- // `additionalProperties: false` drops such a field or rejects the whole object
107
- // is stated BOTH ways in this directory and is not settled here — either way it
108
- // never reaches this classifier, so a run where every test skipped can only
109
- // arrive as `pass: 0` with `fail` zero or absent. Nothing passed and nothing
110
- // failed is no work done.
89
+ // rather than the bare "zero passes" #143's body proposes: a run where every
90
+ // test skipped arrives as `pass: 0` with `fail` zero or absent (the shared run
91
+ // may also report `skipped`, but the verdict never needs it). Nothing passed
92
+ // and nothing failed is no work done.
111
93
  // BOTH arms of `findings`, because this clause is findings-INDEPENDENT by
112
94
  // design and only a non-empty fixture says so. The sibling `fail > 0` clause
113
- // below is the one that reads `findings`; ANDing `!review.findings?.length` in
114
- // here too would let a specialist that reports 0 passes and 0 fails and attaches
115
- // one filler finding read as clean — the loophole #143 exists to close. Every
116
- // fixture here sent `[]`, so that mutation survived the whole suite.
95
+ // below is the one that reads `findings`; ANDing a findings check in here too
96
+ // would let a review that reports 0 passes and 0 fails and attaches one filler
97
+ // finding read as clean — the loophole #143 exists to close. Every fixture
98
+ // here once sent `[]`, so that mutation survived the whole suite.
117
99
  test("a run where nothing passed and nothing failed is unrun — every test skipped", () => {
118
100
  for (const findings of [[], [{ severity: "suggestion", claim: "x", evidence: "y" }]]) {
119
101
  for (const run of [
120
102
  { command: "node --test", tests: 2, pass: 0, fail: 0 },
121
103
  { command: "node --test", tests: 2, pass: 0 },
122
104
  ]) {
123
- const reason = unrunReason({ dimension: "tests", scope_searched: "x", findings, test_run: run });
105
+ const reason = unrunReason(run, findings);
124
106
  const where = `${JSON.stringify(run)} with ${findings.length} findings`;
125
107
  assert.equal(typeof reason, "string", `an all-skipped run (${where}) must yield a reason`);
126
108
  assert.match(reason, /node --test/, "the reason no longer names the command that did no work");
@@ -141,7 +123,7 @@ test("a run that executed a fraction of what it collected is unrun, not clean",
141
123
  { command: "node --test", tests: 937, pass: 1 },
142
124
  { command: "node --test", tests: 937, pass: 468, fail: 0 },
143
125
  ]) {
144
- const reason = unrunReason({ dimension: "tests", scope_searched: "x", findings, test_run: run });
126
+ const reason = unrunReason(run, findings);
145
127
  const where = `${JSON.stringify(run)} with ${findings.length} findings`;
146
128
  assert.equal(typeof reason, "string", `a mostly-unexecuted run (${where}) must yield a reason`);
147
129
  assert.match(reason, /node --test/, "the reason no longer names the command that ran a fraction of its collection");
@@ -160,13 +142,13 @@ test("a run that executed a fraction of what it collected is unrun, not clean",
160
142
  // `typeof` guard stops that from reading as no work.
161
143
  test("a small-but-complete run, a half-todo run, and one that omitted pass are NOT unrun", () => {
162
144
  for (const run of [
163
- { command: "node --test", tests: 3, pass: 3, fail: 0 },
164
- { command: "node --test", tests: 937, pass: 937, fail: 0 },
165
- { command: "node --test", tests: 2, pass: 1, fail: 0 },
166
- { command: "node --test", tests: 937, pass: null },
145
+ { command: "node --test", exitCode: 0, tests: 3, pass: 3, fail: 0 },
146
+ { command: "node --test", exitCode: 0, tests: 937, pass: 937, fail: 0 },
147
+ { command: "node --test", exitCode: 0, tests: 2, pass: 1, fail: 0 },
148
+ { command: "node --test", exitCode: 0, tests: 937, pass: null },
167
149
  ]) {
168
150
  assert.equal(
169
- unrunReason({ dimension: "tests", scope_searched: "the snapshot's own suite", findings: [], test_run: run }),
151
+ unrunReason(run, []),
170
152
  null,
171
153
  `a run that did its work (${JSON.stringify(run)}) must stay clean`,
172
154
  );
@@ -180,12 +162,7 @@ test("a small-but-complete run, a half-todo run, and one that omitted pass are N
180
162
  // off it.
181
163
  test("a fully-executed failing run is NOT unrun by the ratio — a suite that failed ran", () => {
182
164
  assert.equal(
183
- unrunReason({
184
- dimension: "tests",
185
- scope_searched: "the snapshot's own suite",
186
- findings: [{ severity: "critical", claim: "x", evidence: "y" }],
187
- test_run: { command: "node --test", tests: 10, pass: 4, fail: 6 },
188
- }),
165
+ unrunReason({ command: "node --test", exitCode: 1, tests: 10, pass: 4, fail: 6 }, [{ severity: "critical", claim: "x", evidence: "y" }]),
189
166
  null,
190
167
  "a suite that reported failures still ran, having executed everything it collected",
191
168
  );
@@ -203,7 +180,7 @@ test("a run that executed a fraction of what it collected through a MIX of pass
203
180
  { command: "node --test", tests: 937, pass: 1, fail: 1 },
204
181
  { command: "node --test", tests: 937, pass: 200, fail: 200 },
205
182
  ]) {
206
- const reason = unrunReason({ dimension: "tests", scope_searched: "x", findings, test_run: run });
183
+ const reason = unrunReason(run, findings);
207
184
  const where = `${JSON.stringify(run)} with ${findings.length} findings`;
208
185
  assert.equal(typeof reason, "string", `a mostly-unexecuted mixed run (${where}) must yield a reason`);
209
186
  assert.match(reason, /node --test/, "the reason no longer names the command that ran a fraction of its collection");
@@ -217,12 +194,7 @@ test("a run that executed a fraction of what it collected through a MIX of pass
217
194
  // cannot be the thing keeping this clean — only the ratio is under test here.
218
195
  test("a mixed pass/fail run that executed past half its collection is NOT unrun", () => {
219
196
  assert.equal(
220
- unrunReason({
221
- dimension: "tests",
222
- scope_searched: "the snapshot's own suite",
223
- findings: [{ severity: "critical", claim: "x", evidence: "y" }],
224
- test_run: { command: "node --test", tests: 937, pass: 300, fail: 300 },
225
- }),
197
+ unrunReason({ command: "node --test", exitCode: 1, tests: 937, pass: 300, fail: 300 }, [{ severity: "critical", claim: "x", evidence: "y" }]),
226
198
  null,
227
199
  "a mixed run past the half floor did its work",
228
200
  );
@@ -237,12 +209,7 @@ test("a mixed pass/fail run that executed past half its collection is NOT unrun"
237
209
  // tell those two apart.
238
210
  test("a run where every test failed is NOT unrun, even though nothing passed", () => {
239
211
  assert.equal(
240
- unrunReason({
241
- dimension: "tests",
242
- scope_searched: "the snapshot's own suite",
243
- findings: [{ severity: "critical", claim: "x", evidence: "y" }],
244
- test_run: { command: "npm test --", tests: 3, pass: 0, fail: 3 },
245
- }),
212
+ unrunReason({ command: "npm test --", exitCode: 1, tests: 3, pass: 0, fail: 3 }, [{ severity: "critical", claim: "x", evidence: "y" }]),
246
213
  null,
247
214
  "a suite that reported only failures still ran",
248
215
  );
@@ -250,37 +217,71 @@ test("a run where every test failed is NOT unrun, even though nothing passed", (
250
217
 
251
218
  // #143's third case, deferred there from the #526 review. `fail > 0` on its own
252
219
  // is a suite that ran, pinned clean above and deliberately so; the contradiction
253
- // is the CONJUNCTION with an empty findings list — the suite ran, it reported
254
- // failures, and the reviewer filed nothing about them. `findings` is required by
255
- // the schema, so the undefined arm covers a specialist that ignored it rather
256
- // than a shape the schema permits.
257
- test("a run with failing tests and no findings at all is unrun", () => {
258
- for (const findings of [[], undefined]) {
259
- const reason = unrunReason({
260
- dimension: "tests",
261
- scope_searched: "the snapshot's own suite",
262
- findings,
263
- test_run: { command: "node --test", tests: 744, pass: 738, fail: 6 },
264
- });
220
+ // is the CONJUNCTION with no findings — the suite ran, it reported failures,
221
+ // and nobody filed anything about them. #2315 widened "nobody" from one
222
+ // dimension to the whole review: the shared run's failures are the review's,
223
+ // so EVERY finding that reached the payload is read — and a refuted one does
224
+ // not count, because the review rejected it (an unrelated claim its verifiers
225
+ // threw out is not a report of the failures). Cancelled tests are failures
226
+ // too: node's runner exits 1 on one with `fail 0`.
227
+ test("a run with failing or cancelled tests and no kept finding from ANY dimension is unrun", () => {
228
+ const refutedOnly = [{ severity: "critical", claim: "x", evidence: "y", verdict: "refuted" }];
229
+ for (const findings of [[], [null], refutedOnly]) {
230
+ const reason = unrunReason({ command: "node --test", exitCode: 1, tests: 744, pass: 738, fail: 6 }, findings);
265
231
  assert.equal(typeof reason, "string", `fail>0 with findings ${JSON.stringify(findings)} must yield a reason`);
266
232
  assert.match(reason, /6 failing tests/, "the reason no longer says how many tests failed unreported");
233
+ assert.match(reason, /no selected dimension/);
234
+ }
235
+ const cancelled = unrunReason({ command: "node --test", exitCode: 1, tests: 744, pass: 743, fail: 0, cancelled: 1 }, refutedOnly);
236
+ assert.match(cancelled ?? "", /0 failing and 1 cancelled tests and no selected dimension/, "a cancelled test nobody reported must not read clean");
237
+ // The boundary: ONE failing test is failures nobody reported, and one kept
238
+ // finding settles it — a `> 1` threshold would read the first clean.
239
+ const one = { command: "node --test", exitCode: 1, tests: 10, pass: 9, fail: 1 };
240
+ assert.match(unrunReason(one, []) ?? "", /1 failing tests and no selected dimension/, "a single failing test nobody reported read clean");
241
+ assert.equal(unrunReason(one, [{ severity: "suggestion", claim: "x", evidence: "y", verdict: "unverified" }]), null);
242
+ });
243
+
244
+ // The ACCEPT side, and #2315's ownership rule: one finding from ANY dimension
245
+ // satisfies the check for the whole review — the other dimensions are told not
246
+ // to file a duplicate, so reading each dimension's own list would mark every
247
+ // one of them unrun for obeying that.
248
+ test("a run with failing tests and a finding from ONE dimension is NOT unrun", () => {
249
+ const run = { command: "node --test", exitCode: 1, tests: 744, pass: 738, fail: 6 };
250
+ for (const verdict of [undefined, "survived", "unverified"]) {
251
+ const one = [{ severity: "critical", claim: "x", evidence: "y", verdict }];
252
+ assert.equal(unrunReason(run, one), null, `a ${verdict ?? "bare"} finding about the failures must satisfy every dimension`);
253
+ assert.deepEqual(unrunEntries(run, one, ["correctness", "tests", "types"]), []);
267
254
  }
255
+ // A cancelled test routes the same way: one kept finding settles it.
256
+ assert.equal(unrunReason({ ...run, fail: 0, cancelled: 2, pass: 742 }, [{ severity: "suggestion", claim: "x", evidence: "y", verdict: "unverified" }]), null);
268
257
  });
269
258
 
270
- // `pass`/`fail` are optional (see the schema pin below), so a run that reported
271
- // only a count must still come back clean rather than tripping the predicate on
272
- // a field it was never required to send.
259
+ // `pass`/`fail` are optional, so a run that reported only a count must still
260
+ // come back clean rather than tripping the predicate on a field the runner
261
+ // never printed.
273
262
  test("a run that reported tests but not pass/fail is NOT unrun", () => {
274
- assert.equal(
275
- unrunReason({
276
- dimension: "comments",
277
- scope_searched: "every added comment in the diff",
278
- findings: [],
279
- test_run: { command: "node --test", tests: 7 },
280
- }),
281
- null,
282
- "an optional field's absence must not mark a real run unrun",
283
- );
263
+ assert.equal(unrunReason({ command: "node --test", exitCode: 0, tests: 7 }, []), null, "an optional field's absence must not mark a real run unrun");
264
+ });
265
+
266
+ // The exit status is the command's own verdict, and the counts must account
267
+ // for it. A run reporting none, or exiting non-zero with nothing failing or
268
+ // cancelled, is unusable whatever its counts say — and findings cannot buy it
269
+ // clean, because nothing in it names a failure to report.
270
+ test("a run whose exit status is missing, or non-zero with no failing count, is unrun", () => {
271
+ const finding = [{ severity: "critical", claim: "x", evidence: "y", verdict: "survived" }];
272
+ for (const [run, pattern] of [
273
+ [{ command: "node --test", tests: 10, pass: 10, fail: 0 }, /no exit status/],
274
+ [{ command: "node --test", exitCode: null, tests: 10, pass: 10 }, /no exit status/],
275
+ [{ command: "node --test", exitCode: 1, tests: 10, pass: 10, fail: 0 }, /exited 1 but reported no failing or cancelled tests/],
276
+ [{ command: "node --test", exitCode: 137, tests: 10, pass: 10 }, /exited 137/],
277
+ ]) {
278
+ for (const findings of [[], finding]) {
279
+ const reason = unrunReason(run, findings);
280
+ assert.equal(typeof reason, "string", `${JSON.stringify(run)} must yield a reason`);
281
+ assert.match(reason, pattern);
282
+ assert.match(reason, /node --test/, "the reason no longer names the command");
283
+ }
284
+ }
284
285
  });
285
286
 
286
287
  // #139: the description at `:37` called `scope_searched` **Required** while the
@@ -305,7 +306,7 @@ test("test_run is declared, carries the command and count, and does not force pa
305
306
  }
306
307
  assert.ok(Array.isArray(testRun.required), "test_run no longer names which of its fields are required — update this test");
307
308
  assert.ok(testRun.required.includes("command"), "test_run.command must be required — a count with no command bounds nothing");
308
- assert.ok(testRun.required.includes("tests"), "test_run.tests must be required — it is the field the unrun rule reads");
309
+ assert.ok(testRun.required.includes("tests"), "test_run.tests must be required — it is the count every specialist copies from the shared run");
309
310
  // A runner whose output does not split pass from fail must not be forced to
310
311
  // invent numbers: an unanswerable required field is answered with a guess,
311
312
  // and a guessed count is worse than an absent one.
@@ -314,32 +315,20 @@ test("test_run is declared, carries the command and count, and does not force pa
314
315
  }
315
316
  });
316
317
 
317
- // Wiring, not classification. `unrunReason` can be correct and reach nobody:
318
- // the review object it reads is in scope for exactly one closure — the verify
319
- // stage's `(review, d)` — and `reviewed` below is findings, flattened, with the
320
- // per-dimension envelope already gone. If the recording is not in that closure
321
- // it cannot be anywhere.
322
- function verifyStage() {
323
- return between(CODE, "(review, d) =>", "const n = verifiersFor", "the verify stage");
324
- }
325
-
326
- // The entry, not the call site. `unrunEntries` returns zero or one, so both
327
- // writers `push(...)` it with no guard of their own — and a guard is exactly what
328
- // the predecessor of this test could not see: it compared the source positions of
329
- // two substrings, so wrapping the recording in `if (review && why)` left both in
330
- // place, kept the suite green, and silently dropped every crashed dimension.
331
- test("an unrun classification becomes an entry with no guard for a caller to get wrong", () => {
332
- const entries = unrunEntries(null, "tests");
333
- assert.equal(entries.length, 1, "a falsy review must yield exactly one entry — nothing else records #138's cause");
334
- assert.equal(entries[0].dimension, "tests", "the entry no longer names the dimension it was asked about");
335
- assert.match(entries[0].reason, /returned nothing/, "the entry no longer carries the classifier's reason");
318
+ // The entry, not the call site. `unrunEntries` returns zero entries or one per
319
+ // key, so its writer `push(...)`es it with no guard of its own — and a guard is
320
+ // exactly what the predecessor of this test could not see: it compared the
321
+ // source positions of two substrings, so wrapping the recording in
322
+ // `if (review && why)` left both in place, kept the suite green, and silently
323
+ // dropped every crashed dimension.
324
+ test("an unrun classification becomes one entry per key, with no guard for a caller to get wrong", () => {
325
+ const entries = unrunEntries(null, [], ["correctness", "tests"]);
326
+ assert.deepEqual(entries.map((e) => e.dimension), ["correctness", "tests"], "a dead shared run must name EVERY key it was asked about");
327
+ for (const e of entries) assert.match(e.reason, /returned nothing/, "the entry no longer carries the classifier's reason");
336
328
  assert.deepEqual(
337
- unrunEntries(
338
- { dimension: "tests", scope_searched: "x", findings: [], test_run: { command: "npm test --", tests: 9 } },
339
- "tests",
340
- ),
329
+ unrunEntries({ command: "npm test --", exitCode: 0, tests: 9 }, [], ["tests"]),
341
330
  [],
342
- "a covered dimension must yield NO entry — an empty push is what lets both call sites stay unguarded",
331
+ "a covered review must yield NO entry — an empty push is what lets the call site stay unguarded",
343
332
  );
344
333
  });
345
334
 
@@ -357,7 +346,8 @@ test("a dimension whose chain died is recorded unrun, by index, from the pipelin
357
346
  ["tests"],
358
347
  "a null pipeline slot must record ITS dimension unrun, and only it (#138)",
359
348
  );
360
- assert.match(unrun[0].reason, /returned nothing/, "the crashed dimension's reason no longer names a reviewer that returned nothing");
349
+ assert.equal(unrun[0].reason, CRASHED_REASON, "the crashed dimension's reason no longer names a reviewer that returned nothing");
350
+ assert.match(CRASHED_REASON, /returned nothing/);
361
351
  assert.deepEqual(
362
352
  unrunCrashed([[], [], []], dimensions),
363
353
  [],
@@ -378,25 +368,25 @@ test("a null slot the dimension list cannot explain is still reported, never thr
378
368
  });
379
369
 
380
370
  // Wiring, not classification — and textual, because it has to be. Both writers
381
- // are executable above; whether the SCRIPT calls them is not, since the file is a
382
- // workflow body the harness executes and nothing here can run it. Stated ceiling:
383
- // this sees a call deleted or moved, and does not see one wrapped in a guard of
384
- // its own. That is why the classification moved behind two lifted functions —
385
- // the pin it replaced had source positions as its only evidence.
386
- test("both halves are wired in: the verify stage, and the pipeline result the stage cannot see", () => {
387
- const stage = verifyStage();
388
- const asked = stage.indexOf("dimensionsUnrun.push(...unrunEntries(review, d.key))");
389
- assert.notEqual(asked, -1, "the verify stage no longer records #137's half — a reviewer that ran no suite reads clean");
390
- const deref = stage.indexOf("review && review.findings");
391
- assert.notEqual(deref, -1, "the findings guard moved — update this test");
392
- assert.ok(asked < deref, "the recording sits behind the falsy-review guard, which already reads a dead reviewer as clean (#138)");
371
+ // are executable above; whether runReview calls them is pinned here. Stated
372
+ // ceiling: this sees a call deleted or moved, and does not see one wrapped in a
373
+ // guard of its own. That is why the classification moved behind lifted
374
+ // functions — the pin it replaced had source positions as its only evidence.
375
+ // runReview's own behaviour over a scripted host is review-core-shared-test-run.test.mjs's.
376
+ test("both writers are wired in AFTER the pipeline, the failing-tests check reading the payload's findings", () => {
393
377
  // AFTER the pipeline returns, never inside a stage: a stage cannot observe its
394
- // own absence, which is the entire reason #138 shipped as dead code once.
378
+ // own absence (#138), and the failing-tests check needs every dimension's
379
+ // findings at once (#2315).
395
380
  const call = CODE.indexOf("const reviewed = await pipeline(");
396
381
  assert.notEqual(call, -1, "the pipeline call moved — update this test");
397
- const derived = CODE.indexOf("dimensionsUnrun.push(...unrunCrashed(reviewed, dimensions))");
398
- assert.notEqual(derived, -1, "nothing derives the crashed dimensions from the pipeline result — #138 is unreachable again");
399
- assert.ok(call < derived, "the derivation runs before the pipeline returns, where its result does not exist yet");
382
+ for (const writer of [
383
+ "dimensionsUnrun.push(...unrunEntries(sharedRun, all, live))",
384
+ "dimensionsUnrun.push(...unrunCrashed(reviewed, dimensions))",
385
+ ]) {
386
+ const at = CODE.indexOf(writer);
387
+ assert.notEqual(at, -1, `\`${writer}\` is gone — a half of dimensionsUnrun is unreachable again`);
388
+ assert.ok(call < at, `\`${writer}\` runs before the pipeline returns, where its input does not exist yet`);
389
+ }
400
390
  });
401
391
 
402
392
  test("the returned object carries dimensionsUnrun alongside dimensionsRun", () => {
@@ -415,23 +405,19 @@ test("the returned object carries dimensionsUnrun alongside dimensionsRun", () =
415
405
 
416
406
  // The schema field is inert unless the prompt points at it — the specialists
417
407
  // are what fill it in, and a field nothing asks for comes back absent from
418
- // every one of them.
419
- //
420
- // #143 records the gap this pin closes: `review-pr-testcmd.test.mjs` pins the
421
- // RULING (`'tests 0' is a FAILED run`) and nothing pins the FOLLOW-THROUGH, so
422
- // the sentence saying what to DO about a zero-test run could be deleted with
423
- // the suite green. This edit rewrites that sentence; pin it where it now lands.
424
- test("the specialist prompt names test_run as where a zero-test run gets reported", () => {
425
- const prompt = between(CODE, "READ ONLY FROM THE SNAPSHOT", "Scratch files go in", "the specialist prompt");
426
- assert.match(prompt, /test_run/, "the prompt never names test_run, so nothing fills the field the schema requires");
427
- // The instruction that matters is reporting the run that produced NOTHING. A
428
- // specialist that reports only successful runs leaves `test_run` absent in
429
- // exactly the case the field exists for.
430
- assert.match(
431
- prompt,
432
- /even when it (failed|produced)|produced nothing/,
433
- "the prompt no longer tells specialists to report a run that failed or produced nothing",
434
- );
408
+ // every one of them. #2315 moved the instruction into `sharedRunNote`, the
409
+ // Tests paragraph every specialist prompt interpolates, and what it says now is
410
+ // to COPY the shared run — including a run that stated no counts.
411
+ test("the shared-run note names test_run as where the shared run gets reported, even one with no counts", () => {
412
+ for (const run of [
413
+ { command: "node --test", logPath: "/r/test-run.log", tests: 5, pass: 5, fail: 0 },
414
+ { command: "node --test", logPath: "/r/test-run.log", error: "no summary" },
415
+ ]) {
416
+ const note = sharedRunNote(run, "correctness", "tests");
417
+ assert.match(note, /`test_run`/, "the note never names test_run, so nothing fills the field the schema requires");
418
+ assert.match(note, /`tests: 0` when it states\s+none/, "the note no longer says what to report for a run with no counts");
419
+ assert.match(note, /never a run of your own/);
420
+ }
435
421
  });
436
422
 
437
423
  // The workflow's return shape is documented in one place a controller actually