@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,155 +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
-
6
- // #35. A fleet reference doc cited its whole evidence base as "PR #574" while
7
- // this repo's PRs stop in the thirties, so the number reads as local — to a
8
- // human and to an agent. Not a broken link (a repo's own markdown files link
9
- // nothing); a reader defect, which is why counts-not-numbers was the only
10
- // workaround the file had. The convention that closes it is host-split, and
11
- // both halves need pinning: the rule in the claim-discipline block every
12
- // implementer agent body carries, and the applied instance where the foreign
13
- // evidence sits.
14
- const REPO = join(import.meta.dirname, "..");
15
- const AGENT = readFileSync(join(REPO, "agents", "fleet-implementer-slow-high.agent.md"), "utf8");
16
- const CORRECTIONS = readFileSync(
17
- join(REPO, "skills", "run-team", "references", "correction-tickets.md"),
18
- "utf8",
19
- );
20
-
21
- // Slice-scoped, not whole-file: a bare presence check anywhere in a long file
22
- // stays green when the text lands somewhere its reader never reaches (measured
23
- // before in this repo — member-prompt-prose.test.mjs #172). The claim-discipline
24
- // block is what the harness injects into every implementer, so the rule has to
25
- // sit inside it.
26
- function slice(text, startAnchor, endAnchor, what, { endsFile = false } = {}) {
27
- const at = text.indexOf(startAnchor);
28
- assert.notEqual(at, -1, `${what} start anchor ('${startAnchor}') moved — update this test`);
29
- const end = text.indexOf(endAnchor, at);
30
- // `endsFile` sections run to EOF until someone appends a section after them,
31
- // so a missing end anchor is the normal state there, not a moved anchor.
32
- if (end === -1 && endsFile) return text.slice(at);
33
- assert.notEqual(end, -1, `${what} end anchor ('${endAnchor}') moved — update this test`);
34
- return text.slice(at, end);
35
- }
36
-
37
- // Markdown hard-wraps at ~80 columns, so a phrase splits across lines. Phrase
38
- // matches need the wrap invisible.
39
- const flat = (s) => s.replace(/\s+/g, " ");
40
-
41
- const disciplineBlock = () =>
42
- flat(
43
- slice(
44
- AGENT,
45
- "**Claim discipline, on every ticket:**",
46
- "Commit incrementally as you go",
47
- "the agent body's claim-discipline block",
48
- ),
49
- );
50
-
51
- const conventionSection = () =>
52
- flat(
53
- slice(CORRECTIONS, "## Citing evidence from another repo's run", "\n## ", "the citation convention", {
54
- endsFile: true,
55
- }),
56
- );
57
-
58
- const secondRunSection = () =>
59
- flat(slice(CORRECTIONS, "## Second mechanism", "## The clause-by-clause duty", "the second-run evidence"));
60
-
61
- test("the cross-repo citation rule reaches every implementer, in the agent body's claim-discipline block", () => {
62
- const block = disciplineBlock();
63
- assert.match(
64
- block,
65
- /another repo/i,
66
- "the claim-discipline block no longer says anything about evidence from another repo — an implementer stops being told not to write a bare `#N` for foreign evidence",
67
- );
68
- assert.match(
69
- block,
70
- /owner\/repo#N/,
71
- "the github.com half of the citation rule is gone from the agent body",
72
- );
73
- assert.match(
74
- block,
75
- /GHE/,
76
- "the non-github.com half is gone — the rule now reads as if `owner/repo#N` fits every source, which is the form that resolves to nothing for a GHE-hosted one",
77
- );
78
- });
79
-
80
- test("the convention splits by host, and both branches name what to write", () => {
81
- const section = conventionSection();
82
- assert.match(
83
- section,
84
- /github\.com.*owner\/repo#N/,
85
- "the github.com branch no longer prescribes the qualified `owner/repo#N` form",
86
- );
87
- assert.match(
88
- section,
89
- /(GHE|GitLab|internal).*naming (the )?host and repo/i,
90
- "the non-github.com branch no longer prescribes prose naming the host and the repo",
91
- );
92
- assert.match(
93
- section,
94
- /cannot be settled from this repo/,
95
- "the non-github.com branch no longer requires marking the evidence unsettleable from here — a reader is left believing a settling command exists for it",
96
- );
97
- });
98
-
99
- test("the convention carves out this repo's own references instead of banning bare `#N`", () => {
100
- // The REFUSE half. Stated as "never write a bare `#N`" the rule condemns
101
- // every local reference in the repo, this file's own `PR #32` included.
102
- assert.match(
103
- conventionSection(),
104
- /own issues and PRs stay bare `#N`/,
105
- "the convention no longer says local references stay bare — read as a blanket ban it sends a reader qualifying hundreds of correct local `#N`s",
106
- );
107
- });
108
-
109
- test("the second-run evidence names its source repo, its host, and that it cannot be settled here", () => {
110
- const section = secondRunSection();
111
- assert.match(
112
- section,
113
- /CoCo\/agent-brain/,
114
- "the second-run evidence no longer identifies its source repo — 'a different repo' gives provenance without identity, so a reader cannot reach the evidence at all",
115
- );
116
- assert.match(
117
- section,
118
- /bmw\.ghe\.com/,
119
- "the host is gone — without it a reader takes `CoCo/agent-brain` for a github.com repo and gets a 404",
120
- );
121
- assert.match(
122
- section,
123
- /none of it can be settled from this repo/,
124
- "the unsettleable marker is gone, and the ordinals this section carries ('4th of 5', '3rd') read as claims someone could re-check against this tree",
125
- );
126
- });
127
-
128
- test("the ordinal-verification mechanism is named as behavior, not in the source repo's test vocabulary", () => {
129
- const section = secondRunSection();
130
- assert.doesNotMatch(
131
- section,
132
- /\bexpects?\b/i,
133
- "the mechanism is scoped as foreign vocabulary again (`git grep 'expect(' HEAD` → zero hits here; this repo is `node:test` + `assert.*`), which invites a reader to discard a lesson that applies here unchanged",
134
- );
135
- assert.match(
136
- section,
137
- /failing assertion aborts the rest of its test/,
138
- "the aborting-assertion behavior is no longer named generically — with it gone the ordinal trap reads as a quirk of someone else's runner",
139
- );
140
- });
141
-
142
- test("local references in the same file are still bare — the convention did not get applied to them", () => {
143
- // ACCEPT side. `PR #32` is this repo's own, MERGED, and correct as written;
144
- // an over-applied convention rewrites it to `feigi/claude-config#32`.
145
- assert.match(
146
- CORRECTIONS,
147
- /PR #32 measured/,
148
- "the local `PR #32` reference was rewritten — the convention covers foreign evidence only, and qualifying a local reference is the false positive it must not produce",
149
- );
150
- assert.doesNotMatch(
151
- CORRECTIONS,
152
- /feigi\/claude-config#/,
153
- "a local reference got the cross-repo qualified form; bare `#N` is correct and required for this repo's own issues and PRs",
154
- );
155
- });
@@ -1,83 +0,0 @@
1
- import { phrase } from "./prose-pin.mjs";
2
-
3
- // The inherited-cwd rule's pinned spans (#1433, #1673), spelled once.
4
- // review-core-cwd-isolation.test.mjs pins the rule into the prompts
5
- // (scripts/review-core.mjs) against these spans rather than transcribing its
6
- // own copy of the prose, so the pin and the prompt cannot silently drift
7
- // apart the way two independent copies of the same wording would.
8
- //
9
- // Three spans are TEXT, not RegExps, because at least one caller pins each of
10
- // them with the sentence that leads into it, passing `${leadIn} ${SPAN}`
11
- // through phrase(). phrase() trims and joins every whitespace run as `\s+`, so
12
- // the lead-in and the span stay one contiguous pin — never two assertions,
13
- // never a free-text `.{0,N}` gap a spliced exception could fit into. The rest
14
- // carry no lead-in anywhere and are exported ready to match.
15
-
16
- // Part 1, the inherited cwd named as a tree not to write to. The three
17
- // clauses have to arrive together or the rule is not the rule: "carries no
18
- // working directory of its own" alone is a fact with no instruction; naming
19
- // the controller's checkout alone reads as context; and "a relative path lands
20
- // THERE" is the only clause that says what to do differently.
21
- export const SPECIALIST_CWD =
22
- "this dispatch carries no working directory of its own, so you begin wherever the controller's own review cell is standing — its checkout, the tree it reads instruments.sh, ci-state.mjs and every gate decision out of. A relative path in any command lands THERE, not in the snapshot and not in your scratch dir.";
23
- export const REFUTER_CWD =
24
- "this dispatch carries no working directory of its own, so you begin wherever the controller's own review cell is standing — its checkout, the tree it reads every gate decision out of — and a relative path in any command lands THERE.";
25
-
26
- // Part 2, `pwd` first and the inherited directory a no-run zone. Both halves
27
- // in one span: `pwd` with no consequence attached is a print statement, and "a
28
- // no-run zone" naming no directory is unenforceable — the recorded failure is
29
- // an agent that BELIEVED it was somewhere else, which only a printed path
30
- // settles.
31
- export const PWD_FIRST = phrase("Run `pwd` as your FIRST command and keep the path it prints; that directory is a no-run zone from then on");
32
-
33
- // Part 2.5 (#1721): once PWD_FIRST fixes which directory the dispatch
34
- // inherited, each prompt goes on to claim where the snapshot and scratch dir
35
- // THEMSELVES are named as absolute paths — and the two dispatches word that
36
- // claim differently, because the fact differs between them. The specialist
37
- // prompt's scratch dir is only named several paragraphs LATER ("Scratch files
38
- // go in ${snap.runRoot}/${d.key}/"), so its own claim has to stay
39
- // location-neutral ("in this prompt") rather than "above" — "above" was false
40
- // there until #1721 fixed it. The refuter prompt's scratch dir IS named
41
- // earlier ("Scratch: ${snap.runRoot}/verify-${d.key}/..."), so "above" is
42
- // accurate there and is not a synonym for the specialist's span: rewording
43
- // either one to match the other would silently reintroduce #1721 in whichever
44
- // dispatch changed. Measured at PR #1825's review: reverting the specialist
45
- // prompt in ONE harness only, leaving the other on the fixed wording, left the
46
- // entire suite green — nothing previously pinned past PWD_FIRST's "no-run
47
- // zone from then on" on either dispatch.
48
- export const SCRATCH_NAMED_SPECIALIST = phrase(
49
- "and every command after it chains its own `cd` into the snapshot or into your scratch dir, both named in this prompt as absolute paths.",
50
- );
51
- export const SCRATCH_NAMED_REFUTER = phrase("and the snapshot and your scratch dir are both named above as absolute paths.");
52
-
53
- // Part 3, the positive self-check. The audit command and the report contract
54
- // are separate spans because they fail separately: a bare `--porcelain` is a
55
- // silently WRONG audit (a `status.showUntrackedFiles=no` config makes it print
56
- // nothing on a tree holding new files, which reads as clean), while a missing
57
- // report contract is an audit nobody can read.
58
- export const AUDIT_COMMAND =
59
- "`git -C <that path> status --porcelain -uall` — the explicit untracked mode, never bare `--porcelain`, which a `status.showUntrackedFiles=no` config silences into a false clean.";
60
-
61
- // The report contract. The field name is a capture group so a caller EXTRACTS
62
- // it from the rendered prompt rather than transcribing it, and checks it
63
- // against the schema that must carry it. Gaps are `\s+`, never literal spaces
64
- // — this prose is hard-wrapped at ~78 columns, so every one of them may be a
65
- // newline (measured: a literal-space version of this regex matched nothing).
66
- // The two prompts phrase this two different ways ("Report the result in" /
67
- // "Report it in") — one alternation between them, not two independent
68
- // optionals, which would also admit the dead combination neither prompt
69
- // writes ("Report the result it in").
70
- export const REPORT_FIELD = /Report\s+(?:the\s+result|it)\s+in\s+`(\w+)`\s+as\s+one\s+line\s+beginning\s+`CWD-AUDIT:`/;
71
-
72
- // Every state the audit line can take, and the clause that demands it on a
73
- // clean run. A state a prompt cannot spell is a state it will not report, and
74
- // an audit reported only when it finds something is indistinguishable from one
75
- // never run.
76
- export const AUDIT_STATES = ["clean", "dirty", "unrepo"];
77
- export const auditLine = (state) => phrase(`\`CWD-AUDIT: ${state} <path>`);
78
- export const EVERY_RUN = phrase("every run, clean or not");
79
-
80
- // One marker, spelled once, or a controller grepping a review's payload for it
81
- // finds half the reports — matched as a code span, since a reader cannot tell
82
- // a bare literal from the prose around it.
83
- export const CWD_AUDIT_MARKER = /`CWD-AUDIT:`/;
@@ -1,243 +0,0 @@
1
- // #151. `ledger.mjs check` is the fleet's duplicate-filing guard, and #145
2
- // rebuilt it into a real one — tracker query, `--state all`, overlap scoring,
3
- // a warned failure mode, exit 3 on a tracker hit. The path that files most of a
4
- // run's issues never called it: `review-and-fix.md` step 5 hand-rolled
5
- // `gh issue list --search` and the file contained zero occurrences of "ledger".
6
- // The measured 5x rediscovery of #114 came through that reviewer path — the
7
- // filed row in #145's own fixture is tagged `(review-pr-108)` — so the guard
8
- // had been improved on a path that was not the one producing duplicates.
9
- //
10
- // Two slices are pinned, because two different agents file issues and each
11
- // reads only its own instructions: the reviewer/fix-applier gets step 5, and
12
- // the finisher gets run-team's deferral-audit duty, whose "Not filed → file it"
13
- // branch is a filing site of its own. A fix reaching only one leaves the other
14
- // filing blind.
15
- //
16
- // The exit-code reading is pinned as tightly as the call itself, and for the
17
- // opposite failure. `check` exits 0 for BOTH `clean` and `unverified`, so an
18
- // instruction that reads exit 0 as a green light files over a tracker nobody
19
- // read; and exit 2 is a usage error where nothing was checked at all, so an
20
- // instruction that reads any non-zero as "duplicate" turns a deferral into a
21
- // silent drop. Getting the guard called is half the fix; getting it read
22
- // correctly is the other half.
23
- //
24
- // THE CEILING, same as fleet-tick-prose.test.mjs, issue-tracker-prose.test.mjs
25
- // and refuter-scratch-prose.test.mjs: these are PRESENCE pins over a bounded
26
- // slice. They prove a phrase is there and that the superseded instruction is
27
- // not; they cannot prove a later sentence in the same slice does not carve out
28
- // an exception. A reflow of the same words stays green by design.
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 } 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
- // run-team's finisher duties are an indented ordered list, so a hard wrap puts
40
- // leading spaces mid-phrase. Collapse whitespace so `\s+` spans a wrap.
41
- const flat = (s) => s.replace(/\s+/g, " ");
42
-
43
- // Flattened for the same reason as the run-team slices below. review-and-fix.md
44
- // authors one long line per step today, so this is a no-op on the current file —
45
- // but every pin here is a literal phrase with spaces in it, and the moment the
46
- // file is wrapped, whichever pin a break happens to land inside reds on words
47
- // that never changed. Measured at width 100: `never a dropped finding` split and
48
- // reddened test 4 while 80/120/140 stayed green, i.e. the class is present in
49
- // all five step-5 pins and line width merely samples which one fires.
50
- const step5 = () => flat(between(REVIEW_AND_FIX, "5. File each deferred finding", "\n6. Diff-check green", "review-and-fix step 5"));
51
- const finisherDeferrals = () =>
52
- flat(between(RUN_TEAM, "**Confirm every deferral — and every claimed APPLY —", "Add `ready-to-merge`", "run-team finisher duty 2"));
53
-
54
- test("step 5 files through ledger.mjs check, not its own gh search", () => {
55
- const s = step5();
56
- assert.match(s, /ledger\.mjs check/, "step 5 no longer calls the duplicate-filing guard");
57
- // The superseded instruction, verbatim. Reverting to it is the exact
58
- // regression this ticket exists to close, and the new text still names
59
- // `gh issue list --search` (to rule it out), so only the old *phrasing*
60
- // can be excluded here.
61
- assert.doesNotMatch(
62
- s,
63
- /`gh issue list --search` first/,
64
- "step 5 is back to hand-rolling its own dedupe search instead of calling ledger.mjs check",
65
- );
66
- // Presence of the call is not the same as being required by it. Measured
67
- // GREEN on "run `ledger.mjs check` if you like" without this.
68
- assert.doesNotMatch(
69
- s,
70
- /ledger\.mjs check[\s\S]{0,140}?(optional|if you like|may be skipped|need not)/i,
71
- "step 5 turned the dedupe guard into a suggestion",
72
- );
73
- });
74
-
75
- test("step 5 tells exit 1 from exit 3 — already filed this run vs a tracker hit", () => {
76
- const s = step5();
77
- assert.match(s, /\*\*1\*\*[^.]{0,60}already filed/i, "step 5 no longer says exit 1 means already filed in this run");
78
- assert.match(s, /\*\*3\*\*[^.]{0,90}tracker/i, "step 5 no longer says exit 3 is a tracker hit");
79
- });
80
-
81
- test("step 5 refuses to read exit 0 as a green light", () => {
82
- // `check` exits 0 for `clean` and for `unverified` alike. An unreachable
83
- // `gh` degrades to a ledger-only answer that prints TRACKER NOT CHECKED, and
84
- // `verdict` on stdout is the only thing separating the two.
85
- const s = step5();
86
- assert.match(s, /Exit 0 is not automatically\s+"?safe to file"?/i, "step 5 no longer warns that exit 0 can mean unverified");
87
- assert.match(s, /`verdict`/, "step 5 no longer points at the stdout field that separates clean from unverified");
88
- assert.match(s, /TRACKER NOT CHECKED/, "step 5 no longer names the string an unread tracker prints");
89
- assert.match(s, /\bunverified\b/, "step 5 no longer names the unverified verdict by its own value");
90
- });
91
-
92
- test("step 5 does not let the guard turn a deferral into a drop", () => {
93
- // The guard's own failure directions. Exit 2 is a usage error — nothing was
94
- // checked, so reading it as a duplicate drops the finding; and a real
95
- // duplicate is a comment on the existing issue, never a dropped finding.
96
- const s = step5();
97
- assert.match(s, /\*\*2\*\*[\s\S]{0,200}?never read it as a duplicate/i, "step 5 lets a usage error read as a duplicate, dropping the finding");
98
- assert.match(s, /never a dropped finding/i, "step 5 no longer says a duplicate is a comment rather than a dropped deferral");
99
- });
100
-
101
- test("step 5 cites a Run ledger section that exists in run-team", () => {
102
- // Step 5 defers the full exit-code and `verdict` semantics rather than
103
- // restating them — a cross-file citation that rots silently if the section
104
- // is renamed, since neither file's prose fails on its own.
105
- assert.match(step5(), /\*\*Run ledger\*\*/, "step 5 no longer defers the exit-code semantics to run-team's Run ledger section");
106
- assert.match(RUN_TEAM, /^## Run ledger$/m, "run-team no longer has a `## Run ledger` section for step 5 to cite");
107
- // And that section has to still carry what step 5 sends a reader there for.
108
- // Flattened like the sibling below: the slice is hard-wrapped Markdown, so an
109
- // un-flattened match reds on a pure reflow — the one thing the header at the
110
- // top of this file promises stays green.
111
- const runLedger = flat(between(RUN_TEAM, "## Run ledger", "\n## Report", "run-team Run ledger section"));
112
- assert.match(runLedger, /`verdict` is `already-filed`, `tracker-hit`, `clean`, `soft-hit` or `unverified`/, "the cited section no longer enumerates the verdict values");
113
- });
114
-
115
- test("step 5's exit-code readings agree with the section it cites", () => {
116
- // Step 5 cites run-team for the full semantics but states the reading of each
117
- // code inline, because the agent acting on it is mid-filing and a second file
118
- // read is a cost it will skip. Two copies of a number→meaning mapping drift,
119
- // and neither file fails on its own when they do: each stays internally
120
- // coherent while an agent reading one acts on the other's contract. So the
121
- // numbers are pinned on BOTH sides — renumbering in either file alone reddens
122
- // the suite, which is the only signal the split produces. One test per side,
123
- // though, and this is not the one holding step 5: it reads RUN_TEAM only, and
124
- // the step-5 side is pinned by "step 5 tells exit 1 from exit 3" above.
125
- // Measured: `exit **3**` → `exit **4**` in review-and-fix.md alone reds that
126
- // test and leaves this one green; the same edit in run-team alone inverts it.
127
- const runLedger = flat(between(RUN_TEAM, "## Run ledger", "\n## Report", "run-team Run ledger section"));
128
- assert.match(runLedger, /\*\*1\*\* already in this run's filed list/, "run-team no longer reads exit 1 as already filed this run — step 5 still does");
129
- assert.match(runLedger, /\*\*2\*\* usage\s+error/, "run-team no longer reads exit 2 as a usage error — step 5 still does");
130
- assert.match(runLedger, /\*\*3\*\* the ledger is clean but open or closed tracker issues match/, "run-team no longer reads exit 3 as a tracker hit — step 5 still does");
131
- // The exit-0 hazard is the one both files must state, not merely agree on:
132
- // it is the code that reads as permission.
133
- assert.match(runLedger, /Exit 0 is not\s+automatically "safe to file"/, "the cited section no longer warns that exit 0 can mean unverified");
134
- });
135
-
136
- test("both filing sites read soft-hit as rows to read rather than as permission", () => {
137
- // `soft-hit` exits 0, which is the code an instruction is most likely to read
138
- // as a green light — the same hazard `unverified` carries and the same reason
139
- // it is pinned above. A verdict no caller understands is worse than the wrong
140
- // verdict it replaced (#388), and there are two callers because two different
141
- // agents file issues and each reads only its own instructions.
142
- assert.match(step5(), /`soft-hit`[\s\S]{0,400}?read the rows/i, "step 5 names soft-hit without telling its reader to read the rows it printed");
143
- const runLedger = flat(between(RUN_TEAM, "## Run ledger", "\n## Report", "run-team Run ledger section"));
144
- assert.match(runLedger, /`soft-hit`[\s\S]{0,400}?read\s+them before filing/i, "the cited section names soft-hit without saying what to do about it");
145
- });
146
-
147
- test("the finisher verifies a claimed APPLY against the branch diff, not the applier's word", () => {
148
- // Duty 2 audits deferrals AND applies. The review ran against a snapshot cut
149
- // before the fix-applier's edits existed, so nothing but the finisher ever
150
- // checks that a claimed APPLY actually landed — measured once at five applies
151
- // where the controller's hand-written list named three.
152
- //
153
- // ONE bounded span, not two presence pins: a pin on the claim sentence alone
154
- // stays green with the verification command deleted, and a pin on the command
155
- // alone stays green with the duty reworded into a suggestion. Bounded rather
156
- // than exact so a reflow of the sentence between them survives, which is the
157
- // ceiling this whole file already accepts.
158
- assert.match(
159
- finisherDeferrals(),
160
- /\*\*A fix-applier's "applied" is a claim like any other\*\*.{0,200}?Confirm `git diff origin\/main\.\.\.HEAD` actually contains what it reported applying\./,
161
- "duty 2 no longer requires the finisher to verify a claimed APPLY against the branch diff — an applier's \"applied\" becomes self-certifying and a dropped fix ships labelled",
162
- );
163
- });
164
-
165
- test("the finisher files its own deferrals through the same guard", () => {
166
- // The finisher reaches `gh issue create` by a different route — auditing the
167
- // reviewer's deferrals and filing whatever is missing — so it is precisely
168
- // the agent most likely to re-file what a reviewer already filed.
169
- assert.match(finisherDeferrals(), /ledger\.mjs check/, "the finisher's file-it branch no longer runs the dedupe guard");
170
- });
171
-
172
- // ── Filers record what they file (#531) ──────────────────────────────────────
173
- //
174
- // `check`'s ledger arm — exit 1, `already-filed`, and the near-miss rows behind
175
- // `soft-hit` — reads a `## Filed` list, and until #531 no filing site wrote to
176
- // it: both sites ran `check` and then `gh issue create`, and the controller,
177
- // which owned every ledger write, never files. So the arm had never held a row.
178
- // The fix is the filer recording its own filing, under a ledger lock that lets
179
- // a second kind of writer exist; these pin the instruction half of it.
180
- const runLedger = () => flat(between(RUN_TEAM, "## Run ledger", "\n## Report", "run-team Run ledger section"));
181
- const finisherReport = () =>
182
- flat(between(RUN_TEAM, "4. Report you the label", "**Give the finisher the instrument", "run-team finisher duty 4"));
183
- const fixApplierReport = () =>
184
- flat(between(RUN_TEAM, "> Then report to the controller the pushed SHA", "**Deferring everything", "fix-applier report line"));
185
-
186
- test("both filing sites run `ledger.mjs filed` right after `gh issue create`, under the subject they checked", () => {
187
- // The subject is half of it: `check` matches the filed list by the words in
188
- // the subject, so a filing recorded under different words is one the next
189
- // `check` for the same finding can only score as a near miss, never exit 1.
190
- const s = step5();
191
- assert.match(s, /immediately after each `gh issue create`, run `[^`]*ledger\.mjs filed <N> "<subject>"`/, "step 5 no longer records the issue it just created");
192
- assert.match(s, /the same subject string you passed to `check`/, "step 5 no longer ties the recorded subject to the one it checked");
193
- const f = finisherDeferrals();
194
- assert.match(f, /`ledger\.mjs filed <N> "<subject>"` immediately after `gh issue create`/, "the finisher's file-it branch no longer records the issue it created");
195
- assert.match(f, /the same subject string you passed to `check`/, "the finisher no longer ties the recorded subject to the one it checked");
196
- });
197
-
198
- test("a failed `filed` is retried once, then reported unrecorded — never a second issue", () => {
199
- // The issue exists and is correct once `gh issue create` returned; only its
200
- // ledger row is missing. Re-filing to "fix" that makes the duplicate the
201
- // whole guard exists to stop.
202
- for (const [where, s] of [["step 5", step5()], ["finisher duty 2", finisherDeferrals()]]) {
203
- assert.match(s, /retry (it )?once/, `${where} no longer retries a failed \`filed\``);
204
- assert.match(s, /leave the issue alone — it exists and is correct/, `${where} no longer says to leave a created issue alone`);
205
- assert.match(s, /`unrecorded: #N <subject>`/, `${where} no longer reports a filing it could not record`);
206
- }
207
- });
208
-
209
- test("both report contracts carry `filed: #N <subject>` and the `unrecorded:` fallback", () => {
210
- for (const [where, s] of [["fix-applier report", fixApplierReport()], ["finisher duty 4", finisherReport()], ["step 5", step5()]]) {
211
- assert.match(s, /`filed: #N <subject>`/, `${where} no longer returns the issues it filed`);
212
- }
213
- for (const [where, s] of [["fix-applier report", fixApplierReport()], ["finisher duty 4", finisherReport()]]) {
214
- assert.match(s, /`unrecorded: #N <subject>`/, `${where} no longer carries the unrecorded fallback`);
215
- }
216
- });
217
-
218
- test("the controller records every filing a filer reported unrecorded", () => {
219
- // The fallback is only a fallback if someone acts on it: an `unrecorded:`
220
- // line nobody turns into a `filed` row leaves the arm exactly as blind as
221
- // before, one filing at a time.
222
- const table = between(RUN_TEAM, "| Wake | Record, then tick |", "\n\n", "record-before-tick table");
223
- for (const wake of ["Fix-applier report", "Finisher report", "Finisher report (halted)"]) {
224
- const row = table.split("\n").find((r) => r.startsWith(`| ${wake} |`)) ?? "";
225
- assert.match(row, /`ledger\.mjs filed <N> "<subject>"` for each `unrecorded:` line/, `the "${wake}" wake no longer records unrecorded filings`);
226
- }
227
- assert.match(runLedger(), /reports `unrecorded: #N <subject>` instead, and you run `filed` for it/, "the Run ledger section no longer hands unrecorded filings to the controller");
228
- });
229
-
230
- test("the Run ledger section states the writer policy and the check→create gap; step 5 states the gap too", () => {
231
- const r = runLedger();
232
- assert.match(
233
- r,
234
- /the controller owns run state \(`row`\/`settle`\/`dispatch`\/`drain`\/`ruled`\); filers append filings with `filed`; all writes are serialized by `<file>\.lock`/,
235
- "the Run ledger section no longer states who writes what, and that the lock serializes it",
236
- );
237
- // The lock covers each command alone. Stated at the section and at the
238
- // filing site, so neither reader takes the lock for a reservation.
239
- for (const [where, s] of [["Run ledger", r], ["step 5", step5()]]) {
240
- assert.match(s, /`check` → `gh issue create` → `filed` is three commands/, `${where} no longer states the check→create gap`);
241
- assert.match(s, /both read `clean`/, `${where} no longer says what the gap lets through`);
242
- }
243
- });