@feigi/fleet-ctl 3.23.35 → 3.23.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/package.json +1 -1
  2. package/scripts/main-checkout.mjs +1 -1
  3. package/scripts/member-write-guard.mjs +1 -1
  4. package/scripts/repo-root.mjs +1 -1
  5. package/skills/run-team/references/reaping.md +1 -1
  6. package/scripts/agent-test-dir-prose.test.mjs +0 -59
  7. package/scripts/agent-test.test.mjs +0 -1640
  8. package/scripts/ambient-git-vars-mjs-prose.test.mjs +0 -397
  9. package/scripts/ambient-git-vars-prose.test.mjs +0 -192
  10. package/scripts/ancestry-check-position-prose.test.mjs +0 -175
  11. package/scripts/apply-ruleset.test.mjs +0 -421
  12. package/scripts/arg-header-probes-prose.test.mjs +0 -394
  13. package/scripts/arg.test.mjs +0 -1354
  14. package/scripts/board-cli.test.mjs +0 -710
  15. package/scripts/board-identity.test.mjs +0 -429
  16. package/scripts/board-liveness-banner.test.mjs +0 -119
  17. package/scripts/board-prev-shape.test.mjs +0 -228
  18. package/scripts/board-tryparse-null.test.mjs +0 -119
  19. package/scripts/board.test.mjs +0 -3121
  20. package/scripts/brief-after-cut-prose.test.mjs +0 -53
  21. package/scripts/candidates-exit3-prose.test.mjs +0 -302
  22. package/scripts/candidates.test.mjs +0 -2312
  23. package/scripts/caveat-unification-prose.test.mjs +0 -98
  24. package/scripts/cell-readout.test.mjs +0 -615
  25. package/scripts/ci-comment-rot-prose.test.mjs +0 -2025
  26. package/scripts/ci-completes-premise-prose.test.mjs +0 -257
  27. package/scripts/ci-state-prose.test.mjs +0 -113
  28. package/scripts/ci-state.test.mjs +0 -1933
  29. package/scripts/ci-vacuous-green.test.mjs +0 -368
  30. package/scripts/citation-sweep-prose.test.mjs +0 -1712
  31. package/scripts/claim-lifecycle.test.mjs +0 -187
  32. package/scripts/claim-ticket.test.mjs +0 -1122
  33. package/scripts/closing-keyword-prose.test.mjs +0 -193
  34. package/scripts/cockpit-launch-idempotent-prose.test.mjs +0 -165
  35. package/scripts/cockpit-tick-nonblocking.test.mjs +0 -210
  36. package/scripts/compute-board.test.mjs +0 -1214
  37. package/scripts/compute-spend.test.mjs +0 -517
  38. package/scripts/consumer-technology-prose.test.mjs +0 -126
  39. package/scripts/cross-repo-citation-prose.test.mjs +0 -155
  40. package/scripts/cwd-isolation-pins.mjs +0 -83
  41. package/scripts/dedupe-guard-prose.test.mjs +0 -243
  42. package/scripts/delete-merged-branch.test.mjs +0 -576
  43. package/scripts/derive-testcmd.test.mjs +0 -595
  44. package/scripts/diff-stats.test.mjs +0 -404
  45. package/scripts/dispatch-block-golden-prose.test.mjs +0 -1130
  46. package/scripts/dispatch-block-pins-prose.test.mjs +0 -615
  47. package/scripts/dispositions-check.test.mjs +0 -936
  48. package/scripts/dispositions-gate-prose.test.mjs +0 -129
  49. package/scripts/drop-merged-label.test.mjs +0 -479
  50. package/scripts/exec-stub.mjs +0 -93
  51. package/scripts/exec-stub.test.mjs +0 -69
  52. package/scripts/expected-jobs-prose.test.mjs +0 -80
  53. package/scripts/fan-out-authorization-prose.test.mjs +0 -80
  54. package/scripts/filing-bar-seat-prose.test.mjs +0 -242
  55. package/scripts/filing-claim-bar-prose.test.mjs +0 -166
  56. package/scripts/finisher-died-prose.test.mjs +0 -31
  57. package/scripts/finisher-dispatch-premise-prose.test.mjs +0 -312
  58. package/scripts/finisher-halt-prose.test.mjs +0 -106
  59. package/scripts/finisher-name-prose.test.mjs +0 -134
  60. package/scripts/finisher-own-tree-prose.test.mjs +0 -299
  61. package/scripts/finisher-pin-race-prose.test.mjs +0 -339
  62. package/scripts/finisher-test-verdict-prose.test.mjs +0 -102
  63. package/scripts/fix-applier-correction-rules-prose.test.mjs +0 -202
  64. package/scripts/fix-applier-result-file-prose.test.mjs +0 -149
  65. package/scripts/fleet-bootstrap.test.mjs +0 -75
  66. package/scripts/fleet-heartbeat.test.mjs +0 -450
  67. package/scripts/fleet-provenance.test.mjs +0 -138
  68. package/scripts/fleet-run.test.mjs +0 -90
  69. package/scripts/fleet-state.test.mjs +0 -460
  70. package/scripts/fleet-tick-prose.test.mjs +0 -300
  71. package/scripts/fleet-tick.test.mjs +0 -2444
  72. package/scripts/force-with-lease-reason-prose.test.mjs +0 -184
  73. package/scripts/frontmatter-check.test.mjs +0 -436
  74. package/scripts/git-env.test.mjs +0 -149
  75. package/scripts/git-status-untracked-mode-sweep.test.mjs +0 -216
  76. package/scripts/gone-walk.test.mjs +0 -213
  77. package/scripts/gp-sep-invariant-prose.test.mjs +0 -188
  78. package/scripts/head-moved-after-label-prose.test.mjs +0 -233
  79. package/scripts/immutable-body-claim-prose.test.mjs +0 -204
  80. package/scripts/implementer-model-tier.test.mjs +0 -235
  81. package/scripts/inflight-citation-prose.test.mjs +0 -144
  82. package/scripts/inflight-exit2-prose.test.mjs +0 -81
  83. package/scripts/inflight-probe-guard-prose.test.mjs +0 -109
  84. package/scripts/inflight-scan-scope-prose.test.mjs +0 -57
  85. package/scripts/inflight.test.mjs +0 -2882
  86. package/scripts/injection-control-prose.test.mjs +0 -404
  87. package/scripts/install-root-audit.test.mjs +0 -464
  88. package/scripts/instrument-check-prose.test.mjs +0 -235
  89. package/scripts/instruments.test.mjs +0 -787
  90. package/scripts/is-cli.test.mjs +0 -99
  91. package/scripts/issue-tracker-prose.test.mjs +0 -71
  92. package/scripts/json.test.mjs +0 -364
  93. package/scripts/ledger-dispatch.test.mjs +0 -927
  94. package/scripts/ledger-grammar.test.mjs +0 -227
  95. package/scripts/ledger-read-require-file.test.mjs +0 -197
  96. package/scripts/ledger-rotate.test.mjs +0 -142
  97. package/scripts/ledger.test.mjs +0 -3436
  98. package/scripts/line-distance-prose.test.mjs +0 -245
  99. package/scripts/liveness-rationale-prose.test.mjs +0 -83
  100. package/scripts/locale-pin-prose.test.mjs +0 -189
  101. package/scripts/main-checkout.test.mjs +0 -332
  102. package/scripts/member-outcome-prose.test.mjs +0 -167
  103. package/scripts/member-outcomes-header.test.mjs +0 -129
  104. package/scripts/member-outcomes-prose.test.mjs +0 -63
  105. package/scripts/member-outcomes.test.mjs +0 -638
  106. package/scripts/member-prompt-prose.test.mjs +0 -165
  107. package/scripts/member-record.test.mjs +0 -541
  108. package/scripts/member-write-guard.test.mjs +0 -214
  109. package/scripts/merge-commit-probe-prose.test.mjs +0 -122
  110. package/scripts/merge-gate.test.mjs +0 -613
  111. package/scripts/muted-git-guard-sweep.test.mjs +0 -493
  112. package/scripts/net-ssh-precedence-prose.test.mjs +0 -91
  113. package/scripts/net-watchdog-prose.test.mjs +0 -79
  114. package/scripts/net.test.mjs +0 -211
  115. package/scripts/no-ci-gate-prose.test.mjs +0 -108
  116. package/scripts/no-undo-audit.test.mjs +0 -3961
  117. package/scripts/no-wave.test.mjs +0 -138
  118. package/scripts/node-floor-sweep.test.mjs +0 -611
  119. package/scripts/pointer-target-prose.test.mjs +0 -186
  120. package/scripts/pr-cost.test.mjs +0 -521
  121. package/scripts/pr-overlap.test.mjs +0 -692
  122. package/scripts/printf-die-sweep.test.mjs +0 -384
  123. package/scripts/prompt-renderer.mjs +0 -40
  124. package/scripts/prompt-renderer.test.mjs +0 -68
  125. package/scripts/prose-pin.mjs +0 -807
  126. package/scripts/prose-pin.test.mjs +0 -1034
  127. package/scripts/prove-merge.test.mjs +0 -995
  128. package/scripts/pull-table-relabel-prose.test.mjs +0 -60
  129. package/scripts/quiet-payload-prose.test.mjs +0 -222
  130. package/scripts/reap-cherry-check-prose.test.mjs +0 -80
  131. package/scripts/reap.test.mjs +0 -4432
  132. package/scripts/reaping-prose.test.mjs +0 -239
  133. package/scripts/reaping-reap-authorizers-prose.test.mjs +0 -112
  134. package/scripts/reaping-release-authorizers-prose.test.mjs +0 -85
  135. package/scripts/recipe-derivation-prose.test.mjs +0 -112
  136. package/scripts/recipe-prove.test.mjs +0 -1042
  137. package/scripts/refuter-scratch-prose.test.mjs +0 -135
  138. package/scripts/release-label-required-prose.test.mjs +0 -71
  139. package/scripts/release-label-split-prose.test.mjs +0 -184
  140. package/scripts/release-ticket-reap-pairing-prose.test.mjs +0 -63
  141. package/scripts/release-ticket.test.mjs +0 -5099
  142. package/scripts/renovate-release-contract.test.mjs +0 -379
  143. package/scripts/repo-root.test.mjs +0 -873
  144. package/scripts/reporter-output-rule-prose.test.mjs +0 -208
  145. package/scripts/review-agent-report-only.test.mjs +0 -49
  146. package/scripts/review-core-booking.test.mjs +0 -35
  147. package/scripts/review-core-cwd-isolation.test.mjs +0 -374
  148. package/scripts/review-core-reads.test.mjs +0 -478
  149. package/scripts/review-core-refuter-scratch.test.mjs +0 -148
  150. package/scripts/review-core-scratch-refusal.test.mjs +0 -64
  151. package/scripts/review-core-shared-test-run.test.mjs +0 -275
  152. package/scripts/review-core-snapshot-path.test.mjs +0 -830
  153. package/scripts/review-core-specialist-scratch.test.mjs +0 -191
  154. package/scripts/review-core-testcmd.test.mjs +0 -335
  155. package/scripts/review-core-unrun.test.mjs +0 -566
  156. package/scripts/review-core-unverified-discriminant.test.mjs +0 -208
  157. package/scripts/review-eval-resolver-path.test.mjs +0 -55
  158. package/scripts/review-host-fixture.mjs +0 -89
  159. package/scripts/review-in-run-retry.test.mjs +0 -211
  160. package/scripts/review-no-vendor-dispatch.test.mjs +0 -45
  161. package/scripts/review-path-default.test.mjs +0 -796
  162. package/scripts/review-runner-spawns.test.mjs +0 -95
  163. package/scripts/review-runner.test.mjs +0 -166
  164. package/scripts/review-tier-audit.test.mjs +0 -140
  165. package/scripts/run-artifact-pr-prose.test.mjs +0 -341
  166. package/scripts/run-merge-bot-prose.test.mjs +0 -1413
  167. package/scripts/run-team-local-hook.test.mjs +0 -442
  168. package/scripts/scratch-partition-invariant-prose.test.mjs +0 -74
  169. package/scripts/scripts-path-citation-sweep.test.mjs +0 -73
  170. package/scripts/section-between-guard-prose.test.mjs +0 -379
  171. package/scripts/select-dimensions.test.mjs +0 -674
  172. package/scripts/shared-refusal.test.mjs +0 -388
  173. package/scripts/shell-traps-prose.test.mjs +0 -504
  174. package/scripts/shortlist.test.mjs +0 -380
  175. package/scripts/slow-transport.mjs +0 -72
  176. package/scripts/snapshot-repo.test.mjs +0 -1006
  177. package/scripts/snapshot-runner-audience-prose.test.mjs +0 -130
  178. package/scripts/spend-view.test.mjs +0 -312
  179. package/scripts/staleness-qualifier-prose.test.mjs +0 -251
  180. package/scripts/staleness-verdict-prose.test.mjs +0 -142
  181. package/scripts/staleness.test.mjs +0 -893
  182. package/scripts/stalled-member-liveness-prose.test.mjs +0 -219
  183. package/scripts/stash-prohibition-prose.test.mjs +0 -313
  184. package/scripts/strip-comments.mjs +0 -44
  185. package/scripts/temp-dir.mjs +0 -47
  186. package/scripts/ticket-router.test.mjs +0 -981
  187. package/scripts/tier-check.test.mjs +0 -828
  188. package/scripts/tier-outcomes-header.test.mjs +0 -518
  189. package/scripts/tier-outcomes.test.mjs +0 -572
  190. package/scripts/tier-roles.test.mjs +0 -535
  191. package/scripts/tracker-block-copy-prose.test.mjs +0 -288
  192. package/scripts/triage-labels-gloss-prose.test.mjs +0 -97
  193. package/scripts/unattended-git-sweep.test.mjs +0 -142
  194. package/scripts/verify-sha-exit2-prose.test.mjs +0 -269
  195. package/scripts/verify-sha.test.mjs +0 -692
  196. package/scripts/watcher-degraded-block.test.mjs +0 -369
  197. package/scripts/watcher-key-prose.test.mjs +0 -106
  198. package/scripts/within-run-pair-prose.test.mjs +0 -212
  199. package/scripts/worktree-audit.test.mjs +0 -1408
  200. package/scripts/worktree-head-prose.test.mjs +0 -276
  201. package/scripts/worktree-listing-sweep.test.mjs +0 -217
  202. package/scripts/worktree-model-prose.test.mjs +0 -216
  203. package/scripts/worktree-porcelain.mjs +0 -35
  204. package/scripts/worktree-porcelain.test.mjs +0 -102
