igneum/tools/ledger-page.mjs
igneum-labs 621e8add40 Spec read-back and the ledger page (AP-F8-5, 7 October 2026 night)
Spec 01 1.4.6: the constants table gains ACCEPT_TAG, LANES, the (c'') window-cap literal and the first-refused reading of MAX_SATURATED. tools/ci/spec-constants-check.mjs joins the gate: every "Constant | Value | Where" table of spec 01 against the crate's pub const items (an expression over constants evaluated, a byte string compared, a pending row skipped while the constant is absent), known-failed fixture first. igneum-pow/tests/spec_readback.rs derives every pinned id of the "Seed | Attempt | Id | Note" table through the crate and draws each class v4 row with its era to the stated attempt; a must-differ row asserts another id (box suite on the branch: 64 + 7 + 4 + 19 + 2 + 7 + 2 passed, build-remote rc 0).
tools/ledger-page.mjs: both entry heading forms render (M1 and AP-F8-1; the single-letter form dropped every in-house pass row from /ledger), the pass gets its own section, a known-failed self-test in the gate. docs/fud-ledger.md drops the USD 50,000 prize clauses and "paid independent cryptanalysis" (decision item 1 of 6 October: no bounty; the in-house rule of 7 October), so the regenerated site/ledger.html carries neither. checks.txt regenerated (73 checks).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-07 22:44:14 +00:00

244 lines
18 KiB
JavaScript

