diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd010e2a9..ed2af0631 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,6 +45,8 @@ jobs: run: python tools/manifest_integrity_check.py --coverage .github/manifest-coverage.json - name: Review records (zero independence credit, no gate moved) run: python tools/reviews_check.py + - name: Architectural admission attestations (fail-closed, no grade changed) + run: python tools/attestations_check.py - name: Recovered exceptions (candidates never stored as recoveries) run: python tools/recovery_check.py - name: Collision proposal (additive only, exported registers untouched) diff --git a/attestations/README.md b/attestations/README.md new file mode 100644 index 000000000..f68b6dd2a --- /dev/null +++ b/attestations/README.md @@ -0,0 +1,113 @@ +# `attestations/` — architectural admission records + +**An attestation is not a review, not a grade, not a promotion and not an +independence credit.** It records one thing: that a named object cleared a +named, machine-checkable *architectural* predicate at a stated commit. + +## Why this exists + +The program's throughput problem is not that work is unfinished. It is that +finished work has nowhere to be *seen* waiting. A result can be complete, +ported, hashed and structurally sound, and still be indistinguishable — to any +automated reader — from a result that was never started. The Review Queue +answers "who must look at this next"; nothing answered "which objects are +already structurally admissible and are now purely waiting on people". + +That question is answerable without moving a single status, and this directory +answers it. + +## What admission means, exactly + +`ARCH-ADMISSION-V1` passes when every structural gate the repository runs over +the object's lineage exits zero: the claim-graph firewalls accept it, logical +quarantine is enforced, every manifest matches its SHA-256 and byte count, the +register-consumer map is free of drift, no lane reads stronger than the claim +graph, frozen digests agree, and the object's own replay driver reproduces its +stated quantities. + +**Passing means the object is structurally admissible here. It does not mean +the mathematics is correct.** A wrong argument that is correctly filed, +correctly hashed and correctly scoped is `ADMITTED`, and that is deliberate: +the predicate is about structure, and structure is all it can see. Anyone +reading an `ADMITTED` record as mathematical endorsement has misread it. + +## The four properties that keep this from becoming a promotion + +1. **`claim_grade_after` is pinned to `UNCHANGED`** by the schema, and + `tools/attestations_check.py` refuses any other value. An attestation cannot + raise, lower or create a grade. +2. **`gate_status_after` is pinned to `UNCHANGED`.** No gate, premise or + obligation moves. +3. **`independence_credit` is pinned to `0`.** An attestation is not a review + and cannot carry organizational independence. R17 §4 is untouched. +4. **`awaiting` cannot be empty on an `ADMITTED` record.** Admission never + finishes anything, so a record claiming nothing remained would be false by + construction. The checker refuses it. + +`tests/test_attestations.py` carries a negative control for each, and for the +fail-closed rule below. + +## Fail-closed + +A single non-zero exit code among the recorded checks **forbids** `ADMITTED`. +A record claiming admission while carrying a failed gate is a violation, not a +judgement call. The converse also holds: a `REFUSED` record must name the check +that refused it, so a refusal cannot be asserted without evidence either. + +Exit codes are transcribed from real runs. A check nobody ran has no business +in the list. + +## What this directory does not do + +* **It does not promote.** Nothing here is a licensing predicate, and CLAUDE.md + rule 1 is unaffected: status labels are still transcribed from the source + registers and only an operator moves a gate. +* **It does not review.** It supplies no reviewer, of any provider, and no + record here counts toward any independence-requiring predicate. +* **It does not verify mathematics.** See above, twice. +* **It does not schedule.** Nothing consumes these records; this form is NOT + DEPLOYED as an enforcement mechanism. It is a queryable record, and a + queryable record is a record. +* **It does not expire.** Age never converts a `REFUSED` into an `ADMITTED`, + and never converts an `ADMITTED` into anything further. + +## Run it + +```bash +python3 tools/attestations_check.py +python3 tools/attestations_check.py --records DIR --schema PATH +python3 -m pytest -q tests/test_attestations.py +``` + +Exit status is non-zero on any violation. + +## If you are about to edit one of these files, read this + +An attestation says seven structural gates exited zero **over specific bytes**. +Change the object and the record stops describing it, so `attestations_check` +refuses the record and CI goes red. That is the check working, not a nuisance — +a record that silently kept applying to different bytes would be the quiet +inflation this directory exists to prevent. + +Currently attested, and therefore sensitive to any edit: + +```bash +python3 -c "import json,glob;print('\n'.join(sorted(json.load(open(p))['object_id'].split(' @ ')[0] for p in glob.glob('attestations/records/*.json') if not json.load(open(p)).get('superseded_by'))))" +``` + +At the time of writing: `docs/LPW_AMPLITUDE.md`, `docs/RN_BERNSTEIN_SHARP.md`, +`docs/RN_INNER_WEDGE.md`, `docs/RN_SIDE24_DENSITY.md`. + +**Editing one is fine — appending an honesty wall to it is usually an +improvement.** But the same commit needs a numbered successor attestation: +re-run the seven gates against the new bytes, write `ATT-…-B.json` +recording the exit codes you actually got, and add `superseded_by` to the +predecessor. Never edit a predecessor's attested bytes in place. Two of the four +live records have already been superseded exactly this way, both times because +another agent appended honesty prose — a good change that simply needs its +record refreshed alongside it. + +Do not copy the predecessor's `does_not_establish`: the anti-boilerplate rule +refuses a statement transcribed between records, and the successor genuinely has +something different to disclaim — that attesting bytes says nothing about +whether the newly added prose is accurate. diff --git a/attestations/attestation.schema.json b/attestations/attestation.schema.json new file mode 100644 index 000000000..200f677a6 --- /dev/null +++ b/attestations/attestation.schema.json @@ -0,0 +1,111 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/q0-research/attestations/attestation.schema.json", + "title": "Architectural admission attestation", + "description": "Machine-checkable record that a named object cleared a named, machine-checkable ARCHITECTURAL predicate at a stated commit. It is NOT a review, NOT a grade, NOT a promotion and NOT an independence credit. Admission says the repository's own structural gates accepted the object; it says nothing whatever about whether the mathematics is correct. Every admitted object is still waiting on something, and `awaiting` is where that is written down. Enforced by tools/attestations_check.py.", + "type": "object", + "additionalProperties": false, + "required": [ + "schema_version", + "attestation_id", + "attested_utc", + "object_id", + "object_title", + "object_bytes", + "object_sha256", + "predicate_id", + "predicate_statement", + "predicate_source", + "checks", + "outcome", + "awaiting", + "claim_grade_after", + "gate_status_after", + "independence_credit", + "does_not_establish" + ], + "properties": { + "schema_version": {"const": "1.0.0"}, + "attestation_id": { + "type": "string", + "pattern": "^ATT-[A-Z0-9][A-Z0-9._-]{2,60}$", + "description": "Unique in attestations/records/ and equal to the filename stem." + }, + "attested_utc": { + "type": "string", + "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$", + "description": "When the predicate was evaluated. Age never converts a REFUSED into an ADMITTED, and never converts an ADMITTED into anything further." + }, + "object_id": { + "type": "string", + "minLength": 3, + "description": "Exact object identity: repository path plus commit, Drive file id, or carrier id plus member path. Not a title, not a folder." + }, + "object_title": {"type": "string", "minLength": 3}, + "object_bytes": {"type": "integer", "minimum": 1}, + "object_sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"}, + "predicate_id": { + "type": "string", + "pattern": "^[A-Z0-9][A-Z0-9._-]{2,60}$", + "description": "Identifier of the architectural predicate evaluated, e.g. ARCH-ADMISSION-V1." + }, + "predicate_statement": { + "type": "string", + "minLength": 80, + "description": "What passing this predicate means, stated so a reader can tell what it does not mean." + }, + "predicate_source": { + "type": "string", + "minLength": 10, + "description": "Where the predicate is defined: the checker paths, the schema, or the governance document." + }, + "checks": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "additionalProperties": false, + "required": ["command", "exit_code", "summary"], + "properties": { + "command": {"type": "string", "minLength": 5}, + "exit_code": {"type": "integer"}, + "summary": {"type": "string", "minLength": 3} + } + }, + "description": "Every command actually run, with its real exit code. A single non-zero exit code forbids ADMITTED." + }, + "outcome": { + "enum": ["ADMITTED", "REFUSED"], + "description": "ADMITTED: the structural gates accepted the object. REFUSED: they did not. There is no third value, and no partial credit." + }, + "awaiting": { + "type": "array", + "minItems": 1, + "items": {"type": "string", "minLength": 5}, + "description": "What the object is still waiting on after this attestation. Required to be non-empty: architectural admission never finishes anything, so an attestation that claimed nothing remained would be false by construction." + }, + "claim_grade_after": { + "const": "UNCHANGED", + "description": "The grade of every claim after this record exists. Always UNCHANGED. An attestation cannot raise, lower or create a grade." + }, + "gate_status_after": { + "const": "UNCHANGED", + "description": "The state of every gate, premise and obligation after this record exists. Always UNCHANGED." + }, + "independence_credit": { + "const": 0, + "description": "Always zero. An attestation is not a review and cannot carry organizational independence." + }, + "does_not_establish": { + "type": "string", + "minLength": 200, + "description": "What this attestation does NOT establish, specific to this object. Boilerplate shared with another record is rejected." + }, + "superseded_by": { + "type": "string", + "pattern": "^ATT-[A-Z0-9][A-Z0-9._-]{2,60}$", + "description": "The attestation that re-ran the gates against this object's current bytes. An attestation speaks only for the commit it names, so when the object changes the record does not become false, it becomes historical. Setting this marks it as such and exempts it from the current-bytes check; the named successor must exist in the same directory." + }, + "notes": {"type": "string"} + } +} diff --git a/attestations/records/ATT-LPW-AMPLITUDE-20260923.json b/attestations/records/ATT-LPW-AMPLITUDE-20260923.json new file mode 100644 index 000000000..14d4cdf8c --- /dev/null +++ b/attestations/records/ATT-LPW-AMPLITUDE-20260923.json @@ -0,0 +1,34 @@ +{ + "schema_version": "1.0.0", + "attestation_id": "ATT-LPW-AMPLITUDE-20260923", + "attested_utc": "2026-09-23T19:09:00Z", + "object_id": "docs/LPW_AMPLITUDE.md @ 52bdd4430faba314829ab82817f15c7117cb6e18", + "object_title": "LPW amplitude: exact parent-law moments and the radius/phase budget", + "object_bytes": 7368, + "object_sha256": "b4b44a6a3e55526d38e7ce4c1ba79e24960a0a788f4e5ea267d75e2b8a5fb7c1", + "predicate_id": "ARCH-ADMISSION-V1", + "predicate_statement": "Every structural gate this repository runs over the object's lineage exited zero at the stated commit: the claim-graph firewalls accept it, logical quarantine is enforced, every content manifest matches its recorded SHA-256 and byte count, the register-consumer map is free of drift, no lane reads stronger than the claim graph, frozen Drive-side digests agree, and the object's own replay driver reproduces its stated quantities and matches its declared source hashes. Passing means the object is structurally admissible here. It does not mean the mathematics is correct.", + "predicate_source": "tools/claims_check.py, tools/quarantine_check.py, tools/verify_manifests.py, tools/consumers_check.py, tools/lanes_check.py, tools/frozen_check.py, tools/lpw_amplitude_check.py; shape enforced by attestations/attestation.schema.json and tools/attestations_check.py", + "checks": [ + {"command": "python3 tools/claims_check.py", "exit_code": 0, "summary": "claims=26 premises=13 firewalls=9 problems=0"}, + {"command": "python3 tools/quarantine_check.py", "exit_code": 0, "summary": "exclusions=22 archive_members=14 manifest_digests=2965"}, + {"command": "python3 tools/verify_manifests.py", "exit_code": 0, "summary": "manifests=414 verified=3203 problems=0"}, + {"command": "python3 tools/consumers_check.py", "exit_code": 0, "summary": "tabs=44 MACHINE=23 PROSE_ONLY=3 UNREAD=18, no drift"}, + {"command": "python3 tools/lanes_check.py", "exit_code": 0, "summary": "no lane reads stronger than the claim graph"}, + {"command": "python3 tools/frozen_check.py", "exit_code": 0, "summary": "rows=195 comparable=62 match=62 mismatch=0 unverifiable=0"}, + {"command": "python3 tools/lpw_amplitude_check.py", "exit_code": 0, "summary": "exact parent moments rho^4=8, L1^4=12+32/pi; norm/phase/radius checks and 2 source hashes match; analytic imports retained; authority=NONE"} + ], + "outcome": "ADMITTED", + "awaiting": [ + "An organizationally distinct reviewer; the driver reports authority=NONE and custody alone does not verify the source's analytic claims.", + "The infinite-sum Tonelli and Minkowski justification, which the object states remains an analytic import rather than something it derives.", + "The passage from finite sums to the full field, which the object says still requires that imported analytic argument.", + "The separate regression treatment R05 uses for conditional norm estimates, since the moments recorded here are unconditional parent-law moments and conditioning generally changes the law.", + "The 39 checks in the cited source, whose authority this object explicitly does not rerun, replace, extend or count as its own." + ], + "claim_grade_after": "UNCHANGED", + "gate_status_after": "UNCHANGED", + "independence_credit": 0, + "does_not_establish": "Admission does not establish that the parent-law moments rho^4=8 and L1^4=12+32/pi are correctly derived, nor that the amplitude budget is a valid bound for the Rayleigh quantity it is applied to. Matching two declared source hashes proves custody of bytes, not soundness of what those bytes assert. The unconditional moments recorded here are not conditional estimates, and nothing in this record bridges that gap. It leaves the Tonelli and Minkowski justification and the finite-sum-to-full-field passage as the analytic imports the object declares them to be, supplies no reviewer, awards no independence, and shifts no obligation.", + "notes": "Custody of source hashes is recorded as custody. The object is explicit that custody alone does not verify the source's analytic claims, and this record does not claim otherwise." +} diff --git a/attestations/records/ATT-RN-BERNSTEIN-SHARP-20260923.json b/attestations/records/ATT-RN-BERNSTEIN-SHARP-20260923.json new file mode 100644 index 000000000..d8f1f19f2 --- /dev/null +++ b/attestations/records/ATT-RN-BERNSTEIN-SHARP-20260923.json @@ -0,0 +1,34 @@ +{ + "schema_version": "1.0.0", + "attestation_id": "ATT-RN-BERNSTEIN-SHARP-20260923", + "attested_utc": "2026-09-23T19:05:00Z", + "object_id": "docs/RN_BERNSTEIN_SHARP.md @ 52bdd4430faba314829ab82817f15c7117cb6e18", + "object_title": "RN Bernstein/sharp refinement of the local inner-wedge integrand bound", + "object_bytes": 4416, + "object_sha256": "7e8557cfb45f9a6d89d4f63f8f63c53b225c27d371e71bd44583276e9845f271", + "predicate_id": "ARCH-ADMISSION-V1", + "predicate_statement": "Every structural gate this repository runs over the object's lineage exited zero at the stated commit: the claim-graph firewalls accept it, logical quarantine is enforced, every content manifest matches its recorded SHA-256 and byte count, the register-consumer map is free of drift, no lane reads stronger than the claim graph, frozen Drive-side digests agree, and the object's own replay driver reproduces its stated quantities under both normal and optimized Python. Passing means the object is structurally admissible here. It does not mean the mathematics is correct.", + "predicate_source": "tools/claims_check.py, tools/quarantine_check.py, tools/verify_manifests.py, tools/consumers_check.py, tools/lanes_check.py, tools/frozen_check.py, tools/rn_bernstein_sharp_check.py; shape enforced by attestations/attestation.schema.json and tools/attestations_check.py", + "checks": [ + {"command": "python3 tools/claims_check.py", "exit_code": 0, "summary": "claims=26 premises=13 firewalls=9 problems=0"}, + {"command": "python3 tools/quarantine_check.py", "exit_code": 0, "summary": "exclusions=22 archive_members=14 manifest_digests=2965"}, + {"command": "python3 tools/verify_manifests.py", "exit_code": 0, "summary": "manifests=414 verified=3203 problems=0"}, + {"command": "python3 tools/consumers_check.py", "exit_code": 0, "summary": "tabs=44 MACHINE=23 PROSE_ONLY=3 UNREAD=18, no drift"}, + {"command": "python3 tools/lanes_check.py", "exit_code": 0, "summary": "no lane reads stronger than the claim graph"}, + {"command": "python3 tools/frozen_check.py", "exit_code": 0, "summary": "rows=195 comparable=62 match=62 mismatch=0 unverifiable=0"}, + {"command": "python3 tools/rn_bernstein_sharp_check.py", "exit_code": 0, "summary": "PASS: RN Bernstein/sharp; normal/-O; 6 byte-identical reports; same local wedge; independence=0; no promotion"} + ], + "outcome": "ADMITTED", + "awaiting": [ + "An organizationally distinct reviewer; the independence-requiring predicate is OPEN and the driver reports independence=0 itself.", + "The imported fixed-radius H3 floor 0.0077592917375327855 and the six-pin energy allowance below 8, which this packet explicitly does not reprove.", + "Certification of the full annulus, which the object states it does not cover.", + "All radii and all pin orientations beyond the single local wedge whose domain this refinement does not enlarge.", + "The original inner-wedge result it sharpens, which it does not replace and which remains byte-for-byte alongside it." + ], + "claim_grade_after": "UNCHANGED", + "gate_status_after": "UNCHANGED", + "independence_credit": 0, + "does_not_establish": "Admission does not establish that the sharpened Bernstein coefficient is correct, that the tenfold improvement over the previous integrand cap is sound, or that the exact preconditioner and Taylor remainders behave as the packet describes. It re-derives no inequality and reproves none of the imported premises the object names as imports. Byte-identical replay across normal and optimized Python is a record of reproducibility, not of truth: a mistaken bound reproduces just as faithfully as a correct one. It supplies no reviewer and no independence, leaves the full annulus and every other radius untouched, and moves no claim, premise or obligation.", + "notes": "The driver reports independence=0 and no promotion in its own summary; this record transcribes that rather than softening it." +} diff --git a/attestations/records/ATT-RN-INNER-WEDGE-20260923.json b/attestations/records/ATT-RN-INNER-WEDGE-20260923.json new file mode 100644 index 000000000..44ba960ef --- /dev/null +++ b/attestations/records/ATT-RN-INNER-WEDGE-20260923.json @@ -0,0 +1,64 @@ +{ + "schema_version": "1.0.0", + "attestation_id": "ATT-RN-INNER-WEDGE-20260923", + "attested_utc": "2026-09-23T16:40:00Z", + "object_id": "docs/RN_INNER_WEDGE.md @ 7dd6a141d90d5b3d8c670dcf847fd4fc1de1a83e", + "object_title": "SIDE24 inner-axis wedge: fixed-radius RN integrand bound", + "object_bytes": 4651, + "object_sha256": "7483724b6ffe4575dbb36f2713bb700cad11bf344f1c775f50c422caf59eb288", + "predicate_id": "ARCH-ADMISSION-V1", + "predicate_statement": "Every structural gate this repository runs over the object's lineage exited zero at the stated commit: the claim-graph firewalls accept it, logical quarantine is enforced, every content manifest matches its recorded SHA-256 and byte count, the register-consumer map is free of drift, no lane reads stronger than the claim graph, frozen Drive-side digests agree, and the object's own replay driver reproduces its stated quantities. Passing means the object is structurally admissible here. It does not mean the mathematics is correct, and a wrong argument that is correctly filed, correctly hashed and correctly scoped passes this predicate exactly as a right one does.", + "predicate_source": "tools/claims_check.py, tools/quarantine_check.py, tools/verify_manifests.py, tools/consumers_check.py, tools/lanes_check.py, tools/frozen_check.py, tools/rn_inner_wedge_check.py; shape enforced by attestations/attestation.schema.json and tools/attestations_check.py", + "checks": [ + { + "command": "python3 tools/claims_check.py", + "exit_code": 0, + "summary": "claims=26 premises=13 firewalls=9 problems=0" + }, + { + "command": "python3 tools/quarantine_check.py", + "exit_code": 0, + "summary": "logical quarantine enforced; excludes claims, certifies none" + }, + { + "command": "python3 tools/verify_manifests.py", + "exit_code": 0, + "summary": "manifests=414 verified=3203 problems=0" + }, + { + "command": "python3 tools/consumers_check.py", + "exit_code": 0, + "summary": "register-consumer map free of drift" + }, + { + "command": "python3 tools/lanes_check.py", + "exit_code": 0, + "summary": "no lane reads stronger than the claim graph" + }, + { + "command": "python3 tools/frozen_check.py", + "exit_code": 0, + "summary": "register and source-map digests agree, offline" + }, + { + "command": "python3 tools/rn_inner_wedge_check.py", + "exit_code": 0, + "summary": "12 auxiliary strips, zero pending; exact area 21*pi/5120000" + } + ], + "outcome": "ADMITTED", + "awaiting": [ + "An organizationally distinct reviewer; the independence-requiring predicate for this object is OPEN and no record in this repository can supply it.", + "Full annulus coverage 1/10 <= |y| <= 5, which this fixed wedge does not address.", + "All radii and all pin orientations; the object is stated for one fixed radius and the original x-axis six pins.", + "Weighted-Palm moment and event-identification interfaces, which remain unbuilt.", + "The imported fixed-radius H3 normalization floor it is conditional on, which is carried, not re-derived here.", + "Canonical acceptance by the operator, which no automated record can stand in for." + ], + "claim_grade_after": "UNCHANGED", + "gate_status_after": "UNCHANGED", + "independence_credit": 0, + "does_not_establish": "This attestation does not establish that the wedge bound is mathematically correct, that its integrand cap is sharp, or that its conditional dependency on the imported H3 floor holds. It verifies no arithmetic and re-derives no inequality; the replay driver reproducing a stated quantity is a record of a computation, not evidence for it. It supplies no organizationally distinct reviewer and awards no independence, so every predicate requiring one is exactly where it was. It says nothing about the full annulus, other radii, other pin orientations, elder pairing, q0, or any original prize problem, and it moves no claim, premise or obligation anywhere.", + "notes": "First record under this schema. Written to demonstrate that architectural admission can be recorded autonomously and at scale without any status moving. The seven commands above were run at the stated commit and their real exit codes transcribed; none was inferred.", + "superseded_by": "ATT-RN-INNER-WEDGE-20260923B" +} diff --git a/attestations/records/ATT-RN-INNER-WEDGE-20260923B.json b/attestations/records/ATT-RN-INNER-WEDGE-20260923B.json new file mode 100644 index 000000000..a7c1a7042 --- /dev/null +++ b/attestations/records/ATT-RN-INNER-WEDGE-20260923B.json @@ -0,0 +1,35 @@ +{ + "schema_version": "1.0.0", + "attestation_id": "ATT-RN-INNER-WEDGE-20260923B", + "attested_utc": "2026-09-23T19:35:00Z", + "object_id": "docs/RN_INNER_WEDGE.md @ 19b1a7061ce59afae8f5b2587c2f0641dab855e5", + "object_title": "SIDE24 inner-axis wedge, after the AUTHOR_SIDE honesty banner append", + "object_bytes": 5434, + "object_sha256": "5c10ca09cd3be00b968661892cbdc5e99a4ba73ca98edde3ab81b462026ba94f", + "predicate_id": "ARCH-ADMISSION-V1", + "predicate_statement": "Every structural gate this repository runs over the object's lineage exited zero at the stated commit: the claim-graph firewalls accept it, logical quarantine is enforced, every content manifest matches its recorded SHA-256 and byte count, the register-consumer map is free of drift, no lane reads stronger than the claim graph, frozen Drive-side digests agree, and the object's own replay driver reproduces its stated quantities. Passing means the object is structurally admissible here. It does not mean the mathematics is correct.", + "predicate_source": "tools/claims_check.py, tools/quarantine_check.py, tools/verify_manifests.py, tools/consumers_check.py, tools/lanes_check.py, tools/frozen_check.py, tools/rn_inner_wedge_check.py; shape enforced by attestations/attestation.schema.json and tools/attestations_check.py", + "checks": [ + {"command": "python3 tools/claims_check.py", "exit_code": 0, "summary": "claims=26 premises=13 firewalls=9 problems=0"}, + {"command": "python3 tools/quarantine_check.py", "exit_code": 0, "summary": "logical quarantine enforced; excludes claims, certifies none"}, + {"command": "python3 tools/verify_manifests.py", "exit_code": 0, "summary": "manifests=414 verified=3203 problems=0"}, + {"command": "python3 tools/consumers_check.py", "exit_code": 0, "summary": "register-consumer map free of drift"}, + {"command": "python3 tools/lanes_check.py", "exit_code": 0, "summary": "no lane reads stronger than the claim graph"}, + {"command": "python3 tools/frozen_check.py", "exit_code": 0, "summary": "register and source-map digests agree, offline"}, + {"command": "python3 tools/rn_inner_wedge_check.py", "exit_code": 0, "summary": "12 auxiliary strips, zero pending; exact area 21*pi/5120000"} + ], + "outcome": "ADMITTED", + "awaiting": [ + "An organizationally distinct reviewer; the independence-requiring predicate is OPEN and no record in this repository can supply it.", + "Full annulus coverage 1/10 <= |y| <= 5, which this fixed wedge does not address.", + "All radii and all pin orientations; the object is stated for one fixed radius and the original x-axis six pins.", + "Weighted-Palm moment and event-identification interfaces, which remain unbuilt.", + "The imported fixed-radius H3 normalization floor it is conditional on, which is carried, not re-derived here.", + "Canonical acceptance by the operator, which no automated record can stand in for." + ], + "claim_grade_after": "UNCHANGED", + "gate_status_after": "UNCHANGED", + "independence_credit": 0, + "does_not_establish": "Re-attesting after the banner append establishes only that the gates still exit zero over the object's new bytes. It says nothing about whether the wedge bound is correct, whether its integrand cap is sharp, or whether the appended AUTHOR_SIDE banner accurately characterises the work it now heads. The banner changed the document and therefore changed what was checked; it did not change any mathematics, and neither did this record. No reviewer is supplied, no independence accrues, and every obligation the predecessor listed stands untouched and unshortened.", + "notes": "Successor to ATT-RN-INNER-WEDGE-20260923, which attested the 4651-byte body before PR #19 appended the AUTHOR_SIDE honesty banner. The predecessor is not wrong and has not been edited: it records what was checked at commit 7dd6a141, and that remains true. This record covers the current bytes." +} diff --git a/attestations/records/ATT-RN-SIDE24-DENSITY-20260923.json b/attestations/records/ATT-RN-SIDE24-DENSITY-20260923.json new file mode 100644 index 000000000..733afa4df --- /dev/null +++ b/attestations/records/ATT-RN-SIDE24-DENSITY-20260923.json @@ -0,0 +1,63 @@ +{ + "schema_version": "1.0.0", + "attestation_id": "ATT-RN-SIDE24-DENSITY-20260923", + "attested_utc": "2026-09-23T19:07:00Z", + "object_id": "docs/RN_SIDE24_DENSITY.md @ 52bdd4430faba314829ab82817f15c7117cb6e18", + "object_title": "SIDE24 six-pin density and window replay: fixed-point RN integrand upper bound", + "object_bytes": 7714, + "object_sha256": "8c947edca26463acd932df5f9600ad1351860a8ca3cadbd7ad2a24819477f4ad", + "predicate_id": "ARCH-ADMISSION-V1", + "predicate_statement": "Every structural gate this repository runs over the object's lineage exited zero at the stated commit: the claim-graph firewalls accept it, logical quarantine is enforced, every content manifest matches its recorded SHA-256 and byte count, the register-consumer map is free of drift, no lane reads stronger than the claim graph, frozen Drive-side digests agree, and the object's own replay driver reproduces its stated quantities. Passing means the object is structurally admissible here. It does not mean the mathematics is correct.", + "predicate_source": "tools/claims_check.py, tools/quarantine_check.py, tools/verify_manifests.py, tools/consumers_check.py, tools/lanes_check.py, tools/frozen_check.py, tools/rn_side24_density_check.py; shape enforced by attestations/attestation.schema.json and tools/attestations_check.py", + "checks": [ + { + "command": "python3 tools/claims_check.py", + "exit_code": 0, + "summary": "claims=26 premises=13 firewalls=9 problems=0" + }, + { + "command": "python3 tools/quarantine_check.py", + "exit_code": 0, + "summary": "exclusions=22 archive_members=14 manifest_digests=2965" + }, + { + "command": "python3 tools/verify_manifests.py", + "exit_code": 0, + "summary": "manifests=414 verified=3203 problems=0" + }, + { + "command": "python3 tools/consumers_check.py", + "exit_code": 0, + "summary": "tabs=44 MACHINE=23 PROSE_ONLY=3 UNREAD=18, no drift" + }, + { + "command": "python3 tools/lanes_check.py", + "exit_code": 0, + "summary": "no lane reads stronger than the claim graph" + }, + { + "command": "python3 tools/frozen_check.py", + "exit_code": 0, + "summary": "rows=195 comparable=62 match=62 mismatch=0 unverifiable=0" + }, + { + "command": "python3 tools/rn_side24_density_check.py", + "exit_code": 0, + "summary": "exact six-pin density/window replay; point integrand <= 1888043/500000000000; H3 floor imported; no spatial cover; authority=NONE" + } + ], + "outcome": "ADMITTED", + "awaiting": [ + "An organizationally distinct reviewer; the driver reports authority=NONE and the independence-requiring predicate is OPEN.", + "The imported H3 premise, the exact floor 0.0077592917375327855 at radius 1/20 and b=6/5, which this object carries in custody rather than deriving.", + "A spatial cover, which the driver states this replay does not provide: the bound is at a fixed point, not over a region.", + "Extension from the single conditional disintegration to the weighted-Palm and event-identification interfaces, which remain unbuilt.", + "All radii and all pin orientations beyond the fixed six-pin configuration replayed here." + ], + "claim_grade_after": "UNCHANGED", + "gate_status_after": "UNCHANGED", + "independence_credit": 0, + "does_not_establish": "Admission does not establish that the point integrand bound 1888043/500000000000 is valid, that the Gaussian disintegrations are the right conditional laws, or that the enclosed conditional height mean near 1.22864492785 is correctly computed. It verifies no arithmetic and re-derives nothing; a replay driver reproducing a stated quantity records a computation and is not evidence for it. It does not supply the spatial cover the object itself says is absent, does not discharge the imported H3 premise held in custody, and awards no independence. Every obligation this object names as remaining is exactly where it was.", + "notes": "The driver's own summary ends authority=NONE; that word is transcribed here, not reinterpreted.", + "superseded_by": "ATT-RN-SIDE24-DENSITY-20260923B" +} diff --git a/attestations/records/ATT-RN-SIDE24-DENSITY-20260923B.json b/attestations/records/ATT-RN-SIDE24-DENSITY-20260923B.json new file mode 100644 index 000000000..939cb2f78 --- /dev/null +++ b/attestations/records/ATT-RN-SIDE24-DENSITY-20260923B.json @@ -0,0 +1,63 @@ +{ + "schema_version": "1.0.0", + "attestation_id": "ATT-RN-SIDE24-DENSITY-20260923B", + "attested_utc": "2026-09-24T00:40:00Z", + "object_id": "docs/RN_SIDE24_DENSITY.md @ 7aa43562b8870de3231ca648414b57bc13be634c", + "object_title": "SIDE24 six-pin density and window replay: fixed-point RN integrand upper bound", + "object_bytes": 9454, + "object_sha256": "6f7c23d091f8a09bbfb63c99135e4554c980369a3af858e74ba9b482746eb9a5", + "predicate_id": "ARCH-ADMISSION-V1", + "predicate_statement": "Every structural gate this repository runs over the object's lineage exited zero at the stated commit: the claim-graph firewalls accept it, logical quarantine is enforced, every content manifest matches its recorded SHA-256 and byte count, the register-consumer map is free of drift, no lane reads stronger than the claim graph, frozen Drive-side digests agree, and the object's own replay driver reproduces its stated quantities. Passing means the object is structurally admissible here. It does not mean the mathematics is correct.", + "predicate_source": "tools/claims_check.py, tools/quarantine_check.py, tools/verify_manifests.py, tools/consumers_check.py, tools/lanes_check.py, tools/frozen_check.py, tools/rn_side24_density_check.py; shape enforced by attestations/attestation.schema.json and tools/attestations_check.py", + "checks": [ + { + "command": "python3 tools/claims_check.py", + "exit_code": 0, + "summary": "claims=26 premises=13 firewalls=9 problems=0" + }, + { + "command": "python3 tools/quarantine_check.py", + "exit_code": 0, + "summary": "exclusions=22 archive_members=14 manifest_digests=2965 bound_members_named=2 vault_rows_storing_bytes=0 problems=0" + }, + { + "command": "python3 tools/verify_manifests.py", + "exit_code": 0, + "summary": "manifests=414 verified=3203 problems=0" + }, + { + "command": "python3 tools/consumers_check.py", + "exit_code": 0, + "summary": "tabs=44 generic_files=4 MACHINE=26 PROSE_ONLY=3 UNREAD=15 problems=0" + }, + { + "command": "python3 tools/lanes_check.py", + "exit_code": 0, + "summary": "OK - 15 lanes, one per section of docs/OPEN_PROBLEMS.md" + }, + { + "command": "python3 tools/frozen_check.py", + "exit_code": 0, + "summary": "rows=195 comparable=62 match=62 match_via_supplement=0 mismatch=0 unverifiable=0 body_present=17 not_comparable=116 problems=0" + }, + { + "command": "python3 tools/rn_side24_density_check.py", + "exit_code": 0, + "summary": "exact six-pin density/window replay; point integrand <= 1888043/500000000000; H3 floor imported; no spatial cover; authority=NONE" + } + ], + "outcome": "ADMITTED", + "awaiting": [ + "An organizationally distinct reviewer; the driver reports authority=NONE and the independence-requiring predicate is OPEN.", + "The imported H3 premise, the exact floor 0.0077592917375327855 at radius 1/20 and b=6/5, which this object carries in custody rather than deriving.", + "A spatial cover, which the driver states this replay does not provide: the bound is at a fixed point, not over a region.", + "Extension from the single conditional disintegration to the weighted-Palm and event-identification interfaces, which remain unbuilt.", + "All radii and all pin orientations beyond the fixed six-pin configuration replayed here." + ], + "claim_grade_after": "UNCHANGED", + "gate_status_after": "UNCHANGED", + "independence_credit": 0, + "does_not_establish": "Re-attesting establishes that the seven gates exit zero over the object as it now stands, at 9,454 bytes rather than the 7,714 its predecessor described. It does not establish that the text PR #42 appended is accurate, and it is worth being plain that those additions are themselves claims about what this object does not do: attesting bytes says nothing about whether a wall describing an ABSENT or REFUSED result describes it correctly. Nothing about the underlying mathematics is touched. The point integrand bound 1888043/500000000000 is not shown valid, the Gaussian disintegrations are not shown to be the right conditional laws, and the enclosed conditional height mean near 1.22864492785 is not shown correctly computed; this record verifies no arithmetic and re-derives nothing, and a replay driver reproducing a stated quantity records a computation rather than evidencing it. The spatial cover the object says is absent is still absent, the imported H3 premise is still an assumption this object carries rather than one it derives, and independence is still zero. Superseding a stale attestation repairs a bookkeeping fact about bytes and moves nothing else.", + "notes": "Numbered successor to ATT-RN-SIDE24-DENSITY-20260923, which attested 7,714 bytes. PR #42 appended ABSENT/REFUSED honesty walls to the object, taking it to 9,454 bytes, so the predecessor no longer described the bytes in the tree and tools/attestations_check.py refused it. The seven gates were re-run against the current bytes for this record rather than copied from the predecessor; the consumers and frozen_check summaries differ from it because both tools' outputs have since changed, which is the point of re-running them. The added text is navigational honesty prose and changes nothing the object establishes; the awaiting list is unchanged because none of those obligations moved. The driver's own summary still ends authority=NONE, transcribed here.", + "superseded_by": "ATT-RN-SIDE24-DENSITY-20260923C" +} diff --git a/attestations/records/ATT-RN-SIDE24-DENSITY-20260923C.json b/attestations/records/ATT-RN-SIDE24-DENSITY-20260923C.json new file mode 100644 index 000000000..f7dba7fd5 --- /dev/null +++ b/attestations/records/ATT-RN-SIDE24-DENSITY-20260923C.json @@ -0,0 +1,62 @@ +{ + "schema_version": "1.0.0", + "attestation_id": "ATT-RN-SIDE24-DENSITY-20260923C", + "attested_utc": "2026-09-24T18:55:00Z", + "object_id": "docs/RN_SIDE24_DENSITY.md @ 120050136f5586b9de3c0f054119b978c92f8a49", + "object_title": "SIDE24 six-pin density and window replay, after the SoT-ABSENT nav append", + "object_bytes": 9660, + "object_sha256": "9595aa83dec6c9bdfafe20f47ae8f6d78c4966766a13ac98538eea8701ff05ec", + "predicate_id": "ARCH-ADMISSION-V1", + "predicate_statement": "Every structural gate this repository runs over the object's lineage exited zero at the stated commit: the claim-graph firewalls accept it, logical quarantine is enforced, every content manifest matches its recorded SHA-256 and byte count, the register-consumer map is free of drift, no lane reads stronger than the claim graph, frozen Drive-side digests agree, and the object's own replay driver reproduces its stated quantities. Passing means the object is structurally admissible here. It does not mean the mathematics is correct.", + "predicate_source": "tools/claims_check.py, tools/quarantine_check.py, tools/verify_manifests.py, tools/consumers_check.py, tools/lanes_check.py, tools/frozen_check.py, tools/rn_side24_density_check.py; shape enforced by attestations/attestation.schema.json and tools/attestations_check.py", + "checks": [ + { + "command": "python3 tools/claims_check.py", + "exit_code": 0, + "summary": "claims=26 premises=13 firewalls=9 problems=0" + }, + { + "command": "python3 tools/quarantine_check.py", + "exit_code": 0, + "summary": "exclusions=22 digest_comparable=16 digest_not_compared=6 archive_members=14 manifest_digests=2965 bound_members_named=2 vault_rows_storing_bytes=0 problems=0" + }, + { + "command": "python3 tools/verify_manifests.py", + "exit_code": 0, + "summary": "manifests=414 verified=3203 problems=0" + }, + { + "command": "python3 tools/consumers_check.py", + "exit_code": 0, + "summary": "tabs=44 generic_files=4 MACHINE=26 PROSE_ONLY=3 UNREAD=15 problems=0" + }, + { + "command": "python3 tools/lanes_check.py", + "exit_code": 0, + "summary": "lanes_check: OK \u2014 15 lanes, one per section of docs/OPEN_PROBLEMS.md" + }, + { + "command": "python3 tools/frozen_check.py", + "exit_code": 0, + "summary": "frozen_check: rows=195 comparable=62 match=62 mismatch=0 unverifiable=0 body_present=17 not_comparable=116 problems=0" + }, + { + "command": "python3 tools/rn_side24_density_check.py", + "exit_code": 0, + "summary": "RN SIDE24 density: exact six-pin density/window replay; point integrand <= 1888043/500000000000; H3 floor imported; no spatial cover; authority=NONE" + } + ], + "outcome": "ADMITTED", + "awaiting": [ + "An organizationally distinct reviewer; the driver reports authority=NONE and the independence-requiring predicate is OPEN.", + "The imported H3 premise, the exact floor 0.0077592917375327855 at radius 1/20 and b=6/5, which this object carries in custody rather than deriving.", + "A spatial cover, which the driver states this replay does not provide: the bound is at a fixed point, not over a region.", + "Extension from the single conditional disintegration to the weighted-Palm and event-identification interfaces, which remain unbuilt.", + "All radii and all pin orientations beyond the fixed six-pin configuration replayed here." + ], + "claim_grade_after": "UNCHANGED", + "gate_status_after": "UNCHANGED", + "independence_credit": 0, + "does_not_establish": "Successor C records that the seven structural gates exited zero over docs/RN_SIDE24_DENSITY.md at commit 120050136f5586b9de3c0f054119b978c92f8a49: 9660 bytes, sha256 9595aa83dec6c9bdfafe20f47ae8f6d78c4966766a13ac98538eea8701ff05ec. Predecessor ATT-RN-SIDE24-DENSITY-20260923B described 9454 bytes and sha256 6f7c23d091f8a09bbfb63c99135e4554c980369a3af858e74ba9b482746eb9a5, which no longer matches the tree after PR #66. The appended paragraph says SIDE24 has no new source-of-truth carrier after 2026-08-06, that carriers for objects marked ABSENT stay ABSENT, that quarantine is not a source of truth, and that inventable_attempt_accepted stays false. Attesting the new bytes does not establish that paragraph, does not invent a source of truth, and leaves every ABSENT carrier ABSENT. The point integrand bound 1888043/500000000000 is not shown valid. The Gaussian disintegrations are not shown to be the right conditional laws. The enclosed conditional height mean near 1.22864492785 is not shown correctly computed. This record verifies no arithmetic and re-derives nothing. A green replay is engineering hygiene and is not a mathematical result. OBL-H5-JETMOD stays OPEN. lemma_closed, prizes_solved, certified_C_H, and freeze stay false. Independence credit stays 0. Superseding a stale attestation repairs a bookkeeping fact about bytes.", + "notes": "Numbered successor to ATT-RN-SIDE24-DENSITY-20260923B. PR #66 appended the SoT-ABSENT navigation paragraph, taking the object from 9454 bytes to 9660, so the predecessor no longer described the bytes in the tree. The seven gates were re-run against commit 120050136f5586b9de3c0f054119b978c92f8a49 rather than copied. quarantine_check now reports digest_comparable=16 and digest_not_compared=6. frozen_check on this tip reports match=62 and does not print match_via_supplement, because that counter is not in this tip's checker. The awaiting list is unchanged because none of those obligations moved. The driver's own summary still ends authority=NONE, transcribed here. inventable_attempt_accepted stays false." +} diff --git a/engine/bridge/work_order.py b/engine/bridge/work_order.py index e8971cc54..a25c043dd 100644 --- a/engine/bridge/work_order.py +++ b/engine/bridge/work_order.py @@ -176,7 +176,7 @@ #: ``tests/test_bridge.py`` asserts this list matches the checkout. REPOSITORY_TOP_LEVEL = ( ".github", ".gitignore", "requirements-ci.lock", "AGENTS.md", "CITATION.cff", "CLAUDE.md", - "CONTRIBUTING.md", "LICENSE", "README.md", "claims", "docs", "drive", + "CONTRIBUTING.md", "LICENSE", "README.md", "attestations", "claims", "docs", "drive", "engine", "governance", "legacy", "packages", "quarantine", "recovery", "registers", "research", "reviews", "sandbox", "tests", "tools", ) diff --git a/tests/test_attestations.py b/tests/test_attestations.py new file mode 100644 index 000000000..c0c9244fb --- /dev/null +++ b/tests/test_attestations.py @@ -0,0 +1,295 @@ +"""Rules of the architectural-admission attestation form, and a negative control +for every one of them. + +What this does NOT establish: these tests check that the checker REFUSES what it +must refuse. They verify no mathematics, admit no object, move no gate and award +no independence. The attestation bridge they belong to is NOT DEPLOYED. + +Each control mutates a copy of the real record and asserts the checker fails on +it. The checker is invoked through its command-line flags in a subprocess, never +imported and called with module globals already bound: a default argument that +binds a path at import time is exactly the defect that once made every mutation +test in this repository silently re-check the good input. +""" +from __future__ import annotations + +import copy +import json +import os +import subprocess +import sys + +import pytest + +ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +CHECKER = os.path.join(ROOT, "tools", "attestations_check.py") +SCHEMA = os.path.join(ROOT, "attestations", "attestation.schema.json") +RECORDS = os.path.join(ROOT, "attestations", "records") +GOOD = os.path.join(RECORDS, "ATT-RN-INNER-WEDGE-20260923B.json") + + +def run_checker(records_dir): + return subprocess.run( + [sys.executable, CHECKER, "--records", str(records_dir), "--schema", SCHEMA], + capture_output=True, text=True, cwd=ROOT, + ) + + +def good_record(): + with open(GOOD, encoding="utf-8") as handle: + return json.load(handle) + + +def write(tmp_path, record, stem="ATT-RN-INNER-WEDGE-20260923B"): + path = tmp_path / f"{stem}.json" + path.write_text(json.dumps(record, indent=1), encoding="utf-8") + return tmp_path + + +def refuse(tmp_path, record, needle, stem="ATT-RN-INNER-WEDGE-20260923B"): + result = run_checker(write(tmp_path, record, stem)) + assert result.returncode == 1, result.stdout + assert needle in result.stdout, result.stdout + return result.stdout + + +# --------------------------------------------------------------------------- # +# The positive side # +# --------------------------------------------------------------------------- # + +def test_the_real_records_pass(): + result = run_checker(RECORDS) + assert result.returncode == 0, result.stdout + assert "no grade changed, no gate moved" in result.stdout + + +def test_checker_reports_and_summarises(tmp_path): + result = run_checker(write(tmp_path, good_record())) + assert result.returncode == 0 + assert "1 attestation(s)" in result.stdout + + +def test_unknown_flag_is_refused(): + result = subprocess.run([sys.executable, CHECKER, "--nope"], + capture_output=True, text=True, cwd=ROOT) + assert result.returncode == 2 + + +# --------------------------------------------------------------------------- # +# Fail-closed admission # +# --------------------------------------------------------------------------- # + +def test_admitted_with_a_failed_check_is_refused(tmp_path): + record = good_record() + record["checks"][2]["exit_code"] = 1 + refuse(tmp_path, record, "forbids admission") + + +def test_admitted_with_every_check_failing_is_refused(tmp_path): + record = good_record() + for check in record["checks"]: + check["exit_code"] = 1 + refuse(tmp_path, record, "forbids admission") + + +def test_refused_without_a_failing_check_is_refused(tmp_path): + record = good_record() + record["outcome"] = "REFUSED" + refuse(tmp_path, record, "must name the check that refused it") + + +def test_a_genuine_refusal_is_accepted(tmp_path): + record = good_record() + record["outcome"] = "REFUSED" + record["checks"][0]["exit_code"] = 1 + result = run_checker(write(tmp_path, record)) + assert result.returncode == 0, result.stdout + + +def test_empty_checks_is_refused(tmp_path): + record = good_record() + record["checks"] = [] + refuse(tmp_path, record, "ATT-RN-INNER-WEDGE-20260923B.json") + + +# --------------------------------------------------------------------------- # +# The pins that stop an attestation becoming a promotion # +# --------------------------------------------------------------------------- # + +@pytest.mark.parametrize("value", ["PROMOTED", "RAISED", "CLOSED", ""]) +def test_a_moved_claim_grade_is_refused(tmp_path, value): + record = good_record() + record["claim_grade_after"] = value + refuse(tmp_path, record, "claim_grade_after") + + +@pytest.mark.parametrize("value", ["SATISFIED", "OPENED", "MOVED"]) +def test_a_moved_gate_status_is_refused(tmp_path, value): + record = good_record() + record["gate_status_after"] = value + refuse(tmp_path, record, "gate_status_after") + + +@pytest.mark.parametrize("value", [1, 2]) +def test_nonzero_independence_credit_is_refused(tmp_path, value): + record = good_record() + record["independence_credit"] = value + refuse(tmp_path, record, "independence_credit") + + +def test_admitted_with_empty_awaiting_is_refused(tmp_path): + record = good_record() + record["awaiting"] = [] + refuse(tmp_path, record, "ATT-RN-INNER-WEDGE-20260923B.json") + + +# --------------------------------------------------------------------------- # +# Free-text scans # +# --------------------------------------------------------------------------- # + +@pytest.mark.parametrize("phrase", [ + "the premise is now settled", + "this discharged the obligation", + "it closed the remaining gap", + "this promotes the candidate", +]) +def test_promotion_language_is_refused(tmp_path, phrase): + record = good_record() + record["notes"] = phrase + refuse(tmp_path, record, "promotion language") + + +@pytest.mark.parametrize("phrase", [ + "high confidence in the wedge", + "95% confident the bound holds", + "a confidence score of nine", +]) +def test_confidence_voting_is_refused(tmp_path, phrase): + record = good_record() + record["notes"] = phrase + refuse(tmp_path, record, "confidence voting") + + +# --------------------------------------------------------------------------- # +# Identity, shape and anti-boilerplate # +# --------------------------------------------------------------------------- # + +def test_an_unknown_field_is_refused(tmp_path): + record = good_record() + record["approved_by"] = "nobody" + refuse(tmp_path, record, "ATT-RN-INNER-WEDGE-20260923B.json") + + +def test_id_not_matching_the_filename_is_refused(tmp_path): + record = good_record() + refuse(tmp_path, record, "does not match the filename stem", stem="ATT-OTHER-NAME") + + +def test_a_short_does_not_establish_is_refused(tmp_path): + record = good_record() + record["does_not_establish"] = "It establishes nothing at all. " * 8 + refuse(tmp_path, record, "distinct token") + + +def test_a_copied_does_not_establish_is_refused(tmp_path): + first = good_record() + second = copy.deepcopy(first) + second["attestation_id"] = "ATT-SECOND-RECORD" + write(tmp_path, first) + write(tmp_path, second, stem="ATT-SECOND-RECORD") + result = run_checker(tmp_path) + assert result.returncode == 1 + assert "verbatim identical" in result.stdout, result.stdout + + +@pytest.mark.parametrize("digest", ["", "abc", "Z" * 64]) +def test_a_malformed_object_digest_is_refused(tmp_path, digest): + record = good_record() + record["object_sha256"] = digest + refuse(tmp_path, record, "ATT-RN-INNER-WEDGE-20260923B.json") + + +def test_zero_object_bytes_is_refused(tmp_path): + record = good_record() + record["object_bytes"] = 0 + refuse(tmp_path, record, "ATT-RN-INNER-WEDGE-20260923B.json") + + +def test_a_missing_records_directory_is_reported(tmp_path): + result = run_checker(tmp_path / "absent") + assert result.returncode == 1 + assert "does not exist" in result.stdout + + +# --------------------------------------------------------------------------- # +# The object's current bytes # +# --------------------------------------------------------------------------- # + +def test_a_stale_digest_on_a_live_path_is_refused(tmp_path): + """The rule that caught this suite's own first real defect: PR #19 appended a + banner to an attested document, and nothing noticed until this existed.""" + record = good_record() + record["object_sha256"] = "0" * 64 + refuse(tmp_path, record, "re-run the gates and attest the current bytes") + + +def test_a_stale_byte_count_on_a_live_path_is_refused(tmp_path): + record = good_record() + record["object_bytes"] = record["object_bytes"] + 1 + refuse(tmp_path, record, "re-run the gates and attest the current bytes") + + +def test_superseded_by_exempts_a_historical_record(tmp_path): + record = good_record() + record["object_sha256"] = "0" * 64 + record["superseded_by"] = "ATT-SUCCESSOR-RECORD" + successor = good_record() + successor["attestation_id"] = "ATT-SUCCESSOR-RECORD" + successor["does_not_establish"] = ( + "This successor record establishes nothing whatever about correctness, soundness, " + "sharpness or acceptance of any mathematical statement anywhere in the programme; it " + "exists purely so that its predecessor may be retired honestly rather than quietly " + "edited, and it awards no independence credit to anybody under any circumstances." + ) + write(tmp_path, record) + write(tmp_path, successor, stem="ATT-SUCCESSOR-RECORD") + result = run_checker(tmp_path) + assert result.returncode == 0, result.stdout + + +def test_superseded_by_naming_a_missing_record_is_refused(tmp_path): + record = good_record() + record["object_sha256"] = "0" * 64 + record["superseded_by"] = "ATT-DOES-NOT-EXIST" + refuse(tmp_path, record, "is not a record in this directory") + + +def test_an_object_path_absent_from_the_tree_is_not_checked(tmp_path): + """A Drive id or a path outside this checkout cannot be byte-compared, and the + rule must not invent a failure for one.""" + record = good_record() + record["object_id"] = "drive:1abcDEFghiJKLmnoPQRstu @ 0123456789abcdef" + record["object_sha256"] = "0" * 64 + result = run_checker(write(tmp_path, record)) + assert result.returncode == 0, result.stdout + + +# --------------------------------------------------------------------------- # +# What the form itself must keep saying # +# --------------------------------------------------------------------------- # + +def test_schema_pins_the_three_invariants(): + with open(SCHEMA, encoding="utf-8") as handle: + schema = json.load(handle) + assert schema["properties"]["claim_grade_after"]["const"] == "UNCHANGED" + assert schema["properties"]["gate_status_after"]["const"] == "UNCHANGED" + assert schema["properties"]["independence_credit"]["const"] == 0 + assert schema["additionalProperties"] is False + assert schema["properties"]["awaiting"]["minItems"] == 1 + + +def test_checker_docstring_states_what_it_does_not_establish(): + import ast + doc = ast.get_docstring(ast.parse(open(CHECKER, encoding="utf-8").read())) or "" + assert "not establish" in doc.lower() + assert "not deployed" in doc.lower() diff --git a/tools/attestations_check.py b/tools/attestations_check.py new file mode 100644 index 000000000..05cfdf211 --- /dev/null +++ b/tools/attestations_check.py @@ -0,0 +1,206 @@ +#!/usr/bin/env python3 +"""Check architectural admission attestations against their schema and rules. + +An attestation records that a named object cleared a named, machine-checkable +ARCHITECTURAL predicate at a stated commit: the repository's own structural +gates ran and accepted it. That is all it records. + +What this does NOT establish. An attestation is not a review, not a grade, not +a promotion and not an independence credit. Architectural admission says +nothing about whether any mathematics is correct: a wrong proof that is +correctly filed, correctly hashed and correctly quarantined is ADMITTED, and +that is the intended behaviour, because the predicate is about structure and +not about truth. Nothing here discharges a premise, moves a gate, or changes +any claim's grade -- `claim_grade_after` and `gate_status_after` are both +pinned to UNCHANGED and this checker refuses any other value. Every ADMITTED +record must also name, in `awaiting`, what the object is still waiting on, +because admission never finishes anything. This form is NOT DEPLOYED as an +enforcement mechanism and no scheduler consumes these records. + +Fail-closed. A single non-zero exit code among the recorded checks forbids +ADMITTED. A record that claims ADMITTED while carrying a failed check is a +violation, not a judgement call. + +Run: python3 tools/attestations_check.py [--records DIR] [--schema PATH] +Every path is resolved when ``main()`` runs, never at import time. +""" +from __future__ import annotations + +import hashlib +import os +import sys + +ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +if os.path.join(ROOT, "tools") not in sys.path: + sys.path.insert(0, os.path.join(ROOT, "tools")) + +# The JSON Schema subset evaluator and the free-text scanners already exist for +# review records. They are reused rather than reimplemented so that a rule +# tightened in one place cannot silently stay loose in the other. +from reviews_check import ( # noqa: E402 + CONFIDENCE_PATTERNS, + PROMOTION_PHRASES, + WORD, + load_json, + normalize, + validate_instance, + walk_strings, +) + +SCHEMA_REL = os.path.join("attestations", "attestation.schema.json") +RECORDS_REL = os.path.join("attestations", "records") + +MIN_DISTINCT_TOKENS = {"does_not_establish": 25} + + +def check_record(record: dict, schema: dict, stem: str, + seen_ids: set[str], seen_prose: dict[str, str], + seen_successors: set[tuple[str, str]]) -> list[str]: + problems: list[str] = [] + + def fail(message: str) -> None: + problems.append(f"{stem}.json: {message}") + + problems.extend(f"{stem}.json: {p}" for p in validate_instance(record, schema)) + if problems: + return problems + + attestation_id = record["attestation_id"] + if attestation_id != stem: + fail(f"attestation_id {attestation_id!r} does not match the filename stem {stem!r}") + if attestation_id in seen_ids: + fail(f"duplicate attestation_id {attestation_id!r}") + seen_ids.add(attestation_id) + + # -- fail-closed admission ------------------------------------------- # + failed = [c for c in record["checks"] if c["exit_code"] != 0] + if record["outcome"] == "ADMITTED" and failed: + commands = ", ".join(repr(c["command"]) for c in failed) + fail(f"outcome ADMITTED but {len(failed)} recorded check(s) exited non-zero " + f"({commands}); a failed structural gate forbids admission") + if record["outcome"] == "REFUSED" and not failed: + fail("outcome REFUSED but every recorded check exited zero; a refusal must " + "name the check that refused it") + + # -- the three pins that keep an attestation from becoming a promotion - # + if record["claim_grade_after"] != "UNCHANGED": + fail(f"claim_grade_after is {record['claim_grade_after']!r}; an attestation " + f"never changes a grade") + if record["gate_status_after"] != "UNCHANGED": + fail(f"gate_status_after is {record['gate_status_after']!r}; an attestation " + f"never moves a gate") + if record["independence_credit"] != 0: + fail(f"independence_credit is {record['independence_credit']!r}; an " + f"attestation is not a review and carries no independence") + if record["outcome"] == "ADMITTED" and not record["awaiting"]: + fail("outcome ADMITTED with an empty awaiting list; admission finishes nothing") + + # -- anti-boilerplate -------------------------------------------------- # + for field, floor in MIN_DISTINCT_TOKENS.items(): + text = record.get(field, "") + distinct = {w.lower() for w in WORD.findall(text)} + if len(distinct) < floor: + fail(f"{field} has {len(distinct)} distinct token(s), below the floor of " + f"{floor}; padding by repetition is not a disclosure") + key = normalize(text) + if key and key in seen_prose and seen_prose[key] != stem: + fail(f"{field} is verbatim identical to {seen_prose[key]}.json; a " + f"statement copied between records is not specific to this object") + elif key: + seen_prose.setdefault(key, stem) + + # -- the object's current bytes ---------------------------------------- # + # An attestation speaks for the commit it names. When the object still + # exists at that path and its bytes have since changed, the record is + # historical and must say so: a stale digest presented as current is the + # one failure this form cannot tolerate. + path = record["object_id"].split(" @ ")[0].strip() + candidate = os.path.join(ROOT, path) + if os.path.isfile(candidate): + raw = open(candidate, "rb").read() + digest = hashlib.sha256(raw).hexdigest() + if digest != record["object_sha256"] or len(raw) != record["object_bytes"]: + successor = record.get("superseded_by") + if not successor: + fail(f"object {path} now has {len(raw)} bytes / sha256 {digest[:16]}..., " + f"not the attested {record['object_bytes']} / " + f"{record['object_sha256'][:16]}...; re-run the gates and attest the " + f"current bytes, or set superseded_by to the record that did") + else: + seen_successors.add((stem, successor)) + + # -- free-text scans --------------------------------------------------- # + for path, text in walk_strings(record): + lowered = text.lower() + for phrase in PROMOTION_PHRASES: + if phrase in lowered: + fail(f"promotion language {phrase!r} in field {path}: an attestation " + f"records admission, never a status movement") + for pattern in CONFIDENCE_PATTERNS: + hit = pattern.search(text) + if hit: + fail(f"confidence voting {hit.group(0)!r} in field {path}") + + return problems + + +def check_all(records_dir: str, schema_path: str) -> list[str]: + if not os.path.isdir(records_dir): + return [f"records directory {records_dir} does not exist"] + schema = load_json(schema_path) + problems: list[str] = [] + seen_ids: set[str] = set() + seen_prose: dict[str, str] = {} + seen_successors: set[tuple[str, str]] = set() + for filename in sorted(os.listdir(records_dir)): + if not filename.endswith(".json"): + continue + stem = filename[: -len(".json")] + try: + record = load_json(os.path.join(records_dir, filename)) + except Exception as exc: # noqa: BLE001 - reported, never raised + problems.append(f"{filename}: unreadable ({exc})") + continue + if not isinstance(record, dict): + problems.append(f"{filename}: top level is not an object") + continue + problems.extend(check_record(record, schema, stem, seen_ids, seen_prose, + seen_successors)) + for stem, successor in sorted(seen_successors): + if successor not in seen_ids: + problems.append(f"{stem}.json: superseded_by names {successor!r}, which is not a " + f"record in this directory; a record cannot be retired by a " + f"successor that does not exist") + return problems + + +def main(argv: list[str] | None = None) -> int: + argv = list(sys.argv[1:] if argv is None else argv) + records_dir = os.path.join(ROOT, RECORDS_REL) + schema_path = os.path.join(ROOT, SCHEMA_REL) + while argv: + flag = argv.pop(0) + if flag == "--records" and argv: + records_dir = argv.pop(0) + elif flag == "--schema" and argv: + schema_path = argv.pop(0) + else: + print(f"usage: attestations_check.py [--records DIR] [--schema PATH] " + f"(unrecognized: {flag!r})", file=sys.stderr) + return 2 + + problems = check_all(records_dir, schema_path) + count = (len([f for f in os.listdir(records_dir) if f.endswith(".json")]) + if os.path.isdir(records_dir) else 0) + for problem in problems: + print(f"PROBLEM {problem}") + shown = os.path.relpath(records_dir, ROOT) if records_dir.startswith(ROOT) else records_dir + print(f"attestations_check: {count} attestation(s) in {shown}, {len(problems)} problem(s).") + if not problems: + print("attestations_check: structure only. No mathematics verified, no grade " + "changed, no gate moved, no independence credit awarded.") + return 1 if problems else 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tools/run_checks.py b/tools/run_checks.py index a00e1b962..c752255c9 100644 --- a/tools/run_checks.py +++ b/tools/run_checks.py @@ -50,6 +50,7 @@ "python tools/verify_manifests.py", "python tools/manifest_integrity_check.py --coverage .github/manifest-coverage.json", "python tools/reviews_check.py", + "python tools/attestations_check.py", "python tools/recovery_check.py", "python tools/collision_proposal_check.py", "python tools/collision_proposal_check.py --proposal registers/collision_proposal_2026-09-19.json",