@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,239 +0,0 @@
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, paragraph, 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 release deletes the branch with update-ref's compare-and-swap, not `-D`", () => {
117
- // release-ticket.sh deletes with `git update-ref -d refs/heads/<branch> <tip>`
118
- // on a tip read once, which refuses if the ref moved off that tip. SKILL.md
119
- // kept saying `-D` after the script stopped using it, so a controller read
120
- // the release as a force-delete of whatever the ref held at that moment.
121
- const section = between(
122
- RUN_TEAM,
123
- "### Release the claims that never became PRs",
124
- "**That refusal is the",
125
- "run-team/SKILL.md",
126
- );
127
- assert.match(
128
- section,
129
- phrase("deletes the branch with `git update-ref -d` on the tip it read once"),
130
- "SKILL.md's release section no longer names `git update-ref -d` on a tip read once as the branch delete",
131
- );
132
- assert.match(
133
- section,
134
- phrase("compare-and-swap that refuses if the branch has moved off that tip"),
135
- "SKILL.md's release section no longer says the update-ref delete is a compare-and-swap that refuses if the branch has moved off the tip",
136
- );
137
- assert.doesNotMatch(
138
- section,
139
- /(?:deletes?|deleted)\s+(?:the\s+branch\s+)?(?:is\s+)?with\s+`(?:git\s+branch\s+)?-D`/,
140
- "SKILL.md's release section says the branch is deleted with `-D` — release-ticket.sh deletes it with `git update-ref -d`",
141
- );
142
- });
143
-
144
- // The reap paragraph's twin of the release pin above. reap.sh deletes a
145
- // `[gone]` branch with `git update-ref --no-deref -d refs/heads/<b> <tip>`,
146
- // never `-D`, and keeps a branch the cherry check cleared whenever a fresh
147
- // worktree check finds it held — so naming `-D`, or the cherry check as the
148
- // delete's only authorizer, is false as written.
149
- const reapParagraph = () =>
150
- paragraph(RUN_TEAM, "`~/.fleet/bin/fleet-run reap.sh --apply` recomputes every precondition", "run-team/SKILL.md's reap paragraph");
151
-
152
- test("run-team/SKILL.md: reap's cherry check authorizes the update-ref delete, with the fresh worktree check beside it", () => {
153
- const p = reapParagraph();
154
- assert.match(
155
- p,
156
- phrase("`git cherry origin/main` to authorize the `git update-ref -d` delete"),
157
- "SKILL.md's reap paragraph no longer names the cherry check as authorizing the `git update-ref -d` delete",
158
- );
159
- assert.match(
160
- p,
161
- phrase("a fresh check that no worktree holds the branch"),
162
- "SKILL.md's reap paragraph no longer names the fresh worktree check — reap.sh keeps a branch the cherry check cleared whenever a worktree holds it",
163
- );
164
- assert.doesNotMatch(p, /(?:^|[\s`])(?:git\s+branch\s+)?-D\b/, "SKILL.md's reap paragraph names `-D` — reap.sh deletes with `git update-ref -d`");
165
- assert.doesNotMatch(
166
- p,
167
- /\bonly\s+by\b|\bnothing\s+else\b|\bsolely\b|\balone\b/i,
168
- "SKILL.md's reap paragraph makes one check the delete's only authorizer — reap.sh's worktree check stops that delete too",
169
- );
170
- });
171
-
172
- test("run-team/SKILL.md: the reap paragraph keeps the preconditions it already named", () => {
173
- // Input the assertions above must ACCEPT: the corrected clause sits in a
174
- // list whose other entries stay as they were.
175
- const p = reapParagraph();
176
- assert.match(p, phrase("`for-each-ref` for `[gone]`"));
177
- assert.match(p, phrase("worktree removal without `--force`"));
178
- });
179
-
180
- test("reap.sh: the worktree check the reap paragraph names runs before the delete", () => {
181
- // Live lines only: both names recur in comments, and a comment hit would
182
- // read as the code.
183
- const lines = readFileSync(join(REPO, "scripts", "reap.sh"), "utf8")
184
- .split("\n")
185
- .filter((l) => !/^\s*(?:#|echo\b)/.test(l));
186
- const only = (re, what) => {
187
- const hits = lines.flatMap((l, i) => (re.test(l) ? [i] : []));
188
- assert.equal(hits.length, 1, `reap.sh: expected exactly one live line that ${what}, found ${hits.length}`);
189
- return hits[0];
190
- };
191
- const check = only(/^\s*if\s+wt_holding\s+"refs\/heads\/\$b"/, "runs wt_holding on the branch");
192
- const del = only(/\bgit\s+update-ref\s+--no-deref\s+-d\s+"refs\/heads\/\$b"\s+"\$tip"/, "runs `git update-ref -d` on the branch at its tip");
193
- assert.ok(check < del, "reap.sh runs its worktree check after the delete, not before it");
194
- });
195
-
196
- test("run-team/SKILL.md: the by-hand fallback names worktree-audit.sh's no-argument contract", () => {
197
- // #525. The by-hand fallback for a claim `release-ticket.sh` refused sends
198
- // the reader to `worktree-audit.sh`, which takes NO argument and audits
199
- // every worktree at once — unlike the path-taking siblings all around it in
200
- // this runbook. Passing it this claim's worktree path is exit 2; before
201
- // #525's guard it was worse, a full audit of every OTHER worktree at exit 0
202
- // with the main checkout as the first row, read as if it were this claim's.
203
- //
204
- // Slice starts at the wrap point the section-scoped test above ENDS on, so
205
- // the two spans abut rather than overlap and neither can satisfy the other.
206
- const fallback = between(
207
- RUN_TEAM,
208
- "**That refusal is the",
209
- "Run it over every claimed ticket",
210
- "run-team/SKILL.md",
211
- );
212
- // ONE contiguous phrase: the no-argument half and the row-lookup half are
213
- // the same instruction. Pinned separately, dropping the lookup leaves a
214
- // reader taking the first row — the main checkout — as this claim's.
215
- assert.match(
216
- fallback,
217
- phrase("run `worktree-audit.sh` (it audits every worktree; find this claim's row in the output)"),
218
- "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",
219
- );
220
- });
221
-
222
- test("release-ticket.sh: the comment at the dirty check does not contradict the header above it", () => {
223
- // The header (release-ticket.sh) states the limitation; this comment
224
- // said git recomputes this same check at the delete, full stop. Whichever a
225
- // reader reaches first is the one they act on.
226
- const comment = stripHashGutter(
227
- between(
228
- SCRIPT,
229
- " # Ignored files are deliberately not a blocker",
230
- " n=$(printf",
231
- "release-ticket.sh",
232
- ),
233
- );
234
- assert.match(
235
- comment,
236
- /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,
237
- "the dirty-check comment claims an unqualified delete-time recomputation again, contradicting this script's own header",
238
- );
239
- });
@@ -1,112 +0,0 @@
1
- // reaping.md's reap section said reap.sh's `git update-ref -d` is
2
- // "authorized by that cherry check and only by it". The script halts the
3
- // delete on a second thing too: a fresh worktree check (`wt_holding`) over a
4
- // listing re-read right before it, which keeps a `[gone]` branch the cherry
5
- // check cleared whenever a worktree holds it or cannot be resolved. A sentence
6
- // naming the cherry check as the only authorizer is false as written.
7
- //
8
- // The reap-side twin of reaping-release-authorizers-prose.test.mjs, which pins
9
- // the release section's authorizer list. Kept apart so each section's pin can
10
- // be edited independently.
11
- import { test } from "node:test";
12
- import assert from "node:assert/strict";
13
- import { readFileSync } from "node:fs";
14
- import { join } from "node:path";
15
- import { between, bullet, phrase, unemphasized } from "./prose-pin.mjs";
16
-
17
- const REPO = join(import.meta.dirname, "..");
18
- const REAPING = readFileSync(
19
- join(REPO, "skills", "run-team", "references", "reaping.md"),
20
- "utf8",
21
- );
22
- const SCRIPT = readFileSync(join(REPO, "scripts", "reap.sh"), "utf8");
23
-
24
- const reapSection = () =>
25
- between(
26
- REAPING,
27
- "## Why the reap is shaped the way it is",
28
- "## Why a second sweep, over worktrees rather than branches",
29
- "reaping.md",
30
- );
31
-
32
- // The bullet that names the delete, bounded to its own list item: it ends at
33
- // the next list marker, so a sibling bullet (the holder-check bullet sits
34
- // right after it) cannot supply the words, and rewording that sibling does
35
- // not move the bound.
36
- const deleteBullet = () =>
37
- bullet(
38
- reapSection(),
39
- "- **The delete is `git update-ref -d`'s compare-and-swap",
40
- "\n- ",
41
- "reaping.md's reap section",
42
- );
43
-
44
- // The clause that lists the authorizers: from "authorized by" to the
45
- // sentence after the bold lead, which explains the compare-and-swap. Sliced
46
- // emphasis-tolerantly, and every assertion below reads it through
47
- // `unemphasized()`, so a `**` moved onto or into the clause stays green: the
48
- // slice only locates the clause, and `phrase()` is matched against raw text.
49
- const authorizers = () =>
50
- between(
51
- deleteBullet(),
52
- "authorized by that cherry check",
53
- "Tip read before the cherry",
54
- "reaping.md's reap delete bullet",
55
- { emphasisTolerant: true },
56
- );
57
-
58
- test("reaping.md: the reap delete's authorizer clause names the fresh worktree-holds-branch check", () => {
59
- // ONE contiguous span, not keywords: "fresh" and the negation each
60
- // satisfied somewhere in the slice pass a clause with either one gutted
61
- // ("a check that no worktree holds the branch" has no freshness; "a fresh
62
- // check ... that a worktree holds the branch" has the opposite meaning).
63
- // Only a span binds the two to each other.
64
- assert.match(
65
- unemphasized(authorizers()),
66
- phrase("a fresh check, re-read immediately before the delete, that no worktree holds the branch"),
67
- "reaping.md's reap section names what authorizes the `update-ref` delete but not the fresh worktree check — reap.sh keeps a branch the cherry check cleared whenever a worktree holds it",
68
- );
69
- });
70
-
71
- test("reaping.md: the reap delete's authorizer clause does not make any one check the only authorizer", () => {
72
- // The exclusivity the defect carried, in the spellings of it a reword can
73
- // restore after the new words: "only by it", "only by them", "nothing
74
- // else", "solely", "alone". Pinned on its own because the presence pin
75
- // above stays green with any of them restored. A word list, so a spelling
76
- // outside it goes unseen; `\s+` keeps a reflow between its words green.
77
- assert.doesNotMatch(
78
- unemphasized(authorizers()),
79
- /\bonly\s+by\b|\bnothing\s+else\b|\bsolely\b|\balone\b/,
80
- "reaping.md's reap section says one check alone authorizes the `update-ref` delete — reap.sh's worktree check stops that delete too",
81
- );
82
- });
83
-
84
- test("reaping.md: the reap delete's authorizer clause still names the cherry check", () => {
85
- // Input the new assertions must ACCEPT: naming the worktree check must not
86
- // cost the clause the check it already had.
87
- assert.match(unemphasized(deleteBullet()), phrase("authorized by that cherry check"));
88
- });
89
-
90
- // reap.sh's executable lines, comments and `echo` diagnostics dropped. The
91
- // check's name and the delete command both recur in comments: an indexOf over
92
- // the raw text lands on either and reads as the code, so a real delete moved
93
- // above the check, or the check commented out, stays green. Only whole-line
94
- // comments drop here, so each pattern below is anchored at the start of its
95
- // statement: a command spelled after a `#` inside a live line is not live.
96
- const liveLines = () => SCRIPT.split("\n").filter((l) => !/^\s*(?:#|echo\b)/.test(l));
97
-
98
- // The one live line matching `re`. Exactly one: a first-hit search would
99
- // bind the pin to whichever copy comes first.
100
- const liveLineOf = (re, what) => {
101
- const hits = liveLines().flatMap((l, i) => (re.test(l) ? [i] : []));
102
- assert.equal(hits.length, 1, `reap.sh: expected exactly one live line that ${what}, found ${hits.length}`);
103
- return hits[0];
104
- };
105
-
106
- test("reap.sh: the worktree check the prose names sits before the delete", () => {
107
- // The prose names a check the script runs; pin that the script still does,
108
- // and runs it before the delete, so the prose cannot outlive the check.
109
- const check = liveLineOf(/^\s*if\s+wt_holding\s+"refs\/heads\/\$b"/, "runs wt_holding on the branch");
110
- const del = liveLineOf(/^\s*if\s+!\s+err=\$\(git\s+update-ref\s+--no-deref\s+-d\s+"refs\/heads\/\$b"\s+"\$tip"/, "runs `git update-ref -d` on the branch at its tip");
111
- assert.ok(check < del, "reap.sh runs its worktree check after the delete, not before it");
112
- });
@@ -1,85 +0,0 @@
1
- // reaping.md's release section names what authorizes release-ticket.sh's
2
- // `git update-ref -d`, ending "and by nothing else". The script halts the
3
- // delete on a fourth thing too: a fresh worktree check (`wt_holding`) re-read
4
- // right before it, which stopped a delete on its own when a worktree took the
5
- // branch inside the window between the checks and the delete. A list that
6
- // closes with "by nothing else" while omitting it is false as written.
7
- //
8
- // Kept apart from reaping-prose.test.mjs, which pins the dirty-check and
9
- // `worktree remove` claims of the same section: this one pins the
10
- // authorizer list only, so the two files can be edited independently.
11
- import { test } from "node:test";
12
- import assert from "node:assert/strict";
13
- import { readFileSync } from "node:fs";
14
- import { join } from "node:path";
15
- import { between, phrase } from "./prose-pin.mjs";
16
-
17
- const REPO = join(import.meta.dirname, "..");
18
- const REAPING = readFileSync(
19
- join(REPO, "skills", "run-team", "references", "reaping.md"),
20
- "utf8",
21
- );
22
- const SCRIPT = readFileSync(join(REPO, "scripts", "release-ticket.sh"), "utf8");
23
-
24
- const releaseSection = () =>
25
- between(
26
- REAPING,
27
- "## Why reap declines a claim that was never dispatched",
28
- "## Never reap a branch a live member is on",
29
- "reaping.md",
30
- );
31
-
32
- // The sentence that lists the authorizers: from "authorized by" to the
33
- // "and by nothing else" that closes it.
34
- const authorizers = () =>
35
- between(
36
- releaseSection(),
37
- "authorized by the `ahead` and `git cherry` checks above",
38
- "and by nothing else",
39
- "reaping.md's release section",
40
- );
41
-
42
- test("reaping.md: the release delete's authorizer list names the fresh worktree-holds-branch check", () => {
43
- // ONE contiguous span, not keywords: "fresh" and the negation each
44
- // satisfied somewhere in the slice pass a clause with either one gutted
45
- // ("a check that no worktree holds the branch" has no freshness; "a fresh
46
- // check ... that a worktree holds the branch" has the opposite meaning).
47
- // Only a span binds the two to each other.
48
- assert.match(
49
- authorizers(),
50
- phrase("a fresh check, re-read immediately before the delete, that no worktree holds the branch"),
51
- "reaping.md's release section closes its list of what authorizes the `update-ref` delete with \"and by nothing else\" but no longer names the fresh worktree check — release-ticket.sh halts the delete when any worktree holds the branch, and that check alone stopped a delete in the race window",
52
- );
53
- });
54
-
55
- test("reaping.md: the authorizer list still carries the three checks it always named", () => {
56
- // Input the new assertion must ACCEPT: naming the worktree check must not
57
- // cost the list the checks it already had.
58
- const list = authorizers();
59
- assert.match(list, phrase("`ahead` and `git cherry` checks above"));
60
- assert.match(list, phrase("`ahead` recount re-run against `origin/main`"));
61
- });
62
-
63
- // release-ticket.sh's executable lines, comments and `echo` diagnostics
64
- // dropped. The delete is logged by an `echo` that spells the command out in
65
- // a form the real call does not take (the real call quotes its arguments),
66
- // and the check's name recurs in comments: an indexOf over the raw text lands
67
- // on either and reads as the code, so a real delete moved above the check, or
68
- // the check commented out, stays green.
69
- const liveLines = () => SCRIPT.split("\n").filter((l) => !/^\s*(?:#|echo\b)/.test(l));
70
-
71
- // The one live line matching `re`. Exactly one: a first-hit search would
72
- // bind the pin to whichever copy comes first.
73
- const liveLineOf = (re, what) => {
74
- const hits = liveLines().flatMap((l, i) => (re.test(l) ? [i] : []));
75
- assert.equal(hits.length, 1, `release-ticket.sh: expected exactly one live line that ${what}, found ${hits.length}`);
76
- return hits[0];
77
- };
78
-
79
- test("release-ticket.sh: the worktree check the prose names sits before the delete", () => {
80
- // The prose names a check the script runs; pin that the script still does,
81
- // and runs it before the delete, so the prose cannot outlive the check.
82
- const check = liveLineOf(/^\s*if\s+wt_holding\s+"refs\/heads\/\$branch"/, 'runs wt_holding on the branch');
83
- const del = liveLineOf(/\bgit\s+update-ref\s+-d\s+"refs\/heads\/\$branch"\s+"\$tip"/, 'runs `git update-ref -d` on the branch at its tip');
84
- assert.ok(check < del, "release-ticket.sh runs its worktree check after the delete, not before it");
85
- });
@@ -1,112 +0,0 @@
1
- import { test } from "node:test";
2
- import assert from "node:assert/strict";
3
- import { readFileSync } from "node:fs";
4
- import { join } from "node:path";
5
- import { between, paragraph, phrase } from "./prose-pin.mjs";
6
-
7
- // The Recipe derivation step's prose: where it lives in run-team's phase 0,
8
- // what reuses a cache instead of deriving, when a run re-derives and when it
9
- // stalls, and the deriver definition that carries the proof procedure. The
10
- // proof's own behaviour is recipe-prove.test.mjs's; this file pins that the
11
- // runbook routes to it, and that every refusal naming "the Recipe derivation
12
- // step" names a step that exists.
13
- const PLUGIN = join(import.meta.dirname, "..");
14
- const read = (rel) => readFileSync(join(PLUGIN, rel), "utf8");
15
- const RUN_TEAM = read("skills/run-team/SKILL.md");
16
- const DERIVER = read("agents/fleet-recipe-deriver.agent.md");
17
- const PROVER = read("scripts/recipe-prove.mjs");
18
-
19
- const phase0 = () => between(RUN_TEAM, "## Phase 0 — shortlist", "## Phase 1 — Pull", "run-team/SKILL.md phase 0");
20
- // The step spans its quoted dispatch prompt, so it is bounded by the next
21
- // rule's opener rather than by a blank line.
22
- const step = () => between(phase0(), "**Derive the Recipe — the Recipe derivation step — before the fold-in below", "**Mid-run, a cache that stops running", "the phase-0 Recipe derivation step");
23
- const stall = () => paragraph(phase0(), "**Mid-run, a cache that stops running is re-derived once", "the re-derive-once and stall rule");
24
-
25
- test("phase 0 derives the Recipe before the fold-in and before the first claim", () => {
26
- const p0 = phase0();
27
- const at = p0.indexOf("**Derive the Recipe");
28
- assert.ok(at !== -1 && at < p0.indexOf("**Fold in every PR a prior run left open"),
29
- "the Recipe derivation step must come before the fold-in: folded-in PRs are reviewed, and a review reads the Test entrypoint from the cache");
30
- assert.match(step(), phrase("before the first claim."));
31
- });
32
-
33
- test("a present, valid cache is used as it stands — derivation is the controller's, once per run start", () => {
34
- const s = step();
35
- assert.match(s, phrase("Both exit 0 → the cache is present and valid: use it as it stands and derive nothing."));
36
- assert.match(s, phrase("one derivation per run start at most, never one per member, and a member never derives."));
37
- assert.match(s, phrase("agent `fleet-recipe-deriver`"));
38
- });
39
-
40
- test("the dispatch names the proof: a clean install, and a non-zero count or a mutation turning the run red", () => {
41
- const s = step();
42
- assert.match(s, phrase("the Install step must leave the tree clean"));
43
- assert.match(s, phrase("the runner's own non-zero count, or a deliberate mutation of one test that turns the run red."));
44
- assert.match(s, phrase("Only a proof writes the cache"));
45
- });
46
-
47
- test("an invalid cache is re-derived once; a failed derivation stalls the run instead of looping", () => {
48
- const s = stall();
49
- assert.match(s, phrase("dispatch `derive-recipe` again exactly as above, then retry what refused."));
50
- assert.match(s, phrase("A red suite never triggers it: a failing test is a finding, not a stale Recipe."));
51
- assert.match(s, phrase("`RECIPE NOT PROVEN` from any derivation, or a second invalid-cache refusal after this run's one re-derivation, halts the run"));
52
- assert.match(s, phrase("It is never a loop: no third derivation, and never a cache written by hand."));
53
- assert.match(s, phrase("an Install step, Test entrypoint or mutation that hangs until the proof's own bound refuses it as timed out."));
54
- });
55
-
56
- test("the claim paragraph sends an absent or invalid cache to the derivation step, and infers no Install step", () => {
57
- const p = paragraph(RUN_TEAM, "**The Install step comes from the Recipe cache", "run-team/SKILL.md claim Install paragraph");
58
- assert.match(p, phrase("never pass or infer one."));
59
- assert.match(p, phrase("No cache is phase 0's Recipe derivation step not having run"));
60
- });
61
-
62
- // Every refusal that sends its reader to re-derive names the step by the same
63
- // words. If phase 0 stopped carrying a step by that name, each refusal would
64
- // point at nothing.
65
- test("every refusal naming the Recipe derivation step names one that phase 0 carries", () => {
66
- const sources = {
67
- "derive-testcmd.sh": read("scripts/derive-testcmd.sh").match(/^derive="([^"]*)"/m),
68
- "claim-ticket.sh": read("scripts/claim-ticket.sh").match(/^rederive="([^"]*)"/m),
69
- "review-core.mjs": read("scripts/review-core.mjs").match(/DERIVATION_STEP =\s*"([^"]*)"/),
70
- };
71
- for (const [file, m] of Object.entries(sources)) {
72
- assert.ok(m, `${file}: could not find its derivation-step message — update this test`);
73
- assert.match(m[1], /run the Recipe derivation step \(run-team phase 0, before the first claim/, `${file} no longer names the step`);
74
- }
75
- assert.match(step(), /the Recipe derivation step/);
76
- });
77
-
78
- test("the deriver is told never to write the cache itself, and to prove through recipe-prove.mjs", () => {
79
- assert.match(DERIVER, phrase("never write `.fleet/recipe.json` yourself"));
80
- assert.match(DERIVER, phrase("~/.fleet/bin/fleet-run recipe-prove.mjs <repo> --install '<install>' --test '<test>'"));
81
- assert.match(DERIVER, phrase("A count of 0 is a failed proof, never a pass."));
82
- assert.match(DERIVER, phrase("requires the suite to go red"));
83
- });
84
-
85
- test("every flag the deriver's procedure passes is one recipe-prove.mjs accepts", () => {
86
- // The invocations are the indented command blocks naming recipe-prove.mjs;
87
- // flags elsewhere in the definition (its `git` reads) are not the proof's.
88
- const blocks = DERIVER.split(/\n[ \t]*\n/).filter((b) => /^ {4,}/.test(b) && b.includes("recipe-prove.mjs"));
89
- assert.equal(blocks.length, 3, "expected the observe, count-proof and mutation-proof invocations — update this test");
90
- const used = new Set(blocks.join("\n").match(/--[a-z][a-z-]+/g));
91
- const accepted = new Set(PROVER.match(/new Set\(\[([^\]]*)\]\)/)[1].match(/--[a-z-]+/g));
92
- assert.ok(used.size >= 6, `found only ${[...used].join(", ")} in the deriver — the procedure lost its proof flags`);
93
- for (const flag of used) assert.ok(accepted.has(flag), `the deriver passes ${flag}, which recipe-prove.mjs does not accept`);
94
- });
95
-
96
- test("the deriver reports one of two lines, naming vacuity and a timeout as causes", () => {
97
- assert.match(DERIVER, /`RECIPE PROVEN` followed by the JSON line/);
98
- assert.match(DERIVER, /`RECIPE NOT PROVEN` followed by the last run's `NOT PROVEN` reason/);
99
- assert.match(DERIVER, /\*\*vacuous\*\*/);
100
- assert.match(DERIVER, /\*\*timed out\*\*/);
101
- assert.match(DERIVER, phrase("the Install step, the Test entrypoint or the mutation — hung until the script's own bound stopped it"));
102
- });
103
-
104
- // recipe-prove.mjs bounds its own commands and refuses one that overruns; an
105
- // outside kill would end the run with no refusal for the deriver to report.
106
- test("the deriver is told the script bounds its own commands, and never to wrap the call in a timeout", () => {
107
- assert.match(DERIVER, phrase("The script bounds each command it runs itself"));
108
- assert.match(DERIVER, phrase("**Never wrap the `recipe-prove.mjs` call in a timeout of your own**"));
109
- assert.match(DERIVER, phrase("refuses one still running at that bound as `timed out`"));
110
- assert.match(DERIVER, phrase("so give that call `timeout: 0` and wait for the script"));
111
- assert.match(PROVER, /timed out: still running after/, "recipe-prove.mjs no longer names a timeout the way the deriver's cause reads it");
112
- });