@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,615 +0,0 @@
1
- // cell-readout.mjs: the per-cell gate over ticket-features.tsv joined to
2
- // member-outcomes.tsv, run as the CLI against synthetic fixture files.
3
- import { test } from "node:test";
4
- import assert from "node:assert/strict";
5
- import { spawnSync } from "node:child_process";
6
- import { existsSync, readFileSync, writeFileSync } from "node:fs";
7
- import { dirname, join } from "node:path";
8
- import { fileURLToPath } from "node:url";
9
- import { tempDir } from "./temp-dir.mjs";
10
- import { paragraph, phrase, unemphasized } from "./prose-pin.mjs";
11
- import { formatTsv } from "./member-outcomes.mjs";
12
- import { FEATURE_COLUMNS } from "./pr-cost.mjs";
13
- import { readout, stoppingRule, GATE, STOP } from "./cell-readout.mjs";
14
-
15
- const SCRIPT = fileURLToPath(new URL("./cell-readout.mjs", import.meta.url));
16
-
17
- const member = (o) => ({
18
- run_date: "2026-10-01", role: "implementer", member: o.agent, model: "claude-opus-5", effort: "high",
19
- ticket: "", pr: "", tokensCacheCreate: 0, tokensOut: 0, wallS: 0, turns: 1, harness: "omp",
20
- tokensIn: 0, tokensCacheRead: 0, tokensCacheWrite1h: 0, cost: 0, ...o,
21
- });
22
- const pull = (o) => ({
23
- run_date: "2026-10-01", policy_cell: "slow-high", exploration_draw: "", sizing_src: "rule", sizing_pre: "",
24
- router_usd: "", brief_chars: "100", criteria: "1", comments: "0", age_days: "0", paths: "0",
25
- test_paths: "0", xrefs: "0", kind: "enhancement", ...o,
26
- });
27
-
28
- function world() {
29
- return { features: [], members: [], ticket: 100 };
30
- }
31
- // One implementer Pull at `cell` in `session`, and the member row it left.
32
- // `model`/`effort`/`subagentType` override what resolved and what was dispatched.
33
- function addRow(w, { session, date, cell, model, effort, subagentType, member: withMember = true }) {
34
- const ticket = String(w.ticket++);
35
- const agent = `impl-${ticket}`;
36
- const level = cell.split("-").slice(1).join("-");
37
- w.features.push(pull({ session, agent, ticket, chosen_cell: cell }));
38
- if (withMember) {
39
- w.members.push(member({
40
- session, agent, run_date: date, ticket,
41
- model: model ?? (cell.startsWith("slow-") ? "claude-opus-5" : "claude-sonnet-5"),
42
- effort: effort ?? level, subagentType: subagentType ?? `fleet-implementer-${cell}`,
43
- }));
44
- }
45
- }
46
- // `n` sessions, each one comparison for `cell`: a `cell` row beside a slow-high
47
- // row, spread round-robin over `dates` distinct run_dates.
48
- let nextSession = 0;
49
- function addComparisons(w, cell, n, dates, rowOpts = {}) {
50
- for (let i = 0; i < n; i++) {
51
- const session = `2026-10-01T00-00-00-000Z_s${nextSession++}`;
52
- const date = `2026-10-${String(1 + (i % dates)).padStart(2, "0")}`;
53
- addRow(w, { session, date, cell, ...rowOpts });
54
- addRow(w, { session, date, cell: "slow-high" });
55
- }
56
- }
57
-
58
- function files(w) {
59
- const dir = tempDir("cell-readout-");
60
- const features = join(dir, "ticket-features.tsv");
61
- const members = join(dir, "member-outcomes.tsv");
62
- writeFileSync(features, [FEATURE_COLUMNS.join("\t"), ...w.features.map((r) => FEATURE_COLUMNS.map((c) => r[c] ?? "").join("\t"))].join("\n") + "\n");
63
- writeFileSync(members, "# header\n" + formatTsv(w.members));
64
- return { features, members, dir };
65
- }
66
- function cli(w, extra = []) {
67
- const f = files(w);
68
- return spawnSync(process.execPath, [SCRIPT, "--ticket-features", f.features, "--member-outcomes", f.members, ...extra], { encoding: "utf8", cwd: f.dir });
69
- }
70
- const lineFor = (stdout, cell) => stdout.split("\n").find((l) => l.split(" ")[0] === cell);
71
-
72
- test("the gate is ten comparisons across five run_dates: nine across five does not gate, ten across five does", () => {
73
- const nine = world();
74
- addComparisons(nine, "task-high", 9, 5);
75
- const below = cli(nine);
76
- assert.equal(below.status, 0, below.stderr);
77
- assert.equal(lineFor(below.stdout, "task-high"), undefined, "a cell below the gate prints no line");
78
- assert.match(below.stderr, /task-high below the gate: 9 comparisons across 5 run_dates/);
79
-
80
- const ten = world();
81
- addComparisons(ten, "task-high", 10, 5);
82
- const at = cli(ten);
83
- assert.equal(at.status, 0, at.stderr);
84
- assert.equal(lineFor(at.stdout, "task-high"), "task-high 10 5 claude-sonnet-5");
85
- assert.doesNotMatch(at.stderr, /task-high below the gate/);
86
- assert.deepEqual(GATE, { comparisons: 10, runDates: 5 });
87
- });
88
-
89
- test("ten comparisons across four run_dates does not gate: both halves of the gate bind", () => {
90
- const w = world();
91
- addComparisons(w, "task-high", 12, 4);
92
- const r = cli(w);
93
- assert.equal(r.status, 0, r.stderr);
94
- assert.equal(lineFor(r.stdout, "task-high"), undefined);
95
- assert.match(r.stderr, /task-high below the gate: 12 comparisons across 4 run_dates/);
96
- });
97
-
98
- test("two resolved models in one cell's gate window print `mixed (...)` with each model's row count", () => {
99
- const w = world();
100
- addComparisons(w, "task-high", 7, 5);
101
- addComparisons(w, "task-high", 3, 3, { model: "claude-opus-5" });
102
- const r = cli(w);
103
- assert.equal(r.status, 0, r.stderr);
104
- // claude-opus-5 at task-high/high still differs from slow-high only if its
105
- // effort does — it does not, so those three sessions are no comparison.
106
- assert.match(r.stderr, /task-high below the gate: 7 comparisons across 5 run_dates/);
107
-
108
- const gated = world();
109
- addComparisons(gated, "task-high", 10, 5);
110
- addComparisons(gated, "task-high", 2, 1, { model: "claude-haiku-4-5" });
111
- const g = cli(gated);
112
- assert.equal(g.status, 0, g.stderr);
113
- assert.equal(lineFor(g.stdout, "task-high"), "task-high 12 5 mixed (claude-sonnet-5 n=10, claude-haiku-4-5 n=2)");
114
- });
115
-
116
- test("a comparison is one session, however many rows it holds, and a row on each side is required", () => {
117
- const w = world();
118
- // One session, three task-high rows and two slow-high rows: one comparison.
119
- addRow(w, { session: "sA", date: "2026-10-01", cell: "task-high" });
120
- addRow(w, { session: "sA", date: "2026-10-01", cell: "task-high" });
121
- addRow(w, { session: "sA", date: "2026-10-01", cell: "task-high" });
122
- addRow(w, { session: "sA", date: "2026-10-01", cell: "slow-high" });
123
- addRow(w, { session: "sA", date: "2026-10-01", cell: "slow-high" });
124
- // task-high with no slow-high beside it, and slow-high alone: no comparison.
125
- addRow(w, { session: "sB", date: "2026-10-02", cell: "task-high" });
126
- addRow(w, { session: "sC", date: "2026-10-03", cell: "slow-high" });
127
- // A pair split across two sessions is no comparison either.
128
- addRow(w, { session: "sD", date: "2026-10-04", cell: "smol-high" });
129
- addRow(w, { session: "sE", date: "2026-10-04", cell: "slow-high" });
130
- const [task, smol] = ["task-high", "smol-high"].map((c) => readout(parsed(w)).cells.find((x) => x.cell === c));
131
- assert.deepEqual([task.comparisons, task.runDates], [1, 1]);
132
- assert.deepEqual([smol.comparisons, smol.runDates], [0, 0]);
133
- });
134
-
135
- test("only admissible rows count: dispatched as the drawn cell's definition, at the cell's level, with a model on record", () => {
136
- const w = world();
137
- const s = (n) => `s-adm-${n}`;
138
- // effort off the cell's level (a clamp): inadmissible
139
- addRow(w, { session: s(1), date: "2026-10-01", cell: "task-high", effort: "medium" });
140
- addRow(w, { session: s(1), date: "2026-10-01", cell: "slow-high" });
141
- // dispatched as a generic task, not the cell's definition: inadmissible
142
- addRow(w, { session: s(2), date: "2026-10-01", cell: "task-high", subagentType: "task" });
143
- addRow(w, { session: s(2), date: "2026-10-01", cell: "slow-high" });
144
- // the slow-high side dispatched as the pre-cutover definition: inadmissible
145
- addRow(w, { session: s(3), date: "2026-10-01", cell: "task-high" });
146
- addRow(w, { session: s(3), date: "2026-10-01", cell: "slow-high", subagentType: "fleet-implementer" });
147
- // the slow-high side has no member row at all: no join, inadmissible
148
- addRow(w, { session: s(4), date: "2026-10-01", cell: "task-high" });
149
- addRow(w, { session: s(4), date: "2026-10-01", cell: "slow-high", member: false });
150
- // blank model: the resolved model is unknown, so nothing can differ from it
151
- addRow(w, { session: s(5), date: "2026-10-01", cell: "task-high", model: "" });
152
- addRow(w, { session: s(5), date: "2026-10-01", cell: "slow-high" });
153
- // the control: admissible on both sides
154
- addRow(w, { session: s(6), date: "2026-10-01", cell: "task-high" });
155
- addRow(w, { session: s(6), date: "2026-10-01", cell: "slow-high" });
156
- const task = readout(parsed(w)).cells.find((x) => x.cell === "task-high");
157
- assert.equal(task.comparisons, 1, "only the admissible session counts");
158
- assert.deepEqual([...task.models], [["claude-sonnet-5", 3]], "the models column reads admissible rows only — sessions 3, 4 and 6");
159
- });
160
-
161
- test("a comparison needs a resolved (model, effort) that differs from slow-high's — the same model at a different level counts", () => {
162
- const w = world();
163
- // task-high resolved to slow-high's own model at the same level: empty comparison
164
- addRow(w, { session: "sSame", date: "2026-10-01", cell: "task-high", model: "claude-opus-5" });
165
- addRow(w, { session: "sSame", date: "2026-10-01", cell: "slow-high" });
166
- // slow-medium: same model, a different effort — a real comparison
167
- addRow(w, { session: "sEff", date: "2026-10-02", cell: "slow-medium" });
168
- addRow(w, { session: "sEff", date: "2026-10-02", cell: "slow-high" });
169
- const rows = readout(parsed(w)).cells;
170
- assert.equal(rows.find((x) => x.cell === "task-high").comparisons, 0);
171
- assert.equal(rows.find((x) => x.cell === "slow-medium").comparisons, 1);
172
- assert.equal(rows.find((x) => x.cell === "slow-high"), undefined, "slow-high is the baseline, never a readout line");
173
- });
174
-
175
- test("a run_date is the comparison session's member-outcomes run_date, not the ticket-features one", () => {
176
- const w = world();
177
- addComparisons(w, "task-high", 10, 5);
178
- for (const f of w.features) f.run_date = "2026-09-01";
179
- const r = cli(w);
180
- assert.equal(lineFor(r.stdout, "task-high"), "task-high 10 5 claude-sonnet-5");
181
- });
182
-
183
- test("a re-dispatched Pull is one Pull: two ticket-features rows for one session+agent count the member row once", () => {
184
- const w = world();
185
- addRow(w, { session: "sRe", date: "2026-10-01", cell: "task-high" });
186
- addRow(w, { session: "sRe", date: "2026-10-01", cell: "slow-high" });
187
- // The re-dispatch: the same Pull's features row again, on the same member row.
188
- w.features.push({ ...w.features[0] });
189
- // An unjoined Pull, likewise written twice.
190
- addRow(w, { session: "sOrphan", date: "2026-10-01", cell: "smol-high", member: false });
191
- w.features.push({ ...w.features[w.features.length - 1] });
192
- const { cells, unjoined } = readout(parsed(w));
193
- const task = cells.find((x) => x.cell === "task-high");
194
- assert.equal(task.comparisons, 1);
195
- assert.deepEqual([...task.models], [["claude-sonnet-5", 1]], "the member row behind a re-dispatched Pull is counted once");
196
- assert.equal(unjoined, 1, "a re-dispatched Pull with no member row is one unjoined Pull");
197
- });
198
-
199
- test("two ticket-features rows for one session+agent naming different cells are refused, naming the session, agent and both cells", () => {
200
- const w = world();
201
- addRow(w, { session: "sTorn", date: "2026-10-01", cell: "task-high" });
202
- addRow(w, { session: "sTorn", date: "2026-10-01", cell: "slow-high" });
203
- // The same Pull's row again, drawn at another cell: which cell ran is unknown.
204
- w.features.push({ ...w.features[0], chosen_cell: "smol-high" });
205
- const f = files(w);
206
- const r = spawnSync(process.execPath, [SCRIPT, "--ticket-features", f.features, "--member-outcomes", f.members], { encoding: "utf8", cwd: f.dir });
207
- assert.equal(r.status, 2, r.stderr);
208
- assert.equal(r.stdout, "");
209
- assert.equal(r.stderr, `\ncell-readout: ${f.features}: session sTorn agent impl-100 has two rows, chosen_cell 'task-high' and 'smol-high'\n`);
210
- assert.throws(() => readout(parsed(w)), /session sTorn agent impl-100 has two rows, chosen_cell 'task-high' and 'smol-high'/);
211
- });
212
-
213
- // What the refusal must ACCEPT: a repeat that agrees on the cell, whatever else
214
- // it differs on, and one agent name reused in another session.
215
- test("a repeated session+agent on the same cell is one Pull even when its other columns differ, and the key is the session+agent pair", () => {
216
- const w = world();
217
- addRow(w, { session: "sSame", date: "2026-10-01", cell: "task-high" });
218
- addRow(w, { session: "sSame", date: "2026-10-01", cell: "slow-high" });
219
- w.features.push({ ...w.features[0], run_date: "2026-10-02", brief_chars: "200" });
220
- // impl-100 again, in another session and at another cell: a different Pull.
221
- addRow(w, { session: "sOther", date: "2026-10-02", cell: "smol-high" });
222
- w.features.at(-1).agent = "impl-100";
223
- w.members.at(-1).agent = "impl-100";
224
- w.members.at(-1).member = "impl-100";
225
- addRow(w, { session: "sOther", date: "2026-10-02", cell: "slow-high" });
226
- const r = cli(w);
227
- assert.equal(r.status, 0, r.stderr);
228
- const { cells } = readout(parsed(w));
229
- const of = (cell) => cells.find((c) => c.cell === cell);
230
- assert.deepEqual([of("task-high").comparisons, [...of("task-high").models]], [1, [["claude-sonnet-5", 1]]]);
231
- assert.equal(of("smol-high").comparisons, 1);
232
- });
233
-
234
- test("a blank member-outcomes run_date is no date: its session is a comparison but adds nothing to the distinct-date count", () => {
235
- const w = world();
236
- addComparisons(w, "task-high", 4, 4);
237
- for (let i = 0; i < 6; i++) {
238
- const session = `sBlank${i}`;
239
- addRow(w, { session, date: "", cell: "task-high" });
240
- addRow(w, { session, date: "", cell: "slow-high" });
241
- }
242
- const task = readout(parsed(w)).cells.find((x) => x.cell === "task-high");
243
- assert.equal(task.comparisons, 10);
244
- assert.deepEqual([task.runDates, task.gated], [4, false], "ten comparisons over four real dates is below the five-date floor");
245
- assert.ok(!task.dates.includes(""), "a blank run_date is listed as a date");
246
- });
247
-
248
- test("gated cells print sorted by cell name, not in ticket-features order", () => {
249
- const w = world();
250
- // Rows are added in reverse alphabetical order: task-high first, smol-high second.
251
- addComparisons(w, "task-high", 10, 5);
252
- addComparisons(w, "smol-high", 10, 5);
253
- const r = cli(w);
254
- assert.equal(r.status, 0, r.stderr);
255
- assert.deepEqual(
256
- r.stdout.split("\n").filter(Boolean),
257
- ["smol-high 10 5 claude-sonnet-5", "task-high 10 5 claude-sonnet-5"],
258
- );
259
- });
260
-
261
- test("equal per-model counts in a mixed cell list models alphabetically", () => {
262
- const w = world();
263
- // Reverse-alphabetical insertion order: sonnet rows first, then haiku, five each.
264
- addComparisons(w, "task-high", 5, 5, { model: "claude-sonnet-5" });
265
- addComparisons(w, "task-high", 5, 5, { model: "claude-haiku-4-5" });
266
- const r = cli(w);
267
- assert.equal(r.status, 0, r.stderr);
268
- assert.equal(lineFor(r.stdout, "task-high"), "task-high 10 5 mixed (claude-haiku-4-5 n=5, claude-sonnet-5 n=5)");
269
- });
270
-
271
- // run-team/SKILL.md sends the controller here for a cell's comparison count.
272
- // The prose is the only thing that does, and nothing else reads it: renaming
273
- // the script or pointing the floor back at another query leaves every test
274
- // above green. Each slice starts at an anchor that must occur exactly once and
275
- // ends at the paragraph's blank line, so a restatement elsewhere in the file
276
- // cannot satisfy a pin on the paragraph that carries the rule.
277
- const RUN_TEAM = readFileSync(join(import.meta.dirname, "..", "skills", "run-team", "SKILL.md"), "utf8");
278
-
279
- test("SKILL.md's floor names the script that prints a cell's count, and that script exists", () => {
280
- const floor = unemphasized(paragraph(RUN_TEAM, "**Report the count the per-cell readout prints", "run-team's per-cell floor"));
281
- const named = /`~\/\.fleet\/bin\/fleet-run (\S+\.mjs)`/.exec(floor)?.[1];
282
- assert.ok(named, "the floor no longer tells the controller which script to run");
283
- assert.equal(named, "cell-readout.mjs");
284
- assert.ok(existsSync(join(dirname(SCRIPT), named)), `${named} is not a script beside cell-readout.mjs`);
285
- assert.match(floor, phrase("prints `<cell> <comparisons> <run_dates> <resolved models>` for each cell past that floor"));
286
- assert.match(floor, phrase("a cell below it only as a count on stderr"));
287
- });
288
-
289
- test("the line SKILL.md says the readout prints is the line it prints: four fields, a cell below the floor on stderr only", () => {
290
- const gated = world();
291
- addComparisons(gated, "task-high", 10, 5);
292
- addComparisons(gated, "smol-high", 2, 2);
293
- const r = cli(gated);
294
- assert.equal(r.status, 0, r.stderr);
295
- assert.equal(lineFor(r.stdout, "task-high"), "task-high 10 5 claude-sonnet-5");
296
- assert.equal(lineFor(r.stdout, "smol-high"), undefined, "a cell below the floor must not print on stdout");
297
- assert.match(r.stderr, /smol-high below the gate: 2 comparisons/);
298
- });
299
-
300
- test("SKILL.md says the readout counts a pair only when the two rows ran a different model or effort, as the readout does", () => {
301
- const deliberate = unemphasized(paragraph(RUN_TEAM, "**The readout counts DELIBERATE comparisons.**", "run-team's DELIBERATE paragraph"));
302
- assert.match(deliberate, phrase("the two rows must actually have RUN a different model or effort"));
303
- // Run, not read: the same model at the same level is no comparison, the same
304
- // model at a different level is one, a different model at the same level is one.
305
- const w = world();
306
- addRow(w, { session: "sNone", date: "2026-10-01", cell: "task-high", model: "claude-opus-5" });
307
- addRow(w, { session: "sNone", date: "2026-10-01", cell: "slow-high" });
308
- addRow(w, { session: "sModel", date: "2026-10-02", cell: "task-high" });
309
- addRow(w, { session: "sModel", date: "2026-10-02", cell: "slow-high" });
310
- addRow(w, { session: "sEffort", date: "2026-10-03", cell: "slow-medium" });
311
- addRow(w, { session: "sEffort", date: "2026-10-03", cell: "slow-high" });
312
- const { cells } = readout(parsed(w));
313
- const countOf = (cell) => cells.find((c) => c.cell === cell).comparisons;
314
- assert.deepEqual([countOf("task-high"), countOf("slow-medium")], [1, 1]);
315
- });
316
-
317
- test("the output identifies no comparison: no session, ticket or agent appears on either stream", () => {
318
- const w = world();
319
- addComparisons(w, "task-high", 10, 5);
320
- addComparisons(w, "smol-high", 3, 2);
321
- addRow(w, { session: "sOrphan", date: "2026-10-01", cell: "task-high", member: false });
322
- const r = cli(w);
323
- assert.equal(r.status, 0, r.stderr);
324
- const out = r.stdout + r.stderr;
325
- for (const f of w.features) {
326
- assert.ok(!out.includes(f.session), `output names session ${f.session}`);
327
- assert.ok(!out.includes(f.agent), `output names agent ${f.agent}`);
328
- }
329
- assert.match(r.stderr, /1 ticket-features row has no member-outcomes row/);
330
- });
331
-
332
- test("an empty ticket-features.tsv prints no line and says why, exit 0", () => {
333
- const r = cli(world());
334
- assert.equal(r.status, 0, r.stderr);
335
- assert.equal(r.stdout, "");
336
- assert.match(r.stderr, /no cell other than slow-high has a ticket-features row/);
337
- });
338
-
339
- test("usage and input errors exit 2 and print nothing on stdout", () => {
340
- const w = world();
341
- addComparisons(w, "task-high", 1, 1);
342
- const f = files(w);
343
- for (const args of [
344
- ["--ticket-features", join(f.dir, "absent.tsv"), "--member-outcomes", f.members],
345
- ["--ticket-features", f.features, "--member-outcomes", join(f.dir, "absent.tsv")],
346
- ["--ticket-features", f.features, "--member-outcomes", f.members, "--bogus"],
347
- ]) {
348
- const r = spawnSync(process.execPath, [SCRIPT, ...args], { encoding: "utf8", cwd: f.dir });
349
- assert.equal(r.status, 2, `${args.join(" ")}: ${r.stderr}`);
350
- assert.equal(r.stdout, "");
351
- }
352
- writeFileSync(f.members, "# header\nshort\trow\n");
353
- const bad = spawnSync(process.execPath, [SCRIPT, "--ticket-features", f.features, "--member-outcomes", f.members], { encoding: "utf8", cwd: f.dir });
354
- assert.equal(bad.status, 2, bad.stderr);
355
- assert.match(bad.stderr, /malformed row/);
356
- });
357
-
358
- test("with no flags it reads docs/metrics/ under the working directory", () => {
359
- const w = world();
360
- addComparisons(w, "task-high", 10, 5);
361
- const f = files(w);
362
- const metrics = join(f.dir, "docs", "metrics");
363
- spawnSync("mkdir", ["-p", metrics]);
364
- spawnSync("cp", [f.features, f.members, metrics]);
365
- const r = spawnSync(process.execPath, [SCRIPT], { encoding: "utf8", cwd: f.dir });
366
- assert.equal(r.status, 0, r.stderr);
367
- assert.equal(lineFor(r.stdout, "task-high"), "task-high 10 5 claude-sonnet-5");
368
- });
369
-
370
- // The pure function's inputs, parsed the way the CLI parses them.
371
- function parsed(w) {
372
- return {
373
- features: w.features.map((r) => ({ ...r })),
374
- members: w.members.map((r) => ({ ...r })),
375
- };
376
- }
377
-
378
- // ---------------------------------------------------------------------------
379
- // The per-cell stopping rule: admissible Pulls at a cell, joined to their
380
- // ticket's last tier-outcomes row.
381
-
382
- const verdict = (o) => ({
383
- run_date: "2026-10-03", pr: "", ticket: "", class: "", tier: "", closed_own_ticket: "yes",
384
- minted_false_claim: "no", note: "n", sizing: "", profile: "", loc: "", files: "", ...o,
385
- });
386
- // `n` admissible Pulls at `cell` on `date`, each ruled; the first `failures` fail the floor,
387
- // alternating between its two halves.
388
- function addVerdicts(w, cell, n, failures, { date = "2026-10-02", ...rowOpts } = {}) {
389
- w.verdicts ??= [];
390
- for (let i = 0; i < n; i++) {
391
- addRow(w, { session: `2026-10-02T00-00-00-000Z_v${nextSession++}`, date, cell, ...rowOpts });
392
- const p = w.features.at(-1);
393
- p.run_date = date;
394
- const fail = i < failures;
395
- w.verdicts.push(verdict({
396
- ticket: p.ticket, pr: String(Number(p.ticket) + 5000),
397
- minted_false_claim: fail && i % 2 === 0 ? "yes" : "no", closed_own_ticket: fail && i % 2 === 1 ? "no" : "yes",
398
- }));
399
- }
400
- }
401
- const stop = (w, added) => stoppingRule({ ...parsed(w), verdicts: (w.verdicts ?? []).map((r) => ({ ...r })), added });
402
- const judged = (w, added, cell) => stop(w, added).find((c) => c.cell === cell);
403
-
404
- test("stopping rule: ten verdicts with eight floor failures stop the cell; seven, or nine verdicts all failing, do not", () => {
405
- const added = { "smol-high": "2026-09-01" };
406
- const eight = world();
407
- addVerdicts(eight, "smol-high", 10, 8);
408
- const at = judged(eight, added, "smol-high");
409
- assert.equal(at.verdicts.length, STOP.verdicts);
410
- assert.equal(at.failures, 8, "both floor halves count: minted_false_claim=yes and closed_own_ticket=no");
411
- assert.equal(at.stop, true);
412
- assert.equal(at.since, "2026-09-01");
413
- assert.deepEqual(Object.keys(at.verdicts[0]).sort(), ["closed_own_ticket", "failed", "minted_false_claim", "pr", "run_date", "ticket"]);
414
-
415
- const seven = world();
416
- addVerdicts(seven, "smol-high", 10, 7);
417
- assert.equal(judged(seven, added, "smol-high").stop, false, "70% is under the 80% floor-failure rate");
418
-
419
- const nine = world();
420
- addVerdicts(nine, "smol-high", 9, 9);
421
- assert.equal(judged(nine, added, "smol-high").stop, false, "nine verdicts are under the ten the rule needs");
422
-
423
- // Past ten verdicts the rate alone decides: 28 of 35 is 80%, 27 of 35 under it.
424
- const exact = world();
425
- addVerdicts(exact, "smol-high", 35, 28);
426
- assert.equal(judged(exact, added, "smol-high").stop, true);
427
- const under = world();
428
- addVerdicts(under, "smol-high", 35, 27);
429
- assert.equal(judged(under, added, "smol-high").stop, false);
430
- });
431
-
432
- test("stopping rule: a cell's verdicts are listed by ascending ticket number however the corpus orders them", () => {
433
- const w = world();
434
- w.ticket = 95; // 95..104 crosses a digit boundary: a string sort would put 100 before 95
435
- addVerdicts(w, "smol-high", 10, 0);
436
- w.features.reverse();
437
- w.verdicts.reverse();
438
- const at = judged(w, { "smol-high": "2026-09-01" }, "smol-high");
439
- assert.deepEqual(at.verdicts.map((v) => v.ticket), ["95", "96", "97", "98", "99", "100", "101", "102", "103", "104"]);
440
- });
441
-
442
- test("stopping rule: only admissible Pulls on or after the definition was last added count, at a cell with a live definition other than the policy cell", () => {
443
- const w = world();
444
- addVerdicts(w, "smol-high", 10, 10, { date: "2026-10-02" });
445
- addVerdicts(w, "task-high", 10, 10, { effort: "medium" });
446
- addVerdicts(w, "task-high", 2, 2, { subagentType: "task" });
447
- addVerdicts(w, "slow-high", 10, 10);
448
- addVerdicts(w, "task-max", 10, 10);
449
- const out = stop(w, { "smol-high": "2026-10-03", "task-high": "2026-09-01", "slow-high": "2026-09-01" });
450
- assert.deepEqual(out.map((c) => c.cell), ["smol-high", "task-high"], "slow-high is the policy cell; task-max has no definition");
451
- assert.equal(out[0].verdicts.length, 0, "every Pull predates the definition's re-add");
452
- assert.equal(out[1].verdicts.length, 0, "a clamped effort or a generic dispatch is not admissible");
453
- assert.equal(out[0].stop, false);
454
-
455
- const reAdded = stop(w, { "smol-high": "2026-10-02" });
456
- assert.equal(reAdded[0].verdicts.length, 10, "a Pull dated the day the definition was added counts");
457
- assert.equal(reAdded[0].stop, true);
458
- });
459
-
460
- test("stopping rule: a ticket counts once, judged by its last tier-outcomes row, and a `+`-joined ticket field rules each ticket", () => {
461
- const w = world();
462
- addVerdicts(w, "smol-high", 10, 10);
463
- const [first, second] = w.features;
464
- // A re-dispatch of the first ticket in its own session: same ticket, same cell.
465
- addRow(w, { session: first.session, date: "2026-10-02", cell: "smol-high" });
466
- Object.assign(w.features.at(-1), { ticket: first.ticket, agent: `impl-${first.ticket}-2`, run_date: "2026-10-02" });
467
- Object.assign(w.members.at(-1), { ticket: first.ticket, agent: `impl-${first.ticket}-2`, member: `impl-${first.ticket}-2` });
468
- // A later ruling of the first ticket passes the floor, and the second ticket's
469
- // only ruling now shares a row with another ticket.
470
- w.verdicts.push(verdict({ ticket: first.ticket, pr: "9001" }));
471
- w.verdicts.find((v) => v.ticket === second.ticket).ticket = `77+${second.ticket}`;
472
- const at = judged(w, { "smol-high": "2026-09-01" }, "smol-high");
473
- assert.equal(at.verdicts.length, 10, "the re-dispatch adds no second verdict");
474
- assert.equal(at.failures, 9, "the first ticket's last ruling passed");
475
- assert.equal(at.verdicts.find((v) => v.ticket === first.ticket).pr, "9001");
476
- assert.equal(at.verdicts.find((v) => v.ticket === second.ticket).failed, true);
477
- assert.equal(at.stop, true);
478
- });
479
-
480
- // A verdict that is neither `yes` nor `no` matches neither floor half, so read
481
- // as a pass it would lower the failure rate and keep the cell alive unreported.
482
- test("stopping rule: a counted ruling whose closed_own_ticket or minted_false_claim is not exactly yes or no is refused, naming the ticket", () => {
483
- for (const [col, value] of [["closed_own_ticket", "No"], ["minted_false_claim", "YES"], ["closed_own_ticket", ""], ["minted_false_claim", ""], ["closed_own_ticket", "yes "]]) {
484
- const w = world();
485
- addVerdicts(w, "smol-high", 10, 0);
486
- const bad = w.verdicts[3];
487
- bad[col] = value;
488
- assert.throws(() => judged(w, { "smol-high": "2026-09-01" }, "smol-high"),
489
- new RegExp(`ticket #${bad.ticket} \\(PR #${bad.pr}\\): ${col} is '${value}', expected yes or no`), `${col}=${JSON.stringify(value)}`);
490
- }
491
- });
492
-
493
- // What the refusal must ACCEPT: a malformed ruling on a ticket the rule does not
494
- // count, and every yes/no combination on one it does.
495
- test("stopping rule: a malformed ruling on a ticket with no counted Pull is not read, and all four yes/no pairs are", () => {
496
- const w = world();
497
- addVerdicts(w, "smol-high", 4, 0);
498
- [["yes", "no"], ["yes", "yes"], ["no", "no"], ["no", "yes"]].forEach(([closed, minted], i) => {
499
- Object.assign(w.verdicts[i], { closed_own_ticket: closed, minted_false_claim: minted });
500
- });
501
- w.verdicts.push(verdict({ ticket: "1381", pr: "1392", closed_own_ticket: "", minted_false_claim: "" }));
502
- w.verdicts.push(verdict({ ticket: "7", pr: "8", closed_own_ticket: "No", minted_false_claim: "YES" }));
503
- const at = judged(w, { "smol-high": "2026-09-01" }, "smol-high");
504
- assert.equal(at.verdicts.length, 4);
505
- assert.deepEqual(at.verdicts.map((v) => v.failed), [false, true, true, true]);
506
- });
507
-
508
- // ---------------------------------------------------------------------------
509
- // Which ruling is a Pull's: the last row dated on or after the Pull, a
510
- // both-blank (never ruled) row skipped.
511
-
512
- // A second admissible Pull of an existing ticket at smol-high, in its own session.
513
- function rePull(w, ticket, date) {
514
- const session = `2026-10-02T00-00-00-000Z_v${nextSession++}`;
515
- const agent = `impl-${ticket}-re`;
516
- w.features.push(pull({ session, agent, ticket, chosen_cell: "smol-high", run_date: date }));
517
- w.members.push(member({
518
- session, agent, run_date: date, ticket, model: "claude-sonnet-5",
519
- effort: "high", subagentType: "fleet-implementer-smol-high",
520
- }));
521
- }
522
-
523
- test("stopping rule: a ruling dated before its Pull does not rule it, so only pre-Pull rulings leave the cell with no verdicts; one dated the Pull's own day does", () => {
524
- const added = { "smol-high": "2026-10-02" };
525
- const stale = world();
526
- addVerdicts(stale, "smol-high", 10, 0, { date: "2026-10-05" });
527
- for (const v of stale.verdicts) Object.assign(v, { run_date: "2026-09-17", closed_own_ticket: "no" });
528
- const at = judged(stale, added, "smol-high");
529
- assert.deepEqual(at.verdicts, []);
530
- assert.equal(at.failures, 0);
531
- assert.equal(at.stop, false);
532
-
533
- const sameDay = world();
534
- addVerdicts(sameDay, "smol-high", 10, 0, { date: "2026-10-05" });
535
- for (const v of sameDay.verdicts) Object.assign(v, { run_date: "2026-10-05", closed_own_ticket: "no" });
536
- const day = judged(sameDay, added, "smol-high");
537
- assert.equal(day.verdicts.length, 10, "a ruling landing the same day as its Pull rules it");
538
- assert.equal(day.failures, 10);
539
- assert.equal(day.stop, true);
540
- });
541
-
542
- test("stopping rule: a re-Pulled ticket is charged with the ruling after its last Pull at the cell, in either corpus order, and with none while that Pull is unruled", () => {
543
- const added = { "smol-high": "2026-09-01" };
544
- // Pulled 2026-10-02 and ruled 2026-10-03 failing the floor, then re-Pulled 2026-10-05.
545
- const build = () => {
546
- const w = world();
547
- addVerdicts(w, "smol-high", 1, 1);
548
- rePull(w, w.features[0].ticket, "2026-10-05");
549
- return w;
550
- };
551
- const unruled = build();
552
- const { ticket } = unruled.features[0];
553
- assert.deepEqual(judged(unruled, added, "smol-high").verdicts, [], "the earlier ruling predates the re-Pull");
554
-
555
- const later = build();
556
- later.verdicts.push(verdict({ ticket, pr: "9002", run_date: "2026-10-06" }));
557
- const charged = judged(later, added, "smol-high").verdicts;
558
- assert.deepEqual(charged.map((v) => [v.ticket, v.pr, v.run_date, v.failed]), [[ticket, "9002", "2026-10-06", false]]);
559
-
560
- // The stale row appended after the later one, as a backfill would land it.
561
- const backfilled = build();
562
- backfilled.verdicts.unshift(verdict({ ticket, pr: "9002", run_date: "2026-10-06" }));
563
- assert.deepEqual(judged(backfilled, added, "smol-high").verdicts.map((v) => v.pr), ["9002"]);
564
- });
565
-
566
- test("stopping rule: a both-blank row was never ruled: after a real ruling it does not hide it, and a ticket whose only row it is stays uncounted", () => {
567
- const w = world();
568
- addVerdicts(w, "smol-high", 2, 2);
569
- const [real, blank] = w.features.map((p) => p.ticket);
570
- w.verdicts.push(verdict({ ticket: real, pr: "1392", run_date: "2026-10-04", closed_own_ticket: "", minted_false_claim: "" }));
571
- Object.assign(w.verdicts.find((v) => v.ticket === blank), { closed_own_ticket: "", minted_false_claim: "" });
572
- const at = judged(w, { "smol-high": "2026-09-01" }, "smol-high");
573
- assert.deepEqual(at.verdicts.map((v) => [v.ticket, v.pr, v.failed]), [[real, String(Number(real) + 5000), true]]);
574
- });
575
-
576
- // What the both-blank skip must NOT accept: a row with one verdict blank is a
577
- // ruling written half, so selected it is still refused.
578
- test("stopping rule: a half-blank row after a real ruling is the ticket's ruling and is refused", () => {
579
- for (const [col, other] of [["closed_own_ticket", "minted_false_claim"], ["minted_false_claim", "closed_own_ticket"]]) {
580
- const w = world();
581
- addVerdicts(w, "smol-high", 1, 0);
582
- const { ticket } = w.features[0];
583
- w.verdicts.push(verdict({ ticket, pr: "1393", run_date: "2026-10-04", [col]: "", [other]: "no" }));
584
- assert.throws(() => judged(w, { "smol-high": "2026-09-01" }, "smol-high"),
585
- new RegExp(`ticket #${ticket} \\(PR #1393\\): ${col} is '', expected yes or no`), col);
586
- }
587
- });
588
-
589
- // A filled ruling whose date cannot be placed against its Pull must not
590
- // vanish: dropped, its ticket is uncounted and a floor failure goes unreported.
591
- test("stopping rule: a filled ruling with a blank or malformed run_date is refused, naming the ticket", () => {
592
- for (const bad of ["", "10/03/2026", "2026-10-3"]) {
593
- const w = world();
594
- addVerdicts(w, "smol-high", 1, 0);
595
- const [{ ticket }] = w.features;
596
- w.verdicts[0].run_date = bad;
597
- assert.throws(
598
- () => judged(w, { "smol-high": "2026-09-01" }, "smol-high"),
599
- new RegExp(`ticket #${ticket} \\(PR #${w.verdicts[0].pr}\\): run_date is '${bad}', expected YYYY-MM-DD`),
600
- JSON.stringify(bad),
601
- );
602
- }
603
- });
604
-
605
- // What that refusal must NOT touch: a never-ruled row has no date to place,
606
- // and a ticket no live cell's Pull names is not a verdict candidate.
607
- test("stopping rule: a both-blank row or an unPulled ticket's row needs no run_date", () => {
608
- const w = world();
609
- addVerdicts(w, "smol-high", 2, 0);
610
- const [real, blank] = w.features.map((p) => p.ticket);
611
- Object.assign(w.verdicts.find((v) => v.ticket === blank), { closed_own_ticket: "", minted_false_claim: "", run_date: "" });
612
- w.verdicts.push(verdict({ ticket: "999", pr: "1", run_date: "n/a" }));
613
- const at = judged(w, { "smol-high": "2026-09-01" }, "smol-high");
614
- assert.deepEqual(at.verdicts.map((v) => v.ticket), [real]);
615
- });