From caaafd30b5856f61b275a4eff84f9f93afb047c6 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 6 Sep 2026 02:45:41 +0000 Subject: [PATCH] test(gates): the two document-count pins allow up to two words between numeral and noun MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit objectui#7448 landed the same document-count pin in two gate test files and stated the rule in both docstrings as "a numeral DIRECTLY qualifying a document-population noun". Both implemented it as strict adjacency, so a single adjective inside the noun phrase defeated them. Measured, not inferred. #7448's regex run verbatim over `check-links.yml`'s header as it stood on origin/main at 83fe6e741 — a header carrying two live drifted counts — reports one of the two: twin regex => ["183 files"] third regex => ["15 INTERNAL documents","183 files"] The count it scores clean is the one that had drifted furthest (15 against a measured 17), because an adjective sits between the numeral and the noun. This carries the third copy's pattern (objectui#7825, PR #7885, `check-links-workflow.test.ts`) to both twins verbatim: up to two intervening words, issue references excluded at the pattern level by a negative lookbehind rather than by luck, noun set unchanged. No fourth spelling is invented. The docstrings drop "DIRECTLY" — keeping it would only have inverted the same gap between what the pin claims and what it does. Latent, not live: both twin workflow headers are clean under both patterns on today's tree, so this closes a proven hole rather than a live violation. Part of objectui#7888 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01KbJQ1y1J12nZxYzFWhP8Q3 --- .../check-doc-component-types.test.ts | 36 +++++++++++++++--- .../check-doc-fence-languages.test.ts | 38 +++++++++++++++---- 2 files changed, 61 insertions(+), 13 deletions(-) diff --git a/scripts/__tests__/check-doc-component-types.test.ts b/scripts/__tests__/check-doc-component-types.test.ts index acb7868fe..7d5aceb9c 100644 --- a/scripts/__tests__/check-doc-component-types.test.ts +++ b/scripts/__tests__/check-doc-component-types.test.ts @@ -893,13 +893,35 @@ describe('wiring — the gate is reachable and a docs-only PR starts it', () => * each workflow's header is asserted beside its own gate rather than in a * shared sweep that would own neither. * - * Deliberately narrow: a numeral DIRECTLY qualifying a document-population - * noun. Issue references, `node-version`, `timeout-minutes` and "the fifth - * instance of the shape" are all numbers this header legitimately carries, and + * Deliberately narrow, and narrow in the same place as the other two copies: + * a numeral qualifying a document-population noun, with at most two words + * allowed to sit between the two. Issue references (ruled out at the pattern + * level by the negative lookbehind, not by luck), `node-version`, + * `timeout-minutes` and "the fifth instance of the shape" are all numbers + * this header legitimately carries, and * none of them rots when a page is added or deleted. It also means the header * must not quote another header's stale literal verbatim — this pin cannot * tell a quotation from a claim, and refusing both is the safe direction for a * check on prose accuracy. + * + * ⭐ Those two intervening words are objectui#7888, and they are the sentence + * above implemented rather than a new rule. This pin and its twin in + * `check-doc-fence-languages.test.ts` both said "a numeral DIRECTLY + * qualifying" and both coded it as strict adjacency, so a single adjective + * defeated them. Measured: run verbatim over `check-links.yml`'s header as it + * stood on `origin/main` at `83fe6e741` — a header carrying TWO live drifted + * counts — the adjacent-only pattern reported ONE of them. It found the + * sentence about the files the published site is built from, and scored the + * one reading "holds 15 INTERNAL documents" clean — which was the count that + * had drifted furthest (15 against a measured 17), because an adjective sat + * between the numeral and the noun. The pattern below is the third copy's, + * carried here verbatim (objectui#7825, PR objectui#7885, + * `check-links-workflow.test.ts`), with the noun set unchanged; the word + * DIRECTLY is gone from the sentence above because keeping it would only have + * inverted the same gap between what this pin claims and what it does. + * + * Both twin headers were clean under BOTH patterns when this was carried + * across, so this closes a proven hole rather than a live violation. */ it('its header states the population and never counts it — no count can rot here', () => { const header = fs @@ -907,9 +929,11 @@ describe('wiring — the gate is reachable and a docs-only PR starts it', () => .split('\n') .filter((line) => /^\s*#/.test(line)) .join('\n'); - const counts = [...header.matchAll(/\b\d+\s+`?(?:\.mdx|\.md|documents?|pages?|docs?|files?)\b/gi)].map( - (m) => m[0], - ); + const counts = [ + ...header.matchAll( + /(? m[0]); expect( counts, `doc-component-types.yml's header states a page count (${counts.join(', ')}). Nothing fails when ` + diff --git a/scripts/__tests__/check-doc-fence-languages.test.ts b/scripts/__tests__/check-doc-fence-languages.test.ts index a62c81510..35e388ebe 100644 --- a/scripts/__tests__/check-doc-fence-languages.test.ts +++ b/scripts/__tests__/check-doc-fence-languages.test.ts @@ -233,14 +233,36 @@ describe('check-doc-fence-languages is wired, not merely present', () => { * `check-doc-component-types.test.ts` — one gate, one home, so each workflow's * header is asserted beside its own gate rather than in a shared sweep. * - * Deliberately narrow: a numeral DIRECTLY qualifying a document-population - * noun. Issue references, `node-version`, `timeout-minutes` and "the sixth - * instance of the same shape" are all numbers this header legitimately - * carries, and none of them rots when a document is added or deleted. That is + * Deliberately narrow, and narrow in the same place as the other two copies: + * a numeral qualifying a document-population noun, with at most two words + * allowed to sit between the two. Issue references (ruled out at the pattern + * level by the negative lookbehind, not by luck), `node-version`, + * `timeout-minutes` and "the sixth instance of the same shape" are all + * numbers this header legitimately carries, and none of them rots when a + * document is added or deleted. That is * also why the header must not quote another header's stale literal verbatim * — this pin cannot tell a quotation from a claim, and the safe direction for * a check on prose accuracy is to refuse both. * + * ⭐ Those two intervening words are objectui#7888, and they are the sentence + * above implemented rather than a new rule. This pin and its twin in + * `check-doc-component-types.test.ts` both said "a numeral DIRECTLY + * qualifying" and both coded it as strict adjacency, so a single adjective + * defeated them. Measured: run verbatim over `check-links.yml`'s header as it + * stood on `origin/main` at `83fe6e741` — a header carrying TWO live drifted + * counts — the adjacent-only pattern reported ONE of them. It found the + * sentence about the files the published site is built from, and scored the + * one reading "holds 15 INTERNAL documents" clean — which was the count that + * had drifted furthest (15 against a measured 17), because an adjective sat + * between the numeral and the noun. The pattern below is the third copy's, + * carried here verbatim (objectui#7825, PR objectui#7885, + * `check-links-workflow.test.ts`), with the noun set unchanged; the word + * DIRECTLY is gone from the sentence above because keeping it would only have + * inverted the same gap between what this pin claims and what it does. + * + * Both twin headers were clean under BOTH patterns when this was carried + * across, so this closes a proven hole rather than a live violation. + * * Only the negative half is asserted. A positive assertion ("the header names * the verdict line") would pin a wording, and pinned wording is the thing this * file already refuses to do elsewhere; what has to stay true is that no @@ -252,9 +274,11 @@ describe('check-doc-fence-languages is wired, not merely present', () => { .split('\n') .filter((line) => /^\s*#/.test(line)) .join('\n'); - const counts = [...header.matchAll(/\b\d+\s+`?(?:\.mdx|\.md|documents?|pages?|docs?|files?)\b/gi)].map( - (m) => m[0], - ); + const counts = [ + ...header.matchAll( + /(? m[0]); expect( counts, `${WORKFLOW}'s header states a document count (${counts.join(', ')}). Nothing fails when it ` +