@feigi/fleet-ctl 3.23.36 → 3.23.38

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 (205) hide show
  1. package/package.json +1 -1
  2. package/scripts/cell-readout.mjs +38 -11
  3. package/scripts/main-checkout.mjs +1 -1
  4. package/scripts/member-write-guard.mjs +1 -1
  5. package/scripts/repo-root.mjs +1 -1
  6. package/skills/run-team/references/reaping.md +1 -1
  7. package/scripts/agent-test-dir-prose.test.mjs +0 -59
  8. package/scripts/agent-test.test.mjs +0 -1640
  9. package/scripts/ambient-git-vars-mjs-prose.test.mjs +0 -397
  10. package/scripts/ambient-git-vars-prose.test.mjs +0 -192
  11. package/scripts/ancestry-check-position-prose.test.mjs +0 -175
  12. package/scripts/apply-ruleset.test.mjs +0 -421
  13. package/scripts/arg-header-probes-prose.test.mjs +0 -394
  14. package/scripts/arg.test.mjs +0 -1354
  15. package/scripts/board-cli.test.mjs +0 -710
  16. package/scripts/board-identity.test.mjs +0 -429
  17. package/scripts/board-liveness-banner.test.mjs +0 -119
  18. package/scripts/board-prev-shape.test.mjs +0 -228
  19. package/scripts/board-tryparse-null.test.mjs +0 -119
  20. package/scripts/board.test.mjs +0 -3121
  21. package/scripts/brief-after-cut-prose.test.mjs +0 -53
  22. package/scripts/candidates-exit3-prose.test.mjs +0 -302
  23. package/scripts/candidates.test.mjs +0 -2312
  24. package/scripts/caveat-unification-prose.test.mjs +0 -98
  25. package/scripts/cell-readout.test.mjs +0 -615
  26. package/scripts/ci-comment-rot-prose.test.mjs +0 -2025
  27. package/scripts/ci-completes-premise-prose.test.mjs +0 -257
  28. package/scripts/ci-state-prose.test.mjs +0 -113
  29. package/scripts/ci-state.test.mjs +0 -1933
  30. package/scripts/ci-vacuous-green.test.mjs +0 -368
  31. package/scripts/citation-sweep-prose.test.mjs +0 -1712
  32. package/scripts/claim-lifecycle.test.mjs +0 -187
  33. package/scripts/claim-ticket.test.mjs +0 -1122
  34. package/scripts/closing-keyword-prose.test.mjs +0 -193
  35. package/scripts/cockpit-launch-idempotent-prose.test.mjs +0 -165
  36. package/scripts/cockpit-tick-nonblocking.test.mjs +0 -210
  37. package/scripts/compute-board.test.mjs +0 -1214
  38. package/scripts/compute-spend.test.mjs +0 -517
  39. package/scripts/consumer-technology-prose.test.mjs +0 -126
  40. package/scripts/cross-repo-citation-prose.test.mjs +0 -155
  41. package/scripts/cwd-isolation-pins.mjs +0 -83
  42. package/scripts/dedupe-guard-prose.test.mjs +0 -243
  43. package/scripts/delete-merged-branch.test.mjs +0 -576
  44. package/scripts/derive-testcmd.test.mjs +0 -595
  45. package/scripts/diff-stats.test.mjs +0 -404
  46. package/scripts/dispatch-block-golden-prose.test.mjs +0 -1130
  47. package/scripts/dispatch-block-pins-prose.test.mjs +0 -615
  48. package/scripts/dispositions-check.test.mjs +0 -936
  49. package/scripts/dispositions-gate-prose.test.mjs +0 -129
  50. package/scripts/drop-merged-label.test.mjs +0 -479
  51. package/scripts/exec-stub.mjs +0 -93
  52. package/scripts/exec-stub.test.mjs +0 -69
  53. package/scripts/expected-jobs-prose.test.mjs +0 -80
  54. package/scripts/fan-out-authorization-prose.test.mjs +0 -80
  55. package/scripts/filing-bar-seat-prose.test.mjs +0 -242
  56. package/scripts/filing-claim-bar-prose.test.mjs +0 -166
  57. package/scripts/finisher-died-prose.test.mjs +0 -31
  58. package/scripts/finisher-dispatch-premise-prose.test.mjs +0 -312
  59. package/scripts/finisher-halt-prose.test.mjs +0 -106
  60. package/scripts/finisher-name-prose.test.mjs +0 -134
  61. package/scripts/finisher-own-tree-prose.test.mjs +0 -299
  62. package/scripts/finisher-pin-race-prose.test.mjs +0 -339
  63. package/scripts/finisher-test-verdict-prose.test.mjs +0 -102
  64. package/scripts/fix-applier-correction-rules-prose.test.mjs +0 -202
  65. package/scripts/fix-applier-result-file-prose.test.mjs +0 -149
  66. package/scripts/fleet-bootstrap.test.mjs +0 -75
  67. package/scripts/fleet-heartbeat.test.mjs +0 -450
  68. package/scripts/fleet-provenance.test.mjs +0 -138
  69. package/scripts/fleet-run.test.mjs +0 -90
  70. package/scripts/fleet-state.test.mjs +0 -460
  71. package/scripts/fleet-tick-prose.test.mjs +0 -300
  72. package/scripts/fleet-tick.test.mjs +0 -2444
  73. package/scripts/force-with-lease-reason-prose.test.mjs +0 -184
  74. package/scripts/frontmatter-check.test.mjs +0 -436
  75. package/scripts/git-env.test.mjs +0 -149
  76. package/scripts/git-status-untracked-mode-sweep.test.mjs +0 -216
  77. package/scripts/gone-walk.test.mjs +0 -213
  78. package/scripts/gp-sep-invariant-prose.test.mjs +0 -188
  79. package/scripts/head-moved-after-label-prose.test.mjs +0 -233
  80. package/scripts/immutable-body-claim-prose.test.mjs +0 -204
  81. package/scripts/implementer-model-tier.test.mjs +0 -235
  82. package/scripts/inflight-citation-prose.test.mjs +0 -144
  83. package/scripts/inflight-exit2-prose.test.mjs +0 -81
  84. package/scripts/inflight-probe-guard-prose.test.mjs +0 -109
  85. package/scripts/inflight-scan-scope-prose.test.mjs +0 -57
  86. package/scripts/inflight.test.mjs +0 -2882
  87. package/scripts/injection-control-prose.test.mjs +0 -404
  88. package/scripts/install-root-audit.test.mjs +0 -464
  89. package/scripts/instrument-check-prose.test.mjs +0 -235
  90. package/scripts/instruments.test.mjs +0 -787
  91. package/scripts/is-cli.test.mjs +0 -99
  92. package/scripts/issue-tracker-prose.test.mjs +0 -71
  93. package/scripts/json.test.mjs +0 -364
  94. package/scripts/ledger-dispatch.test.mjs +0 -927
  95. package/scripts/ledger-grammar.test.mjs +0 -227
  96. package/scripts/ledger-read-require-file.test.mjs +0 -197
  97. package/scripts/ledger-rotate.test.mjs +0 -142
  98. package/scripts/ledger.test.mjs +0 -3436
  99. package/scripts/line-distance-prose.test.mjs +0 -245
  100. package/scripts/liveness-rationale-prose.test.mjs +0 -83
  101. package/scripts/locale-pin-prose.test.mjs +0 -189
  102. package/scripts/main-checkout.test.mjs +0 -332
  103. package/scripts/member-outcome-prose.test.mjs +0 -167
  104. package/scripts/member-outcomes-header.test.mjs +0 -129
  105. package/scripts/member-outcomes-prose.test.mjs +0 -63
  106. package/scripts/member-outcomes.test.mjs +0 -638
  107. package/scripts/member-prompt-prose.test.mjs +0 -165
  108. package/scripts/member-record.test.mjs +0 -541
  109. package/scripts/member-write-guard.test.mjs +0 -214
  110. package/scripts/merge-commit-probe-prose.test.mjs +0 -122
  111. package/scripts/merge-gate.test.mjs +0 -613
  112. package/scripts/muted-git-guard-sweep.test.mjs +0 -493
  113. package/scripts/net-ssh-precedence-prose.test.mjs +0 -91
  114. package/scripts/net-watchdog-prose.test.mjs +0 -79
  115. package/scripts/net.test.mjs +0 -211
  116. package/scripts/no-ci-gate-prose.test.mjs +0 -108
  117. package/scripts/no-undo-audit.test.mjs +0 -3961
  118. package/scripts/no-wave.test.mjs +0 -138
  119. package/scripts/node-floor-sweep.test.mjs +0 -611
  120. package/scripts/pointer-target-prose.test.mjs +0 -186
  121. package/scripts/pr-cost.test.mjs +0 -521
  122. package/scripts/pr-overlap.test.mjs +0 -692
  123. package/scripts/printf-die-sweep.test.mjs +0 -384
  124. package/scripts/prompt-renderer.mjs +0 -40
  125. package/scripts/prompt-renderer.test.mjs +0 -68
  126. package/scripts/prose-pin.mjs +0 -807
  127. package/scripts/prose-pin.test.mjs +0 -1034
  128. package/scripts/prove-merge.test.mjs +0 -995
  129. package/scripts/pull-table-relabel-prose.test.mjs +0 -60
  130. package/scripts/quiet-payload-prose.test.mjs +0 -222
  131. package/scripts/reap-cherry-check-prose.test.mjs +0 -80
  132. package/scripts/reap.test.mjs +0 -4432
  133. package/scripts/reaping-prose.test.mjs +0 -239
  134. package/scripts/reaping-reap-authorizers-prose.test.mjs +0 -112
  135. package/scripts/reaping-release-authorizers-prose.test.mjs +0 -85
  136. package/scripts/recipe-derivation-prose.test.mjs +0 -112
  137. package/scripts/recipe-prove.test.mjs +0 -1042
  138. package/scripts/refuter-scratch-prose.test.mjs +0 -135
  139. package/scripts/release-label-required-prose.test.mjs +0 -71
  140. package/scripts/release-label-split-prose.test.mjs +0 -184
  141. package/scripts/release-ticket-reap-pairing-prose.test.mjs +0 -63
  142. package/scripts/release-ticket.test.mjs +0 -5099
  143. package/scripts/renovate-release-contract.test.mjs +0 -379
  144. package/scripts/repo-root.test.mjs +0 -873
  145. package/scripts/reporter-output-rule-prose.test.mjs +0 -208
  146. package/scripts/review-agent-report-only.test.mjs +0 -49
  147. package/scripts/review-core-booking.test.mjs +0 -35
  148. package/scripts/review-core-cwd-isolation.test.mjs +0 -374
  149. package/scripts/review-core-reads.test.mjs +0 -478
  150. package/scripts/review-core-refuter-scratch.test.mjs +0 -148
  151. package/scripts/review-core-scratch-refusal.test.mjs +0 -64
  152. package/scripts/review-core-shared-test-run.test.mjs +0 -275
  153. package/scripts/review-core-snapshot-path.test.mjs +0 -830
  154. package/scripts/review-core-specialist-scratch.test.mjs +0 -191
  155. package/scripts/review-core-testcmd.test.mjs +0 -335
  156. package/scripts/review-core-unrun.test.mjs +0 -566
  157. package/scripts/review-core-unverified-discriminant.test.mjs +0 -208
  158. package/scripts/review-eval-resolver-path.test.mjs +0 -55
  159. package/scripts/review-host-fixture.mjs +0 -89
  160. package/scripts/review-in-run-retry.test.mjs +0 -211
  161. package/scripts/review-no-vendor-dispatch.test.mjs +0 -45
  162. package/scripts/review-path-default.test.mjs +0 -796
  163. package/scripts/review-runner-spawns.test.mjs +0 -95
  164. package/scripts/review-runner.test.mjs +0 -166
  165. package/scripts/review-tier-audit.test.mjs +0 -140
  166. package/scripts/run-artifact-pr-prose.test.mjs +0 -341
  167. package/scripts/run-merge-bot-prose.test.mjs +0 -1413
  168. package/scripts/run-team-local-hook.test.mjs +0 -442
  169. package/scripts/scratch-partition-invariant-prose.test.mjs +0 -74
  170. package/scripts/scripts-path-citation-sweep.test.mjs +0 -73
  171. package/scripts/section-between-guard-prose.test.mjs +0 -379
  172. package/scripts/select-dimensions.test.mjs +0 -674
  173. package/scripts/shared-refusal.test.mjs +0 -388
  174. package/scripts/shell-traps-prose.test.mjs +0 -504
  175. package/scripts/shortlist.test.mjs +0 -380
  176. package/scripts/slow-transport.mjs +0 -72
  177. package/scripts/snapshot-repo.test.mjs +0 -1006
  178. package/scripts/snapshot-runner-audience-prose.test.mjs +0 -130
  179. package/scripts/spend-view.test.mjs +0 -312
  180. package/scripts/staleness-qualifier-prose.test.mjs +0 -251
  181. package/scripts/staleness-verdict-prose.test.mjs +0 -142
  182. package/scripts/staleness.test.mjs +0 -893
  183. package/scripts/stalled-member-liveness-prose.test.mjs +0 -219
  184. package/scripts/stash-prohibition-prose.test.mjs +0 -313
  185. package/scripts/strip-comments.mjs +0 -44
  186. package/scripts/temp-dir.mjs +0 -47
  187. package/scripts/ticket-router.test.mjs +0 -981
  188. package/scripts/tier-check.test.mjs +0 -828
  189. package/scripts/tier-outcomes-header.test.mjs +0 -518
  190. package/scripts/tier-outcomes.test.mjs +0 -572
  191. package/scripts/tier-roles.test.mjs +0 -535
  192. package/scripts/tracker-block-copy-prose.test.mjs +0 -288
  193. package/scripts/triage-labels-gloss-prose.test.mjs +0 -97
  194. package/scripts/unattended-git-sweep.test.mjs +0 -142
  195. package/scripts/verify-sha-exit2-prose.test.mjs +0 -269
  196. package/scripts/verify-sha.test.mjs +0 -692
  197. package/scripts/watcher-degraded-block.test.mjs +0 -369
  198. package/scripts/watcher-key-prose.test.mjs +0 -106
  199. package/scripts/within-run-pair-prose.test.mjs +0 -212
  200. package/scripts/worktree-audit.test.mjs +0 -1408
  201. package/scripts/worktree-head-prose.test.mjs +0 -276
  202. package/scripts/worktree-listing-sweep.test.mjs +0 -217
  203. package/scripts/worktree-model-prose.test.mjs +0 -216
  204. package/scripts/worktree-porcelain.mjs +0 -35
  205. package/scripts/worktree-porcelain.test.mjs +0 -102
