spec-constants check: the (c'') window-cap literal is read from site_window_words (class v5 moved it out of distinct_ratio_pass); the self-test fixture follows

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
igneum-labs 2026-10-07 22:58:22 +00:00
parent 23a5148758
commit 017ed9e734

View file

@ -26,7 +26,9 @@ const SRC = 'igneum-pow/src';
// the literals inside functions the spec names as constants: name -> [file, function, regex with one capture]
const LITERALS = {
'accept::distinct_ratio_pass': ['accept.rs', 'distinct_ratio_pass', /\.min\((\d+)\)/],
// class v5 (class-v5 ab6f980b) moved the window cap into `site_window_words`, which distinct_ratio_pass calls through
// distinct_ratio_on; the spec row keeps the pass's name, the literal is read where it now lives
'accept::distinct_ratio_pass': ['accept.rs', 'site_window_words', /\.min\((\d+)\)/],
};
function tables(md) {
@ -116,7 +118,7 @@ function selfTest() {
const d = mkdtempSync(join(tmpdir(), 'spec-constants-')); const fails = [];
try {
mkdirSync(join(d, 'docs', 'spec'), { recursive: true }); mkdirSync(join(d, SRC), { recursive: true });
writeFileSync(join(d, SRC, 'accept.rs'), 'pub const ACCEPT_UNITS: usize = 64;\npub const ACCEPT_HASHES: usize = ACCEPT_UNITS * LANES;\npub const MAX_SATURATED: u32 = 164;\npub const MIN_DISTINCT_RATIO_V4: f64 = 0.98;\npub const ACCEPT_TAG: &[u8] = b"igneum-accept/";\npub fn distinct_ratio_pass(x: u64) -> u64 {\n let w = (x as u64).min(2);\n w\n}\n');
writeFileSync(join(d, SRC, 'accept.rs'), 'pub const ACCEPT_UNITS: usize = 64;\npub const ACCEPT_HASHES: usize = ACCEPT_UNITS * LANES;\npub const MAX_SATURATED: u32 = 164;\npub const MIN_DISTINCT_RATIO_V4: f64 = 0.98;\npub const ACCEPT_TAG: &[u8] = b"igneum-accept/";\npub fn site_window_words(x: u64) -> u64 {\n let w = (x as u64).min(2);\n w\n}\n');
writeFileSync(join(d, SRC, 'generator.rs'), 'pub const LANES: usize = 32;\npub const MIN_DISTINCT_SUM: u64 = 245_760;\n');
const clean = '# spec\n\n| Constant | Value | Where |\n|---|---|---|\n| accept::ACCEPT_UNITS | 64 | (c) |\n| accept::ACCEPT_HASHES | 2048 | |\n| `MIN_DISTINCT_SUM` | 245760 | |\n| accept::MIN_DISTINCT_RATIO_V4 | 0.98 | |\n| accept::ACCEPT_TAG | "igneum-accept/" | |\n| accept::distinct_ratio_pass | 2 | the window cap |\n| accept::MIN_DISTINCT_RATIO_V5 | 0.995 | class v5, pending |\n\ntext\n';
writeFileSync(join(d, SPEC), clean);