#!/usr/bin/env node
// Renders docs/fud-ledger.md as the public page site/ledger.html: every entry, the critic's words, what was done, the
// status and the date, with the count table on top. Nothing is dropped and nothing is softened; the only rewrites are
// the identity and provider terms of tools/ci/forbidden-strings.txt and the leak classes below (config and home paths,
// process ids, listen addresses, machine names, repository file paths), applied in place; the rendered page is then
// grepped against the same list and the render fails on a hit.
// Usage: node tools/ledger-page.mjs [docs/fud-ledger.md] [site/ledger.html]
import { readFileSync, writeFileSync } from 'node:fs';
import { join, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
const here = dirname(fileURLToPath(import.meta.url));
const root = join(here, '..');
const src = process.argv[2] || join(root, 'docs', 'fud-ledger.md');
const out = process.argv[3] || join(root, 'site', 'ledger.html');
const esc = s => s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
// Identity and provider terms. The criticism keeps its force; the operational name goes.
const SCRUB = [
[/\bJosh's\b/g, "the owner's"], [/\bJosh\b/g, 'the owner'],
[/\bHetzner\b/g, 'the cloud provider'], [/\bGoDaddy\b/g, 'the US registrar'], [/\bVercel\b/g, 'the host'],
[/CLAUDE\.md/g, 'the project rules file'], [/\.claude\/agents\/?/g, 'the agent files '],
[/\/opt\/igneum[^\s`,;)]*/g, 'the prover host directory'], [/dl\.igneum\.network/g, 'the downloads host'],
[/log[-_]intake[-_]?key|LOG_INTAKE_KEY|intake[_-]?key/gi, 'the log key'], [/log-intake|LOG_INTAKE/g, 'the log intake'],
[/\bintake id\b/g, 'the upload id'], [/\+0100/g, 'a local-time offset'], [/\bBST\b/g, 'local time'],
[/\bTailscale\b|\bts\.net\b/g, 'the private network'], [/DESKTOP-[A-Z0-9]{7}/g, 'the PC'], [/MacBook/g, 'the laptop'],
[/\bhcloud\b/g, 'the cloud CLI'], [/igneum-seed[0-9]*/g, 'the seed node'], [/\/root\//g, '/<home>/'],
[/\/Users\/[^\s/`]+/g, '~'], [/C:\\Users\\[^\s\\`]+/g, '%USERPROFILE%'], [/~\/Desktop/g, '~/<folder>'],
[/192\.168\.\d+\.\d+/g, '<lan address>'], [/100\.\d+\.\d+\.\d+/g, '<private address>'],
// 6 October 2026 (the public-page leak found by the site audit): config and home paths, process ids, listen addresses,
// machine names and repository file paths never reach the page; the ledger id beside each entry is the reference
[/~\/\.config\/[^\s`,;)]*/g, 'a config file'], [/~\/[A-Za-z0-9_.-]+(?:\/[^\s`,;)]*)?/g, 'a home-directory file'],
[/\bpid \d+\b/g, 'the process'], [/--rpclisten=\S+/g, 'the RPC listen flag'], [/\b0\.0\.0\.0:\d+\b/g, 'the listen address'],
[/\bPC [12]\b('s)?/g, (m, p) => 'the Windows machine' + (p || '')], [/\bthe Mac's\b/g, "the Apple M5 Max's"], [/\bthe Mac\b/g, 'the Apple M5 Max'],
[/(?<![\w/:.@-])(?:docs|tools|app|packaging|infra|sim|proving|vendor|igneum|site|proto-[a-z]+|rusty-kaspa|igneum-node[a-z0-9-]*)\/[\w./+-]*\w(?::\d+(?:-\d+)?)?/g, 'a repository file'],
];
const scrub = s => SCRUB.reduce((t, [re, r]) => t.replace(re, r), s);
// Inline markdown: code spans and links only; the ledger uses nothing else inside a status line.
function inline(s) {
let t = esc(s);
t = t.replace(/`([^`]+)`/g, (m, c) => `<code>${c}</code>`);
t = t.replace(/\[([^\]]+)\]\((https?:[^)]+)\)/g, (m, a, u) => `<a href="${u}" rel="noopener">${a}</a>`);
return t;
}
// An entry heading: `### M1. title` or, since 7 October 2026 night, the in-house adversarial pass's `### AP-F8-1. title`
// (the first form alone dropped every AP entry from the page while the export carried them).
const ENTRY_RE = /^### ([A-Z]\d+|AP-[A-Z]\d+-\d+)\. (.*)$/;
const secKey = id => (id.startsWith('AP-') ? 'AP' : id[0]);
export function parseLedger(text) {
const entries = [];
let cur = null;
for (const l of text.split('\n')) {
const m = ENTRY_RE.exec(l);
if (m) { cur = { id: m[1], title: m[2].trim(), quote: '', status: '', answer: '' }; entries.push(cur); continue; }
if (!cur) continue;
const s = l.trim();
if (!cur.quote && s.startsWith('"')) cur.quote = s.replace(/^"|"$/g, '');
else if (s.startsWith('Status:')) cur.status = s.slice(7).trim(); // the LAST status line wins, as tools/ledger/export-public.mjs reads it (7 October 2026: the page read the first and counted four entries as Other that the export did not)
else if (!cur.answer && s.startsWith('Answer:')) cur.answer = s.slice(7).trim();
}
return entries;
}
if (process.argv.includes('--self-test')) {
// known-failed first: the single-letter form alone misses the AP entry; then the parser sees both forms
const fx = '# l\n\n### M1. The space is small\n"Eleven ops."\n\nStatus: Open.\n\n### AP-F8-1. A hot set\n"Top items."\n\nStatus: Fixed (7 October 2026).\n\nAnswer: Yes.\n';
const old = fx.split('\n').filter(l => /^### ([A-Z]\d+)\. /.test(l)).length;
const got = parseLedger(fx);
const fails = [];
if (old !== 1) fails.push('the known-failed form did not drop the AP entry');
if (got.length !== 2 || got[1].id !== 'AP-F8-1' || got[1].status !== 'Fixed (7 October 2026).' || got[1].answer !== 'Yes.') fails.push('the parser did not read both entry forms: ' + JSON.stringify(got));
if (secKey('AP-F8-1') !== 'AP' || secKey('M1') !== 'M') fails.push('the section key is wrong');
if (fails.length) { fails.forEach(f => console.error('self-test failed: ' + f)); process.exit(1); }
console.log('self-test passed: the single-letter heading form drops an AP entry (known-failed), the parser reads M1 and AP-F8-1 with their status and answer, the section key routes AP ids to the pass section');
process.exit(0);
}
const entries = parseLedger(readFileSync(src, 'utf8'));
const SECTION = { AP: 'The in-house adversarial pass', M: 'Mining and chips', F: 'Finality and attacks', P: 'Proving and the zkEVM', E: 'Economics and the coin', G: 'Governance and the founders', C: 'Comparisons', L: 'Legal and regulatory', X: 'Launch and\u00a0operations', D: 'Builders' };
function bucket(status) {
const s = status.toLowerCase();
if (/^(fixed|rolled out|rule fixed|spec fixed|rule implemented|rule written|written|designed)/.test(s)) return 'Fixed or built';
if (s.startsWith('conceded')) return 'Conceded';
if (s.startsWith('answered by design')) return 'Answered by design';
if (/^(answered with evidence|measured|simulation half)/.test(s)) return 'Answered with evidence';
if (/^(closed|decided)/.test(s)) return 'Closed by rule or decided';
if (s.startsWith('open')) return 'Open';
return 'Other';
}
function statusWord(status) {
const m = /^([^(:.]+?)(?=\s*[(:.]|$)/.exec(status);
return (m ? m[1] : status).trim();
}
function dateOf(status) {
const m = /(\d{1,2} October 2026)/.exec(status);
return m ? m[1] : '3 October 2026';
}
const ORDER = ['Open', 'Conceded', 'Fixed or built', 'Closed by rule or decided', 'Answered with evidence', 'Answered by design', 'Other'];
const MEANING = {
'Open': 'Nothing has settled it yet. The entry names what will',
'Conceded': 'The critic is right. "Stated" means the public text says so; "not yet stated" means it does not yet',
'Fixed or built': 'A code, spec or text change answers it, with the commit or the page named',
'Closed by rule or decided': 'A consensus rule or a decision by the owner answers it, dated',
'Answered with evidence': 'A measurement or a simulation exists and is named',
'Answered by design': 'A design rule answers it; no measurement is possible yet',
'Other': 'A status outside the six above, read the line',
};
const counts = {};
for (const e of entries) { const b = bucket(e.status); counts[b] = (counts[b] || 0) + 1; }
const partial = name => readFileSync(join(root, 'site', 'partials', name), 'utf8').trim();
const HEAD = partial('head.html'), NAV = partial('nav.html'), FOOT = partial('footer.html');
// the ledger is a header item: the page underlines it like build.mjs's navFor does for the other pages
const NAV_LEDGER = NAV.replace(/(<a href="\/ledger" data-nav="ledger")/, '$1 aria-current="page"');
const intro = `This is every criticism the project expects, in the critic's words, with what was done about it and the date. ${entries.length} entries since 3 October 2026. Entries are never deleted; a status that changes keeps its history on the line. Where the critic was right the entry says Conceded. Where nothing has been done it says Open and names what settles it. The founder mined through the GPU years. Ethereum's move to proof of stake in September 2022 ended that income and the miners' place in that chain. This is one person building, with AI systems doing the engineering, the coin he wanted to exist for miners: GPU-mined, the miners are the provers, no founder allocation, every cost stated. Help is welcome and a team is wanted: cryptographers, node engineers, miners who will test. This ledger is the application form: pick an open row and write to <a href="mailto:hello@igneum.network">hello@igneum.network</a> with its id.`;
const countRows = ORDER.filter(b => counts[b]).map(b => `<tr><td class="num">${counts[b]}</td><td><button type="button" class="chip" data-filter="${esc(b)}">${esc(b)}</button></td><td>${esc(MEANING[b])}</td></tr>`).join('\n');
let body = '';
let lastSec = '';
for (const e of entries) {
const sec = SECTION[secKey(e.id)] || secKey(e.id);
if (sec !== lastSec) { body += `<h2 id="${secKey(e.id).toLowerCase()}">${esc(sec)}</h2>\n`; lastSec = sec; }
const b = bucket(e.status);
const word = statusWord(scrub(e.status));
const rest = scrub(e.status).slice(word.length).replace(/^[\s(:.]+/, '').trim();
body += `<article class="entry" id="${e.id}" data-bucket="${esc(b)}">
<div class="head"><span class="id">${e.id}</span><h3>${inline(scrub(e.title))}</h3><span class="date">${esc(dateOf(e.status))}</span></div>
<blockquote>${inline(scrub(e.quote))}</blockquote>
<div class="status"><span class="badge b-${b.toLowerCase().replace(/[^a-z]+/g, '-')}">${esc(word)}</span>${rest ? ` <span class="did">${inline(rest)}</span>` : ''}</div>
${e.answer ? `<details><summary>The answer as first written</summary><p>${inline(scrub(e.answer))}</p></details>` : ''}
</article>\n`;
}
const html = `<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>Igneum ledger: every criticism, answered</title>
<meta name="description" content="Every criticism Igneum expects, in the critic's words, with what was done, the status and the date. ${entries.length} entries. Nothing deleted, nothing softened.">
<link rel="canonical" href="https://igneum.network/ledger">
<meta name="theme-color" content="#0C0C0E">
<meta property="og:type" content="website">
<meta property="og:site_name" content="Igneum">
<meta property="og:title" content="Igneum ledger: every criticism, answered">
<meta property="og:description" content="${entries.length} criticisms in the critic's words, with what was done, the status and the date.">
<meta property="og:url" content="https://igneum.network/ledger">
<meta property="og:image" content="https://igneum.network/og-small.png?v=3">
<meta property="og:image:width" content="256">
<meta property="og:image:height" content="256">
<meta property="og:image:alt" content="Igneum. Mined by GPUs. Proven by fire.">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Igneum ledger: every criticism, answered">
<meta name="twitter:description" content="${entries.length} criticisms in the critic's words, with what was done, the status and the date.">
<meta name="twitter:image" content="https://igneum.network/og-small.png?v=3">
<meta name="twitter:image:alt" content="Igneum. Mined by GPUs. Proven by fire.">
<link rel="icon" href="/favicon.ico" sizes="48x48">
<link rel="icon" href="/favicon-32.png" type="image/png" sizes="32x32">
<link rel="icon" href="/icon-192.png" type="image/png" sizes="192x192">
<link rel="apple-touch-icon" href="/apple-touch-icon.png" sizes="180x180">
<link rel="manifest" href="/site.webmanifest">
<!-- head:start -->
${HEAD}
<!-- head:end -->
<style>
/* ledger page block (7 Oct 2026, the redesign: the page hero, the count table, the entries as records); tokens, type and components are in /site.css */
.entry p,.entry li,.entry .status{overflow-wrap:anywhere}.entry code{white-space:normal;overflow-wrap:anywhere}
main h2{font-size:27px;margin:64px 0 22px;padding-top:0;border-top:0;scroll-margin-top:120px}@media(max-width:560px){main h2{font-size:22px}}
h3{font-family:var(--f-sans);font-weight:600;font-size:17px;margin:0;flex:1 1 auto;min-width:0}
.intro{font-size:17px;color:var(--ink-2);max-width:76ch;margin:0 0 24px}
.counts td{white-space:normal}.counts td.num{font:700 22px/1.2 var(--f-display);color:var(--ember-text);white-space:nowrap}
.chip{background:none;border:1px solid var(--line-2);color:var(--bone);border-radius:999px;padding:6px 12px;font:inherit;font-size:14px;cursor:pointer;min-height:36px}
.chip:hover,.chip.on{border-color:var(--ember);color:var(--molten-text)}
.toolbar{display:flex;flex-wrap:wrap;gap:8px 14px;align-items:center;margin:0 0 8px;font-size:14px;color:var(--ash)}
.toolbar{margin:22px 0}.toolbar input{max-width:360px;min-width:220px;background:var(--row);border:1px solid var(--line-2);border-radius:8px;padding:12px 16px;color:var(--bone);font-size:14px}
.entry{border:1px solid var(--line);border-radius:12px;background:var(--row);padding:25px;margin:0 0 16px;scroll-margin-top:120px}
.entry.hide{display:none}
.entry .head{display:flex;flex-wrap:wrap;align-items:baseline;gap:6px 12px}
.id{font-family:var(--f-mono);font-size:13px;color:var(--molten-text);flex:0 0 auto}
.date{font-family:var(--f-mono);font-size:12px;color:var(--ash);flex:0 0 auto}
blockquote{margin:10px 0;padding:10px 14px;border-left:3px solid var(--line-2);color:var(--ink-2);font-style:italic}
.status{font-size:15px;color:var(--ink-2);display:block;letter-spacing:0;text-transform:none;font-family:var(--f-sans)}
.badge{display:inline-block;font-family:var(--f-mono);font-size:12px;letter-spacing:.06em;text-transform:uppercase;padding:3px 8px;border-radius:6px;border:1px solid var(--line-2);color:var(--bone);margin-right:6px;vertical-align:middle}
.b-open{border-color:var(--ember);color:var(--ember-text)}.b-conceded{border-color:var(--molten);color:var(--molten-text)}.b-fixed-or-built{border-color:#5cb85c;color:#3f9a3f}
:root:not([data-theme="light"]) .b-fixed-or-built{color:#8fd48f}
.entry details{margin-top:8px;font-size:14px;color:var(--ash);border:0}.entry details:last-of-type{border:0}.entry summary{padding:4px 0;color:var(--ash);font-weight:400}.entry details p{margin:8px 0 0;color:var(--ink-2)}
.page-hero .lead{max-width:76ch}
</style>
</head>
<body>
<!-- nav:start -->
${NAV_LEDGER}
<!-- nav:end -->
<main id="main">
<section class="page-hero">
<div class="container">
<div class="breadcrumb"><a href="/">Igneum</a><span>/</span><span>The ledger</span></div>
<div class="page-heading"><div><div class="eyebrow"><span class="line"></span>Ledger · ${entries.length} entries · regenerated from the repository</div>
<h1>Every criticism, answered<br><span class="accent">or conceded.</span></h1>
<p class="lead">${intro}</p></div></div>
</div>
</section>
<section class="section compact"><div class="container">
<div class="table-wrap counts"><table>
<thead><tr><th>Count</th><th>Status</th><th>Meaning</th></tr></thead>
<tbody>
${countRows}
<tr><td class="num">${entries.length}</td><td><button type="button" class="chip" data-filter="">All</button></td><td>Every entry. The sections: ${Object.entries(SECTION).map(([k, v]) => `<a href="#${k.toLowerCase()}">${esc(v)}</a>`).join(', ')}</td></tr>
</tbody></table></div>
<div class="toolbar"><input type="search" id="q" placeholder="Search the ledger" aria-label="Search the ledger"><span id="shown"></span></div>
${body}
<p class="intro" style="margin-top:var(--sec)">Source: the project's criticism ledger, a file in the repository, rendered to this page at build time; the repository is published at the public testnet. A criticism that is not here, or that shows an entry is wrong, is added with credit if wanted: <a href="mailto:hello@igneum.network">hello@igneum.network</a> or <a href="https://github.com/igneum-network/spec/issues" rel="noopener">an issue on the specification repository</a>.</p>
</div></section>
</main>
<!-- footer:start -->
${FOOT}
<!-- footer:end -->
<script>
(function(){
var chips=document.querySelectorAll('.chip'),entries=document.querySelectorAll('.entry'),q=document.getElementById('q'),shown=document.getElementById('shown'),f='';
function apply(){var t=(q.value||'').toLowerCase(),n=0;entries.forEach(function(e){var ok=(!f||e.getAttribute('data-bucket')===f)&&(!t||e.textContent.toLowerCase().indexOf(t)>=0);e.classList.toggle('hide',!ok);if(ok)n++;});shown.textContent=n+' of '+entries.length+' shown';chips.forEach(function(c){c.classList.toggle('on',c.getAttribute('data-filter')===f);});}
chips.forEach(function(c){c.addEventListener('click',function(){f=c.getAttribute('data-filter')||'';apply();});});
q.addEventListener('input',apply);apply();
if(location.hash){var el=document.getElementById(location.hash.slice(1));if(el)el.scrollIntoView();}
})();
</script>
</body>
</html>
`;
// hard stop (6 October 2026): the rendered page is grepped with the committed forbidden list plus the leak classes above
const forbid = readFileSync(join(root, 'tools', 'ci', 'forbidden-strings.txt'), 'utf8').split('\n').filter(l => l.trim() && !l.startsWith('#'))
.concat(['~/\\.config', '\\bpid \\d+\\b', '0\\.0\\.0\\.0:\\d+', '\\bPC [12]\\b', '\\bthe Mac\\b', '/Users/']);
const leaks = [];
for (const pat of forbid) { let re; try { re = new RegExp(pat, 'm'); } catch { continue; } const m = re.exec(html); if (m) leaks.push(`${pat}: ...${html.slice(Math.max(0, m.index - 40), m.index + 60).replace(/\s+/g, ' ')}...`); }
if (leaks.length) { console.error('ledger page: forbidden text would reach the public page:'); leaks.forEach(l => console.error(' ' + l)); process.exit(1); }
writeFileSync(out, html);
console.log(`${out}: ${entries.length} entries, counts ${JSON.stringify(counts)}`);