@feigi/fleet-ctl 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/.claude-plugin/plugin.json +9 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +18 -0
  4. package/agents/fleet-finisher.agent.md +7 -0
  5. package/agents/fleet-implementer-alt.agent.md +210 -0
  6. package/agents/fleet-implementer.agent.md +210 -0
  7. package/agents/fleet-merge-bot.agent.md +7 -0
  8. package/agents/fleet-review-comments.agent.md +40 -0
  9. package/agents/fleet-review-correctness.agent.md +43 -0
  10. package/agents/fleet-review-runner.agent.md +73 -0
  11. package/agents/fleet-review-silent-failure.agent.md +49 -0
  12. package/agents/fleet-review-simplify.agent.md +46 -0
  13. package/agents/fleet-review-snapshot.agent.md +24 -0
  14. package/agents/fleet-review-tests.agent.md +46 -0
  15. package/agents/fleet-review-types.agent.md +41 -0
  16. package/agents/fleet-review-verifier.agent.md +29 -0
  17. package/commands/review-and-fix.md +98 -0
  18. package/commands/run-merge-bot.md +357 -0
  19. package/commands/run-team-help.md +17 -0
  20. package/package.json +23 -0
  21. package/scripts/agent-test-dir-prose.test.mjs +59 -0
  22. package/scripts/agent-test.test.mjs +1636 -0
  23. package/scripts/ambient-git-vars-mjs-prose.test.mjs +354 -0
  24. package/scripts/ambient-git-vars-prose.test.mjs +192 -0
  25. package/scripts/ancestry-check-position-prose.test.mjs +175 -0
  26. package/scripts/apply-ruleset.test.mjs +420 -0
  27. package/scripts/arg-header-probes-prose.test.mjs +393 -0
  28. package/scripts/arg.mjs +600 -0
  29. package/scripts/arg.test.mjs +1354 -0
  30. package/scripts/board-cli.test.mjs +694 -0
  31. package/scripts/board-identity.test.mjs +429 -0
  32. package/scripts/board-liveness-banner.test.mjs +119 -0
  33. package/scripts/board-prev-shape.test.mjs +229 -0
  34. package/scripts/board-tryparse-null.test.mjs +119 -0
  35. package/scripts/board.html +471 -0
  36. package/scripts/board.mjs +2037 -0
  37. package/scripts/board.test.mjs +3086 -0
  38. package/scripts/brief-after-cut-prose.test.mjs +53 -0
  39. package/scripts/candidates-exit3-prose.test.mjs +302 -0
  40. package/scripts/candidates.mjs +674 -0
  41. package/scripts/candidates.test.mjs +2101 -0
  42. package/scripts/caveat-unification-prose.test.mjs +98 -0
  43. package/scripts/ci-comment-rot-prose.test.mjs +2025 -0
  44. package/scripts/ci-completes-premise-prose.test.mjs +257 -0
  45. package/scripts/ci-state-prose.test.mjs +113 -0
  46. package/scripts/ci-state.mjs +761 -0
  47. package/scripts/ci-state.test.mjs +1640 -0
  48. package/scripts/ci-vacuous-green.test.mjs +368 -0
  49. package/scripts/citation-sweep-prose.test.mjs +1572 -0
  50. package/scripts/claim-lifecycle.test.mjs +185 -0
  51. package/scripts/claim-ticket.sh +417 -0
  52. package/scripts/claim-ticket.test.mjs +1121 -0
  53. package/scripts/closing-keyword-prose.test.mjs +193 -0
  54. package/scripts/cockpit-launch-idempotent-prose.test.mjs +165 -0
  55. package/scripts/cockpit-tick-nonblocking.test.mjs +210 -0
  56. package/scripts/compute-board.mjs +579 -0
  57. package/scripts/compute-board.test.mjs +1060 -0
  58. package/scripts/compute-spend.mjs +329 -0
  59. package/scripts/compute-spend.test.mjs +451 -0
  60. package/scripts/cross-repo-citation-prose.test.mjs +156 -0
  61. package/scripts/cwd-isolation-pins.mjs +83 -0
  62. package/scripts/dedupe-guard-prose.test.mjs +243 -0
  63. package/scripts/derive-testcmd.sh +239 -0
  64. package/scripts/derive-testcmd.test.mjs +380 -0
  65. package/scripts/diff-stats.mjs +231 -0
  66. package/scripts/diff-stats.test.mjs +408 -0
  67. package/scripts/dispatch-block-golden-prose.test.mjs +1024 -0
  68. package/scripts/dispatch-block-pins-prose.test.mjs +615 -0
  69. package/scripts/drop-merged-label.sh +173 -0
  70. package/scripts/drop-merged-label.test.mjs +480 -0
  71. package/scripts/expected-jobs-prose.test.mjs +80 -0
  72. package/scripts/filing-bar-seat-prose.test.mjs +242 -0
  73. package/scripts/filing-claim-bar-prose.test.mjs +166 -0
  74. package/scripts/finisher-dispatch-premise-prose.test.mjs +312 -0
  75. package/scripts/finisher-halt-prose.test.mjs +106 -0
  76. package/scripts/finisher-name-prose.test.mjs +134 -0
  77. package/scripts/finisher-own-tree-prose.test.mjs +285 -0
  78. package/scripts/finisher-pin-race-prose.test.mjs +339 -0
  79. package/scripts/fix-applier-correction-rules-prose.test.mjs +201 -0
  80. package/scripts/fix-applier-result-file-prose.test.mjs +100 -0
  81. package/scripts/fleet-bootstrap +155 -0
  82. package/scripts/fleet-heartbeat.mjs +272 -0
  83. package/scripts/fleet-heartbeat.test.mjs +450 -0
  84. package/scripts/fleet-provenance +207 -0
  85. package/scripts/fleet-provenance.test.mjs +64 -0
  86. package/scripts/fleet-run +148 -0
  87. package/scripts/fleet-run.test.mjs +90 -0
  88. package/scripts/fleet-state.mjs +400 -0
  89. package/scripts/fleet-state.test.mjs +373 -0
  90. package/scripts/fleet-tick-prose.test.mjs +299 -0
  91. package/scripts/fleet-tick.mjs +832 -0
  92. package/scripts/fleet-tick.test.mjs +1332 -0
  93. package/scripts/force-with-lease-reason-prose.test.mjs +184 -0
  94. package/scripts/frontmatter-allowlist.json +64 -0
  95. package/scripts/frontmatter-check.mjs +256 -0
  96. package/scripts/frontmatter-check.test.mjs +436 -0
  97. package/scripts/git-env.mjs +124 -0
  98. package/scripts/git-env.test.mjs +149 -0
  99. package/scripts/git-status-untracked-mode-sweep.test.mjs +216 -0
  100. package/scripts/gone-walk.test.mjs +213 -0
  101. package/scripts/gp-sep-invariant-prose.test.mjs +188 -0
  102. package/scripts/head-moved-after-label-prose.test.mjs +233 -0
  103. package/scripts/immutable-body-claim-prose.test.mjs +413 -0
  104. package/scripts/implementer-model-tier.test.mjs +643 -0
  105. package/scripts/inflight-citation-prose.test.mjs +144 -0
  106. package/scripts/inflight-exit2-prose.test.mjs +81 -0
  107. package/scripts/inflight-probe-guard-prose.test.mjs +109 -0
  108. package/scripts/inflight-scan-scope-prose.test.mjs +57 -0
  109. package/scripts/inflight.sh +1106 -0
  110. package/scripts/inflight.test.mjs +2984 -0
  111. package/scripts/injection-control-prose.test.mjs +404 -0
  112. package/scripts/install-root-audit.test.mjs +464 -0
  113. package/scripts/instrument-check-prose.test.mjs +235 -0
  114. package/scripts/instruments.sh +394 -0
  115. package/scripts/instruments.test.mjs +787 -0
  116. package/scripts/issue-tracker-prose.test.mjs +71 -0
  117. package/scripts/json.sh +248 -0
  118. package/scripts/json.test.mjs +364 -0
  119. package/scripts/ledger-dispatch.test.mjs +516 -0
  120. package/scripts/ledger-grammar.mjs +85 -0
  121. package/scripts/ledger-grammar.test.mjs +142 -0
  122. package/scripts/ledger-read-require-file.test.mjs +197 -0
  123. package/scripts/ledger.mjs +1753 -0
  124. package/scripts/ledger.test.mjs +3554 -0
  125. package/scripts/line-distance-prose.test.mjs +245 -0
  126. package/scripts/liveness-rationale-prose.test.mjs +83 -0
  127. package/scripts/locale-pin-prose.test.mjs +189 -0
  128. package/scripts/member-outcome-prose.test.mjs +167 -0
  129. package/scripts/member-outcomes-header.test.mjs +148 -0
  130. package/scripts/member-outcomes-prose.test.mjs +63 -0
  131. package/scripts/member-outcomes.mjs +231 -0
  132. package/scripts/member-outcomes.test.mjs +507 -0
  133. package/scripts/member-prompt-prose.test.mjs +161 -0
  134. package/scripts/member-record.mjs +605 -0
  135. package/scripts/member-record.test.mjs +516 -0
  136. package/scripts/member-write-guard.mjs +279 -0
  137. package/scripts/member-write-guard.test.mjs +211 -0
  138. package/scripts/merge-commit-probe-prose.test.mjs +122 -0
  139. package/scripts/merge-gate.mjs +262 -0
  140. package/scripts/merge-gate.test.mjs +613 -0
  141. package/scripts/muted-git-guard-sweep.test.mjs +493 -0
  142. package/scripts/net-ssh-precedence-prose.test.mjs +91 -0
  143. package/scripts/net-watchdog-prose.test.mjs +79 -0
  144. package/scripts/net.sh +409 -0
  145. package/scripts/net.test.mjs +211 -0
  146. package/scripts/no-ci-gate-prose.test.mjs +108 -0
  147. package/scripts/no-undo-audit.sh +1134 -0
  148. package/scripts/no-undo-audit.test.mjs +3965 -0
  149. package/scripts/no-wave.test.mjs +138 -0
  150. package/scripts/node-floor-sweep.test.mjs +611 -0
  151. package/scripts/pointer-target-prose.test.mjs +186 -0
  152. package/scripts/pr-overlap.mjs +417 -0
  153. package/scripts/pr-overlap.test.mjs +695 -0
  154. package/scripts/printf-die-sweep.test.mjs +384 -0
  155. package/scripts/prompt-renderer.mjs +39 -0
  156. package/scripts/prompt-renderer.test.mjs +68 -0
  157. package/scripts/prose-pin.mjs +808 -0
  158. package/scripts/prose-pin.test.mjs +1034 -0
  159. package/scripts/prove-merge.sh +228 -0
  160. package/scripts/prove-merge.test.mjs +995 -0
  161. package/scripts/pull-table-relabel-prose.test.mjs +60 -0
  162. package/scripts/quiet-payload-prose.test.mjs +222 -0
  163. package/scripts/reap.sh +1768 -0
  164. package/scripts/reap.test.mjs +4395 -0
  165. package/scripts/reaping-prose.test.mjs +159 -0
  166. package/scripts/refuter-scratch-prose.test.mjs +135 -0
  167. package/scripts/release-label-required-prose.test.mjs +71 -0
  168. package/scripts/release-label-split-prose.test.mjs +169 -0
  169. package/scripts/release-ticket.sh +1716 -0
  170. package/scripts/release-ticket.test.mjs +5106 -0
  171. package/scripts/renovate-release-contract.test.mjs +379 -0
  172. package/scripts/repo-root.mjs +544 -0
  173. package/scripts/repo-root.test.mjs +873 -0
  174. package/scripts/reporter-output-rule-prose.test.mjs +208 -0
  175. package/scripts/review-agent-report-only.test.mjs +49 -0
  176. package/scripts/review-core-cwd-isolation.test.mjs +374 -0
  177. package/scripts/review-core-reads.test.mjs +478 -0
  178. package/scripts/review-core-refuter-scratch.test.mjs +148 -0
  179. package/scripts/review-core-snapshot-path.test.mjs +777 -0
  180. package/scripts/review-core-specialist-scratch.test.mjs +189 -0
  181. package/scripts/review-core-testcmd.test.mjs +288 -0
  182. package/scripts/review-core-unrun.test.mjs +530 -0
  183. package/scripts/review-core-unverified-discriminant.test.mjs +208 -0
  184. package/scripts/review-core.mjs +1028 -0
  185. package/scripts/review-eval-resolver-path.test.mjs +55 -0
  186. package/scripts/review-eval.mjs +197 -0
  187. package/scripts/review-host-fixture.mjs +73 -0
  188. package/scripts/review-in-run-retry.test.mjs +187 -0
  189. package/scripts/review-no-vendor-dispatch.test.mjs +45 -0
  190. package/scripts/review-path-default.test.mjs +796 -0
  191. package/scripts/review-runner-spawns.test.mjs +93 -0
  192. package/scripts/review-runner.test.mjs +155 -0
  193. package/scripts/review-tier-audit.test.mjs +140 -0
  194. package/scripts/run-artifact-pr-prose.test.mjs +341 -0
  195. package/scripts/run-merge-bot-prose.test.mjs +1391 -0
  196. package/scripts/scratch-partition-invariant-prose.test.mjs +74 -0
  197. package/scripts/scripts-path-citation-sweep.test.mjs +73 -0
  198. package/scripts/section-between-guard-prose.test.mjs +378 -0
  199. package/scripts/select-dimensions.test.mjs +674 -0
  200. package/scripts/shared-refusal.test.mjs +388 -0
  201. package/scripts/shell-traps-prose.test.mjs +507 -0
  202. package/scripts/shortlist.mjs +355 -0
  203. package/scripts/shortlist.test.mjs +366 -0
  204. package/scripts/slow-transport.mjs +72 -0
  205. package/scripts/snapshot-repo.test.mjs +772 -0
  206. package/scripts/snapshot-runner-audience-prose.test.mjs +129 -0
  207. package/scripts/spend-view.test.mjs +312 -0
  208. package/scripts/staleness-qualifier-prose.test.mjs +251 -0
  209. package/scripts/staleness-verdict-prose.test.mjs +142 -0
  210. package/scripts/staleness.mjs +414 -0
  211. package/scripts/staleness.test.mjs +893 -0
  212. package/scripts/stalled-member-liveness-prose.test.mjs +219 -0
  213. package/scripts/stash-prohibition-prose.test.mjs +313 -0
  214. package/scripts/strip-comments.mjs +44 -0
  215. package/scripts/tier-check.mjs +468 -0
  216. package/scripts/tier-check.test.mjs +726 -0
  217. package/scripts/tier-guard-gate-prose.test.mjs +216 -0
  218. package/scripts/tier-outcomes-header.test.mjs +586 -0
  219. package/scripts/tier-outcomes.mjs +441 -0
  220. package/scripts/tier-outcomes.test.mjs +342 -0
  221. package/scripts/tier-roles.mjs +250 -0
  222. package/scripts/tier-roles.test.mjs +316 -0
  223. package/scripts/tracker-block-copy-prose.test.mjs +288 -0
  224. package/scripts/triage-labels-gloss-prose.test.mjs +97 -0
  225. package/scripts/unattended-git-sweep.test.mjs +142 -0
  226. package/scripts/verify-sha-exit2-prose.test.mjs +269 -0
  227. package/scripts/verify-sha.sh +117 -0
  228. package/scripts/verify-sha.test.mjs +693 -0
  229. package/scripts/watcher-degraded-block.test.mjs +372 -0
  230. package/scripts/watcher-key-prose.test.mjs +106 -0
  231. package/scripts/within-run-pair-prose.test.mjs +208 -0
  232. package/scripts/worktree-audit.sh +482 -0
  233. package/scripts/worktree-audit.test.mjs +1407 -0
  234. package/scripts/worktree-head-prose.test.mjs +276 -0
  235. package/scripts/worktree-listing-sweep.test.mjs +217 -0
  236. package/scripts/worktree-model-prose.test.mjs +216 -0
  237. package/scripts/worktree.sh +470 -0
  238. package/skills/next-ticket/SKILL.md +138 -0
  239. package/skills/run-team/SKILL.md +3603 -0
  240. package/skills/run-team/references/ci-and-staleness.md +75 -0
  241. package/skills/run-team/references/correction-tickets.md +37 -0
  242. package/skills/run-team/references/isolation.md +23 -0
  243. package/skills/run-team/references/member-lifecycle.md +73 -0
  244. package/skills/run-team/references/reaping.md +73 -0
  245. package/skills/sizing-a-ticket/SKILL.md +39 -0
