@feigi/fleet-ctl 3.23.36 → 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,245 +0,0 @@
1
- import test from "node:test";
2
- import assert from "node:assert/strict";
3
- import { readdirSync, readFileSync } from "node:fs";
4
- import { fileURLToPath } from "node:url";
5
- import { join, extname, basename } from "node:path";
6
-
7
- // #765 swept comments that located a construct by counting lines ("two-lines-up",
8
- // "one-line-later", "a-few-lines-down"). Every one had rotted: the count was
9
- // wrong because something had been inserted since. #769 then swept the same
10
- // defect spelled with no numeral at all — a bare "the-line-above" — which no
11
- // numeral-word alternation can reach however many synonyms it lists. This gate
12
- // keeps both out; the remedy for either is to name the construct, carrying the
13
- // file when the construct lives in another one.
14
- //
15
- // Comment blocks are STITCHED before matching. One site escaped four separate
16
- // single-line enumerations because its phrase straddled a comment break — the
17
- // count ended one line and the direction began the next, so no line-oriented
18
- // grep could see it. Joining consecutive comment lines first is the whole point
19
- // of this file; a per-line scan reproduces the miss.
20
- //
21
- // Everything hyphenated in this header for the same reason the pattern below is
22
- // assembled from parts: spelled normally, the gate would trip on its own
23
- // rationale. That is asserted, not hoped for.
24
- //
25
- // Out of class, and deliberately unreachable by the pattern: counts over named
26
- // units ("the-two-cases-above") count semantic units and survive reflow;
27
- // ordinal forms ("first-line", "last-line") describe output data rather than
28
- // pointing at source; a size ("the-same-40-lines") is not a position.
29
- //
30
- // Scope is this repo's code files, every directory holding one of MARKER's
31
- // extensions. Markdown prose (skills/, commands/, agents/) stays out of reach:
32
- // it has no comment marker to stitch blocks from, so covering it means scanning
33
- // whole files — a different gate. #769 swept it by grep instead.
34
-
35
- const DIR = fileURLToPath(new URL(".", import.meta.url));
36
- const SELF = basename(fileURLToPath(import.meta.url));
37
- // The CI helpers carry the same prose and the same
38
- // rot. Scoping to one directory is what let #769's sites sit outside the
39
- // previous gate's reach, so DIRS names every directory holding a scannable
40
- // file — pinned by name in the walk test below, not left to this list.
41
- const DIRS = [
42
- DIR,
43
- fileURLToPath(new URL("../../.github/scripts/", import.meta.url)),
44
- ];
45
-
46
- // #1311: COUNT only enumerated single numeral words, so a compound count
47
- // ("two-hundred-lines-above") broke the COUNT-lines adjacency — "two"
48
- // matched COUNT, but the next token was "hundred", not "lines". MULTIPLIER
49
- // lets every existing numeral word (or a bare digit) take an optional
50
- // hundred/thousand suffix without touching the required
51
- // numeral-immediately-before-"lines" adjacency that keeps bare temporal
52
- // "before"/"after" out of this arm. The initial landing attached it to only
53
- // three of five numeral alternatives (missing "a few" and "several") — the
54
- // exact evasion this PR exists to close, just on different words; MULTIPLIER
55
- // is now factored over the whole numeral-word group instead of per-arm so
56
- // that gap cannot reopen one alternative at a time.
57
- //
58
- // "a couple" is new to this arm — the base gate had no "couple" arm at all —
59
- // so its multiplier is REQUIRED, not optional: without that, this PR would
60
- // silently widen the gate to catch bare "a couple lines below" too, coverage
61
- // nobody asked for and nothing pinned. Bare "a hundred"/"a thousand" (no
62
- // numeral word at all) gets its own arm for the same reason: it is a
63
- // genuinely different shape, not a suffix on an existing word.
64
- //
65
- // Measured against the whole tree before landing (#1311): zero new hits —
66
- // the pre-existing whole-tree matches are out of this gate's scope: markdown
67
- // or tsv prose (a different gate's job per the header above), JSDoc `/**`
68
- // -style lines this gate's `//`-only MARKER never reads, or plain
69
- // string-literal fixture text inside unrelated *.test.mjs files' assertions
70
- // (e.g. ci-completes-premise-prose.test.mjs) that this gate, which only
71
- // reads comment lines, never touches — so the widening was not shown to buy
72
- // any false positive here.
73
- const MULTIPLIER = "(?:\\s+(?:hundred|thousand))?";
74
- const REQUIRED_MULTIPLIER = "\\s+(?:hundred|thousand)";
75
- const COUNT = `(?:(?:one|two|three|four|five|six|seven|eight|nine|ten|a\\s+few|several|\\d+)${MULTIPLIER}|a\\s+couple${REQUIRED_MULTIPLIER}|a${REQUIRED_MULTIPLIER})`;
76
- // The bare form takes no numeral, so it needs its own arm. Narrower direction
77
- // set on purpose: "the-line-up" is not English, and widening it buys nothing
78
- // while risking prose that never pointed at a line.
79
- const BARE = "(?:above|below|before|after)";
80
- // The counted arm carries BARE's directions too, or the gate reads a direction
81
- // as line-relative only while the count is absent — "N-lines-before" would walk
82
- // through the arm built to catch counted distances. Union, not a second list,
83
- // so the two arms cannot drift apart again. Safe only because COUNT pins a
84
- // numeral immediately before "lines": bare temporal "before"/"after" prose,
85
- // which is everywhere, never reaches this arm.
86
- const WHERE = `(?:${BARE}|up|down|later|earlier|further\\s+(?:up|down))`;
87
- // Assembled from parts, never written out as a literal instance, so this file
88
- // can scan itself without tripping — proven by the self-scan assertion below.
89
- const IDIOM = new RegExp(`\\b(?:${COUNT}\\s+lines?\\s+${WHERE}|the\\s+lines?\\s+${BARE})\\b`, "i");
90
-
91
- const MARKER = { ".sh": "#", ".mjs": "//", ".js": "//" };
92
-
93
- function commentBlocks(src, marker) {
94
- const re = new RegExp(`^\\s*${marker}\\s?(.*)$`);
95
- // A trailing comment is its own one-line block, never stitched to the next
96
- // line's. Whole-line-only is the stripper bug this repo has already been
97
- // bitten by: a gate that kills `<marker> whole-line` is walked straight
98
- // through by `code; <marker> trailing`, and the idiom reads the same in both.
99
- // Leading whitespace is required before the marker so `$#`, `${#v}`, `#!` and
100
- // a `//` inside a URL are not read as comment openers.
101
- const trail = new RegExp(`\\s${marker}\\s?(.*)$`);
102
- const out = [];
103
- let cur = null;
104
- const close = () => { if (cur) out.push({ line: cur.line, text: cur.parts.join(" ") }); cur = null; };
105
- src.split("\n").forEach((line, i) => {
106
- const m = line.match(re);
107
- if (m) { (cur ??= { line: i + 1, parts: [] }).parts.push(m[1]); return; }
108
- close();
109
- const t = line.match(trail);
110
- if (t) out.push({ line: i + 1, text: t[1] });
111
- });
112
- close();
113
- return out;
114
- }
115
-
116
- function hitsIn(src, marker) {
117
- return commentBlocks(src, marker).filter((b) => IDIOM.test(b.text));
118
- }
119
-
120
- // Returns the files it actually opened, not just a count, so the walk test
121
- // below can pin coverage against the walk itself.
122
- function sweep(dirs, skipSelf = true) {
123
- const hits = [];
124
- const files = [];
125
- for (const dir of dirs) {
126
- for (const f of readdirSync(dir)) {
127
- if (skipSelf && f === SELF) continue;
128
- const marker = MARKER[extname(f)];
129
- if (!marker) continue;
130
- files.push(f);
131
- for (const b of hitsIn(readFileSync(join(dir, f), "utf8"), marker)) {
132
- const m = b.text.match(IDIOM);
133
- hits.push(`${f}:${b.line} …${b.text.slice(Math.max(0, m.index - 45), m.index + m[0].length + 15)}…`);
134
- }
135
- }
136
- }
137
- return { hits, files };
138
- }
139
-
140
- test("no comment locates a construct by a line distance", () => {
141
- const { hits, files } = sweep(DIRS);
142
- // Without this the whole gate passes vacuously the day the walk reads nothing.
143
- assert.ok(files.length > 50, `swept only ${files.length} files — the walk is not reaching these directories`);
144
- assert.deepEqual(hits, [], `line-distance comment(s) reintroduced — name the construct, drop the distance:\n${hits.join("\n")}`);
145
- });
146
-
147
- // The walk must reach every directory holding a scannable file, not just this
148
- // one. Asserted against what sweep OPENED, by name: re-deriving the listing
149
- // here would pin DIRS and MARKER while a sweep that skipped a whole directory
150
- // stayed green — measured, dropping .github/scripts/ moves the count 136 → 134,
151
- // far above the vacuity floor above. By name, not by count, so landing another
152
- // file in any of these directories does not red the gate.
153
- test("the walk reaches the CI helpers too", () => {
154
- const { files } = sweep(DIRS);
155
- for (const f of ["apply-ruleset.sh", "review-core.mjs"]) {
156
- assert.ok(files.includes(f), `not swept: ${f} — the walk opened ${files.length} files`);
157
- }
158
- });
159
-
160
- // The pattern must be invisible to its own text, or this file's rationale above
161
- // would have to avoid the vocabulary it exists to forbid.
162
- test("the gate does not trip on its own source", () => {
163
- assert.deepEqual(sweep(DIRS, false).hits, []);
164
- });
165
-
166
- // Discrimination, both directions. Built by joining tokens so no line of this
167
- // file ever carries a live instance for the self-scan above to find.
168
- const D = ["the", "line", "above"].join(" ");
169
- const TAIL = ["line", "above"].join(" ");
170
-
171
- test("the bare form reds however it is spelled", () => {
172
- const red = {
173
- "whole-line #": [`# captured ${D} — so the hazard does not apply`, "#"],
174
- "whole-line //": [`// captured ${D} — so the hazard does not apply`, "//"],
175
- "trailing #": [`x=1 # captured ${D} here`, "#"],
176
- "trailing //": [`const x = 1; // captured ${D} here`, "//"],
177
- "wrapped across a # break": [`# captured the\n# ${TAIL} here`, "#"],
178
- "wrapped across a // break": [`// captured the\n// ${TAIL} here`, "//"],
179
- "plural": [`# ${["the", "lines", "below"].join(" ")} assert it`, "#"],
180
- "before/after spelling": [`# ${["the", "line", "after"].join(" ")} collided`, "#"],
181
- // The counted arm's own before/after: caught by WHERE's union with BARE,
182
- // and the reason that union exists rather than two hand-kept lists.
183
- "counted before/after": [`# it broke ${["two", "lines", "before"].join(" ")} this guard`, "#"],
184
- };
185
- for (const [name, [src, marker]] of Object.entries(red)) {
186
- assert.equal(hitsIn(src, marker).length, 1, `missed the bare form: ${name}`);
187
- }
188
- });
189
-
190
- // #1311's planted evasion and its near relatives: a numeral word carrying a
191
- // hundred/thousand multiplier, still immediately before "lines" + WHERE.
192
- // "a few" and "several" only gained the suffix here — the initial #1311
193
- // landing attached MULTIPLIER to three of five numeral alternatives and
194
- // missed these two, the same evasion class on different words. Bare
195
- // "a hundred"/"a thousand" (no numeral word) is its own arm, not a
196
- // numeral-plus-suffix, and needs its own probe.
197
- test("the counted arm reds for compound numerals", () => {
198
- const red = {
199
- "two hundred": [`# and it must not be re-asserted ${["two", "hundred", "lines", "above"].join(" ")} it`, "#"],
200
- "a couple hundred": [`// drifted ${["a", "couple", "hundred", "lines", "below"].join(" ")} the call`, "//"],
201
- "three thousand": [`# moved ${["three", "thousand", "lines", "earlier"].join(" ")} in the file`, "#"],
202
- "a few hundred": [`# reordered ${["a", "few", "hundred", "lines", "above"].join(" ")} the header`, "#"],
203
- "several hundred": [`// shifted ${["several", "hundred", "lines", "below"].join(" ")} the marker`, "//"],
204
- "bare a hundred": [`# it sat ${["a", "hundred", "lines", "above"].join(" ")} the fix`, "#"],
205
- "bare a thousand": [`// spans ${["a", "thousand", "lines", "below"].join(" ")} the call`, "//"],
206
- };
207
- for (const [name, [src, marker]] of Object.entries(red)) {
208
- assert.equal(hitsIn(src, marker).length, 1, `missed the compound numeral form: ${name}`);
209
- }
210
- });
211
-
212
- // Each case carries its own marker, like the red table above. Asserting a
213
- // `#` source under the `//` marker cannot fail: no marker means no comment
214
- // block, so the assertion holds whatever the pattern does — six of twelve here
215
- // were unfalsifiable that way. The URL case is the one that genuinely needs
216
- // `//`: it is the only guard on the leading `\s` in commentBlocks' trail regex.
217
- test("the widened gate still refuses to fire on the out-of-class forms", () => {
218
- const green = {
219
- "a count with no direction": ["# it sits two lines from here", "#"],
220
- "a count over named units": ["# the two cases above disagree", "#"],
221
- "an ordinal over output data": ["# the first line of stdout is the header", "#"],
222
- "a size, not a position": ["# the same ~40 lines were copy-pasted", "#"],
223
- "a // inside a URL": [`curl https://ex.test/x ${D}`, "//"],
224
- "a bare direction word with no line": ["# the guard above already fired", "#"],
225
- // Temporal before/after, the prose the counted arm's widening had to stay
226
- // clear of: a direction word with no count and no line is not a position.
227
- "a temporal direction word": ["# it ran before the fetch landed", "#"],
228
- // "lines" present but not adjacent to the numeral: guards against a
229
- // widening that dropped the numeral-immediately-before-"lines"
230
- // requirement instead of adding an optional suffix to it (the shape
231
- // #1301's review measured producing false positives on unrelated
232
- // temporal prose). The fixture must itself carry "lines" — one with no
233
- // "lines" substring at all (as this case previously read) stays green
234
- // under that exact regression too, so it never exercised the claim.
235
- "a compound count with lines out of adjacency": ["# it deleted a couple hundred blank lines above the cutoff", "#"],
236
- // "a couple" is new to COUNT and its multiplier is required, not
237
- // optional (see the COUNT comment above): unlike "a few" and "several",
238
- // which already matched bare before this PR, bare "a couple" is new
239
- // territory this PR must not silently claim.
240
- "a bare 'a couple' with no multiplier": ["# it sits a couple lines below the guard", "#"],
241
- };
242
- for (const [name, [src, marker]] of Object.entries(green)) {
243
- assert.deepEqual(hitsIn(src, marker), [], `false positive: ${name}`);
244
- }
245
- });
@@ -1,83 +0,0 @@
1
- // #659. Phase 0's liveness paragraph prescribes
2
- // `git log -S '<old string>' --oneline origin/main -- <file> | head -1` and then
3
- // argues for the `origin/main` pin. The argument named the wrong failure mode:
4
- // it said an unpinned search on a checkout behind the remote "prints nothing at
5
- // exit 0", which is the symptom of the **new**-string search the paragraph
6
- // directly above FORBIDS — not of the old-string search it prescribes.
7
- //
8
- // Measured on the recipe's own worked example (#206,
9
- // `skills/next-ticket/SKILL.md`, git 2.50.1), old string
10
- // `server-side \`--search\` + \`--jq\``, new string
11
- // `\`--search\` narrows server-side, \`--jq\` reduces inside \`gh\``:
12
- //
13
- // old @ 0dc39ef^ → `4fd2f73` at exit 0 (a WRONG commit, not empty)
14
- // new @ 0dc39ef^ → empty at exit 0
15
- // old @ 4fd2f73^ → empty at exit 0 (behind the rename as well)
16
- // old @ origin/main → `0dc39ef` first (the fix — the pin working)
17
- //
18
- // So each symptom belongs to a different search, and the one the paragraph
19
- // prescribes fails by naming a plausible wrong commit — which
20
- // `git merge-base --is-ancestor` then clears exactly as well as the real fix
21
- // (measured: exit 0 for `4fd2f73` and `0dc39ef` alike), so the ancestry gate is
22
- // no backstop. That is strictly worse than empty output, and the clause taught
23
- // readers to expect empty. Both halves of the attribution are pinned here
24
- // because a correction that keeps only one of them still misattributes the
25
- // other.
26
- //
27
- // SLICE SIZE anchors these, as in `staleness-qualifier-prose.test.mjs`. This
28
- // document discusses old wording, new wording, exit-0 emptiness and `head -1`
29
- // across several neighbouring paragraphs, so a whole-file match is satisfiable
30
- // from outside the rule it guards: measured, with the live clause reverted to
31
- // its #659 wording and each pinned phrase appended once as a stray line further
32
- // down the file, an unbounded suite went green — the pass bought entirely by
33
- // the decoy. The slice is cut to the one paragraph carrying the rule, and a
34
- // moved anchor reddens rather than silently widening back to the file.
35
- //
36
- // THE CEILING: this pins the two attributions and nothing else — not the
37
- // `--reverse` sentences that follow, not that the recipe above is right. A
38
- // deliberate reword reddens this; re-anchor the phrase here rather than
39
- // dropping the attribution a second time. Reflow-safe by construction:
40
- // `phrase()` joins words on `\s+`, so a rewrap of the hard-wrapped paragraph is
41
- // a no-op.
42
-
43
- import { test } from "node:test";
44
- import assert from "node:assert/strict";
45
- import { readFileSync } from "node:fs";
46
- import { join } from "node:path";
47
- import { paragraph, phrase } from "./prose-pin.mjs";
48
-
49
- const SKILL = "skills/run-team/SKILL.md";
50
- const ANCHOR = "**Both halves of that command are load-bearing.**";
51
-
52
- // The paragraph carrying the rule, and no more of the file than that. A missing
53
- // anchor is a failure rather than a wider slice: silently falling back to the
54
- // whole document is the false green this bound exists to prevent.
55
- //
56
- // The shared bound, not a local copy of it (#1372). What it closes that a local
57
- // copy could not: a blank line carrying whitespace, which a literal `\n\n`
58
- // search runs straight past into the next paragraph, and an anchor occurring
59
- // more than once, which binds the pin to whichever copy of the anchored block
60
- // comes first. What it does NOT close is a blank line deleted outright — the
61
- // paragraphs then merge and the slice takes both, a hole that predates this
62
- // bound and is open still (#1377).
63
- const rule = () =>
64
- paragraph(readFileSync(join(import.meta.dirname, "..", ...SKILL.split("/")), "utf8"), ANCHOR, SKILL);
65
-
66
- const OLD_HALF = "the prescribed **old**-string search names a *wrong* commit at exit 0";
67
- const NEW_HALF = "the **new**-string search the paragraph above forbids that prints nothing at exit 0";
68
-
69
- test("the liveness paragraph attributes the WRONG-COMMIT symptom to the prescribed old-string search", () => {
70
- assert.match(
71
- rule(),
72
- phrase(OLD_HALF),
73
- `${SKILL}'s "${ANCHOR}" paragraph no longer says "${OLD_HALF}". Unpinned, the search the recipe PRESCRIBES answers with a plausible wrong commit on a checkout behind the fix — measured, \`4fd2f73\` at \`0dc39ef^\` — and \`--is-ancestor\` clears it. Reading that failure as empty output is #659.`,
74
- );
75
- });
76
-
77
- test("the liveness paragraph attributes the EMPTY-OUTPUT symptom to the forbidden new-string search", () => {
78
- assert.match(
79
- rule(),
80
- phrase(NEW_HALF),
81
- `${SKILL}'s "${ANCHOR}" paragraph no longer says "${NEW_HALF}". "Prints nothing at exit 0" is the symptom of the new-string search the paragraph above forbids, never the consequence of dropping \`origin/main\` from the prescribed one — that swap is exactly #659.`,
82
- );
83
- });
@@ -1,189 +0,0 @@
1
- // #582. Six scripts carry `export LC_ALL=C`, and this is the only assertion
2
- // about it that CI can actually run.
3
- //
4
- // The behavioural gate lives in no-undo-audit.test.mjs: a conflicting path
5
- // holding an invalid UTF-8 byte must still name every conflict. That test is
6
- // correct on both platforms, but it only FAILS on one. BSD `tr` exits 1 on the
7
- // byte; GNU `tr` is byte-oriented and passes it through, as are GNU `sed`,
8
- // `paste` and `awk` — measured with coreutils 9.11, gnu-sed 4.10 and gawk 5.4.1
9
- // ahead of PATH, the whole of no-undo-audit.test.mjs stays green with
10
- // `export LC_ALL=C` deleted. `ci.yml` runs the suite on ubuntu-latest. So on the
11
- // one platform CI uses, deleting the pin from any of the six is invisible, and
12
- // the obvious cleanup — "a redundant export, drop it" — ships green.
13
- //
14
- // Hence a source assertion, which this repo already uses for exactly this shape
15
- // (no-undo-audit.test.mjs pins a phrase in its own script's comment).
16
- //
17
- // What it pins and what it does not. PRESENCE: `\b` after `LC_ALL=C`, not `$`,
18
- // so `export LC_ALL=C LANG=C` — strictly stronger — does not read as a
19
- // regression; measured, the `$` form false-alarms on it. PLACEMENT: only that
20
- // the pin sits in the file's prologue, ahead of the first line that does any
21
- // work. That is the mutant presence alone misses — the pin moved below its own
22
- // pipelines is genuinely broken and a presence check stays green on it. It does
23
- // NOT pin per-script behaviour: two of the six — inflight.sh and
24
- // release-ticket.sh — have no regression fixture at all, which is deliberate
25
- // and recorded on the PR rather than hidden. inflight.sh's own locale test
26
- // exercises probe 2's INLINE `LC_ALL=C awk`, not this file-global pin (#614),
27
- // so it does not count as coverage for the line asserted here.
28
- //
29
- // Not a list of every script that COULD carry the pin. claim-ticket.sh,
30
- // prove-merge.sh, drop-merged-label.sh and verify-sha.sh do not have it; whether
31
- // claim-ticket.sh's generated runner needs one is #600's question, not this
32
- // file's. Adding a script here is a decision, which is why the list is written
33
- // out rather than globbed.
34
-
35
- import { test } from "node:test";
36
- import assert from "node:assert/strict";
37
- import { readFileSync } from "node:fs";
38
- import { fileURLToPath } from "node:url";
39
-
40
- const PINNED = [
41
- "derive-testcmd.sh",
42
- "inflight.sh",
43
- "no-undo-audit.sh",
44
- "reap.sh",
45
- "release-ticket.sh",
46
- "worktree-audit.sh",
47
- ];
48
-
49
- const read = (f) => readFileSync(fileURLToPath(new URL(`./${f}`, import.meta.url)), "utf8");
50
-
51
- // The prologue: everything a script may do before pinning the locale. A blank
52
- // line, a comment, the shebang, and `set -eu` — none of them runs a
53
- // byte-sensitive tool, so none of them can be caught out by the ambient locale.
54
- const PROLOGUE = /^(#.*|set -[eux]+|\s*)$/;
55
-
56
- for (const f of PINNED) {
57
- test(`${f} pins the locale, in its prologue`, () => {
58
- const lines = read(f).split("\n");
59
- const at = lines.findIndex((l) => /^export LC_ALL=C\b/.test(l));
60
- assert.notEqual(at, -1,
61
- `${f} lost \`export LC_ALL=C\`. On Linux — the only platform CI runs — every byte-sensitive tool in it goes back to accepting whatever the operator's LANG says, and no behavioural test in this suite can tell.`);
62
-
63
- const early = lines.slice(0, at).findIndex((l) => !PROLOGUE.test(l));
64
- assert.equal(early, -1,
65
- `${f} pins the locale at line ${at + 1}, but line ${early + 1} already does work above it: ${JSON.stringify(lines[early])}. An export below the pipelines it protects is not a pin.`);
66
- });
67
- }
68
-
69
- // #612. Everything above guards the pin. What it does not guard is the
70
- // PRECONDITION that makes a file-global pin safe, which five of the six state
71
- // as prose and nothing checked: "nothing in this script sorts, folds case, or
72
- // uses a `[a-z]` range or a POSIX class". That sentence shipped FALSE.
73
- // `no-undo-audit.sh` held `${back%"${back##*[![:space:]]}"}` — a POSIX class,
74
- // and locale-sensitive (measured: a trailing NBSP is stripped under
75
- // `en_US.UTF-8` and kept under `C`) — in the worktree-linkage check, far out
76
- // of sight of the paragraph denying any class existed and never read beside
77
- // it. PR #599 corrected that one paragraph by hand. Nothing stopped
78
- // the next drift, and a `sort` or a `grep -i` added to any of the six would
79
- // keep every assertion above green.
80
- //
81
- // So scan each pinned script's CODE for the constructs the prose denies and
82
- // require the result to equal a list written out here. A newly added one fails;
83
- // a listed one that DISAPPEARS fails too, so the inventory can only move in
84
- // both directions at once and a script cannot quietly become stricter than its
85
- // own comment claims. That list is also the escape hatch — a legitimate
86
- // `sort -u` over ASCII-only data belongs in it — and adding an entry is the
87
- // moment the script's comment gets fixed, since the entry exists for no other
88
- // reason.
89
- //
90
- // Why not shellcheck (#612's second option): it has no rule for this class and
91
- // no plugin mechanism to add one, so that route is a fork of shellcheck.
92
- // Why not simply delete the claim (#612's third): re-verified on this commit,
93
- // the claim is TRUE in all five, and `no-undo-audit.sh`'s narrower "one,
94
- // unreachable" is true in the sixth. Deleting a true justification to avoid
95
- // having to check it is the trade that produced the shipped-false sentence.
96
- //
97
- // Behaviour, not just prose, is what these patterns track: each is a construct
98
- // whose RESULT `LC_ALL=C` changes — collation order for `sort` and a `[a-z]`
99
- // range, the case map for `-i`/`toupper`, class membership for `[:space:]`.
100
- const SENSITIVE = [
101
- [/\[:[a-z]+:\]/, "POSIX character class"],
102
- [/\[[^\]]*[A-Za-z0-9]-[A-Za-z0-9][^\]]*\]/, "collation range"],
103
- [/\bsort\b/, "sort"],
104
- [/\btr\b[^|;&]*[A-Za-z0-9]-[A-Za-z0-9]/, "tr range"],
105
- [/\bgrep\b(\s+-\S+)*\s+(-[A-Za-z]*i[A-Za-z]*|--ignore-case)\b/, "case-insensitive grep"],
106
- [/\b(toupper|tolower)\s*\(/, "case folding"],
107
- [/\$\{[A-Za-z_]\w*[\^,]/, "shell case conversion"],
108
- ];
109
-
110
- // ponytail: whole-line `#` comments only, the same ceiling as
111
- // strip-comments.mjs. A trailing `cmd # mentions [a-z]` false-alarms into the
112
- // list below; a construct hidden in one is impossible, which is the direction
113
- // that matters here.
114
- export function localeSensitive(source) {
115
- const hits = [];
116
- source.split("\n").forEach((line, i) => {
117
- if (/^\s*#/.test(line)) return;
118
- const found = SENSITIVE.find(([re]) => re.test(line));
119
- if (found) hits.push({ line: i + 1, what: found[1], text: line.trim() });
120
- });
121
- return hits;
122
- }
123
-
124
- // Keyed by script, values are the exact source lines. Absent means the
125
- // comment's "none" is the whole inventory.
126
- //
127
- // The two `*[!0-9]*` entries are what this guard found on its first run: both
128
- // scripts' comments said they used a `[a-z]` range NOWHERE while each held a
129
- // digit range in its issue-number guard — the shipped-false shape again, live
130
- // on `main`, in two more scripts than #612 knew about. Measured inert and the
131
- // comments corrected to say so, rather than deleted: under `C`, `en_US.UTF-8`,
132
- // `de_DE.UTF-8` and `tr_TR.UTF-8` the range matches the ASCII digits and
133
- // nothing else — superscript `²`, Arabic-Indic digits and `½` are excluded in
134
- // all four, so no locale reachable here reads the guard differently.
135
- //
136
- // derive-testcmd.sh's four are the reason its pin exists (ADR 0015's cache
137
- // reader): two shell `case` ranges that pick a Recipe command's leading word
138
- // apart past `NAME=value` prefixes — ASCII-only by intent, which `C` is what
139
- // guarantees — one range inside the inline `node -e` validator, which the
140
- // shell locale cannot reach at all (JS regex classes are code-point ranges)
141
- // and is listed only because this scan is line-based, and one more of the
142
- // same digit-only shape as inflight.sh's and release-ticket.sh's own
143
- // issue-number guards below (#2217's byte-count-from-node check).
144
- const ALLOWED = {
145
- "derive-testcmd.sh": [
146
- 'if (typeof r.derivedAt !== "string" || !/^[0-9a-f]{40}([0-9a-f]{24})?$/.test(r.derivedAt))',
147
- `''|*[!0-9]*) die "the Recipe cache at $cache is unusable: node's byte-count file is missing or corrupt — $derive" ;;`,
148
- "[A-Za-z_]*=*)",
149
- "case ${1%%=*} in *[!A-Za-z0-9_]*) break ;; esac",
150
- ],
151
- "inflight.sh": [
152
- `case "$n" in ''|*[!0-9]*|0?*) die "issue must be a number, got '$n'";; esac`,
153
- ],
154
- "no-undo-audit.sh": ['back=${back%"${back##*[![:space:]]}"}'],
155
- "release-ticket.sh": [
156
- `case "$issue" in ''|*[!0-9]*|0?*) die "issue must be a number, got '$issue'";; esac`,
157
- ],
158
- };
159
-
160
- for (const f of PINNED) {
161
- test(`${f}'s locale precondition holds in code, not only in prose`, () => {
162
- const hits = localeSensitive(read(f));
163
- assert.deepEqual(hits.map((h) => h.text), ALLOWED[f] ?? [],
164
- `${f}'s locale-sensitive inventory no longer matches the one recorded in locale-pin-prose.test.mjs. Found: ${JSON.stringify(hits)}. Either the construct is new — in which case the script's \`export LC_ALL=C\` comment claiming it has none is now false, exactly the way it shipped false in no-undo-audit.sh — or it went away and the entry is stale. Fix the comment and this list together.`);
165
- });
166
- }
167
-
168
- // The mutation the guard exists for: the historical shape, a POSIX class in a
169
- // script whose paragraph denies one. `reap.sh` is long and clean, and the
170
- // mutant is appended at its end — nowhere a reader of the pin comment looks,
171
- // which is the whole reason the real one survived review.
172
- test("the scan catches a construct planted far below the comment denying it", () => {
173
- const source = read("reap.sh");
174
- assert.deepEqual(localeSensitive(source), []);
175
- const lines = source.split("\n");
176
-
177
- for (const [mutant, what] of [
178
- ['back=${back%"${back##*[![:space:]]}"}', "POSIX character class"],
179
- ["names=$(printf '%s\\n' \"$x\" | sort)", "sort"],
180
- ["case $b in [a-z]*) : ;; esac", "collation range"],
181
- ["upper=$(printf '%s' \"$b\" | tr a-z A-Z)", "tr range"],
182
- ['printf %s "$b" | grep -qi fix', "case-insensitive grep"],
183
- ["printf '%s' \"$b\" | awk '{print toupper($0)}'", "case folding"],
184
- ["x=${x^}", "shell case conversion"],
185
- ]) {
186
- const hits = localeSensitive([...lines, mutant].join("\n"));
187
- assert.deepEqual(hits.map((h) => h.what), [what], `${mutant} went unseen`);
188
- }
189
- });