diff --git a/docs/status/PROOF-STATUS.adoc b/docs/status/PROOF-STATUS.adoc index 74a64da..528f290 100644 --- a/docs/status/PROOF-STATUS.adoc +++ b/docs/status/PROOF-STATUS.adoc @@ -107,10 +107,14 @@ missing crate as missing from every build. * Negative controls: a planted false lemma is rejected. A planted `Admitted` compiles, and `Print Assumptions` reports it as an axiom. * Receipt state: superseded on 2026-11-10 by the CI receipt below. -* CI receipt (current): Rocq 8.18.0 in the pinned Guix (`8edb9da`), same - invocation, at commit `336768958d01`, run 42896264290. The file SHA-256 is - unchanged, and `Print Assumptions` reports `absent_under_all_features` - closed under the global context. +* CI receipt (superseded on 2026-11-13): Rocq 8.18.0 in the pinned Guix + (`8edb9da`), same invocation, at commit `336768958d01`, run 42896264290. + The file SHA-256 is unchanged, and `Print Assumptions` reports + `absent_under_all_features` closed under the global context. +* CI receipt (current, 2026-11-13): the same, at main `034f215`, run + 43498592499. It records the inputs manifest and an empty `(axioms)` + clause, as PROOF-POLICY §8.5.1 now requires (standards `e5a39d7`). The + file SHA-256 is unchanged. |Lean leg |`PROVEN`, route `re-proved`, correspondence `RECONCILED`. Receipt: @@ -132,9 +136,13 @@ missing crate as missing from every build. definition are rejected. A planted `sorry` compiles with a warning, and `#print axioms` reports `sorryAx`. * Receipt state: superseded on 2026-11-10 by the CI receipt below. -* CI receipt (current): Lean 4.29.0 in the pinned Guix (`8edb9da`), same - invocation, at commit `336768958d01`, run 42896264290. The file SHA-256 is - unchanged, and no declared theorem depends on an axiom. +* CI receipt (superseded on 2026-11-13): Lean 4.29.0 in the pinned Guix + (`8edb9da`), same invocation, at commit `336768958d01`, run 42896264290. + The file SHA-256 is unchanged, and no declared theorem depends on an axiom. +* CI receipt (current, 2026-11-13): the same, at main `034f215`, run + 43498592499. It records the inputs manifest and an empty `(axioms)` + clause, as PROOF-POLICY §8.5.1 now requires (standards `e5a39d7`). The + file SHA-256 is unchanged. |Why neither leg is transported |Lambdapi's Rocq and Lean exports translate before elaboration and drop diff --git a/scripts/registry/claims-registry.mjs b/scripts/registry/claims-registry.mjs index ebfce27..7f783c2 100644 --- a/scripts/registry/claims-registry.mjs +++ b/scripts/registry/claims-registry.mjs @@ -59,6 +59,18 @@ async function ledgerOnMain() { const KINDS = new Set(['theorem', 'demonstration', 'assumption']); const PWG = new Set(['PWG-1', 'PWG-2ii', 'PWG-2i', 'PWG-3', 'ungraded']); const SHELVES = new Set(['theory', 'applied']); +// ADR 0004: a record has exactly these fields, and holds no grade, token, leg +// or flag (those are read from the receipt). The set is closed, as in +// bridges.mjs and theory.mjs: any other field is refused, never ignored. +const FIELDS = new Set(['id', 'repo', 'claim', 'kind', 'statement', 'status_doc', 'agda', 'shelf', + 'source_commit', 'receipt']); +const AGDA_FIELDS = new Set(['module', 'names']); +const RECEIPT_FIELDS = new Set(['path', 'sha256']); + +// Throw unless every key of `object` is in `allowed`. +const closed = (object, allowed, label, where) => { + for (const k of Object.keys(object)) if (!allowed.has(k)) throw new Error(`${label} ${k}: ${where}`); +}; // The canon reader, pinned by commit and by the digest of its file. A reader // that is not this file is refused, so a grade never comes from an unpinned rule. @@ -89,6 +101,8 @@ export function validate(rows, inventory) { const seen = new Set(); for (const r of rows) { const where = r && r.id ? r.id : JSON.stringify(r); + if (r === null || typeof r !== 'object' || Array.isArray(r)) throw new Error(`A claim record is an object: ${where}`); + closed(r, FIELDS, 'Unknown field (a record holds no grade, token, leg or flag):', where); if (typeof r.repo !== 'string' || !/^[-\w.]+\/[-\w.]+$/.test(r.repo)) throw new Error(`Invalid repo: ${where}`); if (typeof r.claim !== 'string' || r.claim === '') throw new Error(`Missing claim id: ${where}`); if (r.id !== `${r.repo}#${r.claim}`) throw new Error(`id must be repo#claim: ${where}`); @@ -102,12 +116,14 @@ export function validate(rows, inventory) { if (!r.agda || typeof r.agda.module !== 'string' || !Array.isArray(r.agda.names) || r.agda.names.length === 0) throw new Error(`A theorem names its Agda module and names: ${r.id}`); } + if (r.agda !== null && r.agda !== undefined) closed(r.agda, AGDA_FIELDS, 'Unknown agda field', r.id); if (r.repo === HOME && r.kind === 'theorem') { if (!SHELVES.has(r.shelf)) throw new Error(`A home theorem is on the theory or the applied shelf: ${r.id}`); } else if ('shelf' in r) throw new Error(`Only a home theorem names a shelf: ${r.id}`); if (r.receipt !== null) { if (!r.receipt || typeof r.receipt.path !== 'string' || !/^[0-9a-f]{64}$/.test(r.receipt.sha256 ?? '')) throw new Error(`receipt is null or {path, sha256}: ${r.id}`); + closed(r.receipt, RECEIPT_FIELDS, 'Unknown receipt field', r.id); } if (visibility.get(r.repo) !== 'public') throw new Error(`Nonpublic or unlisted repository: ${r.id}`); } diff --git a/tests/registry/claims-registry.test.mjs b/tests/registry/claims-registry.test.mjs index 050fddd..629710c 100644 --- a/tests/registry/claims-registry.test.mjs +++ b/tests/registry/claims-registry.test.mjs @@ -72,6 +72,21 @@ test('validation fails closed', () => { expect(() => validate([{...theorem, shelf: 'theory'}], inv)).toThrow(/Only a home theorem names a shelf/); }); +// ADR 0004: a record has exactly the listed fields and holds no grade, token, +// leg or flag. Each of these rows was accepted before validate() was closed. +test('validation is closed over the ADR 0004 field set', () => { + for (const extra of [{pwg: 'PWG-1'}, {grade: 'PWG-1'}, {token: 'proven'}, {legs: []}, {leg: 'rocq'}, + {flags: ['--safe']}, {foundation_diverse: true}, {nonsense: 42}]) { + expect(() => validate([{...theorem, ...extra}], inv)).toThrow(/Unknown field/); + } + expect(() => validate([{...theorem, agda: {module: 'M', names: ['t'], pwg: 'PWG-1'}}], inv)).toThrow(/Unknown agda field/); + const receipt = {path: 'verification/receipts/x_praxis.deed', sha256: 'b'.repeat(64)}; + expect(validate([{...theorem, receipt}], inv)).toHaveLength(1); + expect(() => validate([{...theorem, receipt: {...receipt, pwg: 'PWG-1'}}], inv)).toThrow(/Unknown receipt field/); + const {status_doc: _, ...missing} = theorem; + expect(() => validate([missing], inv)).toThrow(/Missing status_doc/); +}); + test('only the pinned reader is loaded', async () => { const dir = mkdtempSync(path.join(tmpdir(), 'reader-')); mkdirSync(path.join(dir, path.dirname(READER.path)), {recursive: true});