From 4d7d93abc8a00cc916004c51fdc84c3d44dfea7d Mon Sep 17 00:00:00 2001 From: slaguru666 <111923774+slaguru666@users.noreply.github.com> Date: Sun, 13 Sep 2026 10:24:32 +0100 Subject: [PATCH] check-cited: a citation marker nothing reads now fails the build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A misplaced marker failed open. CITE requires the comment to sit immediately after its figure; put one word between them and the citation is silently skipped while the run still reports OK with the same count as a clean tree: The longest fight seen ran **67** rounds. check-cited: OK — 25 cited figures ... That marker names a field the guard is supposed to refuse outright, and the guard never saw it. Worse than an absent citation, because whoever wrote it believes they added a check — and worse still in a guard written yesterday to catch exactly this shape of defect. Every `/g; +/* Every marker, however badly placed. The two counts must agree — see below. */ +const ANY_CITE = //g; let checked = 0; const problems = []; @@ -81,6 +83,26 @@ const rows = []; citations live. The raw file is the thing being checked. */ for (const [rel, abs] of scenarioFiles()) { const text = readFileSync(abs, "utf8"); + + /* A MARKER THIS GUARD CANNOT READ IS WORSE THAN NO MARKER AT ALL, because whoever wrote + it believes they added a check. CITE requires the comment to sit immediately after its + number; put one word between them and the citation is silently skipped while the run + still reports OK with the same count as a clean tree. Found by a peer session writing + a bad citation by accident. So every occurrence is counted and the totals must agree. */ + const seen = (text.match(ANY_CITE) ?? []).length; + const read = [...text.matchAll(CITE)].length; + if (seen !== read) { + const unread = text.split("\n") + .map((l, i) => [i + 1, l]) + .filter(([, l]) => ANY_CITE.test(l) && (ANY_CITE.lastIndex = 0) === 0 + && [...l.matchAll(CITE)].length < (l.match(ANY_CITE) ?? []).length); + problems.push(` ${rel}: ${seen - read} citation marker(s) not attached to a number, so ` + + `nothing checks them — a marker that looks like a citation and is never read is the ` + + `defect this guard exists for. The comment must follow its figure immediately ` + + `(\`**40**\`), with nothing but markup between.`); + unread.forEach(([n, l]) => problems.push(` line ${n}: ${l.trim().slice(0, 110)}`)); + } + for (const m of text.matchAll(CITE)) { const [, printed, name, dotted] = m; checked++; @@ -127,7 +149,7 @@ if (!checked) { } if (problems.length) { - console.error("check-cited: FAILED — a scenario prints a figure its artifact no longer holds"); + console.error("check-cited: FAILED — a scenario's cited figures do not match their artifacts"); problems.forEach(p => console.error(p)); process.exit(1); }