igneum/tools/ci/never-served-check.mjs
igneum-labs 3f95c6fdef /acceptance: the Test and Acceptance Standard 1.0, case by case, rendered from docs/plans/igneum-2.0-test-registry.json
The page shows each of the 128 cases in 16 suites as it is run, in the standard's words (NOT RUN, RUNNING, PASS, FAIL,
BLOCKED, DEFERRED): a header with the approval line and a thin segmented count bar (never a percentage), G0 and the five
gates G1 to G5 plus the three named gates as cards whose state follows the standard's rule, one section per suite with an
expandable row per case (setup, steps, accept, required evidence, the run's evidence record when present), the profiles
(approved as proposed, P13 deferred, the P04 line read as a FAIL to work against), the fixtures, and the closing notes.

site/lib/acceptance-render.mjs is the one renderer: build.mjs imports it for the build-time page and prints the same functions
into the page's inline script, which polls /api/acceptance (site/api/acceptance.mjs: the registry from git.igneum.network
master, cached 60 s, ok:false with status 200 on failure) and re-renders in place when a case state or source_sha256 moves.
Hooks: the Learn panel, the nav check, the sitemap, capture.sh, the og card row, a lead link on /scorecard, the facts rows 1
to 7 name the case that will prove each. The never-served check strips the plan's own marked never-served list. Node tests
(known-failed first) run in the gate; the registry and the standard text land with the page.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-08 17:40:41 +00:00

36 lines
4.4 KiB
JavaScript

// Never-served check (the Igneum 2.0 plan, 8 October 2026): the served pages never carry guaranteed chip death, a universal
// ASIC-efficiency ceiling, a chip-arrival probability, a guaranteed profit, Ethereum security by compatibility, privacy from
// ZK, a numerical rank, or the revenue thresholds the coexistence workbook holds (USD 340 M, USD 23 M, USD 20 to 75 M).
// node tools/ci/never-served-check.mjs exit 1 listing every hit (self-test first: a known-failed fixture per pattern)
import { readFileSync, readdirSync } from 'node:fs';
import { join, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
const site = join(dirname(fileURLToPath(import.meta.url)), '..', '..', 'site');
const RULES = [
['guaranteed chip death', /\b(every|each|any) chip (dies|will die|must die)\b|chips? (is|are) guaranteed to (die|expire)|guaranteed (chip|ASIC) death/i],
['a universal ASIC-efficiency ceiling', /\buniversal (ASIC|chip)[- ]?(efficiency )?ceiling\b|\bno chip can ever\b/i],
['a chip-arrival probability', /\b\d+ percent (chance|probability|odds) (of|that) (a |an )?(chip|ASIC)|\bprobability (of|that) (a |an )?(chip|ASIC) (arrives|arriving|ships|appears)|\bchip-arrival probabilit/i],
['a guaranteed profit', /\bguaranteed (profit|profits|return|returns|income|earnings)\b/i],
['Ethereum security by compatibility', /\b(inherits|inherit|gets|gives|with) Ethereum'?s? security\b|\bEthereum security (by|through|from) compatibility\b/i],
['privacy from ZK', /\b(ZK|zero-knowledge) (makes|keeps|gives|means) (it |transactions |everything )?(private|privacy)\b|\bprivate (by|through) (ZK|zero-knowledge)\b/i],
['a numerical rank', /\bnumber one\b|\b(the )?#1\b|\bno\. 1\b/i],
['a workbook threshold served as a boundary', /USD 340 ?M\b|USD 23 ?M\b|USD 20 to 75 ?M\b/],
];
// a quoted challenge on the ledger page (<blockquote>, the entry title) and a limits item that negates the claim ("X. No.") are not the
// project's claims: they are stripped before the scan, so the pages may refute a line they never make; so is the plan's own list of what
// is never served, printed once on /acceptance in <p class="acc-never" data-never-served>Never served: ...</p> (8 October 2026)
const text = (html) => html.replace(/<script[\s\S]*?<\/script>|<style[\s\S]*?<\/style>|<blockquote>[\s\S]*?<\/blockquote>|<p class="acc-never" data-never-served>Never served:[^<]*<\/p>|<h3>[^<]*<\/h3>|<strong>[^<]*<\/strong>\s*No\.|<span class="did">[^<]*<\/span>/g, ' ').replace(/<[^>]+>/g, ' ').replace(/&[a-z]+;|&#\d+;/g, ' ');
const scan = (name, html) => { const t = text(html); const hits = []; for (const [what, re] of RULES) { const m = re.exec(t); if (m) hits.push(`${name}: ${what} ("${t.slice(Math.max(0, m.index - 40), m.index + m[0].length + 40).replace(/\s+/g, ' ').trim()}")`); } return hits; };
// self-test: a known-failed fixture per rule, then a clean one
const fixtures = ['every chip dies within a year', 'a universal ASIC-efficiency ceiling of 2x', 'a 30 percent chance of a chip by 2027', 'guaranteed profits for miners', 'the chain inherits Ethereum security', 'ZK makes transactions private', 'the number one GPU chain', 'the capex wall at USD 340 M'];
let bad = 0;
fixtures.forEach((f, i) => { if (!RULES[i][1].test(f)) { console.error(`self-test: rule ${i} missed "${f}"`); bad++; } });
if (scan('clean', '<p>A GPU-secured network for Ethereum-compatible applications and verifiable computation. ZK is not privacy. EVM compatibility is not Ethereum security.</p>').length) { console.error('self-test: the clean fixture was flagged'); bad++; }
const NEVER = 'Never served: guaranteed chip death, a universal ASIC-efficiency ceiling, chip-arrival probabilities, guaranteed profits, Ethereum security by compatibility, privacy from ZK, a numerical rank.';
if (scan('list', `<p class="acc-never" data-never-served>${NEVER}</p>`).length) { console.error('self-test: the never-served list in its marked element was flagged'); bad++; }
if (!scan('list', `<p>${NEVER}</p>`).length) { console.error('self-test: the same list outside its marked element was not flagged'); bad++; }
if (bad) process.exit(1);
const hits = [];
for (const f of readdirSync(site).filter(f => f.endsWith('.html'))) hits.push(...scan(f, readFileSync(join(site, f), 'utf8')));
if (hits.length) { console.error(`never-served check: ${hits.length} hit(s)\n ${hits.join('\n ')}`); process.exit(1); }
console.log(`never-served check: ${RULES.length} rules, self-test passed, no hit on the served pages`);