@@ -0,0 +1,1572 @@
1
+ import { test } from "node:test";
2
+ import assert from "node:assert/strict";
3
+ import { readFileSync, readdirSync } from "node:fs";
4
+ import { join } from "node:path";
5
+
6
+ // #516. A scan over every tracked `.mjs`/`.sh`/`.js`/`.yml` file for
7
+ // `path.ext:NNN` found 22 line-numbered citations (plus two bare `(:NNN)`
8
+ // continuations) and converted every one to name a construct instead — a
9
+ // function, a section, a quoted fragment. A line number rots the moment the
10
+ // cited file is next touched, silently, because nothing reds when it does;
11
+ // that is how #516 itself came to exist. This file is what keeps the OLD
12
+ // stale forms from creeping back in one file at a time, the way they crept in
13
+ // the first time, and confirms every construct name the sweep introduced is
14
+ // still findable somewhere in its file (never pinned to a line — that would
15
+ // defeat the point).
16
+ //
17
+ // Two example strings that LOOK like citations are not: `file.mjs:164` in
18
+ // ledger.mjs's prose about search-qualifier smuggling, and `candidates.mjs:164`
19
+ // (twice) in ledger.test.mjs, which is that test's own input/assertion
20
+ // subject. Neither is touched here — the patterns below are the exact stale
21
+ // forms the sweep actually converted, not a general `\.mjs:\d+` ban.
22
+ //
23
+ // Not #516-only any more. The table is this repo's citation-regression record
24
+ // rather than that ticket's frozen inventory: #1136 generalized one entry's ban
25
+ // after the number rotted a third time, #1349 retired one whose target no
26
+ // longer exists, and #870 adds a pair of citations PR #866 fixed BY HAND
27
+ // rather than through a sweep. A citation fixed anywhere in this tree belongs
28
+ // here; the alternative is each file growing a private pin that reads its own
29
+ // source, which is the per-file creep this file exists to stop.
30
+ //
31
+ // #1555 widens the subject past line numbers. The select-dimensions.test.mjs
32
+ // entry bans a reverted ARGUMENT spelling, not a citation: `lift(SOURCE)`
33
+ // where the live code passes `lift(stripComments(SOURCE))`. It belongs here
34
+ // because the rot is the same rot — a one-line spelling that still reads
35
+ // plausibly, whose revert nothing reds on — and the alternative is the
36
+ // private per-file pin the paragraph above rejects. The table's subject is
37
+ // the stale FORM; a line number is one kind of stale form.
38
+ //
39
+ // Both halves here are CITING-side: the stale form must not return, and the
40
+ // construct the citation names must still be named. Neither reads the cited
41
+ // file, so nothing in this table notices the TARGET losing the construct — the
42
+ // direction #870 closes for probe 3's citation, in
43
+ // inflight-citation-prose.test.mjs, and leaves open for every entry below.
44
+ //
45
+ // One target-side check runs here, for one citation shape only (#1757): a
46
+ // `live` needle that names an ADR by number (`ADR 0010`) is a pointer, and the
47
+ // number must still resolve to exactly one `docs/adr/<number>-*.md`. Read off
48
+ // the needle itself, never a second list, so the pointer and what it is checked
49
+ // against have one spelling between them — the reason inflight-citation-prose's
50
+ // WTROOT gives: renumber or move the ADR and this reds; repoint the needle
51
+ // alone and the needle reds against the citing file's unchanged prose. The
52
+ // pointer names the ADR by number, so a retitle that keeps the number keeps
53
+ // the pointer true and stays green. A construct needle is still never checked
54
+ // against its target.
55
+ //
56
+ // And two claims are held by what they say, not by how they were spelled:
57
+ // ADR 0010's security release (#1928) and its count of releases in the 43
58
+ // days the pin sat, which pin-drift.sh restates (#1970). Stale forms here once
59
+ // guarded each by the wrong sentence's exact words. A false claim needs no
60
+ // particular spelling to return, so securityReleaseFault reads which side of
61
+ // the pin the ADR places v26.5.1 on, and windowReleaseCountFault how many
62
+ // releases each file puts inside the 43 days. It is the table's stale-form
63
+ // rule taken one step further, for a claim whose rewording is as likely as
64
+ // its reversion — not a second convention to reach for when a spelling ban
65
+ // would do.
66
+ const REPO = join(import.meta.dirname, "..");
67
+ const read = (...segments) => readFileSync(join(REPO, ...segments), "utf8");
68
+
69
+ // Comments wrap; a construct name can land on either side of the wrap. Strip
70
+ // the `//` or `#` gutter and collapse whitespace so a presence check does not
71
+ // depend on where the line happened to break.
72
+ const normalize = (text) => text.replace(/^[ \t]*(?:\/\/|#) ?/gm, "").replace(/\s+/g, " ");
73
+
74
+ const ADRS = readdirSync(join(REPO, "..", "docs", "adr"), { withFileTypes: true })
75
+ .filter((entry) => entry.isFile())
76
+ .map((entry) => entry.name);
77
+ const ADR_POINTER = /\bADR (\d{4})\b/g;
78
+
79
+ // Null when exactly one `<number>-*.md` answers to the pointer, else the
80
+ // reason. Takes a listing rather than reading docs/adr/ itself, so the tests
81
+ // below can hand it the renamed, emptied, and doubled trees this repo does
82
+ // not hold.
83
+ function adrFault(number, names) {
84
+ const hits = names.filter((name) => name.startsWith(`${number}-`) && name.endsWith(".md"));
85
+ if (hits.length === 1) return null;
86
+ return hits.length === 0
87
+ ? `no docs/adr/${number}-*.md exists — the ADR was renumbered or moved out of docs/adr/`
88
+ : `${hits.length} files answer to ADR ${number} (${hits.join(", ")}) — the pointer no longer names one ruling`;
89
+ }
90
+
91
+ const ADR_0010 = ["..", "docs", "adr", "0010-the-node-pin-stays-exact-and-a-bot-moves-it.md"];
92
+ const PIN_DRIFT_SH = ["..", ".github", "scripts", "pin-drift.sh"];
93
+
94
+ // #1928. ADR 0010's security evidence names its one security release past
95
+ // `26.5.0`, v26.5.1, and #1874 corrected WHEN it landed: already out when #335
96
+ // set the pin, not "since the pin". The spelling ban this replaced refused
97
+ // only that sentence; "v26.5.1, which has since landed after the pin was set"
98
+ // states the same false claim and passed every test here. So the claim is read
99
+ // for what it says. Null when the evidence still says v26.5.1 predates the
100
+ // pin, else the reason. Takes the text rather than reading the ADR itself, so
101
+ // the tests below can hand it rewordings the ADR does not hold.
102
+ //
103
+ // The scope is each markdown block — list item or paragraph — naming
104
+ // "security", never the document: the release-list bullet above it says
105
+ // v26.5.1 was "already out when the pin was set" as well, and read file-wide
106
+ // that sentence vouches for a security bullet claiming the opposite. Inside
107
+ // the scope, each clause (cut at `, ; : ( ) — –` and sentence ends) is read
108
+ // for what it places relative to the pin: the order word nearest before a
109
+ // `pin…` mention decides — "already", "before", "predates", "prior to",
110
+ // "earlier than", "ahead of" put the release before it; "since", "after",
111
+ // "postdates", "later than" after it — and "in", "within", "inside" or
112
+ // "during" the N days (or the window) places it after the pin too. A negation
113
+ // in the same breath as that word flips the side, scanned back only to the
114
+ // nearest `and`/`but`/`so`/`yet` or the clause start — so a `not` attached to
115
+ // an earlier, unrelated verb ("does not affect us and landed after…") can't
116
+ // reach across it, and `not…until` reads as naming the word after `until`,
117
+ // not negating it ("didn't land until after" stays after). "none landed in
118
+ // the 43 days after" is a before-the-pin claim; nearest, not first, is what
119
+ // lets "since" be a conjunction — "since it predates the pin" is read at
120
+ // "predates". Any after-the-pin clause reds, even beside a before-the-pin
121
+ // one, and a scope with no before-the-pin clause reds.
122
+ //
123
+ // THE CEILING. It knows those words and nothing else. A true reword outside
124
+ // them — "out by the time #335 pinned it", or the pin as the subject, "the pin
125
+ // came after v26.5.1" — reds, the loud direction; a false claim outside them
126
+ // passes only if the scope also keeps a clause that still reads before the
127
+ // pin. It reads no date, so it holds the ADR to #1874's measurement, and it
128
+ // cannot notice a double negation. Every block naming "security" is in scope,
129
+ // so a later amendment that names it and places any release after the pin
130
+ // reds too — a claim of the same shape, and worth the same re-read.
131
+ const PIN_ORDER = new RegExp(
132
+ [
133
+ String.raw`\b(?<before>already|before|predat\w*|prior\s+to|earlier\s+than|ahead\s+of)\b`,
134
+ String.raw`\b(?<after>since|after|postdat\w*|later\s+than)\b`,
135
+ String.raw`\b(?<window>(?:in|within|inside|during)\s+(?:the|those|that|this|its)\s+(?:\d+[\s-]days?|(?:\d+[\s-]day\s+)?window))\b`,
136
+ // Only "pin", "pins", "pinned" or "pinning" — not every pin-prefixed
137
+ // word. A bare `pin\w*` also matched "pinpointed", letting an unrelated
138
+ // before-clause about "the pinpointed advisory" stand in for the pin.
139
+ String.raw`\b(?<pin>pin(?:s|ned|ning)?)\b`,
140
+ ].join("|"),
141
+ "gi",
142
+ );
143
+ // Bounds the negation scan below to the same breath as the order word: text
144
+ // back to the nearest coordinating conjunction, not the whole clause.
145
+ const CLAUSE_BREAK = /\b(?:and|but|so|yet)\b/gi;
146
+ const NEGATION = /\b(?:not|no|none|never|nothing|neither|nor|cannot)\b|n['’]t\b/i;
147
+ const OTHER_SIDE = { before: "after", after: "before" };
148
+
149
+ // Where one clause places what it names relative to the pin, in order: the
150
+ // reading the comment above spells out, one "before" or "after" per pin or
151
+ // window mention. A pin mention no order word precedes places nothing.
152
+ // windowReleaseCountFault, below, reads a release count's clause with it too.
153
+ function* pinPlacements(clause) {
154
+ let side = null;
155
+ let last = 0;
156
+ for (const { groups, index, 0: token } of clause.matchAll(PIN_ORDER)) {
157
+ let window = clause.slice(last, index);
158
+ const breaks = [...window.matchAll(CLAUSE_BREAK)];
159
+ if (breaks.length) window = window.slice(breaks[breaks.length - 1].index + breaks[breaks.length - 1][0].length);
160
+ const negated = NEGATION.test(window) && !/\buntil\b/i.test(window);
161
+ last = index + token.length;
162
+ if (groups.before || groups.after) {
163
+ const said = groups.before ? "before" : "after";
164
+ side = negated ? OTHER_SIDE[said] : said;
165
+ continue;
166
+ }
167
+ // A pin mention takes the side of the order word nearest before it; a
168
+ // window is the 43 days after the pin, so landing in it is "after".
169
+ const placed = groups.pin ? side : negated ? "before" : "after";
170
+ side = null;
171
+ if (placed) yield placed;
172
+ }
173
+ }
174
+
175
+ function securityReleaseFault(adr) {
176
+ const scope = adr
177
+ .split(/\n(?=[ \t]*(?:[-*+]|\d+\.)[ \t])|\n[ \t]*\n/)
178
+ .map((block) => block.replace(/\s+/g, " "))
179
+ .filter((block) => /\bsecurity\b/i.test(block));
180
+ if (scope.length === 0) {
181
+ return "ADR 0010 no longer names a security release in its evidence — the claim #1874 corrected, that v26.5.1 predates the pin, is gone rather than kept current";
182
+ }
183
+ if (!scope.some((block) => /\bv?26\.5\.1\b/.test(block))) {
184
+ return "ADR 0010's security-release evidence no longer names v26.5.1, the one security release past `26.5.0` (#1874)";
185
+ }
186
+ let before = false;
187
+ for (const clause of scope.flatMap((block) => block.split(/[,;:()—–]|[.!?]\**\s/))) {
188
+ for (const placed of pinPlacements(clause)) {
189
+ if (placed === "after") {
190
+ return `ADR 0010's security-release evidence places it after the pin ("${clause.trim()}") — v26.5.1 was already out when #335 set the pin, so none landed in the 43 days after (#1874, #1928)`;
191
+ }
192
+ before = true;
193
+ }
194
+ }
195
+ return before
196
+ ? null
197
+ : "ADR 0010's security-release evidence no longer says v26.5.1 predates the pin — state it in that bullet's own words: already out when, before, predates, prior to, earlier than or ahead of the pin (#1874, #1928)";
198
+ }
199
+
200
+ // #1957. Where a sentence ends, for ADR 0010's drift-sentence row below: at
201
+ // `.`, `!` or `?`, after any closing markup — `**`, `_`, a backtick, `)`, `]`,
202
+ // a quote — then whitespace; or where a markdown block ends, as
203
+ // securityReleaseFault splits them: a blank line, or the newline before a
204
+ // `-`/`*`/`+` list item. The row's first cut, a bare `\.\s`, missed point 3's bold
205
+ // heading ending `bumps.**`, so the heading's "minor and patch" read as the
206
+ // next sentence's own scope, and an unscoped drift claim under a scoped
207
+ // heading passed. A lone newline is no end: prose wraps mid-sentence. So a
208
+ // heading with no terminator and no blank line after it still lends the next
209
+ // line its scope — telling that line end from a wrap takes parsing the
210
+ // heading, which a sentence boundary cannot do.
211
+ //
212
+ // #1959. A period closing an abbreviation that never ends a sentence — "e.g.",
213
+ // "i.e.", "cf.", "viz.", "vs.", ci-comment-rot-prose's list (#1852) — is no
214
+ // end either: splitting there dropped a scope word on one side of it out of
215
+ // the claim's sentence on the other, and a scoped drift sentence read as
216
+ // unscoped. Any other period before whitespace still ends one — "etc.", an
217
+ // ellipsis, "a.m." — since each ends a sentence as often as not, and reading
218
+ // past a real end is the silent direction: the next sentence's scope would
219
+ // reach back. Before the abbreviation, only a letter or digit disqualifies it,
220
+ // as for UPDATE_TYPE below: an italic `_e.g._` is one, "devs." is not "vs.",
221
+ // and neither is "DEvs." — the guard spells both cases out, so it reads a
222
+ // capital the same whatever flag the pattern splicing it carries (#2043).
223
+ // The abbreviations match lowercase only, as sentences()'s do (#1899, #2021),
224
+ // even inside both rows' `i` flag — the `(?-i:…)` group (Node 23+; .nvmrc pins
225
+ // 26): folded, a sentence ending in a proper noun "Vs." read as the
226
+ // abbreviation, the silent direction above. The cost: a capitalized one
227
+ // anywhere, a parenthetical "(Cf. …)" included, ends the sentence there. Keep
228
+ // the group to literals: V8 (14.6) still folds a character class in any but
229
+ // its first alternative. Every consumer below compiles it with `i`, as the
230
+ // rows do: windowReleaseCountFault's split once carried no flag, so a capital
231
+ // glued to an abbreviation and a tag name in capitals read there as they
232
+ // read nowhere else (#2043).
233
+ //
234
+ // #1981. The rest of the block ends and closing markup #1957 named only in
235
+ // part. A blank line may be CRLF, or blank but for a gutter — a blockquote's
236
+ // `>`, a shell comment's `#` as in pin-drift.sh (a bare `#` is an empty
237
+ // heading in markdown, so a block end there too) — or hold only a setext
238
+ // underline or thematic break, `---`, `===`, `***`, `___`. A block may open
239
+ // behind that gutter too: a list item, ordered as well — `1)` as well as
240
+ // `1.`, which the terminator branch only caught by the accident of its `. ` —
241
+ // a code fence or a table row. Any item number counts, since every item past
242
+ // a list's first carries one, so a wrapped line opening "2) " ends the
243
+ // sentence it continues: the loud direction, as above. An ellipsis `…` ends a
244
+ // sentence with or without whitespace after it: unlike a period it sits inside
245
+ // no version, file name or range, where three periods do — `main...HEAD` — so
246
+ // `...` still needs the whitespace. Closing markup also takes strikethrough's
247
+ // `~~`, `}`, `>`, `»`, `›` and an HTML closing tag such as `</b>`. Still no end:
248
+ // an ATX heading with no blank line before it, since every line behind the
249
+ // `# ` gutter would open one and the merge row reads sentences across it.
250
+ //
251
+ // #2002. More of what CommonMark (0.31.2) lets interrupt a paragraph, and
252
+ // closing markup #1981 still missed. An HTML block opens straight under
253
+ // prose with no blank line between — `<div>`, `<table>`, `<details>`, `<!--`,
254
+ // `<?`, `<!DOCTYPE`, `<pre>`, any of CommonMark's block tag names, opening or
255
+ // closing — and ends the sentence there; any other tag, `<span>` or
256
+ // `<divider>`, opens no block, so the line still wraps. A blockquote's `>`
257
+ // ends it too, opening straight under an unquoted line. Two quoted lines wrap
258
+ // behind the gutter, and so does a quote nested inside one, `> a` then
259
+ // `> > b` — the silent direction, like the ATX gap above, left since telling it
260
+ // from a wrap means counting both lines' `>`; a lazy line between two quoted
261
+ // ones splits the quote in two, the loud direction. Neither this branch nor
262
+ // the HTML block's own caps how far a `<div>`/`>` line can indent, unlike the
263
+ // setext/thematic branch below — a line indented four or more spaces still
264
+ // ends the sentence here, the same loud direction the pre-existing list
265
+ // lookahead already allowed. A setext underline or thematic break is now only
266
+ // what CommonMark renders as one: a run of `=` or of `-`, or three or more of
267
+ // one of `-`, `*`, `_`, spaced or not, indented at most three spaces past the
268
+ // gutter. `_`, `**`, `-=-`, `*-_` or ` ---` is a paragraph line, and reading
269
+ // one as an end was the loud direction. That three-space cap counts from the
270
+ // margin, not a list item's own content column — inside a list item a deeper
271
+ // underline can still be a real end CommonMark would honor; the silent
272
+ // direction, left beside the ATX and nested-quote gaps above, since a
273
+ // line-based regex can't carry a list item's column forward. A `#` is gutter
274
+ // unless it's followed directly by a digit, as in a shell comment, an ATX
275
+ // heading or a comment-only rule line (`#---`, `#===`): a wrapped line
276
+ // opening `#1906) ` is a citation, not a gutter and a list item. Closing
277
+ // markup also takes a link's destination or reference label,
278
+ // `](renovate.json)` or `][ref]`, a footnote reference `[^1]`, and a closing
279
+ // tag with a hyphen in its name or whitespace before its `>`, `</my-el>`,
280
+ // `</b >`. Tag names match in either case only where the splicing pattern
281
+ // carries `i`, as every consumer of SENTENCE_END here does (#2043).
282
+ //
283
+ // #2027. A bare footnote marker straight behind the terminator — `.[1]`,
284
+ // `?[note]`, `.[1][2]`, closing markup allowed after it — ends the sentence
285
+ // after it, as sentences() in prose-pin.mjs has since #1987. Without it
286
+ // `only.[1] Bounding drift…` read as one sentence here while sentences() read
287
+ // two, the silent direction for both rows. It is sentences()'s rule, not a
288
+ // bare `\[[^\]]*\]`: the marker holds at least one character and no
289
+ // whitespace, and the terminator must close a word, a digit, a code span, a
290
+ // paren or a curly quote — so jq's `'.[] | …'`, JavaScript's `m?.[1] || …`, a
291
+ // glob's `*.[0-9]*' ` and jq's `.jobs.[0, 1] | …` end nothing, and a single
292
+ // unspaced `.jobs.[0] | …` still does, the same known gap sentences() carries.
293
+ // One divergence, forced: every consumer here compiles without `u`, where
294
+ // `\p{L}` is a literal "p" (see UPDATE_TYPE's #1988 note), so "a letter" is
295
+ // an ASCII one or ANY non-ASCII character — every non-ASCII letter sentences()
296
+ // takes, `”` and `’` included, and also non-ASCII punctuation such as `»`,
297
+ // which sentences() does not take. That extra split is the loud direction for
298
+ // the rows, and none of the code shapes above starts with one. The caret form
299
+ // `[^1]` stays in CLOSING_MARKUP, unguarded, as #2002 left it.
300
+ //
301
+ // #2063. The `][ref]` closer skips a label `[^1]` reads whole — `][^1]` is
302
+ // `]` then `[^1]` and nothing else — so no run of closers has two readings.
303
+ // Read both ways, a chain of n `][^1]` had 2^n, and a match failing after
304
+ // it walked all of them first. `][^]` and `][^a b]`, which `[^1]` cannot
305
+ // read, stay `][ref]` closers.
306
+ const FOOTNOTE_MARKERS = String.raw`(?:(?<=[A-Za-z\d\x60)\u0080-\uFFFF][.!?])(?:\[[^\]\s]+\])+)?`;
307
+ const CLOSING_MARKUP = String.raw`(?:[*_\x60)\]}>~"'”’»›]|\]\([^()]*\)|\]\[(?!\^[^\]\s]+\])[^\]]*\]|\[\^[^\]\s]+\]|<\/[a-z][a-z\d-]*\s*>)`;
308
+ const HASH_GUTTER = String.raw`[ \t]*#(?!\d)`;
309
+ const GUTTER = String.raw`(?:[ \t]*>|${HASH_GUTTER})`;
310
+ const HTML_BLOCK_OPEN = String.raw`<(?:!--|\?|![A-Za-z]|!\[CDATA\[|(?:script|pre|style|textarea)(?=[\s>]|$)|\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?=[\s>]|\/>|$))`;
311
+ const SENTENCE_END = String.raw`(?:(?:[!?]|(?<!(?<![A-Za-z\d])(?-i:e\.g|i\.e|cf|viz|vs))\.)${FOOTNOTE_MARKERS}${CLOSING_MARKUP}*\s|…${CLOSING_MARKUP}*\s?|\n(?=${GUTTER}*[ \t]*(?:(?:[-*+]|\d{1,9}[.)])[ \t]|\x60{3}|~{3}|\||${HTML_BLOCK_OPEN}))|\n(?=(?:${HASH_GUTTER})*[ \t]*>)(?<=(?:^|\n)(?!(?:${HASH_GUTTER})*[ \t]*>)[^\n]*\n)|\n${GUTTER}*[ \t]*\r?\n|\n(?:${GUTTER}+ ?)? {0,3}(?:=+|-+|(?:-[ \t]*){3,}|(?:\*[ \t]*){3,}|(?:_[ \t]*){3,})[ \t]*\r?\n)`;
312
+ // #1958. What names an update type, for both of ADR 0010's #1906 rows below:
313
+ // minor, patch or major as a whole word. The rows' first cut matched the bare
314
+ // substring, so "dispatched" and "majority" scoped a claim that names no
315
+ // update type, and an unscoped bold span or drift sentence passed. `\b` is not
316
+ // the boundary either: it counts `_` as a word character, so an italic
317
+ // `_patch_` would stop scoping its claim. Only an ASCII letter or digit beside
318
+ // the word disqualifies it. A plural still names the type — "automerged for
319
+ // minors and patches" is scoped — so minors, majors and patches count;
320
+ // "patched" and "patching" do not.
321
+ //
322
+ // #1988. Three holes are left open, each a word that names no update type
323
+ // still scoping its claim. The plain-English sense: "patches" read as a verb,
324
+ // as #1958 left it, and "we patch monthly", "at minor cost", "a major
325
+ // benefit". A whole word cannot tell that sense from the update type, and
326
+ // asking for the type's own context — "bump" beside it — refuses "Majors
327
+ // aside" and "for minors and patches", prose that names exactly the scope the
328
+ // rows ask for. A word no reader sees: a link target, as in
329
+ // `[notes](https://x.io/patch-notes)`, a reference label, an HTML comment.
330
+ // Refusing those takes one more lookbehind on `UPDATE_TYPE` itself, for
331
+ // markup ADR 0010 has none of. And a non-ASCII letter
332
+ // beside the word: "patché" scopes. `[\p{L}\p{N}]` would refuse it, but each
333
+ // regex this is spliced into sets its own flags: built without `u`, `\p` is a
334
+ // plain "p" and the class a few literal characters, so "dispatched" scopes
335
+ // again, silently.
336
+ const UPDATE_TYPE = String.raw`(?<![a-z\d])(?:minors?|majors?|patch(?:es)?)(?![a-z\d])`;
337
+
338
+ // #1992. Both sentence rows are spelling bans, triggered by the stale
339
+ // sentence's own words: "bounding drift" here, a merge verb in
340
+ // UNSCOPED_MERGE_SENTENCE below. The same unscoped claim reworded — "keeping
341
+ // drift bounded at about one month", "that caps drift at a month" — passes.
342
+ // That ceiling is accepted, not missed: the table bans a stale FORM, and
343
+ // reading a claim for what it says is kept, by the header's rule, for a claim
344
+ // whose rewording is as likely as its reversion, as securityReleaseFault and
345
+ // windowReleaseCountFault read theirs. A longer list of trigger words would
346
+ // still be a spelling, only a longer one.
347
+ const UNSCOPED_DRIFT_SENTENCE = new RegExp(
348
+ String.raw`(?:^|${SENTENCE_END})(?:(?!${SENTENCE_END}|${UPDATE_TYPE})[^])*\bbounding\s+drift\b(?:(?!${SENTENCE_END}|${UPDATE_TYPE})[^])*(?:${SENTENCE_END}|$)`,
349
+ "i",
350
+ );
351
+ const UNSCOPED_AUTOMERGED_SPAN = new RegExp(
352
+ String.raw`\*\*(?:(?!${UPDATE_TYPE})[^*\n])*\bautomerged\b(?:(?!${UPDATE_TYPE})[^*\n])*\*\*`,
353
+ "i",
354
+ );
355
+
356
+ // #1978. The merge counterpart of UNSCOPED_DRIFT_SENTENCE, for pin-drift.sh's
357
+ // bound row below: a sentence that ties a bump's merge to its checks — merge,
358
+ // merges, automerged; checks, CI, green — with no update type named in it.
359
+ // Both trigger words sit in lookaheads so either may come first, and the scope
360
+ // ban spans the whole sentence, so UPDATE_TYPE anywhere inside it passes —
361
+ // rebased onto #1958's shared constant rather than a bare `minor|patch|major`,
362
+ // so "dispatched"/"majority" scope nothing here either, same as its drift
363
+ // twin. It pins the scope's presence, not its polarity — "every bump, major
364
+ // included, merges once the checks pass" names a type and passes — since
365
+ // which types automerge is renovate.json's to say, and
366
+ // renovate-release-contract.test.mjs already reds a major that automerges.
367
+ // The merge trigger is closed with its own `\b`, matching the checks
368
+ // trigger's bilateral bounding: `merg` alone left the noun "merger" (an
369
+ // unrelated business sense, not a PR merge) free to trip this beside
370
+ // "checks"/"CI"/"green", since a word boundary sits before "merg" in "merger"
371
+ // too. Bounding it to `merg(?:e[sd]?|ing)` keeps every verb form this needs —
372
+ // merge, merges, merged, merging, automerges, automerged — while
373
+ // "merger"/"mergers" no longer satisfy it (review finding, PR #1990).
374
+ //
375
+ // #1992. Its trigger has the drift row's ceiling in merge words: "a bump
376
+ // lands once its checks go green" and "the bump is approved once checks are
377
+ // green" pass. Widening the verb list buys more spellings, not the concept.
378
+ // `land`, the likeliest synonym, is in pin-drift.sh four times already —
379
+ // releases "landing inside" the 43 days, a move "LANDED on the branch", the
380
+ // pin "lands roughly", bumps that "keep landing" — none shares a sentence
381
+ // with a checks/CI/green word, so none would trip even a widened trigger
382
+ // here; the row does not guard ADR 0010, but the same widened trigger reds
383
+ // its "none landed in the 43 days after — and node here runs `node
384
+ // --check`", whose "check" is a flag.
385
+ const UNSCOPED_MERGE_SENTENCE = new RegExp(
386
+ String.raw`(?:^|${SENTENCE_END})(?=(?:(?!${SENTENCE_END})[^])*?\b(?:auto-?)?merg(?:e[sd]?|ing)\b)(?=(?:(?!${SENTENCE_END})[^])*?\b(?:checks?|CI|green)\b)(?:(?!${SENTENCE_END}|${UPDATE_TYPE})[^])*(?:${SENTENCE_END}|$)`,
387
+ "i",
388
+ );
389
+
390
+ // #1970. How many releases landed in the 43 days the pin sat, which ADR 0010
391
+ // and pin-drift.sh both state. #1874 corrected the count: 8 releases are past
392
+ // `26.5.0`, three of them already out when #335 set the pin, so five landed
393
+ // inside the 43 days. Until #1970 both files' rows banned only the old
394
+ // spelling, "across 8 releases", and "43 days, with eight 26.x releases
395
+ // landing inside them" states the same false count and passed. So the count
396
+ // is read for what it says, as securityReleaseFault reads its claim. Null when
397
+ // every count the 43 days owns is five, else the reason. Takes the text, so
398
+ // the tests can hand it rewordings neither file holds.
399
+ //
400
+ // The scope is each sentence (SENTENCE_END, gutter stripped) naming the
401
+ // window: "43 days", or since/after the pin or #335. A count there is a
402
+ // number — digits, or "no" and "zero" through "twelve" — then "release(s)",
403
+ // with only "more", "new", "further", "other", "Node" or a `26`/`26.x`
404
+ // between; any other word between makes it a count of some kind of release —
405
+ // "no security release" — not the window's total. The rest of the count's
406
+ // clause, up to `, ; : ( ) — –` or a clause break (`and`, `but`, `so`,
407
+ // `yet`), says which reference point it counts from: pinPlacements reading
408
+ // it after the pin, or "in the 43 days", ties it to the window whatever
409
+ // else the clause says; failing that, a before-the-pin reading, or "past"
410
+ // (not the window's own "the past 43 days"), "behind", "beyond", or
411
+ // since/after/from `26.5.0`, measures it from somewhere else — "Of those 8
412
+ // releases past `26.5.0`", "ended the 43 days with 8 releases behind". A
413
+ // count with none of those belongs to the window its sentence names. A bare
414
+ // "not" (or "not all") directly before it denies the count rather than
415
+ // claiming it.
416
+ //
417
+ // THE CEILING. It knows the window only as the words above, so "while the
418
+ // pin sat unbumped, Node shipped 8 releases" names no window and passes; so
419
+ // does a count spelled outside that vocabulary, "a dozen", or measured past
420
+ // `26.5.0` in a clause that never says where it landed. A true reword that
421
+ // counts from somewhere it does not know — "8 releases, three of them already
422
+ // out" — reds, the loud direction. It checks the window's count alone: the 8
423
+ // behind and the three before the pin are not held to their numbers. And,
424
+ // unlike securityReleaseFault, a file stating no count at all passes: the
425
+ // rows below carry no live needle for this count, for #1756's reason. It
426
+ // also reads a count that never sits beside the word "release(s)" at all —
427
+ // an anaphoric "eight of them", "eight of those", or "eight of Node's
428
+ // releases" referring back to a "release(s)" named earlier in the same
429
+ // sentence makes the identical false claim. The house style already reaches
430
+ // for this shape: this function's own design note above reads "8 releases,
431
+ // three of them already out", and ADR 0010, ADR 0002 and ADR 0008 each use
432
+ // "of those"/"any of them" the same way (#2003).
433
+ const COUNT_WORDS = { no: 0, zero: 0, one: 1, two: 2, three: 3, four: 4, five: 5, six: 6, seven: 7, eight: 8, nine: 9, ten: 10, eleven: 11, twelve: 12 };
434
+ const RELEASE_COUNT = new RegExp(
435
+ String.raw`(?<![\w.\x60-])(?<!\bnode\s+)(?<count>\d+|${Object.keys(COUNT_WORDS).join("|")})\s+(?:(?:more|new|further|other|node|of\s+(?:node['’]s|the|those|these)|\x60?v?26(?:\.x)?\x60?)\s+)*releases?\b`,
436
+ "gi",
437
+ );
438
+ // A count with no noun following it at all — "eight of them"/"eight of
439
+ // those" — has no "release(s)" to match beside, so it needs its own shape:
440
+ // the pronoun, plus RELEASE_NAMED reading back over the sentence so far for
441
+ // the antecedent it stands in for. That scope is the sentence, not the
442
+ // clause: #2003's own motivating example names "releases" ahead of an
443
+ // em-dash and reads "8 of them" only after it, past the clause break the
444
+ // window/pin scan elsewhere in this file stops at. The same width that lets
445
+ // it catch that example lets an unrelated "N of them" later in a sentence
446
+ // that also happens to name a release ride along — a false-alarm risk this
447
+ // shape accepts rather than parses away.
448
+ const ANAPHORIC_RELEASE_COUNT = new RegExp(
449
+ String.raw`(?<![\w.\x60-])(?<!\bnode\s+)(?<count>\d+|${Object.keys(COUNT_WORDS).join("|")})\s+of\s+(?:them|those)\b`,
450
+ "gi",
451
+ );
452
+ const RELEASE_NAMED = /\breleases?\b/i;
453
+ const PIN_WINDOW = /\b43[\s-]days?\b|\b(?:since|after)\s+(?:#335\b|(?:the\s+|it\s+was\s+)?pin(?:s|ned|ning)?\b)/i;
454
+ const MEASURED_ELSEWHERE = /\b(?:(?<!\bthe\s+)past|behind|beyond)\b|\b(?:since|after|from)\s+\x60?v?26\.5\.0\b/i;
455
+
456
+ function windowReleaseCountFault(text) {
457
+ for (const sentence of text.split(new RegExp(SENTENCE_END, "i")).map(normalize)) {
458
+ if (!PIN_WINDOW.test(sentence)) continue;
459
+ const matches = [
460
+ ...sentence.matchAll(RELEASE_COUNT),
461
+ ...[...sentence.matchAll(ANAPHORIC_RELEASE_COUNT)].filter((match) => RELEASE_NAMED.test(sentence.slice(0, match.index))),
462
+ ].sort((a, b) => a.index - b.index);
463
+ for (const { groups, index, 0: phrase } of matches) {
464
+ if (/\bnot\s+(?:all\s+)?$/i.test(sentence.slice(0, index))) continue;
465
+ const rest = sentence.slice(index + phrase.length).split(new RegExp(String.raw`[,;:()—–]|${CLAUSE_BREAK.source}`, "i"))[0];
466
+ const placements = [...pinPlacements(rest)];
467
+ if (!placements.includes("after") && (placements.includes("before") || MEASURED_ELSEWHERE.test(rest))) continue;
468
+ const count = groups.count.toLowerCase();
469
+ if ((COUNT_WORDS[count] ?? Number(count)) === 5) continue;
470
+ return `counts ${phrase} in the 43 days the pin sat ("${sentence.trim()}") — five landed inside them, v26.8.0 through v26.10.0; the other three of the 8 past \`26.5.0\` were already out when #335 set the pin (#1874, #1970)`;
471
+ }
472
+ }
473
+ return null;
474
+ }
475
+
476
+ const FILES = [
477
+ {
478
+ path: ["scripts", "arg.test.mjs"],
479
+ stale: [/ledger\.mjs:441/, /board\.mjs:76-79/],
480
+ live: ["tryRun"],
481
+ },
482
+ {
483
+ path: ["scripts", "candidates-exit3-prose.test.mjs"],
484
+ stale: [/candidates\.mjs:378/, /\(:390\)/, /\(:424\)/],
485
+ live: ["allFilteredOut", "process.exitCode"],
486
+ },
487
+ {
488
+ path: ["scripts", "candidates.test.mjs"],
489
+ stale: [/next-ticket\/SKILL\.md:15/],
490
+ live: ["## 1. Candidates"],
491
+ },
492
+ {
493
+ // #1935. Two citations of `run-merge-bot.md:195` in this file, both
494
+ // pointing at the CI wait rule's shell-timeout-vs-CI-cycle
495
+ // claim, and both already stale before #1895's step-1 fire/poll split
496
+ // moved the target's own numbering again. Banned generally rather than
497
+ // at the one drifted value: a ban on `:195` alone lets `:196` or any
498
+ // other number straight back in, and this file already carried the
499
+ // identical stale number at two independent sites.
500
+ path: ["scripts", "fleet-heartbeat.mjs"],
501
+ stale: [/run-merge-bot\.md:\d+/],
502
+ // One needle per SITE — either can revert independently of the other.
503
+ live: [
504
+ "run-merge-bot.md's CI wait rule already states",
505
+ "run-merge-bot.md's CI wait rule measures",
506
+ ],
507
+ },
508
+ {
509
+ path: ["scripts", "implementer-model-tier.test.mjs"],
510
+ stale: [/member-lifecycle\.md:7/],
511
+ live: ["member-lifecycle.md's"],
512
+ },
513
+ {
514
+ path: ["scripts", "ledger.mjs"],
515
+ stale: [/fleet-plugin-design\.md:200/, /candidates\.mjs:279/],
516
+ live: ["fleet-plugin-design.md's", "refuseIfCapped"],
517
+ },
518
+ {
519
+ path: ["scripts", "ledger.test.mjs"],
520
+ stale: [/fleet-plugin-design\.md:200/],
521
+ live: ["fleet-plugin-design.md's"],
522
+ },
523
+ {
524
+ path: ["scripts", "member-outcomes.mjs"],
525
+ stale: [/board\.mjs:221-232/],
526
+ live: ["board.mjs's"],
527
+ },
528
+ {
529
+ path: ["scripts", "no-undo-audit.sh"],
530
+ stale: [/claim-ticket\.sh:26/],
531
+ live: [`wt=".worktrees/$issue-$slug"`],
532
+ },
533
+ {
534
+ path: ["scripts", "printf-die-sweep.test.mjs"],
535
+ stale: [/verify-sha\.sh:33/],
536
+ live: ["verify-sha.sh's fetch trace"],
537
+ },
538
+ {
539
+ // #870. Not a #516 conversion: PR #866 fixed these two citations by hand,
540
+ // both `release-ticket.sh:15-25` -> a bare `release-ticket.sh`, and left
541
+ // them unpinned in both directions. Banned generally rather than at the one
542
+ // drifted value, for the reason the run-merge-bot entry below gives: a ban
543
+ // on `:15-25` alone lets `:14-24` straight back in. This file carries no
544
+ // other `release-ticket.sh:<digit>`, so the general form costs nothing
545
+ // today — and it will refuse one thing tomorrow, the same thing
546
+ // net-ssh-precedence-prose.test.mjs's negative pin already refuses and
547
+ // documents: a future sentence in that file recounting what the citation
548
+ // USED to say. Accepted on the same ground — that history belongs on the
549
+ // commit, not in a comment a reader could act on.
550
+ path: ["scripts", "reaping-prose.test.mjs"],
551
+ stale: [/release-ticket\.sh:\d/],
552
+ // One needle per SITE — the file header, and the comment inside
553
+ // `test("release-ticket.sh: the comment at the dirty check ...")` — because
554
+ // the finding is that the stale form can return to EITHER of them, and a
555
+ // needle satisfied from one site would not notice the other reverting. A
556
+ // bare `release-ticket.sh` would be vacuous outright: that file names the
557
+ // script in unrelated prose, in a path join and in a test name. Needles
558
+ // this long are the price of that: a copy-edit to either sentence reds
559
+ // here, which is a citation-shaped change asking to be re-read anyway.
560
+ live: [
561
+ "The script's header (release-ticket.sh) already carried the corrected wording",
562
+ "The header (release-ticket.sh) states the limitation",
563
+ ],
564
+ },
565
+ {
566
+ path: ["scripts", "release-ticket.test.mjs"],
567
+ stale: [/release-ticket\.sh:303/],
568
+ live: ["empty-entry skip"],
569
+ },
570
+ {
571
+ path: ["scripts", "review-core-reads.test.mjs"],
572
+ stale: [/select-dimensions\.test\.mjs:211-216/],
573
+ live: ["reviewDispatchOptions"],
574
+ },
575
+ {
576
+ path: ["scripts", "review-core-snapshot-path.test.mjs"],
577
+ stale: [/select-dimensions\.test\.mjs:251-256/],
578
+ live: ["resolveDimensions"],
579
+ },
580
+ {
581
+ path: ["scripts", "run-merge-bot-prose.test.mjs"],
582
+ // #1136. The line number on this citation rotted repeatedly — #1136
583
+ // measured `:107`, #516 swept `:173`, and the check itself now sits at a
584
+ // third place again — so the stale form is banned generally here rather
585
+ // than one drifted value at a time.
586
+ stale: [/prove-merge\.sh:\d+/],
587
+ // The live needle is the CONSTRUCT, verbatim from that check. The die
588
+ // message the check emits would be a vacuous needle: this file asserts
589
+ // that string independently of the citation, so the pin would still pass
590
+ // after the citation was deleted outright.
591
+ live: ['[ "$parents" -ge 2 ]'],
592
+ },
593
+ // #1349 retired this entry outright rather than leaving it to rot:
594
+ // select-dimensions.test.mjs's `lift(stripComments(SOURCE), "resolveDimensions"...)`
595
+ // machinery this pin guarded no longer exists anywhere in this file —
596
+ // the omp-only cutover converted it to direct imports of
597
+ // `resolveDimensions`/`verifiersFor`/`DEFAULT_DIMENSIONS`, so there is no
598
+ // construct left to name here. Removed with the cutover that obsoleted
599
+ // it, not left as a stale form for a future sweep to catch.
600
+ // #1349 retired this entry outright rather than leaving it to rot: the
601
+ // vendored `code-reviewer.md` this citation pointed at (via its "Review
602
+ // Scope" section) no longer exists anywhere in this port — the fork ruled
603
+ // on #1303 drops the whole `pr-review-toolkit` dependency, so there is no
604
+ // construct left to name here. Removed with the ticket that obsoleted it,
605
+ // not left as a stale form for a future sweep to catch.
606
+ {
607
+ path: ["skills", "run-team", "SKILL.md"],
608
+ stale: [/board\.mjs:153/],
609
+ live: ["encodeProjectDir"],
610
+ },
611
+ // #1725 fixed this ADR's `ci.yml:269` citation by hand, replacing it with
612
+ // the `# Blocking, every PR` comment anchor. Ban the general `\d+` form,
613
+ // not just the one drifted value: a ban on `:269` alone lets `:270` right
614
+ // back in.
615
+ //
616
+ // #1916. Two more citations rotted the same way: `release.yml:41` (the
617
+ // false-claim history in Context) and `release-label.yml:39-41` /
618
+ // `release-label.yml:68-70` (the `auto-label-bots` and
619
+ // `validate-release-label` jobs' `if:` conditions, both cited on the same
620
+ // `required_status_checks` table row). Converted to the job/step names,
621
+ // the same construct ADR 0010 already uses for these same two files.
622
+ {
623
+ path: ["..", "docs", "adr", "0007-main-ruleset-is-the-merge-gate.md"],
624
+ stale: [/ci\.yml:\d+/, /release\.yml:\d+/, /release-label\.yml:\d+/],
625
+ live: [
626
+ "# Blocking, every PR",
627
+ "`release.yml`'s `Determine bump segment` step",
628
+ "`release-label.yml`'s `auto-label-bots` job",
629
+ "`release-label.yml`'s `validate-release-label` job",
630
+ ],
631
+ },
632
+ // #1756. ADR 0010's own evidence, corrected in place. Its ci.yml citation
633
+ // named the `node-version-file` sites by line, numbers the introducing PR's
634
+ // own hunk had already shifted; 8ec241f, in that same PR, named the jobs
635
+ // holding them instead. Its claim-ticket.test.mjs citation landed on a
636
+ // comment above the assertions it describes, and now names the test by its
637
+ // title. Its candidates.mjs citations for the query and the fallback retry
638
+ // pointed at comment lines even at the ADR's own commit, and now name
639
+ // `query()` and the retry's `query(null)`. Each of those line forms is
640
+ // banned generally, for the reason the ADR 0007 entry gives. The remaining
641
+ // stale forms are not citations but the same rot, the widening #1555 made:
642
+ // a parseArgs caller list crediting arg.mjs and staleness.mjs, whose
643
+ // mentions are comments; a Node release date a day earlier than the
644
+ // changelog's; and an escape-hatch sentence that ruled out every other hatch
645
+ // rather than every other Renovate-driven one. None of those was replaced
646
+ // by a construct, so they carry no live needle — pinning the new wording
647
+ // instead would red a legitimate reword.
648
+ //
649
+ // #1872. The three citations #1756 left in line form, all in the same
650
+ // evidence list: `board-cli.test.mjs`'s 100-run measurement, and the
651
+ // `release.yml` / `release-label.yml` citations behind "every merged PR
652
+ // mints a release". The board-cli one had already rotted when this ticket
653
+ // reached it — later edits to that file had moved the measurement out of the
654
+ // cited range, and nothing went red. Each now names its construct instead —
655
+ // the test the measurement sits above, and each workflow's job — and each
656
+ // line form is banned generally, for the same reason.
657
+ //
658
+ // #1874. Two more of the same, adjacent to #1756's. The Status line and a
659
+ // Consequences bullet located the pin's owner comment in ci.yml as the
660
+ // "first" `setup-node`, a position any `setup-node` step added above the
661
+ // `check` job's would silently re-point it to; both now name the `check`
662
+ // job instead.
663
+ // One needle serves both sites, so it is the ban on the positional form, not
664
+ // the needle, that reds either one reverting. And the evidence counted "8
665
+ // releases" and a security release "since the pin" without saying from
666
+ // what: 8 is the releases past `26.5.0`, three of them — the security
667
+ // release among them — already out when the pin was set. Both were bans on
668
+ // the old sentence's spelling, and the same false claim in other words
669
+ // passed each: securityReleaseFault reads the security release's for what it
670
+ // says since #1928, and windowReleaseCountFault the count's since #1970,
671
+ // both above the table and both tested below it.
672
+ //
673
+ // #1905. The release-age gate, stated in wall-clock days it does not give.
674
+ // The Status line's #1753 amendment said a release "must be three days old"
675
+ // before the bot acts, and point 3 (as #1900 left it) put the shortfall at
676
+ // "closer to two days", from a date that sits "hours to a day before" the
677
+ // publish. Renovate's `node-version` datasource reads index.json's day-only
678
+ // `date` as UTC midnight; across all 15 v26.x releases that midnight sat 12
679
+ // to 38.5 hours before the GitHub release, so the gate can pass a release
680
+ // 33.5 hours after it went out. All three wordings are banned. The third
681
+ // row also bans "up to a day before"; #1905's own suggested remedy said the
682
+ // datasource can "precede actual publish by up to a day", which undercounts
683
+ // the same gap the same way and gets its own fourth row below, since it
684
+ // drops the trailing "before" the third row's alternation needs. No live
685
+ // needle, for the reason #1756's gives.
686
+ //
687
+ // #1906. Point 3's bold heading ("Monthly, and automerged.") and its
688
+ // closing figures ("about one PR, one release and one CI burst per month
689
+ // ... bounding drift at about one month") read as covering every bump,
690
+ // where the Status line's #1752 amendment keeps automerge for minor and
691
+ // patch bumps only: a major waits for a human, so its release waits on that
692
+ // human and no one-month drift bound holds for it. Both now name their
693
+ // scope. The two rows #1906 adds ban each claim with no update type —
694
+ // minor, patch or major — named in its own span: a one-line bold span that
695
+ // says automerged, and a sentence bounding drift. The scope has to sit in
696
+ // that span, for the reason ci-comment-rot-prose's windowClaimFault keeps
697
+ // its distinction inside one sentence: read any wider, an unrelated mention
698
+ // nearby supplies it. The cost of that ceiling is that a paraphrase scoping
699
+ // the claim only in the NEXT sentence reds too — and so does one scoping it
700
+ // across a mid-sentence period SENTENCE_END still counts as an end: "etc.",
701
+ // an ellipsis, any abbreviation off its list (#1959). No live needle, for
702
+ // the reason #1756's gives.
703
+ {
704
+ path: ADR_0010,
705
+ stale: [
706
+ /\blines?\s+\d/,
707
+ /claim-ticket\.test\.mjs:\d/,
708
+ /candidates\.mjs:\d/,
709
+ /board-cli\.test\.mjs:\d/,
710
+ /release\.yml:\d/,
711
+ /release-label\.yml:\d/,
712
+ /\bfirst\s+`?setup-node\b/,
713
+ // A backticked `.mjs` list straight after "used by" that includes either
714
+ // comment-only file, wherever in the list and however it wraps.
715
+ /used by(?:[\s,]*(?:and\s+)?`[\w-]+\.mjs`)*[\s,]*(?:and\s+)?`(?:arg|staleness)\.mjs`/,
716
+ /2026-09-21/,
717
+ /there is no other(?!\s+Renovate-driven\b)/,
718
+ /must\s+be\s+three\s+days\s+old/,
719
+ /closer\s+to\s+two\s+days/,
720
+ /(?:hours|up)\s+to\s+a\s+day\s+before/,
721
+ /\bby\s+up\s+to\s+a\s+day\b/,
722
+ UNSCOPED_AUTOMERGED_SPAN,
723
+ UNSCOPED_DRIFT_SENTENCE,
724
+ ],
725
+ live: [
726
+ "`check`",
727
+ "`validate-claude`",
728
+ "`install-and-smoke`",
729
+ "runner: a dash-led argument counts as an operand only where it exists",
730
+ "`query()`",
731
+ "`query(null)`",
732
+ "build: --spend-since's refusal survives a gh child that has already pushed past the pipe buffer, unread",
733
+ "`release.yml`'s `release` job",
734
+ "`release-label.yml`'s `auto-label-bots` job",
735
+ "the `check` job's `setup-node`",
736
+ ],
737
+ },
738
+ // #1874. pin-drift.sh restated ADR 0010's "43 days across 8 releases" as
739
+ // the cost of a silent pin, where only five of the 8 landed inside the 43
740
+ // days. The count is corrected in both files, and windowReleaseCountFault
741
+ // keeps both from counting anything else in the 43 days (#1970).
742
+ //
743
+ // #1925. The bound's argument in pin-drift.sh, and the cadence note in
744
+ // pin-drift.yml that leans on it, still described the Renovate schedule
745
+ // #1753 replaced: the 1st of each month, 00:00–04:59 UTC. The window is now
746
+ // all day on the 1st–3rd, so the longest healthy gap is no longer "up to 31
747
+ // days", 35 leaves about a day of slack rather than "a few days'", and a
748
+ // Monday run on the 1st–3rd falls inside the window rather than "never"
749
+ // racing it. Each stale wording is banned in the file that carried it, and
750
+ // `(?:\s|#)+` spans a wrap across the `# ` gutter. No
751
+ // live needle: the replacement states the window renovate.json owns, and
752
+ // pinning it would red a legitimate schedule change, not the stale copy.
753
+ //
754
+ // #1978. The same argument added that last PR's checks to the gap "since
755
+ // the merge waits on them, not on the window" — every bump's merge, as
756
+ // #1956 found ci.yml saying, when #1752 had narrowed automerge to minor and
757
+ // patch: a major waits on a human, which no drift bound covers. The bound
758
+ // stays at 35 (the script now argues why a pending major needs no slack);
759
+ // the row bans a merge-on-checks sentence that names no update type, and
760
+ // SENTENCE_END finds the sentence across the `# ` gutter as it does in the
761
+ // ADR. No live needle, for #1756's reason.
762
+ {
763
+ path: PIN_DRIFT_SH,
764
+ stale: [
765
+ /\b1st(?:\s|#)+of(?:\s|#)+each(?:\s|#)+month\b/,
766
+ /\b1st-to-1st\b/,
767
+ /\bup(?:\s|#)+to(?:\s|#)+31(?:\s|#)+days\b/,
768
+ /\ba(?:\s|#)+few(?:\s|#)+days'(?:\s|#)+slack\b/,
769
+ UNSCOPED_MERGE_SENTENCE,
770
+ ],
771
+ live: [],
772
+ },
773
+ {
774
+ path: ["..", ".github", "workflows", "pin-drift.yml"],
775
+ stale: [
776
+ /\b1st(?:\s|#)+of(?:\s|#)+each(?:\s|#)+month\b/,
777
+ /00:00(?:\s|#)*[–-](?:\s|#)*04:59/,
778
+ /\bnever(?:\s|#)+races\b/,
779
+ ],
780
+ live: [],
781
+ },
782
+ // #1757. The glossary's Runtime heading names the two terms ADR 0010
783
+ // separates, and each entry points at that ADR from its cross-reference to
784
+ // the other term. One needle per SITE, for the reason the reaping-prose
785
+ // entry gives: a bare `(ADR 0010)` would stay satisfied by either entry
786
+ // after the other lost its pointer. These are new pointers, not converted
787
+ // ones, so the entry carries no `stale` form.
788
+ {
789
+ path: ["..", "CONTEXT.md"],
790
+ stale: [],
791
+ live: ["**Consumer floor** (ADR 0010)", "**Runtime pin** (ADR 0010)"],
792
+ },
793
+ ];
794
+
795
+ for (const { path, stale, live } of FILES) {
796
+ const label = path.join("/");
797
+ const source = read(...path);
798
+ const prose = normalize(source);
799
+
800
+ for (const pattern of stale) {
801
+ test(`${label} does not regress to the stale form ${pattern}`, () => {
802
+ assert.doesNotMatch(
803
+ source,
804
+ pattern,
805
+ `a stale form matching ${pattern} is back in ${label} — this spelling was converted away because it rots silently: a line number the moment the cited file is next touched, a raw-source pin the moment a dead copy drifts above the live declaration — with nothing going red when it does`,
806
+ );
807
+ });
808
+ }
809
+
810
+ for (const needle of live) {
811
+ test(`${label} still names the construct its citation rests on (${needle})`, () => {
812
+ assert.ok(
813
+ prose.includes(needle),
814
+ `${label} no longer mentions "${needle}" anywhere — the construct this citation rests on appears to have been deleted outright rather than kept current`,
815
+ );
816
+ });
817
+
818
+ for (const [, number] of needle.matchAll(ADR_POINTER)) {
819
+ test(`${label}'s pointer to ADR ${number} still resolves to one file under docs/adr/ (${needle})`, () => {
820
+ const fault = adrFault(number, ADRS);
821
+ assert.equal(fault, null, `${label} points at ADR ${number} through "${needle}", but ${fault}`);
822
+ });
823
+ }
824
+ }
825
+ }
826
+
827
+ test("an ADR pointer resolves by number alone, so a retitled ADR still answers to it", () => {
828
+ assert.equal(adrFault("0010", ["0009-supported-platforms-are-macos-linux-wsl.md", "0010-a-retitled-ruling.md"]), null);
829
+ });
830
+
831
+ test("an ADR pointer reds once its number stops naming exactly one file: renumbered, moved out, or doubled", () => {
832
+ assert.match(adrFault("0010", ["0009-supported-platforms-are-macos-linux-wsl.md", "0014-the-node-pin-stays-exact-and-a-bot-moves-it.md"]), /no docs\/adr\/0010-\*\.md/);
833
+ assert.match(adrFault("0010", []), /no docs\/adr\/0010-\*\.md/);
834
+ assert.match(adrFault("0010", ["0010-one-ruling.md", "0010-another-ruling.md"]), /2 files answer to ADR 0010/);
835
+ });
836
+
837
+ // #1928. The security bullet in a fixture ADR, between two neighbours that
838
+ // stay fixed: the release-list bullet above names v26.5.1 as "already out when
839
+ // the pin was set" too, so a claim the security bullet no longer makes has a
840
+ // true one right beside it to lean on — the scope the fault reads is what the
841
+ // last of these tests proves.
842
+ const adrWith = (claim) =>
843
+ [
844
+ "- **The exact pin does not get bumped.** Three more past `26.5.0` — v26.5.1, v26.6.0",
845
+ " and v26.7.0 — were already out when the pin was set.",
846
+ "- **Security was never the axis.** Of those 8 releases past `26.5.0`, exactly",
847
+ ` one was a security release — ${claim} — and node here runs \`node --check\` on`,
848
+ " tracked files and this repo's own suite: no server, no untrusted input, no",
849
+ " published artifact.",
850
+ "- **Reproducibility is the real axis.** This suite pins node's *own* behaviour.",
851
+ ].join("\n");
852
+
853
+ test("ADR 0010's security evidence still says its lone security release predates the pin (#1928)", () => {
854
+ assert.equal(securityReleaseFault(read(...ADR_0010)), null);
855
+ });
856
+
857
+ test("a security-release claim reworded with v26.5.1 still before the pin is accepted (#1928)", () => {
858
+ for (const claim of [
859
+ "v26.5.1, already out when the pin was set, so none landed in the 43 days after",
860
+ "v26.5.1, which predates the pin",
861
+ "v26.5.1, shipped before #335 set the pin, and none has landed since",
862
+ "v26.5.1, and none has landed since the pin",
863
+ "v26.5.1, which did not land after the pin was set",
864
+ // "since" as the causal conjunction: the order word nearest the pin is
865
+ // "predates", so a first-word reading refuses the first of these. In the
866
+ // second, the "cannot" before "since" negates nothing about "predates".
867
+ "v26.5.1, which is harmless here since it predates the pin",
868
+ "v26.5.1, which cannot matter here since it predates the pin",
869
+ ]) {
870
+ assert.equal(securityReleaseFault(adrWith(claim)), null, claim);
871
+ }
872
+ });
873
+
874
+ test("the same false claim in other words — v26.5.1 landing after the pin — is refused (#1928)", () => {
875
+ for (const claim of [
876
+ // The rewording #1928 was filed on, which the spelling ban let through.
877
+ "v26.5.1, which has since landed after the pin was set",
878
+ "v26.5.1, which postdates the pin",
879
+ "v26.5.1, which landed in the 43 days after #335 pinned it",
880
+ "v26.5.1, which landed during the 43-day window",
881
+ "v26.5.1, which was not already out when the pin was set",
882
+ ]) {
883
+ assert.match(securityReleaseFault(adrWith(claim)), /places it after the pin/, claim);
884
+ }
885
+ });
886
+
887
+ test("a negation on an earlier, unrelated verb does not excuse an after-the-pin clause in the same breath (PR #1969 review)", () => {
888
+ // Caught in #1969's review: `NEGATION.test(clause.slice(last, index))` used
889
+ // to scan the WHOLE span back to the previous match, so a `not` attached to
890
+ // a different verb, on the other side of `and`, wrongly flipped "after" to
891
+ // "before" — accepting the exact false claim #1928 exists to refuse.
892
+ for (const claim of [
893
+ "v26.5.1, which does not affect us and landed after the pin was set",
894
+ "v26.5.1, which is not exploitable here and landed after the pin",
895
+ ]) {
896
+ assert.match(securityReleaseFault(adrWith(claim)), /places it after the pin/, claim);
897
+ }
898
+ });
899
+
900
+ test("`not … until` names the word after `until`, it does not negate it (PR #1969 review)", () => {
901
+ // "didn't land until after the pin" states the pin as when it DID land —
902
+ // the most natural English phrasing of the false claim, and the negation
903
+ // scan used to flip it to a before-the-pin claim regardless.
904
+ for (const claim of ["v26.5.1, which didn't land until after the pin was set", "v26.5.1, which wasn't out until after the pin"]) {
905
+ assert.match(securityReleaseFault(adrWith(claim)), /places it after the pin/, claim);
906
+ }
907
+ });
908
+
909
+ test("the pin token only matches \"pin\", \"pins\", \"pinned\" or \"pinning\" (PR #1969 review)", () => {
910
+ // A bare `pin\w*` also matched "pinpointed", so an unrelated before-clause
911
+ // about "the pinpointed advisory" stood in for the pin mention itself,
912
+ // leaving `before` true and excusing a same-clause "landed after #335" — a
913
+ // false claim in the function's own vocabulary — as accepted. Tightened,
914
+ // neither clause names the pin at all (the second names it only as
915
+ // "#335", outside vocabulary — the loud direction, per THE CEILING), so
916
+ // the claim is refused for naming no valid before-clause rather than
917
+ // silently accepted.
918
+ assert.match(
919
+ securityReleaseFault(adrWith("v26.5.1, which predates the pinpointed advisory, landed after #335")),
920
+ /no longer says v26\.5\.1 predates the pin/,
921
+ );
922
+ });
923
+
924
+ test("the sentence #1874 replaced is refused for what it says, not how it was spelled (#1928)", () => {
925
+ const before1874 = [
926
+ "- **Security was never the axis.** Exactly one security release (v26.5.1) landed",
927
+ " in 26.x since the pin, and node here runs `node --check` on tracked files and",
928
+ " this repo's own suite: no server, no untrusted input, no published artifact.",
929
+ ].join("\n");
930
+ assert.match(securityReleaseFault(before1874), /places it after the pin \("landed in 26\.x since the pin"\)/);
931
+ });
932
+
933
+ test("a before-the-pin clause does not excuse an after-the-pin one beside it (#1928)", () => {
934
+ // The negative half's own case: the positive half alone passes this.
935
+ assert.match(
936
+ securityReleaseFault(adrWith("v26.5.1, already out when the pin was set; it has since landed after the pin")),
937
+ /places it after the pin \("it has since landed after the pin"\)/,
938
+ );
939
+ });
940
+
941
+ test("the security bullet must place v26.5.1 before the pin itself — no neighbour vouches for it (#1928)", () => {
942
+ for (const claim of ["v26.5.1, which is outside this repo's threat model", "v26.5.1, not yet out when the pin was set"]) {
943
+ assert.match(securityReleaseFault(adrWith(claim)), /no longer says v26\.5\.1 predates the pin/, claim);
944
+ }
945
+ assert.match(securityReleaseFault(adrWith("v26.8.0, already out when the pin was set")), /no longer names v26\.5\.1/);
946
+ assert.match(securityReleaseFault(adrWith("v26.5.1").split("\n").slice(0, 2).join("\n")), /no longer names a security release/);
947
+ });
948
+
949
+ test("ADR 0010 and pin-drift.sh still count five releases in the 43 days the pin sat (#1970)", () => {
950
+ for (const path of [ADR_0010, PIN_DRIFT_SH]) {
951
+ assert.equal(windowReleaseCountFault(read(...path)), null, path.join("/"));
952
+ }
953
+ });
954
+
955
+ test("the sentences #1874 replaced are refused for what they count, not how they were spelled (#1970)", () => {
956
+ for (const text of [
957
+ "- **The exact pin does not get bumped.** `.nvmrc` sat at `26.5.0` for 43 days\n across 8 releases (latest 26.x was v26.10.0, 2026-09-21). The cost #354\n",
958
+ "# removed the one passive heartbeat there was. The measured cost of that\n# silence is 43 days across 8 releases.\n#\n",
959
+ ]) {
960
+ assert.match(windowReleaseCountFault(text), /counts 8 releases in the 43 days/, text);
961
+ }
962
+ });
963
+
964
+ test("the same false count in other words — releases in the 43 days that are not five — is refused (#1970)", () => {
965
+ for (const text of [
966
+ "The measured cost of that silence is 43 days, with eight 26.x releases landing inside them.",
967
+ "`.nvmrc` sat at `26.5.0` for 43 days, while Node shipped 8 releases.",
968
+ "It sat for 43 days, during which Node shipped eight new releases.",
969
+ "It sat for 43 days and saw only one release.",
970
+ "Node shipped 8 releases since the pin was set.",
971
+ "Node shipped 8 releases after #335 pinned it.",
972
+ // "before" names the measurement here, not the pin: still inside the window.
973
+ "Eight releases landed in the 43 days before this measurement.",
974
+ "Of those 8 releases in the 43 days, exactly one was a security release.",
975
+ // A reference point beside the count does not excuse placing it in the window.
976
+ "Node shipped 8 releases past `26.5.0` in the 43 days.",
977
+ // A clause break (and/but/so/yet) after the count does not excuse it —
978
+ // the reference point has to sit in the count's own clause (#1970 review).
979
+ "`.nvmrc` sat at `26.5.0` for 43 days, from #335 setting it on 2026-08-11 to this measurement, while Node shipped eight 26.x releases and the pin fell behind.",
980
+ // "the past 43 days" is the window naming itself, not a reference point.
981
+ "Node shipped 8 releases in the past 43 days.",
982
+ // Wrapped across the `# ` gutter.
983
+ "# The measured cost of that silence is 43 days, with\n# eight releases landing inside them.\n",
984
+ ]) {
985
+ assert.match(windowReleaseCountFault(text), /releases? in the 43 days/, text);
986
+ }
987
+ });
988
+
989
+ test("a count measured from `26.5.0`, or placed before the pin, is not read as the 43 days' own (#1970)", () => {
990
+ for (const text of [
991
+ "It sat for 43 days, with five 26.x releases landing inside them.",
992
+ // "26" names the release line, not a count.
993
+ "It sat for 43 days while Node 26 releases kept shipping.",
994
+ "It sat for 43 days while Node shipped 5 releases.",
995
+ "Three more releases were already out when the pin was set, so it ended the 43 days eight releases behind.",
996
+ "Of those 8 releases past `26.5.0`, exactly one was a security release — v26.5.1, already out when the pin was set, so none landed in the 43 days after.",
997
+ "Of the 8 releases since `26.5.0`, five landed in the 43 days.",
998
+ "Not all 8 releases landed in the 43 days.",
999
+ // A sub-count of one kind of release is not the window's total.
1000
+ "No security release landed in the 43 days.",
1001
+ "Node shipped 8 releases past `26.5.0` and the pin never moved.",
1002
+ // "the past 43 days" still names the window when the count is true.
1003
+ "It sat for the past 43 days, with five 26.x releases landing inside them.",
1004
+ // Naming no window, a count is not this claim.
1005
+ "An unscheduled bot would mint roughly 8 releases a month.",
1006
+ ]) {
1007
+ assert.equal(windowReleaseCountFault(text), null, text);
1008
+ }
1009
+ });
1010
+
1011
+ test("an anaphoric release count is refused the same as one spelled beside the word (#2003)", () => {
1012
+ for (const text of [
1013
+ // #2003's own three motivating examples.
1014
+ "It shipped releases inside the 43 days — 8 of them, all after the pin.",
1015
+ "Node shipped releases in the 43 days; eight of them landed after the pin.",
1016
+ "In the 43 days, eight of Node's releases landed after the pin.",
1017
+ // "those" reaches the same pronoun shape as "them".
1018
+ "Node shipped releases in the 43 days; eight of those landed after the pin.",
1019
+ ]) {
1020
+ assert.match(windowReleaseCountFault(text), /\bof (?:them|those)\b in the 43 days|releases? in the 43 days/, text);
1021
+ }
1022
+ // "of the releases" is the same literal noun as "releases" alone, with
1023
+ // the anaphoric "the"/"those"/"these" sitting between the count and it.
1024
+ for (const text of [
1025
+ "In the 43 days, eight of the releases landed after the pin.",
1026
+ "In the 43 days, eight of those releases landed after the pin.",
1027
+ "In the 43 days, eight of these releases landed after the pin.",
1028
+ ]) {
1029
+ assert.match(windowReleaseCountFault(text), /releases? in the 43 days/, text);
1030
+ }
1031
+ });
1032
+
1033
+ test("a true anaphoric count stays green, and a count with no release to refer back to is not this claim (#2003)", () => {
1034
+ for (const text of [
1035
+ // The true count, anaphoric to "them" or to "Node's"/"the"/"those" releases.
1036
+ "Node shipped releases in the 43 days, five of them landed after the pin.",
1037
+ "In the 43 days, five of Node's releases landed after the pin.",
1038
+ "Node shipped releases in the 43 days; five of those landed after the pin.",
1039
+ "In the 43 days, five of those releases landed after the pin.",
1040
+ // No "release(s)" is ever named for "them" to stand in for — an
1041
+ // ordinary count of something else inside the window is not this claim.
1042
+ // Eight, not five, so this case cannot pass merely because it shares the
1043
+ // count the five-exemption above already treats as correct.
1044
+ "Node shipped 8 issues in the 43 days; eight of them are still urgent.",
1045
+ ]) {
1046
+ assert.equal(windowReleaseCountFault(text), null, text);
1047
+ }
1048
+ });
1049
+
1050
+ test("an unscoped drift sentence is refused, whatever ends the sentence before it (#1957)", () => {
1051
+ for (const text of [
1052
+ // Point 3's figures sentence as it read before #1906.
1053
+ [
1054
+ " gives the measurement.",
1055
+ " That keeps about one PR, one release and one CI burst per month — the",
1056
+ " Status line's #1753 amendment names one case that opens a second — while",
1057
+ " bounding drift at about one month.",
1058
+ ].join("\n"),
1059
+ // The case #1957 was filed on: a scoped bold heading ending `bumps.**`.
1060
+ "3. **Monthly, and automerged for minor and patch bumps.**\n Bounding drift at about one month.\n",
1061
+ "_Monthly for minor and patch bumps._ Bounding drift at about one month.\n",
1062
+ "Minor and patch bumps follow `schedule: monthly.` Bounding drift at about one month.\n",
1063
+ "Minor and patch bumps land monthly (see `renovate.json`.) Bounding drift at about one month.\n",
1064
+ "[Minor and patch bumps only.] Bounding drift at about one month.\n",
1065
+ 'Renovate calls minor and patch bumps "monthly." Bounding drift at about one month.\n',
1066
+ "Renovate calls minor and patch bumps 'monthly.' Bounding drift at about one month.\n",
1067
+ "Renovate calls minor and patch bumps “monthly.” Bounding drift at about one month.\n",
1068
+ "Renovate calls minor and patch bumps ‘monthly.’ Bounding drift at about one month.\n",
1069
+ "**Why automerge minor and patch bumps?** Bounding drift at about one month.\n",
1070
+ "Minor and patch bumps merge themselves! Bounding drift at about one month.\n",
1071
+ "## Minor and patch bumps\n\nBounding drift at about one month.\n",
1072
+ "- Monthly for minor and patch bumps\n- Bounding drift at about one month.\n",
1073
+ // The other two markers SENTENCE_END's `[-*+]` list-item lookahead
1074
+ // allows — each is its own branch, not implied by `-` alone.
1075
+ "* Monthly for minor and patch bumps\n* Bounding drift at about one month.\n",
1076
+ "+ Monthly for minor and patch bumps\n+ Bounding drift at about one month.\n",
1077
+ ]) {
1078
+ assert.match(text, UNSCOPED_DRIFT_SENTENCE, text);
1079
+ }
1080
+ });
1081
+
1082
+ test("a drift sentence naming its own scope passes, whatever markup it carries and however it wraps (#1957)", () => {
1083
+ for (const text of [
1084
+ // Closing markup ends nothing without a terminator before it, and a
1085
+ // terminator ends nothing without whitespace after it.
1086
+ "For **minor** and _patch_ bumps (automerged) under `renovate.json`, bounding drift at about one month.\n",
1087
+ "For minor and patch bumps past v26.5.0, bounding drift at about one month.\n",
1088
+ // A lone newline is a wrap, not an end — even before an issue number or
1089
+ // a bold span, which open no heading and no list item.
1090
+ "For a minor or patch bump, the Status line's\n #1753 amendment names one case, and\n **automerge** keeps\n bounding drift at about one month.\n",
1091
+ ]) {
1092
+ assert.doesNotMatch(text, UNSCOPED_DRIFT_SENTENCE, text);
1093
+ }
1094
+ });
1095
+
1096
+ test("an unscoped drift sentence is refused after every block end and closing markup #1957 left out (#1981)", () => {
1097
+ for (const text of [
1098
+ // The three cases #1981 was filed on.
1099
+ "1) Monthly for minor and patch bumps\n2) Bounding drift at about one month.\n",
1100
+ "> Minor and patch bumps\n>\n> Bounding drift at about one month.\n",
1101
+ "Minor and patch bumps merge monthly…Bounding drift at about one month.\n",
1102
+ "Minor and patch bumps\r\n\r\nBounding drift at about one month.\r\n",
1103
+ // The same blank line behind pin-drift.sh's `# ` gutter, and a list item
1104
+ // behind either gutter.
1105
+ "# Minor and patch bumps\n#\n# Bounding drift at about one month.\n",
1106
+ "> - Minor and patch bumps\n> - Bounding drift at about one month.\n",
1107
+ "# 1) Minor and patch bumps\n# 2) Bounding drift at about one month.\n",
1108
+ // A multi-digit ordered item marker — the digit branch is `\d{1,9}`,
1109
+ // not just a single digit (PR #1998 review, fleet-review-tests).
1110
+ "100) Monthly for minor and patch bumps\n101) Bounding drift at about one month.\n",
1111
+ // A line holding only a setext underline or thematic break — each
1112
+ // character its own case, since `* ` and `- ` would open a list item
1113
+ // instead — then a code fence and a table row.
1114
+ "Minor and patch bumps\n===\nBounding drift at about one month.\n",
1115
+ "Minor and patch bumps\n---\nBounding drift at about one month.\n",
1116
+ "Minor and patch bumps\n***\nBounding drift at about one month.\n",
1117
+ "Minor and patch bumps\n___\nBounding drift at about one month.\n",
1118
+ "Minor and patch bumps\n```\nbounding drift at about one month.\n```\n",
1119
+ "Minor and patch bumps\n~~~\nbounding drift at about one month.\n~~~\n",
1120
+ "| Minor and patch bumps |\n| Bounding drift at about one month. |\n",
1121
+ // Closing markup past the class #1957 added.
1122
+ "~~Minor and patch bumps only.~~ Bounding drift at about one month.\n",
1123
+ "Renovate calls minor and patch bumps «monthly.» Bounding drift at about one month.\n",
1124
+ "Renovate calls minor and patch bumps ‹monthly.› Bounding drift at about one month.\n",
1125
+ "Minor and patch bumps set `{schedule: monthly.}` Bounding drift at about one month.\n",
1126
+ "Minor and patch bumps land monthly <see renovate.json.> Bounding drift at about one month.\n",
1127
+ "<b>Minor and patch bumps only.</b> Bounding drift at about one month.\n",
1128
+ ]) {
1129
+ assert.match(text, UNSCOPED_DRIFT_SENTENCE, text);
1130
+ }
1131
+ });
1132
+
1133
+ test("a scoped drift sentence still wraps behind a gutter, over CRLF, past `...` and a leading number (#1981)", () => {
1134
+ for (const text of [
1135
+ // A lone newline behind a gutter is a wrap, as it is without one.
1136
+ "> For minor and patch bumps, the gap keeps\n> bounding drift at about one month.\n",
1137
+ "# For minor and patch bumps, the gap keeps\n# bounding drift at about one month.\n",
1138
+ "For minor and patch bumps, the gap keeps\r\nbounding drift at about one month.\r\n",
1139
+ // Three periods inside a range end nothing; only `…` needs no whitespace.
1140
+ "For minor and patch bumps, `main...HEAD` keeps bounding drift at about one month.\n",
1141
+ // A number opens a list item only with its `.` or `)` and a space.
1142
+ "For minor and patch bumps the gap runs\n35 days, bounding drift at about one month.\n",
1143
+ ]) {
1144
+ assert.doesNotMatch(text, UNSCOPED_DRIFT_SENTENCE, text);
1145
+ }
1146
+ });
1147
+
1148
+ test("an unscoped drift sentence is refused after an HTML block or blockquote opens, a short setext underline, and a link or footnote (#2002)", () => {
1149
+ for (const text of [
1150
+ // The cases #2002 was filed on that read past a real end.
1151
+ "Minor and patch bumps\n<div>\nBounding drift at about one month.\n",
1152
+ "Minor and patch bumps\n> Bounding drift at about one month.\n",
1153
+ "[Minor and patch bumps only.](renovate.json) Bounding drift at about one month.\n",
1154
+ "<my-el>Minor and patch bumps only.</my-el> Bounding drift at about one month.\n",
1155
+ "<b>Minor and patch bumps only.</b > Bounding drift at about one month.\n",
1156
+ // The HTML block's other openers: a closing block tag, a comment, a
1157
+ // type-1 tag outside the block tag list.
1158
+ "Minor and patch bumps\n</details>\nBounding drift at about one month.\n",
1159
+ "Minor and patch bumps\n<!-- monthly -->\nBounding drift at about one month.\n",
1160
+ "Minor and patch bumps\n<pre>\nBounding drift at about one month.\n",
1161
+ // The rest of HTML_BLOCK_OPEN's own openers: the other type-1 tags, a
1162
+ // processing instruction, a doctype, a CDATA section, and a block tag's
1163
+ // self-closing boundary.
1164
+ "Minor and patch bumps\n<script>\nBounding drift at about one month.\n",
1165
+ "Minor and patch bumps\n<?php\nBounding drift at about one month.\n",
1166
+ "Minor and patch bumps\n<!DOCTYPE html>\nBounding drift at about one month.\n",
1167
+ "Minor and patch bumps\n<![CDATA[x]]>\nBounding drift at about one month.\n",
1168
+ "Minor and patch bumps\n<hr/>\nBounding drift at about one month.\n",
1169
+ // A quote opening behind pin-drift.sh's `# ` gutter.
1170
+ "# Minor and patch bumps\n# > Bounding drift at about one month.\n",
1171
+ // A `#`-gutter rule line or gutter list item, with no space after the
1172
+ // `#`, still ends the sentence — the digit-only exception #2002 needs.
1173
+ "# Minor and patch bumps\n#------------------------------\n# Bounding drift at about one month.\n",
1174
+ "# Minor and patch bumps\n#- Bounding drift at about one month.\n",
1175
+ // What still ends at the underline: a setext run of one, a spaced break,
1176
+ // three spaces of indent.
1177
+ "Minor and patch bumps\n-\nBounding drift at about one month.\n",
1178
+ "Minor and patch bumps\n_ _ _\nBounding drift at about one month.\n",
1179
+ "Minor and patch bumps\n ===\nBounding drift at about one month.\n",
1180
+ // A reference link's label and a footnote reference close a sentence too.
1181
+ "[Minor and patch bumps only.][renovate] Bounding drift at about one month.\n",
1182
+ "Minor and patch bumps only.[^1] Bounding drift at about one month.\n",
1183
+ ]) {
1184
+ assert.match(text, UNSCOPED_DRIFT_SENTENCE, text);
1185
+ }
1186
+ });
1187
+
1188
+ test("a scoped drift sentence still wraps past an inline tag, a line CommonMark renders as prose, and a `#NNNN)` citation (#2002)", () => {
1189
+ for (const text of [
1190
+ // Not an HTML block: a tag outside the block list, or a block tag's name
1191
+ // as the prefix of a longer one.
1192
+ "For minor and patch bumps, the gap keeps\n<span>\nbounding drift at about one month.\n",
1193
+ "For minor and patch bumps, the gap keeps\n<divider>\nbounding drift at about one month.\n",
1194
+ // Neither a setext underline nor a thematic break.
1195
+ "For minor and patch bumps, the gap keeps\n_\nbounding drift at about one month.\n",
1196
+ "For minor and patch bumps, the gap keeps\n**\nbounding drift at about one month.\n",
1197
+ "For minor and patch bumps, the gap keeps\n-=-\nbounding drift at about one month.\n",
1198
+ "For minor and patch bumps, the gap keeps\n*-_\nbounding drift at about one month.\n",
1199
+ "For minor and patch bumps, the gap keeps\n ---\nbounding drift at about one month.\n",
1200
+ // An issue citation wrapped to a line's start, with or without a gutter.
1201
+ "For minor and patch bumps (see\n#1906) the gap keeps bounding drift at about one month.\n",
1202
+ "# For minor and patch bumps (see\n# #1906) the gap keeps bounding drift at about one month.\n",
1203
+ // A link ends nothing without a terminator inside it.
1204
+ "For minor and patch bumps [the gap](renovate.json) keeps bounding drift at about one month.\n",
1205
+ ]) {
1206
+ assert.doesNotMatch(text, UNSCOPED_DRIFT_SENTENCE, text);
1207
+ }
1208
+ });
1209
+
1210
+ test("a word that only contains minor, patch or major scopes neither claim (#1958)", () => {
1211
+ for (const text of [
1212
+ // Point 3's heading as it read before #1906.
1213
+ "3. **Monthly, and automerged.**\n",
1214
+ "**Monthly, and automerged; dispatched by the bot.**",
1215
+ "**Dispatched monthly, and automerged.**",
1216
+ "**Monthly, and automerged for the majority of bumps.**",
1217
+ "**Monthly, and automerged once patched.**",
1218
+ // Ends in "patch": only the boundary BEFORE the word refuses it.
1219
+ "**Monthly, and automerged on each dispatch.**",
1220
+ ]) {
1221
+ assert.match(text, UNSCOPED_AUTOMERGED_SPAN, text);
1222
+ }
1223
+ for (const text of [
1224
+ "For the majority of bumps that keeps one PR while bounding drift at a month.\n",
1225
+ "Bounding drift at about one month, dispatched by the bot.\n",
1226
+ "Once patched, bounding drift at about one month.\n",
1227
+ "Bounding drift at about one month for a minority of releases.\n",
1228
+ "Bounding drift at about one month, whatever Renovate dispatches.\n",
1229
+ ]) {
1230
+ assert.match(text, UNSCOPED_DRIFT_SENTENCE, text);
1231
+ }
1232
+ });
1233
+
1234
+ test("minor, patch or major still scopes both claims in italics or as a plural (#1958)", () => {
1235
+ for (const text of [
1236
+ "3. **Monthly, and automerged for minor and patch bumps.**\n",
1237
+ "**Monthly, and automerged for _patch_ bumps.**",
1238
+ "**Monthly, and automerged for minors and patches.**",
1239
+ "**Majors wait; the rest are automerged.**",
1240
+ // Italic and plural at once (#1989): the `_` beside the word and the
1241
+ // plural's "es"/"s" meet in one token, before and after the claim.
1242
+ "**Monthly, and automerged for _patches_.**",
1243
+ "**_Majors_ wait; the rest are automerged.**",
1244
+ ]) {
1245
+ assert.doesNotMatch(text, UNSCOPED_AUTOMERGED_SPAN, text);
1246
+ }
1247
+ for (const text of [
1248
+ "For _patch_ bumps, bounding drift at about one month.\n",
1249
+ "Bounding drift at about one month for minors and patches.\n",
1250
+ "Majors aside, bounding drift at about one month.\n",
1251
+ "Bounding drift at about one month for _patches_.\n",
1252
+ "_Minors_ aside, bounding drift at about one month.\n",
1253
+ ]) {
1254
+ assert.doesNotMatch(text, UNSCOPED_DRIFT_SENTENCE, text);
1255
+ }
1256
+ });
1257
+
1258
+ // Pins #1988's accepted plain-English hole, not a bug: a whole word cannot
1259
+ // tell the verb "patches" or "patch", or the adjective "minor" or "major",
1260
+ // from the update type, so each still scopes its claim. A change that closes
1261
+ // the hole should fail here; one that widens it instead fails #1958's "a word
1262
+ // that only contains…" test above, since that is the row already pinning
1263
+ // which inflected forms of "patch" scope nothing. Either way, update
1264
+ // UPDATE_TYPE's comment with it (#1989).
1265
+ test("minor, patch or major in its plain-English sense still scopes all three claims, as documented (#1989)", () => {
1266
+ for (const text of [
1267
+ "**Renovate patches the automerged bumps.**",
1268
+ "**We patch monthly, and the bumps are automerged.**",
1269
+ ]) {
1270
+ assert.doesNotMatch(text, UNSCOPED_AUTOMERGED_SPAN, text);
1271
+ }
1272
+ for (const text of [
1273
+ "Renovate patches each dependency, bounding drift at about one month.\n",
1274
+ "At minor cost, bounding drift at about one month.\n",
1275
+ ]) {
1276
+ assert.doesNotMatch(text, UNSCOPED_DRIFT_SENTENCE, text);
1277
+ }
1278
+ for (const text of [
1279
+ "# Renovate patches the lockfile, and the bump merges once CI goes green.\n",
1280
+ "# A major benefit: the bump merges once CI goes green.\n",
1281
+ ]) {
1282
+ assert.doesNotMatch(text, UNSCOPED_MERGE_SENTENCE, text);
1283
+ }
1284
+ });
1285
+
1286
+ test("a merge-on-checks sentence naming no update type is refused, across the gutter and in either word order (#1978)", () => {
1287
+ for (const text of [
1288
+ // pin-drift.sh's bound argument as it read before #1978.
1289
+ [
1290
+ "# monthly. The longest healthy gap runs from a bump PR opened as one window",
1291
+ "# opens on the 1st to the next one opened as its window closes at the end of",
1292
+ "# the 3rd — up to 34 days across a 31-day month, and a hosted run that comes",
1293
+ "# late inside the window is already inside that figure — plus however long",
1294
+ "# that last PR's checks take to go green, since the merge waits on them, not",
1295
+ "# on the window. 35 days leaves about a day for those checks.",
1296
+ ].join("\n"),
1297
+ "# The bump automerges once CI goes green.\n",
1298
+ "# Once the checks pass, the bump PR merges itself.\n",
1299
+ // UPDATE_TYPE's word boundary, not a bare substring test: "dispatch" and
1300
+ // "majority" contain no whole minor/patch/major token (#1958).
1301
+ "# The bump merges once CI goes green, as a workflow_dispatch run shows.\n",
1302
+ "# The bump merges once CI goes green, in the majority of months.\n",
1303
+ // The ceiling: the next sentence's scope does not reach back.
1304
+ "# Its merge waits on the checks, not the window. A major waits on a human too.\n",
1305
+ ]) {
1306
+ assert.match(text, UNSCOPED_MERGE_SENTENCE, text);
1307
+ }
1308
+ });
1309
+
1310
+ test("a merge-on-checks sentence naming its scope passes, as does a sentence with only one of merge and checks (#1978)", () => {
1311
+ for (const text of [
1312
+ [
1313
+ "# that last PR's checks take to go green, since a minor or patch bump is",
1314
+ "# automerged and its merge waits on them, not on the window.",
1315
+ ].join("\n"),
1316
+ "# A major's merge waits on a human as well as its checks.\n",
1317
+ // pin-drift.sh's own neighbours: a merge commit with no checks, and
1318
+ // checks with no merge — neither says what a bump's merge waits on.
1319
+ "# `--first-parent` dates the move by when it LANDED on the branch (the merge\n# commit), not by when the bot authored it: a bump PR that sat red for a week\n# has not moved the pin for that week.\n",
1320
+ "# 35 days leaves about a day for those checks; a bump PR that goes red and\n# stays red longer than that trips it in such a month.\n",
1321
+ // The unrelated business sense of "merger" starts with the same four
1322
+ // letters as "merge" — a bare `\b(?:auto-?)?merg` would trip here too,
1323
+ // since a word boundary sits before "merg" in "merger" as well (review
1324
+ // finding, PR #1990). Bounding the trigger to a real verb form excludes it.
1325
+ "# The merger of the checks team and CI team went smoothly and green-lit.\n",
1326
+ ]) {
1327
+ assert.doesNotMatch(text, UNSCOPED_MERGE_SENTENCE, text);
1328
+ }
1329
+ });
1330
+
1331
+ test("the merge trigger only fires on a real merge verb, not a word that merely starts with it (#1990)", () => {
1332
+ // "merger" (an unrelated business sense) starts with the same four letters
1333
+ // as "merge" — a bare `\bmerg` trigger with no closing boundary would trip
1334
+ // beside "checks"/"CI"/"green" here too, since a word boundary sits before
1335
+ // "merg" in "merger" as well.
1336
+ assert.doesNotMatch(
1337
+ "# The merger of the checks team and CI team went smoothly and green-lit.\n",
1338
+ UNSCOPED_MERGE_SENTENCE,
1339
+ );
1340
+ });
1341
+ test("a drift sentence scoped across an abbreviation passes — its period ends no sentence (#1959)", () => {
1342
+ for (const text of [
1343
+ // The case #1959 was filed on: the scope before "e.g.", the claim after.
1344
+ "For a minor bump, e.g. 26.6, that keeps one PR while bounding drift at a month.\n",
1345
+ // And the scope after it, the claim before.
1346
+ "Bounding drift at about one month, i.e. for minor and patch bumps.\n",
1347
+ "For minor bumps (cf. the Status line) bounding drift at about one month.\n",
1348
+ "For patch bumps, viz. 26.5.x, bounding drift at about one month.\n",
1349
+ "For a minor bump (a small vs. a big change) bounding drift at about one month.\n",
1350
+ // Closing markup after the abbreviation, as after any other terminator.
1351
+ "For minor bumps (e.g.) bounding drift at about one month.\n",
1352
+ "For minor bumps, **e.g.** 26.6, bounding drift at about one month.\n",
1353
+ // `_` is a word character, so a `\b` before the abbreviation would miss
1354
+ // an italic one, as #1958 found for an italic `_patch_`.
1355
+ "For minor bumps, _e.g._ 26.6, bounding drift at about one month.\n",
1356
+ ]) {
1357
+ assert.doesNotMatch(text, UNSCOPED_DRIFT_SENTENCE, text);
1358
+ }
1359
+ });
1360
+
1361
+ test("a period after \"etc.\", or after a word only ending in an abbreviation's letters, still ends the sentence (#1959)", () => {
1362
+ for (const text of [
1363
+ // "etc." ends a sentence as often as not, so it is off the list: skipping
1364
+ // it would lend this claim the scope of the sentence before it.
1365
+ "Minor and patch bumps, the lockfile, etc. Bounding drift at about one month.\n",
1366
+ // "devs." is not "vs.".
1367
+ "Minor and patch bumps are for the devs. Bounding drift at about one month.\n",
1368
+ // A digit disqualifies it exactly as a letter does (review finding, PR
1369
+ // #1993): narrowing the boundary to `(?<![a-z])` alone still passes every
1370
+ // other case here, so nothing else in this file pins the digit half.
1371
+ "Minor bumps land in 26vs. Bounding drift at about one month.\n",
1372
+ ]) {
1373
+ assert.match(text, UNSCOPED_DRIFT_SENTENCE, text);
1374
+ }
1375
+ });
1376
+
1377
+ test("a period after a capitalized abbreviation lookalike still ends the sentence, in both rows (#2021)", () => {
1378
+ // "Vs." is not "vs.": the rows match case-insensitively, and the list used
1379
+ // to fold with them, so a proper noun ending a sentence was read as the
1380
+ // abbreviation and the sentence before lent the claim its scope — the
1381
+ // silent direction. sentences() matches the list lowercase only (#1899).
1382
+ for (const word of ["Vs.", "VS.", "E.g.", "I.e.", "Cf.", "Viz."]) {
1383
+ assert.match(`Minor and patch bumps are for the ${word} Bounding drift at about one month.\n`, UNSCOPED_DRIFT_SENTENCE, word);
1384
+ assert.match(`# Minor and patch bumps are for the ${word} The bump merges once CI goes green.\n`, UNSCOPED_MERGE_SENTENCE, word);
1385
+ }
1386
+ // The accept side, in the same fixture shape: lowercase stays one sentence.
1387
+ for (const abbr of ["vs.", "e.g.", "i.e.", "cf.", "viz."]) {
1388
+ assert.doesNotMatch(`Minor and patch bumps are for the ${abbr} Bounding drift at about one month.\n`, UNSCOPED_DRIFT_SENTENCE, abbr);
1389
+ assert.doesNotMatch(`# Minor and patch bumps are for the ${abbr} The bump merges once CI goes green.\n`, UNSCOPED_MERGE_SENTENCE, abbr);
1390
+ }
1391
+ // Only the list itself stopped folding: the letter-or-digit guard before it
1392
+ // still reads a capital — by folding until #2043, by spelling both cases
1393
+ // since — so a capital glued to a lowercase abbreviation disqualifies it
1394
+ // just as "devs." does, and the sentence ends. Both ends of the list.
1395
+ for (const word of ["Ee.g.", "DEvs."]) {
1396
+ assert.match(`Minor and patch bumps are for the ${word} Bounding drift at about one month.\n`, UNSCOPED_DRIFT_SENTENCE, word);
1397
+ }
1398
+ });
1399
+
1400
+ test("a capitalized abbreviation mid-sentence ends the sentence too — the cost of matching lowercase only (#2021)", () => {
1401
+ // Loud here: the scope before the parenthetical drops out of the claim's
1402
+ // sentence, and a scoped drift sentence is refused. No file's prose spells
1403
+ // one capitalized; the pin is here so a change to the list meets it.
1404
+ assert.match("For minor bumps (Cf. the Status line) bounding drift at about one month.\n", UNSCOPED_DRIFT_SENTENCE);
1405
+ });
1406
+
1407
+ // #2043: windowReleaseCountFault split on SENTENCE_END compiled with no flag,
1408
+ // unlike both rows, so every case-sensitive piece of it read differently
1409
+ // there: the letter-or-digit guard missed a capital, and a closing tag or
1410
+ // block tag spelled in capitals ended nothing. Each fixture below is two
1411
+ // sentences, the count in the first and the window in the second, so a
1412
+ // missed end joins them and the count reads as the window's own — the loud
1413
+ // direction.
1414
+ test("windowReleaseCountFault ends a sentence wherever both rows do, capitals included (#2043)", () => {
1415
+ for (const text of [
1416
+ // The cases #2043 was filed on: a capital glued to the abbreviation.
1417
+ "Node shipped 8 releases for the Xvs. The pin sat 43 days.",
1418
+ "Node shipped 8 releases for the Ee.g. The pin sat 43 days.",
1419
+ "Node shipped 8 releases for the DEvs. The pin sat 43 days.",
1420
+ // The same flag, on tag names: a closing tag and an HTML block in capitals.
1421
+ "Node shipped **8 releases.</B> The pin sat 43 days.",
1422
+ "Node shipped 8 releases\n<DIV>\nThe pin sat 43 days.",
1423
+ ]) {
1424
+ assert.equal(windowReleaseCountFault(text), null, text);
1425
+ }
1426
+ // The refuse side, in the same fixture shape: the abbreviation itself, and
1427
+ // a tag that opens no block, join the two into one sentence.
1428
+ for (const text of [
1429
+ "Node shipped 8 releases for the vs. The pin sat 43 days.",
1430
+ "Node shipped 8 releases for the e.g. The pin sat 43 days.",
1431
+ "Node shipped 8 releases\n<SPAN>\nThe pin sat 43 days.",
1432
+ ]) {
1433
+ assert.match(windowReleaseCountFault(text), /counts 8 releases in the 43 days/, text);
1434
+ }
1435
+ });
1436
+
1437
+ test("SENTENCE_END's abbreviation guard reads a capital the same with or without `i` (#2043)", () => {
1438
+ // The guard names both cases itself, so no consumer's flag decides whether
1439
+ // "DEvs." is "vs.".
1440
+ for (const flags of ["", "i"]) {
1441
+ for (const word of ["Xvs.", "Ee.g.", "DEvs."]) {
1442
+ assert.deepEqual(`for the ${word} Next`.split(new RegExp(SENTENCE_END, flags)), [`for the ${word.slice(0, -1)}`, "Next"], `${word} /${flags}`);
1443
+ }
1444
+ assert.deepEqual("for the vs. Next".split(new RegExp(SENTENCE_END, flags)), ["for the vs. Next"], `vs. /${flags}`);
1445
+ }
1446
+ });
1447
+
1448
+ // #2027: sentences() (prose-pin.mjs) ends a sentence behind a bare footnote
1449
+ // marker since #1987, and SENTENCE_END took only the caret form `[^1]`, so
1450
+ // the two read `only.[1] Next` differently. Each shape below is checked with
1451
+ // and without `i`, since SENTENCE_END is spliced into patterns of both kinds.
1452
+ test("SENTENCE_END ends a sentence behind a bare footnote marker, as sentences() does, and still behind `[^1]` (#2027)", () => {
1453
+ for (const flags of ["", "i"]) {
1454
+ const split = (text) => text.split(new RegExp(SENTENCE_END, flags));
1455
+ // The ticket's repro, and the caret form beside it.
1456
+ assert.deepEqual(split("Bounding drift, only.[1] Elsewhere more."), ["Bounding drift, only", "Elsewhere more."], `[1] /${flags}`);
1457
+ assert.deepEqual(split("Bounding drift, only.[^1] Elsewhere more."), ["Bounding drift, only", "Elsewhere more."], `[^1] /${flags}`);
1458
+ // Whatever closes before the terminator: a word, a non-ASCII letter, a
1459
+ // digit, a code span, a paren, a curly quote. Any terminator, a named
1460
+ // marker, a run of markers, closing markup after.
1461
+ for (const [text, first] of [
1462
+ ["a café.[1] Next", "a café"],
1463
+ // A capital, which the guard names itself, as #2043's does.
1464
+ ["ran on CI.[1] Next", "ran on CI"],
1465
+ ["only 26.[1] Next", "only 26"],
1466
+ ["run `jq`.[1] Next", "run `jq`"],
1467
+ ["(see above).[1] Next", "(see above)"],
1468
+ ["said \u201cstop\u201d.[1] Next", "said \u201cstop\u201d"],
1469
+ ["it said \u2018stop\u2019.[1] Next", "it said \u2018stop\u2019"],
1470
+ ["done?[note] Next", "done"],
1471
+ ["done![1] Next", "done"],
1472
+ ["only.[1][2] Next", "only"],
1473
+ ["**only.[1]** Next", "**only"],
1474
+ // The caret form behind a closer the bare marker's guard refuses: it
1475
+ // stays closing markup, as #2002 left it.
1476
+ ["**only**.[^1] Next", "**only**"],
1477
+ ]) {
1478
+ assert.deepEqual(split(text), [first, "Next"], `${text} /${flags}`);
1479
+ }
1480
+ }
1481
+ });
1482
+
1483
+ test("SENTENCE_END ends nothing at a jq, JavaScript or glob index quoted after a period (#2027)", () => {
1484
+ // The code shapes #1987 measured a bare `\[[^\]]*\]` splitting: behind a
1485
+ // quote, a `?`, a `*`, or behind a word with an empty or comma-spaced
1486
+ // bracket.
1487
+ for (const flags of ["", "i"]) {
1488
+ for (const text of [
1489
+ "jq '.[] | select(.x)' here",
1490
+ "const n = m?.[1] || fallback;",
1491
+ "ls *.[0-9]*' now",
1492
+ "jq '.jobs.[] | .x'",
1493
+ "jq '.jobs.[0, 1] | .x'",
1494
+ // The guard refuses `*` on its own, not only via the caret form
1495
+ // (#2002) or by riding along on the unrelated glob fixture above.
1496
+ "**only**.[1] Next",
1497
+ // An abbreviation's period is no terminator, marker or not.
1498
+ "e.g.[1] Next",
1499
+ ]) {
1500
+ assert.deepEqual(text.split(new RegExp(SENTENCE_END, flags)), [text], `${text} /${flags}`);
1501
+ }
1502
+ }
1503
+ });
1504
+
1505
+ // #2063. `][^1]` read two ways under CLOSING_MARKUP — one `][ref]` closer, or
1506
+ // a bare `]` then a `[^1]` footnote — so a chain of n of them had 2^n
1507
+ // readings, and SENTENCE_END walked every one before giving up on a chain
1508
+ // with no whitespace after it. At this n the chain took half a second to
1509
+ // several seconds, doubling with every link; unambiguous, it takes well under
1510
+ // a millisecond, so the budget only catches a return to the blow-up, not a
1511
+ // slow machine.
1512
+ test("SENTENCE_END stays fast on a closer chain that once read two ways (#2063)", () => {
1513
+ const text = "x." + "][^a]".repeat(25) + "z";
1514
+ for (const flags of ["", "i"]) {
1515
+ const start = performance.now();
1516
+ const parts = text.split(new RegExp(SENTENCE_END, flags));
1517
+ const ms = performance.now() - start;
1518
+ assert.deepEqual(parts, [text], `/${flags}`);
1519
+ assert.ok(ms < 100, `${ms.toFixed(0)}ms /${flags}`);
1520
+ }
1521
+ });
1522
+
1523
+ // The fix drops only the `][ref]` reading that `]` plus `[^1]` already
1524
+ // covers, so every closer run ends the same sentences as before. A `][^…]`
1525
+ // label that `[^1]` cannot read — empty, or holding a space — is still one
1526
+ // `][ref]` closer; a fix that refused every `][^` would lose those two.
1527
+ test("SENTENCE_END ends the same sentences behind a `][^…]` closer as before #2063", () => {
1528
+ for (const flags of ["", "i"]) {
1529
+ const split = (text) => text.split(new RegExp(SENTENCE_END, flags));
1530
+ for (const closer of ["][^1]", "][^1]][^2]", "][^a b]", "][^]", "][^vs.]"]) {
1531
+ assert.deepEqual(split(`It shipped.${closer} Next`), ["It shipped", "Next"], `${closer} /${flags}`);
1532
+ assert.deepEqual(split(`per vs.${closer} next`), [`per vs.${closer} next`], `${closer} /${flags}`);
1533
+ }
1534
+ }
1535
+ });
1536
+
1537
+ test("both rows and the window count read a bare footnote marker as a sentence end (#2027)", () => {
1538
+ // The next sentence's scope no longer reaches back across the marker.
1539
+ for (const text of [
1540
+ "Minor and patch bumps only.[1] Bounding drift at about one month.\n",
1541
+ "Minor and patch bumps only.[note] Bounding drift at about one month.\n",
1542
+ "Minor and patch bumps only.[^1] Bounding drift at about one month.\n",
1543
+ ]) {
1544
+ assert.match(text, UNSCOPED_DRIFT_SENTENCE, text);
1545
+ }
1546
+ // Only the simplest marker (`.[1]`, letter-preceded) reached
1547
+ // UNSCOPED_MERGE_SENTENCE and windowReleaseCountFault below, once each —
1548
+ // a consumer that quietly stopped splicing the current SENTENCE_END, or
1549
+ // carried its own narrower guard, would still pass those two single rows
1550
+ // and only red the direct-split test above. Every marker shape, and a
1551
+ // backtick- or paren-preceded terminator, through both consumers here too.
1552
+ for (const text of [
1553
+ "# Minor and patch bumps only.[1] The bump merges once CI goes green.\n",
1554
+ "# Minor and patch bumps only.[note] The bump merges once CI goes green.\n",
1555
+ "# Minor and patch bumps only.[1][2] The bump merges once CI goes green.\n",
1556
+ "# Minor and patch bumps `only`.[1] The bump merges once CI goes green.\n",
1557
+ ]) {
1558
+ assert.match(text, UNSCOPED_MERGE_SENTENCE, text);
1559
+ }
1560
+ // The count in the first sentence, the window in the second.
1561
+ for (const text of [
1562
+ "Node shipped 8 releases.[1] The pin sat 43 days.",
1563
+ "Node shipped 8 releases.[note] The pin sat 43 days.",
1564
+ "Node shipped 8 releases.[1][2] The pin sat 43 days.",
1565
+ "Node shipped 8 releases (confirmed).[1] The pin sat 43 days.",
1566
+ ]) {
1567
+ assert.equal(windowReleaseCountFault(text), null, text);
1568
+ }
1569
+ // The accept side: a scoped sentence quoting a jq index wraps past it.
1570
+ assert.doesNotMatch("For minor and patch bumps, jq '.[] | .x' keeps bounding drift at about one month.\n", UNSCOPED_DRIFT_SENTENCE);
1571
+ assert.doesNotMatch("For minor and patch bumps, `m?.[1] || x` keeps bounding drift at about one month.\n", UNSCOPED_DRIFT_SENTENCE);
1572
+ });