@dzhechkov/harness-core 0.8.11 → 0.8.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/.dz-manifest.json +399 -139
  2. package/LICENSE +13 -0
  3. package/README.md +420 -6
  4. package/dist/agents-policy.d.ts +15 -1
  5. package/dist/agents-policy.d.ts.map +1 -1
  6. package/dist/agents-policy.js +27 -1
  7. package/dist/agents-policy.js.map +1 -1
  8. package/dist/amendment-trace.d.ts +72 -0
  9. package/dist/amendment-trace.d.ts.map +1 -1
  10. package/dist/amendment-trace.js +385 -17
  11. package/dist/amendment-trace.js.map +1 -1
  12. package/dist/backlog-public.d.ts +153 -0
  13. package/dist/backlog-public.d.ts.map +1 -0
  14. package/dist/backlog-public.js +415 -0
  15. package/dist/backlog-public.js.map +1 -0
  16. package/dist/backlog-transitions.d.ts +48 -0
  17. package/dist/backlog-transitions.d.ts.map +1 -0
  18. package/dist/backlog-transitions.js +64 -0
  19. package/dist/backlog-transitions.js.map +1 -0
  20. package/dist/backlog.d.ts.map +1 -1
  21. package/dist/backlog.js +13 -0
  22. package/dist/backlog.js.map +1 -1
  23. package/dist/claim-check.d.ts.map +1 -1
  24. package/dist/claim-check.js +24 -2
  25. package/dist/claim-check.js.map +1 -1
  26. package/dist/claude-hooks-assets.d.ts +93 -0
  27. package/dist/claude-hooks-assets.d.ts.map +1 -0
  28. package/dist/claude-hooks-assets.js +208 -0
  29. package/dist/claude-hooks-assets.js.map +1 -0
  30. package/dist/clean-room-smoke.d.ts +83 -0
  31. package/dist/clean-room-smoke.d.ts.map +1 -0
  32. package/dist/clean-room-smoke.js +138 -0
  33. package/dist/clean-room-smoke.js.map +1 -0
  34. package/dist/cmd-usage.d.ts.map +1 -1
  35. package/dist/cmd-usage.js +36 -6
  36. package/dist/cmd-usage.js.map +1 -1
  37. package/dist/codex-hooks-assets.d.ts +25 -7
  38. package/dist/codex-hooks-assets.d.ts.map +1 -1
  39. package/dist/codex-hooks-assets.js +138 -30
  40. package/dist/codex-hooks-assets.js.map +1 -1
  41. package/dist/codex-hooks.d.ts +21 -1
  42. package/dist/codex-hooks.d.ts.map +1 -1
  43. package/dist/codex-hooks.js +21 -1
  44. package/dist/codex-hooks.js.map +1 -1
  45. package/dist/course-staleness.d.ts +19 -0
  46. package/dist/course-staleness.d.ts.map +1 -0
  47. package/dist/course-staleness.js +95 -0
  48. package/dist/course-staleness.js.map +1 -0
  49. package/dist/destructive-guard-hook.d.ts +40 -0
  50. package/dist/destructive-guard-hook.d.ts.map +1 -0
  51. package/dist/destructive-guard-hook.js +109 -0
  52. package/dist/destructive-guard-hook.js.map +1 -0
  53. package/dist/destructive-guard.d.ts +27 -0
  54. package/dist/destructive-guard.d.ts.map +1 -0
  55. package/dist/destructive-guard.js +2808 -0
  56. package/dist/destructive-guard.js.map +1 -0
  57. package/dist/discrimination-gate.d.ts +28 -3
  58. package/dist/discrimination-gate.d.ts.map +1 -1
  59. package/dist/discrimination-gate.js +76 -16
  60. package/dist/discrimination-gate.js.map +1 -1
  61. package/dist/feature-adr-routing.d.ts +95 -1
  62. package/dist/feature-adr-routing.d.ts.map +1 -1
  63. package/dist/feature-adr-routing.js +193 -27
  64. package/dist/feature-adr-routing.js.map +1 -1
  65. package/dist/guard.d.ts +90 -0
  66. package/dist/guard.d.ts.map +1 -1
  67. package/dist/guard.js +271 -0
  68. package/dist/guard.js.map +1 -1
  69. package/dist/harness-core-location.d.ts +18 -0
  70. package/dist/harness-core-location.d.ts.map +1 -0
  71. package/dist/harness-core-location.js +42 -0
  72. package/dist/harness-core-location.js.map +1 -0
  73. package/dist/index.d.ts +24 -6
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +24 -3
  76. package/dist/index.js.map +1 -1
  77. package/dist/lead-shift-gate.d.ts +95 -0
  78. package/dist/lead-shift-gate.d.ts.map +1 -0
  79. package/dist/lead-shift-gate.js +100 -0
  80. package/dist/lead-shift-gate.js.map +1 -0
  81. package/dist/ledger-backfill.d.ts +11 -1
  82. package/dist/ledger-backfill.d.ts.map +1 -1
  83. package/dist/ledger-backfill.js +19 -0
  84. package/dist/ledger-backfill.js.map +1 -1
  85. package/dist/loop-blobs.generated.d.ts +1 -1
  86. package/dist/loop-blobs.generated.d.ts.map +1 -1
  87. package/dist/loop-blobs.generated.js +12 -3
  88. package/dist/loop-blobs.generated.js.map +1 -1
  89. package/dist/loop-lint.d.ts.map +1 -1
  90. package/dist/loop-lint.js +56 -7
  91. package/dist/loop-lint.js.map +1 -1
  92. package/dist/loop-plan-graph.d.ts +1 -3
  93. package/dist/loop-plan-graph.d.ts.map +1 -1
  94. package/dist/loop-plan-graph.js +70 -1
  95. package/dist/loop-plan-graph.js.map +1 -1
  96. package/dist/loop-trace.d.ts.map +1 -1
  97. package/dist/loop-trace.js +16 -2
  98. package/dist/loop-trace.js.map +1 -1
  99. package/dist/managed-hooks.d.ts +5 -6
  100. package/dist/managed-hooks.d.ts.map +1 -1
  101. package/dist/managed-hooks.js +2 -2
  102. package/dist/managed-hooks.js.map +1 -1
  103. package/dist/model-recommender.d.ts.map +1 -1
  104. package/dist/model-recommender.js +14 -3
  105. package/dist/model-recommender.js.map +1 -1
  106. package/dist/operations.d.ts.map +1 -1
  107. package/dist/operations.js +82 -0
  108. package/dist/operations.js.map +1 -1
  109. package/dist/patterns.d.ts +23 -0
  110. package/dist/patterns.d.ts.map +1 -1
  111. package/dist/patterns.js +10 -0
  112. package/dist/patterns.js.map +1 -1
  113. package/dist/publish.d.ts +11 -0
  114. package/dist/publish.d.ts.map +1 -1
  115. package/dist/publish.js +16 -2
  116. package/dist/publish.js.map +1 -1
  117. package/dist/registry.d.ts.map +1 -1
  118. package/dist/registry.js +3 -2
  119. package/dist/registry.js.map +1 -1
  120. package/dist/score.d.ts.map +1 -1
  121. package/dist/score.js +15 -4
  122. package/dist/score.js.map +1 -1
  123. package/dist/session-retro.d.ts +121 -2
  124. package/dist/session-retro.d.ts.map +1 -1
  125. package/dist/session-retro.js +454 -11
  126. package/dist/session-retro.js.map +1 -1
  127. package/dist/setup.d.ts +28 -0
  128. package/dist/setup.d.ts.map +1 -1
  129. package/dist/setup.js +223 -6
  130. package/dist/setup.js.map +1 -1
  131. package/dist/sign.d.ts.map +1 -1
  132. package/dist/sign.js +18 -1
  133. package/dist/sign.js.map +1 -1
  134. package/dist/skills-verify.d.ts +34 -1
  135. package/dist/skills-verify.d.ts.map +1 -1
  136. package/dist/skills-verify.js +82 -0
  137. package/dist/skills-verify.js.map +1 -1
  138. package/dist/stage-line.d.ts +68 -0
  139. package/dist/stage-line.d.ts.map +1 -0
  140. package/dist/stage-line.js +129 -0
  141. package/dist/stage-line.js.map +1 -0
  142. package/dist/statusline.d.ts +99 -0
  143. package/dist/statusline.d.ts.map +1 -1
  144. package/dist/statusline.js +310 -44
  145. package/dist/statusline.js.map +1 -1
  146. package/dist/store-counts.d.ts +26 -0
  147. package/dist/store-counts.d.ts.map +1 -0
  148. package/dist/store-counts.js +125 -0
  149. package/dist/store-counts.js.map +1 -0
  150. package/dist/store-guard.d.ts +106 -0
  151. package/dist/store-guard.d.ts.map +1 -0
  152. package/dist/store-guard.js +294 -0
  153. package/dist/store-guard.js.map +1 -0
  154. package/dist/swarm-brief.d.ts +95 -0
  155. package/dist/swarm-brief.d.ts.map +1 -0
  156. package/dist/swarm-brief.js +660 -0
  157. package/dist/swarm-brief.js.map +1 -0
  158. package/dist/trace-bundle.d.ts +8 -0
  159. package/dist/trace-bundle.d.ts.map +1 -1
  160. package/dist/trace-bundle.js +11 -0
  161. package/dist/trace-bundle.js.map +1 -1
  162. package/package.json +12 -11
  163. package/sbom.json +804 -154
  164. package/src/agents-policy.ts +46 -2
  165. package/src/amendment-trace.ts +441 -19
  166. package/src/backlog-public.ts +503 -0
  167. package/src/backlog-transitions.ts +77 -0
  168. package/src/backlog.ts +12 -0
  169. package/src/claim-check.ts +25 -2
  170. package/src/claude-hooks-assets.ts +227 -0
  171. package/src/clean-room-smoke.ts +195 -0
  172. package/src/cmd-usage.ts +29 -5
  173. package/src/codex-hooks-assets.ts +140 -30
  174. package/src/codex-hooks.ts +21 -1
  175. package/src/course-staleness.ts +125 -0
  176. package/src/destructive-guard-hook.ts +151 -0
  177. package/src/destructive-guard.ts +3027 -0
  178. package/src/discrimination-gate.ts +98 -19
  179. package/src/feature-adr-routing.ts +220 -22
  180. package/src/guard.ts +318 -0
  181. package/src/harness-core-location.ts +44 -0
  182. package/src/index.ts +111 -3
  183. package/src/lead-shift-gate.ts +145 -0
  184. package/src/ledger-backfill.ts +20 -1
  185. package/src/loop-blobs.generated.ts +12 -3
  186. package/src/loop-lint.ts +52 -7
  187. package/src/loop-plan-graph.ts +66 -1
  188. package/src/loop-trace.ts +13 -1
  189. package/src/managed-hooks.ts +5 -6
  190. package/src/model-recommender.ts +14 -3
  191. package/src/operations.ts +75 -0
  192. package/src/patterns.ts +33 -0
  193. package/src/publish.ts +27 -2
  194. package/src/registry.ts +3 -2
  195. package/src/score.ts +16 -4
  196. package/src/session-retro.ts +466 -11
  197. package/src/setup.ts +246 -9
  198. package/src/sign.ts +18 -1
  199. package/src/skills-verify.ts +99 -1
  200. package/src/stage-line.ts +151 -0
  201. package/src/statusline.ts +396 -47
  202. package/src/store-counts.ts +154 -0
  203. package/src/store-guard.ts +388 -0
  204. package/src/swarm-brief.ts +661 -0
  205. package/src/trace-bundle.ts +10 -0