@@ -1,341 +0,0 @@
1
- // #944. run-team's phase-2 tier-guard step tells the controller to produce two
2
- // files under `docs/metrics/` and said only that neither commits itself. What it
3
- // never said was where they go: `grep -niE 'run-artifacts|tier-rows|chore/'
4
- // plugin/skills/run-team/SKILL.md` returned nothing before this ticket, so the
5
- // branch convention every close-out has actually used existed on controller
6
- // habit alone — and habit strands things. Three measured strandings, one shape:
7
- // the artifacts ended up outside `main` behind a question nobody owned.
8
- //
9
- // Three rules now carry it, and this file pins all three. None is a new
10
- // decision; each is settled by prose already in the same document, which is why
11
- // each pin below cites where it is settled rather than asserting it fresh:
12
- //
13
- // 1. the branch is `chore/run-artifacts-<date>` — the shape phase 0's own
14
- // fast-forward step already tells the next controller to look for ("the
15
- // PREVIOUS run's own close-out PR: it lands the rules THIS run needs");
16
- // 2. data rows and rule-doc prose never share a PR, and the data branch
17
- // carries the two `docs/metrics/` files and nothing else — the load-bearing
18
- // one, because the two halves have opposite cost profiles and bundling
19
- // makes the cheap-to-strand half gate the expensive one;
20
- // 3. the `ready-to-merge`-by-reviewer-only invariant does not reach a
21
- // controller-authored artifact PR, stated in that invariant's own bullet so
22
- // the next controller does not re-derive a blocker from it.
23
- //
24
- // WHY THE SLICES ARE PARAGRAPH- AND BULLET-TIGHT. A positive regex over a whole
25
- // markdown section is a vacuous pin: this document says "chore PR" in phase 0
26
- // and again under `## Queue depth`, and it says `docs/metrics/tier-outcomes.tsv`
27
- // in multiple other places, so a file-wide match is bought by prose that has nothing to do
28
- // with the rule and survives the rule's deletion. Slice size is what anchors a
29
- // prose pin. Rules 1 and 2 share one slice bounded by two landmark phrases —
30
- // the sentence that introduces them and the next unrelated bolded lead — never
31
- // `paragraph`'s blank-line bound. Rule 3 lives in a list item with no blank
32
- // line before the next one, so it is bounded by its own landmark phrase and
33
- // cut at the next top-level bullet (`\n- `), built from the same `anchorAt`
34
- // uniqueness check rather than a local copy of `paragraph`'s slicer — the
35
- // shape `quiet-payload-prose.test.mjs` already uses for an end bound that is
36
- // not a blank line.
37
- //
38
- // WHY EACH RULE HAS A BAN BESIDE ITS PHRASE. A presence check is satisfied by a
39
- // sentence that repudiates it from elsewhere in the same slice, so the three
40
- // hazards that keep a phrase pin green while gutting the rule are banned
41
- // structurally: permission to bundle (rule 2), a reviewer requirement on the
42
- // controller's own artifact PR (rule 3), and a negated commit duty (rule 1).
43
- //
44
- // THE ONE REGEX THIS FILE MUST NOT HAVE is a bare /is not exempt/ for rule 3's
45
- // inversion. The invariant's own tail says "a chore PR is not exempt from being
46
- // wrong" — the true half that keeps the exemption narrow, settled by phase 0's
47
- // step 0 (#1222, #1237) — so that regex reds the correct document. The inversion
48
- // is caught by the phrase pin instead, and the fixture for it is below.
49
- //
50
- // THE CEILING: this proves the three rules are stated and not contradicted from
51
- // inside their own slices. It cannot prove a controller follows them, and it
52
- // does not touch rule 3-of-the-ticket, the `fleet-tick.mjs` backlog filter —
53
- // that one was already implemented, already pinned by "CLI: a PR that closes no
54
- // issue is not review backlog (#590)" in `fleet-tick.test.mjs`, and needed no
55
- // change.
56
- import { test } from "node:test";
57
- import assert from "node:assert/strict";
58
- import { readFileSync } from "node:fs";
59
- import { join } from "node:path";
60
- import { anchorAt, betweenPhrases, phrase, sentences } from "./prose-pin.mjs";
61
-
62
- const REPO = join(import.meta.dirname, "..");
63
- const RUN_TEAM = readFileSync(join(REPO, "skills", "run-team", "SKILL.md"), "utf8");
64
-
65
- // Rules 1 and 2 share one slice, bounded by two landmarks NEITHER rule owns:
66
- // the sentence that introduces them (which #944 did not write — it already said
67
- // the files do not commit themselves and stopped there) and the bolded lead of
68
- // the next unrelated paragraph. This is deliberate and it is the second thing
69
- // this file got wrong. Anchoring each rule on its OWN bolded lead, the obvious
70
- // shape, puts the slice anchor inside the text every deletion fixture replaces:
71
- // `betweenPhrases` (extracted #1611 from a hand-rolled copy of this same
72
- // anchor-to-bound-slice pattern in `finisher-dispatch-premise-prose.test.mjs`)
73
- // THROWS on the mutant instead of the pin reddening, which is not a pin
74
- // discriminating, it is the harness losing its footing — and a thrown anchor
75
- // reads as "re-anchor this test" to whoever next deletes the rule.
76
- //
77
- // Both bounds go through `phrase`, so a reflow of either cannot move them, and
78
- // both are proven single-hit:
79
- // grep -cF "Both files are the run's own artifacts and neither commits itself" → 1
80
- // grep -cF '**Why not decide inside one run.**' → 1
81
- //
82
- // The cost of one slice for two rules is the fat-slice hazard: rule 2's
83
- // paragraph could in principle satisfy a pin on rule 1. That is not left to
84
- // judgement — the "branch name is dropped" and "split rule is deleted" fixtures
85
- // below each red exactly one pin, which is what proves the two rules are pinned
86
- // separately inside a shared bound.
87
- //
88
- // No `bound` option: unbounded, the same reach this slice always had — the
89
- // only change from the hand-rolled version is the exactly-once end-guard
90
- // `betweenPhrases` adds for free, so a duplicated restatement of the end
91
- // phrase now throws instead of silently binding the first copy.
92
- const ARTIFACT_FROM = "Both files are the run's own artifacts and neither commits itself";
93
- const ARTIFACT_TO = "**Why not decide inside one run.**";
94
- const artifactRules = (text = RUN_TEAM) => betweenPhrases(text, ARTIFACT_FROM, ARTIFACT_TO, "run-team artifact-PR rules");
95
-
96
- // Rule 3's bullet under `## Invariants`, bounded at the next top-level list
97
- // item. Not `paragraph`: the bullets are adjacent, so a blank-line bound would
98
- // swallow the rest of the section and every pin below would be satisfiable from
99
- // a neighbouring invariant. Continuation lines are indented, so `\n- ` is the
100
- // item boundary and cannot match inside the item itself. The anchor here is the
101
- // invariant's original sentence, which #944 left untouched and no fixture below
102
- // rewrites — the same stability the artifact bounds above are chosen for.
103
- const invariant = (text = RUN_TEAM) => {
104
- const what = "run-team ready-to-merge invariant";
105
- const rest = text.slice(anchorAt(text, "`ready-to-merge` is added by a reviewer only", what));
106
- const end = rest.search(/\n- /);
107
- return end === -1 ? rest : rest.slice(0, end);
108
- };
109
-
110
- // Each duty as a wrap-tolerant PHRASE, never as the words it is built from.
111
- // `phrase` puts `\s+` at every word gap, so a hard wrap landing anywhere inside
112
- // is fine while a negation, a rescoping or a restatement is not.
113
- //
114
- // BRANCH_DUTY deliberately carries the branch name INSIDE the pinned phrase.
115
- // The imperative alone ("commit both and open a PR") is the part that was
116
- // already true in spirit and is not what #944 fixed; the NAME is the
117
- // deliverable, because a close-out PR the next controller cannot find by shape
118
- // is the stranding this rule ends. The phrase also carries the paragraph's own
119
- // normative claim — "the convention rather than a suggestion" — so demoting
120
- // the branch name to optional guidance reds this pin too, not just deleting or
121
- // renaming it.
122
- const BRANCH_DUTY = phrase("Commit both to `chore/run-artifacts-<date>` and open a PR — at end of run, and that branch name is the convention rather than a suggestion");
123
- // The belt for a negation that keeps the capital and so slips past BRANCH_DUTY's
124
- // leading `Commit`. Scoped to this paragraph's own verbs. KNOWN GAP: the
125
- // negation must sit immediately before the verb (`\s+`, nothing between) — one
126
- // placed elsewhere in the sentence, semantically identical, evades this.
127
- // Widening to scan the whole paragraph is unsafe: this paragraph's own
128
- // accept-direction text pairs an unrelated "not" ("does not own") with
129
- // "commit" ("Commit both to"), so an undirected match would redden the real,
130
- // correct document. See the "KNOWN GAP" test below the mutants loop for the
131
- // fixture that pins this as a documented limitation, not a silent hole.
132
- const NO_COMMIT = /(?:\bnot|\bnever|n't)\s+(?:commit|open|push)\b/i;
133
-
134
- const SPLIT_DUTY = phrase("Data rows and rule-doc prose never share a PR — one branch each");
135
- // Rule 2's operative half: what the data branch is allowed to carry. Without
136
- // this, "never share a PR" survives while the branch quietly grows a prose
137
- // exception, which is exactly the bundling the rule forbids.
138
- const ONLY_METRICS = phrase("carries the two `docs/metrics/` files and nothing else");
139
- // Permission to bundle, however it is spelled. Bans the modal reaching a
140
- // sharing verb rather than a list of wordings — enumerating wordings catches the
141
- // one it was written from and nothing adjacent. `own PR`/`own branch` are the
142
- // rule's own words for the opposite arrangement and are not modals, so they do
143
- // not collide. A second alternation catches indicative-mood permission with no
144
- // modal at all ("is allowed to ride", "unless ... put it on the data branch"),
145
- // co-located with the same sharing vocabulary plus `same PR`/`one PR`/`data
146
- // branch`, since the modal list alone let both proven phrasings through.
147
- const MAY_BUNDLE = /\b(?:may|can|could|might)\b[\s\S]{0,60}\b(?:share|bundle|bundled|accompany|travel|ride)\b|\b(?:allowed|licensed|fine|ok|permitted|unless|except)\b[\s\S]{0,60}\b(?:ride|share|same\s+PR|one\s+PR|data\s+branch)\b/i;
148
-
149
- const EXEMPT_DUTY = phrase("The run's own artifact PR is exempt, and it is exempt because this invariant does not reach it");
150
- // The positive duty the exemption exists to license. A slice that states the
151
- // exemption and then withholds the action is a rule nobody can act on.
152
- const LABEL_DUTY = phrase("Label and merge that one yourself");
153
- // A reviewer requirement re-imposed on the controller's own artifact PR. Must
154
- // not collide with the bullet's true tail, which sends a LEFTOVER artifact PR
155
- // into the next run's review queue on purpose: that clause says "review queue",
156
- // never that this run's PR needs a review or a reviewer first. Three more
157
- // alternations catch phrasing the keyword list above misses: passive "must
158
- // still be reviewed", "reviewed first/before", and approve/sign-off language —
159
- // none of which collide with "review queue" either.
160
- const NEEDS_REVIEW =
161
- /\b(?:needs?|requires?|await|awaits|wait\s+for|must\s+(?:get|have|obtain))\b[\s\S]{0,60}\b(?:reviewer|review-pr|a\s+review)\b|\b(?:must|has\s+to|needs?\s+to|should)\b[\s\S]{0,40}\bbe\s+review|\breview(?:ed)?\s+(?:first|before)\b|\b(?:approve[ds]?|approval|sign(?:ed)?[- ]off)\b/i;
162
-
163
- // The sentences of `slice` a fault pattern matches. MAY_BUNDLE and NEEDS_REVIEW
164
- // are NEGATIVE — a match is the failure — so a window cut short is their silent
165
- // direction, and a first-period `[^.]` gap cut one short at every "e.g.",
166
- // `SKILL.md` or `v1.2` between the permission word and the sharing or review
167
- // word (#1983). The gap tolerates a period now, and the SENTENCE, from
168
- // `sentences()`, is what bounds it: widened over the raw slice instead, the gap
169
- // would pair a modal in one sentence with a verb in the next. RESIDUAL:
170
- // sentences() still cuts short at a `.)`, `."`, a mid-sentence `?`, a
171
- // capitalised "E.g." or an "etc." (silent here — none of those four is in
172
- // either slice today), and still merges two real sentences across #1987's
173
- // `**late**.[1]` and #1899's sentence-final lowercase "vs." (an over-fire
174
- // here, also absent today). `.**` itself IS in the artifact-rules slice
175
- // (twice) and absent from the invariant slice, but both occurrences are
176
- // genuine sentence boundaries, neither straddling a permission/review fact.
177
- const faults = (pattern, slice) => sentences(slice).filter((s) => pattern.test(s));
178
-
179
- // Every pin in one place, so a fixture asserts WHICH pins fire rather than that
180
- // something somewhere went red — a pin that reddens on the wrong mutant has
181
- // discriminated nothing.
182
- const PINS = {
183
- branch: (t) => !BRANCH_DUTY.test(artifactRules(t)),
184
- noCommit: (t) => NO_COMMIT.test(artifactRules(t)),
185
- split: (t) => !SPLIT_DUTY.test(artifactRules(t)),
186
- onlyMetrics: (t) => !ONLY_METRICS.test(artifactRules(t)),
187
- mayBundle: (t) => faults(MAY_BUNDLE, artifactRules(t)).length > 0,
188
- exempt: (t) => !EXEMPT_DUTY.test(invariant(t)),
189
- label: (t) => !LABEL_DUTY.test(invariant(t)),
190
- needsReview: (t) => faults(NEEDS_REVIEW, invariant(t)).length > 0,
191
- };
192
- const firing = (text) => Object.keys(PINS).filter((name) => PINS[name](text));
193
-
194
- test("the artifact PR gets a branch name, not just an instruction to commit", () => {
195
- const slice = artifactRules();
196
- // Positive control against a vacuous pin: a stale bound matching an empty or
197
- // anchor-length slice would satisfy every doesNotMatch below while asserting
198
- // nothing.
199
- assert.ok(slice.length > 400, `the artifact-PR rules sliced down to ${slice.length} chars — the extractor is broken, not the docs`);
200
- assert.match(slice, BRANCH_DUTY, "the phase-2 step no longer names `chore/run-artifacts-<date>` as the branch both metrics files go to — renamed the convention on purpose? update BRANCH_DUTY. Do not delete it");
201
- assert.doesNotMatch(slice, NO_COMMIT, "the artifact-PR rules now say NOT to commit or open the PR they exist to require");
202
- });
203
-
204
- test("data rows and rule-doc prose are kept to separate PRs, and the data branch to the metrics files", () => {
205
- const slice = artifactRules();
206
- assert.match(slice, SPLIT_DUTY, "the load-bearing rule — data rows and rule-doc prose never share a PR — is no longer stated word for word");
207
- assert.match(slice, ONLY_METRICS, "the artifact branch is no longer scoped to the two `docs/metrics/` files, so 'never share a PR' has nothing left to bite on");
208
- assert.deepEqual(faults(MAY_BUNDLE, slice), [], "the split rule now licenses the bundling it forbids");
209
- });
210
-
211
- test("the ready-to-merge invariant states its own artifact-PR exemption", () => {
212
- const slice = invariant();
213
- assert.ok(slice.length > 200, `the ready-to-merge invariant sliced down to ${slice.length} chars — the extractor is broken, not the docs`);
214
- assert.match(slice, EXEMPT_DUTY, "the `ready-to-merge` invariant no longer says the run's own artifact PR is outside it, which is the blocker #619 re-derived");
215
- assert.match(slice, LABEL_DUTY, "the exemption no longer tells the controller to label and merge that PR itself, so it licenses nothing");
216
- assert.deepEqual(faults(NEEDS_REVIEW, slice), [], "the invariant re-imposes a reviewer on the controller's own artifact PR");
217
- });
218
-
219
- test("the invariant slice stops at its own bullet", () => {
220
- // The bound is the pin. Widened to the section, the neighbouring invariants
221
- // would satisfy a phrase pin on their own and the exemption could be deleted
222
- // green.
223
- const slice = invariant();
224
- assert.ok(slice.startsWith("`ready-to-merge` is added by a reviewer only"), "the invariant slice no longer starts at its own bullet");
225
- assert.doesNotMatch(slice, /Every member acts through the maintainer/, "the invariant slice ran past its bullet into the next one");
226
- });
227
-
228
- // The refuse direction. Every mutation asserts it changed the document before it
229
- // is scored, because a mutation that fails to apply is green in exactly the way
230
- // a pin that does not bite is green — and this prose hard-wraps, so every search
231
- // here is a wrap-tolerant `phrase` rather than the line breaks the file happens
232
- // to have today.
233
- const BRANCH_TAIL = phrase("`chore/run-artifacts-<date>` and open a PR");
234
- const EXEMPT_TAIL = phrase("is exempt, and it is exempt because this invariant does not reach it");
235
- const RULE_CHANGE_COST = phrase("Stranding a rule change costs the status quo, which is where it already was.");
236
- const appendTo = (anchor, sentence) => (text) => text.replace(anchor, (m) => `${m} ${sentence}`);
237
-
238
- const mutants = [
239
- ["the branch name is dropped for a generic instruction to commit", ["branch"],
240
- (text) => text.replace(BRANCH_TAIL, "a branch of your own and open a PR")],
241
- ["the branch is renamed to a shape nothing goes looking for", ["branch"],
242
- (text) => text.replace(BRANCH_TAIL, "`chore/metrics` and open a PR")],
243
- ["the commit duty is negated while keeping the branch name", ["branch", "noCommit"],
244
- (text) => text.replace(phrase("Commit both to"), "Do not commit both to")],
245
- ["the split rule is deleted outright", ["split"],
246
- (text) => text.replace(SPLIT_DUTY, "Data rows and rule-doc prose are both the run's own output")],
247
- ["the split rule is inverted", ["split", "mayBundle"],
248
- (text) => text.replace(SPLIT_DUTY, "Data rows and rule-doc prose may share a PR — one branch for both")],
249
- ["bundling is licensed by an added sentence the phrase pin survives", ["mayBundle"],
250
- appendTo(RULE_CHANGE_COST, "A one-line rule fix may ride along with the rows when the run is short.")],
251
- ["the data branch is allowed to carry prose too", ["onlyMetrics"],
252
- (text) => text.replace(ONLY_METRICS, "carries the two `docs/metrics/` files and any rule fix the run made")],
253
- ["the exemption is removed from the invariant", ["exempt"],
254
- (text) => text.replace(EXEMPT_TAIL, "is no different, and this invariant reaches it like any other")],
255
- ["the exemption is inverted rather than removed", ["exempt"],
256
- (text) => text.replace(EXEMPT_TAIL, "is not exempt, and this invariant reaches it too")],
257
- ["the exemption is stated but the action it licenses is withheld", ["label"],
258
- (text) => text.replace(LABEL_DUTY, "Leave that one unlabelled for the maintainer")],
259
- ["a reviewer is re-imposed on the run's own artifact PR", ["needsReview"],
260
- appendTo(LABEL_DUTY, "It still needs a reviewer before the label goes on.")],
261
- ["bundling is licensed by indicative permission phrasing with no modal verb", ["mayBundle"],
262
- appendTo(RULE_CHANGE_COST, "A one-line rule fix is allowed to ride along with the rows when the run is short.")],
263
- ["bundling is licensed by an indicative exception clause naming the data branch", ["mayBundle"],
264
- appendTo(RULE_CHANGE_COST, "This applies unless the rule fix is one line, in which case put it on the data branch.")],
265
- ["the branch name is demoted from convention to suggestion", ["branch"],
266
- (text) => text.replace(phrase("and that branch name is the convention rather than a suggestion"), "and the branch name is a suggestion, not a strict convention")],
267
- ["a reviewer is re-imposed on the run's own artifact PR via passive phrasing NEEDS_REVIEW's old keyword list missed", ["needsReview"],
268
- appendTo(LABEL_DUTY, "It must still be reviewed before the label goes on.")],
269
- // #1983: a period in the gap — an abbreviation, a filename — ended the old
270
- // `[^.]` window before the sharing or review word, and each of these was green.
271
- ["bundling is licensed with an abbreviation between the modal and the sharing verb", ["mayBundle"],
272
- appendTo(RULE_CHANGE_COST, "A one-line rule fix may, e.g. when the run is short, ride along with the rows.")],
273
- ["bundling is licensed with a filename between the permission and the data branch", ["mayBundle"],
274
- appendTo(RULE_CHANGE_COST, "A fix is fine if it only touches SKILL.md, so put it on the data branch.")],
275
- ["a reviewer is re-imposed with an abbreviation between the need and the reviewer", ["needsReview"],
276
- appendTo(LABEL_DUTY, "It still needs, i.e. before the label goes on, a reviewer.")],
277
- ["a reviewer is re-imposed passively with a filename in the gap", ["needsReview"],
278
- appendTo(LABEL_DUTY, "It must, per SKILL.md, still be reviewed.")],
279
- ];
280
-
281
- for (const [what, expected, mutate] of mutants) {
282
- test(`the pins redden when ${what}`, () => {
283
- const mutated = mutate(RUN_TEAM);
284
- assert.notEqual(mutated, RUN_TEAM, `the "${what}" fixture no longer matches the prose and applied nothing — update the fixture, do not delete it`);
285
- assert.deepEqual(firing(mutated), expected, `the "${what}" fixture did not fire exactly the pins it is here to exercise`);
286
- });
287
- }
288
-
289
- // The accept half of #1983's widening: the gap tolerates a period now, so the
290
- // SENTENCE is all that keeps a permission or need word in one sentence from
291
- // pairing with a sharing or review word in the next. Both fixtures are benign
292
- // and both red the moment the scan reads the raw slice instead of `sentences()`.
293
- test("a permission or need word in one sentence does not pair with the next sentence's sharing or review word", () => {
294
- for (const mutate of [
295
- appendTo(RULE_CHANGE_COST, "A reviewer may ask why. Rows never share a PR with prose."),
296
- appendTo(phrase("stranding the rows behind it."), "Nothing here needs one. A reviewer is for ticket work."),
297
- ]) {
298
- const mutated = mutate(RUN_TEAM);
299
- assert.notEqual(mutated, RUN_TEAM, "an accept fixture no longer matches the prose and applied nothing — update it");
300
- assert.deepEqual(firing(mutated), [], "a permission or need word paired with a word in the NEXT sentence");
301
- }
302
- });
303
-
304
- // KNOWN GAP: NO_COMMIT only fires when the negation sits immediately before
305
- // the verb (`\s+`, nothing between). A negation placed elsewhere in the same
306
- // sentence, semantically identical, evades it. Widening to scan the whole
307
- // paragraph is unsafe: this paragraph's own accept-direction text pairs an
308
- // unrelated "not" ("does not own") with "commit" ("Commit both to"), so an
309
- // undirected match would redden the real, correct document. Documented here
310
- // as an accepted limitation rather than left silently unpinned.
311
- test("KNOWN GAP: a negation of the commit duty placed away from the verb evades NO_COMMIT", () => {
312
- const mutated = appendTo(BRANCH_DUTY, "On reflection, don't actually do any of that.")(RUN_TEAM);
313
- assert.notEqual(mutated, RUN_TEAM, "the fixture no longer matches the prose — update it");
314
- assert.deepEqual(firing(mutated), [], "NO_COMMIT now catches a non-adjacent negation — if intentional, narrow this comment/test rather than deleting them silently");
315
- });
316
-
317
- // The accept direction, and the half that decides whether these pins survive
318
- // contact with an editor. A pin that reddens on any edit near the rule has
319
- // discriminated nothing and gets deleted by whoever next reflows the paragraph.
320
- // Both moves at once: every pinned slice is reflowed to one long line, AND an
321
- // unpinned sentence inside each slice is reworded.
322
- test("reflowing both slices and rewording unpinned sentences inside them stays green", () => {
323
- // The reflow is the control that proves the pinned phrases are not bound to
324
- // the line breaks the file happens to have today. It flattens EVERY wrap in
325
- // the slice, blank lines included, which is a harsher edit than any real
326
- // rewrap and is the point.
327
- const rules = artifactRules();
328
- let benign = RUN_TEAM.replace(rules, () => rules.replace(/\n/g, " "));
329
- const bullet = invariant();
330
- benign = benign.replace(bullet, () => bullet.replace(/\n {2}/g, " "));
331
- // Three unrelated rewords: two inside the artifact-rules slice (rules 1 and
332
- // 2 share one slice) and one inside the invariant slice — the sentence that
333
- // explains the rule, never the sentence that states it.
334
- benign = benign
335
- .replace(phrase("a name of your own invention still merges and still cannot be found"),
336
- "an invented name merges just as well and is findable by nobody")
337
- .replace(RULE_CHANGE_COST, "An unmerged rule change simply leaves the rule as it was.")
338
- .replace(phrase("stranding the rows behind it"), "rather than leaving the rows stranded behind a question nobody owns");
339
- assert.notEqual(benign, RUN_TEAM, "the benign-edit fixture applied nothing — update it");
340
- assert.deepEqual(firing(benign), [], "a reflow plus unrelated rewords reddened a pin — the pins are over-tight, not the docs wrong");
341
- });