@feigi/fleet-ctl 0.0.0

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 (245) hide show
  1. package/.claude-plugin/plugin.json +9 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +18 -0
  4. package/agents/fleet-finisher.agent.md +7 -0
  5. package/agents/fleet-implementer-alt.agent.md +210 -0
  6. package/agents/fleet-implementer.agent.md +210 -0
  7. package/agents/fleet-merge-bot.agent.md +7 -0
  8. package/agents/fleet-review-comments.agent.md +40 -0
  9. package/agents/fleet-review-correctness.agent.md +43 -0
  10. package/agents/fleet-review-runner.agent.md +73 -0
  11. package/agents/fleet-review-silent-failure.agent.md +49 -0
  12. package/agents/fleet-review-simplify.agent.md +46 -0
  13. package/agents/fleet-review-snapshot.agent.md +24 -0
  14. package/agents/fleet-review-tests.agent.md +46 -0
  15. package/agents/fleet-review-types.agent.md +41 -0
  16. package/agents/fleet-review-verifier.agent.md +29 -0
  17. package/commands/review-and-fix.md +98 -0
  18. package/commands/run-merge-bot.md +357 -0
  19. package/commands/run-team-help.md +17 -0
  20. package/package.json +23 -0
  21. package/scripts/agent-test-dir-prose.test.mjs +59 -0
  22. package/scripts/agent-test.test.mjs +1636 -0
  23. package/scripts/ambient-git-vars-mjs-prose.test.mjs +354 -0
  24. package/scripts/ambient-git-vars-prose.test.mjs +192 -0
  25. package/scripts/ancestry-check-position-prose.test.mjs +175 -0
  26. package/scripts/apply-ruleset.test.mjs +420 -0
  27. package/scripts/arg-header-probes-prose.test.mjs +393 -0
  28. package/scripts/arg.mjs +600 -0
  29. package/scripts/arg.test.mjs +1354 -0
  30. package/scripts/board-cli.test.mjs +694 -0
  31. package/scripts/board-identity.test.mjs +429 -0
  32. package/scripts/board-liveness-banner.test.mjs +119 -0
  33. package/scripts/board-prev-shape.test.mjs +229 -0
  34. package/scripts/board-tryparse-null.test.mjs +119 -0
  35. package/scripts/board.html +471 -0
  36. package/scripts/board.mjs +2037 -0
  37. package/scripts/board.test.mjs +3086 -0
  38. package/scripts/brief-after-cut-prose.test.mjs +53 -0
  39. package/scripts/candidates-exit3-prose.test.mjs +302 -0
  40. package/scripts/candidates.mjs +674 -0
  41. package/scripts/candidates.test.mjs +2101 -0
  42. package/scripts/caveat-unification-prose.test.mjs +98 -0
  43. package/scripts/ci-comment-rot-prose.test.mjs +2025 -0
  44. package/scripts/ci-completes-premise-prose.test.mjs +257 -0
  45. package/scripts/ci-state-prose.test.mjs +113 -0
  46. package/scripts/ci-state.mjs +761 -0
  47. package/scripts/ci-state.test.mjs +1640 -0
  48. package/scripts/ci-vacuous-green.test.mjs +368 -0
  49. package/scripts/citation-sweep-prose.test.mjs +1572 -0
  50. package/scripts/claim-lifecycle.test.mjs +185 -0
  51. package/scripts/claim-ticket.sh +417 -0
  52. package/scripts/claim-ticket.test.mjs +1121 -0
  53. package/scripts/closing-keyword-prose.test.mjs +193 -0
  54. package/scripts/cockpit-launch-idempotent-prose.test.mjs +165 -0
  55. package/scripts/cockpit-tick-nonblocking.test.mjs +210 -0
  56. package/scripts/compute-board.mjs +579 -0
  57. package/scripts/compute-board.test.mjs +1060 -0
  58. package/scripts/compute-spend.mjs +329 -0
  59. package/scripts/compute-spend.test.mjs +451 -0
  60. package/scripts/cross-repo-citation-prose.test.mjs +156 -0
  61. package/scripts/cwd-isolation-pins.mjs +83 -0
  62. package/scripts/dedupe-guard-prose.test.mjs +243 -0
  63. package/scripts/derive-testcmd.sh +239 -0
  64. package/scripts/derive-testcmd.test.mjs +380 -0
  65. package/scripts/diff-stats.mjs +231 -0
  66. package/scripts/diff-stats.test.mjs +408 -0
  67. package/scripts/dispatch-block-golden-prose.test.mjs +1024 -0
  68. package/scripts/dispatch-block-pins-prose.test.mjs +615 -0
  69. package/scripts/drop-merged-label.sh +173 -0
  70. package/scripts/drop-merged-label.test.mjs +480 -0
  71. package/scripts/expected-jobs-prose.test.mjs +80 -0
  72. package/scripts/filing-bar-seat-prose.test.mjs +242 -0
  73. package/scripts/filing-claim-bar-prose.test.mjs +166 -0
  74. package/scripts/finisher-dispatch-premise-prose.test.mjs +312 -0
  75. package/scripts/finisher-halt-prose.test.mjs +106 -0
  76. package/scripts/finisher-name-prose.test.mjs +134 -0
  77. package/scripts/finisher-own-tree-prose.test.mjs +285 -0
  78. package/scripts/finisher-pin-race-prose.test.mjs +339 -0
  79. package/scripts/fix-applier-correction-rules-prose.test.mjs +201 -0
  80. package/scripts/fix-applier-result-file-prose.test.mjs +100 -0
  81. package/scripts/fleet-bootstrap +155 -0
  82. package/scripts/fleet-heartbeat.mjs +272 -0
  83. package/scripts/fleet-heartbeat.test.mjs +450 -0
  84. package/scripts/fleet-provenance +207 -0
  85. package/scripts/fleet-provenance.test.mjs +64 -0
  86. package/scripts/fleet-run +148 -0
  87. package/scripts/fleet-run.test.mjs +90 -0
  88. package/scripts/fleet-state.mjs +400 -0
  89. package/scripts/fleet-state.test.mjs +373 -0
  90. package/scripts/fleet-tick-prose.test.mjs +299 -0
  91. package/scripts/fleet-tick.mjs +832 -0
  92. package/scripts/fleet-tick.test.mjs +1332 -0
  93. package/scripts/force-with-lease-reason-prose.test.mjs +184 -0
  94. package/scripts/frontmatter-allowlist.json +64 -0
  95. package/scripts/frontmatter-check.mjs +256 -0
  96. package/scripts/frontmatter-check.test.mjs +436 -0
  97. package/scripts/git-env.mjs +124 -0
  98. package/scripts/git-env.test.mjs +149 -0
  99. package/scripts/git-status-untracked-mode-sweep.test.mjs +216 -0
  100. package/scripts/gone-walk.test.mjs +213 -0
  101. package/scripts/gp-sep-invariant-prose.test.mjs +188 -0
  102. package/scripts/head-moved-after-label-prose.test.mjs +233 -0
  103. package/scripts/immutable-body-claim-prose.test.mjs +413 -0
  104. package/scripts/implementer-model-tier.test.mjs +643 -0
  105. package/scripts/inflight-citation-prose.test.mjs +144 -0
  106. package/scripts/inflight-exit2-prose.test.mjs +81 -0
  107. package/scripts/inflight-probe-guard-prose.test.mjs +109 -0
  108. package/scripts/inflight-scan-scope-prose.test.mjs +57 -0
  109. package/scripts/inflight.sh +1106 -0
  110. package/scripts/inflight.test.mjs +2984 -0
  111. package/scripts/injection-control-prose.test.mjs +404 -0
  112. package/scripts/install-root-audit.test.mjs +464 -0
  113. package/scripts/instrument-check-prose.test.mjs +235 -0
  114. package/scripts/instruments.sh +394 -0
  115. package/scripts/instruments.test.mjs +787 -0
  116. package/scripts/issue-tracker-prose.test.mjs +71 -0
  117. package/scripts/json.sh +248 -0
  118. package/scripts/json.test.mjs +364 -0
  119. package/scripts/ledger-dispatch.test.mjs +516 -0
  120. package/scripts/ledger-grammar.mjs +85 -0
  121. package/scripts/ledger-grammar.test.mjs +142 -0
  122. package/scripts/ledger-read-require-file.test.mjs +197 -0
  123. package/scripts/ledger.mjs +1753 -0
  124. package/scripts/ledger.test.mjs +3554 -0
  125. package/scripts/line-distance-prose.test.mjs +245 -0
  126. package/scripts/liveness-rationale-prose.test.mjs +83 -0
  127. package/scripts/locale-pin-prose.test.mjs +189 -0
  128. package/scripts/member-outcome-prose.test.mjs +167 -0
  129. package/scripts/member-outcomes-header.test.mjs +148 -0
  130. package/scripts/member-outcomes-prose.test.mjs +63 -0
  131. package/scripts/member-outcomes.mjs +231 -0
  132. package/scripts/member-outcomes.test.mjs +507 -0
  133. package/scripts/member-prompt-prose.test.mjs +161 -0
  134. package/scripts/member-record.mjs +605 -0
  135. package/scripts/member-record.test.mjs +516 -0
  136. package/scripts/member-write-guard.mjs +279 -0
  137. package/scripts/member-write-guard.test.mjs +211 -0
  138. package/scripts/merge-commit-probe-prose.test.mjs +122 -0
  139. package/scripts/merge-gate.mjs +262 -0
  140. package/scripts/merge-gate.test.mjs +613 -0
  141. package/scripts/muted-git-guard-sweep.test.mjs +493 -0
  142. package/scripts/net-ssh-precedence-prose.test.mjs +91 -0
  143. package/scripts/net-watchdog-prose.test.mjs +79 -0
  144. package/scripts/net.sh +409 -0
  145. package/scripts/net.test.mjs +211 -0
  146. package/scripts/no-ci-gate-prose.test.mjs +108 -0
  147. package/scripts/no-undo-audit.sh +1134 -0
  148. package/scripts/no-undo-audit.test.mjs +3965 -0
  149. package/scripts/no-wave.test.mjs +138 -0
  150. package/scripts/node-floor-sweep.test.mjs +611 -0
  151. package/scripts/pointer-target-prose.test.mjs +186 -0
  152. package/scripts/pr-overlap.mjs +417 -0
  153. package/scripts/pr-overlap.test.mjs +695 -0
  154. package/scripts/printf-die-sweep.test.mjs +384 -0
  155. package/scripts/prompt-renderer.mjs +39 -0
  156. package/scripts/prompt-renderer.test.mjs +68 -0
  157. package/scripts/prose-pin.mjs +808 -0
  158. package/scripts/prose-pin.test.mjs +1034 -0
  159. package/scripts/prove-merge.sh +228 -0
  160. package/scripts/prove-merge.test.mjs +995 -0
  161. package/scripts/pull-table-relabel-prose.test.mjs +60 -0
  162. package/scripts/quiet-payload-prose.test.mjs +222 -0
  163. package/scripts/reap.sh +1768 -0
  164. package/scripts/reap.test.mjs +4395 -0
  165. package/scripts/reaping-prose.test.mjs +159 -0
  166. package/scripts/refuter-scratch-prose.test.mjs +135 -0
  167. package/scripts/release-label-required-prose.test.mjs +71 -0
  168. package/scripts/release-label-split-prose.test.mjs +169 -0
  169. package/scripts/release-ticket.sh +1716 -0
  170. package/scripts/release-ticket.test.mjs +5106 -0
  171. package/scripts/renovate-release-contract.test.mjs +379 -0
  172. package/scripts/repo-root.mjs +544 -0
  173. package/scripts/repo-root.test.mjs +873 -0
  174. package/scripts/reporter-output-rule-prose.test.mjs +208 -0
  175. package/scripts/review-agent-report-only.test.mjs +49 -0
  176. package/scripts/review-core-cwd-isolation.test.mjs +374 -0
  177. package/scripts/review-core-reads.test.mjs +478 -0
  178. package/scripts/review-core-refuter-scratch.test.mjs +148 -0
  179. package/scripts/review-core-snapshot-path.test.mjs +777 -0
  180. package/scripts/review-core-specialist-scratch.test.mjs +189 -0
  181. package/scripts/review-core-testcmd.test.mjs +288 -0
  182. package/scripts/review-core-unrun.test.mjs +530 -0
  183. package/scripts/review-core-unverified-discriminant.test.mjs +208 -0
  184. package/scripts/review-core.mjs +1028 -0
  185. package/scripts/review-eval-resolver-path.test.mjs +55 -0
  186. package/scripts/review-eval.mjs +197 -0
  187. package/scripts/review-host-fixture.mjs +73 -0
  188. package/scripts/review-in-run-retry.test.mjs +187 -0
  189. package/scripts/review-no-vendor-dispatch.test.mjs +45 -0
  190. package/scripts/review-path-default.test.mjs +796 -0
  191. package/scripts/review-runner-spawns.test.mjs +93 -0
  192. package/scripts/review-runner.test.mjs +155 -0
  193. package/scripts/review-tier-audit.test.mjs +140 -0
  194. package/scripts/run-artifact-pr-prose.test.mjs +341 -0
  195. package/scripts/run-merge-bot-prose.test.mjs +1391 -0
  196. package/scripts/scratch-partition-invariant-prose.test.mjs +74 -0
  197. package/scripts/scripts-path-citation-sweep.test.mjs +73 -0
  198. package/scripts/section-between-guard-prose.test.mjs +378 -0
  199. package/scripts/select-dimensions.test.mjs +674 -0
  200. package/scripts/shared-refusal.test.mjs +388 -0
  201. package/scripts/shell-traps-prose.test.mjs +507 -0
  202. package/scripts/shortlist.mjs +355 -0
  203. package/scripts/shortlist.test.mjs +366 -0
  204. package/scripts/slow-transport.mjs +72 -0
  205. package/scripts/snapshot-repo.test.mjs +772 -0
  206. package/scripts/snapshot-runner-audience-prose.test.mjs +129 -0
  207. package/scripts/spend-view.test.mjs +312 -0
  208. package/scripts/staleness-qualifier-prose.test.mjs +251 -0
  209. package/scripts/staleness-verdict-prose.test.mjs +142 -0
  210. package/scripts/staleness.mjs +414 -0
  211. package/scripts/staleness.test.mjs +893 -0
  212. package/scripts/stalled-member-liveness-prose.test.mjs +219 -0
  213. package/scripts/stash-prohibition-prose.test.mjs +313 -0
  214. package/scripts/strip-comments.mjs +44 -0
  215. package/scripts/tier-check.mjs +468 -0
  216. package/scripts/tier-check.test.mjs +726 -0
  217. package/scripts/tier-guard-gate-prose.test.mjs +216 -0
  218. package/scripts/tier-outcomes-header.test.mjs +586 -0
  219. package/scripts/tier-outcomes.mjs +441 -0
  220. package/scripts/tier-outcomes.test.mjs +342 -0
  221. package/scripts/tier-roles.mjs +250 -0
  222. package/scripts/tier-roles.test.mjs +316 -0
  223. package/scripts/tracker-block-copy-prose.test.mjs +288 -0
  224. package/scripts/triage-labels-gloss-prose.test.mjs +97 -0
  225. package/scripts/unattended-git-sweep.test.mjs +142 -0
  226. package/scripts/verify-sha-exit2-prose.test.mjs +269 -0
  227. package/scripts/verify-sha.sh +117 -0
  228. package/scripts/verify-sha.test.mjs +693 -0
  229. package/scripts/watcher-degraded-block.test.mjs +372 -0
  230. package/scripts/watcher-key-prose.test.mjs +106 -0
  231. package/scripts/within-run-pair-prose.test.mjs +208 -0
  232. package/scripts/worktree-audit.sh +482 -0
  233. package/scripts/worktree-audit.test.mjs +1407 -0
  234. package/scripts/worktree-head-prose.test.mjs +276 -0
  235. package/scripts/worktree-listing-sweep.test.mjs +217 -0
  236. package/scripts/worktree-model-prose.test.mjs +216 -0
  237. package/scripts/worktree.sh +470 -0
  238. package/skills/next-ticket/SKILL.md +138 -0
  239. package/skills/run-team/SKILL.md +3603 -0
  240. package/skills/run-team/references/ci-and-staleness.md +75 -0
  241. package/skills/run-team/references/correction-tickets.md +37 -0
  242. package/skills/run-team/references/isolation.md +23 -0
  243. package/skills/run-team/references/member-lifecycle.md +73 -0
  244. package/skills/run-team/references/reaping.md +73 -0
  245. package/skills/sizing-a-ticket/SKILL.md +39 -0