@@ -1 +1 @@
1
- {"version":3,"file":"agents-policy.js","sourceRoot":"","sources":["../src/agents-policy.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAWvE,oFAAoF;AACpF,MAAM,CAAC,MAAM,cAAc,GAA4B;IACrD;QACE,EAAE,EAAE,gBAAgB;QACpB,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,2BAA2B;QACpC,GA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YACd,QAAQ,GAAG,CAAC;YACZ,UAAU,KAAK,QAAQ;YACvB,wBAAwB,CAAC,YAAY,CAAC;YACtC,0BAA0B,CAAC,YAAY,CAAC,EACxC,CAAC;YACD,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACtH,CAAC;IACH,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,QAAQ,EAAE,CAAC;AACtD,CAAC"}
@@ -19,7 +19,28 @@ export interface AmendmentRow {
19
19
  readonly id: string;
20
20
  readonly testIds: readonly string[];
21
21
  readonly file: string | null;
22
+ /** The row's literal text, fenced examples included — what the author wrote. */
22
23
  readonly raw: string;
24
+ /**
25
+ * The same slice with non-rendered regions (fenced blocks, HTML comments) blanked out, same
26
+ * length, so an index means the same byte in both. EVERY semantic read goes through this one —
27
+ * pointers, retraction, subject — because an EXAMPLE inside a row's block is not that row's
28
+ * answer.
29
+ *
30
+ * OPTIONAL, and that is a compatibility promise rather than sloppiness: round 4 made it REQUIRED
31
+ * and thereby broke every downstream constructor of a row the previous release accepted — a
32
+ * TypeScript consumer stopped compiling, and a legacy or deserialised row reaching
33
+ * `amendmentsMissingFromPlan` threw `TypeError: Cannot read properties of undefined (reading
34
+ * 'split')` (MEASURED 2026-09-06, Codex cross-family review round 5, P1). Every read goes through
35
+ * `rowScan()`, which falls back to `raw` — the honest degradation for a row that was built
36
+ * without a mask and therefore has no masked text to offer.
37
+ *
38
+ * MEASURED 2026-09-06 (Codex cross-family review round 4, P2): row starts were found in the mask
39
+ * while the text was sliced from the original, so a testless `AM-1` followed by a fenced
40
+ * `AM-2 … → test \`x\` in \`x.ts\`` example borrowed the example's pointer, resolved, and the
41
+ * gate answered `pass` with exit 0. Finding in the mask and reading past it is not masking.
42
+ */
43
+ readonly scan?: string;
23
44
  }
24
45
  export type AmendmentVerdict = 'resolved' | 'placeholder'
25
46
  /**
@@ -65,6 +86,42 @@ export declare const MIN_MATCHABLE_ID_LENGTH = 8;
65
86
  */
66
87
  export declare function extractTestTitles(body: string): string[];
67
88
  export declare function normalizeTestId(s: string): string;
89
+ /** Every distinct amendment id mentioned in `text`, in first-seen order. */
90
+ export declare function amendmentIdsIn(text: string): string[];
91
+ /**
92
+ * Does `text` mention `id` AS AN ID? `AM-10` is not a mention of `AM-1`, and `AM-CP-1` is not a
93
+ * mention of `AM-1` — both are what a `String.includes` check answers wrongly.
94
+ */
95
+ export declare function mentionsAmendmentId(text: string, id: string): boolean;
96
+ /**
97
+ * How many RENDERED `## Amendments` sections the document opens. More than one is a document that
98
+ * contradicts itself, and until 2026-09-06 the FIRST one answered for all of them: a stale
99
+ * `## Amendments: None` left above the real section made the explicit-none branch exit 0 while the
100
+ * real section's unresolved rows were never parsed (Codex round 6, P2 — MEASURED `skip`, exit 0).
101
+ */
102
+ /** Where the document contradicts its own "no amendments" declaration. */
103
+ export interface AmendmentAmbiguity {
104
+ /** 1-based line in the ORIGINAL document. */
105
+ readonly line: number;
106
+ /** the offending line, trimmed and capped — evidence, not a hint. */
107
+ readonly text: string;
108
+ }
109
+ /**
110
+ * The FAIL-CLOSED half of the explicit-none contract (Codex cross-family review round 7).
111
+ *
112
+ * Seven rounds produced one outcome again and again: an ambiguous document answering `skip`/exit 0.
113
+ * Each round closed the parser hole that round's fixture used — and the next fixture used the next
114
+ * hole. This function stops paying that toll by inverting the burden: a declaration of "no
115
+ * amendments" is honoured ONLY IF the rendered document carries no amendment-shaped content below
116
+ * it. Anything AM-like with zero parsed rows means the PARSER and the DOCUMENT disagree, and the
117
+ * honest verdict for a disagreement is NOT-ESTABLISHED, never a pass and never a skip.
118
+ *
119
+ * Scanned in the block-scanned text, so fenced examples and HTML comments are already out; scanned
120
+ * from the section heading DOWN, which is deliberately more than "below the declaration" — the
121
+ * conservative direction here is to see more, because every miss is an exit 0.
122
+ */
123
+ export declare function amendmentDeclarationAmbiguity(md: string): AmendmentAmbiguity | null;
124
+ export declare function amendmentSectionCount(md: string): number;
68
125
  /** The `## Amendments` section body, or null when the document has none (acid case A5). */
69
126
  export declare function amendmentSection(md: string): string | null;
70
127
  /** `## Amendments` present but recording nothing to check — distinct from the section being absent. */
@@ -84,6 +141,21 @@ export declare function decideAmendmentOutcome(input: {
84
141
  id: string;
85
142
  kind: 'dropped' | 'subject-changed';
86
143
  }[];
144
+ /**
145
+ * How many RENDERED `## Amendments` sections the inputs open (`amendmentSectionCount`). Optional
146
+ * for backward compatibility — absent means "not measured", never "exactly one".
147
+ */
148
+ sectionCount?: number;
149
+ /**
150
+ * Amendment-shaped content found below the section heading in RENDERED text
151
+ * (`amendmentDeclarationAmbiguity`). Optional for backward compatibility — absent means "not
152
+ * measured". Present WITH zero parsed rows is the fail-closed trigger: parser and document
153
+ * disagree, so the run is inconclusive rather than skipped.
154
+ */
155
+ ambiguity?: {
156
+ readonly line: number;
157
+ readonly text: string;
158
+ } | null;
87
159
  }): AmendmentDecision;
