@feigi/fleet-ctl 3.23.35 → 3.23.37

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 (204) hide show
  1. package/package.json +1 -1
  2. package/scripts/main-checkout.mjs +1 -1
  3. package/scripts/member-write-guard.mjs +1 -1
  4. package/scripts/repo-root.mjs +1 -1
  5. package/skills/run-team/references/reaping.md +1 -1
  6. package/scripts/agent-test-dir-prose.test.mjs +0 -59
  7. package/scripts/agent-test.test.mjs +0 -1640
  8. package/scripts/ambient-git-vars-mjs-prose.test.mjs +0 -397
  9. package/scripts/ambient-git-vars-prose.test.mjs +0 -192
  10. package/scripts/ancestry-check-position-prose.test.mjs +0 -175
  11. package/scripts/apply-ruleset.test.mjs +0 -421
  12. package/scripts/arg-header-probes-prose.test.mjs +0 -394
  13. package/scripts/arg.test.mjs +0 -1354
  14. package/scripts/board-cli.test.mjs +0 -710
  15. package/scripts/board-identity.test.mjs +0 -429
  16. package/scripts/board-liveness-banner.test.mjs +0 -119
  17. package/scripts/board-prev-shape.test.mjs +0 -228
  18. package/scripts/board-tryparse-null.test.mjs +0 -119
  19. package/scripts/board.test.mjs +0 -3121
  20. package/scripts/brief-after-cut-prose.test.mjs +0 -53
  21. package/scripts/candidates-exit3-prose.test.mjs +0 -302
  22. package/scripts/candidates.test.mjs +0 -2312
  23. package/scripts/caveat-unification-prose.test.mjs +0 -98
  24. package/scripts/cell-readout.test.mjs +0 -615
  25. package/scripts/ci-comment-rot-prose.test.mjs +0 -2025
  26. package/scripts/ci-completes-premise-prose.test.mjs +0 -257
  27. package/scripts/ci-state-prose.test.mjs +0 -113
  28. package/scripts/ci-state.test.mjs +0 -1933
  29. package/scripts/ci-vacuous-green.test.mjs +0 -368
  30. package/scripts/citation-sweep-prose.test.mjs +0 -1712
  31. package/scripts/claim-lifecycle.test.mjs +0 -187
  32. package/scripts/claim-ticket.test.mjs +0 -1122
  33. package/scripts/closing-keyword-prose.test.mjs +0 -193
  34. package/scripts/cockpit-launch-idempotent-prose.test.mjs +0 -165
  35. package/scripts/cockpit-tick-nonblocking.test.mjs +0 -210
  36. package/scripts/compute-board.test.mjs +0 -1214
  37. package/scripts/compute-spend.test.mjs +0 -517
  38. package/scripts/consumer-technology-prose.test.mjs +0 -126
  39. package/scripts/cross-repo-citation-prose.test.mjs +0 -155
  40. package/scripts/cwd-isolation-pins.mjs +0 -83
  41. package/scripts/dedupe-guard-prose.test.mjs +0 -243
  42. package/scripts/delete-merged-branch.test.mjs +0 -576
  43. package/scripts/derive-testcmd.test.mjs +0 -595
  44. package/scripts/diff-stats.test.mjs +0 -404
  45. package/scripts/dispatch-block-golden-prose.test.mjs +0 -1130
  46. package/scripts/dispatch-block-pins-prose.test.mjs +0 -615
  47. package/scripts/dispositions-check.test.mjs +0 -936
  48. package/scripts/dispositions-gate-prose.test.mjs +0 -129
  49. package/scripts/drop-merged-label.test.mjs +0 -479
  50. package/scripts/exec-stub.mjs +0 -93
  51. package/scripts/exec-stub.test.mjs +0 -69
  52. package/scripts/expected-jobs-prose.test.mjs +0 -80
  53. package/scripts/fan-out-authorization-prose.test.mjs +0 -80
  54. package/scripts/filing-bar-seat-prose.test.mjs +0 -242
  55. package/scripts/filing-claim-bar-prose.test.mjs +0 -166
  56. package/scripts/finisher-died-prose.test.mjs +0 -31
  57. package/scripts/finisher-dispatch-premise-prose.test.mjs +0 -312
  58. package/scripts/finisher-halt-prose.test.mjs +0 -106
  59. package/scripts/finisher-name-prose.test.mjs +0 -134
  60. package/scripts/finisher-own-tree-prose.test.mjs +0 -299
  61. package/scripts/finisher-pin-race-prose.test.mjs +0 -339
  62. package/scripts/finisher-test-verdict-prose.test.mjs +0 -102
  63. package/scripts/fix-applier-correction-rules-prose.test.mjs +0 -202
  64. package/scripts/fix-applier-result-file-prose.test.mjs +0 -149
  65. package/scripts/fleet-bootstrap.test.mjs +0 -75
  66. package/scripts/fleet-heartbeat.test.mjs +0 -450
  67. package/scripts/fleet-provenance.test.mjs +0 -138
  68. package/scripts/fleet-run.test.mjs +0 -90
  69. package/scripts/fleet-state.test.mjs +0 -460
  70. package/scripts/fleet-tick-prose.test.mjs +0 -300
  71. package/scripts/fleet-tick.test.mjs +0 -2444
  72. package/scripts/force-with-lease-reason-prose.test.mjs +0 -184
  73. package/scripts/frontmatter-check.test.mjs +0 -436
  74. package/scripts/git-env.test.mjs +0 -149
  75. package/scripts/git-status-untracked-mode-sweep.test.mjs +0 -216
  76. package/scripts/gone-walk.test.mjs +0 -213
  77. package/scripts/gp-sep-invariant-prose.test.mjs +0 -188
  78. package/scripts/head-moved-after-label-prose.test.mjs +0 -233
  79. package/scripts/immutable-body-claim-prose.test.mjs +0 -204
  80. package/scripts/implementer-model-tier.test.mjs +0 -235
  81. package/scripts/inflight-citation-prose.test.mjs +0 -144
  82. package/scripts/inflight-exit2-prose.test.mjs +0 -81
  83. package/scripts/inflight-probe-guard-prose.test.mjs +0 -109
  84. package/scripts/inflight-scan-scope-prose.test.mjs +0 -57
  85. package/scripts/inflight.test.mjs +0 -2882
  86. package/scripts/injection-control-prose.test.mjs +0 -404
  87. package/scripts/install-root-audit.test.mjs +0 -464
  88. package/scripts/instrument-check-prose.test.mjs +0 -235
  89. package/scripts/instruments.test.mjs +0 -787
  90. package/scripts/is-cli.test.mjs +0 -99
  91. package/scripts/issue-tracker-prose.test.mjs +0 -71
  92. package/scripts/json.test.mjs +0 -364
  93. package/scripts/ledger-dispatch.test.mjs +0 -927
  94. package/scripts/ledger-grammar.test.mjs +0 -227
  95. package/scripts/ledger-read-require-file.test.mjs +0 -197
  96. package/scripts/ledger-rotate.test.mjs +0 -142
  97. package/scripts/ledger.test.mjs +0 -3436
  98. package/scripts/line-distance-prose.test.mjs +0 -245
  99. package/scripts/liveness-rationale-prose.test.mjs +0 -83
  100. package/scripts/locale-pin-prose.test.mjs +0 -189
  101. package/scripts/main-checkout.test.mjs +0 -332
  102. package/scripts/member-outcome-prose.test.mjs +0 -167
  103. package/scripts/member-outcomes-header.test.mjs +0 -129
  104. package/scripts/member-outcomes-prose.test.mjs +0 -63
  105. package/scripts/member-outcomes.test.mjs +0 -638
  106. package/scripts/member-prompt-prose.test.mjs +0 -165
  107. package/scripts/member-record.test.mjs +0 -541
  108. package/scripts/member-write-guard.test.mjs +0 -214
  109. package/scripts/merge-commit-probe-prose.test.mjs +0 -122
  110. package/scripts/merge-gate.test.mjs +0 -613
  111. package/scripts/muted-git-guard-sweep.test.mjs +0 -493
  112. package/scripts/net-ssh-precedence-prose.test.mjs +0 -91
  113. package/scripts/net-watchdog-prose.test.mjs +0 -79
  114. package/scripts/net.test.mjs +0 -211
  115. package/scripts/no-ci-gate-prose.test.mjs +0 -108
  116. package/scripts/no-undo-audit.test.mjs +0 -3961
  117. package/scripts/no-wave.test.mjs +0 -138
  118. package/scripts/node-floor-sweep.test.mjs +0 -611
  119. package/scripts/pointer-target-prose.test.mjs +0 -186
  120. package/scripts/pr-cost.test.mjs +0 -521
  121. package/scripts/pr-overlap.test.mjs +0 -692
  122. package/scripts/printf-die-sweep.test.mjs +0 -384
  123. package/scripts/prompt-renderer.mjs +0 -40
  124. package/scripts/prompt-renderer.test.mjs +0 -68
  125. package/scripts/prose-pin.mjs +0 -807
  126. package/scripts/prose-pin.test.mjs +0 -1034
  127. package/scripts/prove-merge.test.mjs +0 -995
  128. package/scripts/pull-table-relabel-prose.test.mjs +0 -60
  129. package/scripts/quiet-payload-prose.test.mjs +0 -222
  130. package/scripts/reap-cherry-check-prose.test.mjs +0 -80
  131. package/scripts/reap.test.mjs +0 -4432
  132. package/scripts/reaping-prose.test.mjs +0 -239
  133. package/scripts/reaping-reap-authorizers-prose.test.mjs +0 -112
  134. package/scripts/reaping-release-authorizers-prose.test.mjs +0 -85
  135. package/scripts/recipe-derivation-prose.test.mjs +0 -112
  136. package/scripts/recipe-prove.test.mjs +0 -1042
  137. package/scripts/refuter-scratch-prose.test.mjs +0 -135
  138. package/scripts/release-label-required-prose.test.mjs +0 -71
  139. package/scripts/release-label-split-prose.test.mjs +0 -184
  140. package/scripts/release-ticket-reap-pairing-prose.test.mjs +0 -63
  141. package/scripts/release-ticket.test.mjs +0 -5099
  142. package/scripts/renovate-release-contract.test.mjs +0 -379
  143. package/scripts/repo-root.test.mjs +0 -873
  144. package/scripts/reporter-output-rule-prose.test.mjs +0 -208
  145. package/scripts/review-agent-report-only.test.mjs +0 -49
  146. package/scripts/review-core-booking.test.mjs +0 -35
  147. package/scripts/review-core-cwd-isolation.test.mjs +0 -374
  148. package/scripts/review-core-reads.test.mjs +0 -478
  149. package/scripts/review-core-refuter-scratch.test.mjs +0 -148
  150. package/scripts/review-core-scratch-refusal.test.mjs +0 -64
  151. package/scripts/review-core-shared-test-run.test.mjs +0 -275
  152. package/scripts/review-core-snapshot-path.test.mjs +0 -830
  153. package/scripts/review-core-specialist-scratch.test.mjs +0 -191
  154. package/scripts/review-core-testcmd.test.mjs +0 -335
  155. package/scripts/review-core-unrun.test.mjs +0 -566
  156. package/scripts/review-core-unverified-discriminant.test.mjs +0 -208
  157. package/scripts/review-eval-resolver-path.test.mjs +0 -55
  158. package/scripts/review-host-fixture.mjs +0 -89
  159. package/scripts/review-in-run-retry.test.mjs +0 -211
  160. package/scripts/review-no-vendor-dispatch.test.mjs +0 -45
  161. package/scripts/review-path-default.test.mjs +0 -796
  162. package/scripts/review-runner-spawns.test.mjs +0 -95
  163. package/scripts/review-runner.test.mjs +0 -166
  164. package/scripts/review-tier-audit.test.mjs +0 -140
  165. package/scripts/run-artifact-pr-prose.test.mjs +0 -341
  166. package/scripts/run-merge-bot-prose.test.mjs +0 -1413
  167. package/scripts/run-team-local-hook.test.mjs +0 -442
  168. package/scripts/scratch-partition-invariant-prose.test.mjs +0 -74
  169. package/scripts/scripts-path-citation-sweep.test.mjs +0 -73
  170. package/scripts/section-between-guard-prose.test.mjs +0 -379
  171. package/scripts/select-dimensions.test.mjs +0 -674
  172. package/scripts/shared-refusal.test.mjs +0 -388
  173. package/scripts/shell-traps-prose.test.mjs +0 -504
  174. package/scripts/shortlist.test.mjs +0 -380
  175. package/scripts/slow-transport.mjs +0 -72
  176. package/scripts/snapshot-repo.test.mjs +0 -1006
  177. package/scripts/snapshot-runner-audience-prose.test.mjs +0 -130
  178. package/scripts/spend-view.test.mjs +0 -312
  179. package/scripts/staleness-qualifier-prose.test.mjs +0 -251
  180. package/scripts/staleness-verdict-prose.test.mjs +0 -142
  181. package/scripts/staleness.test.mjs +0 -893
  182. package/scripts/stalled-member-liveness-prose.test.mjs +0 -219
  183. package/scripts/stash-prohibition-prose.test.mjs +0 -313
  184. package/scripts/strip-comments.mjs +0 -44
  185. package/scripts/temp-dir.mjs +0 -47
  186. package/scripts/ticket-router.test.mjs +0 -981
  187. package/scripts/tier-check.test.mjs +0 -828
  188. package/scripts/tier-outcomes-header.test.mjs +0 -518
  189. package/scripts/tier-outcomes.test.mjs +0 -572
  190. package/scripts/tier-roles.test.mjs +0 -535
  191. package/scripts/tracker-block-copy-prose.test.mjs +0 -288
  192. package/scripts/triage-labels-gloss-prose.test.mjs +0 -97
  193. package/scripts/unattended-git-sweep.test.mjs +0 -142
  194. package/scripts/verify-sha-exit2-prose.test.mjs +0 -269
  195. package/scripts/verify-sha.test.mjs +0 -692
  196. package/scripts/watcher-degraded-block.test.mjs +0 -369
  197. package/scripts/watcher-key-prose.test.mjs +0 -106
  198. package/scripts/within-run-pair-prose.test.mjs +0 -212
  199. package/scripts/worktree-audit.test.mjs +0 -1408
  200. package/scripts/worktree-head-prose.test.mjs +0 -276
  201. package/scripts/worktree-listing-sweep.test.mjs +0 -217
  202. package/scripts/worktree-model-prose.test.mjs +0 -216
  203. package/scripts/worktree-porcelain.mjs +0 -35
  204. package/scripts/worktree-porcelain.test.mjs +0 -102
