@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,332 +0,0 @@
1
- // Regression gate for main-checkout.mjs (#2210), the tick's main-checkout
2
- // dirty check. Zero deps:
3
- // node --test plugin/scripts/main-checkout.test.mjs
4
- //
5
- // Every case runs in a real temporary repository: what is under test is how
6
- // git's porcelain, the gitignore, a linked worktree and the filesystem answer,
7
- // and a stubbed git would answer whatever the stub was told.
8
- import { test } from "node:test";
9
- import assert from "node:assert/strict";
10
- import { spawnSync } from "node:child_process";
11
- import {
12
- appendFileSync, chmodSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, symlinkSync, unlinkSync, writeFileSync,
13
- } from "node:fs";
14
- import { tmpdir } from "node:os";
15
- import { join } from "node:path";
16
- import { fileURLToPath } from "node:url";
17
- import { checkMainCheckout, recordBaseline, baselinePath, describe } from "./main-checkout.mjs";
18
-
19
- const SCRIPT = fileURLToPath(new URL("./main-checkout.mjs", import.meta.url));
20
- // Permission cases mean nothing to root, which reads through any mode bits.
21
- const ROOT = process.getuid?.() === 0;
22
-
23
- const git = (cwd, ...args) => {
24
- const r = spawnSync("git", ["-c", "user.email=t@t", "-c", "user.name=t", ...args], { cwd, encoding: "utf8" });
25
- assert.equal(r.status, 0, `git ${args.join(" ")}: ${r.stderr}`);
26
- return r.stdout;
27
- };
28
-
29
- // A fleet-shaped main checkout: one tracked file, `.fleet/` and `.worktrees/`
30
- // ignored the way a fleet repo's .gitignore ignores them.
31
- function repo(t) {
32
- const dir = realpathSync(mkdtempSync(join(tmpdir(), "main-checkout-")));
33
- t.after(() => {
34
- // Restore what a case took away, or rmSync cannot clear it.
35
- for (const p of [join(dir, ".fleet"), join(dir, "locked.txt")]) try { chmodSync(p, 0o755); } catch {}
36
- rmSync(dir, { recursive: true, force: true });
37
- });
38
- git(dir, "init", "-q");
39
- writeFileSync(join(dir, ".gitignore"), ".fleet/\n.worktrees/\n.agent-brain/\n");
40
- writeFileSync(join(dir, "tracked.txt"), "one\n");
41
- git(dir, "add", "-A");
42
- git(dir, "commit", "-qm", "init");
43
- return dir;
44
- }
45
-
46
- const record = (cwd, env) => {
47
- const r = recordBaseline({ cwd, env });
48
- assert.equal(r.ok, true, r.why);
49
- return r;
50
- };
51
- const check = (cwd, env) => checkMainCheckout({ cwd, env });
52
-
53
- test("a clean tree recorded and left alone is clean", (t) => {
54
- const dir = repo(t);
55
- record(dir);
56
- assert.equal(check(dir).state, "clean");
57
- });
58
-
59
- test("uncommitted work present at run start is in the baseline and holds nothing", (t) => {
60
- const dir = repo(t);
61
- writeFileSync(join(dir, "tracked.txt"), "mine, uncommitted\n");
62
- writeFileSync(join(dir, "notes.md"), "untracked, mine\n");
63
- record(dir);
64
- assert.equal(check(dir).state, "clean");
65
- });
66
-
67
- test("a new untracked file is dirty, and named", (t) => {
68
- const dir = repo(t);
69
- record(dir);
70
- mkdirSync(join(dir, "plugin", "scripts"), { recursive: true });
71
- writeFileSync(join(dir, "plugin", "scripts", "stray.mjs"), "x\n");
72
- const c = check(dir);
73
- assert.equal(c.state, "dirty");
74
- // -uall: the file itself, never only its new directory.
75
- assert.deepEqual(c.changed, ["plugin/scripts/stray.mjs"]);
76
- });
77
-
78
- test("an untracked file is dirty even where status.showUntrackedFiles=no would silence it (#730)", (t) => {
79
- const dir = repo(t);
80
- git(dir, "config", "status.showUntrackedFiles", "no");
81
- record(dir);
82
- writeFileSync(join(dir, "stray.txt"), "x\n");
83
- assert.deepEqual(check(dir).changed, ["stray.txt"]);
84
- });
85
-
86
- test("a modified tracked file is dirty", (t) => {
87
- const dir = repo(t);
88
- record(dir);
89
- writeFileSync(join(dir, "tracked.txt"), "two\n");
90
- assert.deepEqual(check(dir), { state: "dirty", root: dir, baseline: baselinePath(dir), changed: ["tracked.txt"] });
91
- });
92
-
93
- test("a further edit to a file already dirty at the baseline is dirty — the hash, not the status line, catches it", (t) => {
94
- const dir = repo(t);
95
- writeFileSync(join(dir, "tracked.txt"), "mine\n");
96
- writeFileSync(join(dir, "notes.md"), "mine\n");
97
- record(dir);
98
- appendFileSync(join(dir, "tracked.txt"), "a member's line\n");
99
- assert.deepEqual(check(dir).changed, ["tracked.txt"]);
100
- appendFileSync(join(dir, "notes.md"), "a member's line\n");
101
- assert.deepEqual(check(dir).changed, ["notes.md", "tracked.txt"]);
102
- });
103
-
104
- test("a deleted tracked file, and an entry that leaves porcelain, are both dirty", (t) => {
105
- const dir = repo(t);
106
- writeFileSync(join(dir, "notes.md"), "mine\n");
107
- record(dir);
108
- unlinkSync(join(dir, "tracked.txt"));
109
- unlinkSync(join(dir, "notes.md"));
110
- assert.deepEqual(check(dir).changed, ["notes.md", "tracked.txt"]);
111
- });
112
-
113
- test("staging a change is a change", (t) => {
114
- const dir = repo(t);
115
- writeFileSync(join(dir, "tracked.txt"), "mine\n");
116
- record(dir);
117
- git(dir, "add", "tracked.txt");
118
- assert.deepEqual(check(dir).changed, ["tracked.txt"]);
119
- });
120
-
121
- test("a write under a gitignored directory is clean — run state, agent-brain's cache", (t) => {
122
- const dir = repo(t);
123
- record(dir);
124
- writeFileSync(join(dir, ".fleet", "ledger.md"), "# ledger\n");
125
- mkdirSync(join(dir, ".agent-brain"));
126
- writeFileSync(join(dir, ".agent-brain", "index.md"), "x\n");
127
- assert.equal(check(dir).state, "clean");
128
- });
129
-
130
- test("the run's own bookkeeping is not a stray write: the controller's metrics appends stay clean, anything beside them does not", (t) => {
131
- const dir = repo(t);
132
- mkdirSync(join(dir, "docs", "metrics"), { recursive: true });
133
- writeFileSync(join(dir, "docs", "metrics", "tier-outcomes.tsv"), "# header\n");
134
- writeFileSync(join(dir, "docs", "metrics", "member-outcomes.tsv"), "# header\n");
135
- git(dir, "add", "-A");
136
- git(dir, "commit", "-qm", "metrics");
137
- record(dir);
138
- // What the controller does mid-run: `tier-outcomes.mjs append` per ruled
139
- // PR, the member-facts scrape rewriting its file. Twice, as a run does.
140
- for (const row of ["2026-10-01\t2298\n", "2026-10-01\t2302\n"]) {
141
- appendFileSync(join(dir, "docs", "metrics", "tier-outcomes.tsv"), row);
142
- writeFileSync(join(dir, "docs", "metrics", "member-outcomes.tsv"), `# header\n${row}`);
143
- assert.equal(check(dir).state, "clean", "the controller's own append held the run");
144
- }
145
- // Two named files, never the directory, and a stray beside them is named alone.
146
- writeFileSync(join(dir, "docs", "metrics", "stray.tsv"), "x\n");
147
- writeFileSync(join(dir, "tracked.txt"), "a member's\n");
148
- assert.deepEqual(check(dir).changed, ["docs/metrics/stray.tsv", "tracked.txt"]);
149
- });
150
-
151
- test("a write inside .worktrees/<x>/ is clean, and the check run from that worktree still answers for the main checkout", (t) => {
152
- const dir = repo(t);
153
- git(dir, "worktree", "add", "-q", "-b", "impl/1", join(dir, ".worktrees", "1-x"));
154
- record(dir);
155
- const wt = join(dir, ".worktrees", "1-x");
156
- writeFileSync(join(wt, "tracked.txt"), "a member's own work\n");
157
- writeFileSync(join(wt, "new.mjs"), "x\n");
158
- assert.equal(check(dir).state, "clean");
159
- const fromWt = check(wt);
160
- assert.equal(fromWt.state, "clean");
161
- assert.equal(fromWt.root, dir, "resolved the worktree as the main checkout — --show-toplevel's answer, not the common dir's");
162
- writeFileSync(join(dir, "stray.txt"), "x\n");
163
- assert.deepEqual(check(wt).changed, ["stray.txt"], "a stray write is invisible from a member's worktree");
164
- });
165
-
166
- test("paths that would split or blur the line are quoted in it", (t) => {
167
- const dir = repo(t);
168
- record(dir);
169
- writeFileSync(join(dir, "plain.txt"), "x\n");
170
- writeFileSync(join(dir, "a b.txt"), "x\n");
171
- writeFileSync(join(dir, 'q"uote.txt'), "x\n");
172
- writeFileSync(join(dir, "back\\slash.txt"), "x\n");
173
- writeFileSync(join(dir, "ctl\x01.txt"), "x\n");
174
- writeFileSync(join(dir, "new\nline.txt"), "x\n");
175
- const c = check(dir);
176
- assert.deepEqual(c.changed, ["a b.txt", "back\\slash.txt", "ctl\x01.txt", "new\nline.txt", "plain.txt", 'q"uote.txt']);
177
- const said = describe(c, ["impl-7"]);
178
- assert.ok(said.startsWith(`MAIN-CHECKOUT-DIRTY "a b.txt" "back\\\\slash.txt" "ctl\\u0001.txt" "new\\nline.txt" plain.txt "q\\"uote.txt" — `), said);
179
- assert.doesNotMatch(said, /[\x00-\x1f]/, "a raw control byte reached the printed line");
180
- });
181
-
182
- test("a git that fails is unknown, never clean", (t) => {
183
- const dir = repo(t);
184
- record(dir);
185
- // A corrupt index: git status exits non-zero.
186
- writeFileSync(join(dir, ".git", "index"), "not an index");
187
- const c = check(dir);
188
- assert.equal(c.state, "unknown");
189
- assert.equal(c.cause, "read");
190
- assert.match(c.why, /git status --porcelain -uall exited \d+/);
191
- assert.match(describe(c, []), /^MAIN-CHECKOUT-UNKNOWN could not look: .*NEVER re-baseline over it/);
192
- });
193
-
194
- test("a directory that is no repository is unknown, never clean", (t) => {
195
- const dir = realpathSync(mkdtempSync(join(tmpdir(), "main-checkout-norepo-")));
196
- t.after(() => rmSync(dir, { recursive: true, force: true }));
197
- const c = check(dir, { ...process.env, GIT_CEILING_DIRECTORIES: dir });
198
- assert.equal(c.state, "unknown");
199
- assert.match(c.why, /git rev-parse --git-common-dir exited 128/);
200
- });
201
-
202
- test("a path git names but the check cannot hash is unknown, never clean", { skip: ROOT }, (t) => {
203
- const dir = repo(t);
204
- record(dir);
205
- writeFileSync(join(dir, "locked.txt"), "x\n");
206
- chmodSync(join(dir, "locked.txt"), 0o000);
207
- const c = check(dir);
208
- assert.equal(c.state, "unknown");
209
- assert.match(c.why, /cannot hash locked\.txt: EACCES/);
210
- });
211
-
212
- test("an ambient GIT_DIR naming another repository does not change the answer (#1599)", (t) => {
213
- const dir = repo(t);
214
- const decoy = repo(t);
215
- writeFileSync(join(decoy, "decoy-stray.txt"), "x\n");
216
- const env = { ...process.env, GIT_DIR: join(decoy, ".git"), GIT_WORK_TREE: decoy };
217
- record(dir, env);
218
- assert.equal(readFileSync(baselinePath(dir), "utf8").includes("decoy-stray"), false, "the baseline recorded the decoy's tree");
219
- assert.equal(check(dir, env).state, "clean");
220
- writeFileSync(join(dir, "stray.txt"), "x\n");
221
- assert.deepEqual(check(dir, env).changed, ["stray.txt"]);
222
- });
223
-
224
- test("no baseline is its own refusal, never clean", (t) => {
225
- const dir = repo(t);
226
- const c = check(dir);
227
- assert.deepEqual(c, { state: "absent", root: dir, baseline: baselinePath(dir) });
228
- assert.match(describe(c, []), /^MAIN-CHECKOUT-NO-BASELINE no baseline at .*main-checkout\.sha — .*record it at run start/);
229
- });
230
-
231
- test("a baseline that exists but cannot be read is its own unknown, never clean and never 'no baseline'", { skip: ROOT }, (t) => {
232
- const dir = repo(t);
233
- record(dir);
234
- const base = baselinePath(dir);
235
-
236
- chmodSync(base, 0o000);
237
- let c = check(dir);
238
- assert.equal(c.state, "unknown");
239
- assert.equal(c.cause, "baseline");
240
- assert.match(c.why, /exists but cannot be read: EACCES/);
241
- assert.match(describe(c, []), /^MAIN-CHECKOUT-UNKNOWN baseline unreadable: .*NEVER re-baseline over it/);
242
- chmodSync(base, 0o644);
243
-
244
- // An unsearchable .fleet/ hides the file from stat: EACCES, not ENOENT.
245
- chmodSync(join(dir, ".fleet"), 0o600);
246
- c = check(dir);
247
- assert.equal(c.state, "unknown");
248
- assert.equal(c.cause, "baseline");
249
- chmodSync(join(dir, ".fleet"), 0o755);
250
-
251
- unlinkSync(base);
252
- symlinkSync(join(dir, "gone"), base);
253
- c = check(dir);
254
- assert.equal(c.state, "unknown");
255
- assert.match(c.why, /dangling symlink/);
256
- unlinkSync(base);
257
-
258
- writeFileSync(base, "deadbeef\n");
259
- c = check(dir);
260
- assert.equal(c.state, "unknown");
261
- assert.match(c.why, /not a baseline main-checkout\.mjs --record wrote/);
262
- });
263
-
264
- test("--record overwrites rather than compares: after the stray paths are resolved it clears, and it clears a dirty tree too", (t) => {
265
- const dir = repo(t);
266
- record(dir);
267
- writeFileSync(join(dir, "stray.txt"), "x\n");
268
- assert.equal(check(dir).state, "dirty");
269
- // Re-baselining while dirty certifies the tree as it stands — which is why
270
- // the runbook says resolve FIRST.
271
- record(dir);
272
- assert.equal(check(dir).state, "clean");
273
- unlinkSync(join(dir, "stray.txt"));
274
- assert.equal(check(dir).state, "dirty", "removing a path the baseline recorded is a change");
275
- });
276
-
277
- test("--record refuses over a baseline it cannot read, and leaves it in place", { skip: ROOT }, (t) => {
278
- const dir = repo(t);
279
- record(dir);
280
- const base = baselinePath(dir);
281
- chmodSync(base, 0o000);
282
- const r = recordBaseline({ cwd: dir });
283
- assert.equal(r.ok, false);
284
- assert.match(r.why, /do NOT --record over it, --record overwrites rather than compares/);
285
- chmodSync(base, 0o644);
286
- writeFileSync(base, "not a baseline\n");
287
- assert.equal(recordBaseline({ cwd: dir }).ok, false);
288
- assert.equal(readFileSync(base, "utf8"), "not a baseline\n");
289
- });
290
-
291
- test("--record refuses when git cannot look, and writes nothing", (t) => {
292
- const dir = repo(t);
293
- writeFileSync(join(dir, ".git", "index"), "not an index");
294
- const r = recordBaseline({ cwd: dir });
295
- assert.equal(r.ok, false);
296
- assert.match(r.why, /could not look, so there is nothing to record/);
297
- assert.equal(check(dir).state, "absent");
298
- });
299
-
300
- test("CLI: --record then --check, with the exit codes the header names", (t) => {
301
- const dir = repo(t);
302
- const run = (...args) => spawnSync(process.execPath, [SCRIPT, ...args], { cwd: dir, encoding: "utf8" });
303
- let r = run("--check");
304
- assert.equal(r.status, 2);
305
- assert.match(r.stdout, /^MAIN-CHECKOUT-NO-BASELINE /);
306
- r = run("--record");
307
- assert.equal(r.status, 0, r.stderr);
308
- assert.match(r.stdout, /^main-checkout: recorded 0 porcelain entries at /);
309
- r = run("--check");
310
- assert.equal(r.status, 0, r.stderr);
311
- assert.match(r.stdout, /^main-checkout: clean against /);
312
- writeFileSync(join(dir, "stray.txt"), "x\n");
313
- r = run("--check");
314
- assert.equal(r.status, 1);
315
- assert.match(r.stdout, /^MAIN-CHECKOUT-DIRTY stray\.txt — /);
316
- writeFileSync(join(dir, ".git", "index"), "not an index");
317
- r = run("--check");
318
- assert.equal(r.status, 2);
319
- assert.match(r.stdout, /^MAIN-CHECKOUT-UNKNOWN /);
320
- r = run("--record");
321
- assert.equal(r.status, 2);
322
- assert.match(r.stderr, /^main-checkout: .*could not look/m);
323
- r = run();
324
- assert.equal(r.status, 2);
325
- assert.match(r.stderr, /usage: main-checkout\.mjs --record \| --check/);
326
- r = run("--record", "--check");
327
- assert.equal(r.status, 2);
328
- assert.match(r.stderr, /usage: main-checkout\.mjs --record \| --check/);
329
- r = run("--recrod");
330
- assert.equal(r.status, 2);
331
- assert.match(r.stderr, /--recrod/, "a misspelt flag must be refused by name, never run as a check");
332
- });
@@ -1,167 +0,0 @@
1
- // #1591's outcome classification, retargeted by #1804 from the omp workpool
2
- // block to the direct-dispatch Pull (spec 2026-09-24 § 2, ruled without a
3
- // question: "#1591 outcome classification survives verbatim, keyed to the
4
- // member's own job status … reworded per member, 'confirm death first'
5
- // unchanged").
6
- //
7
- // The fact the classification rests on survives the pool: two very different
8
- // facts produce the same silence. A member that DIED (its job settled `failed`
9
- // or `cancelled` — CONTEXT.md § Coordination's Settle vocabulary) never got
10
- // the chance to bail; a member that `completed` its turn with nothing to report
11
- // is merely quiet. Collapsing either into "the member bailed" would demote a
12
- // ticket its member never judged. Only an explicit bail report — the member
13
- // naming the cause itself — may reach `Implementer bails before implementing`
14
- // and its demote-by-cause table (phase 3). What changed is only where the
15
- // status arrives from: under Pull each member's job status arrives as its own,
16
- // where a pool settled once on its whole drain.
17
- //
18
- // The second half of #1591 closed a refill loop: a demotion drops
19
- // `ready-for-agent`, and the ticket it demoted must never be the one handed
20
- // back. Under Pull the same hazard has a new shape — the shortlist file can be
21
- // older than a relabel (this run's own Pulls relabel by cause, ADR 0013
22
- // Decision 4) — and phase 1 closes it by reading the ticket's labels in the
23
- // Pull's own full read.
24
- //
25
- // TABLE-DRIVEN OVER OUTCOME SHAPES, per #1591's own acceptance criterion, so a
26
- // future edit that quietly drops ONE shape reds on exactly that entry instead
27
- // of surviving inside a still-green bundle.
28
- //
29
- // SELF-CHECK carried over from #1591's measurement: a presence-only check per
30
- // settle state passed with `cancelled` stripped from the three-state
31
- // enumeration, because a second `cancelled` occurs later in the paragraph — so
32
- // the enumeration and the collapse sentence are each pinned by their own words.
33
- import { test } from "node:test";
34
- import assert from "node:assert/strict";
35
- import { readFileSync } from "node:fs";
36
- import { join } from "node:path";
37
- import { between, paragraph, phrase, sentences } from "./prose-pin.mjs";
38
-
39
- const REPO = join(import.meta.dirname, "..");
40
- const RUN_TEAM = readFileSync(join(REPO, "skills", "run-team", "SKILL.md"), "utf8");
41
-
42
- const phase = (from, to) => between(RUN_TEAM, from, to, `run-team/SKILL.md ${from.trim()}`);
43
-
44
- const outcomeParagraph = () =>
45
- paragraph(
46
- phase("## Phase 2", "## Phase 3"),
47
- "A member settling with nothing is not, by itself, a bail.",
48
- "run-team/SKILL.md member outcome-classification paragraph",
49
- );
50
-
51
- const relabelParagraph = () =>
52
- paragraph(
53
- phase("## Phase 1", "## Phase 2"),
54
- "A Pull never re-admits a ticket already relabelled.",
55
- "run-team/SKILL.md Pull relabel-safety paragraph",
56
- );
57
-
58
- test("run-team/SKILL.md: a member's outcome arrives as its own job status", () => {
59
- assert.match(outcomeParagraph(), phrase("Each member's outcome arrives as its own job status"));
60
- });
61
-
62
- // Settle (CONTEXT.md § Coordination) is three states on omp, and the paragraph
63
- // must name all three — never fewer, which is exactly how a `failed`/
64
- // `cancelled` reading could quietly re-collapse into `completed`.
65
- for (const state of ["completed", "failed", "cancelled"]) {
66
- test(`run-team/SKILL.md: the outcome paragraph names omp's \`${state}\` settle state`, () => {
67
- assert.match(outcomeParagraph(), new RegExp("`" + state + "`"));
68
- });
69
- }
70
-
71
- test("run-team/SKILL.md: the outcome paragraph enumerates all three omp settle states together, in one list", () => {
72
- assert.match(outcomeParagraph(), phrase("Settle (CONTEXT.md § Coordination) is three states on omp — `completed`, `failed`, `cancelled` —"));
73
- });
74
-
75
- test("run-team/SKILL.md: the outcome paragraph names the failed/cancelled-vs-completed collapse as the exact failure it blocks", () => {
76
- assert.match(outcomeParagraph(), phrase("and reading `failed`/`cancelled` the same as a `completed` turn that had nothing"));
77
- assert.match(outcomeParagraph(), phrase("is the exact collapse this line blocks"));
78
- });
79
-
80
- // #1591's core acceptance, table-driven: each of the three outcome shapes gets
81
- // its OWN reading, distinct text a reader cannot satisfy by pointing at either
82
- // of the other two rows.
83
- const OUTCOME_SHAPES = [
84
- { name: "died (failed/cancelled settle)", pin: phrase("a member that died never chose to bail") },
85
- { name: "completed with nothing (alive, merely quiet)", pin: phrase("a died or merely-quiet member's silence never does") },
86
- {
87
- name: "explicit bail report",
88
- pin: phrase("Only an explicit bail report — the member itself naming the cause — reaches Implementer bails before implementing"),
89
- },
90
- ];
91
- for (const shape of OUTCOME_SHAPES) {
92
- test(`run-team/SKILL.md: the outcome paragraph gives "${shape.name}" its own reading`, () => {
93
- assert.match(outcomeParagraph(), shape.pin);
94
- });
95
- }
96
-
97
- test("run-team/SKILL.md: a dead member recovers exactly as the Member-killed row does, never as a demotion", () => {
98
- assert.match(outcomeParagraph(), phrase("Confirm death first, exactly as the Member-killed row does"));
99
- assert.match(
100
- outcomeParagraph(),
101
- phrase("A confirmed-dead member recovers exactly as the Member-killed row says — new member, new name, the SAME ticket — never a demotion"),
102
- );
103
- });
104
-
105
- // The contradiction this paragraph exists to block: reading silence itself —
106
- // with no confirmation step — as grounds to demote. Phrase-agnostic by design
107
- // (inherited narrow idiom-only regex previously missed a colon-phrased
108
- // restatement of the same forbidden meaning, e.g. "Silence alone: treat it as
109
- // a bail." — caught live against the pinned paragraph): any short clause that
110
- // co-locates "silence" with "bail" is blocked outright, and any clause that
111
- // equates "silence" with a demotion via a copula/colon/"treat as" construction
112
- // is blocked too — while the paragraph's own legitimate "so demoting its
113
- // ticket on its silence demotes a ticket" (describing the collapse the line
114
- // BLOCKS, not endorsing it) must keep passing, which is why the demote guard
115
- // requires an equivalence construction rather than bare proximity.
116
- //
117
- // The co-location is read one sentence at a time, via `sentences()`, with a
118
- // gap that tolerates a period — never a first-period `[^.]` window (#1983).
119
- // This pin is NEGATIVE, so a window cut short is its silent direction: "Treat
120
- // silence (i.e. no report) as a bail." ended the old window at "i.e." and
121
- // passed. The sentence bound is load-bearing the other way too: this
122
- // paragraph's own "never silence alone." sits 20 characters before the next
123
- // sentence's "bail", so an unbounded period-tolerant gap reds the real text.
124
- // RESIDUAL: sentences() still cuts short at a `.)`, `."`, a mid-sentence `?`,
125
- // a capitalised "E.g." or an "etc." (silent here — none of those four is in
126
- // this paragraph today), and still merges two real sentences across #1987's
127
- // `**late**.[1]` and #1899's sentence-final lowercase "vs." (an over-fire
128
- // here, also absent today). `.**` itself IS in this paragraph once (its own
129
- // opening bold lead), but that boundary is a genuine sentence end, not one
130
- // straddling the silence/bail co-location this pin reads.
131
- const silenceBails = (p) => sentences(p).filter((s) => /\bsilence\b[\s\S]{0,30}\bbail\b/i.test(s));
132
-
133
- test("run-team/SKILL.md: no text in the outcome paragraph lets silence alone stand in for a bail or a confirmed death", () => {
134
- const p = outcomeParagraph();
135
- assert.deepEqual(silenceBails(p), [], "a sentence of the outcome paragraph co-locates silence with a bail");
136
- assert.doesNotMatch(
137
- p,
138
- /\bsilence\b(?:\s+alone)?\s*[:,]?\s*(?:is|means|counts\s+as|equates?\s+to|treat(?:s|ed)?(?:\s+it)?\s+as|reads?\s+as)\s+(?:an?\s+)?(?:clean\s+)?(?:grounds?\s+(?:for|to)\s+)?demot\w*/i,
139
- );
140
- assert.doesNotMatch(p, /(?:always|automatically)\s+demote/i);
141
- assert.doesNotMatch(p, /\b(?:is|are)\s+demoted\b/i);
142
- });
143
-
144
- test("a period between silence and bail does not hide the co-location", () => {
145
- // #1983's reproduction, copied from the ticket: green under the `[^.]` window.
146
- const p = outcomeParagraph();
147
- assert.deepEqual(silenceBails(`${p} Treat silence (i.e. no report) as a bail.`), ["Treat silence (i.e. no report) as a bail."]);
148
- assert.deepEqual(silenceBails(`${p} Treat silence, per SKILL.md, as a bail.`), ["Treat silence, per SKILL.md, as a bail."]);
149
- });
150
-
151
- // #1591's second acceptance, in the Pull's shape: a relabel must hold across a
152
- // shortlist built before it landed. Both the check (the Pull's own label read)
153
- // and the failure it blocks are pinned — dropping either leaves a stale-list
154
- // admission unguarded.
155
- test("run-team/SKILL.md: a Pull reads the ticket's labels and drops one that lost `ready-for-agent`", () => {
156
- assert.match(relabelParagraph(), phrase("The shortlist file can be older than a relabel"));
157
- assert.match(relabelParagraph(), /`--json\s+title,body,comments,labels`\)\s+and\s+drop\s+it\s+when\s+`ready-for-agent`\s+is\s+gone/);
158
- assert.match(relabelParagraph(), phrase("A Pull that trusted a list built before the relabel landed would hand a ticket the fleet has already judged unimplementable straight to the next member"));
159
- });
160
-
161
- // The label the paragraph reads has to be one the Pull's full read actually
162
- // fetches — cross-checked against step 3's own invocation, the way #1591 once
163
- // cross-checked the pool's borrowed `candidates.mjs` call against phase 0's.
164
- test("run-team/SKILL.md: the Pull's full read fetches the labels the relabel check reads", () => {
165
- const step3 = between(RUN_TEAM, "3. **Read the ticket in full, once**", "One read answers every question", "run-team/SKILL.md Pull step 3");
166
- assert.match(step3, /gh\s+issue\s+view\s+<N>\s+--json\s+title,body,comments,labels/, "the Pull's full read no longer fetches `labels`, so the relabel check has nothing to read");
167
- });
@@ -1,129 +0,0 @@
1
- import { test } from "node:test";
2
- import assert from "node:assert/strict";
3
- import { existsSync, readFileSync } from "node:fs";
4
- import { spawnSync } from "node:child_process";
5
- import { join } from "node:path";
6
- import { COLUMNS } from "./member-outcomes.mjs";
7
- import { GATE } from "./cell-readout.mjs";
8
-
9
- const REPO = join(import.meta.dirname, "..", "..");
10
- const TSV = readFileSync(join(REPO, "docs", "metrics", "member-outcomes.tsv"), "utf8");
11
- // The header is the LEADING comment block, which is also exactly what the CLI
12
- // preserves across a rewrite. Slicing it — rather than collecting `#` lines from
13
- // anywhere — is what keeps the prose assertions below from being satisfied by a
14
- // stray comment sitting among the data rows.
15
- const headerLines = [];
16
- for (const l of TSV.split("\n")) {
17
- if (!l.startsWith("#") && l.trim()) break;
18
- headerLines.push(l);
19
- }
20
- const HEADER = headerLines.join("\n");
21
- // A comment block as prose: comment markers stripped, whitespace collapsed, so
22
- // a pinned sentence survives a re-wrap.
23
- const flat = (s) => s.replace(/^\/\/ ?|^# ?/gm, "").replace(/\s+/g, " ");
24
-
25
- test("the header's column line matches COLUMNS exactly, in order", () => {
26
- // Drift here is silent and total: every awk one-liner in the header indexes
27
- // by position, so a column inserted in the code shifts $5 for every reader.
28
- //
29
- // Anchored on the tab-separated shape, not on `includes("run_date")`: the
30
- // loose lookup took the first top-down match, so a future header paragraph
31
- // that merely mentioned run_date above this line would silently pin prose.
32
- const line = headerLines.find((l) => l.startsWith("# session\t"));
33
- assert.ok(line, "header has no `# session<TAB>...` column line");
34
- assert.deepEqual(line.replace(/^#\s*/, "").split("\t"), COLUMNS);
35
- });
36
-
37
- test("the header states the blank, hand-edit, and superseded-generation rules", () => {
38
- // All three are load-bearing and none is enforceable in code, so prose is the
39
- // only carrier — which is what makes them worth pinning. The third is the one
40
- // most likely to be dropped as noise by a future editor, and dropping it is
41
- // how an older, dearer generation gets read as a cheap tier.
42
- //
43
- // Matched against the HEADER SLICE, not the whole file: matching the file
44
- // meant a pinned rule that had been moved down among the data rows still
45
- // satisfied the pin.
46
- assert.match(HEADER, /BLANK MEANS UNKNOWN/);
47
- // …and the one column where it does not. Blank `subagent_type` is a closed
48
- // category, not missing data: on an omp row the transcript carried no
49
- // `session_init` agent to read, on a claude row the dispatch was untyped.
50
- // Read as "unknown" it turns thousands of pre-2026-08-28 rows into evidence
51
- // someone believes a re-scrape could recover, which is how #1066's
52
- // over-count got argued for in the first place.
53
- assert.match(HEADER, /ITS BLANK IS NOT UNKNOWN/);
54
- assert.match(HEADER, /NEVER hand-edit a row/);
55
- assert.match(HEADER, /SUPERSEDED GENERATIONS ARE A SEPARATE POPULATION/);
56
- assert.match(HEADER, /OPAQUE JOIN KEY/);
57
- // The corpus spans both transcript depths. A reader who assumes the flat half
58
- // only would under-count every review role by roughly half.
59
- assert.match(HEADER, /workflows\/wf_/);
60
- });
61
-
62
- test("the blank-subagent_type wording says what blank means per harness: omp in the header and the script, claude in the header", () => {
63
- // On omp an untyped dispatch records the generic `task`; blank is only a
64
- // transcript with no `session_init` agent to read. Both places that restate
65
- // the column must say so, and neither may call an omp blank an untyped
66
- // dispatch. The claude rows are the other population — there blank IS an
67
- // untyped dispatch — and only the header describes them, so only it is held
68
- // to saying so.
69
- const SRC = readFileSync(join(import.meta.dirname, "member-outcomes.mjs"), "utf8");
70
- for (const [where, text] of [["header", flat(HEADER)], ["script", flat(SRC)]]) {
71
- assert.match(text, /no `session_init` agent to read/, `${where}: blank's cause`);
72
- assert.match(text, /records the generic `task`/, `${where}: untyped dispatch's record`);
73
- assert.doesNotMatch(text, /named no (agent )?definition/, `${where}: stale wording`);
74
- assert.doesNotMatch(text, /untyped Task call/, `${where}: stale wording`);
75
- }
76
- assert.match(flat(HEADER), /claude row[^.]*blank means the sidecar carried no `customAgentType`/, "header: claude's blank");
77
- });
78
-
79
- test("the header's awk read-out indexes the column it names", () => {
80
- // Read the `$n` reference out of the header's own awk line and resolve it
81
- // against COLUMNS — a fact about the CODE alone (COLUMNS[4]) stays green when
82
- // the header is repointed. Mutation this must survive: changing the `$n` in
83
- // the header without changing COLUMNS.
84
- const byModel = headerLines.find((l) => /\{n\[\$\d+\]\+\+\}/.test(l));
85
- assert.ok(byModel, "header lost its rows-by-model read-out");
86
- assert.equal(COLUMNS[/\{n\[\$(\d+)\]\+\+\}/.exec(byModel)[1] - 1], "model");
87
- });
88
-
89
- // The comparison count is cell-readout.mjs's, and the header only points at it:
90
- // a second copy of the definition as a runnable query is two countings free to
91
- // drift apart, which is how the pre-cell pair query came to count pairs no cell
92
- // owns once the cell grid replaced the two definitions it keyed on.
93
- test("the header points at cell-readout.mjs for a cell's comparisons and carries no query of its own", () => {
94
- const invocation = headerLines.find((l) => /^#\s+node \S*cell-readout\.mjs\s*$/.test(l));
95
- assert.ok(invocation, "header lost its `node plugin/scripts/cell-readout.mjs` pointer");
96
- const script = invocation.replace(/^#\s+node\s+/, "").trim();
97
- assert.equal(script, "plugin/scripts/cell-readout.mjs");
98
- assert.ok(existsSync(join(REPO, script)), `the header points at ${script}, which does not exist`);
99
- // The pointer is runnable as written, from the repo root, against this
100
- // repo's own metrics files.
101
- const r = spawnSync(process.execPath, [script], { cwd: REPO, encoding: "utf8" });
102
- assert.equal(r.status, 0, r.stderr);
103
-
104
- assert.doesNotMatch(HEADER, /fleet-implementer-alt\$\//, "the header still carries the pre-cell pair query");
105
- const subagentType = new RegExp(`\\$${COLUMNS.indexOf("subagent_type") + 1}(?!\\d)`);
106
- assert.ok(
107
- !headerLines.some((l) => subagentType.test(l)),
108
- "an awk read-out over `subagent_type` is a second counting of comparisons",
109
- );
110
-
111
- // The definition the header states is the one the script applies.
112
- const block = flat(HEADER);
113
- assert.match(block, /a comparison is one session holding an ADMISSIBLE row at X and an admissible slow-high row whose resolved \(`model`, `effort`\) differ from the X row's/);
114
- assert.match(block, /admissible only when its `subagent_type` is `fleet-implementer-<chosen_cell>` and its `effort` is the cell's level/);
115
- assert.match(block, /joined to its row here on `session`\+`agent`/);
116
- const gate = /at least (\w+) comparisons across (\w+) or more distinct `run_date`s/.exec(block);
117
- assert.ok(gate, "the header no longer states the gate");
118
- const words = { five: 5, ten: 10 };
119
- assert.deepEqual({ comparisons: words[gate[1]], runDates: words[gate[2]] }, { ...GATE }, "the header's gate is not cell-readout.mjs's GATE");
120
- assert.match(block, /`<cell> <comparisons> <run_dates> <resolved models>`/);
121
- assert.match(block, /`mixed \(<model-a> n=…, <model-b> n=…\)`/);
122
- });
123
-
124
- test("the header names a producer script that exists", () => {
125
- const producer = /produced by (\S+\.mjs)/.exec(HEADER);
126
- assert.ok(producer, "the header no longer names the script that produces its rows");
127
- assert.ok(existsSync(join(REPO, producer[1])), `the header names ${producer[1]} as its producer, which does not exist`);
128
- assert.equal(producer[1], "plugin/scripts/member-outcomes.mjs");
129
- });