@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,674 +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 { computeStats } from "./diff-stats.mjs";
6
- import { stripComments } from "./strip-comments.mjs";
7
- import { DEFAULT_DIMENSIONS, selectDimensions, resolveDimensions, verifiersFor } from "./review-core.mjs";
8
-
9
- // The reason #118 existed: every count claim about `selectDimensions` had to
10
- // be hand-derived, and two hand-derived comments were wrong. Every value
11
- // under test here is the REAL export now, never a re-derived or lifted copy.
12
- const REPO = join(import.meta.dirname, "..");
13
- const SOURCE = readFileSync(join(REPO, "scripts", "review-core.mjs"), "utf8");
14
-
15
- // Drive the matrix from REAL file lists through the real classifier, not from
16
- // hand-written profile strings. A `diff-stats` classifier change that silently
17
- // shifts a profile then fails here instead of silently retuning the fan-out.
18
- const dimensionKeys = (files) => selectDimensions(DEFAULT_DIMENSIONS, computeStats(files)).map((d) => d.key);
19
- const f = (path, additions = 5, deletions = 5) => ({ path, additions, deletions });
20
-
21
- test("the imported values have the shape the rest of this file assumes", () => {
22
- assert.equal(DEFAULT_DIMENSIONS.length, 6);
23
- assert.deepEqual(
24
- DEFAULT_DIMENSIONS.map((d) => d.key),
25
- ["correctness", "silent-failure", "tests", "comments", "types", "simplify"],
26
- );
27
- });
28
-
29
- test("unknown, unparseable or empty stats widen to the full set", () => {
30
- assert.equal(selectDimensions(DEFAULT_DIMENSIONS, null).length, 6);
31
- assert.equal(selectDimensions(DEFAULT_DIMENSIONS, undefined).length, 6);
32
- // An empty `files` array is NOT a signal to trim: `gh` can report no files for
33
- // a real PR, and treating that as "nothing to review" would drop FOUR
34
- // dimensions on production code.
35
- assert.equal(dimensionKeys([]).length, 6);
36
- });
37
-
38
- test("a docs-only diff runs correctness + comments", () => {
39
- assert.deepEqual(dimensionKeys([f("README.md")]), ["correctness", "comments"]);
40
- });
41
-
42
- test("a tests-only diff drops types, silent-failure and simplify", () => {
43
- assert.deepEqual(dimensionKeys([f("scripts/foo.test.mjs")]), ["correctness", "tests", "comments"]);
44
- });
45
-
46
- test("a production diff runs everything, less `tests` when the diff has none", () => {
47
- const withTests = [f("scripts/review-core.mjs", 100, 50), f("scripts/a.test.mjs", 30, 10)];
48
- assert.equal(dimensionKeys(withTests).length, 6);
49
-
50
- const noTests = [f("scripts/review-core.mjs", 100, 50), f("scripts/b.mjs", 40, 20)];
51
- const keys = dimensionKeys(noTests);
52
- assert.equal(keys.length, 5);
53
- assert.ok(!keys.includes("tests"));
54
- });
55
-
56
- // --- Size tier. `profile` is assigned through an else-if chain in computeStats,
57
- // --- so these values are mutually exclusive and cannot race `docsOnly`.
58
- // #218: `comments` is part of the size-tier floor, so this row carries it. This
59
- // single `.js` file whose whole substance is prose scores `docs: 0`, because
60
- // `classify()` returns `src` for any code extension before it checks `isDocs`
61
- // — one shape of the diffs #218 measured in production (four of them, below).
62
- test("a single-file source diff trims to correctness + silent-failure + comments", () => {
63
- assert.deepEqual(dimensionKeys([f("scripts/review-core.mjs", 3, 2)]), [
64
- "correctness",
65
- "silent-failure",
66
- "comments",
67
- ]);
68
- });
69
-
70
- // The measured instances, as file lists, driven through the real classifier: a
71
- // comment-only `.mjs` (#682), a comment-only `.mjs` (#710), a `.sh` + its test
72
- // (#1091), and a majority-comment `.sh` + test at `small` (#1172). Every one
73
- // scores `docs: 0` and every one now keeps `comments`. Under the old
74
- // `stats.kinds?.docs !== 0` carve-out all four returned without it.
75
- test("the diffs #218 measured in production all keep comments — none of them has a docs file", () => {
76
- for (const files of [
77
- [f("scripts/board.mjs", 1, 1)],
78
- [f("scripts/arg.mjs", 2, 1)],
79
- [f("scripts/no-undo-audit.sh", 1, 1), f("scripts/no-undo-audit.test.mjs", 1, 1)],
80
- [f("scripts/claim-ticket.sh", 7, 0), f("scripts/claim-ticket.test.mjs", 20, 2)],
81
- ]) {
82
- const stats = computeStats(files);
83
- assert.equal(stats.kinds.docs, 0, `${files.map((x) => x.path)} unexpectedly scores a docs file`);
84
- assert.ok(
85
- dimensionKeys(files).includes("comments"),
86
- `${files.map((x) => x.path)} lost the comments dimension`,
87
- );
88
- }
89
- });
90
-
91
- // The size-tier floor OUTRANKS the hasSrc guard for `silent-failure` (#236). A
92
- // single `.github/workflows/ci.yml` change is profile "single-file" with hasSrc
93
- // false, so the guard had already removed silent-failure before the tier ran and
94
- // the documented floor did not exist: PR #226 reviewed CI's own gating logic with
95
- // `dimensionsRun: ["correctness"]`. A CI workflow diff is mostly shell, which is
96
- // what the silent-failure hunter is for, and it is where this fleet got bitten.
97
- test("a single-file config diff keeps the silent-failure floor", () => {
98
- assert.deepEqual(dimensionKeys([f(".github/workflows/ci.yml", 2, 1)]), [
99
- "correctness",
100
- "silent-failure",
101
- "comments",
102
- ]);
103
- // Shell under `.github/` is the ticket's other named case, and it classifies
104
- // `config` for the same reason. A `.sh` ANYWHERE ELSE is classify()'s `src`
105
- // residue, so it always had silent-failure and is not part of this class.
106
- assert.deepEqual(dimensionKeys([f(".github/scripts/release.sh", 4, 2)]), [
107
- "correctness",
108
- "silent-failure",
109
- "comments",
110
- ]);
111
- });
112
-
113
- // AC-2: `small` is the other size-tier profile and gets the same floor. Two
114
- // config files at 6 loc — `single-file` needs files === 1, so this row can only
115
- // reach the tier through `small`, and it went in as [correctness] alone too.
116
- test("a small config-only diff keeps the silent-failure floor", () => {
117
- assert.deepEqual(
118
- dimensionKeys([f(".github/workflows/ci.yml", 2, 1), f(".github/workflows/release.yml", 2, 1)]),
119
- ["correctness", "silent-failure", "comments"],
120
- );
121
- });
122
-
123
- // The floor's own former boundary. OUTSIDE the size tier the hasSrc guard used
124
- // to drop silent-failure again — five config files at 50 loc profile
125
- // `production`, and neither #236's floor (SIZE_TIER_PROFILES) nor #739's
126
- // `tests-only` arm reached it, so growing a config-only diff past the tier
127
- // LOST the specialist a smaller diff of that SAME KIND kept: non-monotonic on
128
- // #236's own motivating class, the sibling gap #1285 closed alongside #739.
129
- // Fixed by a third `keepsSilentFailure` arm gated on `hasTests === false`: a
130
- // config-only diff keeps silent-failure regardless of size, the same way a
131
- // config+test diff already does via #739.
132
- test("a large config-only diff keeps the silent-failure floor even past the size tier (#1285)", () => {
133
- const files = [
134
- f(".github/workflows/a.yml", 6, 4),
135
- f(".github/workflows/b.yml", 6, 4),
136
- f(".github/workflows/c.yml", 6, 4),
137
- f("tsconfig.json", 6, 4),
138
- f("package.json", 6, 4),
139
- ];
140
- assert.equal(computeStats(files).profile, "production");
141
- assert.deepEqual(dimensionKeys(files), ["correctness", "silent-failure", "comments"]);
142
- });
143
-
144
- // #1285's own reproduction, mirrored on #739's own test shape below: a
145
- // config-only diff UNDER the size tier keeps silent-failure (`small`), and
146
- // adding a SECOND config file that pushes `loc` past the tier into
147
- // `production` must not subtract it. Crossing into a larger, more-scrutinized
148
- // profile can only ADD scrutiny, never remove a specialist a smaller diff of
149
- // the same kind already had — the monotonicity property this file's
150
- // dimension-selection logic exists to guarantee.
151
- test("a second config file that crosses the size tier into production does not drop silent-failure", () => {
152
- const underTier = [f(".github/workflows/ci.yml", 3, 2), f("tsconfig.json", 3, 2)];
153
- assert.equal(computeStats(underTier).profile, "small");
154
- assert.deepEqual(dimensionKeys(underTier), ["correctness", "silent-failure", "comments"]);
155
-
156
- const crossesTier = [...underTier, f("package.json", 30, 10)];
157
- assert.equal(computeStats(crossesTier).profile, "production");
158
- assert.deepEqual(dimensionKeys(crossesTier), ["correctness", "silent-failure", "comments"]);
159
- });
160
-
161
- // #739. `tests-only` is assigned AHEAD of `single-file`/`small` in computeStats'
162
- // else-if chain, so a config diff that also touches a test file never reaches
163
- // SIZE_TIER_PROFILES and the #236 floor could not re-admit silent-failure. That
164
- // made coverage NON-MONOTONIC: `ci.yml` alone kept the hunter and `ci.yml` + a
165
- // test SUBTRACTED it — adding a file to a diff removed a specialist, on #236's
166
- // own motivating class (CI gating logic, no src). The gate's other half — a pure
167
- // test diff has no config, so it must still lose silent-failure — is already
168
- // pinned above by `a tests-only diff drops types, silent-failure and simplify`.
169
- test("a tests-only diff keeps the silent-failure floor when it also carries config", () => {
170
- const configPlusTest = [
171
- f(".github/workflows/ci.yml", 2, 1),
172
- f("scripts/ci-vacuous-green.test.mjs", 3, 1),
173
- ];
174
- assert.equal(computeStats(configPlusTest).profile, "tests-only");
175
- assert.deepEqual(dimensionKeys(configPlusTest), ["correctness", "silent-failure", "tests", "comments"]);
176
- });
177
-
178
- // AC-3: the floor must not reach a diff with nothing for it to do, and the ORDER
179
- // is the whole guarantee — `docsOnly` returns BEFORE the tier. A file list cannot
180
- // pin that: computeStats assigns profile `docs` ahead of `files === 1`, so a docs
181
- // diff never matches SIZE_TIER_PROFILES, both branches agree on [correctness,
182
- // comments], and `a docs-only diff runs correctness + comments` above already
183
- // pins that agreement. Pin the DIRECTION instead, on the one blob where the two
184
- // disagree — the same shape as the missing-`kinds` row below. Measured: leaking
185
- // the tier into the docsOnly filter, and deleting that branch outright, each
186
- // passed all 1030 tests without this.
187
- test("docsOnly returns before the size tier — the floor never reaches a docs diff", () => {
188
- const docsInTier = { profile: "single-file", docsOnly: true, hasSrc: false, hasTests: false };
189
- assert.deepEqual(
190
- selectDimensions(DEFAULT_DIMENSIONS, docsInTier).map((d) => d.key),
191
- ["correctness", "comments"],
192
- );
193
- });
194
-
195
- test("a small multi-file source diff trims to correctness + silent-failure + comments", () => {
196
- assert.deepEqual(
197
- dimensionKeys([f("scripts/a.mjs", 5, 5), f("scripts/b.mjs", 5, 4)]),
198
- ["correctness", "silent-failure", "comments"],
199
- );
200
- });
201
-
202
- // Same carve-out shape for `tests`: when the diff's substance IS a test, the
203
- // mutation-discrimination check is the one it most needs. Without this the row
204
- // below trims to whatever else the size tier keeps (`SIZE_TIER_DIMS`) — not
205
- // restated here as a count, which is exactly what went stale last time (#218).
206
- test("a small diff that adds a test keeps the tests dimension", () => {
207
- assert.deepEqual(
208
- dimensionKeys([f("scripts/a.mjs", 5, 5), f("scripts/a.test.mjs", 5, 5)]),
209
- ["correctness", "silent-failure", "tests", "comments"],
210
- );
211
- });
212
-
213
- // Fail DIRECTION, not a matrix row. The blob reaches review-core.mjs relayed by an
214
- // agent, so a field can go missing without failing JSON.parse, and absence must
215
- // widen rather than narrow — the `=== true` guards elsewhere in selectDimensions
216
- // exist for that. `comments` no longer reads any field at all since #218, so what
217
- // this row pins is the surviving half: `tests` is `=== true`, so a blob without
218
- // `hasTests` loses it, while `comments` cannot be lost to a missing field.
219
- test("a size-tier stats blob missing `kinds` and `hasTests` still keeps comments", () => {
220
- const stats = { profile: "small", docsOnly: false, hasSrc: true };
221
- assert.deepEqual(
222
- selectDimensions(DEFAULT_DIMENSIONS, stats).map((d) => d.key),
223
- ["correctness", "silent-failure", "comments"],
224
- );
225
- });
226
-
227
- // #1349 removed the per-call `model` field entirely (per #1303's gap 3): no
228
- // `agent()` call may carry `model`/`effort`, so DEFAULT_DIMENSIONS carries
229
- // only `key`/`prompt`/`agentType` now, and tier lives in each fleet-owned
230
- // `fleet-review-<key>` definition's own frontmatter instead. omp's native
231
- // `agent()` resolves a bare frontmatter `name:` exactly, so `agentType` is
232
- // bare here — no namespace prefix to carry (omp's own registry is
233
- // bare-name/unnamespaced, ADR 0014). This replaces
234
- // the retired "only the recoverable-miss dimensions carry a model downgrade"
235
- // test, which pinned a field that no longer exists.
236
- test("every dimension names a distinct fleet-owned agentType and carries no model field", () => {
237
- const byKey = Object.fromEntries(DEFAULT_DIMENSIONS.map((d) => [d.key, d]));
238
- for (const key of ["correctness", "silent-failure", "tests", "comments", "types", "simplify"]) {
239
- assert.equal(byKey[key].agentType, `fleet-review-${key}`);
240
- assert.equal(byKey[key].model, undefined, `${key} still carries a model field`);
241
- }
242
- assert.equal(new Set(DEFAULT_DIMENSIONS.map((d) => d.agentType)).size, DEFAULT_DIMENSIONS.length);
243
- });
244
-
245
- // The test above pins WHICH dimensions carry the downgrade. This pins the fact
246
- // its comment rests on: `verifiersFor` is keyed on SEVERITY ALONE, so no
247
- // dimension can draw a different refuter budget and "faces refuters" was never
248
- // able to separate these six (#221). Without this the corrected rationale is
249
- // prose with nothing under it — which is how the retired one survived.
250
- test("the refuter budget is keyed on severity alone, never on a dimension", () => {
251
- const forSeverity = verifiersFor({ verifiers: 7 });
252
- // One parameter, and it is the severity. A dimension-aware budget needs a
253
- // second one, and passing a dimension anyway must not move the answer.
254
- assert.equal(forSeverity.length, 1);
255
- for (const d of DEFAULT_DIMENSIONS)
256
- assert.equal(forSeverity("critical", d.key), 7, `critical/${d.key}`);
257
- // `silent-failure` and `tests` are dispatched under different fleet-owned
258
- // agent tiers (frontmatter, not a per-call field) and still draw the same
259
- // budget — the whole of why the retired rule did not
260
- // separate them. `suggestion` is the one band that differs, and it is a
261
- // SEVERITY, not a dimension.
262
- assert.equal(forSeverity("important"), forSeverity("critical"));
263
- assert.equal(forSeverity("suggestion"), 0);
264
- });
265
-
266
- // --- args.dimensions normalization (#113). The "Specialists" section of
267
- // `commands/review-and-fix.md` documents the override as
268
- // accepting "keys or dimension objects"; before this, only objects worked and
269
- // a key array passed through untouched, dereferencing `d.key`, `d.prompt`,
270
- // `d.model` and `d.agentType` to `undefined` with no throw and no warning.
271
- test("no override leaves the size tier in charge", () => {
272
- assert.equal(resolveDimensions(undefined, DEFAULT_DIMENSIONS), null);
273
- assert.equal(resolveDimensions(null, DEFAULT_DIMENSIONS), null);
274
- });
275
-
276
- // ...but only an ABSENT override does. A falsy-but-present one is a caller
277
- // error, and falling back to the size tier would silently run a DIFFERENT set
278
- // than the one that was pinned, with nothing in the log naming the override.
279
- test("a falsy-but-present override stops the run rather than degrading to the size tier", () => {
280
- for (const override of ["", 0, false, NaN]) {
281
- assert.throws(() => resolveDimensions(override, DEFAULT_DIMENSIONS), /must be an array/);
282
- }
283
- });
284
-
285
- test("an object override behaves as it does today — passed through unchanged", () => {
286
- const objs = [DEFAULT_DIMENSIONS[0], DEFAULT_DIMENSIONS[2]];
287
- assert.deepEqual(resolveDimensions(objs, DEFAULT_DIMENSIONS), objs);
288
- });
289
-
290
- test("a key override resolves against the workflow's own dimension list", () => {
291
- assert.deepEqual(
292
- resolveDimensions(["correctness", "comments"], DEFAULT_DIMENSIONS),
293
- [DEFAULT_DIMENSIONS[0], DEFAULT_DIMENSIONS[3]],
294
- );
295
- });
296
-
297
- test("keys and objects can mix in the same override", () => {
298
- assert.deepEqual(
299
- resolveDimensions(["correctness", DEFAULT_DIMENSIONS[2]], DEFAULT_DIMENSIONS),
300
- [DEFAULT_DIMENSIONS[0], DEFAULT_DIMENSIONS[2]],
301
- );
302
- });
303
-
304
- test("an unknown key stops the run and names the key", () => {
305
- assert.throws(
306
- () => resolveDimensions(["not-a-real-dimension"], DEFAULT_DIMENSIONS),
307
- /unknown key "not-a-real-dimension"/,
308
- );
309
- });
310
-
311
- test("an object override missing a required field stops the run and names the field", () => {
312
- assert.throws(
313
- () => resolveDimensions([{ key: "x", agentType: "y" }], DEFAULT_DIMENSIONS),
314
- /missing required field\(s\): prompt/,
315
- );
316
- // All three REQUIRED fields are checked, not just one. `model` is not among
317
- // them — #1349 retired it entirely (dispatch tier lives only in the agent
318
- // definition's own frontmatter now), and a caller that still sends one is
319
- // refused outright — see the dedicated test below, not this one.
320
- assert.throws(
321
- () => resolveDimensions([{}], DEFAULT_DIMENSIONS),
322
- /missing required field\(s\): key, prompt, agentType/,
323
- );
324
- assert.deepEqual(
325
- resolveDimensions([{ key: "x", prompt: "p", agentType: "a" }], DEFAULT_DIMENSIONS),
326
- [{ key: "x", prompt: "p", agentType: "a" }],
327
- );
328
- });
329
-
330
- // Presence alone let a non-string field (a number, an object, ...) straight
331
- // through to the specialist dispatch machinery with no throw, contradicting
332
- // this function's own job of validating the boundary. Mutation-verified: with
333
- // the `wrongType` check in resolveDimensions loosened back to the
334
- // presence-only `missing` check, this test reds.
335
- test("a required field of the wrong type stops the run and names the field and the type it got", () => {
336
- assert.throws(
337
- () => resolveDimensions([{ key: 42, prompt: "p", agentType: "a" }], DEFAULT_DIMENSIONS),
338
- /review-pr: args\.dimensions\[0\] field "key" must be a string, got number$/,
339
- );
340
- // `0`, `""`, `null` etc are already caught as MISSING (falsy) above — a
341
- // truthy non-string, like an object, is the case the presence check lets
342
- // through unnoticed.
343
- assert.throws(
344
- () => resolveDimensions([{ key: "x", prompt: {}, agentType: "a" }], DEFAULT_DIMENSIONS),
345
- /review-pr: args\.dimensions\[0\] field "prompt" must be a string, got object$/,
346
- );
347
- assert.deepEqual(
348
- resolveDimensions([{ key: "x", prompt: "p", agentType: "a" }], DEFAULT_DIMENSIONS),
349
- [{ key: "x", prompt: "p", agentType: "a" }],
350
- );
351
- });
352
-
353
- // #1349 (per #1303's gap 3): `model` used to be a fourth, optional field on a
354
- // dimension override, dereferenced at dispatch to override the tier. Now it
355
- // is refused OUTRIGHT — any value, not just a wrong-typed one — because tier
356
- // lives only in the fleet-owned agent definition's frontmatter, never per
357
- // call. A caller-facing knob that silently worked on one harness and not the
358
- // other is the exact shape #1349 exists to close, so this is loud rather than
359
- // a silent no-op.
360
- test("a dimension override carrying a model field is refused outright, regardless of its type", () => {
361
- assert.throws(
362
- () => resolveDimensions([{ key: "x", prompt: "p", agentType: "a", model: "opus" }], DEFAULT_DIMENSIONS),
363
- /review-pr: args\.dimensions\[0\] field "model" is no longer supported/,
364
- );
365
- assert.throws(
366
- () => resolveDimensions([{ key: "x", prompt: "p", agentType: "a", model: 7 }], DEFAULT_DIMENSIONS),
367
- /review-pr: args\.dimensions\[0\] field "model" is no longer supported/,
368
- );
369
- // A missing `model` is still fine — there is nothing left to demand.
370
- assert.deepEqual(
371
- resolveDimensions([{ key: "x", prompt: "p", agentType: "a" }], DEFAULT_DIMENSIONS),
372
- [{ key: "x", prompt: "p", agentType: "a" }],
373
- );
374
- });
375
-
376
- // #279. These five all used to produce "object is missing required field(s):
377
- // key, prompt, agentType" — a message asserting the entry IS an object and
378
- // sending the caller off to add three fields to a `42`. The type is the defect;
379
- // say so. `null` and `undefined` are the case the old `!entry?.[f]` optional
380
- // chain covered by accident: it kept the run from dying on an uncaught
381
- // `TypeError: Cannot read properties of null (reading 'key')`, but it answered
382
- // with the wrong diagnosis. The explicit type check answers with the right one.
383
- test("a non-object entry is reported as the wrong TYPE, not as an object missing fields", () => {
384
- for (const [entry, name] of [
385
- [42, "number"],
386
- [null, "null"],
387
- [undefined, "undefined"],
388
- [true, "boolean"],
389
- [["x"], "array"],
390
- ]) {
391
- // Deliberately NOT anchored on the `[0]` index here — index coverage for
392
- // THIS type-mismatch branch is a dedicated assertion below, not this one:
393
- // dropping `[${i}]` from the throw does not fail #281's "identifies which
394
- // entry" test either, since that test only exercises the missing-field
395
- // and unknown-key branches. "Reverting one must red one" does not hold
396
- // for this branch without that dedicated assertion.
397
- assert.throws(
398
- () => resolveDimensions([entry], DEFAULT_DIMENSIONS),
399
- new RegExp(`review-pr: args\\.dimensions\\[0\\] must be a key string or a dimension object, got ${name}$`),
400
- `a ${name} entry no longer names its own type, and not as an object missing fields`,
401
- );
402
- }
403
- });
404
-
405
- // The loop above only ever indexes ONE entry ([0]), so it cannot pin the
406
- // index for a multi-entry override — and separately from #281's "identifies
407
- // which entry" test above, which never exercises this branch at all. Dropping
408
- // `[${i}]` from the type-mismatch throw (review-core.mjs) fails no
409
- // test above. Mutation-verified: reverting the `${i}` in that throw back to a
410
- // fixed string reds this assertion.
411
- test("a type-mismatch entry error identifies which entry of a multi-entry override failed", () => {
412
- assert.throws(
413
- () => resolveDimensions(["correctness", 42], DEFAULT_DIMENSIONS),
414
- /review-pr: args\.dimensions\[1\] must be a key string or a dimension object, got number$/,
415
- );
416
- });
417
-
418
- // #281. With a multi-entry override the field names alone do not say WHICH
419
- // entry is short — and the map callback has the index already. Both throwing
420
- // branches carry it, so an unknown key in a long list is locatable too.
421
- test("an entry error identifies which entry of a multi-entry override failed", () => {
422
- assert.throws(
423
- () => resolveDimensions(["correctness", "comments", { key: "x", agentType: "y" }], DEFAULT_DIMENSIONS),
424
- /args\.dimensions\[2\] is missing required field\(s\): prompt/,
425
- );
426
- assert.throws(
427
- () => resolveDimensions(["correctness", "not-a-real-dimension"], DEFAULT_DIMENSIONS),
428
- /args\.dimensions\[1\] named an unknown key "not-a-real-dimension"/,
429
- );
430
- });
431
-
432
- // #274. A repeated key resolved to two entries pointing at ONE dimension
433
- // object: the fan-out dispatched the same specialist twice against a single
434
- // scratch dir, and the coverage record double-counted it — which
435
- // `run-team/SKILL.md` reads AS coverage. Redundant-but-valid input WHEN THE
436
- // ENTRIES AGREE, so it dedupes silently in that case; throwing would refuse a
437
- // request whose meaning is not in doubt. A DIVERGENT collision is a different
438
- // case — see the dedicated test below.
439
- test("a repeated key resolves once, and does not throw", () => {
440
- assert.deepEqual(
441
- resolveDimensions(["correctness", "comments", "correctness"], DEFAULT_DIMENSIONS),
442
- [DEFAULT_DIMENSIONS[0], DEFAULT_DIMENSIONS[3]],
443
- );
444
- // A key and the object it names are the same dimension; first occurrence wins.
445
- assert.deepEqual(
446
- resolveDimensions(["correctness", DEFAULT_DIMENSIONS[0]], DEFAULT_DIMENSIONS),
447
- [DEFAULT_DIMENSIONS[0]],
448
- );
449
- // Dedupe must not empty a set that had entries: an all-duplicate override
450
- // resolves to one dimension, not to the "resolved to no dimensions" throw.
451
- assert.equal(resolveDimensions(["types", "types", "types"], DEFAULT_DIMENSIONS).length, 1);
452
- });
453
-
454
- // A second entry sharing a key but DIVERGING (different `prompt`/`agentType`)
455
- // used to dedupe SILENTLY too, discarding a caller's real attempt to
456
- // override or customize a catalog entry with zero signal — the one silent
457
- // exception to what this whole function exists to do (#279/#281 turn silent/
458
- // ambiguous failures into loud, indexed ones). Mutation-verified: comparing
459
- // only `d.key` in the dedupe loop (the old behaviour) reds this test; the
460
- // identical-duplicate cases above stay green either way, so this is
461
- // independent of them, not a replacement. `model` used to be a third
462
- // divergence field here too, before #1349 retired it outright (see the
463
- // dedicated "refused regardless of its type" test above) — a `model`-only
464
- // divergence can no longer reach this comparison at all, since the field is
465
- // refused before resolveDimensions ever gets to dedupe.
466
- test("a repeated key with different fields throws — a divergent collision is not silently dropped", () => {
467
- const dup = { key: "correctness", prompt: "other", agentType: "code-reviewer" };
468
- assert.throws(
469
- () => resolveDimensions([DEFAULT_DIMENSIONS[0], dup], DEFAULT_DIMENSIONS),
470
- /review-pr: args\.dimensions\[1\] repeats key "correctness" with different fields$/,
471
- );
472
- });
473
-
474
- test("an override resolving to nothing stops the run", () => {
475
- assert.throws(() => resolveDimensions([], DEFAULT_DIMENSIONS), /resolved to no dimensions/);
476
- });
477
-
478
- test("a non-array override stops the run rather than crashing on .map", () => {
479
- assert.throws(() => resolveDimensions({ key: "correctness" }, DEFAULT_DIMENSIONS), /must be an array/);
480
- });
481
-
482
- // #278. The header claimed "the three fields the fan-out actually dereferences"
483
- // and enumerated three; four were dereferenced, back when `model` was a
484
- // fourth optional field. #1349 retired `model` entirely, so the
485
- // dereferenced set is three again — `key`, `prompt`, `agentType` — and this
486
- // pin now confirms the header says exactly that rather than re-asserting the
487
- // four-field count #278 corrected. Derived from the source rather than
488
- // hand-listed, because hand-derived count claims about this function have
489
- // been wrong before (#118) — a fifth dereferenced field reds this and forces
490
- // the prose to be updated with it.
491
- test("the resolveDimensions header states the dereferenced-field situation correctly", () => {
492
- const m = SOURCE.match(/((?:^\/\/.*\n)+)^export function resolveDimensions\(/m);
493
- assert.ok(m, "resolveDimensions no longer carries a header comment block — update this test");
494
- const header = m[1];
495
- // Comments stripped BEFORE deriving the dereferenced set: the header's own
496
- // prose lists `d.key`, `d.prompt`, `d.model`, `d.agentType` in backticks,
497
- // which matches the same `\bd\.` pattern used to derive the set. Deriving
498
- // from raw SOURCE would let the header vote for its own claim — it could
499
- // catch the header UNDER-counting a field the code dereferences, but never
500
- // OVER-counting one the code no longer does, since the header's mention
501
- // would keep padding the derived set to match itself.
502
- const dereferenced = [...new Set([...stripComments(SOURCE).matchAll(/\bd\.([a-zA-Z]+)/g)].map((x) => x[1]))].sort();
503
- assert.deepEqual(dereferenced, ["agentType", "key", "prompt"], "the dereferenced field set changed");
504
- for (const f of dereferenced) {
505
- assert.match(header, new RegExp("`d\\." + f + "`"), `the header no longer enumerates d.${f}`);
506
- }
507
- assert.doesNotMatch(header, /three fields the fan-out actually dereferences/, "the header undercounts again");
508
- assert.doesNotMatch(header, /absent means inherit/i, "the refuted reword is back — see the models-sent log");
509
- });
510
-
511
- // Everything above tests a LIFTED COPY. Nothing above proves review-core.mjs
512
- // wires resolveDimensions AND selectDimensions into the same call site:
513
- // replacing it with `explicitDimensions || DEFAULT_DIMENSIONS` left this file
514
- // green before (#118) by disconnecting the size tier, and a version that
515
- // dropped resolveDimensions here would do the same to the override
516
- // normalization, silently. This is the only assertion that fails on either.
517
- //
518
- // The two halves now sit ~570 lines apart (#275 moved normalization up to the
519
- // required-args guard), so this pin is TWO pins — one per line. Weakening either
520
- // to a looser match, or dropping one because the other still passes, restores
521
- // exactly the hole #118 opened.
522
- test("runReview actually calls resolveDimensions, then selectDimensions, to pick the fan-out", () => {
523
- assert.match(
524
- SOURCE,
525
- /^\s*const explicitDimensions = resolveDimensions\(A\.dimensions, DEFAULT_DIMENSIONS\);$/m,
526
- "the args.dimensions normalization changed — the override may be passed through unresolved",
527
- );
528
- assert.match(
529
- SOURCE,
530
- /^\s*const dimensions = explicitDimensions \|\| selectDimensions\(DEFAULT_DIMENSIONS, stats\);$/m,
531
- "the dimensions call site changed — override normalization and/or size-tier selection may be disconnected",
532
- );
533
- });
534
-
535
- // #275, AC: "refused with no agent dispatched and no snapshot directory
536
- // created". Both are pinned by ONE ordering fact, because the snapshot
537
- // directory is `mkdir -p`'d inside the snapshot agent's own bash — the dispatch
538
- // is the only thing that creates it. Asserting the message alone would stay
539
- // green with the throw back below the snapshot, which is the whole defect.
540
- //
541
- // The workflow cannot be imported to test this by execution: it runs a
542
- // top-level `await pipeline(...)` and compiles as a function body (#538), so
543
- // source position is the observable. Same shape as
544
- // review-core-snapshot-path.test.mjs's guard-ordering pin.
545
- test("an unresolvable override is refused before the snapshot agent is dispatched", () => {
546
- const resolveAt = SOURCE.indexOf("const explicitDimensions = resolveDimensions(A.dimensions, DEFAULT_DIMENSIONS);");
547
- const guardAt = SOURCE.indexOf('if (!pr || !worktree) throw new Error("review-pr: args.pr and args.worktree are required");');
548
- const snapshotAt = SOURCE.indexOf("const snap = await agent(");
549
- const mkdirAt = SOURCE.indexOf('mkdir -p "${runRootParent}"');
550
- assert.ok(resolveAt !== -1 && guardAt !== -1 && snapshotAt !== -1, "one of the three sites moved — update this test");
551
- assert.ok(guardAt < resolveAt, "the required-args guard no longer runs first — args.pr errors are now masked");
552
- assert.ok(
553
- resolveAt < snapshotAt,
554
- "args.dimensions is validated after the snapshot agent — a typo'd key pays for a snapshot agent first (#275)",
555
- );
556
- // The directory is created by that dispatch, not before it, so "no snapshot
557
- // directory" follows from "no dispatch" only while the mkdir stays inside.
558
- assert.ok(
559
- mkdirAt > snapshotAt,
560
- "the run-root mkdir moved out of the snapshot agent's bash — 'no directory created' no longer follows from 'no agent dispatched'",
561
- );
562
- });
563
-
564
- // Slice, then match. A whole-file `assert.match` for this proved nothing: it
565
- // survived commenting the line out, planting the phrase in a comment elsewhere,
566
- // AND moving the `model` option off the review dispatch onto the refuter
567
- // dispatch. Comment lines are stripped so a commented-out option cannot satisfy
568
- // it, and the slice is the review dispatch's options object alone.
569
- function reviewDispatchOptions() {
570
- const m = SOURCE.match(/\{ label: `review:\$\{d\.key\}\$\{forPr\}`[^\n]*\},/);
571
- assert.ok(m, "review-core.mjs no longer passes an options object labelled review:${d.key}${forPr} — update this test");
572
- return m[0]
573
- .split("\n")
574
- .filter((l) => !/^\s*\/\//.test(l))
575
- .join("\n");
576
- }
577
-
578
- // #1349 (per #1303's gap 3) retired the whole per-call override this test
579
- // used to pin: `args.specialistModel`/per-dimension `model` are both gone,
580
- // and no `agent()` call anywhere in review-core.mjs may carry a `model` option
581
- // at all — review-tier-audit.test.mjs is the general-purpose guard for that;
582
- // this pin is the SPECIFIC regression check that the review dispatch's own
583
- // options object never grows one back.
584
- test("the review dispatch never carries a model option — tier lives only in agentType's definition", () => {
585
- assert.doesNotMatch(
586
- reviewDispatchOptions(),
587
- /\bmodel\s*:/,
588
- "the review dispatch carries a `model` option again — #1349 ruled that out entirely",
589
- );
590
- assert.doesNotMatch(
591
- stripComments(SOURCE),
592
- /specialistModel/,
593
- "args.specialistModel is back in CODE — #1349 retired this per-call override entirely (a comment explaining the removal is fine and expected)",
594
- );
595
- });
596
-
597
- // The log is the only runtime evidence of WHICH fleet-owned definition each
598
- // dimension dispatched to — the tier itself is no longer runtime-visible
599
- // here at all (#1349): it lives in that definition's own frontmatter, read
600
- // off the definition file or the dispatch transcript, never off this log.
601
- test("the dispatch log reports the agentType sent for each dimension, not a model tier", () => {
602
- const m = SOURCE.match(/`agents dispatched \$\{dimensions[\s\S]*?\n/);
603
- assert.ok(m, "the `agents dispatched` log line is gone — nothing then reports which definition each dimension used");
604
- assert.match(m[0], /d\.agentType/, "the log no longer names the dispatched agentType");
605
- assert.doesNotMatch(m[0], /"frontmatter"|"inherit"/, "the log still reasons about a model tier that no agent() call carries anymore");
606
- });
607
-
608
- // `gh pr view --json files` pages at 100 and exits 0, so a truncated list is a
609
- // short MEASUREMENT, not a small PR: `loc` under-counts and `docsOnly` can be
610
- // true only because the src files fell off the end. Either one trims dimensions
611
- // off production code — the docs profile drops four. Widen, the same safe
612
- // direction as an unparseable blob.
613
- test("a truncated file list widens to the full set, whatever it profiles as", () => {
614
- const docsish = computeStats(
615
- [
616
- { path: "docs/a.md", additions: 3, deletions: 0 },
617
- { path: "docs/b.md", additions: 3, deletions: 0 },
618
- ],
619
- 124,
620
- );
621
- assert.equal(docsish.docsOnly, true, "the short list really does look docs-only — that is the trap");
622
- assert.equal(docsish.truncated, 124);
623
- assert.equal(
624
- selectDimensions(DEFAULT_DIMENSIONS, docsish).length,
625
- DEFAULT_DIMENSIONS.length,
626
- "a capped list was sized as a docs PR — four dimensions dropped off code gh never listed",
627
- );
628
- // And the widen must not fire when the list is complete, or every review runs
629
- // the full set forever and the size tier is dead.
630
- const complete = computeStats(
631
- [
632
- { path: "docs/a.md", additions: 3, deletions: 0 },
633
- { path: "docs/b.md", additions: 3, deletions: 0 },
634
- ],
635
- 2,
636
- );
637
- assert.equal(complete.truncated, undefined);
638
- assert.deepEqual(
639
- selectDimensions(DEFAULT_DIMENSIONS, complete).map((d) => d.key),
640
- ["correctness", "comments"],
641
- "the docs trim no longer fires on a complete docs-only list",
642
- );
643
- });
644
-
645
- // The invariant that made two `x.length ? x : all` fallbacks dead code, deleted
646
- // in #669. This is the pin that has to hold for the deletion to stay safe: with
647
- // `all = DEFAULT_DIMENSIONS` — which is what the ONE call site passes, an
648
- // `args.dimensions` override having short-circuited via `resolveDimensions` —
649
- // no combination of stats can empty the set. Sweeping the stats SHAPE rather
650
- // than a file list on purpose: the fallbacks guarded against a corrupt or
651
- // unforeseen blob, so the values under test include the non-booleans and
652
- // unknown profiles a real payload could carry, not only what computeStats emits.
653
- test("no stats shape empties the dimension set — `correctness` survives every filter", () => {
654
- // `""` stands in for the whole falsy family (`undefined`, `null`, `""`) plus
655
- // `"empty"`: all four hit `!stats.profile || stats.profile === "empty"` and
656
- // return `all` before any other field is read, so they are one outcome, not
657
- // four — verified by re-reading that guard, not assumed from this trim.
658
- const profiles = ["", "docs", "tests-only", "single-file", "small", "production", "bogus"];
659
- const values = [true, false, undefined, null, "yes", 0, 1];
660
- for (const profile of profiles)
661
- for (const docsOnly of values)
662
- for (const hasSrc of values)
663
- for (const hasTests of values)
664
- for (const truncated of values) {
665
- const stats = { profile, docsOnly, hasSrc, hasTests, truncated };
666
- assert.ok(
667
- selectDimensions(DEFAULT_DIMENSIONS, stats).some((d) => d.key === "correctness"),
668
- `correctness was filtered out by ${JSON.stringify(stats)}`,
669
- );
670
- }
671
- // The non-object arms of the same guard.
672
- for (const stats of [null, undefined, 0, "", false])
673
- assert.equal(selectDimensions(DEFAULT_DIMENSIONS, stats).length, DEFAULT_DIMENSIONS.length);
674
- });