@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,518 +0,0 @@
1
- import { test } from "node:test";
2
- import assert from "node:assert/strict";
3
- import { readFileSync } from "node:fs";
4
- import { join } from "node:path";
5
- import { between, phrase, sentences, stripHashGutter, unemphasized } from "./prose-pin.mjs";
6
- import { GATE, readout } from "./cell-readout.mjs";
7
- import { COLUMNS } from "./tier-outcomes.mjs";
8
-
9
- // #472: this file's header has never been pinned, while SKILL.md's guard tells
10
- // the controller that "that file's header carries the column meanings" — so the
11
- // guard's whole accumulate-across-runs mechanism rests on a shape nothing
12
- // checks. The deferral said to add the pin alongside the first consumer. The
13
- // four difficulty columns are that consumer's arrival: they are appended AFTER
14
- // a free-text `note`, which is a shift nobody would see.
15
- //
16
- // The column list is tier-outcomes.mjs's own COLUMNS (#2207), the order its
17
- // `append` writes in — so the header's column line is pinned against the
18
- // writer, the way member-outcomes.tsv's is against its scraper.
19
- const REPO = join(import.meta.dirname, "..", "..");
20
- const TSV = readFileSync(join(REPO, "docs", "metrics", "tier-outcomes.tsv"), "utf8");
21
- const RUN_TEAM = readFileSync(join(REPO, "plugin", "skills", "run-team", "SKILL.md"), "utf8");
22
-
23
- // The header is the LEADING comment block. Slicing it — rather than grepping
24
- // `#` lines from anywhere — is what stops a stray comment among the data rows
25
- // from satisfying a prose pin, the same reason member-outcomes-header.test.mjs
26
- // slices.
27
- const headerLines = [];
28
- for (const l of TSV.split("\n")) {
29
- if (!l.startsWith("#") && l.trim()) break;
30
- headerLines.push(l);
31
- }
32
- const HEADER = headerLines.join("\n");
33
-
34
- // The ruling step, and no more of SKILL.md than that — the same reason
35
- // `prose-pin.mjs`'s own slicers give: a positive regex over the whole file is
36
- // satisfiable from outside the paragraph it guards, and this file is 2700 lines
37
- // of prose about exactly these words. One definition, because three hand-rolled
38
- // copies of one slice is how two of them end up bounded differently.
39
- const rulingStep = () => between(RUN_TEAM, "**Guard: accumulate per PR", "**Then record the run's member facts", "phase 3's ruling step");
40
-
41
- // The first sentence of the ruling step that names `sizing` — the sentence the
42
- // phase-0 negative below reads. `sentences()`, never a first-period `[^.]`
43
- // window (#1983): the pin is NEGATIVE, so a window cut short is its silent
44
- // direction, and "e.g.", `SKILL.md` or `v1.2` between `sizing` and "phase 0"
45
- // ended the old window before the forbidden words and passed the misattribution
46
- // green. RESIDUAL, both directions: sentences() still cuts short at a `.)`,
47
- // `."`, a mid-sentence `?`, a capitalised "E.g." or an "etc." — the silent
48
- // direction for this pin — and still merges two real sentences across its
49
- // known shapes (#1987's `**late**.[1]`, #1899's sentence-final lowercase
50
- // "vs."), which here can only over-fire. None of those four is in this slice
51
- // today. `.**` itself IS in this slice (3 bold-lead sentence ends), but each
52
- // is a genuine boundary between two unrelated sentences, not one straddling
53
- // the `sizing`/`phase 0` attribution this pin reads.
54
- const sizingSentence = (slice) => sentences(slice).find((s) => /`sizing`/i.test(s)) ?? "";
55
-
56
- // Same reason as `rulingStep` above: one definition of the `minted_false_claim`
57
- // slice, so two hand-rolled copies do not drift to different bounds.
58
- const mfcDef = () => stripHashGutter(between(HEADER, "minted_false_claim", "# sizing", "the header"));
59
-
60
- test("the header's column line names every column, in order", () => {
61
- // Drift here is silent and total: the header's own awk one-liners and every
62
- // recount in SKILL.md index by position, so a column inserted anywhere but
63
- // the end shifts $N for every reader of an append-only file.
64
- //
65
- // Anchored on the tab-separated shape rather than a substring lookup, so a
66
- // future paragraph that merely mentions run_date cannot be taken for the
67
- // column line.
68
- const line = headerLines.find((l) => l.startsWith("# run_date\t"));
69
- assert.ok(line, "header has no `# run_date<TAB>...` column line");
70
- assert.deepEqual(line.replace(/^#\s*/, "").split("\t"), COLUMNS);
71
- });
72
-
73
- const LEGACY_COLUMNS = COLUMNS.length - 4;
74
-
75
- test("every data row has exactly the legacy or the full field count, never between", () => {
76
- // Rows predating the four covariates are SHORT on purpose — blank means
77
- // unknown, and padding them would mint measurements. So the pin cannot simply
78
- // require the full width.
79
- //
80
- // It cannot be an UPPER BOUND either, and that is measured: `n <= 12` stayed
81
- // green when a tab was typed into a legacy row's free-text `note`, because
82
- // the row went from 8 fields to 9 and 9 is still under the header. A tab in
83
- // `note` shifts all four appended columns for that row and for no other,
84
- // which is the one corruption this layout makes invisible — `note` is the
85
- // only free-text field and it now sits in front of them.
86
- //
87
- // Exactly-8-or-exactly-12 is what discriminates: any tab typed into a note
88
- // lands on 9 or 13 and reds here. A partially-known row is written to the
89
- // full width with the unknown fields EMPTY, not truncated.
90
- const rows = TSV.split("\n").filter((l) => l.trim() && !l.startsWith("#"));
91
- assert.ok(rows.length > 0, "no data rows — the header slice above ate the file");
92
- const wrong = rows
93
- .map((r, i) => [i, r.split("\t").length])
94
- .filter(([, n]) => n !== LEGACY_COLUMNS && n !== COLUMNS.length);
95
- assert.deepEqual(
96
- wrong,
97
- [],
98
- `rows (0-indexed among data rows) whose field count is neither ${LEGACY_COLUMNS} nor ${COLUMNS.length} — a tab inside \`note\`?`,
99
- );
100
- });
101
-
102
- test("the header says blank means unknown and forbids backfilling a guess", () => {
103
- // Neither rule is enforceable in code, which is exactly what makes them worth
104
- // pinning. Dropping the second is how a covariate gets filled in from memory
105
- // and then read as measured.
106
- assert.match(HEADER, /BLANK MEANS UNKNOWN/, "the header no longer says blank means unknown");
107
- assert.match(
108
- HEADER,
109
- /Never fill one in\s*\n?#?\s*retroactively/,
110
- "the header no longer forbids backfilling the four covariates",
111
- );
112
- assert.match(
113
- HEADER,
114
- /`note` IS FREE TEXT AND NOW SITS BEFORE FOUR COLUMNS/,
115
- "the header no longer warns that a tab in `note` shifts the appended columns",
116
- );
117
- });
118
-
119
- test("the header names WHICH diff `minted_false_claim` scores, and settles the caught-before-merge case", () => {
120
- // #1029: the definition read "the diff" and a PR has two — as submitted and
121
- // as merged. Two rows in one arm scored it opposite ways before the ruling
122
- // named the submitted one. Nothing derives this column, so neither half is
123
- // enforceable in code, and a scorer left to infer the convention re-derives
124
- // the same ambiguity: the caught-before-merge case is the half that decides
125
- // most rows, and stating only "as submitted" leaves it inferable.
126
- //
127
- // Sliced to the definition itself, so a stray "as submitted" elsewhere in the
128
- // header cannot buy the pass with this one gutted. `stripHashGutter` because
129
- // `\s+` does not span the `#` a wrapped comment line begins with.
130
- const def = mfcDef();
131
- assert.match(
132
- def,
133
- phrase("the work AS SUBMITTED asserted a factual claim"),
134
- "the header no longer says `minted_false_claim` scores the work AS SUBMITTED",
135
- );
136
- assert.match(
137
- def,
138
- phrase("a claim review caught and the fix pass corrected before merge still counts yes"),
139
- "the header no longer settles the caught-before-merge case, the half a scorer would otherwise infer",
140
- );
141
- });
142
-
143
- test("the header rules `minted_false_claim` by REFERENT, not by surface, and names the tiebreak", () => {
144
- // #1457: #1029 settled submitted-vs-merged and left the surface axis
145
- // implicit. Rulings inferred it two incompatible ways — some rows scored a
146
- // PR-body-only claim `yes`, one scored a PR-body-only claim `no` citing "the
147
- // column's diff-scoped definition", a phrase the header never stated. The
148
- // ruling is referent-scoped: a claim scores on ANY surface the implementer
149
- // wrote it on when it is about the change being submitted, and is out of
150
- // scope when it is about code the change does not touch, regardless of
151
- // surface. A pin that only asserted inclusion of PR/commit bodies would stay
152
- // green under the narrower "diff-scoped" reading too (every diff-carried
153
- // claim's surface is trivially the diff); the exclusion clause is what makes
154
- // this pin red on either kind of drop or inversion.
155
- const def = mfcDef();
156
- assert.match(
157
- def,
158
- phrase("a diff comment, a doc, a test name, a PR body, a commit body"),
159
- "the header no longer lists a PR body and a commit body among the surfaces a claim can be written on",
160
- );
161
- assert.match(
162
- def,
163
- phrase("A PR body and a commit body are IN SCOPE on the same terms as a diff comment"),
164
- "the header no longer states that a PR/commit body claim scores on the same terms as a diff comment",
165
- );
166
- assert.match(
167
- def,
168
- phrase("A claim about code the change does not touch is OUT of scope even when the implementer wrote it"),
169
- "the header no longer excludes a claim about code the change does not touch, regardless of who wrote it or where",
170
- );
171
- assert.match(
172
- def,
173
- phrase(
174
- "Tiebreak: would reading the change itself — its diff, its evidence, " +
175
- "its behaviour — falsify this claim? If yes, it scores.",
176
- ),
177
- "the header no longer states the referent tiebreak: would reading the change falsify this claim",
178
- );
179
- });
180
-
181
- test("SKILL.md's guard still delegates the column meanings to this header", () => {
182
- // #472's finding in one line: the guard PROMISES this header carries the
183
- // meanings. If that sentence is ever replaced by an inline column list, the
184
- // two go out of sync silently and this whole file stops being the contract.
185
- assert.match(
186
- RUN_TEAM,
187
- /header carries the column meanings/,
188
- "SKILL.md no longer delegates the column meanings to the TSV header",
189
- );
190
- });
191
-
192
- test("SKILL.md's ruling step names all four covariates and says a missing one stays blank", () => {
193
- // The columns are useless unless the ruling step tells the controller to fill
194
- // them, and worse than useless if it does not say what to do without a value:
195
- // a guessed covariate looks measured.
196
- const slice = rulingStep();
197
-
198
- for (const col of ["sizing", "profile", "loc", "files"]) {
199
- assert.match(slice, new RegExp("`" + col + "`"), `the ruling step never names \`${col}\``);
200
- }
201
- assert.match(
202
- slice,
203
- /left BLANK, never estimated/,
204
- "the ruling step no longer says a value not in hand is left blank",
205
- );
206
- assert.match(
207
- slice,
208
- /diff-stats\.mjs/,
209
- "the ruling step names the covariates without saying where three of them come from",
210
- );
211
- });
212
-
213
- test("the documented `profile` value set is exactly what diff-stats.mjs emits", () => {
214
- // Restating an enum in prose is how it drifts: the first draft of this header
215
- // said `docs-only`, which the script never emits — `docsOnly` is a separate
216
- // boolean on the same stats object — and omitted `empty`, which the CLI does
217
- // reach on a genuine zero-file PR. Two spellings for one stratum split the
218
- // group the column exists to compare, and nothing here noticed, because the
219
- // pins above cover the column NAMES and not their values.
220
- //
221
- // So derive rather than restate. Both halves are guarded: an unguarded
222
- // `.match()[0]` at module scope takes the whole file down on a reformat that
223
- // changed no behaviour, which is why this lives inside the test and asserts
224
- // before it indexes.
225
- const src = readFileSync(join(REPO, "plugin", "scripts", "diff-stats.mjs"), "utf8");
226
- const emitted = [...src.matchAll(/^\s*(?:else\s+)?(?:if\s*\([^)]*\)\s*)?profile = "([a-z-]+)";/gm)].map((m) => m[1]);
227
- assert.ok(emitted.length >= 5, `diff-stats.mjs profile ladder not found — got ${emitted.length}`);
228
-
229
- // The header is wrapped across comment lines, so normalise before reading the
230
- // parenthetical: strip the `# ` gutter, join, drop whitespace inside the list.
231
- const flat = HEADER.replace(/^#\s?/gm, "").replace(/\n/g, " ");
232
- const hit = /it prints \(([^)]+)\)/.exec(flat);
233
- assert.ok(hit, "the header no longer lists the `profile` value set in parentheses");
234
- const documented = hit[1].replace(/\s+/g, "").split("/").filter(Boolean);
235
-
236
- assert.deepEqual(
237
- [...documented].sort(),
238
- [...new Set(emitted)].sort(),
239
- "the header's `profile` value set and diff-stats.mjs's ladder disagree",
240
- );
241
- });
242
-
243
- test("the header forbids the `docs-only` spelling the script never emits", () => {
244
- // The narrow trap, kept separate from the set comparison above: a future edit
245
- // could satisfy the set while dropping the warning, and "docs-only" is the
246
- // spelling every other paragraph in the repo uses as an English adjective —
247
- // which is exactly why it reached this header as a value in the first place.
248
- assert.match(HEADER, /never\s*\n?#?\s*"docs-only"/, "the header no longer warns off the `docs-only` spelling");
249
- });
250
-
251
- test("the sizing verdict has a stated collection channel, and it is not phase 0", () => {
252
- // The column shipped described as "phase 0's light/heavy verdict ... recorded
253
- // at claim time", which is wrong twice — phase 0 shortlists (`## Phase 0 —
254
- // shortlist`), phase 1 claims, and the sizing run happens inside the member in
255
- // phase 2 — and named no channel at all. With the adjacent rule "a value not in
256
- // hand is left BLANK, never estimated", that made the covariate correct-to-omit
257
- // on every row forever: documented as the thing a tier comparison must condition
258
- // on, and uncollectable.
259
- const slice = rulingStep();
260
- // Negative pinned on the ATTRIBUTION, not on one phrasing of it: the first
261
- // draft of this test forbade the literal `sizing` is phase 0's and stayed
262
- // green under a reworded restatement of the same error.
263
- const sentence = sizingSentence(slice);
264
- assert.ok(sentence, "the ruling step no longer describes `sizing` at all");
265
- assert.doesNotMatch(
266
- sentence,
267
- /phase 0/i,
268
- `the ruling step attributes sizing to phase 0 again — phase 0 shortlists, it does not size: ${sentence}`,
269
- );
270
- // Bound to the word `sizing` itself, not just "somewhere in the sentence":
271
- // found in review, widening `sizingSentence` from a 120-char window to the
272
- // whole ~326-char sentence also widened THIS pre-existing positive check,
273
- // which used to be tight against that same window. A misattribution that
274
- // keeps "member" alive later in the sentence (e.g. in the trailing
275
- // `diff-stats.mjs` clause) would otherwise still pass.
276
- assert.match(
277
- sentence,
278
- /`sizing`[\s\S]{0,40}member/i,
279
- "the ruling step no longer says the sizing verdict is the member's, within reach of `sizing` itself",
280
- );
281
- assert.match(
282
- slice,
283
- /PR body|Sizing:/,
284
- "the ruling step no longer says where the controller reads the sizing verdict from",
285
- );
286
- });
287
-
288
- test("a period in the gap does not hide a phase-0 attribution, and the next sentence's phase 0 is not this one's", () => {
289
- // #1983's reproduction, both directions. Refuse: "e.g." sat between `sizing`
290
- // and "phase 0" and the first-period window stopped at it, green. Accept: the
291
- // window is the sentence, so a "phase 0" in the NEXT sentence is not an
292
- // attribution — widening past the real end would red a true statement.
293
- const slice = rulingStep();
294
- const opening = phrase("`sizing` is the");
295
- const misattributed = slice.replace(opening, "`sizing` is the member's verdict, e.g. the one phase 0 records. `sizing` is the");
296
- assert.notEqual(misattributed, slice, "the fixture's anchor no longer matches the ruling step — update it, do not delete it");
297
- assert.match(sizingSentence(misattributed), /phase 0/i, "a phase-0 attribution with an abbreviation before it read as clean");
298
- const nextSentence = slice.replace(opening, "`sizing` is the member's verdict, e.g. from its own run. Phase 0 only shortlists. `sizing` is the");
299
- assert.doesNotMatch(sizingSentence(nextSentence), /phase 0/i, "the sizing sentence ran on into the next one");
300
- });
301
-
302
- test("a `member` mentioned later in the sentence does not cover a `sizing` misattributed near its own start", () => {
303
- // Found in review of #1983: extracting the WHOLE sentence (up from a 120-char
304
- // window) also widened the pre-existing positive check above, which used to
305
- // require "member" within that same 120 chars. A misattribution that keeps
306
- // "member" alive later in the ~326-char sentence — here, in the trailing
307
- // `diff-stats.mjs` clause — passed silently until that check was re-bound to
308
- // the word `sizing` itself.
309
- const slice = rulingStep();
310
- const misattributed = slice
311
- .replace("`sizing` is the\n**member's** own", "`sizing` is the\n**controller's** own")
312
- .replace(
313
- "`profile`, `loc` and `files` all come from `diff-stats.mjs` over the merged\ndiff.",
314
- "`profile`, `loc` and `files` all come from `diff-stats.mjs` over the member's merged\ndiff.",
315
- );
316
- assert.notEqual(misattributed, slice, "the fixture's anchors no longer match the ruling step — update it, do not delete it");
317
- assert.doesNotMatch(
318
- sizingSentence(misattributed),
319
- /`sizing`[\s\S]{0,40}member/i,
320
- "a `sizing` misattributed to the controller read as the member's because `member` appears later in the sentence",
321
- );
322
- });
323
-
324
- test("the dispatch brief tells the member to emit the Sizing line the ruling step reads", () => {
325
- // Both ends or neither: a ruling step that reads `Sizing:` off a PR body no
326
- // member was told to write is the same blank column with more words. Pinned
327
- // apart from the reader above so dropping either end reds. The brief is the
328
- // implementer agent body since #1804 (spec 2026-09-24 § 2 Decision 2) — the
329
- // member's system prompt, where run-team's phase 2 used to paste it.
330
- const brief = readFileSync(join(REPO, "plugin", "agents", "fleet-implementer-slow-high.agent.md"), "utf8").split("---").slice(2).join("---");
331
- assert.match(
332
- brief,
333
- /`Sizing: light` or `Sizing: heavy`/,
334
- "the dispatch brief no longer tells the member to put its sizing verdict in the PR body",
335
- );
336
- });
337
-
338
- test("the ruling step refuses to record a sizing verdict it cannot date", () => {
339
- // #1070. The channel pinned above says WHERE the verdict is read from; it says
340
- // nothing about whether the line was produced by the run it claims. A
341
- // `Sizing:` line typed in before `sizing-a-ticket` ever ran is byte-identical
342
- // to one the skill produced, so the body is not a second source for itself —
343
- // measured on a member that wrote the verdict first and caught itself
344
- // afterwards, which is the only reason anyone knows this can happen.
345
- const slice = rulingStep();
346
-
347
- // The rule as ONE span, both conditions joined. Split into two presence
348
- // checks, a controller holding a signalled-but-undated verdict satisfies the
349
- // half it is looking at and records it, which is the whole defect.
350
- assert.match(
351
- slice,
352
- phrase("Record `sizing` only when the report places that run before the PR AND the line carries its signal"),
353
- "recording `sizing` is no longer conditioned on the report's ordering together with the line's signal",
354
- );
355
- // The else-branch, bound to the action it demands. A rule with no stated
356
- // failure action is read as advice, and the adjacent BLANK rule is about a
357
- // value not in hand — an undated verdict IS in hand, which is what makes it
358
- // dangerous.
359
- assert.match(
360
- slice,
361
- phrase("leave the field BLANK and say which in `note`"),
362
- "the ruling step no longer says what to do when the verdict cannot be dated",
363
- );
364
- // The three failure cases, as the one sentence that enumerates them: a
365
- // controller told only about a missing clause still records the case where
366
- // the member reported writing the line early.
367
- assert.match(
368
- slice,
369
- phrase("Ordering clause missing, verdict authored before the run with no corrected value reported, or body and report naming different verdicts"),
370
- "the ruling step no longer enumerates which failures blank the covariate",
371
- );
372
- // The rejected alternative, kept explicit: deriving the verdict from the diff
373
- // was ruled premature on #1070, and a controller staring at a blank column
374
- // with `diff-stats.mjs` output already in hand is exactly who would reach for
375
- // it — producing a value that reads as measured, which is the defect again.
376
- assert.match(
377
- slice,
378
- phrase("Do not re-derive the verdict from the diff to fill the gap"),
379
- "the ruling step no longer forbids substituting a diff-derived proxy for the member's verdict",
380
- );
381
- });
382
-
383
- // `run_date` is DERIVED in `member-outcomes.tsv` (a transcript mtime) and
384
- // STAMPED AT RULING here, and phase 2's per-cell gate counts distinct
385
- // `run_date`s — ten comparisons across five dates — over the other file, never
386
- // this one. Read as a count over THIS file, it answers a different question,
387
- // and nothing in this header used to say so.
388
- //
389
- // The paragraph that now says it makes claims about files this one does not
390
- // contain, which is the shape that rots silently: it stays true only while
391
- // cell-readout.mjs keeps dating comparisons off member-outcomes.tsv,
392
- // `member-outcomes.mjs` keeps stamping dates off an mtime, and SKILL.md keeps
393
- // the floor's numbers. So the pins below DERIVE each claim from its real
394
- // source — the same reason the `profile` pin above derives the enum instead of
395
- // restating it.
396
- const MEMBER_SRC = readFileSync(join(REPO, "plugin", "scripts", "member-outcomes.mjs"), "utf8");
397
-
398
- // Bounded at both ends, for `between`'s own stated reason: this header is 140
399
- // lines about exactly these words, so an unbounded match is satisfiable from
400
- // the provenance block above the paragraph or the column legend below it. The
401
- // end bound is the column line's tab-separated shape, which no prose line has.
402
- const runDateSources = () =>
403
- stripHashGutter(between(HEADER, "WHICH FILE'S `run_date` SUPPLIES", "# run_date\t", "the header"));
404
-
405
- test("the header says which file each distinct-`run_date` count is read from, and that the two columns differ", () => {
406
- const block = runDateSources();
407
-
408
- // The floor bound to its file in ONE span. Split into a mention of the
409
- // number and a separate mention of the file, a reader counting the ten/five
410
- // floor over this file satisfies both halves and is wrong anyway — which is
411
- // the defect, not a wording preference.
412
- assert.match(
413
- block,
414
- phrase(
415
- "at least ten comparisons across five or more distinct `run_date`s, the floor that forbids reading a cell early — is NOT read here at all. It comes from `plugin/scripts/cell-readout.mjs`, which dates each comparison by its session's `run_date` in `docs/metrics/member-outcomes.tsv`",
416
- ),
417
- "the header no longer says the per-cell gate's distinct-date count is read from member-outcomes.tsv through cell-readout.mjs, not here",
418
- );
419
-
420
- // The definitional halves, each joined to what it makes the column MEAN. A
421
- // reader told only that the two are "different" still has to guess which way.
422
- assert.match(
423
- block,
424
- phrase(
425
- "Here it is STAMPED AT RULING — `tier-outcomes.mjs append` reads the clock when the controller rules a PR's review, where before 2026-09-29 the controller typed it at that same moment — so it records WHICH RUN THE PR BELONGS TO",
426
- ),
427
- "the header no longer says this file's `run_date` is stamped at ruling and records which run the PR belongs to, as one contiguous claim",
428
- );
429
- assert.match(
430
- block,
431
- phrase(
432
- "In `member-outcomes.tsv` it is DERIVED in code: `member-outcomes.mjs` stamps every row of a session from the NEWEST TRANSCRIPT MTIME in that session directory rather than a clock read, so it records WHEN THE SESSION LAST WROTE",
433
- ),
434
- "the header no longer says member-outcomes.tsv's `run_date` is derived from a transcript mtime",
435
- );
436
-
437
- // The correction the ticket itself got wrong: it reported the derived date as
438
- // drifting "if the session is re-scraped after midnight". A re-scrape moves
439
- // nothing — the mtime is fixed once written, which is why a December backfill
440
- // still dates an August session in August. Dropping this sentence restores
441
- // the false claim into a header other prose cites.
442
- assert.match(
443
- block,
444
- phrase("It moves only when the session WRITES AGAIN"),
445
- "the header no longer says the derived date moves on a re-write, not on a re-scrape",
446
- );
447
- assert.match(
448
- block,
449
- phrase("never because the file was merely re-scraped"),
450
- "the header no longer rules out a bare re-scrape as a cause of date drift",
451
- );
452
- });
453
-
454
- test("the header's `run_date` source claims still hold against the readout, the scraper and the guard", () => {
455
- const block = runDateSources();
456
-
457
- // The gate half: the count lives in cell-readout.mjs and dates each
458
- // comparison off the OTHER file's `run_date`. Run, not read: one comparison
459
- // whose ticket-features date and member-outcomes date differ, and the date
460
- // the readout counts must be the member-outcomes one. If the readout ever
461
- // keys its dates elsewhere, "it comes from there" stops being true.
462
- const session = "s-tier-hdr";
463
- const pull = (agent, chosen_cell) => ({ run_date: "2026-01-01", session, agent, chosen_cell });
464
- const member = (agent, cell, model) => ({
465
- session, agent, run_date: "2026-02-02", model, effort: "high", subagentType: `fleet-implementer-${cell}`,
466
- });
467
- const { cells: [task] } = readout({
468
- features: [pull("impl-1", "task-high"), pull("impl-2", "slow-high")],
469
- members: [member("impl-1", "task-high", "m-task"), member("impl-2", "slow-high", "m-slow")],
470
- });
471
- assert.deepEqual([task.cell, task.comparisons, task.runDates], ["task-high", 1, 1]);
472
- assert.deepEqual([...task.dates], ["2026-02-02"], "cell-readout.mjs no longer dates a comparison by member-outcomes.tsv's `run_date`");
473
- assert.match(block, /`plugin\/scripts\/cell-readout\.mjs`/);
474
- assert.match(block, /`docs\/metrics\/member-outcomes\.tsv`/);
475
-
476
- // The DERIVED half as code, not prose: the date comes off a transcript
477
- // mtime. A scraper switched to a clock read would make this header's
478
- // central contrast false while every prose pin above stayed green. Bound
479
- // to rowsForSession, member-outcomes.mjs's one stamp site, rather than
480
- // scanning the whole file — a regression outside this slice could
481
- // otherwise satisfy `assert.match` over MEMBER_SRC as a whole through
482
- // unrelated text elsewhere.
483
- const rowsForSessionSrc = between(
484
- MEMBER_SRC,
485
- "export function rowsForSession(sessionDir, stats = {}) {",
486
- "export const COLUMNS",
487
- "member-outcomes.mjs's rowsForSession",
488
- );
489
- assert.match(
490
- rowsForSessionSrc,
491
- /newest = Math\.max\(newest, statSync\(.+\)\.mtimeMs\)/,
492
- "member-outcomes.mjs's rowsForSession no longer takes its date from a transcript mtime",
493
- );
494
- assert.match(
495
- rowsForSessionSrc,
496
- /const run_date = newest \? new Date\(newest\)/,
497
- "member-outcomes.mjs's rowsForSession no longer stamps `run_date` from that mtime",
498
- );
499
-
500
- // The STAMPED-AT-RULING half is the writer's behaviour since #2207, not a
501
- // SKILL.md duty: tier-outcomes.test.mjs runs `append` and pins the date it
502
- // writes to the day it ran.
503
-
504
- // The floor's numbers, as the paragraph quotes them. It names figures it
505
- // does not own; a threshold changed in SKILL.md or in the readout alone
506
- // leaves this header quietly citing the old one.
507
- assert.match(
508
- unemphasized(RUN_TEAM),
509
- phrase("there are at least ten of them across five or more distinct `run_date`s"),
510
- "SKILL.md's per-cell floor is no longer ten comparisons across five dates — the header quotes those numbers",
511
- );
512
- assert.deepEqual({ ...GATE }, { comparisons: 10, runDates: 5 }, "cell-readout.mjs's gate is no longer ten across five — the header quotes those numbers");
513
- assert.match(
514
- block,
515
- phrase("at least ten comparisons across five or more"),
516
- "the header no longer states the per-cell floor it attributes to the other file",
517
- );
518
- });