88
160
  /** The one line every caller reads last, in the K2 gate's own shape so the two read alike. */
89
161
  export declare function amendmentVerdictLine(d: AmendmentDecision): string;
@@ -1 +1 @@
1
- {"version":3,"file":"amendment-trace.d.ts","sourceRoot":"","sources":["../src/amendment-trace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,iEAAiE;AACjE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,gBAAgB,GACxB,UAAU,GACV,aAAa;AACf;;;;;;;;;GASG;GACD,YAAY,GACZ,SAAS,GACT,eAAe,GACf,cAAc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AI,CAAC;IAC1B,2FAA2F;IAC3F,eAAe,CAAC,EAAE,SAAS;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,GAAG,iBAAiB,CAAA;KAAE,EAAE,CAAC;IACjF;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,SAAS,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACrE,GAAG,iBAAiB,CAwGpB;AAED,8FAA8F;AAC9F,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAQjE;AAED,kGAAkG;AAClG,eAAO,MAAM,sBAAsB,mJAC0G,CAAC;AAG9I;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAsBpD;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,iBAAiB,CAAC;CAC9C;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,SAAS,YAAY,EAAE,EACrC,QAAQ,EAAE,SAAS,YAAY,EAAE,GAChC,eAAe,EAAE,CAkBnB"}
@@ -14,6 +14,15 @@
14
14
  * test still pass with the protection deleted" (non-goal NG-1, acid case A8). A checker that implied
15
15
  * it proved vacuity would be the same lie in a new place.
16
16
  */
17
+ /**
18
+ * The text a row's SEMANTICS are read from: its masked slice when it has one, its raw text when it
19
+ * does not. A row built by hand or revived from JSON has no mask to speak of, so `raw` is the only
20
+ * honest answer for it — and a fallback that returns text is the difference between a legacy row
21
+ * being read slightly too generously and the whole call throwing.
22
+ */
23
+ function rowScan(row) {
24
+ return row.scan ?? row.raw;
25
+ }
17
26
  /**
18
27
  * Template placeholders that reach shipped reports. A stub read as an ordinary unresolvable id lets
19
28
  * the author believe they merely mistyped a name, so it earns its own verdict (acid case A1).
@@ -61,39 +70,344 @@ export function normalizeTestId(s) {
61
70
  // bullet drops 104 of the corpus's 347 real amendment rows out of the check entirely, and a
62
71
  // bullet-less row made this tool return `not-established` — which the pipeline's own gate text calls
63
72
  // "NEVER a pass". C6 has always treated the bullet as optional; this is that half of the contract.
64
- const ROW_START = /^(?:[-*|]\s*)?\*{0,2}AM-(?:CP-)?(\d+)/gm;
65
- /** The `## Amendments` section body, or null when the document has none (acid case A5). */
66
- export function amendmentSection(md) {
67
- const m = /^ {0,3}#{2,4}\s+Amendments\b[^\n]*\n/m.exec(md);
73
+ //
74
+ // The `CP-` prefix is CAPTURED, because it is IDENTITY: `AM-CP-N` is a row like any other AND a
75
+ // DIFFERENT id from `AM-N`. It was a non-capturing group until 2026-09-05 and the id was rebuilt
76
+ // from the number alone, so a challenge-panel row collided with the ideation's `AM-1` and the
77
+ // subject guard failed an honest plan as `subject-changed`. MEASURED TWICE that day (backlog
78
+ // a7d0aece023774a0): `run-registry-liveness` re-numbered 7 panel rows to AM-18…AM-31 to escape it,
79
+ // `core-boundary-guard` refused the `AM-CP-N` form outright. K2 (check-plan-completeness.mjs:361,
80
+ // `(AM-(?:CP-)?\d+)`) has always kept the whole token — this ends that disagreement, and the
81
+ // agreement is pinned by test/amendment-grammar-agreement.test.ts, not by this comment.
82
+ const ROW_START = /^(?:[-*|]\s*)?\*{0,2}AM-(CP-)?(\d+)/gm;
83
+ /**
84
+ * The same token, read out of ORDINARY PROSE rather than at the start of a row — `dz score` scans a
85
+ * whole plan and a whole QE report for the amendments it must account for, and a scan is not a row
86
+ * grammar (a row is anchored to the line start; a mention is not).
87
+ *
88
+ * It lives HERE, next to `ROW_START`, because the defect it closes is the same class the row
89
+ * grammar just closed (doc-26: two tools, one text, two contracts) — measured one reader later.
90
+ * MEASURED 2026-09-06: `score.ts` scanned with its own `/AM-\d+/g`, which does not match `AM-CP-1`
91
+ * at all (`node -e "console.log('AM-CP-1'.match(/AM-\d+/g))"` → `null`), so a plan whose amendments
92
+ * were all challenge-panel rows produced an EMPTY planned set and the amendment-confirmation
93
+ * discipline was skipped with no trace — a check that silently checked nothing, the very class this
94
+ * module exists to remove. There were never two readers of `AM-*`; there were three.
95
+ *
96
+ * The trailing `\b` is identity too: without it a planned `AM-1` is "covered" by a report that only
97
+ * ever mentions `AM-10` (MEASURED — `'AM-10'.includes('AM-1')` → `true`). A substring is not an id.
98
+ */
99
+ const AMENDMENT_ID_TOKEN = /\bAM-(?:CP-)?\d+\b/g;
100
+ /** Every distinct amendment id mentioned in `text`, in first-seen order. */
101
+ export function amendmentIdsIn(text) {
102
+ return [...new Set(text.match(AMENDMENT_ID_TOKEN) ?? [])];
103
+ }
104
+ /**
105
+ * Does `text` mention `id` AS AN ID? `AM-10` is not a mention of `AM-1`, and `AM-CP-1` is not a
106
+ * mention of `AM-1` — both are what a `String.includes` check answers wrongly.
107
+ */
108
+ export function mentionsAmendmentId(text, id) {
109
+ return amendmentIdsIn(text).includes(id);
110
+ }
111
+ /**
112
+ * The `## Amendments` heading line — ONE definition, because two readers of the same line is the
113
+ * defect class this module keeps closing. Group 1 is the heading SUFFIX: everything after the word
114
+ * `Amendments` on that line, which is where the inline declaration `## Amendments: None` lives.
115
+ * The final newline is optional so a document that ENDS on its heading is still a section that
116
+ * exists (an empty one) rather than no section at all.
117
+ */
118
+ const AMENDMENT_HEADING = /^ {0,3}(#{2,4})\s+Amendments\b([^\n]*)(?:\n|$)/m;
119
+ /**
120
+ * The CLOSED set of explicit-none forms, matched against a WHOLE trimmed heading suffix or a WHOLE
121
+ * trimmed first paragraph. The word alone, optionally with a full stop — nothing else.
122
+ *
123
+ * The previous trailing-guard form only checked the character AFTER the word, so ordinary prose such
124
+ * as `None of the required rows has been written yet.` passed as a DECLARATION because the next
125
+ * character was a space, and with zero parsed rows the gate answered skip/exit 0 (MEASURED
126
+ * 2026-09-06, Codex cross-family review round 7, P1). A declaration is a whole utterance, not a
127
+ * prefix: "none" is an answer, "none of X yet" is a description of work outstanding.
128
+ */
129
+ const NONE_DECLARATION_EXACT = /^(?:none|n\/a|нет)\.?$/iu;
130
+ /** Anything that LOOKS like amendment content in rendered text: a row id, a table cell, a child section. */
131
+ const AMENDMENT_LIKE = /\bAM-(?:CP-)?\d+\b|^\s*\|\s*\*{0,2}AM-|^ {0,3}#{3,6}\s+Amendments\b/;
132
+ /** A separator that turns a heading suffix into a DECLARATION rather than a qualifier. */
133
+ const HEADING_DECLARATION_SEPARATOR = /^\s*[:\u2014\u2013-]\s*/;
134
+ /**
135
+ * The document with every FENCED block blanked out — same length, same line count, so every index
136
+ * computed on the mask addresses the identical byte of the original.
137
+ *
138
+ * A plan is allowed to SHOW the form it may write, and this module must not read the example as the
139
+ * document's own answer. MEASURED 2026-09-06 (Codex round 3, P2): a fenced `## Amendments: None`
140
+ * placed above the real section won the raw heading search, the fence's own body parsed as zero
141
+ * rows, and the explicit-none branch exited 0 WITHOUT EVER LOOKING at the real section, which
142
+ * carried an unresolvable `AM-1`. That is the new false pass NFR-3 forbids. K2 has refused fenced
143
+ * examples from the start (`check-plan-completeness.mjs`, its fence-blindness fix); this is that
144
+ * half of the contract, arriving here.
145
+ *
146
+ * An UNCLOSED fence is reverted rather than trusted — masking may only lose EXAMPLES, never hide a
147
+ * real section, because a hidden section is a skip and a skip is exit 0. The safe direction is
148
+ * chosen explicitly and pinned by a test.
149
+ */
150
+ function blankLine(line) {
151
+ return ' '.repeat(line.length);
152
+ }
153
+ /**
154
+ * The document with every NON-RENDERED block blanked out — same length, same line count, so every
155
+ * index computed on the mask addresses the identical byte of the original.
156
+ *
157
+ * ONE BLOCK SCAN, not a stack of regexes. Five rounds of cross-family review found the same class
158
+ * five times — a fenced heading, a fenced row, a fenced pointer, a fence closed by a shorter run,
159
+ * an HTML-commented template — and round 6 found the sixth: `<!--` and `-->` written inside INLINE
160
+ * CODE SPANS in ordinary prose, which a `<!--[\s\S]*?-->` mask happily read as a comment spanning
161
+ * the real section (MEASURED 2026-09-06: `section: NULL`, `skip`, exit 0, the whole section
162
+ * swallowed). Each mask was born to close the previous one's hole, which is the signature of the
163
+ * wrong level: markdown decides what a document CONTAINS at BLOCK level, so that is where this
164
+ * reads. An inline construct cannot open a block, so the code-span case is closed BY CONSTRUCTION
165
+ * rather than by a longer pattern.
166
+ *
167
+ * WHAT THIS IMPLEMENTS, named so the gap is auditable:
168
+ * • CommonMark §4.5 fenced code blocks — opener ``` or ~~~ (three or more, indented ≤3), closed
169
+ * only by a run of the SAME character at least as long, with nothing but whitespace after it.
170
+ * • CommonMark §4.6 HTML blocks, TYPE 2 ONLY (`<!-- … -->`) — start condition `<!--` at the start
171
+ * of a line after at most three spaces; end condition `-->` anywhere on a line, the start line
172
+ * included. This is the rule that makes a code-spanned delimiter a non-event.
173
+ * • CommonMark §4.2 ATX headings are then matched only in what survives (the heading pattern
174
+ * itself is unchanged and allows at most three spaces of indent).
175
+ * • CommonMark §6.1 code spans are deliberately NOT parsed: no inline construct can open a block,
176
+ * so there is nothing left for them to forge.
177
+ *
178
+ * WHAT IT DOES NOT IMPLEMENT (honest, and the reason a fixture outside this list is not covered):
179
+ * indented code blocks (§4.4) — a four-space-indented row still parses as a row, though a
180
+ * four-space-indented heading is not a heading; HTML block types 1 and 3–7 (`<script>`, `<?`,
181
+ * `<!DOCTYPE`, `<![CDATA[`, block tags, generic tags); block quotes and list containers, so a fence
182
+ * nested inside them is matched by its own indentation rather than relative to its container; tabs
183
+ * as indentation; link reference definitions.
184
+ *
185
+ * DELIBERATE DEVIATION: CommonMark runs an unclosed fence (or HTML block) to the end of the
186
+ * document. Here an unclosed block is REVERTED — its lines come back. The asymmetry is the point:
187
+ * masking may lose an EXAMPLE, but hiding a real section turns the gate into `skip`, and a skip is
188
+ * exit 0. Pinned by its own tests, for both fences and comments.
189
+ */
190
+ function maskNonRendered(md) {
191
+ const lines = md.split('\n');
192
+ const out = lines.slice();
193
+ let state = 'text';
194
+ let marker = '';
195
+ let markerLength = 0;
196
+ let openedAt = -1;
197
+ for (let i = 0; i < lines.length; i++) {
198
+ const line = lines[i];
199
+ if (state === 'text') {
200
+ const fence = /^ {0,3}(`{3,}|~{3,})([^\n]*)$/.exec(line);
201
+ // CommonMark §4.5: the info string of a BACKTICK fence may not contain a backtick (a tilde
202
+ // fence may). An invalid opener is not an opener — accepting one let a later run close a
203
+ // fence that markdown never opened, exposing a `## Amendments: None` that is really inside an
204
+ // unclosed fence and hiding a real section above it (Codex round 7, P2).
205
+ if (fence && fence[1][0] === '`' && fence[2].includes('`')) {
206
+ continue;
207
+ }
208
+ if (fence) {
209
+ const run = fence[1];
210
+ state = 'fence';
211
+ marker = run[0];
212
+ markerLength = run.length;
213
+ openedAt = i;
214
+ out[i] = blankLine(line);
215
+ continue;
216
+ }
217
+ // §4.6 type 2 START CONDITION: line start, at most three spaces. NOT anywhere in the line —
218
+ // that spelling is what let a code-spanned `<!--` in prose open a comment (round 6, P1).
219
+ const htmlStart = /^ {0,3}<!--/.exec(line);
220
+ if (htmlStart) {
221
+ state = 'html';
222
+ openedAt = i;
223
+ out[i] = blankLine(line);
224
+ // The end condition may be satisfied on the start line itself.
225
+ if (/-->/.test(line)) {
226
+ state = 'text';
227
+ openedAt = -1;
228
+ }
229
+ }
230
+ continue;
231
+ }
232
+ out[i] = blankLine(line);
233
+ if (state === 'fence') {
234
+ const close = /^ {0,3}(`{3,}|~{3,})\s*$/.exec(line);
235
+ if (close) {
236
+ const run = close[1];
237
+ if (run[0] === marker && run.length >= markerLength) {
238
+ state = 'text';
239
+ openedAt = -1;
240
+ }
241
+ }
242
+ }
243
+ else if (/-->/.test(line)) {
244
+ state = 'text';
245
+ openedAt = -1;
246
+ }
247
+ }
248
+ // An unclosed block is not trusted: put its lines back (see DELIBERATE DEVIATION above).
249
+ if (openedAt >= 0)
250
+ for (let i = openedAt; i < lines.length; i++)
251
+ out[i] = lines[i];
252
+ return out.join('\n');
253
+ }
254
+ /**
255
+ * The FAIL-CLOSED half of the explicit-none contract (Codex cross-family review round 7).
256
+ *
257
+ * Seven rounds produced one outcome again and again: an ambiguous document answering `skip`/exit 0.
258
+ * Each round closed the parser hole that round's fixture used — and the next fixture used the next
259
+ * hole. This function stops paying that toll by inverting the burden: a declaration of "no
260
+ * amendments" is honoured ONLY IF the rendered document carries no amendment-shaped content below
261
+ * it. Anything AM-like with zero parsed rows means the PARSER and the DOCUMENT disagree, and the
262
+ * honest verdict for a disagreement is NOT-ESTABLISHED, never a pass and never a skip.
263
+ *
264
+ * Scanned in the block-scanned text, so fenced examples and HTML comments are already out; scanned
265
+ * from the section heading DOWN, which is deliberately more than "below the declaration" — the
266
+ * conservative direction here is to see more, because every miss is an exit 0.
267
+ */
268
+ export function amendmentDeclarationAmbiguity(md) {
269
+ const mask = maskNonRendered(md);
270
+ const m = AMENDMENT_HEADING.exec(mask);
271
+ if (m === null)
272
+ return null;
273
+ const maskLines = mask.split('\n');
274
+ const rawLines = md.split('\n');
275
+ const headingIndex = mask.slice(0, m.index).split('\n').length - 1;
276
+ for (let i = headingIndex + 1; i < maskLines.length; i++) {
277
+ const line = maskLines[i];
278
+ if (AMENDMENT_LIKE.test(line)) {
279
+ return { line: i + 1, text: (rawLines[i] ?? '').trim().slice(0, 160) };
280
+ }
281
+ }
282
+ return null;
283
+ }
284
+ export function amendmentSectionCount(md) {
285
+ const mask = maskNonRendered(md);
286
+ // DEPTH MATTERS, and the corpus is why (MEASURED 2026-09-06 on the 363-feature census while this
287
+ // refusal was being added): `features/p16-non-js-portability/06_implementation_plan.md` carries
288
+ // `## Amendments` at line 780 and `### Amendments folded in from the challenge panel …` at 845.
289
+ // The second is a SUBSECTION of the first, not a rival for it, and counting it turned a feature
290
+ // whose rows are genuinely broken from `fail` into `not-established` — a gate that answers "I
291
+ // cannot tell" where it used to name six bad rows is a REGRESSION dressed as caution. So a
292
+ // duplicate is a later heading at the SAME depth or shallower; anything deeper is a child.
293
+ const re = /^ {0,3}(#{2,4})\s+Amendments\b/gm;
294
+ let first = null;
295
+ let count = 0;
296
+ for (let m = re.exec(mask); m !== null; m = re.exec(mask)) {
297
+ const depth = m[1].length;
298
+ if (first === null) {
299
+ first = depth;
300
+ count = 1;
301
+ continue;
302
+ }
303
+ if (depth <= first)
304
+ count++;
305
+ }
306
+ return count;
307
+ }
308
+ /**
309
+ * Does the heading itself declare "none"? `## Amendments: None` is the form the pipeline's own
310
+ * Step-8 module documents (`.claude/skills/feature-adr/modules/08-qe.md:166`), and until 2026-09-06
311
+ * `amendmentSection` ate `: None` as part of the heading and returned an EMPTY body, so the
312
+ * explicit-none branch never ran and the gate answered NOT-ESTABLISHED (exit 3) on a plan that had
313
+ * said its piece (Codex cross-family review round 2, P2).
314
+ *
315
+ * A DECLARATION, not a qualifier: a separator (`:` or a dash) must precede the word, and the word
316
+ * must end there. That rule was chosen from the corpus rather than invented — the 363 features
317
+ * carry `## Amendments (carried verbatim into the plan)` (8×), `## Amendments — conditions before
318
+ * plan/code`, `## Amendments applied before Step 6` and `## Amendments and confirmation
319
+ * obligations`, and none of them may read as "none". Whole-utterance matching refuses
320
+ * `none-blocking`; an optional whitespace-separated closing `#` sequence is heading furniture.
321
+ */
322
+ function headingSaysNone(md) {
323
+ const m = AMENDMENT_HEADING.exec(maskNonRendered(md));
324
+ if (!m)
325
+ return false;
326
+ const suffix = m[1 + 1] ?? '';
327
+ const sep = HEADING_DECLARATION_SEPARATOR.exec(suffix);
328
+ if (!sep)
329
+ return false;
330
+ // CommonMark §4.2 permits an optional closing `#` sequence when whitespace separates it from
331
+ // the heading text. `None##` deliberately stays text because it has no separating whitespace.
332
+ const declaration = suffix.slice(sep[0].length).replace(/[ \t]+#+[ \t]*$/, '').trim();
333
+ // The WHOLE remainder must be the declaration (round 7, P1): `## Amendments: None` is an answer,
334
+ // `## Amendments: None of the panel rows landed` is a sentence about outstanding work.
335
+ return NONE_DECLARATION_EXACT.test(declaration);
336
+ }
337
+ /**
338
+ * The `## Amendments` section body AND the same body with fenced examples blanked out. Both are
339
+ * returned because they answer different questions: the RAW body is what a row's text is, and the
340
+ * MASKED body is what counts as a row or as a heading at all. Two callers, one traversal, no way
341
+ * for them to disagree about where the section is.
342
+ */
343
+ function amendmentSectionPair(md) {
344
+ const mask = maskNonRendered(md);
345
+ const m = AMENDMENT_HEADING.exec(mask);
68
346
  if (!m)
69
347
  return null;
70
348
  const start = m.index + m[0].length;
71
- const rest = md.slice(start);
72
- const next = /^ {0,3}#{2,4}\s+\S/m.exec(rest);
73
- return next ? rest.slice(0, next.index) : rest;
349
+ const depth = m[1].length;
350
+ // The boundary is searched in the MASK for the same reason the heading is: a `## Something`
351
+ // inside a fenced example does not end the section, it illustrates one.
352
+ //
353
+ // And it ends only at a heading of the SAME depth or SHALLOWER. A `### Amendments folded in from
354
+ // the challenge panel` under a `## Amendments` is a CHILD, and round 6 made it a non-duplicate
355
+ // for the ambiguity count while parsing still stopped dead at it — so `## Amendments: None` plus
356
+ // a deeper subsection full of rows read as zero rows and answered skip/exit 0 (MEASURED
357
+ // 2026-09-06, Codex round 7, P1). One rule for both questions: deeper is inside.
358
+ const rest = mask.slice(start);
359
+ const boundary = /^ {0,3}(#{1,6})\s+\S/gm;
360
+ let end = md.length;
361
+ for (let b = boundary.exec(rest); b !== null; b = boundary.exec(rest)) {
362
+ if (b[1].length <= depth) {
363
+ end = start + b.index;
364
+ break;
365
+ }
366
+ }
367
+ return { raw: md.slice(start, end), masked: mask.slice(start, end) };
368
+ }
369
+ /** The `## Amendments` section body, or null when the document has none (acid case A5). */
370
+ export function amendmentSection(md) {
371
+ return amendmentSectionPair(md)?.raw ?? null;
74
372
  }
75
373
  /** `## Amendments` present but recording nothing to check — distinct from the section being absent. */
76
374
  export function planSaysNoAmendments(planMd) {
77
375
  const sec = amendmentSection(planMd);
78
376
  if (sec === null)
79
377
  return false;
80
- return /^\s*(none|n\/a|нет)\b/i.test(sec.trim());
378
+ // BOTH homes of the same declaration: the section body, and the heading suffix. A reader that
379
+ // knows only one of them tells a plan that answered honestly that its grammar matched nothing.
380
+ // The body form is the FIRST PARAGRAPH, whole: `None.` is a declaration, `None of the rows has
381
+ // been written yet.` is prose about outstanding work and used to pass as one (round 7, P1).
382
+ const firstParagraph = (sec.trim().split(/\n\s*\n/)[0] ?? '').trim();
383
+ return headingSaysNone(planMd) || NONE_DECLARATION_EXACT.test(firstParagraph);
81
384
  }
82
385
  export function parseAmendments(md) {
83
- const section = amendmentSection(md);
84
- if (section === null)
386
+ const pair = amendmentSectionPair(md);
387
+ if (pair === null)
85
388
  return [];
389
+ const section = pair.raw;
390
+ // Rows are FOUND in the masked body (a fenced `- AM-9 …` is an example of the form, not an
391
+ // amendment) and SLICED from the raw one, which is the text the row actually carries. The mask is
392
+ // length-preserving, so an index means the same byte in both.
393
+ const scan = pair.masked;
86
394
  const starts = [];
87
395
  ROW_START.lastIndex = 0;
88
- for (let m = ROW_START.exec(section); m !== null; m = ROW_START.exec(section)) {
89
- starts.push({ index: m.index, num: (m[1] ?? m[2]) });
396
+ for (let m = ROW_START.exec(scan); m !== null; m = ROW_START.exec(scan)) {
397
+ // group 1 is the optional `CP-` prefix, group 2 the number. The prefix is kept because it is
398
+ // part of the id (backlog a7d0aece) — dropping it merges two provenances into one identity.
399
+ starts.push({ index: m.index, prefix: m[1] ?? '', num: m[2] });
90
400
  }
91
401
  const rows = [];
92
402
  for (let i = 0; i < starts.length; i++) {
93
403
  const s = starts[i];
94
404
  const end = i + 1 < starts.length ? starts[i + 1].index : section.length;
95
405
  const raw = section.slice(s.index, end);
96
- rows.push({ id: `AM-${s.num}`, testIds: extractTestIds(raw), file: extractFile(raw), raw });
406
+ // Pointers are read from the MASKED slice: a fenced example inside this row's block illustrates
407
+ // the form, it does not answer for the row (Codex round 4, P2 — it used to, and that resolved a
408
+ // testless amendment).
409
+ const rowScan = scan.slice(s.index, end);
410
+ rows.push({ id: `AM-${s.prefix}${s.num}`, testIds: extractTestIds(rowScan), file: extractFile(rowScan), raw, scan: rowScan });
97
411
  }
98
412
  return rows;
99
413
  }
@@ -127,7 +441,9 @@ export function resolveAmendments(rows, opts) {
127
441
  for (const row of rows) {
128
442
  // A retraction is checked BEFORE the missing-pointer branch: a row that says it was superseded
129
443
  // is not a row that forgot its test.
130
- if (SUPERSEDED.test(row.raw)) {
444
+ // The masked slice, for the same reason the pointer is: a retraction shown INSIDE a fenced
445
+ // example is an illustration of the form, not this row's retraction.
446
+ if (SUPERSEDED.test(rowScan(row))) {
131
447
  out.push({ id: row.id, testId: null, file: row.file, verdict: 'superseded', detail: 'the plan retracted this amendment and named its successor' });
132
448
  continue;
133
449
  }
@@ -210,6 +526,55 @@ export function decideAmendmentOutcome(input) {
210
526
  counts,
211
527
  };
212
528
  }
529
+ // A document that opens the section TWICE contradicts itself, and the first heading used to answer
530
+ // for both — a stale `## Amendments: None` above the real section bought a skip while the real
531
+ // section's rows were never parsed (Codex round 6, P2; MEASURED skip/exit 0). Refused BEFORE the
532
+ // explicit-none branch, and refused as INCONCLUSIVE rather than as a failure: which section is
533
+ // authoritative is not something this checker can decide, and guessing would be the same class of
534
+ // lie in a new place.
535
+ if ((input.sectionCount ?? 0) > 1) {
536
+ return {
537
+ outcome: 'not-established',
538
+ exit: 3,
539
+ reasons: [
540
+ `the document opens more than one rendered \`## Amendments\` section (${input.sectionCount}) — which one is authoritative is not decidable here, and the first one must never answer for the rest`,
541
+ ],
542
+ counts,
543
+ };
544
+ }
545
+ // An explicit "None" is an ANSWER; zero rows from a section that says nothing is a BLIND SPOT.
546
+ // Until 2026-09-06 the blind-spot branch below ran first, so a plan that honestly declared it had
547
+ // no amendments got NOT-ESTABLISHED (exit 3) — an inconclusive verdict on a document that was
548
+ // complete. MEASURED on this feature's own plan (backlog ce2da797e17a7a7f):
549
+ // `dz amendment-check --feature-dir features/amendment-trace-cp-prefix --json` → exit 3 with
550
+ // "the grammar matched nothing". The two facts are opposites and must not share a verdict.
551
+ // GUARDED: only when nothing is OWED. A gap carried in from the ideation side is owed, so an
552
+ // explicit "None" may never be the reason a dropped amendment exits 0 (that case falls through
553
+ // to the blind-spot branch, which is inconclusive — never a pass).
554
+ if (input.rows.length === 0 && input.planSaysNone && (input.missingFromPlan ?? []).length === 0) {
555
+ // FAIL-CLOSED (round 7): a declaration only answers for a document that carries nothing
556
+ // amendment-shaped below it. If it does and NOTHING parsed, the parser and the document
557
+ // disagree — which is exactly the shape every one of the seven review rounds arrived in — and a
558
+ // disagreement is NOT-ESTABLISHED. Absence of a receipt is not success.
559
+ if (input.ambiguity) {
560
+ return {
561
+ outcome: 'not-established',
562
+ exit: 3,
563
+ reasons: [
564
+ `the \`## Amendments\` section declares no amendments but AM-like content exists at line ${input.ambiguity.line} ("${input.ambiguity.text}") while ZERO rows parsed — the declaration and the document disagree, and a disagreement is never a pass`,
565
+ ],
566
+ counts,
567
+ };
568
+ }
569
+ return {
570
+ outcome: 'skip',
571
+ exit: 0,
572
+ reasons: [
573
+ 'the `## Amendments` section explicitly declares no amendments ("None"/"нет"/"n/a") and zero rows parsed — an explicit absence, which is an answer and not a grammar failure (an absence is a skip, never a pass)',
574
+ ],
575
+ counts,
576
+ };
577
+ }
213
578
  // The whole class this feature removes: a check that silently checked nothing (AM-1, acid case A7).
214
579
  if (input.rows.length === 0) {
215
580
  return {
@@ -278,7 +643,10 @@ export function amendmentSubject(raw) {
278
643
  // a colon. An earlier version consumed up to 80 characters after the id, which ate the SUBJECT
279
644
  // itself whenever a row carried no `(source):` tag — the checker then compared two truncations
280
645
  // and called honest rows a mismatch.
281
- const stripped = withoutPointer.replace(/^[\s|*\-]*\**AM-\d+\**\s*(?:\([^)]{0,80}\))?\s*:?\s*/, '');
646
+ // `AM-CP-N` is furniture too. Until 2026-09-05 this pattern demanded a digit straight after
647
+ // `AM-`, so a panel row's own id stayed inside its "subject" and every CP row read as a different
648
+ // change from every other one (backlog a7d0aece).
649
+ const stripped = withoutPointer.replace(/^[\s|*\-]*\**AM-(?:CP-)?\d+\**\s*(?:\([^)]{0,80}\))?\s*:?\s*/, '');
282
650
  return normalizeTestId(stripped);
283
651
  }
284
652
  /**
@@ -296,8 +664,8 @@ export function amendmentsMissingFromPlan(ideationRows, planRows) {
296
664
  gaps.push({ id: row.id, kind: 'dropped' });
297
665
  continue;
298
666
  }
299
- const want = amendmentSubject(row.raw);
300
- const got = amendmentSubject(planRow.raw);
667
+ const want = amendmentSubject(rowScan(row));
668
+ const got = amendmentSubject(rowScan(planRow));
301
669
  // Containment either way: a plan may append a note ("closes HIGH-2"), and ideation may be the
302
670
  // longer prose. What it may not do is describe a different change.
303
671
  if (want.length >= MIN_MATCHABLE_ID_LENGTH && !got.includes(want) && !want.includes(got)) {