@@ -1,64 +0,0 @@
1
- // #2323. `runReview` owns the review side's `pr<N>/` partition: it appends
2
- // `/pr${pr}` to the scratch it is given. A caller that already did so (the
3
- // run-team skill once read as telling the controller to pass `<scratch>/pr<N>`)
4
- // nested every run root at `<root>/pr<N>/pr<N>/run-*`, which a correctly scoped
5
- // review's prune never reaches. So a scratch whose LAST component — after `.`
6
- // segments and repeated or trailing slashes collapse — is `pr` followed only
7
- // by digits is refused before any dispatch, whatever the digits, and never
8
- // coerced by stripping the suffix. A `..` segment is refused outright: the
9
- // kernel resolves it through symlinks, so no lexical reading of it is safe.
10
- //
11
- // Driven through the real `runReview` and asserted on `calls`, for the reason
12
- // review-core-snapshot-path.test.mjs states beside its skewed-snapshot test: a
13
- // rejection alone does not show nothing was dispatched first.
14
- import { test } from "node:test";
15
- import assert from "node:assert/strict";
16
- import { runReview } from "./review-core.mjs";
17
- import { ARGS, SNAP, pipeline, parallel, review, scriptedHost } from "./review-host-fixture.mjs";
18
-
19
- const PR = 42;
20
-
21
- function runWith(scratch) {
22
- const base = scratch === undefined ? `/tmp/review-pr-${PR}` : scratch.replace(/\/+$/, "");
23
- const runRoot = `${base}/pr${PR}/run-ab12`;
24
- const snap = { ...SNAP, runRoot, path: `${runRoot}/snapshot-abc123` };
25
- const { host, calls, prompts } = scriptedHost({ snapshot: [snap], "review:correctness": [review([])] });
26
- return { run: runReview({ ...host, pipeline, parallel }, { ...ARGS, pr: PR, scratch }), calls, prompts, base };
27
- }
28
-
29
- const PR_SUFFIX = /already ends in a pr<N> directory/;
30
- const DOTDOT = /has a "\.\." segment/;
31
- const refused = [
32
- ...["/x/pr42", "/x/pr42/", "/x/pr7", "/x/pr42//", "pr42", "/x/pr42/.", "/x/pr42/./", "/x/./pr42/."].map((s) => [s, PR_SUFFIX]),
33
- ...["/x/pr42/..", "/x/a/../pr42", "/x/link/.."].map((s) => [s, DOTDOT]),
34
- ];
35
- for (const [scratch, reason] of refused) {
36
- test(`scratch ${scratch} is refused before any dispatch (${reason.source}), naming the path`, async () => {
37
- const { run, calls } = runWith(scratch);
38
- await assert.rejects(run, (err) => {
39
- assert.ok(err.message.includes(JSON.stringify(scratch)), `the refusal does not name the scratch it was given: ${err.message}`);
40
- assert.match(err.message, reason, `refused for the wrong reason: ${err.message}`);
41
- assert.match(err.message, /scratch root/, `the refusal does not say to pass the scratch root: ${err.message}`);
42
- return true;
43
- });
44
- assert.deepEqual(calls, {}, `a refused scratch still dispatched: ${JSON.stringify(calls)}`);
45
- });
46
- }
47
-
48
- // What the guard must ACCEPT: a pr-looking name that is not exactly `pr<digits>`,
49
- // a `pr<N>` that is not the last component — including behind a `.` segment,
50
- // which collapses away without changing the last component — a `..` inside a
51
- // name rather than as a segment, and the default scratch. Each runs the review
52
- // to its specialist, with the run root at `<scratch>/pr42/` — one level, as
53
- // before.
54
- for (const scratch of ["/x/review-pr-42", "/x/pr42x", "/x/apr42", "/x/pr", "/x/prx42", "/x/pr42/root", "/x/pr42/./root", "/x/.pr42", "/x/a..b", undefined]) {
55
- test(`scratch ${scratch ?? "(omitted)"} is accepted and runs the review under <scratch>/pr42/`, async () => {
56
- const { run, calls, prompts, base } = runWith(scratch);
57
- await run;
58
- assert.equal(calls["review:correctness"], 1, "an accepted scratch must reach its specialist");
59
- assert.ok(
60
- prompts.snapshot[0].includes(`mkdir -p "${base}/pr${PR}"`),
61
- `the snapshot agent was not told to make the run root parent at ${base}/pr${PR}`,
62
- );
63
- });
64
- }
@@ -1,275 +0,0 @@
1
- // #2315. A review runs the repo's test command ONCE and hands the result to
2
- // every dimension, instead of every dimension specialist running the full
3
- // suite itself — up to six full sweeps of one immutable snapshot per review.
4
- //
5
- // Driven through runReview over a scripted host, as review-in-run-retry.test.mjs
6
- // is: `agent`/`pipeline`/`parallel`/`phase`/`log` are exactly what runReview
7
- // takes off `host`, so the dispatch count, the prompts and the unrun verdicts
8
- // below are review-core.mjs's own wiring, never a re-derived copy of it.
9
- //
10
- // THE CEILING: a scripted host answers for the agents, so nothing here proves
11
- // a live specialist obeys "do NOT run that full command yourself". What it
12
- // does prove is that review-core.mjs launches the command once (the first
13
- // test executes the test-run prompt's command block for real against a
14
- // counter file) and that no specialist prompt hands the command out to run.
15
- import { test } from "node:test";
16
- import assert from "node:assert/strict";
17
- import { execFileSync } from "node:child_process";
18
- import { mkdtempSync, mkdirSync, readFileSync, existsSync, rmSync } from "node:fs";
19
- import { tmpdir } from "node:os";
20
- import { join } from "node:path";
21
- import { runReview, DEFAULT_DIMENSIONS, CRASHED_REASON } from "./review-core.mjs";
22
- import { pipeline, parallel, ARGS, SNAP, review, finding, vote, scriptedHost } from "./review-host-fixture.mjs";
23
-
24
- const ALL = DEFAULT_DIMENSIONS.map((d) => d.key);
25
- const ALL_ARGS = { ...ARGS, dimensions: ALL };
26
- const run = (host, args = ALL_ARGS) => runReview({ ...host, pipeline, parallel }, args);
27
- // Every one of the six specialists returning the same clean review, plus
28
- // whatever the case under test scripts on top.
29
- const script = (extra) => ({
30
- snapshot: [SNAP],
31
- ...Object.fromEntries(ALL.map((k) => [`review:${k}`, [review([])]])),
32
- ...extra,
33
- });
34
-
35
- // The one command line the test-run prompt hands its agent, run the way that
36
- // agent is told to: once, in the foreground, through a POSIX shell. The counts
37
- // come from the log the block wrote, as the agent is told to read them.
38
- function obeyTestRun(prompt) {
39
- const block = prompt.split("\n").find((l) => /^ {4}\{ cd /.test(l));
40
- assert.ok(block, "the test-run prompt carries no `{ cd … }` command block");
41
- const out = execFileSync("/bin/sh", ["-c", block.trim()], { encoding: "utf8" });
42
- const exit = Number(/TEST_RUN_EXIT=(\d+)/.exec(out)?.[1]);
43
- const logPath = /> "([^"]+)" 2>&1/.exec(block)[1];
44
- const log = readFileSync(logPath, "utf8");
45
- const count = (k) => Number(new RegExp(`^# ${k} (\\d+)$`, "m").exec(log)?.[1]);
46
- return { exitCode: exit, tests: count("tests"), pass: count("pass"), fail: count("fail") };
47
- }
48
-
49
- test("one review with all six dimensions launches the test command exactly once, from the snapshot's root", async () => {
50
- const tmp = mkdtempSync(join(tmpdir(), "shared-test-run-"));
51
- try {
52
- const runRoot = join(tmp, "pr7", "run-ab12");
53
- const snap = { ...SNAP, runRoot, path: join(runRoot, "snapshot-abc123") };
54
- mkdirSync(snap.path, { recursive: true });
55
- const counter = join(tmp, "launches");
56
- // The caller-supplied override is what the shared run runs: each launch
57
- // appends one line (its cwd) to the counter file.
58
- const testCmd = `pwd >> "${counter}"; echo "# tests 3"; echo "# pass 3"; echo "# fail 0"`;
59
- const { host, calls, prompts } = scriptedHost(script({ snapshot: [snap] }));
60
- const scripted = host.agent;
61
- host.agent = async (prompt, opts) => {
62
- if (opts.label !== `test-run:pr${ARGS.pr}`) return scripted(prompt, opts);
63
- calls["test-run"] = (calls["test-run"] ?? 0) + 1;
64
- return obeyTestRun(prompt);
65
- };
66
- const result = await run(host, { ...ALL_ARGS, scratch: tmp, testCmd });
67
-
68
- const launches = readFileSync(counter, "utf8").trim().split("\n");
69
- assert.equal(launches.length, 1, `one review launched the test command ${launches.length} times`);
70
- assert.equal(launches[0], execFileSync("/bin/sh", ["-c", `cd "${snap.path}" && pwd`], { encoding: "utf8" }).trim());
71
- assert.equal(calls["test-run"], 1);
72
- assert.ok(existsSync(join(runRoot, "test-run.log")), "the shared run's log is not where the specialists are pointed");
73
- for (const k of ALL) {
74
- assert.equal(calls[`review:${k}`], 1);
75
- // No specialist prompt hands the command over as something to run.
76
- assert.doesNotMatch(prompts[`review:${k}`][0], /run exactly this/);
77
- assert.match(prompts[`review:${k}`][0], /Do NOT run that full command yourself/);
78
- }
79
- assert.deepEqual(result.dimensionsUnrun, []);
80
- } finally {
81
- rmSync(tmp, { recursive: true, force: true });
82
- }
83
- });
84
-
85
- test("every dispatched specialist receives the shared run's command, counts and log path", async () => {
86
- const { host, prompts } = scriptedHost(script({ "test-run": [{ exitCode: 0, tests: 41, pass: 40, fail: 0, skipped: 1 }] }));
87
- await run(host);
88
- for (const k of ALL) {
89
- const p = prompts[`review:${k}`]?.[0];
90
- assert.ok(p, `the ${k} specialist was never dispatched`);
91
- assert.match(p, /command: node --test\n/, `${k}'s prompt lacks the shared run's command`);
92
- assert.match(p, /counts: {2}tests 41, pass 40, fail 0, skipped 1\n/, `${k}'s prompt lacks the shared run's counts`);
93
- assert.match(p, new RegExp(`log: {5}${SNAP.runRoot}/test-run\\.log\\n`), `${k}'s prompt lacks the shared run's log path`);
94
- }
95
- });
96
-
97
- // The override precedence #142 settled, carried onto the one prompt that runs
98
- // the command: a caller's override wins, the derivation is used without one.
99
- test("the shared run runs the caller's override, and the snapshot's derived command only without one", async () => {
100
- for (const [args, expected] of [
101
- [{ ...ARGS, testCmd: "npm test -- --ci" }, "npm test -- --ci"],
102
- [{ ...ARGS, testCmd: undefined }, SNAP.testCmd],
103
- ]) {
104
- const { host, prompts } = scriptedHost(script({}));
105
- await run(host, args);
106
- assert.ok(prompts["test-run"][0].includes(`&& ${expected}; }`), `the test-run prompt does not run ${expected}`);
107
- }
108
- });
109
-
110
- test("a shared run reporting tests 0 makes every selected dimension unrun", async () => {
111
- const { host, calls } = scriptedHost(script({ "test-run": [{ exitCode: 0, tests: 0, pass: 0, fail: 0 }] }));
112
- const result = await run(host);
113
- assert.deepEqual(result.dimensionsUnrun.map((u) => u.dimension), ALL);
114
- for (const u of result.dimensionsUnrun) assert.match(u.reason, /produced 0 tests/);
115
- // Still a review: the specialists were dispatched and their findings verified.
116
- for (const k of ALL) assert.equal(calls[`review:${k}`], 1);
117
- });
118
-
119
- test("a shared run that yields no counts reports every selected dimension unrun, never a pass", async () => {
120
- for (const answer of [null, new Error("spend limit"), {}, { exitCode: 124, error: "hit the 1800 s deadline" }]) {
121
- const { host, calls, prompts } = scriptedHost(script({ "test-run": [answer] }));
122
- const result = await run(host);
123
- const where = answer instanceof Error ? "a thrown dispatch" : JSON.stringify(answer);
124
- assert.equal(calls["test-run"], 1, `${where}: the shared run was dispatched again — a second full-suite launch`);
125
- assert.deepEqual(result.dimensionsUnrun.map((u) => u.dimension), ALL, `${where}: not every dimension is unrun`);
126
- for (const u of result.dimensionsUnrun) assert.match(u.reason, /no counts/, `${where}: ${u.reason}`);
127
- assert.match(prompts["review:correctness"][0], /This run is NOT usable/);
128
- }
129
- });
130
-
131
- // Failing tests are the REVIEW's, not each dimension's: the first selected
132
- // dimension is told to file them and every other one not to duplicate it.
133
- test("a shared run with failures: one dimension's finding leaves no dimension unrun, and the others are told not to duplicate it", async () => {
134
- const failing = { exitCode: 1, tests: 10, pass: 8, fail: 2 };
135
- const { host, prompts } = scriptedHost(
136
- script({ "test-run": [failing], "review:correctness": [review([finding("suggestion")])] }),
137
- );
138
- const result = await run(host);
139
- assert.deepEqual(result.dimensionsUnrun, [], "a sibling's finding about the failures must satisfy every dimension");
140
- assert.match(prompts["review:correctness"][0], /filing them is YOUR job/);
141
- for (const k of ALL.filter((k) => k !== "correctness")) {
142
- const p = prompts[`review:${k}`][0];
143
- assert.match(p, /the correctness dimension files the finding\s+about them\. Do not file a duplicate/, `${k} is not told to leave the failures to correctness`);
144
- assert.doesNotMatch(p, /YOUR job/, `${k} is told to file the failures too — a duplicate per dimension`);
145
- }
146
- // The accept side: ownership is a duplicate-avoidance rule, not a verdict
147
- // key — a finding from a NON-owner satisfies the check just as well.
148
- const other = scriptedHost(script({ "test-run": [failing], "review:types": [review([finding("suggestion")])] }));
149
- assert.deepEqual((await run(other.host)).dimensionsUnrun, []);
150
- });
151
-
152
- test("a shared run with failures and no finding from any dimension makes every selected dimension unrun", async () => {
153
- const { host } = scriptedHost(script({ "test-run": [{ exitCode: 1, tests: 10, pass: 8, fail: 2 }] }));
154
- const result = await run(host);
155
- assert.deepEqual(result.dimensionsUnrun.map((u) => u.dimension), ALL);
156
- for (const u of result.dimensionsUnrun) assert.match(u.reason, /2 failing tests and no selected dimension filed a finding/);
157
- });
158
-
159
- // The failing-tests check reads what reached the payload, never what a
160
- // specialist returned before its findings were verified: an unrelated finding
161
- // the refuters threw out, or the findings of a dimension whose verify stage
162
- // died, would otherwise stand in for failures nobody reported — and the
163
- // failures would reach neither the report nor dimensionsUnrun.
164
- test("a shared run with failures is not satisfied by a refuted finding, nor by a dimension whose verify stage died", async () => {
165
- const failing = { exitCode: 1, tests: 10, pass: 8, fail: 2 };
166
- const refuted = scriptedHost(
167
- script({ "test-run": [failing], "review:correctness": [review([finding("critical")])], "verify:correctness": [vote(true)] }),
168
- );
169
- const r1 = await run(refuted.host);
170
- assert.equal(r1.refuted.length, 1, "the fixture's finding was not refuted — this case tests nothing");
171
- assert.deepEqual(r1.dimensionsUnrun.map((u) => u.dimension), ALL, "a refuted finding satisfied the failing-tests check");
172
- for (const u of r1.dimensionsUnrun) assert.match(u.reason, /2 failing tests and no selected dimension filed a finding/);
173
-
174
- // A malformed finding throws inside the verify stage: the slot dies, so its
175
- // dimension is crashed and its findings never reach the payload.
176
- const died = scriptedHost(script({ "test-run": [failing], "review:correctness": [review([null])] }));
177
- const r2 = await run(died.host);
178
- assert.equal(r2.dimensionsUnrun.find((u) => u.dimension === "correctness")?.reason, CRASHED_REASON);
179
- assert.deepEqual(
180
- r2.dimensionsUnrun.filter((u) => u.dimension !== "correctness").map((u) => u.dimension),
181
- ALL.filter((k) => k !== "correctness"),
182
- "a dead dimension's unverified findings satisfied the failing-tests check",
183
- );
184
-
185
- // The accept side: a finding that survived its refuters settles it.
186
- const kept = scriptedHost(
187
- script({ "test-run": [failing], "review:correctness": [review([finding("critical")])], "verify:correctness": [vote(false)] }),
188
- );
189
- assert.deepEqual((await run(kept.host)).dimensionsUnrun, []);
190
- });
191
-
192
- // The exit status is the command's verdict: clean-looking counts beside a
193
- // non-zero or missing exit are not a pass, and every specialist is told so.
194
- test("a shared run whose exit is non-zero with nothing failing, or missing, makes every selected dimension unrun", async () => {
195
- for (const answer of [{ exitCode: 137, tests: 5, pass: 5, fail: 0 }, { exitCode: 1, tests: 5, pass: 5 }, { tests: 5, pass: 5, fail: 0 }]) {
196
- const { host, prompts } = scriptedHost(script({ "test-run": [answer], "review:correctness": [review([finding("suggestion")])] }));
197
- const result = await run(host);
198
- const where = JSON.stringify(answer);
199
- assert.deepEqual(result.dimensionsUnrun.map((u) => u.dimension), ALL, `${where}: not every dimension is unrun`);
200
- for (const u of result.dimensionsUnrun) assert.match(u.reason, /exited \d+ but reported no failing|no exit status/, `${where}: ${u.reason}`);
201
- assert.match(prompts["review:tests"][0], /This run is NOT usable/, `${where}: a specialist was not told the run is unusable`);
202
- }
203
- });
204
-
205
- // node's runner counts a test that never finished as `cancelled`, not `fail`,
206
- // and exits 1: that is a failure for the owner to file, not an unusable run.
207
- test("a shared run with cancelled tests and no failing count hands the owner the cancelled tests to file", async () => {
208
- const cancelled = { exitCode: 1, tests: 10, pass: 9, fail: 0, cancelled: 1 };
209
- const { host, prompts } = scriptedHost(script({ "test-run": [cancelled] }));
210
- const result = await run(host);
211
- assert.match(prompts["review:correctness"][0], /It has 0 failing and 1 cancelled tests, and filing them is YOUR job/);
212
- assert.doesNotMatch(prompts["review:correctness"][0], /NOT usable/);
213
- assert.deepEqual(result.dimensionsUnrun.map((u) => u.dimension), ALL);
214
- for (const u of result.dimensionsUnrun) assert.match(u.reason, /1 cancelled tests and no selected dimension filed a finding/);
215
- const filed = scriptedHost(script({ "test-run": [cancelled], "review:correctness": [review([finding("suggestion")])] }));
216
- assert.deepEqual((await run(filed.host)).dimensionsUnrun, []);
217
- });
218
-
219
- // A crashed specialist is named once, with its own reason — never a second
220
- // entry for the shared run's verdict on top.
221
- test("a crashed dimension is listed once, with its crash reason, beside the shared run's verdict for the rest", async () => {
222
- const { host } = scriptedHost(
223
- script({ "test-run": [{ exitCode: 0, tests: 0 }], "review:types": [null] }),
224
- );
225
- const result = await run(host);
226
- const keys = result.dimensionsUnrun.map((u) => u.dimension);
227
- assert.equal(keys.length, new Set(keys).size, `a dimension is listed twice: ${keys.join(", ")}`);
228
- assert.deepEqual([...keys].sort(), [...ALL].sort());
229
- assert.equal(result.dimensionsUnrun.find((u) => u.dimension === "types").reason, CRASHED_REASON);
230
- });
231
-
232
- // The shared run alone decides. A specialist whose payload still carries its
233
- // own `test_run` — from a prompt that predates the field's removal — is
234
- // ignored: a count that disagrees with the shared run changes no verdict, and
235
- // leaves no trace in the result. The baseline is the same script with no stray
236
- // field, so the comparison is the whole result, not a chosen key.
237
- test("a specialist's stray test_run never changes the result, and the shared run alone decides", async () => {
238
- const stray = (r, testRun) => ({ ...r, test_run: testRun });
239
- const cases = [
240
- // The shared run counted nothing; a stray copy claims a full suite ran.
241
- ["shared tests 0, stray 9999", { exitCode: 0, tests: 0, pass: 0, fail: 0 }, { command: "MARKER-CMD", tests: 9999, pass: 9999, fail: 0 }, {}],
242
- // The shared run is clean; a stray copy claims nothing ran. Findings on
243
- // three dimensions put an entry in survived, refuted and unverified.
244
- [
245
- "shared clean, stray 0",
246
- { exitCode: 0, tests: 5, pass: 5, fail: 0 },
247
- { command: "MARKER-CMD", tests: 0 },
248
- {
249
- "review:correctness": [review([finding("critical")])],
250
- "verify:correctness": [vote(false)],
251
- "review:types": [review([finding("important")])],
252
- "verify:types": [vote(true)],
253
- "review:tests": [review([finding("suggestion")])],
254
- },
255
- ],
256
- ];
257
- for (const [name, shared, testRun, extra] of cases) {
258
- const base = script({ "test-run": [shared], ...extra });
259
- const withStray = Object.fromEntries(
260
- Object.entries(base).map(([label, seq]) => [label, label.startsWith("review:") ? seq.map((r) => stray(r, testRun)) : seq]),
261
- );
262
- const expected = await run(scriptedHost(base).host);
263
- const actual = await run(scriptedHost(withStray).host);
264
- assert.deepEqual(actual, expected, `${name}: a stray test_run changed the result`);
265
- const text = JSON.stringify(actual);
266
- assert.doesNotMatch(text, /MARKER-CMD|test_run/, `${name}: the stray test_run reached the result`);
267
- if (shared.tests === 0) {
268
- assert.deepEqual(actual.dimensionsUnrun.map((u) => u.dimension), ALL, `${name}: not every live dimension is unrun`);
269
- assert.doesNotMatch(text, /9999/, `${name}: the stray count reached the result`);
270
- } else {
271
- assert.deepEqual(actual.dimensionsUnrun, [], `${name}: a stray count of 0 made a dimension unrun`);
272
- for (const key of ["survived", "refuted", "unverified"]) assert.equal(actual[key].length, 1, `${name}: ${key} holds no finding — this case tests nothing`);
273
- }
274
- }
275
- });