@@ -0,0 +1,159 @@
1
+ // #87. Three documents said `release-ticket.sh` recomputes all four
2
+ // preconditions at the moment of the delete. Two things are wrong with that,
3
+ // and only the second is obvious once stated.
4
+ //
5
+ // The dirty check is the CONDITIONAL one: it opens inside
6
+ // `[ -n "$wt" ] && [ -d "$wt" ]`, so a claim whose worktree directory is
7
+ // established absent has three preconditions recomputed, not four. (The
8
+ // established-absent path is the only one that reaches the delete with it
9
+ // skipped — a directory git cannot stat dies on the unknown-existence guard
10
+ // above it, and a non-directory blocks.)
11
+ //
12
+ // And `git worktree remove` without `--force` is no backstop for the one it
13
+ // skips. It gates its own clean check on the same `stat` the script's `gone`
14
+ // guard does, so it is not an independent second opinion — it reaches the same
15
+ // verdict by the same means. Measured here, git 2.50.1 (Apple Git-155):
16
+ //
17
+ // path stattable + untracked file -> rc 128, "contains modified or untracked
18
+ // files, use --force to delete it"
19
+ // directory rm -rf'd -> rc 0, entry deregistered
20
+ // live worktree, chmod 000 parent -> rc 0, entry deregistered, the untracked
21
+ // file still sitting on disk
22
+ //
23
+ // That third row is the whole point: git deregistered a worktree that was
24
+ // holding uncommitted work, at rc 0, because it could not stat it either. It is
25
+ // why the fail-open fixed in `1e54bac` survived being reasoned about — guard and
26
+ // backstop fail on the same inputs — and why the guard establishes absence
27
+ // instead of inferring it from a failed `-e`.
28
+ //
29
+ // Pinned in all four places the claim is made, because a correction applied to
30
+ // one document is the one a reader does not reach: SKILL.md asserts, reaping.md
31
+ // carries the evidence, and release-ticket.sh's own comment sits at the check.
32
+ // The script's header (release-ticket.sh) already carried the corrected
33
+ // wording when this was filed; the comment at the dirty check did not.
34
+ //
35
+ // NOT pinned, deliberately: reap.sh's sibling prose. Its "recomputed inside this
36
+ // invocation" makes no delete-time claim, and reaping.md's reap-side
37
+ // "double-covers dirty check" is about the BREADTH of what git refuses on
38
+ // (modified and untracked) rather than independence from the stat — reap routes
39
+ // cannot-stat to KEEP before its delete is reachable, so its delete is never
40
+ // sole arbiter of a path it could not stat.
41
+ //
42
+ // THE CEILING, same as refuter-scratch-prose.test.mjs: these are PRESENCE pins
43
+ // over a bounded slice, each a single regex, so text spliced INSIDE a pinned
44
+ // clause reddens them. What they cannot catch is a whole new sentence appended
45
+ // AFTER a clause carving out an exception. Reflow stays green by design — the
46
+ // words are pinned, not their layout.
47
+ import { test } from "node:test";
48
+ import assert from "node:assert/strict";
49
+ import { readFileSync } from "node:fs";
50
+ import { join } from "node:path";
51
+ import { between, phrase, stripHashGutter } from "./prose-pin.mjs";
52
+
53
+ const REPO = join(import.meta.dirname, "..");
54
+ const REAPING = readFileSync(
55
+ join(REPO, "skills", "run-team", "references", "reaping.md"),
56
+ "utf8",
57
+ );
58
+ const RUN_TEAM = readFileSync(join(REPO, "skills", "run-team", "SKILL.md"), "utf8");
59
+ const SCRIPT = readFileSync(join(REPO, "scripts", "release-ticket.sh"), "utf8");
60
+
61
+ const releaseSection = () =>
62
+ between(
63
+ REAPING,
64
+ "## Why reap declines a claim that was never dispatched",
65
+ "## Never reap a branch a live member is on",
66
+ "reaping.md",
67
+ );
68
+
69
+ test("reaping.md: the dirty check is named as the conditional precondition", () => {
70
+ // Without this, "four preconditions, recomputed inside same invocation as
71
+ // delete" reads as four checks that always run — and the claim whose worktree
72
+ // directory is gone gets released on three.
73
+ assert.match(
74
+ releaseSection(),
75
+ /dirty\s+check\s+is\s+the\s+conditional\s+one.{0,120}only\s+when\s+the\s+worktree\s+directory\s+is\s+there\s+to\s+read.{0,120}established\s+absent\s+it\s+does\s+not\s+run\s+at\s+all/s,
76
+ "the dirty check reads as unconditional again — it opens inside `[ -d \"$wt\" ]`, so a claim whose worktree directory is established absent has three preconditions recomputed, not four",
77
+ );
78
+ });
79
+
80
+ test("reaping.md: worktree remove's refusal is scoped to the live directory and named as the same stat", () => {
81
+ // ONE contiguous span, not three asserts: the scope, the shared stat and the
82
+ // sole-arbiter consequence are the same claim, and a sentence spliced between
83
+ // them can carve the exception back out.
84
+ assert.match(
85
+ releaseSection(),
86
+ /live-directory\s+case\s+ONLY.{0,200}same\s+`stat`.{0,200}not\s+an\s+independent\s+second\s+opinion.{0,400}sole\s+arbiter/s,
87
+ "the delete-time backstop reads as covering the dirty check outright again — `worktree remove` gates its clean check on the same stat the guard does, accepts an unstattable path at rc 0, and deregisters a worktree still holding work (measured, git 2.50.1)",
88
+ );
89
+ });
90
+
91
+ test("reaping.md: the rc-0 deregistration of an unstattable worktree is measured, not asserted", () => {
92
+ assert.match(
93
+ releaseSection(),
94
+ /rc\s+0.{0,160}still\s+on\s+disk.{0,80}measured,\s+git\s+2\.50\.1/s,
95
+ "the measurement behind the correction is gone — without it the claim is one more assertion about git, which is what produced the wrong text in the first place",
96
+ );
97
+ });
98
+
99
+ test("run-team/SKILL.md: the release-claims section carries the same limitation", () => {
100
+ // The assertion doc is where a controller actually reads this. Corrected in
101
+ // reaping.md alone, it is corrected in the document nobody opens mid-run.
102
+ const section = between(
103
+ RUN_TEAM,
104
+ "### Release the claims that never became PRs",
105
+ // Short of a wrap point: SKILL.md hard-wraps this sentence mid-phrase.
106
+ "**That refusal is the",
107
+ "run-team/SKILL.md",
108
+ );
109
+ assert.match(
110
+ section,
111
+ /whenever\s+the\s+worktree\s+directory\s+is\s+there\s+to\s+read.{0,200}established\s+absent.{0,120}no\s+backstop.{0,200}sole\s+arbiter/s,
112
+ "SKILL.md is back to promising all four preconditions are recomputed at the delete — the dirty check does not run when the directory is established absent, and `worktree remove` does not stand in for it",
113
+ );
114
+ });
115
+
116
+ test("run-team/SKILL.md: the by-hand fallback names worktree-audit.sh's no-argument contract", () => {
117
+ // #525. The by-hand fallback for a claim `release-ticket.sh` refused sends
118
+ // the reader to `worktree-audit.sh`, which takes NO argument and audits
119
+ // every worktree at once — unlike the path-taking siblings all around it in
120
+ // this runbook. Passing it this claim's worktree path is exit 2; before
121
+ // #525's guard it was worse, a full audit of every OTHER worktree at exit 0
122
+ // with the main checkout as the first row, read as if it were this claim's.
123
+ //
124
+ // Slice starts at the wrap point the section-scoped test above ENDS on, so
125
+ // the two spans abut rather than overlap and neither can satisfy the other.
126
+ const fallback = between(
127
+ RUN_TEAM,
128
+ "**That refusal is the",
129
+ "Run it over every claimed ticket",
130
+ "run-team/SKILL.md",
131
+ );
132
+ // ONE contiguous phrase: the no-argument half and the row-lookup half are
133
+ // the same instruction. Pinned separately, dropping the lookup leaves a
134
+ // reader taking the first row — the main checkout — as this claim's.
135
+ assert.match(
136
+ fallback,
137
+ phrase("run `worktree-audit.sh` (it audits every worktree; find this claim's row in the output)"),
138
+ "the by-hand fallback no longer says `worktree-audit.sh` audits every worktree and needs a row lookup — a reader passing it this claim's path gets exit 2, and one reading the first row reads the main checkout",
139
+ );
140
+ });
141
+
142
+ test("release-ticket.sh: the comment at the dirty check does not contradict the header above it", () => {
143
+ // The header (release-ticket.sh) states the limitation; this comment
144
+ // said git recomputes this same check at the delete, full stop. Whichever a
145
+ // reader reaches first is the one they act on.
146
+ const comment = stripHashGutter(
147
+ between(
148
+ SCRIPT,
149
+ " # Ignored files are deliberately not a blocker",
150
+ " n=$(printf",
151
+ "release-ticket.sh",
152
+ ),
153
+ );
154
+ assert.match(
155
+ comment,
156
+ /recomputed\s+by\s+git\s+at\s+the\s+moment\s+of\s+the\s+delete.{0,120}only\s+while\s+the\s+directory\s+is\s+there/s,
157
+ "the dirty-check comment claims an unqualified delete-time recomputation again, contradicting this script's own header",
158
+ );
159
+ });
@@ -0,0 +1,135 @@
1
+ // #258. The dictated refuter prompt orders filesystem writes — "compile it, run
2
+ // the test, apply the mutation" — and named no location. Three measured
3
+ // instances: a refuter's mutation matrix collided with a sibling's in a shared
4
+ // scratchpad; a probe built a throwaway git repo at the maintainer's checkout
5
+ // root while its own report claimed a different path; and a fixture's `cd`
6
+ // silently failed, leaving the following `git` commands running in the live
7
+ // checkout, where they committed an uncommitted settings.json edit.
8
+ //
9
+ // A fourth measured instance is deliberately NOT cited above: fix-appliers on
10
+ // different PRs colliding on `unv1`/`unv2`/`unv7`/`unv11`, because finding ids
11
+ // restart at 1 every review. The clause pinned below binds only the REFUTER's
12
+ // own writes — it opens "Everything you write" — and #258 is refuter-shaped, so
13
+ // a fix-applier's own scratch path is out of scope. Citing that failure as
14
+ // motivation here would claim coverage these pins do not have.
15
+ //
16
+ // The instruction is quoted VERBATIM in two documents — run-team/SKILL.md's
17
+ // fix-applier dispatch block, and review-and-fix.md step 2 — and neither carried
18
+ // a scratch clause. A fix added to only one is the one that does not reach
19
+ // whichever path a given caller takes, so both slices are pinned here.
20
+ //
21
+ // THE CEILING, same as fleet-tick-prose.test.mjs and issue-tracker-prose.test.mjs:
22
+ // these are PRESENCE pins over a bounded slice. Every one is a single regex —
23
+ // one contiguous span, or `.{0,40}` joins between anchors — so text spliced
24
+ // INSIDE a pinned clause reddens them (measured both ways). What they still
25
+ // cannot catch is a WHOLE NEW sentence appended AFTER the clause that carves out
26
+ // an exception: nothing pins the clause's neighbourhood. A reflow of the same
27
+ // words (line wraps, `**bold**` moved) stays green by design — the words are
28
+ // what is pinned, not their layout.
29
+ import { test } from "node:test";
30
+ import assert from "node:assert/strict";
31
+ import { readFileSync } from "node:fs";
32
+ import { join } from "node:path";
33
+ import { between, phrase } from "./prose-pin.mjs";
34
+
35
+ const REPO = join(import.meta.dirname, "..");
36
+ const RUN_TEAM = readFileSync(join(REPO, "skills", "run-team", "SKILL.md"), "utf8");
37
+ const REVIEW_AND_FIX = readFileSync(join(REPO, "commands", "review-and-fix.md"), "utf8");
38
+
39
+ // The run-team/SKILL.md copy sits inside a nested `> > ` blockquote, so a hard
40
+ // wrap can land INSIDE a phrase with the quote gutter, not whitespace, at the
41
+ // break — `\s+` does not span it, `>` is not whitespace. Strip the gutter per
42
+ // line and rejoin with a single space, which restores exactly the original
43
+ // inter-word space at a wrap point (markdown only ever wraps AT one). Harmless
44
+ // on review-and-fix.md's copy, which carries no `>` prefix to strip.
45
+ function stripQuoteGutter(text) {
46
+ return text
47
+ .split("\n")
48
+ .map((l) => l.replace(/^(>\s?)+/, ""))
49
+ .join(" ");
50
+ }
51
+
52
+ const runTeamPrompt = () =>
53
+ stripQuoteGutter(
54
+ between(RUN_TEAM, "Try to REFUTE this finding", "Survives → apply it, with one hold", "run-team/SKILL.md"),
55
+ );
56
+ const reviewAndFixPrompt = () =>
57
+ stripQuoteGutter(
58
+ between(
59
+ REVIEW_AND_FIX,
60
+ "Try to REFUTE this finding",
61
+ "That last clause is the whole mechanism",
62
+ "review-and-fix.md",
63
+ ),
64
+ );
65
+
66
+ for (const [name, getPrompt] of [
67
+ ["run-team/SKILL.md", runTeamPrompt],
68
+ ["review-and-fix.md", reviewAndFixPrompt],
69
+ ]) {
70
+ // `\s+` between every word, never a literal space — a wrap point can land
71
+ // INSIDE a pinned phrase, not just between clauses, and dropped this whole
72
+ // group to 4/8 the first time it was measured (see the mutation-test note
73
+ // at the top of this file). The words are pinned, not the exact bytes.
74
+ test(`${name}: refuter prompt names a two-level scratch path and forbids checkout writes`, () => {
75
+ const prompt = getPrompt();
76
+ // ONE contiguous span, not two independent `assert.match` calls. Two
77
+ // regexes with no bound on the gap between them let a spliced sentence
78
+ // carve an exception INTO the write-ban and stay 8/8 green — measured on
79
+ // this exact pair, and the same defect PR #488 fixed in
80
+ // finisher-pin-race-prose.test.mjs. The real gap here is `; the `, so
81
+ // pinning it costs nothing and closes the splice.
82
+ assert.match(
83
+ prompt,
84
+ /`<scratch>\/pr<N>\/<finding>\/`\s+and\s+nowhere\s+else;\s+the\s+checkout\s+and\s+any\s+worktree\s+are\s+never\s+write\s+targets/,
85
+ "the scratch-path clause is broken — either the two-level path is gone (a refuter falls back to a generic name and collides with a sibling, or with a fix-applier on another PR, since finding ids restart at 1 every review), or the write ban is gone, or a sentence was spliced BETWEEN them carving out an exception",
86
+ );
87
+ });
88
+
89
+ test(`${name}: refuter prompt still permits reading the PR at a pinned ref`, () => {
90
+ assert.match(
91
+ getPrompt(),
92
+ /`git\s+show`\/`git\s+archive`\s+at\s+a\s+pinned\s+ref\s+read\s+fine\s+anywhere/,
93
+ "the write ban reads as a blanket ban — a refuter that cannot read the PR's own object store cannot verify anything",
94
+ );
95
+ });
96
+
97
+ test(`${name}: refuter prompt chains cd into the git command, never semicolon`, () => {
98
+ assert.match(
99
+ getPrompt(),
100
+ /cd\s+"\$D"\s+&&\s+git\s+….{0,40}never.{0,40}cd\s+"\$D";\s+git\s+…/s,
101
+ 'no cd-chaining rule — a fixture\'s silently failed `cd` can leave a `git` command running in the checkout, the actual failure during the PR #488 run',
102
+ );
103
+ });
104
+
105
+ test(`${name}: refuter prompt requires a toplevel assertion around git init/commit, including the realpath remedy for macOS's /private/tmp symlink`, () => {
106
+ assert.match(
107
+ getPrompt(),
108
+ /`git\s+rev-parse\s+--show-toplevel`.{0,40}before\s+`git\s+init`\s+it\s+must\s+NOT\s+resolve\s+to\s+the\s+repository.{0,40}`fatal:\s+not\s+a\s+git\s+repository`.{0,40}is\s+the\s+pass.{0,40}before\s+any\s+`git\s+commit`\s+it\s+must\s+resolve\s+to\s+your\s+scratch\s+path.{0,80}compare\s+resolved\s+forms.{0,60}realpath/s,
109
+ "no toplevel assertion around git init/commit, or the realpath remedy for macOS's /private/tmp symlink is gone — the observed failure is the agent BELIEVING it is already in scratch and being wrong, which naming a path alone does not catch. Both halves are pinned because they have OPPOSITE expected outcomes: a single `resolves to your scratch path` guard is unsatisfiable before `git init` (a fresh scratch dir has no toplevel and exits 128), and a guard that cannot pass on the clean path gets ignored",
110
+ );
111
+ });
112
+ }
113
+
114
+ // #1150. The clause above names `<scratch>/pr<N>/<finding>/` inside the
115
+ // instruction the REFUTER reads, which left the refuter to resolve it — a
116
+ // child deriving its own path. The ruling is that the parent assigns it: the
117
+ // fix-applier resolves the placeholder to an absolute path (its own `pr<N>`,
118
+ // the finding's id) and writes that path into the refuter's prompt. That
119
+ // clause sits in the lead-in the FIX-APPLIER reads, ahead of the quoted
120
+ // instruction, so it is sliced from the dispatch line to the instruction's
121
+ // opening words — both copies, one phrase, for this file's two-copies reason.
122
+ const SUBSTITUTION =
123
+ "with one substitution: resolve `<scratch>/pr<N>/<finding>/` in it to an absolute path under your own run root — `mktemp -d` once per round for `<scratch>/pr<N>/fix-XXXXXXXX/`, never bare `pr<N>`, since finding ids restart at 1 each round too — and write that absolute path into the refuter's prompt in its place; a refuter never derives its own path";
124
+ for (const [name, getLeadIn] of [
125
+ ["run-team/SKILL.md", () => stripQuoteGutter(between(RUN_TEAM, "In scope → dispatch ONE refuter", "Try to REFUTE this finding", "run-team/SKILL.md"))],
126
+ ["review-and-fix.md", () => between(REVIEW_AND_FIX, "In scope → dispatch one refuter", "Try to REFUTE this finding", "review-and-fix.md")],
127
+ ]) {
128
+ test(`${name}: the fix-applier resolves the refuter's scratch path to an absolute one and writes it into the refuter's prompt`, () => {
129
+ assert.match(
130
+ getLeadIn(),
131
+ phrase(SUBSTITUTION),
132
+ "the fix-applier is no longer told to resolve `<scratch>/pr<N>/<finding>/` to an absolute path of its own and write it into the refuter's prompt — the refuter is back to deriving its own path from a placeholder",
133
+ );
134
+ });
135
+ }
@@ -0,0 +1,71 @@
1
+ // #1347, hand-off from #1294: commands/review-and-fix.md step 6 used to
2
+ // document the release-label gate as CONDITIONAL — "a repo defining none of
3
+ // them does not gate on one" — true before this repo had any release
4
+ // pipeline to gate. #1347 ports `release-label.yml`/`release.yml`
5
+ // (agent-brain's shape): `release-label.yml`'s `auto-label-bots` job adds
6
+ // `patch` when no release label is present and `validate-release-label`
7
+ // hard-fails on more than one, so every PR on this repo now carries exactly
8
+ // one release label by the time it reaches step 6 — the conditional clause
9
+ // is stale and this ticket flips it to state the gate as required.
10
+ //
11
+ // Cited by step NAME, not by line — this repo's own convention
12
+ // (ci.yml: "a refactor that shifts that file silently re-points a line
13
+ // number at unrelated code"): #1361 is in flight on this same file, inside
14
+ // its Specialists section, well below step 6; this pin's slice starts and
15
+ // ends inside step 6's own paragraph and cannot reach that section either
16
+ // way, regardless of which lines either one currently sits on.
17
+ //
18
+ // Mutation-tested by hand, 2026-09-09, against a scratch copy of
19
+ // commands/review-and-fix.md (never the real checkout): (1) reverting
20
+ // "required on every PR" back to the old "a repo defining none of them does
21
+ // not gate on one" wording reddened this file's presence pin and left the
22
+ // count/label-name pins (already covered by release-label-split-prose.test.mjs)
23
+ // unaffected; (2) deleting the `release-label.yml` citation entirely also
24
+ // reddened it; (3) the unrelated Specialists section was untouched
25
+ // throughout, confirming the slice below cannot see that far.
26
+ //
27
+ // CEILING: a presence pin over a bounded slice, same shape and same limits
28
+ // as every other prose test here (release-label-split-prose.test.mjs's own
29
+ // header states them) — this proves the required-gate clause is PRESENT in
30
+ // step 6's own paragraph, not that no later edit could dilute it.
31
+ import { test } from "node:test";
32
+ import assert from "node:assert/strict";
33
+ import { readFileSync } from "node:fs";
34
+ import { join } from "node:path";
35
+ import { between, phrase } from "./prose-pin.mjs";
36
+
37
+ const REPO = join(import.meta.dirname, "..");
38
+ const REVIEW_AND_FIX = readFileSync(join(REPO, "commands", "review-and-fix.md"), "utf8");
39
+
40
+ // Bounded to step 6's own paragraph — starts at the step's own opening
41
+ // clause, ends at the `ready-to-merge` label command that closes its first
42
+ // sentence. Never widened past that, so #1361's in-flight Specialists
43
+ // section is out of this slice's reach in either direction, wherever it
44
+ // currently sits.
45
+ const step6ReleaseLabelClause = () =>
46
+ between(
47
+ REVIEW_AND_FIX,
48
+ "the PR carrying exactly one release label",
49
+ "gh pr edit <pr> --add-label ready-to-merge",
50
+ "review-and-fix.md step 6",
51
+ );
52
+
53
+ test("review-and-fix.md step 6 states the release-label gate as required, not conditional on the repo defining one", () => {
54
+ const slice = step6ReleaseLabelClause();
55
+ assert.match(slice, phrase("required on every PR"));
56
+ assert.match(slice, phrase("release-label.yml"));
57
+ assert.match(slice, phrase("auto-adds `patch` when none is present and hard-fails on more than one"));
58
+ });
59
+
60
+ test("review-and-fix.md step 6 no longer states the old conditional wording", () => {
61
+ const slice = step6ReleaseLabelClause();
62
+ assert.doesNotMatch(slice, phrase("a repo defining none of them does not gate on one"));
63
+ });
64
+
65
+ test("review-and-fix.md step 6 still names the exact three release labels, unchanged by the flip", () => {
66
+ const slice = step6ReleaseLabelClause();
67
+ assert.match(slice, phrase("patch"));
68
+ assert.match(slice, phrase("minor"));
69
+ assert.match(slice, phrase("major"));
70
+ assert.match(slice, phrase("counting only those three"));
71
+ });
@@ -0,0 +1,169 @@
1
+ import { test } from "node:test";
2
+ import assert from "node:assert/strict";
3
+ import { readFileSync } from "node:fs";
4
+ import { join } from "node:path";
5
+ import { between, phrase } from "./prose-pin.mjs";
6
+
7
+ // #375. A `gh pr create --label patch` that exceeds the caller's tool timeout is
8
+ // backgrounded with the PR ALREADY OPEN and the label unapplied, and a timeout
9
+ // carries no exit status for anything downstream to react to. Measured live: the
10
+ // member noticed only because it happened to re-read the labels afterwards.
11
+ //
12
+ // Two independent guards, because they fail at different points. Splitting the
13
+ // create gives the label write its own exit status, so it fails loudly at
14
+ // creation; the finisher's assertion catches the loss wherever it happened,
15
+ // including on a hand-created PR. Neither subsumes the other, so each is pinned
16
+ // separately here.
17
+ //
18
+ // Known ceiling: these are presence pins over bounded slices, so they hold the
19
+ // wording and its location, not the absence of a later carve-out — the same
20
+ // ceiling `member-prompt-prose.test.mjs` records for its own slice.
21
+ const REPO = join(import.meta.dirname, "..");
22
+ const read = (...p) => readFileSync(join(REPO, ...p), "utf8");
23
+
24
+ const NEXT_TICKET = read("skills", "next-ticket", "SKILL.md");
25
+ const RUN_TEAM = read("skills", "run-team", "SKILL.md");
26
+ const REVIEW_AND_FIX = read("commands", "review-and-fix.md");
27
+
28
+ const step7 = () =>
29
+ between(NEXT_TICKET, "## 7. When the superpowers path reports done", "## Red flags", "next-ticket/SKILL.md step 7");
30
+
31
+ // The member reads the implementer agent body verbatim — its system prompt
32
+ // since #1804 moved the blocks there out of run-team's phase 2
33
+ // (spec 2026-09-24 § 2 Decision 2); the same slice `member-prompt-prose.test.mjs`
34
+ // takes, for the same reason.
35
+ const memberBlocks = () => read("agents", "fleet-implementer.agent.md").split("---").slice(2).join("---");
36
+
37
+ const finisherLabelDuty = () =>
38
+ between(RUN_TEAM, "Add `ready-to-merge`", "A halt at step 1 reads identical from a bare SHA mismatch", "run-team finisher duty 3");
39
+
40
+ test("next-ticket's step 7 writes the label with a command of its own, not a flag on the create", () => {
41
+ const s = step7();
42
+ // The whole command, not its first physical line: the create's body string
43
+ // spans lines, so a line-anchored match never sees `--label` folded onto the
44
+ // body-closing continuation — the very fold this asserts against.
45
+ const create = between(s, "gh pr create", "\ngh pr edit", "step 7 create command");
46
+
47
+ // The defect in one assertion: a flag on the create shares the create's fate,
48
+ // and that fate is a timeout with no exit status.
49
+ assert.doesNotMatch(
50
+ create,
51
+ /--label/,
52
+ "step 7 folds `--label` back into `gh pr create` — a timed-out create then opens the PR with the label silently unapplied",
53
+ );
54
+ assert.match(
55
+ s,
56
+ /^gh pr edit .*--add-label/m,
57
+ "step 7 no longer writes the release label with its own command, so the write has no exit status of its own",
58
+ );
59
+ });
60
+
61
+ test("next-ticket says why the label write stands alone, so it is not folded back in as a tidy-up", () => {
62
+ const s = step7();
63
+ assert.match(
64
+ s,
65
+ phrase("Never fold `--label` into the create"),
66
+ "step 7 lost the instruction against folding the label into the create",
67
+ );
68
+ // Not a `/timeout|backgrounded/` keyword search: that is polarity-blind and
69
+ // slice-wide — it stayed GREEN with the mechanism sentence replaced by one
70
+ // NEGATING it, satisfied by the word "timeout" in the paragraph's tail clause.
71
+ assert.match(
72
+ s,
73
+ phrase("outruns the caller's tool timeout is backgrounded with the PR already open"),
74
+ "step 7 no longer names the timeout the split exists for, so the split reads as an arbitrary extra call",
75
+ );
76
+ // Not a bare `own exit status`: the command block's own trailing comment
77
+ // carries that phrase, so the loose form stayed GREEN with the prose rationale
78
+ // rewritten to "a tidier shape" — measured. Pin the sentence, not the words.
79
+ assert.match(
80
+ s,
81
+ phrase("it has its own exit status and fails loudly"),
82
+ "step 7 no longer says the separate command carries its own exit status — the whole reason it is separate",
83
+ );
84
+ });
85
+
86
+ test("the split reaches the fleet member verbatim, inside the agent body it is dispatched with", () => {
87
+ const blocks = memberBlocks();
88
+
89
+ // Location, not vocabulary: a member reads only its agent body and its prompt.
90
+ // The instruction sitting in controller-facing prose reaches it by paraphrase
91
+ // or not at all.
92
+ assert.match(
93
+ blocks,
94
+ /gh pr edit --add-label/,
95
+ "the member is not told to write the release label as its own command — it will pass `--label` to the create, which is the bug",
96
+ );
97
+ assert.match(
98
+ blocks,
99
+ phrase("Never fold `--label` into the create"),
100
+ "the member block lost the prohibition, leaving the split as an example a member may collapse back into one call",
101
+ );
102
+ });
103
+
104
+ test("the finisher refuses a PR with zero or more than one release label, and says which", () => {
105
+ const duty = finisherLabelDuty();
106
+ assert.match(
107
+ duty,
108
+ phrase("exactly one"),
109
+ "the finisher no longer asserts a release-label count before labelling",
110
+ );
111
+ assert.match(
112
+ duty,
113
+ /`patch`\/`minor`\/`major`/,
114
+ "the finisher's assertion no longer names the release labels it counts",
115
+ );
116
+ assert.match(
117
+ duty,
118
+ /[Zz]ero or more than one/,
119
+ "the finisher's assertion covers only one of the two failures — a PR wearing two release labels passes, or a bare PR does",
120
+ );
121
+ assert.match(
122
+ duty,
123
+ /naming which|says which|report(s|ing)? which/,
124
+ "the finisher may halt without naming what it found, which is the bare-SHA-mismatch failure shape this file's neighbours already record",
125
+ );
126
+ });
127
+
128
+ test("the finisher's assertion accepts a normally-labelled PR — it counts release labels, not labels", () => {
129
+ const duty = finisherLabelDuty();
130
+
131
+ // The wrongly-REFUSE half. The finisher is about to add `ready-to-merge`,
132
+ // which is itself a label, and PRs carry others; an assertion reading
133
+ // "exactly one label" halts every correctly-created PR in the fleet.
134
+ assert.match(
135
+ duty,
136
+ phrase("Count only those three"),
137
+ "the finisher's assertion is no longer scoped to the release labels — any other label on the PR now trips it",
138
+ );
139
+ assert.match(
140
+ duty,
141
+ phrase("passes unchanged"),
142
+ "the finisher no longer states that a PR carrying one release label beside its other labels passes",
143
+ );
144
+ });
145
+
146
+ test("the solo labelling step gates on the release label too — the fleet finisher is not its only writer", () => {
147
+ // `review-and-fix.md` step 6 is the other writer of `ready-to-merge`. A guard
148
+ // on the fleet path alone leaves the standalone path labelling PRs with no
149
+ // release label at all.
150
+ const step6 = between(REVIEW_AND_FIX, "6. Diff-check green", "**Bind green to the *run*", "review-and-fix.md step 6");
151
+ assert.match(
152
+ step6,
153
+ phrase("exactly one release label"),
154
+ "step 6 labels `ready-to-merge` without asserting a release label, so the standalone path still ships PRs with none",
155
+ );
156
+ // The same two halves test 4 pins on the fleet path. A count with no halt
157
+ // reads the labels back and labels anyway; a halt with no naming is the
158
+ // bare-SHA-mismatch failure shape this file's neighbours already record.
159
+ assert.match(
160
+ step6,
161
+ /[Zz]ero or more than one/,
162
+ "step 6 covers only one of the two failures — a PR wearing two release labels gets `ready-to-merge`, or a bare PR does",
163
+ );
164
+ assert.match(
165
+ step6,
166
+ /naming which|says which|report(s|ing)? which/,
167
+ "step 6 may halt without naming what it found, leaving the standalone path's halt unactionable",
168
+ );
169
+ });