@feigi/fleet-ctl 3.23.36 → 3.23.38

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 (205) hide show
  1. package/package.json +1 -1
  2. package/scripts/cell-readout.mjs +38 -11
  3. package/scripts/main-checkout.mjs +1 -1
  4. package/scripts/member-write-guard.mjs +1 -1
  5. package/scripts/repo-root.mjs +1 -1
  6. package/skills/run-team/references/reaping.md +1 -1
  7. package/scripts/agent-test-dir-prose.test.mjs +0 -59
  8. package/scripts/agent-test.test.mjs +0 -1640
  9. package/scripts/ambient-git-vars-mjs-prose.test.mjs +0 -397
  10. package/scripts/ambient-git-vars-prose.test.mjs +0 -192
  11. package/scripts/ancestry-check-position-prose.test.mjs +0 -175
  12. package/scripts/apply-ruleset.test.mjs +0 -421
  13. package/scripts/arg-header-probes-prose.test.mjs +0 -394
  14. package/scripts/arg.test.mjs +0 -1354
  15. package/scripts/board-cli.test.mjs +0 -710
  16. package/scripts/board-identity.test.mjs +0 -429
  17. package/scripts/board-liveness-banner.test.mjs +0 -119
  18. package/scripts/board-prev-shape.test.mjs +0 -228
  19. package/scripts/board-tryparse-null.test.mjs +0 -119
  20. package/scripts/board.test.mjs +0 -3121
  21. package/scripts/brief-after-cut-prose.test.mjs +0 -53
  22. package/scripts/candidates-exit3-prose.test.mjs +0 -302
  23. package/scripts/candidates.test.mjs +0 -2312
  24. package/scripts/caveat-unification-prose.test.mjs +0 -98
  25. package/scripts/cell-readout.test.mjs +0 -615
  26. package/scripts/ci-comment-rot-prose.test.mjs +0 -2025
  27. package/scripts/ci-completes-premise-prose.test.mjs +0 -257
  28. package/scripts/ci-state-prose.test.mjs +0 -113
  29. package/scripts/ci-state.test.mjs +0 -1933
  30. package/scripts/ci-vacuous-green.test.mjs +0 -368
  31. package/scripts/citation-sweep-prose.test.mjs +0 -1712
  32. package/scripts/claim-lifecycle.test.mjs +0 -187
  33. package/scripts/claim-ticket.test.mjs +0 -1122
  34. package/scripts/closing-keyword-prose.test.mjs +0 -193
  35. package/scripts/cockpit-launch-idempotent-prose.test.mjs +0 -165
  36. package/scripts/cockpit-tick-nonblocking.test.mjs +0 -210
  37. package/scripts/compute-board.test.mjs +0 -1214
  38. package/scripts/compute-spend.test.mjs +0 -517
  39. package/scripts/consumer-technology-prose.test.mjs +0 -126
  40. package/scripts/cross-repo-citation-prose.test.mjs +0 -155
  41. package/scripts/cwd-isolation-pins.mjs +0 -83
  42. package/scripts/dedupe-guard-prose.test.mjs +0 -243
  43. package/scripts/delete-merged-branch.test.mjs +0 -576
  44. package/scripts/derive-testcmd.test.mjs +0 -595
  45. package/scripts/diff-stats.test.mjs +0 -404
  46. package/scripts/dispatch-block-golden-prose.test.mjs +0 -1130
  47. package/scripts/dispatch-block-pins-prose.test.mjs +0 -615
  48. package/scripts/dispositions-check.test.mjs +0 -936
  49. package/scripts/dispositions-gate-prose.test.mjs +0 -129
  50. package/scripts/drop-merged-label.test.mjs +0 -479
  51. package/scripts/exec-stub.mjs +0 -93
  52. package/scripts/exec-stub.test.mjs +0 -69
  53. package/scripts/expected-jobs-prose.test.mjs +0 -80
  54. package/scripts/fan-out-authorization-prose.test.mjs +0 -80
  55. package/scripts/filing-bar-seat-prose.test.mjs +0 -242
  56. package/scripts/filing-claim-bar-prose.test.mjs +0 -166
  57. package/scripts/finisher-died-prose.test.mjs +0 -31
  58. package/scripts/finisher-dispatch-premise-prose.test.mjs +0 -312
  59. package/scripts/finisher-halt-prose.test.mjs +0 -106
  60. package/scripts/finisher-name-prose.test.mjs +0 -134
  61. package/scripts/finisher-own-tree-prose.test.mjs +0 -299
  62. package/scripts/finisher-pin-race-prose.test.mjs +0 -339
  63. package/scripts/finisher-test-verdict-prose.test.mjs +0 -102
  64. package/scripts/fix-applier-correction-rules-prose.test.mjs +0 -202
  65. package/scripts/fix-applier-result-file-prose.test.mjs +0 -149
  66. package/scripts/fleet-bootstrap.test.mjs +0 -75
  67. package/scripts/fleet-heartbeat.test.mjs +0 -450
  68. package/scripts/fleet-provenance.test.mjs +0 -138
  69. package/scripts/fleet-run.test.mjs +0 -90
  70. package/scripts/fleet-state.test.mjs +0 -460
  71. package/scripts/fleet-tick-prose.test.mjs +0 -300
  72. package/scripts/fleet-tick.test.mjs +0 -2444
  73. package/scripts/force-with-lease-reason-prose.test.mjs +0 -184
  74. package/scripts/frontmatter-check.test.mjs +0 -436
  75. package/scripts/git-env.test.mjs +0 -149
  76. package/scripts/git-status-untracked-mode-sweep.test.mjs +0 -216
  77. package/scripts/gone-walk.test.mjs +0 -213
  78. package/scripts/gp-sep-invariant-prose.test.mjs +0 -188
  79. package/scripts/head-moved-after-label-prose.test.mjs +0 -233
  80. package/scripts/immutable-body-claim-prose.test.mjs +0 -204
  81. package/scripts/implementer-model-tier.test.mjs +0 -235
  82. package/scripts/inflight-citation-prose.test.mjs +0 -144
  83. package/scripts/inflight-exit2-prose.test.mjs +0 -81
  84. package/scripts/inflight-probe-guard-prose.test.mjs +0 -109
  85. package/scripts/inflight-scan-scope-prose.test.mjs +0 -57
  86. package/scripts/inflight.test.mjs +0 -2882
  87. package/scripts/injection-control-prose.test.mjs +0 -404
  88. package/scripts/install-root-audit.test.mjs +0 -464
  89. package/scripts/instrument-check-prose.test.mjs +0 -235
  90. package/scripts/instruments.test.mjs +0 -787
  91. package/scripts/is-cli.test.mjs +0 -99
  92. package/scripts/issue-tracker-prose.test.mjs +0 -71
  93. package/scripts/json.test.mjs +0 -364
  94. package/scripts/ledger-dispatch.test.mjs +0 -927
  95. package/scripts/ledger-grammar.test.mjs +0 -227
  96. package/scripts/ledger-read-require-file.test.mjs +0 -197
  97. package/scripts/ledger-rotate.test.mjs +0 -142
  98. package/scripts/ledger.test.mjs +0 -3436
  99. package/scripts/line-distance-prose.test.mjs +0 -245
  100. package/scripts/liveness-rationale-prose.test.mjs +0 -83
  101. package/scripts/locale-pin-prose.test.mjs +0 -189
  102. package/scripts/main-checkout.test.mjs +0 -332
  103. package/scripts/member-outcome-prose.test.mjs +0 -167
  104. package/scripts/member-outcomes-header.test.mjs +0 -129
  105. package/scripts/member-outcomes-prose.test.mjs +0 -63
  106. package/scripts/member-outcomes.test.mjs +0 -638
  107. package/scripts/member-prompt-prose.test.mjs +0 -165
  108. package/scripts/member-record.test.mjs +0 -541
  109. package/scripts/member-write-guard.test.mjs +0 -214
  110. package/scripts/merge-commit-probe-prose.test.mjs +0 -122
  111. package/scripts/merge-gate.test.mjs +0 -613
  112. package/scripts/muted-git-guard-sweep.test.mjs +0 -493
  113. package/scripts/net-ssh-precedence-prose.test.mjs +0 -91
  114. package/scripts/net-watchdog-prose.test.mjs +0 -79
  115. package/scripts/net.test.mjs +0 -211
  116. package/scripts/no-ci-gate-prose.test.mjs +0 -108
  117. package/scripts/no-undo-audit.test.mjs +0 -3961
  118. package/scripts/no-wave.test.mjs +0 -138
  119. package/scripts/node-floor-sweep.test.mjs +0 -611
  120. package/scripts/pointer-target-prose.test.mjs +0 -186
  121. package/scripts/pr-cost.test.mjs +0 -521
  122. package/scripts/pr-overlap.test.mjs +0 -692
  123. package/scripts/printf-die-sweep.test.mjs +0 -384
  124. package/scripts/prompt-renderer.mjs +0 -40
  125. package/scripts/prompt-renderer.test.mjs +0 -68
  126. package/scripts/prose-pin.mjs +0 -807
  127. package/scripts/prose-pin.test.mjs +0 -1034
  128. package/scripts/prove-merge.test.mjs +0 -995
  129. package/scripts/pull-table-relabel-prose.test.mjs +0 -60
  130. package/scripts/quiet-payload-prose.test.mjs +0 -222
  131. package/scripts/reap-cherry-check-prose.test.mjs +0 -80
  132. package/scripts/reap.test.mjs +0 -4432
  133. package/scripts/reaping-prose.test.mjs +0 -239
  134. package/scripts/reaping-reap-authorizers-prose.test.mjs +0 -112
  135. package/scripts/reaping-release-authorizers-prose.test.mjs +0 -85
  136. package/scripts/recipe-derivation-prose.test.mjs +0 -112
  137. package/scripts/recipe-prove.test.mjs +0 -1042
  138. package/scripts/refuter-scratch-prose.test.mjs +0 -135
  139. package/scripts/release-label-required-prose.test.mjs +0 -71
  140. package/scripts/release-label-split-prose.test.mjs +0 -184
  141. package/scripts/release-ticket-reap-pairing-prose.test.mjs +0 -63
  142. package/scripts/release-ticket.test.mjs +0 -5099
  143. package/scripts/renovate-release-contract.test.mjs +0 -379
  144. package/scripts/repo-root.test.mjs +0 -873
  145. package/scripts/reporter-output-rule-prose.test.mjs +0 -208
  146. package/scripts/review-agent-report-only.test.mjs +0 -49
  147. package/scripts/review-core-booking.test.mjs +0 -35
  148. package/scripts/review-core-cwd-isolation.test.mjs +0 -374
  149. package/scripts/review-core-reads.test.mjs +0 -478
  150. package/scripts/review-core-refuter-scratch.test.mjs +0 -148
  151. package/scripts/review-core-scratch-refusal.test.mjs +0 -64
  152. package/scripts/review-core-shared-test-run.test.mjs +0 -275
  153. package/scripts/review-core-snapshot-path.test.mjs +0 -830
  154. package/scripts/review-core-specialist-scratch.test.mjs +0 -191
  155. package/scripts/review-core-testcmd.test.mjs +0 -335
  156. package/scripts/review-core-unrun.test.mjs +0 -566
  157. package/scripts/review-core-unverified-discriminant.test.mjs +0 -208
  158. package/scripts/review-eval-resolver-path.test.mjs +0 -55
  159. package/scripts/review-host-fixture.mjs +0 -89
  160. package/scripts/review-in-run-retry.test.mjs +0 -211
  161. package/scripts/review-no-vendor-dispatch.test.mjs +0 -45
  162. package/scripts/review-path-default.test.mjs +0 -796
  163. package/scripts/review-runner-spawns.test.mjs +0 -95
  164. package/scripts/review-runner.test.mjs +0 -166
  165. package/scripts/review-tier-audit.test.mjs +0 -140
  166. package/scripts/run-artifact-pr-prose.test.mjs +0 -341
  167. package/scripts/run-merge-bot-prose.test.mjs +0 -1413
  168. package/scripts/run-team-local-hook.test.mjs +0 -442
  169. package/scripts/scratch-partition-invariant-prose.test.mjs +0 -74
  170. package/scripts/scripts-path-citation-sweep.test.mjs +0 -73
  171. package/scripts/section-between-guard-prose.test.mjs +0 -379
  172. package/scripts/select-dimensions.test.mjs +0 -674
  173. package/scripts/shared-refusal.test.mjs +0 -388
  174. package/scripts/shell-traps-prose.test.mjs +0 -504
  175. package/scripts/shortlist.test.mjs +0 -380
  176. package/scripts/slow-transport.mjs +0 -72
  177. package/scripts/snapshot-repo.test.mjs +0 -1006
  178. package/scripts/snapshot-runner-audience-prose.test.mjs +0 -130
  179. package/scripts/spend-view.test.mjs +0 -312
  180. package/scripts/staleness-qualifier-prose.test.mjs +0 -251
  181. package/scripts/staleness-verdict-prose.test.mjs +0 -142
  182. package/scripts/staleness.test.mjs +0 -893
  183. package/scripts/stalled-member-liveness-prose.test.mjs +0 -219
  184. package/scripts/stash-prohibition-prose.test.mjs +0 -313
  185. package/scripts/strip-comments.mjs +0 -44
  186. package/scripts/temp-dir.mjs +0 -47
  187. package/scripts/ticket-router.test.mjs +0 -981
  188. package/scripts/tier-check.test.mjs +0 -828
  189. package/scripts/tier-outcomes-header.test.mjs +0 -518
  190. package/scripts/tier-outcomes.test.mjs +0 -572
  191. package/scripts/tier-roles.test.mjs +0 -535
  192. package/scripts/tracker-block-copy-prose.test.mjs +0 -288
  193. package/scripts/triage-labels-gloss-prose.test.mjs +0 -97
  194. package/scripts/unattended-git-sweep.test.mjs +0 -142
  195. package/scripts/verify-sha-exit2-prose.test.mjs +0 -269
  196. package/scripts/verify-sha.test.mjs +0 -692
  197. package/scripts/watcher-degraded-block.test.mjs +0 -369
  198. package/scripts/watcher-key-prose.test.mjs +0 -106
  199. package/scripts/within-run-pair-prose.test.mjs +0 -212
  200. package/scripts/worktree-audit.test.mjs +0 -1408
  201. package/scripts/worktree-head-prose.test.mjs +0 -276
  202. package/scripts/worktree-listing-sweep.test.mjs +0 -217
  203. package/scripts/worktree-model-prose.test.mjs +0 -216
  204. package/scripts/worktree-porcelain.mjs +0 -35
  205. 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
- });