diff --git a/research/audit-local-cut-centre-guard/NOTICE.md b/research/audit-local-cut-centre-guard/NOTICE.md new file mode 100644 index 0000000000..a510934063 --- /dev/null +++ b/research/audit-local-cut-centre-guard/NOTICE.md @@ -0,0 +1,15 @@ +# Notice + +`inputs/BASE-WORD.json.gz` and `inputs/EXTRA-WORD.json.gz` are unmodified copies of PR #1672's +`research/gmx-t74-k554-signed-001/new/{gauge44,extra}-word-566.json.gz` (Jeremy Kothe / LeverRank, head b8ab040d), +Apache-2.0, with that package's retained ancestry (PR #1625 mdumitrean; PR #1319, #1297, #1286 Rohan Arun; PR #1274 +Jeremy Kothe; PR #1193 Jeremy Diviney; PR #1148 Thomas DiFiore; PR #1196 chafreaky; PR #1195; the PR564/571/589/645 +lineage). Exact pins: `inputs/PINS.json`. + +`inputs/PROBE-CUT-502.json.gz` is derived from the base word in this work (see README) as a semantic counterexample. +It is not a valid word. + +The audited checker, `research/gauge44-frames-x/independent/audit_local.py` (icekylinx, Apache-2.0), is used unchanged +and pinned in `SOURCES.json`. + +New files: Marius-Paul Dumitrean, Apache-2.0, prepared with substantial AI assistance (Anthropic Claude, via Claude Code). diff --git a/research/audit-local-cut-centre-guard/README.md b/research/audit-local-cut-centre-guard/README.md new file mode 100644 index 0000000000..e373ae5401 --- /dev/null +++ b/research/audit-local-cut-centre-guard/README.md @@ -0,0 +1,70 @@ +# audit_local.py accepts non-centre cut gates (guard and regression fixture, no new κ) + +**Finding.** The independent local auditor `research/gauge44-frames-x/independent/audit_local.py` climbs frames only in +sections A and B. In the cut it checks only gates whose source is one of the word's eight centres (the centre-path +rule). A cut gate with any other source is applied to the scalar map but never frame-checked. A word can therefore move +priced work into the unpriced cut and still pass, with an understated paid profile. + +**Counterexample** (`inputs/PROBE-CUT-502.json.gz`). Start from the genuine base word of the pivot-566+554 T74 supplier +(`inputs/BASE-WORD.json.gz`, PR #1672). Make width-9 helper 502 entering (start frame of dimension 1 instead of 0), so its +width drops from 9 to 8. Cancel its initial-value leak with four cut gates `200/203/205/206 += ±½ · 502`, and re-time its +two A-section writes into B. +- The unchanged auditor run with `--main` **passes** it: compensation 7,204 gates instead of 7,208, 193 entering helpers instead of 192, local + profile `{2: 501, 3: 415}` instead of `{2: 500, 3: 416}`. That is one rank level less, about 2.1M units per call, which + would be worth roughly +8e-8 κ through the hosting. +- The native provider chain **rejects** it at its second step: `hpe_emit_local.py` fails with `emitted column mismatch` + at register 153 (`evidence/NATIVE-PROBE.txt`). The base word passes all five native steps. + +So the gap does not affect claims whose admission includes the native chain, which every T74 claim does. It does +affect any acceptance that relies on `audit_local.py` alone. + +**Guard** (`guard.py`, standard library). Every cut gate must be an `add` whose source is a centre and whose target is a +target row (`v <= t < 2v`). This is the structure of every genuine word, and the native emitter relies on it. +- It accepts all 146 genuine words found at the base commit (every `CANONICAL-WORD`/`FULL-WORD` file with a cut) and both + supplier words (`evidence/GUARD-GENUINE-WORDS.json`). +- It rejects exactly the probe's four gates (`evidence/GUARD-PROBE.json`). + +`audit_local.py` is pinned by hash in 421 files at the base commit, so this package does not modify it. The guard is +additive: run it alongside the auditor, or fold it into a new auditor version. + +## Reproduce + +```sh +python3.12 scripts/research_package.py --package research/audit-local-cut-centre-guard +python3 -B research/audit-local-cut-centre-guard/guard.py WORD.json.gz +``` + +`verify.py` checks the input pins and runs the unchanged auditor on the base and probe words; both pass, and the +receipts equal `evidence/AUDIT-*.json`. The pins cover the three words and two repository files, which are declared in +both `VERIFY.json` and `SOURCES.json`: the auditor, and the parent `CANONICAL-WORD.json.gz` (PR622 baseline558 +split-centres) that its `--main` interface check reads. The package plus those two files is enough: `verify.py` also +passes in a Git-free export that contains nothing else. It then runs the guard on all three words and two mutation controls (a +non-centre cut source, a non-target cut row). It takes a few seconds. The native rejection is recorded evidence, not +rerun. + +## Scope + +This audits one condition: frames of cut gates in the local auditor. It is not a new construction and gives no κ. The +counterexample is built on the pending T74 supplier's base word, which is not in main; the auditor and guard are the +same for the selected line's words. + +## Open next questions + +- **Version the guard into the auditor.** The first step is done. ywz65's + [handoff](https://github.com/CrocSwap/integer-mult-bounds/pull/2478#issuecomment-6192363481) found seven registered + packages that actually call `audit_local.py`; eleven more only hash it, and five use other checkers. Their committed + words pass `guard.py` with the same 176-gate cut (re-run here on the six distinct words). Their admitted mutation + families do not change the cut, so no existing claim is shown to use the gap. Adoption by those callers is blocked on a + maintainer decision about versioning a pinned auditor. +- **Check the other unpriced sections.** The precondition, the derived compensation and the frame-free cleanup could + admit analogous counterexamples. For each one, state the structural rule the native emitter assumes and test it with + a constructed word, as here. + +## Credit + +The auditor is icekylinx's gauge44-frames-x package. The words are PR #1672's (Jeremy Kothe / LeverRank) pivot-554 kernel on +PR #1625's pivot-566 words (mdumitrean), in the PR #1319/#1297 lineage (Rohan Arun) and its retained ancestry. The native +chain is PR635's vendored scripts, run through PR #1186's toolkit. The registered-consumer screen is ywz65's (see the +open questions). See `NOTICE.md`. + +Prepared by Marius-Paul Dumitrean with substantial AI assistance (Anthropic Claude, via Claude Code). Apache-2.0. diff --git a/research/audit-local-cut-centre-guard/SOURCES.json b/research/audit-local-cut-centre-guard/SOURCES.json new file mode 100644 index 0000000000..af96bb2a61 --- /dev/null +++ b/research/audit-local-cut-centre-guard/SOURCES.json @@ -0,0 +1,32 @@ +{ + "schema_version": 1, + "base_commit": "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2", + "files": [ + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "e8870e5917057d59b730eb14721a778639eca050", + "sha256": "d46eb6d5b3e279428753d770653663fbdf1063e55c255ea073d768f344927ef7" + }, + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11", + "sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32" + }, + { + "path": "research/gauge44-frames-x/independent/audit_local.py", + "usage": "input", + "git_blob": "4744d8783c25bf7bf5076886169077ca3808309a", + "sha256": "03afcfc9da428b3f6edac81c1fee7f277ab81b64998efae78380b63498dec6cd" + }, + { + "path": "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/CANONICAL-WORD.json.gz", + "usage": "input", + "git_blob": "a2e5a1ffd454a353bd2d2100bc26259ff5b57af7", + "sha256": "66d3c3c70983224650643a0a05a21ac6c6959f84d0f4528650601016f5a76844", + "source_commit": "5c5567d15bd019186519a4db267914257b5f1ac0", + "note": "Read by audit_local.py --main (check_parent_interface: the transported centre/port interface). Same bytes at base_commit; last changed by source_commit." + } + ] +} diff --git a/research/audit-local-cut-centre-guard/TASK.json b/research/audit-local-cut-centre-guard/TASK.json new file mode 100644 index 0000000000..a60ee3b34c --- /dev/null +++ b/research/audit-local-cut-centre-guard/TASK.json @@ -0,0 +1,66 @@ +{ + "schema_version": 1, + "task_id": "supplier-boundary-audit", + "priority_revision": 4, + "base_commit": "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2", + "original_card": { + "id": "supplier-boundary-audit", + "question": "Does one selected supplier obligation follow from its actual source-bound checks?", + "starting_points": [ + "certificates/selected-result.json", + "research/owner-boundary-audit/README.md" + ], + "methods": [ + "Trace one hypothesis through the source, checker and complete caller.", + "Construct one semantically invalid but superficially well-formed fixture and test rejection." + ], + "acceptance_gate": "Pin the current sources and one obligation; the historical owner audit is an example, not evidence of a current bug.", + "first_step": { + "command": [ + "python3", + "-B", + "research/owner-boundary-audit/verify.py" + ], + "expected": "PASS_PR626_NEXT_TOUCH_BOUNDARY_AUDIT", + "inspect": "Identify why the timing-only omission passes but the full production controller still rejects it.", + "scope": "Positive control / source-bound orientation only; this is not a new construction or full cold replay." + }, + "first_experiment": "Choose one current supplier obligation and trace whether its acceptance depends on an independent check.", + "bottleneck_link": "Closing a current acceptance gap or proof obligation strengthens reliability even without changing kappa.", + "allowed_variations": [ + "Audit one named current condition using a new semantic counterexample." + ], + "scope_change_triggers": [ + "Reporting the historical timing-only diagnostic as a new current acceptance bug." + ], + "overlap_terms": [ + "owner boundary", + "bridge omission", + "hosting" + ] + }, + "scope_status": "refined", + "actual_scope": "Does the local-word frame obligation checked by research/gauge44-frames-x/independent/audit_local.py follow from its source-bound checks for every section of the word? Audited condition: frames of cut gates.", + "scope_change_reason": "The card asks for one selected supplier obligation; the audited checker is the local-word auditor used by the selected and the pending T74 supplier lines, and the semantic counterexample is built on the pending T74 supplier base word because that is where the gap appeared.", + "bottleneck_link": "An acceptance gap in the local auditor can admit a word whose paid profile is understated; closing it strengthens every package that relies on this auditor without the native chain. No kappa changes.", + "budget_minutes": 90, + "stop_rule": "Stop after one semantic counterexample, one guard that accepts every genuine word checked and rejects the counterexample, and two mutation controls.", + "outcome": "completed", + "evidence": "evidence/AUDIT-BASE.json and AUDIT-PROBE.json (the unchanged auditor passes both); evidence/GUARD-PROBE.json (the four non-centre cut gates); evidence/GUARD-GENUINE-WORDS.json (146 genuine words at the base commit plus the supplier words: no violation); evidence/NATIVE-PROBE.txt (the native chain rejects the probe at hpe_emit_local.py).", + "author": "Marius-Paul Dumitrean", + "ai_assistance": "Substantial assistance from Anthropic Claude (Claude Code): search, construction of the counterexample, code, runs, analysis and text.", + "open_questions": [ + { + "question": "Should the guard become part of a new version of the local auditor (or of the registered replays that call it)?", + "why_it_matters": "audit_local.py is pinned by hash in 421 files at the base commit, so it is not changed here; packages that rely on it without the native chain inherit the gap.", + "first_step": "Done for the registered packages by ywz65 (https://github.com/CrocSwap/integer-mult-bounds/pull/2478#issuecomment-6192363481): seven actual callers of the auditor at the base commit; their committed words pass guard.py with the same 176-gate cut. Next: choose how a versioned auditor (or a guard step before it) is adopted by those callers.", + "blocked_by": "A maintainer decision on how to version a pinned auditor." + }, + { + "question": "Do the other unpriced sections (precondition, derived compensation, frame-free cleanup) admit analogous counterexamples?", + "why_it_matters": "The cut gap shows the auditor trusts structure it does not check; the precondition and cleanup are also frame-free.", + "first_step": "For each section, write the structural rule the native emitter assumes and test it against a constructed word as here.", + "blocked_by": "None." + } + ] +} diff --git a/research/audit-local-cut-centre-guard/VERIFY.json b/research/audit-local-cut-centre-guard/VERIFY.json new file mode 100644 index 0000000000..ac963383b7 --- /dev/null +++ b/research/audit-local-cut-centre-guard/VERIFY.json @@ -0,0 +1,21 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/gauge44-frames-x/independent/audit_local.py", + "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/CANONICAL-WORD.json.gz" + ], + "commands": [ + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "SHA-256/Git-blob pins of the package inputs and of both declared repository inputs (the auditor and the parent CANONICAL-WORD that its --main interface check reads); the unchanged audit_local.py --main PASSES both the genuine base word and the probe word with four non-centre cut gates (receipts equal evidence/AUDIT-*.json); guard.py passes the genuine base and extra words and rejects exactly the probe's four cut gates; two mutation controls (non-centre cut source, non-target cut row) are rejected. The native chain's rejection of the probe is recorded evidence, not rerun." + } + ] +} diff --git a/research/audit-local-cut-centre-guard/evidence/AUDIT-BASE.json b/research/audit-local-cut-centre-guard/evidence/AUDIT-BASE.json new file mode 100644 index 0000000000..069fe843ea --- /dev/null +++ b/research/audit-local-cut-centre-guard/evidence/AUDIT-BASE.json @@ -0,0 +1,13 @@ +{ + "compensation_gates": 7208, + "entering": 192, + "local_profile": { + "1": 2348, + "2": 500, + "3": 416, + "4": 130, + "5": 82, + "8": 8 + }, + "status": "PASS_INDEPENDENT_EXACT_FORWARD_AND_DUAL_ENDPOINT_FRAMES_ENTRANCES_CONES" +} diff --git a/research/audit-local-cut-centre-guard/evidence/AUDIT-PROBE.json b/research/audit-local-cut-centre-guard/evidence/AUDIT-PROBE.json new file mode 100644 index 0000000000..220e914a14 --- /dev/null +++ b/research/audit-local-cut-centre-guard/evidence/AUDIT-PROBE.json @@ -0,0 +1,13 @@ +{ + "compensation_gates": 7204, + "entering": 193, + "local_profile": { + "1": 2348, + "2": 501, + "3": 415, + "4": 130, + "5": 82, + "8": 8 + }, + "status": "PASS_INDEPENDENT_EXACT_FORWARD_AND_DUAL_ENDPOINT_FRAMES_ENTRANCES_CONES" +} diff --git a/research/audit-local-cut-centre-guard/evidence/GUARD-GENUINE-WORDS.json b/research/audit-local-cut-centre-guard/evidence/GUARD-GENUINE-WORDS.json new file mode 100644 index 0000000000..fb53890c9d --- /dev/null +++ b/research/audit-local-cut-centre-guard/evidence/GUARD-GENUINE-WORDS.json @@ -0,0 +1,736 @@ +{ + "base_commit": "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2", + "words": [ + { + "path": "research/complex-cold-owner-repair/vendor/structural_gain/frontier-composition/combined-prefix-word/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/complex-k492-owner-repair/vendor/structural_gain/frontier-composition/combined-prefix-word/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/complex-pr615-ceiling/vendor/structural_gain/frontier-composition/combined-prefix-word/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/complex-sw4-frame8-validation/platforms/linux/frames/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/complex-sw4-frame8-validation/platforms/linux/local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/complex-sw4-frame8-validation/platforms/linux/p6n/p6n/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/complex-sw4-frame8-validation/platforms/linux/promoted/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/complex-sw4-frame8-validation/platforms/linux/sw4/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/complex-sw4-frame8-validation/platforms/macos/frames/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/complex-sw4-frame8-validation/platforms/macos/local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/complex-sw4-frame8-validation/platforms/macos/p6n/p6n/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/complex-sw4-frame8-validation/platforms/macos/promoted/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/complex-sw4-frame8-validation/platforms/macos/sw4/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/complex-sw4-frame8/vendor/main/research/structural-gain/frontier-composition/global-replay/base/split-centres/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/complex-sw4-frame8/vendor/main/research/structural-gain/frontier-composition/multicold-eight-word/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/direct-delivery504-global/evidence/local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/direct504-kernel92-lifts/vendor/pr531/evidence/local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/direct504-kernel92-lifts/vendor/pr534/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/direct504-kernel92/vendor/pr531/evidence/local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/filtered-supplier-registry/evidence/local-filtered/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/filtered-supplier-registry/evidence/local-retargeted/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/filtered-supplier-registry/vendor/pr531/evidence/local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/frame-sa504/evidence/local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/gauge44-barch-t16/evidence/local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/gauge44-barch/evidence/local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/gauge44-frames-x/evidence/local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/gauge44-leaver/evidence/local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/gauge44-leaver8/evidence/local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/gauge44-slots-t16/evidence/local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/gauge44-slots/evidence/local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/kernel92-frame-composition/vendor/pr531/evidence/local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/larger-gain/providers/fourcold-eight/local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/larger-gain/providers/fourcold-eight/word/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/larger-gain/providers/fourcold-four/local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/larger-gain/providers/fourcold-four/word/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/larger-gain/providers/fourcold-zero/local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/larger-gain/providers/fourcold-zero/word/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/larger-gain/providers/promotions/all32width7/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/larger-gain/providers/promotions/all40width4/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/larger-gain/providers/promotions/all48width4/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/larger-gain/providers/promotions/all60width7/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/larger-gain/providers/promotions/combined72/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/larger-gain/providers/promotions/combined80/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/larger-gain/providers/width7/eight/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/larger-gain/providers/width7/four/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/larger-gain/providers/width7/zero/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/larger-gain/providers/words/eight/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/larger-gain/providers/words/four/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/larger-gain/providers/words/zero/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/mixed-prefix-fourway/vendor/pr569/providers/width7/eight/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/mixed-prefix-fourway/vendor/pr571/frontier-composition/prefix-input/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/post-center-rank4-global/evidence/local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/promoted-kernel-coalescing/vendor/structural_gain/frontier-composition/combined-prefix-word/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/punctured112-global/evidence/local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/r480-owner-optimum/inputs/local/FULL-WORD.json.gz", + "cut_gates": 176, + "violations": 0 + }, + { + "path": "research/static44-selective/vendor/pr531/evidence/local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/frontier-composition/combined-eight-local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/frontier-composition/combined-eight-word/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/frontier-composition/combined-prefix-local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/frontier-composition/combined-prefix-word/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/frontier-composition/global-replay/base/providers/fourcold_eight/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/frontier-composition/global-replay/base/providers/width7_eight/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/frontier-composition/global-replay/base/split-centres/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/frontier-composition/multicold-eight-local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/frontier-composition/multicold-eight-word/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/frontier-composition/portable-replay/composed-word/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/frontier-composition/portable-replay/global/base/providers/fourcold_eight/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/frontier-composition/portable-replay/global/base/providers/width7_eight/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/frontier-composition/portable-replay/global/base/split-centres/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/frontier-composition/portable-replay/local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/frontier-composition/portable-replay/multicold-word/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/frontier-composition/portable-replay/width7-word/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/frontier-composition/prefix-input/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/multicut-shared-compositions/candidate-000/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/multicut-shared-compositions/candidate-001/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/multicut-shared-compositions/candidate-002/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/multicut-shared-compositions/candidate-003/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/multicut-shared-compositions/candidate-004/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/multicut-shared-compositions/candidate-005/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/multicut-shared-compositions/candidate-006/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/multicut-shared-compositions/candidate-007/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/multicut-unlocked-rank2/candidate-000/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/multicut-unlocked-rank2/candidate-001/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/multicut-unlocked-rank2/candidate-002/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/multicut-unlocked-rank2/candidate-003/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/multicut-unlocked-rank2/candidate-004/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/multicut-unlocked-rank2/candidate-005/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/multicut-unlocked-rank2/candidate-006/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/multicut-unlocked-rank2/candidate-007/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/multicut-unlocked-rank2/candidate-008/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/multicut-unlocked-rank2/candidate-009/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/multicut-unlocked-rank2/candidate-010/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/multicut-unlocked-rank2/candidate-011/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/multicut-unlocked-rank2/candidate-012/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/multicut-unlocked-rank2/candidate-013/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/multicut-unlocked-rank2/candidate-014/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/multicut-unlocked-rank2/candidate-015/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/prefix-optimal-disjoint/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/prefix-raised-optimal-disjoint/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/prefix-raised-screen/rank1-disjoint/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/prefix-raised-screen/rank2-disjoint/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/prefix-raised-screen/rank3-disjoint/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/prefix-raised-screen/rank4-disjoint/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/prefix-screen/rank1-disjoint/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/prefix-screen/rank2-disjoint/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/prefix-screen/rank3-disjoint/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/prefix-screen/rank4-disjoint/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/multicut-shared-compositions/candidate-000/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/multicut-shared-compositions/candidate-001/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/multicut-shared-compositions/candidate-002/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/multicut-shared-compositions/candidate-003/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/multicut-shared-compositions/candidate-004/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/multicut-shared-compositions/candidate-005/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/multicut-shared-compositions/candidate-006/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/multicut-shared-compositions/candidate-007/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/multicut-unlocked-rank2/candidate-000/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/multicut-unlocked-rank2/candidate-001/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/multicut-unlocked-rank2/candidate-002/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/multicut-unlocked-rank2/candidate-003/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/multicut-unlocked-rank2/candidate-004/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/multicut-unlocked-rank2/candidate-005/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/multicut-unlocked-rank2/candidate-006/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/multicut-unlocked-rank2/candidate-007/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/multicut-unlocked-rank2/candidate-008/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/multicut-unlocked-rank2/candidate-009/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/multicut-unlocked-rank2/candidate-010/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/multicut-unlocked-rank2/candidate-011/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/multicut-unlocked-rank2/candidate-012/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/multicut-unlocked-rank2/candidate-013/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/multicut-unlocked-rank2/candidate-014/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/multicut-unlocked-rank2/candidate-015/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/prefix-optimal-disjoint/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/prefix-raised-optimal-disjoint/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/prefix-raised-screen/rank1-disjoint/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/prefix-raised-screen/rank2-disjoint/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/prefix-raised-screen/rank3-disjoint/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/prefix-raised-screen/rank4-disjoint/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/prefix-screen/rank1-disjoint/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/prefix-screen/rank2-disjoint/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/prefix-screen/rank3-disjoint/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/prefix-screen/rank4-disjoint/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/replay-evidence/suffix-unlocked/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/structural-gain/joint-basis/suffix-unlocked/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "research/subspace16-r420/vendor/pr531/evidence/local/FULL-WORD.json.gz", + "cut_gates": 224, + "violations": 0 + }, + { + "path": "inputs/BASE-WORD.json.gz", + "cut_gates": 176, + "violations": 0 + }, + { + "path": "inputs/EXTRA-WORD.json.gz", + "cut_gates": 176, + "violations": 0 + } + ], + "all_pass": true +} diff --git a/research/audit-local-cut-centre-guard/evidence/GUARD-PROBE.json b/research/audit-local-cut-centre-guard/evidence/GUARD-PROBE.json new file mode 100644 index 0000000000..22d828389f --- /dev/null +++ b/research/audit-local-cut-centre-guard/evidence/GUARD-PROBE.json @@ -0,0 +1,38 @@ +{ + "violations_gates": [ + [ + "add", + 200, + 502, + -1, + 2 + ], + [ + "add", + 203, + 502, + 1, + 2 + ], + [ + "add", + 205, + 502, + 1, + 2 + ], + [ + "add", + 206, + 502, + 1, + 2 + ] + ], + "cut_indices": [ + 176, + 177, + 178, + 179 + ] +} diff --git a/research/audit-local-cut-centre-guard/evidence/NATIVE-PROBE.txt b/research/audit-local-cut-centre-guard/evidence/NATIVE-PROBE.txt new file mode 100644 index 0000000000..98fcbfcaa9 --- /dev/null +++ b/research/audit-local-cut-centre-guard/evidence/NATIVE-PROBE.txt @@ -0,0 +1,12 @@ +Native provider chain on the two words (recorded run, 2026-10-15; not rerun by verify.py). +Runner: PR #1186's exact-frame toolkit native.py (revision 3, c37dfb07), which executes main's vendored PR635 scripts +through research/complex-k492-owner-repair/vendor/multicold/code/run_portable.py: +transport audit -> ledgers (hpe_emit_local.py) -> local replay (hpe_audit_local.py) -> wrappers (hpe_adapters_local.py) -> phases. + +BASE-WORD.json.gz: PASS native 1s / PASS ledgers 1s / PASS local-replay 3s / PASS wrappers 1s / PASS phases 85s +PROBE-CUT-502.json.gz: PASS native 1s / FAIL ledgers 0s + +Probe failure (paths shortened): + File "research/complex-sw4-frame8/vendor/pr635/research/complex-571-cold14-st2/code/hpe_emit_local.py", line 150, in check_local + assert state['L',r]==expected,('emitted column mismatch',back,r) + AssertionError: ('emitted column mismatch', False, 153) diff --git a/research/audit-local-cut-centre-guard/guard.py b/research/audit-local-cut-centre-guard/guard.py new file mode 100644 index 0000000000..ce1c236a51 --- /dev/null +++ b/research/audit-local-cut-centre-guard/guard.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Cut-source guard for local words checked by research/gauge44-frames-x/independent/audit_local.py. + +audit_local.py climbs frames only in sections A and B; in the cut it checks only gates whose source is a centre +(the centre-path rule). A cut gate with any other source is applied to the scalar map but never frame-checked, so a +word can move priced work into the unpriced cut and still pass. This guard checks what every genuine word satisfies +and the native emitter (hpe_emit_local.py) relies on: every cut gate is an add whose source is one of the word's +eight centres and whose target is a target row (v <= t < 2v). + +usage: python3 -B guard.py WORD.json.gz [--json OUT.json] (exit 0 = PASS, 1 = violation)""" +import argparse, gzip, json, sys +from pathlib import Path + + +def violations(word): + v = word['report']['v']; centres = set(word['centers']) + out = [] + for i, e in enumerate(word['cut']): + if not (e[0] == 'add' and e[2] in centres and v <= e[1] < 2 * v): + out.append(dict(cut_index=i, gate=e[:5])) + return out + + +def main(): + ap = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + ap.add_argument('word', type=Path); ap.add_argument('--json', type=Path) + a = ap.parse_args() + word = json.loads(gzip.decompress(a.word.read_bytes())) + bad = violations(word) + res = dict(status='PASS_CUT_SOURCES_ARE_CENTRES' if not bad else 'FAIL_NON_CENTRE_CUT_GATES', + word=a.word.name, cut_gates=len(word['cut']), centres=sorted(word['centers']), violations=bad) + if a.json: a.json.write_text(json.dumps(res, indent=1, sort_keys=True) + '\n', encoding='utf-8') + print(res['status'], a.word.name, 'cut', len(word['cut']), 'violations', len(bad), flush=True) + return 0 if not bad else 1 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/research/audit-local-cut-centre-guard/inputs/BASE-WORD.json.gz b/research/audit-local-cut-centre-guard/inputs/BASE-WORD.json.gz new file mode 100644 index 0000000000..76c01583a0 Binary files /dev/null and b/research/audit-local-cut-centre-guard/inputs/BASE-WORD.json.gz differ diff --git a/research/audit-local-cut-centre-guard/inputs/EXTRA-WORD.json.gz b/research/audit-local-cut-centre-guard/inputs/EXTRA-WORD.json.gz new file mode 100644 index 0000000000..e86142b352 Binary files /dev/null and b/research/audit-local-cut-centre-guard/inputs/EXTRA-WORD.json.gz differ diff --git a/research/audit-local-cut-centre-guard/inputs/PINS.json b/research/audit-local-cut-centre-guard/inputs/PINS.json new file mode 100644 index 0000000000..eb1ea14a29 --- /dev/null +++ b/research/audit-local-cut-centre-guard/inputs/PINS.json @@ -0,0 +1,24 @@ +{ + "schema_version": 1, + "license": "Apache-2.0 (words: PR #1672 and its retained lineage; probe derived from them)", + "files": { + "BASE-WORD.json.gz": { + "sha256": "eeb6a236ed0ea8873b8800947d0cd19c36a6fcfdf857fc42913cb45cd984f219", + "git_blob": "76c01583a0286cddb0f71e0cb13077e4317104f6", + "source": "PR #1672 b8ab040d research/gmx-t74-k554-signed-001/new/gauge44-word-566.json.gz", + "role": "genuine base (gauge44) word of the pivot-566+554 T74 supplier used by #2044/#2161/#2180/#2220" + }, + "EXTRA-WORD.json.gz": { + "sha256": "cd417b904408c221d9840d08faff8af040cc4207f9804284f2f5375d21298a62", + "git_blob": "e86142b352466f54a3da38c96a6e1484145c3b5c", + "source": "PR #1672 b8ab040d research/gmx-t74-k554-signed-001/new/extra-word-566.json.gz", + "role": "genuine extra word of the same supplier" + }, + "PROBE-CUT-502.json.gz": { + "sha256": "97d079123aa9c0b1c73cbe5f700ea81b4b8fdad92e9e4fa10f8ed55fd16cd788", + "git_blob": "eb636ed1d6cc4c9faefe99ef62750f2fed078853", + "source": "built in this package from BASE-WORD (see README)", + "role": "semantic counterexample: helper 502 entering, its leak cancelled by four non-centre cut gates" + } + } +} diff --git a/research/audit-local-cut-centre-guard/inputs/PROBE-CUT-502.json.gz b/research/audit-local-cut-centre-guard/inputs/PROBE-CUT-502.json.gz new file mode 100644 index 0000000000..eb636ed1d6 Binary files /dev/null and b/research/audit-local-cut-centre-guard/inputs/PROBE-CUT-502.json.gz differ diff --git a/research/audit-local-cut-centre-guard/verify.py b/research/audit-local-cut-centre-guard/verify.py new file mode 100644 index 0000000000..23a0f96d4f --- /dev/null +++ b/research/audit-local-cut-centre-guard/verify.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Registered check: the unchanged local auditor accepts a word whose cut gates read a non-centre helper; guard.py +rejects it, and accepts the genuine words. + +Checks: + 1. input pins: SHA-256 and Git blob ids of the three words equal inputs/PINS.json, and those of the two declared + repository inputs (the auditor, and the parent CANONICAL-WORD that its --main interface check reads) equal SOURCES.json; + 2. the gap: research/gauge44-frames-x/independent/audit_local.py --main (unchanged, pinned in SOURCES.json) PASSES + both the genuine base word and the probe word PROBE-CUT-502 (four non-centre cut gates, helper 502 entering); + the receipts' status, compensation size, entering count and local profile equal evidence/AUDIT-*.json; + 3. the guard: PASS on the base and extra words, FAIL on the probe with exactly its four cut gates; + 4. controls: the guard rejects a base word with one cut source replaced by a non-centre helper, and one with a cut + target replaced by a non-target row. +The native provider chain's rejection of the probe (hpe_emit_local.py: 'emitted column mismatch', register 153) is +recorded evidence (evidence/NATIVE-PROBE.txt), not rerun here.""" +import copy, gzip, hashlib, json, subprocess, sys, tempfile +from pathlib import Path +if not __debug__: + raise SystemExit('verify.py: do not run with -O (the registered replay runs unoptimised)') +PKG = Path(__file__).resolve().parent +ROOT = PKG.parents[1] +sys.path.insert(0, str(PKG)) +import guard # noqa: E402 +AUDITOR = ROOT / 'research/gauge44-frames-x/independent/audit_local.py' +PARENT = ROOT / 'research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/CANONICAL-WORD.json.gz' # read by --main +rd = lambda p: json.loads(Path(p).read_text(encoding='utf-8')) +def blob(b): return hashlib.sha1(b'blob %d\0' % len(b) + b).hexdigest() +def require(ok, msg): + if not ok: raise SystemExit('FAIL: ' + msg) + +pins = rd(PKG / 'inputs/PINS.json')['files'] +for name, pin in pins.items(): + b = (PKG / 'inputs' / name).read_bytes() + require(hashlib.sha256(b).hexdigest() == pin['sha256'] and blob(b) == pin['git_blob'], 'input pin ' + name) +src = {r['path']: r for r in rd(PKG / 'SOURCES.json')['files'] if r['usage'] == 'input'} +for path in (AUDITOR, PARENT): + pin = src[path.relative_to(ROOT).as_posix()] + require(path.is_file(), 'declared input missing: ' + pin['path']) + b = path.read_bytes() + require(hashlib.sha256(b).hexdigest() == pin['sha256'] and blob(b) == pin['git_blob'], 'declared input changed: ' + pin['path']) + +def audit(name, out): + rc = subprocess.run([sys.executable, '-B', str(AUDITOR), '--word', str(PKG / 'inputs' / name), '--output', str(out), + '--main', str(ROOT)], cwd=ROOT, capture_output=True, text=True).returncode + require(rc == 0, 'auditor exit %d on %s' % (rc, name)) + r = rd(out); keep = ('status', 'compensation_gates', 'local_profile') + return {k: r.get(k) for k in keep} | {'entering': len(json.loads(gzip.decompress((PKG / 'inputs' / name).read_bytes())).get('start_extra', {}))} + +with tempfile.TemporaryDirectory() as d: + for name, ev in (('BASE-WORD.json.gz', 'AUDIT-BASE.json'), ('PROBE-CUT-502.json.gz', 'AUDIT-PROBE.json')): + got = audit(name, Path(d) / ev) + require(got['status'] == 'PASS_INDEPENDENT_EXACT_FORWARD_AND_DUAL_ENDPOINT_FRAMES_ENTRANCES_CONES', 'auditor did not pass ' + name) + require(got == rd(PKG / 'evidence' / ev), 'auditor receipt differs from evidence/' + ev) + print('auditor PASS', name, got['compensation_gates'], 'compensation gates,', got['entering'], 'entering', flush=True) + +words = {n: json.loads(gzip.decompress((PKG / 'inputs' / n).read_bytes())) for n in pins} +require(guard.violations(words['BASE-WORD.json.gz']) == [] and guard.violations(words['EXTRA-WORD.json.gz']) == [], 'guard rejects a genuine word') +bad = guard.violations(words['PROBE-CUT-502.json.gz']) +require([b['gate'] for b in bad] == rd(PKG / 'evidence/GUARD-PROBE.json')['violations_gates'], 'guard probe violations differ') +print('guard PASS base, PASS extra, FAIL probe with', len(bad), 'non-centre cut gates', flush=True) + +base = words['BASE-WORD.json.gz']; v = base['report']['v'] +c1 = copy.deepcopy(base); c1['cut'][0] = list(c1['cut'][0]); c1['cut'][0][2] = 502 +c2 = copy.deepcopy(base); c2['cut'][0] = list(c2['cut'][0]); c2['cut'][0][1] = 2 * v + 5 +require(len(guard.violations(c1)) == 1 and len(guard.violations(c2)) == 1, 'guard controls') +print('controls: non-centre source and non-target row both rejected', flush=True) +print('PASS_AUDIT_LOCAL_CUT_CENTRE_GUARD auditor-accepts-probe guard-rejects-probe', flush=True)