From 6b7ff34e218474323575020619d568f81eb445a3 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 17 Sep 2026 22:58:15 +0000 Subject: [PATCH 1/3] feat(scripts): widen the shared anchor core to the checklist's line-citation spellings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The platform checklist's forked line-citation grammar recognised five spelling classes the shared core did not: the bare colon continuation, the parenthesised bare form, the `~:` approximation, the `L` line pin and the `html` extension. The 2026-09-01 ruling in this module's own header names the exit — widen the core, never fork it for a second corpus — so the core gains them: * `html` joins the shared anchorable vocabulary (measured additive: zero `.html` tokens read as an anchor or a citation across all five corpora); * the approximation tilde inside the colon form is a line anchor for every corpus (measured: one occurrence tree-wide, in the fork's own docs); * the two PATH-LESS spellings become a third corpus declaration, `pathlessLineCitations`, defaulted OFF — measured, not assumed: on for every corpus they would fire 245 times across the prose corpora, almost all of them ports, scenario labels and docblock back-references. The 19 cases that pinned the fork's grammar are transplanted into this module's battery, every firing spelling and every silent neighbour. Claude-Session: https://claude.ai/code/session_01JbZnqu8bt6YqfJsr9vaFb3 Co-authored-by: Claude --- scripts/symbol-anchors.mjs | 240 +++++++++++++++++++++++++++++++++---- 1 file changed, 215 insertions(+), 25 deletions(-) diff --git a/scripts/symbol-anchors.mjs b/scripts/symbol-anchors.mjs index 9a59b5b2f77..cc978399e71 100644 --- a/scripts/symbol-anchors.mjs +++ b/scripts/symbol-anchors.mjs @@ -88,9 +88,9 @@ * * (`scripts/symbol-anchors.mjs#extractAnchors`, `#defineCorpus`) * - * ### Two corpus-declared variations on the SAME three forms (#18107) + * ### Three corpus-declared variations on the SAME three forms (#18107, #18592) * - * Neither changes what an anchor means; both are DELIMITER and POPULATION + * None changes what an anchor means; all three are DELIMITER and POPULATION * declarations a corpus makes about its own documents, defaulted OFF so a * corpus that says nothing reads exactly the text it read before. * @@ -110,6 +110,15 @@ * on the BASENAME and cannot see a directory, so this shape had no * spelling before -- which is precisely why that corpus stayed forked. * + * `pathlessLineCitations: true` The two LINE CITATIONS that carry no path of + * their own are judged: a bare colon continuation written without a code + * span (`id :140 and version :202`) and an `L` pin (`~L7246-7331`), both + * continuing a filename named earlier in the same sentence. This is the + * LAST half of the checklist's fork (#18592); the symbol half left at + * #18107. ⛔ Default OFF is a measurement: in PROSE a colon before digits + * is punctuation, and turning these on corpus-wide would fire 245 times + * across the prose corpora, essentially all false positives. + * * ⭐ A dotted `#Outer.member` is also part of the grammar, and `sweepCorpus` * requires EVERY segment to resolve. Admitting it was additive: a dotted symbol * could not be written inside a code span at all before, so nothing that @@ -126,9 +135,11 @@ * knows from URLs, and it survives copy-paste into a GitHub link. * * ⛔ A LINE NUMBER IS NOT AN ANCHOR FORM. `.ts:4901`, `.ts:341-400`, - * `.ts:459–463` (en dash) and a bare continuation -- a backticked `:` - * followed by a line spec, `2933` -- are all findings. ⚠️ The angle brackets - * are deliberate: this file is itself inside the `scripts/**` corpus, so an + * `.ts:459–463` (en dash), `.tsx:~605-615` (the approximation + * tilde) and a bare continuation -- a backticked `:` followed by a line spec, + * `2933` -- are all findings, and so are the two PATH-LESS spellings a corpus + * declaring `pathlessLineCitations` admits. ⚠️ The angle brackets are + * deliberate: this file is itself inside the `scripts/**` corpus, so an * illustration written path-shaped would be a citation of its own. * * ### The one escape hatch, and who may use it @@ -219,11 +230,28 @@ export const ANCHOR_GRAMMAR = [ ].join('\n '); /* Extensions an anchor may name. Deliberately the same list the #13556 census - * extracted with, so a token that census counted is a token this gate sees. */ + * extracted with, so a token that census counted is a token this gate sees. + * + * ⭐ `html` joined it when the platform checklist's forked LINE-CITATION + * grammar was folded in (#18592). That fork's own vocabulary was not a subset + * of this one: it carried `html` where this list did not, so a citation into a + * template or a fixture page was a citation ONE of the two graders could read. + * Widening here is the exit the checklist gate's own header already prescribed + * -- widen the shared vocabulary, ⛔ never re-fork a private extension set -- + * and it was measured additive before it landed: across all five registered + * corpora, ZERO `.html` tokens are read as an anchor or as a line citation + * today, so nothing that passed can start failing on this row alone. + * + * ⚠️ One hazard stated rather than discovered: `.html` is the extension that + * appears in an ordinary external URL more than any other, and a corpus + * declaring `unspannedAnchors` reads a path-shaped token out of running text. + * That class is not new -- a `/.md#` URL has always been + * readable as an anchor by the same rule -- and this row extends it rather + * than opening it. */ export const ANCHORABLE_EXTENSIONS = [ 'ts', 'tsx', 'mts', 'cts', 'js', 'jsx', 'mjs', 'cjs', 'sh', 'yaml', 'yml', 'json', 'jsonc', 'md', 'mdx', - 'sql', 'css', 'scss', 'py', 'rs', 'go', 'toml', 'prisma', + 'sql', 'css', 'scss', 'py', 'rs', 'go', 'toml', 'prisma', 'html', ]; const EXT_ALT = ANCHORABLE_EXTENSIONS.join('|'); @@ -325,7 +353,17 @@ const UNSPANNED_ANCHOR = new RegExp( * that slash list. A line number is rot wherever it is written; the only thing * excluded is a FENCED block, which is quoted material, not an anchor. */ const LINE_SPEC = '\\d+(?:\\s*[-–—]\\s*\\d+)?(?:\\s*[,/]\\s*\\d+(?:\\s*[-–—]\\s*\\d+)?)*\\+?'; -const LINE_ANCHOR = new RegExp('(?.tsx:~605-615` + * for "about line 605". It is the same rot wearing the same hat as `:2214+` -- + * an author hedging a number does not make the number survive an edit -- and + * the two graders disagreed about it, which is the drift the fold closes. + * + * ⛔ The tilde is the ONLY thing admitted here, and ⛔ no whitespace with it: a + * `:` followed by a SPACE and then digits is ordinary prose punctuation + * (`**Date**: 2026-04-19`, `exit contract: 1`), and admitting it was measured + * to fire 26 times across `docs/adr/**` alone, every one a false positive. */ +const LINE_ANCHOR = new RegExp('(?/.ts:378` — a comment that is nothing but a path. */ @@ -344,6 +382,51 @@ const FENCED_HEADER = new RegExp('^\\s*(?://|#|\\*|/\\*)\\s*' + PATHISH + ':\\d' * gated. */ const TILDE_LINE = /~\s*`(\d{2,5})`/g; +/* ⭐ THE PATH-LESS LINE CITATION, and it is OPT-IN per corpus + * (`pathlessLineCitations`). Folded in from the platform checklist's private + * grammar (#18592), which is the LAST half of that fork -- the symbol-anchor + * half became a registration at #18107 and this one stayed behind. + * + * Two spellings, and neither carries a path of its own: + * + * `ManifestSchema id :140 and version :202` bare colon continuation + * `registerRecordShareEndpoints ~L7246-7331` the `L` line pin + * + * Both continue a filename named EARLIER in the same sentence, which is how a + * data ledger writes a second pointer into a file it has already named. The + * bare half is the worse half of the class the #13556 migration deleted: it + * carries no path at all, only a number, so nothing can even report WHICH file + * rotted out from under it. + * + * ⛔ DEFAULT OFF, and that is a MEASUREMENT, not caution. Turned on for every + * corpus, these two would fire 222 and 23 times respectively across + * `docs/adr/**`, `scripts/**` and `packages/spec/src/**` -- a dev-server port + * written `(:3000)`, a scenario label `L11`, a docblock's own back-reference + * `` `:148` `` -- essentially all of them false positives, because in PROSE a + * colon before digits is punctuation. In this checklist's DATA, where every + * citation lives inside a JSON string value beside the filename it continues, + * it is a line pin. Which of the two a corpus is, is the corpus's declaration + * to make -- exactly as `unspannedAnchors` is. + * + * ⚠️ The numeric shape here is deliberately TIGHTER than `LINE_SPEC`: a plain + * run of digits with one optional hyphen range, no comma list, no slash list, + * no trailing `+` and ⛔ no internal whitespace. With a path in front of it a + * line spec is unambiguous and can afford the long form; with nothing in front + * of it the left boundary is the entire safety margin, and the forked grammar + * had already proved this exact shape out against a ledger dense with the + * neighbours it must refuse -- an HTTP status (`status:409`), a config literal + * (`{maxRetries:3}`), a URL port (`localhost:3000`), a clock time (`08:00`) + * and JSON quoted in prose (`{"scannedTypes":1}`) -- every one of them pinned + * by name in the self-test below. + * + * ⚠️ The `L` form needs a left boundary of its own so an identifier ending in + * a capital L before digits (`SQL2019`, `TTL3600`) is not read as a line pin, + * and a TWO-DIGIT floor so a lane label (`L1`) and an i18n token (`L10n`) are + * not either. */ +const PATHLESS_LINE_SPEC = '\\d+(?:-\\d+)?'; +const PATHLESS_COLON_CITATION = new RegExp('(?]*-->/; export const EXEMPT_CLASSES = ['HISTORICAL', 'EXTERNAL']; @@ -523,13 +606,17 @@ export function symbolSegmentResolution(source, filePath, symbol) { * * @param {string} markdown the document text (already projected, if the corpus * declares a `docProjection`) - * @param {{unspannedAnchors?: boolean}} [options] `unspannedAnchors` admits the - * UNSPANNED form beside the spanned one, for a corpus whose documents are - * data rather than markdown. ⛔ Default OFF: a prose corpus that never opted - * in reads exactly the text it read before. + * @param {{unspannedAnchors?: boolean, pathlessLineCitations?: boolean}} [options] + * `unspannedAnchors` admits the UNSPANNED form beside the spanned one, for a + * corpus whose documents are data rather than markdown. + * `pathlessLineCitations` admits the two line citations that carry no path of + * their own -- the bare `:NNN` continuation and the `L` pin -- for a corpus + * that writes a second pointer into a file it has already named. + * ⛔ Both default OFF: a prose corpus that never opted in reads exactly the + * text it read before. */ export function extractAnchors(markdown, options = {}) { - const { unspannedAnchors = false } = options; + const { unspannedAnchors = false, pathlessLineCitations = false } = options; const anchors = []; const lineAnchors = []; const lines = markdown.split('\n'); @@ -609,17 +696,44 @@ export function extractAnchors(markdown, options = {}) { symbol: m.groups.symbol, continuation: true, }); } + /* The spans every line citation recorded on this line occupies. The + * path-less pass below runs over the SAME text and its two spellings are + * SUFFIXES of forms already recorded here -- a backticked `` `:2933` `` is + * a `:2933` too -- so without this it would report ONE citation twice, and + * a corpus counting citations would read the duplicate as a second defect. + * Same reasoning, and same remedy, as the unspanned anchor pass above. */ + const lineAnchorRanges = []; + const pushLineAnchor = (entry, length) => { + lineAnchorRanges.push([entry.index, entry.index + length]); + lineAnchors.push(entry); + }; for (const m of text.matchAll(LINE_ANCHOR)) { const ex = exemptionFor(m.index + m[0].length); - lineAnchors.push({ line: lineNo, index: m.index, raw: m[0], path: m[1], cited: parseInt(m[2], 10), exempt: ex?.class ?? null, exemptRaw: ex?.raw ?? null }); + pushLineAnchor({ line: lineNo, index: m.index, raw: m[0], path: m[1], cited: parseInt(m[2], 10), exempt: ex?.class ?? null, exemptRaw: ex?.raw ?? null }, m[0].length); } for (const m of text.matchAll(TILDE_LINE)) { const ex = exemptionFor(m.index + m[0].length); - lineAnchors.push({ line: lineNo, index: m.index, raw: m[0], path: lastPath, cited: parseInt(m[1], 10), exempt: ex?.class ?? null, exemptRaw: ex?.raw ?? null, tilde: true }); + pushLineAnchor({ line: lineNo, index: m.index, raw: m[0], path: lastPath, cited: parseInt(m[1], 10), exempt: ex?.class ?? null, exemptRaw: ex?.raw ?? null, tilde: true }, m[0].length); } for (const m of text.matchAll(LINE_CONTINUATION)) { const ex = exemptionFor(m.index + m[0].length); - lineAnchors.push({ line: lineNo, index: m.index, raw: m[0], path: lastPath, cited: parseInt(m[1], 10), exempt: ex?.class ?? null, exemptRaw: ex?.raw ?? null, continuation: true }); + pushLineAnchor({ line: lineNo, index: m.index, raw: m[0], path: lastPath, cited: parseInt(m[1], 10), exempt: ex?.class ?? null, exemptRaw: ex?.raw ?? null, continuation: true }, m[0].length); + } + if (pathlessLineCitations) { + const alreadyRecorded = (start, end) => lineAnchorRanges.some(([s, e]) => start < e && end > s); + /* The bare colon form IS a continuation -- it continues the filename + * named before it -- so it is REPORTED as one, and `declinedShape` names + * it by how it was written rather than by the path it borrowed. */ + for (const m of text.matchAll(PATHLESS_COLON_CITATION)) { + if (alreadyRecorded(m.index, m.index + m[0].length)) continue; + const ex = exemptionFor(m.index + m[0].length); + pushLineAnchor({ line: lineNo, index: m.index, raw: m[0], path: lastPath, cited: parseInt(m[1], 10), exempt: ex?.class ?? null, exemptRaw: ex?.raw ?? null, continuation: true, pathless: true }, m[0].length); + } + for (const m of text.matchAll(PATHLESS_L_CITATION)) { + if (alreadyRecorded(m.index, m.index + m[0].length)) continue; + const ex = exemptionFor(m.index + m[0].length); + pushLineAnchor({ line: lineNo, index: m.index, raw: m[0], path: lastPath, cited: parseInt(m[1], 10), exempt: ex?.class ?? null, exemptRaw: ex?.raw ?? null, pathless: true }, m[0].length); + } } }); return { anchors, lineAnchors }; @@ -676,7 +790,7 @@ export function defineCorpus(spec) { const { id, label, docRoots, docPattern = /\.mdx?$/, crossRepos = {}, checkBarePaths = false, docProjection = null, judgeUntrackedLineAnchors = true, excludeDirs = [], - unspannedAnchors = false, + unspannedAnchors = false, pathlessLineCitations = false, } = spec; if (!id || !label) throw new Error('defineCorpus: `id` and `label` are required'); if (!Array.isArray(docRoots) || docRoots.length === 0) throw new Error('defineCorpus: `docRoots` must be a non-empty array'); @@ -697,7 +811,7 @@ export function defineCorpus(spec) { } return { id, label, docRoots, docPattern, crossRepos, checkBarePaths, docProjection, - judgeUntrackedLineAnchors, excludeDirs, unspannedAnchors, + judgeUntrackedLineAnchors, excludeDirs, unspannedAnchors, pathlessLineCitations, }; } @@ -776,13 +890,14 @@ function trackedFiles(root) { * same four words, and a residual list can be grouped without re-deriving the * classification from the raw text. * - * Order is load-bearing: a continuation and a tilde form BOTH inherit whatever - * path preceded them on the line, so they must be named by how they were - * written, never by the path they borrowed. + * Order is load-bearing: a continuation, a tilde form and a path-less citation + * ALL inherit whatever path preceded them on the line, so they must be named by + * how they were written, never by the path they borrowed. */ export function declinedShape(la) { if (la.tilde) return 'tilde'; if (la.continuation) return 'continuation'; + if (la.pathless) return 'pathless'; if (la.path?.includes('/')) return 'directory-qualified'; return 'bare-filename'; } @@ -838,7 +953,10 @@ export function sweepCorpus(corpus, root = process.cwd()) { const rawDoc = readFileSync(abs, 'utf8'); const { anchors, lineAnchors } = extractAnchors( corpus.docProjection ? corpus.docProjection(rawDoc) : rawDoc, - { unspannedAnchors: corpus.unspannedAnchors ?? false }, + { + unspannedAnchors: corpus.unspannedAnchors ?? false, + pathlessLineCitations: corpus.pathlessLineCitations ?? false, + }, ); for (const la of lineAnchors) { @@ -1003,8 +1121,15 @@ function assert(cond, msg) { if (!cond) { console.error(`❌ symbol-anchors --se // dotted symbol segments, and `excludeDirs` driven in both directions // on one fixture. Each option carries its DEFAULT-OFF control, which // is the case that says an already-registered corpus did not move. +// 122 → 149 when the LAST half of that same fork was folded in (#18592): the +// path-less line citation as a third corpus declaration, the +// approximation tilde inside the colon form and `html` in the shared +// vocabulary. The 19 cases that pinned the checklist's private +// line-citation grammar moved here — every spelling it caught and +// every colon-then-digit neighbour it refused — and the de-duplication +// pair, the inheritance pair and the default-off control joined them. const SELF_TEST_BATTERIES = Object.freeze({ - 'symbol-anchors self-test': 122, + 'symbol-anchors self-test': 149, }); // DELETING an entry silences that battery's floor exactly as effectively as @@ -1355,8 +1480,73 @@ export function selfTest() { try { defineCorpus({ id: 'x', label: 'x', docRoots: ['a'], excludeDirs: ['runs/2026'] }); } catch { exclThrew = true; } check(exclThrew, 'defineCorpus must refuse an `excludeDirs` entry carrying a separator — it would match nothing while reading as though it matched'); check(defineCorpus({ id: 'x', label: 'x', docRoots: ['a'] }).excludeDirs.length === 0 - && defineCorpus({ id: 'x', label: 'x', docRoots: ['a'] }).unspannedAnchors === false, - 'excluding nothing and requiring a code span are the DEFAULTS — an existing corpus must not be moved by adding either option'); + && defineCorpus({ id: 'x', label: 'x', docRoots: ['a'] }).unspannedAnchors === false + && defineCorpus({ id: 'x', label: 'x', docRoots: ['a'] }).pathlessLineCitations === false, + 'excluding nothing, requiring a code span and requiring a path are the DEFAULTS — an existing corpus must not be moved by adding any of the three options'); + + // 11e. ⭐ THE PATH-LESS LINE CITATION (#18592), and the whole battery that + // used to pin the platform checklist's forked grammar, transplanted. + // ⛔ A case is not deleted by moving; it is deleted by stopping. Every + // row below fired in that fork and must fire here, and every silent + // neighbour it refused must stay silent here — that pair is what makes + // the fold a fold rather than a rewrite. + // + // Driven in BOTH directions against the SAME text, because the whole + // risk of dropping the path is over-firing: with nothing in front of the + // number, the left boundary is the entire safety margin. + const plDoc = 'ManifestSchema id :140 and version :202'; + check(extractAnchors(plDoc).lineAnchors.length === 0, + 'DEFAULT: a path-less citation is NOT read — a corpus that never declared `pathlessLineCitations` reads exactly the text it read before'); + const pl = (s) => extractAnchors(s, { pathlessLineCitations: true }).lineAnchors; + const plRaw = (s) => pl(s).map((l) => l.raw); + // ⭐ FIRES — every spelling the forked grammar caught and this core did not. + check(pl(plDoc).length === 2, `OPT-IN: a bare continuation citation is caught, once per number — got ${JSON.stringify(plRaw(plDoc))}`); + check(plRaw('Ada Auditor holds ONLY auditor (:395)').join() === ':395', 'a PARENTHESISED bare citation is caught'); + check(plRaw('computeAuthGate ~:5084-5160').join() === ':5084-5160', 'an approximate `~:` bare citation is caught — the tilde sits OUTSIDE the token, exactly as the fork read it'); + check(plRaw('computeAuthGate :~5084-5160').join() === ':~5084-5160', 'and the other tilde placement, INSIDE the colon form, is caught too'); + check(plRaw('registerRecordShareEndpoints ~L7246-7331').join() === '~L7246-7331', 'a `~L` line pin is caught'); + check(plRaw('the evaluate leg L7477-7493').join() === 'L7477-7493', 'a bare `L` line pin is caught, tilde or no tilde'); + check(pl('a run at :241-243 and :255 and :267').length === 3, 'each bare citation in a chained run is its own hit'); + // ⭐ The citation INHERITS the filename named before it — that is the whole + // reason the shape exists, and reporting it with no path at all would make + // the finding unactionable. + const plInherit = pl('`packages/a/b.ts#one` then id :140'); + check(plInherit.length === 1 && plInherit[0].path === 'packages/a/b.ts' && plInherit[0].pathless === true, + `a path-less citation inherits the path named before it and is marked path-less — got ${JSON.stringify(plInherit)}`); + check(declinedShape({ pathless: true, path: 'packages/a/b.ts' }) === 'pathless', + 'a path-less citation is named by how it was WRITTEN, never by the path it borrowed'); + check(declinedShape({ continuation: true, pathless: true, path: 'packages/a/b.ts' }) === 'continuation', + 'the bare COLON form is a continuation and reports as one — it continues the filename before it'); + // ⭐ DE-DUPLICATION, both ways. A path-anchored citation and a backticked + // continuation both END in a `:NNN`, so the path-less pass must not report + // either of them a second time: a corpus counting citations would read the + // duplicate as a second defect in a file that has one. + check(plRaw('packages/a/b.ts:4901').join() === 'packages/a/b.ts:4901', + `a PATH-ANCHORED citation stays ONE hit with the option on — got ${JSON.stringify(plRaw('packages/a/b.ts:4901'))}`); + check(plRaw('`packages/a/b.ts#s` and `:2933` after').join() === '`:2933`', + `a BACKTICKED continuation stays ONE hit with the option on — got ${JSON.stringify(plRaw('`packages/a/b.ts#s` and `:2933` after'))}`); + check(plRaw('about ~`326` there').join() === '~`326`', 'the tilde bare-number form is untouched by the option'); + // ⛔ STAYS SILENT — the colon-then-digit neighbours a real ledger is full of. + // Each of these was pinned by name in the fork and is pinned by name here. + check(pl("thrown {code:'DELETE_RESTRICTED', status:409}").length === 0, 'an HTTP status in prose is not a citation'); + check(pl('retry {maxRetries:3, backoffMs:1000}').length === 0, 'a config literal is not a citation'); + check(pl('probe http://localhost:3000/_console/').length === 0, 'a URL port is not a citation'); + check(pl('daily 08:00 UTC; today() == 2026-08-31T00:00:00Z').length === 0, 'a clock time is not a citation'); + check(pl('a 200 {"scannedTypes":1,"stats":{}}').length === 0, 'JSON quoted in prose is not a citation'); + check(pl('ADR-0025 §3.3 and #13479').length === 0, 'an ADR section reference is not a citation'); + check(pl('never pin a bare colon-NNN').length === 0, 'prose that DESCRIBES the ban is not itself a citation'); + check(pl('SQL2019 and a TTL3600 budget').length === 0, 'a capital L ending an identifier before digits is not a line pin'); + check(pl('the L10n bundle').length === 0, 'an i18n-style token is not a line pin'); + check(pl('lane L1 of the queue').length === 0, 'a one-digit `L` reference is not a line pin — the floor is two digits'); + check(pl('**Date**: 2026-04-19 and exit contract: 1').length === 0, + '⛔ a colon followed by a SPACE is prose punctuation, not a citation — admitting it fires 26 times in `docs/adr/**` alone'); + // ⭐ And the spelling the fold added to the PATH-ANCHORED form, which is NOT + // behind the option: every corpus catches it. + const tildeInColon = extractAnchors('a pin at packages/a/AiChatPage.tsx:~605-615 here').lineAnchors; + check(tildeInColon.length === 1 && tildeInColon[0].cited === 605, + `the approximation tilde INSIDE the colon form is a line anchor for EVERY corpus — got ${JSON.stringify(tildeInColon.map((l) => l.raw))}`); + check(extractAnchors('a template at packages/a/page.html:42 here').lineAnchors.length === 1, + '`html` is in the shared anchorable vocabulary — a citation into a template page is read like any other'); // 12. ⛔ THE ENVIRONMENT ISOLATION PIN (#16624), and it is the one case here // that spawns `git`. `sweepCorpus` resolves through `git ls-files`, and From 8f4d102bd9847adccc930e22c9b6d36d85abf542 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 17 Sep 2026 23:04:56 +0000 Subject: [PATCH 2/3] refactor(scripts): delete the checklist's forked line-citation grammar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The symbol-anchor half of this file became a registered corpus at #18107; the line-citation half stayed forked, with `SOURCE_LINE_CITATION`, `findSourceLineCitations` and a family-file loop of its own. It is gone: a surviving `file:line`, a bare `:NNN` continuation and an `L` pin now arrive as `line-anchor` findings from the one sweep that already ran beside them. The 19 spelling cases that pinned the fork moved into the shared core's battery. What this limb pins now is the BINDING — the corpus declaration, a source read that finds no grammar here, and the binding driven ON and OFF against one text so the green is the declaration working rather than a text that would have matched either way. Claude-Session: https://claude.ai/code/session_01JbZnqu8bt6YqfJsr9vaFb3 Co-authored-by: Claude --- scripts/check-platform-checklist.mjs | 282 +++++++++++++++------------ scripts/symbol-anchors.mjs | 15 +- 2 files changed, 165 insertions(+), 132 deletions(-) diff --git a/scripts/check-platform-checklist.mjs b/scripts/check-platform-checklist.mjs index ceee8169605..5d199caa51e 100644 --- a/scripts/check-platform-checklist.mjs +++ b/scripts/check-platform-checklist.mjs @@ -95,7 +95,7 @@ import { readdirSync, readFileSync, existsSync } from 'node:fs'; import { maskComments } from './js-comment-mask.mjs'; import * as symbolAnchorsModule from './symbol-anchors.mjs'; -import { ANCHORABLE_EXTENSIONS, defineCorpus, sweepCorpus, symbolSegmentResolution } from './symbol-anchors.mjs'; +import { ANCHORABLE_EXTENSIONS, defineCorpus, extractAnchors, sweepCorpus, symbolSegmentResolution } from './symbol-anchors.mjs'; import { join, basename, relative } from 'node:path'; const ROOT = new URL('..', import.meta.url).pathname; @@ -773,7 +773,7 @@ let trapReachedVerdict = false; let provisioningReachedVerdict = false; let unreferencedReachedVerdict = false; let metaCallReachedVerdict = false; -let citationsReachedVerdict = false; +let lineCitationsReachedVerdict = false; let symbolAnchorsReachedVerdict = false; // ── The self-test's own battery roster and floor (#13489, adopted here) ──── @@ -803,7 +803,7 @@ const BATTERY_TRAP_VOCABULARY = 'selfTestTrapVocabulary: the trap table, read an const BATTERY_PROVISIONING_USE = 'selfTestProvisioningUse: both `use` spellings and all three dangling shapes'; const BATTERY_UNREFERENCED_RECIPES = 'selfTestUnreferencedRecipes: the reverse direction'; const BATTERY_META_CALL_SPELLING = 'selfTestMetaCallSpelling: the folded `/meta` plural, read from the live contract'; -const BATTERY_SOURCE_LINE_CITATIONS = 'selfTestSourceLineCitations: the `:NNN` refusal and its silent neighbours'; +const BATTERY_LINE_CITATION_BINDING = 'selfTestLineCitationBinding: the corpus declaration, the absent fork, and the binding driven both ways'; const BATTERY_SYMBOL_ANCHORS = 'selfTestSymbolAnchors: the corpus registration, the binding to the shared resolver, the residual and the floor'; const SELF_TEST_BATTERIES = Object.freeze({ @@ -811,7 +811,16 @@ const SELF_TEST_BATTERIES = Object.freeze({ [BATTERY_PROVISIONING_USE]: 34, [BATTERY_UNREFERENCED_RECIPES]: 19, [BATTERY_META_CALL_SPELLING]: 53, - [BATTERY_SOURCE_LINE_CITATIONS]: 19, + // 19 → 9 at #18592, and the SHAPE of the battery changed under it exactly as + // the symbol-anchor battery's did at #18107: the 19 spelling cases that + // pinned this file's own forked LINE-CITATION grammar moved into + // `scripts/symbol-anchors.mjs`'s battery (122 → 149 there), and 9 took their + // place — the corpus declaration, the source read that says no fork survives + // here, its control, the binding driven ON and OFF against ONE text, the DARK + // case that a citation both grammars already agreed on keeps its verdict, the + // over-firing refusal on this ledger's own colon-then-digit neighbours, and + // the live reading with its control. + [BATTERY_LINE_CITATION_BINDING]: 9, // 40 → 42 at #18107, and the SHAPE of the battery changed under it: the 25 // detector/resolver cases that pinned this file's own forked grammar moved // into `scripts/symbol-anchors.mjs`'s battery (93 → 122 there) and 27 took @@ -1303,102 +1312,121 @@ export const NEIGHBOURING_MAP: Readonly> = Object.freeze( return { checked, failures }; } -// ── Source-line citations ─────────────────────────────────────────────────── +// ── Line citations ─ ONE grammar, reached by the SAME registration ───────── +// // An item's `source` (and the prose beside it) is the evidence pointer a later // runner uses to decide whether the item still describes reality. This ledger // used to pin those pointers at `file:line` — and a line number is the ONE part // of a citation that rots on an edit the citation has nothing to do with: two // TSDoc blocks widening in the cited file shift every symbol below them, and -// every pinned line silently starts naming something else. Nothing here -// resolved a citation, so the rot was exit-0 by construction: the pointer keeps -// reading as "verified against source" while pointing somewhere else, which is -// strictly worse than no pointer at all. -// -// The whole class was stripped: `file` plus the symbol name is the load-bearing -// half and does not rot in place. This check keeps them from coming back. It is -// deliberately NOT a symbol resolver (that is the follow-up) — it is the cheap -// half, and the cheap half is the one that removes a false signal today. -// -// A citation is a colon-then-digits reached one of two ways, because the ledger -// spelled it both ways: anchored to a source filename (`.ts:158`, the -// placeholder spelling `scripts/symbol-anchors.mjs#ANCHOR_GRAMMAR` uses), -// or BARE, continuing a filename named earlier in the same sentence -// (`ManifestSchema id :140 and version :202`). The bare half is why a plain -// "filename followed by a colon" rule is not enough — and the bare half is the -// worse one, since it carries no file at all, only a number. -// -// The second branch is a negative lookbehind rather than a list of allowed -// prefixes: it is what separates a citation from the neighbours that share the -// colon-then-digit shape, all of which occur in this ledger and must stay -// silent — HTTP status (`status:409`), config literals (`{maxRetries:3}`), -// ports (`http://localhost:3000`), clock times (`08:00`, `...T00:00:00Z`) and -// JSON quoted in prose (`{"scannedTypes":1}`). Each is pinned below. -// -// A THIRD branch was added by #13788, measured rather than reasoned: sweeping -// the ledger for anchorable citations turned up four line pins the two -// branches above do not reach — `AiChatPage.tsx:~605-615` (the tilde INSIDE -// the colon form, where the battery only ever pinned `~:`) and the `~L7246-7331` -// spelling, which carries no colon at all. Both read exactly like the class -// step (1) removed, and both sat green through it. The `L` form needs its own -// left boundary so an identifier ending in a capital L before digits -// (`SQL2019`) is not read as a line pin. -const SOURCE_LINE_CITATION = - /(?:\.(?:ts|tsx|mts|cts|js|mjs|cjs|json|jsonc|md|mdx|ya?ml|sql|css|html|sh|py|toml)|(? { + const t = (what, ok, note = '') => { checked++; - if (!ok) failures.push(what); + if (!ok) failures.push(`${what}${note ? ` — ${note}` : ''}`); }; - const n = (s) => findSourceLineCitations(s).length; - - // FIRES — the spellings this ledger actually carried. - t('C1 a file-anchored citation is caught', n('packages/spec/src/kernel/manifest.zod.ts:158') === 1); - t('C2 a line RANGE is caught, as one hit not two', n('rest-server.ts:1276-1331') === 1); - t('C3 a bare continuation citation is caught', n('ManifestSchema id :140 and version :202') === 2); - t('C4 a parenthesised bare citation is caught', n('Ada Auditor holds ONLY auditor (:395)') === 1); - t('C5 an approximate `~:` citation is caught', n('computeAuthGate ~:5084-5160') === 1); - t('C6 a comma/slash-chained run is caught in full', n('storage-routes.ts:241-243,:255,:267') === 3); - - // FIRES — the two spellings #13788 measured still in the ledger after step (1). - t('C7 a colon-TILDE citation is caught — the tilde inside the colon form', n('AiChatPage.tsx:~605-615') === 1); - t('C8 a `~L` line pin is caught, colon or no colon', n('registerRecordShareEndpoints ~L7246-7331') === 1); - t('C9 a bare `L` line pin is caught', n('the evaluate leg L7477-7493') === 1); - - // STAYS SILENT — the neighbours that share the colon-then-digit shape. - t('S1 an HTTP status in prose is not a citation', n("thrown {code:'DELETE_RESTRICTED', status:409}") === 0); - t('S2 a config literal is not a citation', n('retry {maxRetries:3, backoffMs:1000}') === 0); - t('S3 a URL port is not a citation', n('probe http://localhost:3000/_console/') === 0); - t('S4 a clock time is not a citation', n('daily 08:00 UTC; today() == 2026-08-31T00:00:00Z') === 0); - t('S5 JSON quoted in prose is not a citation', n('a 200 {"scannedTypes":1,"stats":{}}') === 0); - t('S6 an ADR section reference is not a citation', n('ADR-0025 §3.3 and #13479') === 0); - t('S7 the README placeholder spelling of the ban is not itself a citation', n('never pin `file.ts:NNN` or a bare `:NNN`') === 0); - t('S8 a capital L ending an identifier before digits is not a line pin', n('SQL2019 and a TTL3600 budget') === 0); - t('S9 an i18n-style token is not a line pin', n('the L10n bundle') === 0); - t('S10 a one-digit `L` reference is not a line pin — the floor is two digits', n('lane L1 of the queue') === 0); - - citationsReachedVerdict = true; + const OWN_SOURCE = readFileSync(new URL(import.meta.url).pathname, 'utf8'); + + // ── the DECLARATION, and no grammar behind it ──────────────────────────── + t('D1 the corpus DECLARES its path-less citations — this ledger continues a filename it has already named, and without the declaration the shared grammar requires a path', + CORPUS.pathlessLineCitations === true); + /* ⚠️ NAME-BASED and PREFIX-matched, exactly as V2 below: a fork under a + * nearby name is a fork. The residual gap is the same one and is stated + * rather than papered over — a grammar under a name sharing none of these + * tokens is invisible here, which is why D3 keeps the READ honest. */ + const noLocal = (name) => !new RegExp(`\\b(?:const|let|var)\\s+${name}\\w*\\s*=`).test(OWN_SOURCE); + t('D2 this gate defines NO line-citation grammar of its own — no citation regex, no detector, no family loop of its own', + noLocal('SOURCE_LINE_CITATION') && noLocal('LINE_CITATION') && noLocal('LINE_ANCHOR') + && !/\bfunction\s+findSourceLineCitations\w*\b/.test(OWN_SOURCE) + && !/\bfunction\s+findLineCitations\w*\b/.test(OWN_SOURCE)); + t('D3 CONTROL for D2 — the same source read DOES find the declaration, so a green above is "no fork" and not "the read returned nothing"', + /pathlessLineCitations:\s*true/.test(OWN_SOURCE) && /sweepCorpus\(CORPUS, ROOT\)/.test(OWN_SOURCE)); + + // ── the binding, BOTH DIRECTIONS on the SAME text ──────────────────────── + // + // ⭐ The declaration is read off `CORPUS` rather than written as a literal, + // so deleting it from the registration fails B1 instead of leaving a case + // that passes on a flag nothing reads. + const declared = { unspannedAnchors: CORPUS.unspannedAnchors, pathlessLineCitations: CORPUS.pathlessLineCitations }; + const cited = 'ManifestSchema id :140 and the leg ~L7246-7331'; + t('B1 ON — a path-less citation in THIS ledger’s shape is read as a line anchor by the shared grammar, through the declarations this corpus makes', + extractAnchors(cited, declared).lineAnchors.length === 2, + JSON.stringify(extractAnchors(cited, declared).lineAnchors.map((l) => l.raw))); + t('B2 OFF — the SAME text is not read without the declaration, so B1 is the declaration doing the work and not a text that would have matched anyway', + extractAnchors(cited, { unspannedAnchors: CORPUS.unspannedAnchors }).lineAnchors.length === 0); + t('B3 DARK — a citation BOTH grammars already agreed on keeps its verdict, with the declaration and without it: the fold re-grades nothing that was already judged', + extractAnchors('a pin at packages/spec/src/kernel/x.zod.ts:158 here', declared).lineAnchors.length === 1 + && extractAnchors('a pin at packages/spec/src/kernel/x.zod.ts:158 here', {}).lineAnchors.length === 1); + /* ⛔ The over-firing direction, which is the whole risk of admitting a + * citation that carries no path: THIS ledger is dense with colon-then-digit + * text that is not a pin. One case, not a battery — every one of these is + * pinned by name beside the grammar, and repeating them here would be the + * second copy this card exists to delete. */ + t('B4 the neighbours this ledger is full of stay silent under the declaration — an HTTP status, a config literal, a URL port, a clock time and JSON quoted in prose', + extractAnchors('status:409 {maxRetries:3} http://localhost:3000/_console/ 08:00 {"scannedTypes":1}', declared).lineAnchors.length === 0); + + // ── the LIVE reading, so the zero above the console line prints is a + // reading and not an instrument that stopped ────────────────────────── + const liveSweep = sweepCorpus(CORPUS, ROOT); + const liveLineAnchors = liveSweep.findings.filter((f) => f.kind === 'line-anchor'); + t('B5 the live family carries NO line citation — the class the migration deleted has not come back', + liveLineAnchors.length === 0, + liveLineAnchors.map((f) => `${f.doc}:${f.line} ${f.raw}`).join(', ')); + t('B6 CONTROL for B5 — the same sweep over the same family DID read anchors, so the zero above is a reading and not a sweep that reached nothing', + liveSweep.counts.anchors > 0, `${liveSweep.counts.anchors} anchor(s)`); + + lineCitationsReachedVerdict = true; return { failures, checked }; } @@ -1513,6 +1541,16 @@ function selfTestSourceLineCitations() { // `excludeDirs: ['runs']` `docPattern` is a regex on the BASENAME and // cannot see a directory, so "the family MINUS `runs/`" had no spelling. // Run records are outputs; see `familyFiles` above. +// `pathlessLineCitations: true` (#18592) This ledger writes a second pointer +// into a file it has already named — `ManifestSchema id :140 and version +// :202` — and an `L` pin beside it. Both carry NO path of their own, and +// both were the last thing this file still detected with a grammar of its +// own. ⛔ Default OFF everywhere else, and that is a measurement rather +// than caution: in PROSE a colon before digits is punctuation, and these +// two turned on corpus-wide fire 245 times across `docs/adr/**`, +// `scripts/**` and `packages/spec/src/**`, essentially all of them ports, +// scenario labels and docblock back-references. In DATA, beside the +// filename they continue, they are line pins. // // The dotted `#Outer.member` form this ledger's grammar carried is now the // shared grammar's, and `sweepCorpus` requires EVERY segment to resolve — the @@ -1530,6 +1568,7 @@ const CORPUS = defineCorpus({ docPattern: /\.(json|md)$/, excludeDirs: ['runs'], unspannedAnchors: true, + pathlessLineCitations: true, }); // ── The residual the binding measured (#16898) ──────────────────────── @@ -1949,20 +1988,20 @@ if (process.argv.slice(2).includes('--self-test')) { const prov = selfTestProvisioningUse(); const unref = selfTestUnreferencedRecipes(); const metaCall = selfTestMetaCallSpelling(); - const cites = selfTestSourceLineCitations(); + const cites = selfTestLineCitationBinding(); const anchors = selfTestSymbolAnchors(); requireReachedVerdict('selfTestTrapVocabulary', trapReachedVerdict); requireReachedVerdict('selfTestProvisioningUse', provisioningReachedVerdict); requireReachedVerdict('selfTestUnreferencedRecipes', unreferencedReachedVerdict); requireReachedVerdict('selfTestMetaCallSpelling', metaCallReachedVerdict); - requireReachedVerdict('selfTestSourceLineCitations', citationsReachedVerdict); + requireReachedVerdict('selfTestLineCitationBinding', lineCitationsReachedVerdict); requireReachedVerdict('selfTestSymbolAnchors', symbolAnchorsReachedVerdict); const rosterFailures = batteryRosterFailures({ [BATTERY_TRAP_VOCABULARY]: trap.checked, [BATTERY_PROVISIONING_USE]: prov.checked, [BATTERY_UNREFERENCED_RECIPES]: unref.checked, [BATTERY_META_CALL_SPELLING]: metaCall.checked, - [BATTERY_SOURCE_LINE_CITATIONS]: cites.checked, + [BATTERY_LINE_CITATION_BINDING]: cites.checked, [BATTERY_SYMBOL_ANCHORS]: anchors.checked, }); const failures = [...trap.failures, ...prov.failures, ...unref.failures, ...metaCall.failures, ...cites.failures, ...anchors.failures, ...rosterFailures]; @@ -1972,7 +2011,7 @@ if (process.argv.slice(2).includes('--self-test')) { ' `fixtures.provisioning.use` resolves both spellings (own-area key and `:`) and fires on all three dangling shapes;' + ' the unreferenced-recipe direction fires on a recipe nobody uses while leaving a cross-area consumer, a retired consumer and a `$`-annotation alone;' + ' and the `/meta` call-spelling refusal reads its vocabulary out of the live generated contract, fires on every folded spelling a `call` can instruct, and stays silent on the canonical singular, on parameter placeholders, and on the `why`/`expect`/`source`/`requires` prose that narrates the fold;' + - ' and the source-line-citation refusal fires on every spelling this ledger carried (file-anchored, range, bare continuation, parenthesised, `~:`, comma/slash-chained) while staying silent on HTTP status, config literals, URL ports, clock times, JSON quoted in prose and the README placeholder that documents the ban;' + + ' and the line-citation limb DETECTS NOTHING ITSELF EITHER: the last forked grammar in this file went into the shared core at #18592, so what is pinned here is the BINDING — the corpus declaring `pathlessLineCitations`, a source read finding no citation regex and no detector while the same read DOES find the declaration, the binding driven ON and OFF against ONE text so the green is the declaration working rather than a text that would have matched anyway, the DARK case that a citation both grammars already agreed on keeps its verdict either way, the refusal to over-fire on this ledger\'s own HTTP statuses, config literals, URL ports, clock times and quoted JSON, and the live zero with the control that says it is a reading;' + ' and the symbol-anchor limb DETECTS NOTHING AND RESOLVES NOTHING ITSELF: it is a registered corpus (#18107), so the grammar, the walk and the verdict are all `scripts/symbol-anchors.mjs`\'s, pinned here by a source read that finds no local extension set, no anchor regex and no detector while the same read DOES find the registration, by the anchorable-extension vocabulary being the shared OBJECT rather than a copy of it, by the `runs/` exclusion driven three ways on the live corpus (the subtree holds files, none is swept, the areas beside it still are, and dropping the exclusion puts them back), and by the #16898 binding re-taken through the registration — a call site / import / local parameter / string-substring all reading ABSENT, the positive control that a declaration and a complete quoted token still resolve, a `.json` key resolving where a `.json` value does not, an INLINE object-literal key reading absent where one at the start of a line resolves — with the closed, grow-never residual and the per-file anchor floor held in both directions beside it.', ); process.exit(0); @@ -2026,16 +2065,16 @@ if (metaCallControl.failures.length) { process.exit(1); } -// And for the source-line-citation refusal. The control matters more here than -// anywhere else in this file: the ledger is CLEAN of line citations now, so -// this check's real output is permanently empty and its green says nothing on -// its own. A detector that silently stopped matching would be indistinguishable -// from the ledger staying clean — which is precisely the exit-0-by-construction -// shape this check was added to end. -const citationControl = selfTestSourceLineCitations(); -requireReachedVerdict('selfTestSourceLineCitations', citationsReachedVerdict); +// And for the line-citation binding. The control matters more here than +// anywhere else in this file: the ledger is CLEAN of line citations, so this +// limb's real output is permanently empty and its green says nothing on its +// own. A binding that silently stopped reaching the grammar would be +// indistinguishable from the ledger staying clean — which is precisely the +// exit-0-by-construction shape this check was added to end. +const citationControl = selfTestLineCitationBinding(); +requireReachedVerdict('selfTestLineCitationBinding', lineCitationsReachedVerdict); if (citationControl.failures.length) { - console.error('check-platform-checklist: the source-line-citation refusal\'s own positive control FAILED — a rotting `file:line` pointer would pass unreported, and because the ledger is clean nothing else here would ever notice.\n'); + console.error('check-platform-checklist: the line-citation binding\'s own positive control FAILED — a rotting `file:line` pointer would pass unreported, and because the ledger is clean nothing else here would ever notice.\n'); for (const f of citationControl.failures) console.error(` ✗ ${f}`); process.exit(1); } @@ -2057,7 +2096,7 @@ const inlineRosterFailures = batteryRosterFailures({ [BATTERY_PROVISIONING_USE]: provisioningControl.checked, [BATTERY_UNREFERENCED_RECIPES]: unreferencedControl.checked, [BATTERY_META_CALL_SPELLING]: metaCallControl.checked, - [BATTERY_SOURCE_LINE_CITATIONS]: citationControl.checked, + [BATTERY_LINE_CITATION_BINDING]: citationControl.checked, [BATTERY_SYMBOL_ANCHORS]: symbolAnchorControl.checked, }); if (inlineRosterFailures.length) { @@ -2404,22 +2443,6 @@ if (!existsSync(COVERAGE_FILE)) { } } -// The source-line-citation sweep, over the whole family rather than the area -// files alone: the same rot lives in README/RUNNER/SWEEP/FOLLOW-UPS prose, and -// FOLLOW-UPS in particular carried more citations than most area files. -let citationsScanned = 0; -for (const rel of familyFiles(CHECKLIST_DIR)) { - const hits = findSourceLineCitations(readFileSync(join(CHECKLIST_DIR, rel), 'utf8')); - citationsScanned++; - for (const hit of hits) { - err( - rel, - null, - `SOURCE LINE CITATION — \`${hit}\`. Line numbers rot on the next unrelated edit to the cited file and nothing can tell a stale one from a fresh one, so the pointer keeps reading as "verified against source" while naming something else. Cite the FILE plus the SYMBOL instead (README.md → "Every call cites framework source as \`file\` plus the symbol it lands in").`, - ); - } -} - // ── The symbol-anchor sweep ─ ONE call into the registered corpus ─────── // // ⛔ There is no loop over family files here any more, and no detector: the @@ -2427,15 +2450,22 @@ for (const rel of familyFiles(CHECKLIST_DIR)) { // reached through the `CORPUS` registration above. What stays local is what is // genuinely this corpus's own — the closed #16898 residual, and the per-file // shrink-never floor — and both are keyed off what the sweep reports. +// +// ⭐ ONE call, and it now carries BOTH limbs. The line-citation loop that used +// to stand beside this one is gone with its grammar (#18592): a surviving +// `file:line`, a bare `:NNN` continuation and an `L` pin all arrive here as +// `line-anchor` findings from the same sweep, reported below with every other +// finding kind. Two walkers over one corpus became one. const sweep = sweepCorpus(CORPUS, ROOT); // The population the sweep walked, held against the one `familyFiles` walks. -// ⚠️ They are TWO walkers over one corpus while the source-line-citation limb -// beside this one still owns its own detector (#18101 / #18104 own that half), -// and two walkers that silently disagree is the drift this card exists to -// close, one level up. So they are compared on every run rather than assumed -// equal: a `docPattern` or an `excludeDirs` that stops matching shows up here -// as a number, not as a quietly smaller sweep. +// ⚠️ The second walker is no longer a second GRADER — the line-citation limb +// that owned one went into the registration at #18592 — but `familyFiles` is +// still walked for the ledger's own structural checks, and two walkers that +// silently disagree about the POPULATION is drift of its own. So they are +// compared on every run rather than assumed equal: a `docPattern` or an +// `excludeDirs` that stops matching shows up here as a number, not as a +// quietly smaller sweep. const familyPopulation = familyFiles(CHECKLIST_DIR); if (sweep.counts.docs !== familyPopulation.length) { err( @@ -2563,8 +2593,8 @@ console.log( ` traps: ${TRAPS.size} documented, ${usedTraps.size} in use;` + ` provisioning: ${recipeTotal} area recipes, ${recipeRefs} item references resolved (${qualifiedRefs} area-qualified), ${recipesReferenced}/${recipeTotal} recipes referenced;` + ` meta-URL spelling: ${metaCallsScanned} \`call\` strings scanned against ${FOLDED_META_SPELLINGS.size} folded spellings;` + - ` source citations: ${citationsScanned} family files carry no \`file:line\` pin;` + + ` line citations: 0 survive across ${sweep.counts.docs} swept documents — \`file:line\`, a bare \`:NNN\` continuation and an \`L\` pin are all judged by \`symbol-anchors.mjs\`, through the same registration;` + ` symbol anchors: ${anchorsResolved}/${anchorsScanned} resolved by \`symbol-anchors.mjs\` (the ONE resolver, reached as a REGISTERED corpus) across ${sweep.counts.docs} swept documents against ${sweep.counts.citedSources} cited sources` + `, ${anchorsResidual} on the named #16898 residual, ${Object.keys(anchorFloors).length} file floors held;` + - ` (self-checks: ${trapControl.checked} trap-vocabulary + ${provisioningControl.checked} provisioning-resolve + ${unreferencedControl.checked} unreferenced-recipe + ${metaCallControl.checked} meta-call-spelling + ${citationControl.checked} source-line-citation + ${symbolAnchorControl.checked} symbol-anchor assertions).`, + ` (self-checks: ${trapControl.checked} trap-vocabulary + ${provisioningControl.checked} provisioning-resolve + ${unreferencedControl.checked} unreferenced-recipe + ${metaCallControl.checked} meta-call-spelling + ${citationControl.checked} line-citation-binding + ${symbolAnchorControl.checked} symbol-anchor assertions).`, ); diff --git a/scripts/symbol-anchors.mjs b/scripts/symbol-anchors.mjs index cc978399e71..804ba200ed2 100644 --- a/scripts/symbol-anchors.mjs +++ b/scripts/symbol-anchors.mjs @@ -355,8 +355,9 @@ const UNSPANNED_ANCHOR = new RegExp( const LINE_SPEC = '\\d+(?:\\s*[-–—]\\s*\\d+)?(?:\\s*[,/]\\s*\\d+(?:\\s*[-–—]\\s*\\d+)?)*\\+?'; /* ⭐ A TENTH spelling, folded in from the checklist's private grammar (#18592): * the approximation tilde written INSIDE the colon form, `.tsx:~605-615` - * for "about line 605". It is the same rot wearing the same hat as `:2214+` -- - * an author hedging a number does not make the number survive an edit -- and + * for "about line 605". It is the same rot wearing the same hat as the + * open-ended `.ts:NNN+` form -- an author hedging a number does not make + * the number survive an edit -- and * the two graders disagreed about it, which is the drift the fold closes. * * ⛔ The tilde is the ONLY thing admitted here, and ⛔ no whitespace with it: a @@ -401,8 +402,9 @@ const TILDE_LINE = /~\s*`(\d{2,5})`/g; * ⛔ DEFAULT OFF, and that is a MEASUREMENT, not caution. Turned on for every * corpus, these two would fire 222 and 23 times respectively across * `docs/adr/**`, `scripts/**` and `packages/spec/src/**` -- a dev-server port - * written `(:3000)`, a scenario label `L11`, a docblock's own back-reference - * `` `:148` `` -- essentially all of them false positives, because in PROSE a + * written as a parenthesised colon-port, a two-character scenario label, a + * docblock pointing back at a line of its own -- essentially all of them false + * positives, because in PROSE a * colon before digits is punctuation. In this checklist's DATA, where every * citation lives inside a JSON string value beside the filename it continues, * it is a line pin. Which of the two a corpus is, is the corpus's declaration @@ -698,8 +700,9 @@ export function extractAnchors(markdown, options = {}) { } /* The spans every line citation recorded on this line occupies. The * path-less pass below runs over the SAME text and its two spellings are - * SUFFIXES of forms already recorded here -- a backticked `` `:2933` `` is - * a `:2933` too -- so without this it would report ONE citation twice, and + * SUFFIXES of forms already recorded here -- a backticked continuation + * ENDS in the bare colon form the pass below looks for -- so without this + * it would report ONE citation twice, and * a corpus counting citations would read the duplicate as a second defect. * Same reasoning, and same remedy, as the unspanned anchor pass above. */ const lineAnchorRanges = []; From 88172978c7feb793cbb55fbe0cf7fd3bf68bf831 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 17 Sep 2026 23:37:30 +0000 Subject: [PATCH 3/3] chore(pm): move the compound-anchor ledger row with the renamed battery MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `check:pm-dispatch-gates` requires every compound self-test name to be classified in COMPOUND_ANCHOR_LEDGER, in the same edit that introduces it. The platform checklist's citation battery was renamed when its forked grammar was deleted, so its row moves with it — same classification, same totals. Claude-Session: https://claude.ai/code/session_01JbZnqu8bt6YqfJsr9vaFb3 Co-authored-by: Claude --- scripts/pm/dispatch-gates.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pm/dispatch-gates.mjs b/scripts/pm/dispatch-gates.mjs index e72c4d48d33..244384eb374 100644 --- a/scripts/pm/dispatch-gates.mjs +++ b/scripts/pm/dispatch-gates.mjs @@ -4965,7 +4965,7 @@ const COMPOUND_ANCHOR_LEDGER = [ ['scripts/check-platform-checklist.mjs', 'selfTestProvisioningUse', false], ['scripts/check-platform-checklist.mjs', 'selfTestUnreferencedRecipes', false], ['scripts/check-platform-checklist.mjs', 'selfTestMetaCallSpelling', false], - ['scripts/check-platform-checklist.mjs', 'selfTestSourceLineCitations', false], + ['scripts/check-platform-checklist.mjs', 'selfTestLineCitationBinding', false], ['scripts/check-platform-checklist.mjs', 'selfTestSymbolAnchors', false], ['scripts/check-regen-pending.mjs', 'fixtureSelfTest', false], ['scripts/check-regen-pending.mjs', 'prePushIsArmedSelfTest', false],