@@ -1,288 +0,0 @@
1
- // #374. `docs/agents/issue-tracker.md` reproduces the implementer issue-read
2
- // block — since #1804 carried by the body of `agents/fleet-implementer-<cell>.agent.md`
3
- // (spec 2026-09-24 § 2 Decision 2), which each harness injects as the member's
4
- // system prompt; before that, by a `>` quote block in `run-team/SKILL.md`'s
5
- // phase 2 — and the copy has fallen behind that block
6
- // twice: #79 found it carrying the command and its caveat but neither rule
7
- // saying which text wins, and #373 restored those two without the judgement
8
- // rule that had arrived beside them upstream in the meantime.
9
- //
10
- // So this pins the copy COMPLETE against the source, rather than pinning any
11
- // sentence present in it. A presence pin on the sentence #374 restores leaves
12
- // the next sentence added upstream to drift exactly as that one did — the
13
- // failure mode is the block GROWING, and only an end-to-end comparison sees
14
- // growth.
15
- //
16
- // DESIGN, and the thing to read before deleting this test when it reddens: it
17
- // compares the two paragraphs whole, so an edit to one side alone IS a failure,
18
- // by construction. That is not a false positive — one wording, two files, and
19
- // the file you did not edit is the copy that just went stale. The fix when it
20
- // reddens is to apply the same edit to the other side, never to loosen the
21
- // comparison. That remedy is now MEASURED green: #1004 found that rewording the
22
- // block's last sentence in both files still reddened the growth assertion,
23
- // because the reword invalidated a hard-coded copy of that sentence kept here
24
- // as a fixture — a red that named growth for an edit that was not growth. Every
25
- // fixture below is now derived from the live block instead, so the prescribed
26
- // remedy reddens nothing.
27
- //
28
- // A rewrap is not an edit either: both slices are whitespace-normalized, and
29
- // "a rewrapped copy still matches" below is what holds that open.
30
- //
31
- // NOR IS AN EMPHASIS MOVE, on the anchors. Narrowing a `**` span within the
32
- // sentence this file anchors the far end of its slice on — `**Re-derive the
33
- // ticket's claims** against ...`, same words, same order, same meaning —
34
- // reddened all FOUR tests here, with a message about a stale end anchor
35
- // (#1004, measured at two refs). Anchors are therefore matched against a view
36
- // with `**` removed. The COMPARED SLICES keep every byte: this file compares
37
- // one file's block against another file's copy of it, so emphasis appearing on
38
- // one side only is real drift and still reddens. That is the one place this
39
- // file deliberately diverges from `dispatch-block-pins-prose.test.mjs`, which
40
- // strips `**` outright — it pins content against a single file, so it has no
41
- // second side to disagree with and nothing to lose by stripping.
42
- //
43
- // #23's `caveat-unification-prose.test.mjs` deliberately left this pair out,
44
- // on the ground that `run-team`'s copy sits inside a verbatim subagent prompt
45
- // written for a different audience. That holds for the SKILL files it does
46
- // compare, which paraphrase; it does not hold here, because the tracker
47
- // section is not a paraphrase of the block but a reproduction of it, differing
48
- // today only in wrap width and the prompt's quote markers. Comparing whole is
49
- // available precisely because the copy is verbatim.
50
- //
51
- // THE CEILING: this proves the copy AGREES with the source. It cannot prove
52
- // either is correct — a wrong sentence written into both agrees with itself
53
- // and passes here, however the fixtures are obtained. No fixture change reaches
54
- // that, and deriving them did not: the content pins in
55
- // `dispatch-block-pins-prose.test.mjs` are what catch an identical gutting of
56
- // both files.
57
- import { test } from "node:test";
58
- import assert from "node:assert/strict";
59
- import { readFileSync } from "node:fs";
60
- import { join } from "node:path";
61
- import { paragraph, unemphasized } from "./prose-pin.mjs";
62
-
63
- const REPO = join(import.meta.dirname, "..");
64
- const read = (...p) => readFileSync(join(REPO, ...p), "utf8");
65
- // The body alone — everything after the frontmatter's closing `---`. Named
66
- // SKILL for the history above: this was run-team/SKILL.md's phase 2 until #1804.
67
- const SKILL = read("agents", "fleet-implementer-slow-high.agent.md").split("---").slice(2).join("---");
68
- const REPO_ROOT = join(import.meta.dirname, "..", "..");
69
- const TRACKER = readFileSync(join(REPO_ROOT, "docs", "agents", "issue-tracker.md"), "utf8");
70
-
71
- // Names the block by its opening clause. Semantic, and the one clause both
72
- // files must share for either to be the block at all.
73
- const OPENER = "Read the issue with `gh issue view <N>";
74
- const SKILL_END = /^Re-derive the ticket's claims against/;
75
- const TRACKER_END = /^#/;
76
-
77
- // Imported from `prose-pin.mjs` — anchor matching only, never the compared
78
- // text. See the header for why the two differ. Written without `**` on both
79
- // sides of the test so an anchor that someone later types WITH the markers
80
- // still matches, and so the anchors above read as the sentences they name
81
- // rather than as markup. `skillBlock`/`trackerBlock` below opt the same
82
- // helper into `quoteBlock`/`paragraph`'s own anchor matching, so an opener
83
- // move like this one does not stop at those two fixtures while `block`
84
- // itself stays green (#1004, measured — see the comment above them).
85
-
86
- // The far end of the slice is anchored on the first thing that is NOT this
87
- // rule, and never on the block's own last sentence. A closing-phrase anchor
88
- // stops the slice at today's last sentence, so a sentence appended after it
89
- // falls outside BOTH slices and the pin passes with the copy already behind.
90
- // The paragraph break is that same mistake one level up, and it shipped: #374's
91
- // review appended a whole new `>` paragraph beside the block in run-team only
92
- // and every test here stayed green while the tracker was genuinely behind.
93
- // Anchoring past the rule instead puts growth of any size — sentence or
94
- // paragraph — INSIDE the slice, where the equality pin sees it.
95
- //
96
- // WHY THIS IS NOT `quoteBlock`, which #1002 added for exactly this shape of
97
- // job. `quoteBlock` bounds a block at its own maximal run of `>` lines, and
98
- // growth arriving as a blank-line-separated `>` paragraph beside the block is a
99
- // SEPARATE run. Measured on this file's own fixtures: a `>`-joined growth
100
- // paragraph lands inside `quoteBlock`'s return, a blank-line-separated one does
101
- // not — and the blank-line shape is the one #374's review actually shipped, and
102
- // the one the anchor above catches. So a one-block bound (`quoteBlock` until
103
- // #1804, `paragraph` since the block became plain prose in the agent body) is
104
- // used below for the FIXTURES, where a bound that is exactly one block is what
105
- // is wanted, and the slice keeps this broader bound, which is strictly wider.
106
- //
107
- // The two anchors differ because the two files hold the block differently: in
108
- // the tracker it owns a `##` section, so the next heading ends it; in the
109
- // agent body (run-team until #1804) it is one blockquote rule among siblings, so the rule that follows it does.
110
- // Both are SEMANTIC, like the opener, and both are guarded below — an anchor
111
- // that goes stale reddens loudly rather than silently widening the slice.
112
- //
113
- // Paragraphs are split, unquoted and whitespace-normalized BEFORE the opener is
114
- // looked for, so neither end of the slice depends on where a line happens to
115
- // break. Matching the opener against a raw line instead costs the accept case
116
- // its point: a reflow landing inside the opener reddens on the anchor itself,
117
- // where no amount of normalizing the slice afterwards can help. (Measured — the
118
- // first draft of this test did exactly that.)
119
- //
120
- // Quote markers are stripped: they are markdown holding the block inside
121
- // run-team's verbatim prompt, not part of the text being copied. Stripped
122
- // before the paragraph split too, so a `>`-only separator line still closes the
123
- // paragraph rather than joining two.
124
- function block(text, what, end) {
125
- const paragraphs = text
126
- .split("\n")
127
- .map((l) => l.replace(/^>\s?/, ""))
128
- .join("\n")
129
- .split(/\n\s*\n/)
130
- // Whitespace-normalized for the reason `prose-pin.mjs`'s `phrase()` is:
131
- // these two files hard-wrap the same prose at different widths TODAY, so
132
- // without this the pin refuses the copy it is supposed to accept.
133
- .map((p) => p.split(/\s+/).join(" ").trim())
134
- .filter((p) => p);
135
- // Exactly one, not the first: a second paragraph opening the same way is a
136
- // second copy, and `find` would compare one of them and leave the other free
137
- // to say anything.
138
- const hits = paragraphs.filter((p) => unemphasized(p).startsWith(unemphasized(OPENER)));
139
- assert.equal(hits.length, 1, `${what}: expected exactly one paragraph opening "${OPENER}", found ${hits.length} — update this test`);
140
- const rest = paragraphs.slice(paragraphs.indexOf(hits[0]) + 1);
141
- // Guarded, or a stale end anchor runs the slice to EOF and swallows the whole
142
- // rest of the file: still red, but red about the wrong thing.
143
- const stop = rest.findIndex((p) => end.test(unemphasized(p)));
144
- assert.notEqual(stop, -1, `${what}: nothing after the block matches ${end} — the end anchor is stale, update this test`);
145
- const slice = [hits[0], ...rest.slice(0, stop)];
146
- // Positive control. Both slices coming back empty is how an equality pin
147
- // passes while asserting nothing, and a stale anchor is how they would get
148
- // there; the check above only proves the paragraph STARTS somewhere.
149
- assert.ok(hits[0].length > OPENER.length, `${what}: the block slice is no longer than its opener — the extractor is broken, not the docs`);
150
- return slice.join("\n");
151
- }
152
-
153
- const source = (text = SKILL) => block(text, "agents/fleet-implementer-slow-high.agent.md", SKILL_END);
154
- const copy = (text = TRACKER) => block(text, "docs/agents/issue-tracker.md", TRACKER_END);
155
-
156
- // Each side's own raw bytes, for the fixtures below to mutate. Both throw,
157
- // naming the block, if it is gone, doubled or re-anchored — which is the
158
- // staleness guard a hard-coded copy of the prose needed and could not have,
159
- // and unlike that copy, this one names the actual cause.
160
- //
161
- // `paragraph` bounds the agent body's side at the block's own blank line, so a
162
- // fixture built from it cannot run past the block's end onto the next block.
163
- // That is not hypothetical tidiness: a sibling rewrap fixture in
164
- // `dispatch-block-pins-prose.test.mjs` ran one line past its block, spliced two
165
- // blocks onto one line, and left its own staleness guard vacuous (#1003).
166
- //
167
- // `emphasisTolerant: true` on both: OPENER carries no `**`, and `block` above
168
- // already tolerates a `**` landing on its words via `unemphasized`. Without
169
- // this, the same emphasis move throws HERE instead — `quoteBlock`/`anchorAt`
170
- // matched the raw byte here, not the unemphasized view, so a fixture-locating
171
- // anchor this file never meant to be emphasis-sensitive went stale on an edit
172
- // `block` itself shrugs off (#1004, measured: `**Read the issue**` reddened
173
- // both fixture-based tests below, not just this one, with a stale-anchor
174
- // message rather than the growth or reflow they are meant to catch).
175
- // The agent body carries the block as plain prose, like the tracker, so its
176
- // bound is the paragraph too — no `>` run to bound it since #1804.
177
- const skillBlock = () => paragraph(SKILL, OPENER, "the implementer body's issue-read block", { emphasisTolerant: true });
178
- // The tracker's copy is plain prose in a `##` section, not a quote run, so its
179
- // bound is the paragraph — `prose-pin.mjs`'s single definition of that bound,
180
- // blank-line-terminated and anchored exactly once.
181
- const trackerBlock = () => paragraph(TRACKER, OPENER, "the tracker's copy of the issue-read block", { emphasisTolerant: true });
182
-
183
- // Gutter off, whitespace collapsed — the shape wrap width cannot change, used
184
- // below to prove a rewrap moved the breaks and nothing else.
185
- const flat = (s) =>
186
- s
187
- .split("\n")
188
- .map((l) => l.replace(/^>\s?/, ""))
189
- .join(" ")
190
- .split(/\s+/)
191
- .join(" ")
192
- .trim();
193
-
194
- // Re-wraps at word boundaries and nowhere else, at a width the file does not
195
- // use, so the accept case is exercised at wrap points the tree does not
196
- // currently contain. Never splits a word, so the words and their order are
197
- // invariant — which is what makes the equality check on `flat` below a real
198
- // guard against a corrupt fixture rather than a restatement of the wrap.
199
- const rewrapOne = (text, width, gutter) => {
200
- const lines = [[]];
201
- let len = 0;
202
- for (const word of flat(text).split(" ")) {
203
- if (len && len + 1 + word.length > width) {
204
- lines.push([]);
205
- len = 0;
206
- }
207
- len += (len ? 1 : 0) + word.length;
208
- lines.at(-1).push(word);
209
- }
210
- return lines.map((l) => `${gutter}${l.join(" ")}`).join("\n");
211
- };
212
-
213
- // Per quote-paragraph, not over the whole flattened run: once the block has
214
- // grown a blank-gutter-line paragraph beside it (the growth test below),
215
- // `skillBlock()` returns TWO `>` paragraphs, and flattening both into one run
216
- // before wrapping — the previous shape of this function — deletes the
217
- // internal separator between them. The rewrapped text comes back as a single
218
- // paragraph, `block()` re-splits the untouched copy on the blank line it
219
- // still has, and the equality check compares a 2-paragraph copy against a
220
- // 1-paragraph rewrap with no cause named (#1004, measured: the only red was a
221
- // bare equality diff on "a rewrapped copy still matches"). Splitting on the
222
- // separator line first — gutter-only, so it matches whether the gutter is
223
- // `> ` or absent — and rejoining with that same line after wrapping each
224
- // piece keeps every paragraph's wrap independent and the separator intact
225
- // either way.
226
- const rewrap = (text, width, gutter) =>
227
- text
228
- .split(/\n[ \t]*(?:>[ \t]*)?\n/)
229
- .map((part) => rewrapOne(part, width, gutter))
230
- .join(`\n${gutter.trimEnd()}\n`);
231
-
232
- test("the tracker's copy of the issue-read block carries the block whole", () => {
233
- // Equality, not containment: every stale copy this section has produced has
234
- // been a strict PREFIX of the block, and `includes()` accepts a prefix.
235
- assert.equal(copy(), source());
236
- });
237
-
238
- test("a copy that stops short of the block's end reddens", () => {
239
- // The refuse direction, built as a prefix because that is the shape the drift
240
- // has actually taken twice. Derived from the live copy rather than quoting a
241
- // sentence, so it still shortens a block that has grown since.
242
- const short = copy().slice(0, copy().lastIndexOf(". ") + 1);
243
- assert.notEqual(short, copy(), "the truncation fixture no longer shortens the copy — update it");
244
- assert.notEqual(short, source());
245
- });
246
-
247
- test("a rewrapped copy still matches", () => {
248
- // The accept direction. Feeding the comparison prose it MUST accept is the
249
- // only thing pinning reflow-safety; a suite of already-matching inputs passes
250
- // with the normalization deleted. Re-wrapping a doc is not drift, and a pin
251
- // that reddened on it would be deleted by the next person who reflowed a
252
- // paragraph.
253
- //
254
- // Both sides, because either file can be reflowed independently and the
255
- // normalization that accepts one is not the one that accepts the other: the
256
- // source side's breaks carry a `>` gutter and the copy side's do not.
257
- //
258
- // Replacer functions, not replacement strings: `$&`, `$'` and `` $` `` are
259
- // interpreted in the latter, and these fixtures are whole blocks of prose
260
- // nobody is auditing for `$`.
261
- const skill = skillBlock();
262
- const narrowSkill = rewrap(skill, 46, "");
263
- assert.equal(flat(narrowSkill), flat(skill), "the source rewrap changed the block's words, not just its breaks — the fixture is corrupt, not the docs");
264
- assert.notEqual(narrowSkill, skill, "the source rewrap no longer changes run-team's wrapping — pick a width the file does not already use");
265
- assert.equal(copy(), source(SKILL.replace(skill, () => narrowSkill)));
266
-
267
- const tracker = trackerBlock();
268
- const narrowTracker = rewrap(tracker, 52, "");
269
- assert.equal(flat(narrowTracker), flat(tracker), "the copy rewrap changed the block's words, not just its breaks — the fixture is corrupt, not the docs");
270
- assert.notEqual(narrowTracker, tracker, "the copy rewrap no longer changes the tracker's wrapping — pick a width the file does not already use");
271
- assert.equal(copy(TRACKER.replace(tracker, () => narrowTracker)), source());
272
- });
273
-
274
- test("upstream growth arriving as a new paragraph beside the block reddens", () => {
275
- // The hole the paragraph break left, and the reason the end anchor moved past
276
- // the rule: growth does not have to land inside the block's last paragraph.
277
- // Test 1 covers the sentence-sized case; this is the same drift one size up,
278
- // and under the paragraph-break slice it passed.
279
- const skill = skillBlock();
280
- const grown = SKILL.replace(skill, () => `${skill}\n\nIf the ticket names a linked PR, read that PR's diff too.`);
281
- // Non-vacuity, and the assertion the hard-coded fixture used to stand in for:
282
- // the appended paragraph has to land INSIDE the source slice, or the
283
- // comparison below never sees the growth it is named for. Checked on the
284
- // slice rather than on the file, because landing in the file is what
285
- // `String.replace` guarantees and landing in the slice is what matters.
286
- assert.match(source(grown), /linked PR/, "the growth fixture landed outside the slice — the end anchor stops short of the block, update this test");
287
- assert.notEqual(source(grown), copy());
288
- });
@@ -1,97 +0,0 @@
1
- // #836. `docs/agents/triage-labels.md`'s Meaning column is a TRANSCRIPT of the
2
- // tracker's own label descriptions — three of the five cells were byte-identical
3
- // to `gh api repos/feigi/claude-config/labels/<name> --jq .description` when this
4
- // was written. A transcript has no owner, so it drifts against whichever side
5
- // moves. ADR 0001 repriced the filing bar to "is the defect confirmed"; the
6
- // `ready-for-agent` cell kept saying "Fully specified", which a remedy-open
7
- // ticket is by construction not.
8
- //
9
- // The fix was to strip the criterion rather than restate it, so what needs
10
- // guarding is a RE-ADDITION, and its vector is named and still live: the
11
- // `ready-for-agent` description on the tracker still carries the old wording,
12
- // and anyone re-syncing this column from it puts the contradiction back.
13
- //
14
- // #836 raises the `ready-for-agent` cell alone. The `ready-for-human` pin below
15
- // is an ADDITION, made under the ticket's own acceptance criterion that "the
16
- // other four rows are checked for the same drift while the file is open". That
17
- // check found the same narrowing in `ready-for-human` and nothing to correct in
18
- // the other three. Its vector is not the re-sync above — the tracker's own
19
- // `ready-for-human` description does not narrow to implementation — so what is
20
- // pinned there is the narrowing itself.
21
- //
22
- // CEILING: each test pins one row slice, on three things — the role-to-label-
23
- // string mapping, that the gloss still turns on whether an AFK agent can take
24
- // the work, and the absence of the restated criterion. The middle one is what
25
- // stops the negative passing on an emptied cell; the label-string companion
26
- // alone does not, because it pins columns the gloss is not in. None of this
27
- // proves the column carries no OTHER restated criterion — no assertion can. The
28
- // bound is the file's own stated job at `:3`, which "maps those roles to the
29
- // actual label strings": a mapping, not a criteria source.
30
- //
31
- // Measured as of this commit, on a copy of the tree with `cp` restore after
32
- // each: seven mutations — the old description re-synced verbatim, the criterion
33
- // re-added with two words wedged into the adjacency, `ready-for-human` narrowed
34
- // back to implementation, that same narrowing with the noun gone, the
35
- // label-string mapping broken, and each gloss cell emptied out entirely — each
36
- // reddened its own pin and no other. Controls: a benign reword of either pinned
37
- // cell, an unpinned row's cell rewritten, and the table re-padded to a wider
38
- // column all stayed green.
39
- import { test } from "node:test";
40
- import assert from "node:assert/strict";
41
- import { readFileSync } from "node:fs";
42
- import { join } from "node:path";
43
- import { between, phrase } from "./prose-pin.mjs";
44
-
45
- const REPO = join(import.meta.dirname, "..", "..");
46
- const TABLE = readFileSync(join(REPO, "docs", "agents", "triage-labels.md"), "utf8");
47
-
48
- // One table row per slice. The claim is a single cell, so anything wider lets
49
- // a neighbouring row satisfy the assertion with the cell rewritten.
50
- const row = (label) => between(TABLE, `| \`${label}\``, "\n|", `the ${label} row`);
51
-
52
- test("the ready-for-agent row maps the role and states no filing criterion", () => {
53
- const r = row("ready-for-agent");
54
- assert.match(
55
- r,
56
- phrase("| `ready-for-agent` | `ready-for-agent` |"),
57
- "the ready-for-agent row no longer maps the role to its label string — that mapping is what scripts read",
58
- );
59
- // The gloss itself, which the mapping companion above does not cover: it pins
60
- // columns 1 and 2, so emptying column 3 leaves it green and the negative
61
- // below then passes on nothing at all.
62
- assert.match(
63
- r,
64
- /AFK agent/,
65
- "the ready-for-agent gloss no longer says who the label routes work to, so the negative below is passing on an empty cell",
66
- );
67
- // The stem, not the phrase. A negative pinned to the adjacency is trivially
68
- // evaded — measured: `/[Ff]ully\s+\w*\s*specified/` stayed green against
69
- // "Ready for a fully and precisely specified AFK agent", because a one-word
70
- // gap does not span two. A one-row gloss cell has no innocent use of the stem.
71
- assert.doesNotMatch(
72
- r,
73
- /specifi/i,
74
- "the ready-for-agent gloss is back to promising a fully specified ticket, which the filing bar in `commands/review-and-fix.md` step 5 contradicts — a confirmed defect files here with its remedy still open",
75
- );
76
- });
77
-
78
- test("the ready-for-human row does not narrow the role to implementation", () => {
79
- const r = row("ready-for-human");
80
- assert.match(
81
- r,
82
- phrase("| `ready-for-human` | `ready-for-human` |"),
83
- "the ready-for-human row no longer maps the role to its label string — that mapping is what scripts read",
84
- );
85
- assert.match(
86
- r,
87
- /AFK agent/,
88
- "the ready-for-human gloss no longer says who the label routes work to, so the negative below is passing on an empty cell",
89
- );
90
- // Stem again: "Requires a human to implement" carries the same narrowing
91
- // with the noun gone.
92
- assert.doesNotMatch(
93
- r,
94
- /implement/i,
95
- "the ready-for-human gloss is back to requiring human implementation — `skills/run-team/SKILL.md` also routes work needing a human BEFORE implementation here",
96
- );
97
- });
@@ -1,142 +0,0 @@
1
- // Regression gate for #347, and the ticket's own recorded enumeration.
2
- //
3
- // #92 named the hazard for one call: an unattended `git` network call with no
4
- // prompt suppression and no bound can sit on a credential or host-key prompt
5
- // nobody will answer, or on a transport that connects and then goes quiet, and
6
- // either way it holds a fleet slot until something outside kills it. #346 built
7
- // the mechanism that closes it. #347 is the observation that inflight.sh's
8
- // probe 2 was the only call routed through it.
9
- //
10
- // The enumeration this file records, so the next reader does not re-derive it —
11
- // every raw `git` network call in the fleet's shell scripts at the time, from
12
- // the Brief's own command, `git ls-files '*.sh' | xargs grep -nE 'git
13
- // (ls-remote|push|fetch|clone)|gh (issue|pr|api)'`:
14
- //
15
- // inflight.sh ls-remote --heads origin already bounded (#346)
16
- // release-ticket.sh ls-remote --heads origin refs/heads/… routed here
17
- // prove-merge.sh fetch --quiet origin routed here
18
- // reap.sh fetch --prune --quiet origin routed here
19
- // verify-sha.sh fetch --quiet origin <branch> routed here
20
- //
21
- // DELIBERATELY LEFT, both with their reason:
22
- //
23
- // - Every `gh` call (claim-ticket.sh, drop-merged-label.sh, inflight.sh,
24
- // release-ticket.sh, .github/scripts/apply-ruleset.sh). `gh` bounds
25
- // itself: measured during the PR #332 review, `gh issue view` against a
26
- // silent listener failed on its own at 10.0s with `net/http: TLS handshake
27
- // timeout`. Wrapping it would buy a second bound over the first.
28
- // - `.github/workflows/ci.yml`'s `git fetch`. Not a `*.sh` and not a fleet
29
- // member: it runs under `actions/checkout`'s credentials on a runner that
30
- // is torn down, so there is no fleet slot to hold and no prompt to answer.
31
- //
32
- // The sweep below is the durable half. The list above rots; a scan does not,
33
- // and it is what catches the sibling nobody thought of — the failure mode #347
34
- // exists to report, where a fix landed on the one call a ticket named and every
35
- // call beside it stayed broken.
36
- //
37
- // Zero deps: `node --test plugin/scripts/unattended-git-sweep.test.mjs`.
38
-
39
- import { test } from "node:test";
40
- import assert from "node:assert/strict";
41
- import { readFileSync } from "node:fs";
42
- import { join } from "node:path";
43
- import { fileURLToPath } from "node:url";
44
- import { repoRoot, skipWithoutRepo, trackedShellScripts } from "./repo-root.mjs";
45
-
46
- // This file needs an ambient git WORKING TREE, not just the sources: it asks git
47
- // what ships rather than walking the directory, so both calls below want a
48
- // `.git` at or above them. A checkout and a worktree both have one; a `git
49
- // archive` extraction does not, and this file's tests DECLINE there with a
50
- // reason instead of running — the tree they would police is not reachable from
51
- // an extraction. That is the extraction missing a repo, not a defect in the tree
52
- // under it, and a review or CI step that unpacks an archive should run this one
53
- // against a checkout. Until #1149 the same condition threw at module load and
54
- // node could only report it as one synthetic failing test at line 1.
55
- const ROOT = repoRoot(fileURLToPath(new URL(".", import.meta.url)));
56
- const SKIP_WITHOUT_REPO = skipWithoutRepo(ROOT, "this sweep over what ships");
57
-
58
- // Tracked `*.sh` only, and from git rather than a directory walk: an untracked
59
- // scratch script is not what ships, and a fleet script that moves out of this
60
- // directory must not fall out of the sweep with it.
61
- //
62
- // Empty ONLY because the root lookup could not answer, in which case both tests
63
- // are skipped. A root that answers and lists nothing is a different condition —
64
- // the wrong repository, or a broken glob — and it must reach the non-vacuity
65
- // test below and fail there.
66
- const SHELL_SCRIPTS = ROOT === null ? [] : trackedShellScripts(ROOT);
67
-
68
- // Whole-line `#` comments only, blanked rather than deleted so line numbers
69
- // survive for the diagnostic. A trailing `code # note` keeps its comment, and
70
- // a `#` inside a string is left alone — blanking either would delete real code,
71
- // and neither can hide a command from this scan, which is what it is for.
72
- const stripHashComments = (source) =>
73
- source.split("\n").map((l) => (/^\s*#/.test(l) ? "" : l)).join("\n");
74
-
75
- // The verbs that reach the network. `pull` and `clone` appear in no fleet
76
- // script today and are swept anyway: the point of a sweep is the call that has
77
- // not been written yet.
78
- const RAW_NETWORK_GIT = /\bgit\s+(?:-[^\s]+\s+|-c\s+\S+\s+|-C\s+\S+\s+)*(ls-remote|fetch|push|clone|pull)\b/g;
79
-
80
- // A `git fetch` inside a QUOTED STRING is not a call, and both of the fleet's
81
- // conventions put one there: the trace line every script prints before it acts
82
- // (`echo "\$ git fetch …" >&2`), and the refusal every script prints when the
83
- // call fails (`die "git fetch did not finish within …"`). Measured — without
84
- // this, the sweep reports seven offenders across four scripts on a tree where
85
- // every one of those calls is routed, which is worse than a useless assertion:
86
- // the obvious way to quiet it is to delete it.
87
- //
88
- // Odd quote count before the match means it opened a string and did not close
89
- // it. Backslash escapes are dropped first so `\"` inside one does not read as a
90
- // closing quote. Known ceiling: a heredoc body, and a string that opens on one
91
- // line and closes on another, are judged per line — no fleet script writes a
92
- // git call in either, and the failure direction is a false OFFENDER, which is
93
- // read and dismissed, never a call let through.
94
- const insideString = (prefix) => {
95
- const bare = prefix.replace(/\\./g, "");
96
- return (bare.split('"').length - 1) % 2 === 1 || (bare.split("'").length - 1) % 2 === 1;
97
- };
98
-
99
- // A guard on the guard, and the half the skip above leans on: a bad glob, a
100
- // moved directory or a `git ls-files` that answers nothing turns every
101
- // assertion below into a vacuous pass over an empty list — green, and blind.
102
- // The skip is allowed to make that list empty for ONE reason (no working tree);
103
- // every other reason has to land here as a failure. Named scripts, because
104
- // those are the ones this file exists to police.
105
- test("the sweep sees the scripts it is supposed to police", { skip: SKIP_WITHOUT_REPO }, () => {
106
- for (const s of ["inflight.sh", "release-ticket.sh", "prove-merge.sh", "reap.sh", "verify-sha.sh"]) {
107
- assert.ok(
108
- SHELL_SCRIPTS.some((f) => f.endsWith(`/${s}`)),
109
- `${s} is not in the tracked-script list — the glob or the root above is broken, not the script`,
110
- );
111
- }
112
- });
113
-
114
- test("no fleet shell script makes a raw git network call — they all route through net.sh (#347)", { skip: SKIP_WITHOUT_REPO }, () => {
115
- const offenders = [];
116
- for (const f of SHELL_SCRIPTS) {
117
- const code = stripHashComments(readFileSync(join(ROOT, f), "utf8"));
118
- for (const line of code.split("\n")) {
119
- for (const m of line.matchAll(RAW_NETWORK_GIT)) {
120
- if (insideString(line.slice(0, m.index))) continue;
121
- offenders.push(`${f}: ${m[0].trim()} in ${line.trim()}`);
122
- }
123
- }
124
- }
125
-
126
- assert.deepEqual(offenders, [],
127
- "an unattended `git` network call is running raw. It can prompt for a credential or a host key with nobody there to answer, or stall on a transport that connects and goes quiet, and either holds a fleet slot indefinitely (#92). Route it through net.sh's `net_git` — which takes the subcommand as arguments, so its own dispatch carries no verb and this sweep does not see it — rather than copying transport flags to the call site, which does not bound the connect phase in any case since git exposes no knob for it (#346, #347).");
128
- });
129
-
130
- // The other direction. The sweep above is an absence, and an absence is also
131
- // what a tree with the calls DELETED would show — so on its own it cannot tell
132
- // "routed" from "gone". These are the five call sites the enumeration names;
133
- // each must still source the lib and still reach it.
134
- test("every script that made one of those calls still sources net.sh and reaches net_git (#347)", { skip: SKIP_WITHOUT_REPO }, () => {
135
- for (const f of ["inflight.sh", "release-ticket.sh", "prove-merge.sh", "reap.sh", "verify-sha.sh"]) {
136
- const code = stripHashComments(readFileSync(join(ROOT, "plugin", "scripts", f), "utf8"));
137
- assert.match(code, /\.\s+"\$net_lib"/,
138
- `${f} no longer sources net.sh, so whatever network call it makes is unbounded again`);
139
- assert.match(code, /\bnet_git\s+"/,
140
- `${f} sources net.sh but calls nothing in it — the sweep above would stay green on a call that was deleted rather than routed`);
141
- }
142
- });