From 3710b40e6987b9b2fbf2650500c0a597f50f9947 Mon Sep 17 00:00:00 2001 From: os-sam Date: Tue, 8 Sep 2026 15:59:18 +0000 Subject: [PATCH] test(gates): both document-count pins strip the `#` marker before the pattern runs, as the third copy does MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All three copies of the objectui#7448 document-count pin extract a workflow's comment block before applying one shared pattern. Two of the three kept the leading `#` marker; the third stripped it, and its own docstring said why: a sentence that wraps across two comment lines has a `#` sitting in the middle of it, and the pattern cannot see a numeral and the noun it qualifies as adjacent when the line break falls between them. The marker is not one of the two intervening words the pattern allows, and it also trips the negative lookbehind that rules out issue references. That reasoning applied verbatim to the twins and neither did it. Both twins now carry the third copy's `.map` step and its paragraph verbatim. The pattern is untouched: `grep | sort | uniq -c` over the three copies still prints exactly one distinct line with count 3, and that line hashes to 3f89a4be6c1fa37f17006b67f1b5abe6dca4c5f4ab391b46468939a5917feb0e before and after. The extraction bodies now agree too — each of the four steps appears exactly three times, where `.map` previously appeared once. Measured over all 35 workflow headers under both extractions, with the in-class control that makes each `[]` a reading rather than a silence: 9 hits with markers kept, 11 with them stripped. The difference set is `pre-install-import-graph.yml` ("24 workflow files") and `shell-escape-residue.yml` ("200 markdown documents") — two live wrapped counts the old extraction could not see, neither read by any pin, so no pinned reading moves anywhere in the tree. The three pinned headers read `[]` under both. A positive control is committed in each pin rather than described: the wrapped `184` / `pages` fixture must come back as `["184 pages"]`, with the same sentence unwrapped asserted beside it so the claim is about the extraction and not about the regex. Reverting the `.map` line fails it. The floor readings in both pins are re-measured: 4696 to 4435 characters (11.7 to 11.1 times the floor) and 4514 to 4312 (11.3 to 10.8). The removed characters are markers, not prose. Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr Co-authored-by: Claude --- .../7967-twin-count-pin-marker-strip.md | 10 +++ .../check-doc-component-types.test.ts | 71 +++++++++++++++++-- .../check-doc-fence-languages.test.ts | 71 +++++++++++++++++-- 3 files changed, 144 insertions(+), 8 deletions(-) create mode 100644 .changeset/7967-twin-count-pin-marker-strip.md diff --git a/.changeset/7967-twin-count-pin-marker-strip.md b/.changeset/7967-twin-count-pin-marker-strip.md new file mode 100644 index 0000000000..43b86a483a --- /dev/null +++ b/.changeset/7967-twin-count-pin-marker-strip.md @@ -0,0 +1,10 @@ +--- +--- + +Both objectui#7448 document-count pins now read their workflow header through +the same extraction the third copy uses: the leading `#` marker is stripped +before the pattern runs, so a count that wraps across two comment lines is no +longer invisible to them (objectui#7967). The pattern itself is unchanged, +byte-identical across all three copies. A positive control demonstrating the +wrapped-count catch is committed in each pin. Test only; no package is released +by this change. diff --git a/scripts/__tests__/check-doc-component-types.test.ts b/scripts/__tests__/check-doc-component-types.test.ts index 42b88e53a0..35f9f22e26 100644 --- a/scripts/__tests__/check-doc-component-types.test.ts +++ b/scripts/__tests__/check-doc-component-types.test.ts @@ -74,13 +74,30 @@ function documentCounts(text: string): string[] { * Lifted to module scope by objectui#7901 for the same reason objectui#7914 * lifted the pattern: the pin below and the emptiness control beside it must * read ONE extraction, or the control demonstrates a surface the pin does not - * have. The extraction itself is unchanged, character for character, from what - * the pin carried inline. + * have. + * + * Stripped, not kept: a sentence that wraps across two comment lines has a `#` + * sitting in the middle of it, and a scan that reads the raw lines cannot see a + * numeral and the noun it qualifies as adjacent when the line break falls + * between them. Removing the marker is what makes the count pin below read the + * header the way a person does. + * + * That paragraph is the third copy's (`check-links-workflow.test.ts`), carried + * here verbatim by objectui#7967 together with the `.map` line it argues for. + * This extraction and its twin in the other objectui#7448 pin KEPT the marker + * while the third copy stripped it — one rule, three copies, and the two that + * never wrote down WHY were the two that drifted. The divergence is not + * theoretical: the census objectui#7967 ran over all 35 workflow headers reads + * two document counts under the stripped extraction that the kept extraction + * cannot see at all (`pre-install-import-graph.yml`, `shell-escape-residue.yml` + * — neither of them read by any pin today, which is why nothing was failing). + * The extraction control below fixtures the shape so this cannot drift back. */ function headerComments(yaml: string): string { return yaml .split('\n') .filter((line) => /^\s*#/.test(line)) + .map((line) => line.replace(/^\s*#\s?/, '')) .join('\n'); } @@ -986,8 +1003,10 @@ describe('wiring — the gate is reachable and a docs-only PR starts it', () => // objectui#7901 — the floor first, or the assertion below is vacuous. The // count half cannot distinguish a header that carries no counts from a // header this pin has stopped reading; both score `[]`. Measured when this - // was added, so it is latent rather than live: the extraction returned 4514 - // characters from this header, 11.3 times the floor. + // was added, so it is latent rather than live: the extraction returned 4312 + // characters from this header, 10.8 times the floor. It read 4514 at 11.3 + // before objectui#7967 made this extraction strip the `#` markers: 202 of + // those characters were markers, and none of them were prose. expect( header.length, 'doc-component-types.yml: the header prose this pin reads came back empty or near-empty, so it asserted over nothing', @@ -1065,6 +1084,50 @@ describe('wiring — the gate is reachable and a docs-only PR starts it', () => expect(documentCounts(line), `doc-component-types.yml's count pin must NOT fire on: ${line}`).toEqual([]); } }); + + /** + * The positive control for the EXTRACTION — objectui#7967. + * + * The control above exercises the PATTERN half of the pin and the one below + * exercises the emptiness floor. Neither can fail if the extraction hands the + * pattern a string the pattern is unable to read, and that is a third way for + * this pin to go vacuous — the one that was live here. Where an empty surface + * scores clean because there was nothing to read, this one scores clean with + * the surface arriving whole and still unreadable. + * + * Measured, not inferred. This extraction used to KEEP the `#` markers, so a + * count wrapping across two comment lines reached the pattern as + * `184\n# pages`: the marker is not one of the two intervening words the + * pattern allows, and it also trips the negative lookbehind that exists to + * rule out issue references. Run over that fixture the kept-marker extraction + * returns `[]`; the stripped one returns `["184 pages"]`. + * + * ⭐ A count landing at end-of-line is not a corner case in a block this + * shape. `doc-component-types.yml`'s header is hard-wrapped at a comment column, so a + * numeral parting from its noun is the ordinary outcome of editing a + * paragraph, not an unlucky one. + * + * Both halves are asserted because only the pair means anything. The + * unwrapped sentence proves the fixture is a count this pattern accepts, so + * the wrapped assertion is a claim about the EXTRACTION rather than about the + * regex; without it, a fixture the pattern simply never matched would look + * like the same green. + */ + it('the extraction strips the markers, so a count that wraps across comment lines is still caught', () => { + const wrapped = [' # the published site is built from 184', ' # pages today, so the sweep covers', ' name: x'].join( + '\n', + ); + expect( + documentCounts(headerComments(wrapped)), + 'a count wrapping across two comment lines must survive the extraction', + ).toEqual(['184 pages']); + + const unwrapped = ' # the published site is built from 184 pages today, so the sweep covers\n name: x'; + expect( + documentCounts(headerComments(unwrapped)), + 'the same sentence on one line — so the assertion above is about the extraction, not the pattern', + ).toEqual(['184 pages']); + }); /** * The positive control for the emptiness floor — objectui#7901. * diff --git a/scripts/__tests__/check-doc-fence-languages.test.ts b/scripts/__tests__/check-doc-fence-languages.test.ts index 913887c506..68ec775246 100644 --- a/scripts/__tests__/check-doc-fence-languages.test.ts +++ b/scripts/__tests__/check-doc-fence-languages.test.ts @@ -64,13 +64,30 @@ function documentCounts(text: string): string[] { * Lifted to module scope by objectui#7901 for the same reason objectui#7914 * lifted the pattern: the pin below and the emptiness control beside it must * read ONE extraction, or the control demonstrates a surface the pin does not - * have. The extraction itself is unchanged, character for character, from what - * the pin carried inline. + * have. + * + * Stripped, not kept: a sentence that wraps across two comment lines has a `#` + * sitting in the middle of it, and a scan that reads the raw lines cannot see a + * numeral and the noun it qualifies as adjacent when the line break falls + * between them. Removing the marker is what makes the count pin below read the + * header the way a person does. + * + * That paragraph is the third copy's (`check-links-workflow.test.ts`), carried + * here verbatim by objectui#7967 together with the `.map` line it argues for. + * This extraction and its twin in the other objectui#7448 pin KEPT the marker + * while the third copy stripped it — one rule, three copies, and the two that + * never wrote down WHY were the two that drifted. The divergence is not + * theoretical: the census objectui#7967 ran over all 35 workflow headers reads + * two document counts under the stripped extraction that the kept extraction + * cannot see at all (`pre-install-import-graph.yml`, `shell-escape-residue.yml` + * — neither of them read by any pin today, which is why nothing was failing). + * The extraction control below fixtures the shape so this cannot drift back. */ function headerComments(yaml: string): string { return yaml .split('\n') .filter((line) => /^\s*#/.test(line)) + .map((line) => line.replace(/^\s*#\s?/, '')) .join('\n'); } @@ -434,8 +451,10 @@ describe('check-doc-fence-languages is wired, not merely present', () => { // objectui#7901 — the floor first, or the assertion below is vacuous. The // count half cannot distinguish a header that carries no counts from a // header this pin has stopped reading; both score `[]`. Measured when this - // was added, so it is latent rather than live: the extraction returned 4696 - // characters from this header, 11.7 times the floor. + // was added, so it is latent rather than live: the extraction returned 4435 + // characters from this header, 11.1 times the floor. It read 4696 at 11.7 + // before objectui#7967 made this extraction strip the `#` markers: 261 of + // those characters were markers, and none of them were prose. expect( header.length, `${WORKFLOW}: the header prose this pin reads came back empty or near-empty, so it asserted over nothing`, @@ -513,6 +532,50 @@ describe('check-doc-fence-languages is wired, not merely present', () => { expect(documentCounts(line), `${WORKFLOW}'s count pin must NOT fire on: ${line}`).toEqual([]); } }); + + /** + * The positive control for the EXTRACTION — objectui#7967. + * + * The control above exercises the PATTERN half of the pin and the one below + * exercises the emptiness floor. Neither can fail if the extraction hands the + * pattern a string the pattern is unable to read, and that is a third way for + * this pin to go vacuous — the one that was live here. Where an empty surface + * scores clean because there was nothing to read, this one scores clean with + * the surface arriving whole and still unreadable. + * + * Measured, not inferred. This extraction used to KEEP the `#` markers, so a + * count wrapping across two comment lines reached the pattern as + * `184\n# pages`: the marker is not one of the two intervening words the + * pattern allows, and it also trips the negative lookbehind that exists to + * rule out issue references. Run over that fixture the kept-marker extraction + * returns `[]`; the stripped one returns `["184 pages"]`. + * + * ⭐ A count landing at end-of-line is not a corner case in a block this + * shape. `doc-fence-languages.yml`'s header is hard-wrapped at a comment column, so a + * numeral parting from its noun is the ordinary outcome of editing a + * paragraph, not an unlucky one. + * + * Both halves are asserted because only the pair means anything. The + * unwrapped sentence proves the fixture is a count this pattern accepts, so + * the wrapped assertion is a claim about the EXTRACTION rather than about the + * regex; without it, a fixture the pattern simply never matched would look + * like the same green. + */ + it('the extraction strips the markers, so a count that wraps across comment lines is still caught', () => { + const wrapped = [' # the published site is built from 184', ' # pages today, so the sweep covers', ' name: x'].join( + '\n', + ); + expect( + documentCounts(headerComments(wrapped)), + 'a count wrapping across two comment lines must survive the extraction', + ).toEqual(['184 pages']); + + const unwrapped = ' # the published site is built from 184 pages today, so the sweep covers\n name: x'; + expect( + documentCounts(headerComments(unwrapped)), + 'the same sentence on one line — so the assertion above is about the extraction, not the pattern', + ).toEqual(['184 pages']); + }); /** * The positive control for the emptiness floor — objectui#7901. *