From 02d279515ff1fc468ab99a19d89461f1b6391507 Mon Sep 17 00:00:00 2001 From: Sagar Thakrar Date: Wed, 14 Oct 2026 03:06:22 +0530 Subject: [PATCH] Research audit: ancestry binding of the selected #1094 reuse replay (no new kappa) The --baseline1042 reuse mode of verify_frontier1094.py discards the return value of check_selected and never compares it with the BASELINE-BINDING.json bound by #1042. The new package rebuilds that binding byte-for-byte from the committed PR799/PR741 archives and freezes variant controls at three layers: check_selected, the pinned reuse statements, and the whole pinned reuse mode, each with and without a suggested one-line binding. No pinned file is edited. Seed 69, supplier-boundary-audit (refined). Prepared with substantial Anthropic Claude assistance. --- .../EXPECTED.json | 79 +++++ .../README.md | 214 +++++++++++++ .../SOURCES.json | 246 ++++++++++++++ .../TASK.json | 66 ++++ .../VERIFY.json | 55 ++++ .../verify.py | 301 ++++++++++++++++++ 6 files changed, 961 insertions(+) create mode 100644 research/frontier1094-ancestry-binding-seed69/EXPECTED.json create mode 100644 research/frontier1094-ancestry-binding-seed69/README.md create mode 100644 research/frontier1094-ancestry-binding-seed69/SOURCES.json create mode 100644 research/frontier1094-ancestry-binding-seed69/TASK.json create mode 100644 research/frontier1094-ancestry-binding-seed69/VERIFY.json create mode 100644 research/frontier1094-ancestry-binding-seed69/verify.py diff --git a/research/frontier1094-ancestry-binding-seed69/EXPECTED.json b/research/frontier1094-ancestry-binding-seed69/EXPECTED.json new file mode 100644 index 0000000000..6459ef6055 --- /dev/null +++ b/research/frontier1094-ancestry-binding-seed69/EXPECTED.json @@ -0,0 +1,79 @@ +{ + "pinned_reuse_branch": [ + "ancestor = Path(receipt['baseline']).resolve()", + "check_selected(ancestor, ancestor / 'ancestor')", + "require(sha(baseline / 'BASELINE-BINDING.json') == receipt['baseline_binding_sha256'], 'Ancestor binding')" + ], + "suggested_binding": "require(check_selected(ancestor, ancestor / 'ancestor') == read(baseline / 'BASELINE-BINDING.json'), 'Ancestry recheck differs from bound #1042 binding')", + "writer_statements": [ + "ancestor = check_selected(baseline, baseline / 'ancestor')", + "(work / 'BASELINE-BINDING.json').write_text(json.dumps(ancestor, indent=2) + '\\n')" + ], + "recorded_baselines": { + "pr1094": "/private/tmp/batch1047-selected", + "pr1042": "/private/tmp/batch952-baseline799" + }, + "variants": { + "identity": { + "check_selected": "PASS", + "binding_sha256": "22575ff21833fdfcfc7d67d7d9b3b433cf13a3165628ebcb9aaae239b8145472", + "differs_from_bound": [], + "pinned_reuse_branch": "ACCEPT", + "suggested_binding": "ACCEPT" + }, + "timing": { + "check_selected": "PASS", + "binding_sha256": "fa59eab2ec1ca4c3c4f46c6ae7afcbfcce9684750a49c0a6d41fb16f7cf1f055", + "differs_from_bound": [ + "/selected_binding/ancestry/complex_receipt_sha256" + ], + "pinned_reuse_branch": "ACCEPT", + "suggested_binding": "REJECT: Ancestry recheck differs from bound #1042 binding" + }, + "bit_result": { + "check_selected": "PASS", + "binding_sha256": "cc9fbb0b308659916ab75a5c906640486aff84be19ef3f9b16b12b4ef75ba950", + "differs_from_bound": [ + "/selected_binding/ancestry/bit_result_sha256" + ], + "pinned_reuse_branch": "ACCEPT", + "suggested_binding": "REJECT: Ancestry recheck differs from bound #1042 binding" + }, + "bit_supplier": { + "check_selected": "PASS", + "binding_sha256": "0d6b9e02e986361d2b933ab64a8d4d6ea5a9498874a57c450f7c20772641d15d", + "differs_from_bound": [ + "/selected_binding/assembly_sha256" + ], + "pinned_reuse_branch": "ACCEPT", + "suggested_binding": "REJECT: Ancestry recheck differs from bound #1042 binding" + }, + "kappa": { + "check_selected": "REJECT: Selected result binding differs", + "pinned_reuse_branch": "REJECT: Selected result binding differs", + "suggested_binding": "REJECT: Selected result binding differs" + } + }, + "end_to_end": { + "identity": { + "pinned_reuse_mode": "exit 0: PASS_COMPLETE_PR1094_COMPOSITION 0.001672660197076918", + "suggested_reuse_mode": "exit 0: PASS_COMPLETE_PR1094_COMPOSITION 0.001672660197076918" + }, + "timing": { + "pinned_reuse_mode": "exit 0: PASS_COMPLETE_PR1094_COMPOSITION 0.001672660197076918", + "suggested_reuse_mode": "exit 1: ValueError: Ancestry recheck differs from bound #1042 binding" + }, + "bit_result": { + "pinned_reuse_mode": "exit 0: PASS_COMPLETE_PR1094_COMPOSITION 0.001672660197076918", + "suggested_reuse_mode": "exit 1: ValueError: Ancestry recheck differs from bound #1042 binding" + }, + "bit_supplier": { + "pinned_reuse_mode": "exit 0: PASS_COMPLETE_PR1094_COMPOSITION 0.001672660197076918", + "suggested_reuse_mode": "exit 1: ValueError: Ancestry recheck differs from bound #1042 binding" + }, + "kappa": { + "pinned_reuse_mode": "exit 1: ValueError: Selected result binding differs", + "suggested_reuse_mode": "exit 1: ValueError: Selected result binding differs" + } + } +} diff --git a/research/frontier1094-ancestry-binding-seed69/README.md b/research/frontier1094-ancestry-binding-seed69/README.md new file mode 100644 index 0000000000..957acd3f97 --- /dev/null +++ b/research/frontier1094-ancestry-binding-seed69/README.md @@ -0,0 +1,214 @@ +# Ancestry binding of the selected #1094 reuse replay + +**Adversarial audit and supplemental certificate; no new kappa.** Seed 69 +(adversarial mathematical audit), card `supplier-boundary-audit`, refined scope +recorded in [TASK.json](TASK.json). Base `dadfea6e`. No selected record, pinned +verifier, review document or `upstream/` file is changed. + +## Finding + +The selected record's `reproduce` command is the cold `make frontier1094-verify`. +`scripts/verify_frontier1094.py` also has a reuse mode, `--baseline1042`. The +[batch1099 review](../../docs/research/community-batch1099-review.md) says its +local execution used that mode. Reuse mode checks the published #1042 receipt, +its stage logs and all 457 artifacts. It then runs these three statements: + +```python +ancestor = Path(receipt['baseline']).resolve() +check_selected(ancestor, ancestor/'ancestor') +require(sha(baseline/'BASELINE-BINDING.json') == receipt['baseline_binding_sha256'], 'Ancestor binding') +``` + +The return value of `check_selected` is discarded. `BASELINE-BINDING.json` is +compared only with the receipt's hash, and both come from the same #1042 +package. Nothing ties the rechecked PR799/PR741 ancestry to the binding that +#1042 recorded. Reuse mode therefore accepts any ancestry at the receipt's +machine-local path (`/private/tmp/batch952-baseline799`) that passes +`check_selected`, even when its binding differs from the bound one. + +`verify_frontier1042.py` writes that file as exactly +`json.dumps(check_selected(baseline, baseline/'ancestor'), indent=2)+'\n'`, so +the missing comparison is a direct one. The #890 and #942 reuse modes also +discard an initial pre-check, but they then bind their ancestry through their +`final_binding` comparisons +([complex-t21-owners/verify.py](../complex-t21-owners/verify.py), +[complex-t37-owners/final_binding.py](../complex-t37-owners/final_binding.py)). +Among the current `--baseline*` reuse modes, #1094's is the only one without +that binding. + +**Severity: low.** + +- **κ:** no κ changes. +- **Cold path:** the cold default rebuilds the ancestry and writes the binding + from that same directory, so it has no such gap. +- **Reuse inputs:** in reuse mode, the #1094 candidate stage consumes + `slots/local`, and the verifier's retained-bit-supplier check reads + `t16/ASSEMBLY.json`. Both come from the hashed #1042 artifacts, not the PR799 + ancestry. +- **Review wording:** the review's description, "rechecks the complete retained + bit/PR741/PR799 ancestry", is accurate about the check performed. The check + does not show that the rechecked ancestry is the one #1042 bound. + +## Certificate from committed evidence + +The verifier extracts two committed archives into the `check_selected` layout: + +- [integrated799-replay.tar.gz](../community-frontier799-audit/integrated799-replay.tar.gz) + (the PR799 replay); +- [composed-replay-evidence.tar.gz](../community-frontier741-audit/composed-replay-evidence.tar.gz) + (its PR741 ancestor). + +The unchanged `check_selected` returns a binding whose canonical serialization +has SHA256 `22575ff2…`. That is byte-identical to +[BASELINE-BINDING.json](../community-frontier1042-audit/BASELINE-BINDING.json). +The same hash appears in three places: + +- as `baseline_binding_sha256` in the #1042 receipt (`bf12c6ed…`); +- in the archived #1042 replay `selected-replay.tar.gz`; +- by chain from the #1094 receipt, which names that #1042 receipt in its + `baseline_receipt_sha256` field. + +So the ancestry binding behind the selected record can be reproduced from +in-repo evidence alone. It does not depend on what was present at the recorded +`/private/tmp` path during review. + +## Controls + +Each variant is a copy of the rebuilt ancestry. Where a variant changes PR741 or +bit evidence, `ANCESTRY.json` and the PR799 `RESULT.json` are rebound to the +ancestry check, as a consistent rerun would record them. + +| Variant | Mutation | `check_selected` | Binding field that differs | Pinned reuse mode | With suggested line | +| --- | --- | --- | --- | --- | --- | +| identity | none | PASS | none | PASS, κ = 0.001672660197076918 | PASS | +| timing | PR741 stage-one `seconds` +1, `STAGES.json` and receipt rehashed | PASS | `complex_receipt_sha256` | PASS | reject | +| bit_result | PR589 `RESULT9.json` `next_grid_point_rejected` replaced | PASS | `bit_result_sha256` | PASS | reject | +| bit_supplier | PR799 `global/ASSEMBLY.json` `bit_supplier` commit and blob zeroed | PASS | `assembly_sha256` | PASS | reject | +| kappa | PR799 `RESULT.json` κ raised by 10⁻¹⁸ | reject | none | reject | reject | + +What the variants show: + +- **timing** is benign. A genuine re-execution has different wall-clock times, + and reuse mode cannot tell which execution #1042 bound. +- **bit_supplier** is the semantically invalid fixture the card asks for. The + PR799 assembly names a nonexistent supplier commit and blob. `check_selected` + does not pin those provenance fields, and the assembly hash in its return + value is the value reuse mode discards. +- **kappa** shows that `check_selected` itself is not vacuous. + +Each row is evaluated at three layers: + +1. **`check_selected` directly**, on the variant ancestry. +2. **The three pinned statements.** They are parsed from the pinned Git blob of + `verify_frontier1094.py`, executed with the real `check_selected`, then + executed again with the second statement replaced by the suggested binding. +3. **The whole pinned `verify_frontier1094.py` reuse mode**, run in a scratch + copy of the required sources against the archived #1042 replay. Two stages + are stubbed: the historical-source stage, and the candidate stage, whose stub + copies the published #1094 `REPLAY.json`/`ASSEMBLY.json`. All #1042 receipt, + stage-source, log and artifact checks, and every later #1094 assertion, run + unchanged. Only the receipt's `baseline` field is redirected to each variant; + this models placing the variant at the recorded path. + +Outcomes are frozen in [EXPECTED.json](EXPECTED.json). + +## Suggested maintainer fix (not applied) + +```python +require(check_selected(ancestor, ancestor/'ancestor') == read(baseline/'BASELINE-BINDING.json'), + 'Ancestry recheck differs from bound #1042 binding') +``` + +In cold mode, `BASELINE-BINDING.json` is written from `check_selected` on the +same directory, so it still matches. A future receipt could also record +`ancestry_binding_sha256`. This package does not edit the pinned verifier, +because that would change the selected record's reproduction source. + +The package reads both audited verifiers from their pinned Git blobs whenever +the live files differ. Its result therefore remains checkable after such a fix. + +## Reproduce + +```sh +python3 scripts/research_package.py --package research/frontier1094-ancestry-binding-seed69 --check-only +python3.12 scripts/research_package.py --package research/frontier1094-ancestry-binding-seed69 +``` + +- Expected output: `PASS_FRONTIER1094_ANCESTRY_BINDING_AUDIT 22575ff2…`. +- Inputs: before importing any checker, `verify.py` requires every live input + declared in `SOURCES.json` to match its pin. `check_selected` also requires + all of `research/gauge44-frames-x` to equal that package's `MANIFEST.json`. + The manifest and the six files read directly are declared, and the manifest + stands in for the rest of the directory. +- Run time and environment: about 3 seconds, standard library only, with + assertions required. All scratch files go in temporary directories outside + the checkout. +- Tested on Python 3.12.15 and 3.14.8 (macOS). + +## Scope and remaining obligations + +This package is not: + +- a cold replay of #1042 or #1094 (the cold path was not rerun here); +- authentication of the archived logs' execution; +- a proof of the multiplication theorem. + +It shows that the bound ancestry binding is reproducible from committed +evidence, and that the reuse path does not itself enforce that binding. +Inherited assumptions remain conditional: all-size/compiler, +common-label/mutable-source, whole-call hosting, precision/tape, analytic, and +bit H1–H5. + +## Open next questions + +The structured entries are in [TASK.json](TASK.json). + +1. **Should PR799's bit-supplier provenance fields be bound to their cited + source?** + - *The question:* should `check_selected` (or `verify_frontier799_bindings`) + bind the PR799 assembly's `bit_supplier` commit, blob and path to the cited + PR589 source? + - *Why it matters:* the zeroed fixture above passes, because only a + downstream hash differs. + - *First step:* in a separate checker, require + `git rev-parse :` to equal `git_blob_sha1`. At the PR589 + head `commit`, the same blob sits at the pre-rename path + `research/e8-bit-p111/tune/EXPECTED.json`, so a check against `commit` + must handle the rename. + - *Blocker:* those scripts are pinned selected supplements, so changing them + needs a maintainer rehash cycle. +2. **Should receipts record a portable ancestry identity instead of a + machine-local path?** + - *The question:* receipts could record archive and binding hashes rather + than only a `baseline` path under `/private/tmp`. + - *Why it matters:* the receipt records a path but no content identity, so + reviewers have no portable record of which ancestry was rechecked. + - *First step:* add `ancestry_binding_sha256` in the next selected-record + integration, and derive the reuse ancestor from committed archives as this + package does. + - *Blocker:* the receipt schema of the selected record is frozen. + +## Credit + +Prepared by Sagar Thakrar with substantial Anthropic Claude assistance. That +assistance included a five-explorer sweep with impact, rigor and novelty judges, +and separate code and impact skeptics who tried to refute the finding. + +Predecessor and maintainer credit: + +- Douglas Colkitt: the #1042/#1094 composition verifiers, archived replays, + binding receipts and batch1099 review. +- Rohan Arun's #1094 and Jeremy Kothe's #1042 constructions, with Hao Yan's T16 + controller. +- nightangelflowerwin-ops (#865): `check_selected` and the versioned PR741 + coverage contract it enforces. +- Lucas Steinmetz (@ljste, #838): the PR741 receipt-coverage finding that the + contract addresses + ([frontier741-receipt-coverage-audit](../frontier741-receipt-coverage-audit/README.md)). +- Adem Vessell (@AdemVessell, #851): the bridge-identity check used to rebind + the variant ancestries. +- Chafik Boukhalfa / chafreaky (#890) and Jonathan Capalbo / jon314159 (#942): + the replays whose ancestry-binding pattern this note compares against. +- The bit and complex supplier lineage credited in the selected review. + +New work is Apache-2.0. diff --git a/research/frontier1094-ancestry-binding-seed69/SOURCES.json b/research/frontier1094-ancestry-binding-seed69/SOURCES.json new file mode 100644 index 0000000000..0f257eede0 --- /dev/null +++ b/research/frontier1094-ancestry-binding-seed69/SOURCES.json @@ -0,0 +1,246 @@ +{ + "schema_version": 1, + "base_commit": "dadfea6e8a78ff6ba901705f87532a71c6f5bbb8", + "files": [ + { + "path": "certificates/replay-coverage/pr741-sw4-v1.json", + "usage": "input", + "git_blob": "1acec5f34c21155ab9fee9ceef9ff72b0018252d", + "sha256": "7acd5033bc78e3f473718269edaa267c2785d84fbe95ccf6815a33dcf58c2756" + }, + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11", + "sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "c05fafaa25ba95b2d5af86b1800427198e3d20eb", + "sha256": "89b5928bc92c81e2647b6d702a7ad85a6795b8f44e2eb267b2ff3145d8f2b2ce" + }, + { + "path": "research/community-frontier1042-audit/BASELINE-BINDING.json", + "usage": "input", + "git_blob": "2fd4c8de62a596cf479f031b65a65c2522936e1f", + "sha256": "22575ff21833fdfcfc7d67d7d9b3b433cf13a3165628ebcb9aaae239b8145472" + }, + { + "path": "research/community-frontier1042-audit/RESULT.json", + "usage": "input", + "git_blob": "8182d0818c0cbda7e52c10120f15b2c3a2c8f933", + "sha256": "bf12c6ed3b412539638b76addb40591a631609b2ab9e5ee0db1f6bbe067d0ec0" + }, + { + "path": "research/community-frontier1042-audit/selected-replay.tar.gz", + "usage": "input", + "git_blob": "6f4dc6fe7631d8aacf8081fcaecf32197181685b", + "sha256": "22c3f4dce4b897a1d423d1388801933e288b6a6b1906cb15e1b16a5eb68db754" + }, + { + "path": "research/community-frontier1094-audit/ASSEMBLY.json", + "usage": "input", + "git_blob": "5fd676df060f3b450782fdf5ff5f6beb63a5eeb0", + "sha256": "1122cb3a575f8c788345fc1bf4c108ac7c3250fb81a5988671f5eb04b3ab3045" + }, + { + "path": "research/community-frontier1094-audit/REPLAY.json", + "usage": "input", + "git_blob": "2cfb7fffa7cd78f418be16c13224c3206b6d0183", + "sha256": "ce0678fa7abaab221de74baeace0c6696d5ea23a36719a58cff230215a06aae7" + }, + { + "path": "research/community-frontier1094-audit/RESULT.json", + "usage": "input", + "git_blob": "131d9c96a54632ae385ced4138fd7f30ad448a3e", + "sha256": "1e3e47e9ec24bcb6fb5f703b7fce0aab658d84ff72bfae5da3ae429d17b6e752" + }, + { + "path": "research/community-frontier741-audit/composed-replay-evidence.tar.gz", + "usage": "input", + "git_blob": "687b1bb827ac939c3feb1d538c4fd2684b0debed", + "sha256": "27516447e242c264030ba427dabc5e616f9a4aacbff9e0623db4d00c058e1a7b" + }, + { + "path": "research/community-frontier799-audit/integrated799-replay.tar.gz", + "usage": "input", + "git_blob": "c80685bdf48cea26561b25900ce0416ba2cf709f", + "sha256": "70dfdfcf2ff95352c6020ee9dfca6dca9032b33c10daed3f3dc574c014f4e2cb" + }, + { + "path": "research/complex-sw4-frame8/MANIFEST.json", + "usage": "input", + "git_blob": "fddcb8d952df2c220ad8834f1eab63ef7373aef6", + "sha256": "b9b39c206fcd2613382b0dcbda23a371e8781d1bedaf8e2f8e7df1e79dc1fa89" + }, + { + "path": "research/complex-sw4-frame8/data/SPEC.json", + "usage": "input", + "git_blob": "c54052846b3d52a412b6901f9feb2a2d43dfbb2e", + "sha256": "7fc2bd2e3c0ac13729c1fa1f0f327a4eb7c72373ba58e5ed3954b30e23c803be" + }, + { + "path": "research/complex-sw4-frame8/inputs/PR589-EXPECTED.json", + "usage": "input", + "git_blob": "e293ddc557742637f9f679f083a1a282d87b1b13", + "sha256": "b9f0e5ca038abe837b0007c8fe006f366a6f02009244ac57705a8a200e2301f4" + }, + { + "path": "research/complex-sw4-frame8/verify.py", + "usage": "input", + "git_blob": "97d3dc5de5f70706117664535bf35a9a825b636d", + "sha256": "7706065e3d2934ea493910638b40e6285348d337507e0fb695d8d1e536926637" + }, + { + "path": "research/e8-bit-p111-tuned/tune/EXPECTED.json", + "usage": "input", + "git_blob": "e293ddc557742637f9f679f083a1a282d87b1b13", + "sha256": "b9f0e5ca038abe837b0007c8fe006f366a6f02009244ac57705a8a200e2301f4" + }, + { + "path": "research/gauge44-frames-x/MANIFEST.json", + "usage": "input", + "git_blob": "139ce7bb6fb929d23c11ce2072ee7c226adea7b8", + "sha256": "e1b7998c8f7cb24f8674d250d0510f2b5b351b2ed0b35f17a17e6bacf3d9824b" + }, + { + "path": "research/gauge44-frames-x/construction/jx/LOCAL-PINS-jx-X4.json", + "usage": "input", + "git_blob": "417e4ba7a1d731f56b24ae68563a963703e33a0b", + "sha256": "95c5114c8e937c2737a1b9f9da97303f2e5e129d39e6dfcc4010e99bfdb9c974" + }, + { + "path": "research/gauge44-frames-x/construction/jx/RECIPE-X4.json", + "usage": "input", + "git_blob": "30f7fa5948539b888969935b03e848cc1f3289c0", + "sha256": "9d42c6b38e8124f5ffe15da56c260a7fba7260626bf3c5f8cbd93aa4a71ceadd" + }, + { + "path": "research/gauge44-frames-x/construction/jx/reproduce_jx.py", + "usage": "input", + "git_blob": "6829a1b25d4ff473dfd1ea315cf6e363aecfd139", + "sha256": "5c7afebb4eb7fcdeb7e971cfbc457cf071850e2da21c3c71295efdd453c2399c" + }, + { + "path": "research/gauge44-frames-x/data/SPEC.json", + "usage": "input", + "git_blob": "65d1048b0356ce508fbd8f2607eae7689d598d9f", + "sha256": "64817c60a4a2c1839bf12239cb1b7515a40bf8988229d81d4c9faa17b488c7d5" + }, + { + "path": "research/gauge44-frames-x/inputs/PR589-EXPECTED.json", + "usage": "input", + "git_blob": "e293ddc557742637f9f679f083a1a282d87b1b13", + "sha256": "b9f0e5ca038abe837b0007c8fe006f366a6f02009244ac57705a8a200e2301f4" + }, + { + "path": "research/gauge44-frames-x/verify_global.py", + "usage": "input", + "git_blob": "7ab79e3062e23e3ebfadecddb7851c65799f2f9a", + "sha256": "16bd5e54598592e92e210f99065348c5df261b8350fdc688072ce053d15b088a" + }, + { + "path": "research/gauge44-leaver8/construction/leaver/reproduce_leaver.py", + "usage": "input", + "git_blob": "bc4360ef93ceea8fe2da33afbbaa100feaf0731a", + "sha256": "831bfdf2247b5d864b74c3b2b6a475718053d48570851d48bd1c5471d410ee30" + }, + { + "path": "research/gauge44-leaver8/construction/leaver/reproduce_leaver_chain.py", + "usage": "input", + "git_blob": "19fcd28f4d41db8590ae71f6b98dd7c0655bce32", + "sha256": "2bc3fc3f32e0f957a0731b79254c553ca48fc6d4d47c4f99d6cd31e1901d85b5" + }, + { + "path": "research/gauge44-leaver8/construction/reproduce.py", + "usage": "input", + "git_blob": "8b51efa64638c849ad329757b807ef1f68a6cb8c", + "sha256": "047bb9b3536b0b16bb08a21cd9fd80404ca9d022345f1aeab34b21dffc281c92" + }, + { + "path": "research/gauge44-leaver8/independent/audit_local.py", + "usage": "input", + "git_blob": "4744d8783c25bf7bf5076886169077ca3808309a", + "sha256": "03afcfc9da428b3f6edac81c1fee7f277ab81b64998efae78380b63498dec6cd" + }, + { + "path": "research/gauge44-leaver8/verify_global.py", + "usage": "input", + "git_blob": "7ab79e3062e23e3ebfadecddb7851c65799f2f9a", + "sha256": "16bd5e54598592e92e210f99065348c5df261b8350fdc688072ce053d15b088a" + }, + { + "path": "research/gauge44-leaver8/verify_manifest.py", + "usage": "input", + "git_blob": "8c2441d39202409ffe1c2cb42f197946f7bfa7c0", + "sha256": "723d726dbbe5b65a49caecae0f1aab664a1413fb639abfd3e826a5a538e14e5b" + }, + { + "path": "research/gauge44-slots-t16/verify_manifest.py", + "usage": "input", + "git_blob": "8c2441d39202409ffe1c2cb42f197946f7bfa7c0", + "sha256": "723d726dbbe5b65a49caecae0f1aab664a1413fb639abfd3e826a5a538e14e5b" + }, + { + "path": "research/gauge44-slots-t16/verify_t16.py", + "usage": "input", + "git_blob": "4794150c4cf96cf1c445e2650800e636809fa06c", + "sha256": "050e2dfba59911b8f29fd94422833d421367a0ad01c5e4ae916a75a235ee5e46" + }, + { + "path": "research/gauge44-slots/construction/slots/verify_slots.py", + "usage": "input", + "git_blob": "fd06b654afb1f3a98b28d5cbac50f3ba4a967883", + "sha256": "bc1c0e3e3d7c81dc1649f5be82cdd2399e543d46c24879cb975877bf9b7957be" + }, + { + "path": "research/gauge44-slots/verify_manifest.py", + "usage": "input", + "git_blob": "8c2441d39202409ffe1c2cb42f197946f7bfa7c0", + "sha256": "723d726dbbe5b65a49caecae0f1aab664a1413fb639abfd3e826a5a538e14e5b" + }, + { + "path": "scripts/verify_frontier1042.py", + "usage": "provenance", + "git_blob": "e4f129b0570865330e39ae11eafafe7167f7e374", + "sha256": "700fdcaeb6e8f57f6e63c71c2dd1652fc5b183e8d706cd092779bdc0d271e854" + }, + { + "path": "scripts/verify_frontier1094.py", + "usage": "provenance", + "git_blob": "96e6c1386bd052b9bcaf136d934406f3f0c3f777", + "sha256": "c7e20f59968ed5736fb859735de4de207de3418083e37012310ebcded946b949" + }, + { + "path": "scripts/verify_frontier741_bindings.py", + "usage": "input", + "git_blob": "dcb4029aeaafe60f4d852a1975b01e02438595fc", + "sha256": "eff455167e2fd0bc9a67d35241d0e69d8edc58f3a23e776dcfe8f500ca8e8d67" + }, + { + "path": "scripts/verify_frontier741_bridge_coverage.py", + "usage": "input", + "git_blob": "4d680ce8b5de16e6f3deb61a914cc9ca477e9e6d", + "sha256": "9a14f26762b6126eb54ed43db90371773374fe98733ada80ee871a74afa3b836" + }, + { + "path": "scripts/verify_frontier799.py", + "usage": "input", + "git_blob": "c0d8b0d0c9c52ed17ad37cbf7dc88838daea203a", + "sha256": "19fe1b32079095160dc00fe2f7df75e0fcbc82cff37f7159b755c8a63bd5ce99" + }, + { + "path": "scripts/verify_frontier799_bindings.py", + "usage": "input", + "git_blob": "ff902406c7acc760cb3ab5c9cf732768bdde1620", + "sha256": "43897b3c99212d6134870898a1840f32898aa1b3679b299e654901568ad7e19b" + }, + { + "path": "scripts/verify_replay_coverage.py", + "usage": "input", + "git_blob": "66c9a4e98d5fbfc82a9f2dfe6117c5af0215a5b3", + "sha256": "babe5941d7e6dac4248613ef01f950ee7bb6199e7355021aea4cf854fd1b91c5" + } + ] +} diff --git a/research/frontier1094-ancestry-binding-seed69/TASK.json b/research/frontier1094-ancestry-binding-seed69/TASK.json new file mode 100644 index 0000000000..946578de20 --- /dev/null +++ b/research/frontier1094-ancestry-binding-seed69/TASK.json @@ -0,0 +1,66 @@ +{ + "schema_version": 1, + "task_id": "supplier-boundary-audit", + "priority_revision": 2, + "base_commit": "dadfea6e8a78ff6ba901705f87532a71c6f5bbb8", + "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 selected #1094 reuse replay (verify_frontier1094.py --baseline1042) bind its rechecked PR799/PR741 ancestry to the BASELINE-BINDING.json recorded by #1042, and is that bound binding reproducible from committed archives?", + "scope_change_reason": "The card asks about one supplier obligation. The traced obligation is the ancestry binding of the selected record's documented reuse path rather than a supplier inequality, because a five-explorer sweep with impact/rigor/novelty judges and separate code and impact skeptics left it as the strongest confirmed current acceptance gap. The bit-supplier provenance fixture is the semantically invalid fixture the card asks for.", + "bottleneck_link": "Side result for reliability: it changes no kappa. It certifies, from in-repo evidence only, the ancestry binding that the selected record's review relied on through a machine-local reuse path, and identifies a one-line check that would make that reuse path binding.", + "budget_minutes": 90, + "stop_rule": "Stop once the bound binding is reproduced byte-for-byte from committed archives and every variant has a frozen outcome under check_selected, the pinned reuse statements, and the whole pinned reuse mode with and without the suggested line; do not edit pinned verifiers.", + "outcome": "completed", + "evidence": "verify.py prints PASS_FRONTIER1094_ANCESTRY_BINDING_AUDIT 22575ff2... on Python 3.12.15 and 3.14.8 in about 3 s: the committed PR799 and PR741 archives rebuild the exact BASELINE-BINDING.json bytes bound by the #1042 receipt (bf12c6ed...) that #1094 names; timing, bit_result and bit_supplier variants pass check_selected and the unchanged reuse mode at the selected kappa but are rejected by the suggested binding; a kappa variant is rejected by all. Outcomes are frozen in EXPECTED.json.", + "author": "Sagar Thakrar", + "ai_assistance": "Substantial Anthropic Claude (Claude Code, Opus) assistance, including parallel explorer and skeptic subagents that proposed and tried to refute candidate findings; the author reviewed, ran and is responsible for the result.", + "open_questions": [ + { + "question": "Should check_selected (or verify_frontier799_bindings) bind the PR799 global ASSEMBLY bit_supplier provenance fields (commit, merged_as, git_blob_sha1, path) to the cited PR589 source rather than relying only on a downstream assembly hash?", + "why_it_matters": "The bit_supplier fixture with zeroed commit and blob passes check_selected; only the assembly_sha256 in its return value differs, and that value is what the #1094 reuse branch discards.", + "first_step": "In a separate scoped checker, require git rev-parse : == git_blob_sha1 (at the PR589 head commit the same blob sits at the pre-rename path research/e8-bit-p111/tune/EXPECTED.json, so a check against commit must handle the rename), and test the zeroed fixture.", + "blocked_by": "verify_frontier799_bindings.py and verify_replay_coverage.py are pinned selected supplements, so a change needs a maintainer rehash cycle." + }, + { + "question": "Should replay receipts record a portable ancestry identity (archive SHA256 plus binding SHA256) instead of only a machine-local baseline path such as /private/tmp/batch952-baseline799?", + "why_it_matters": "The receipt records only a machine-local path, not a content identity, so a reviewer cannot tell which ancestry was rechecked there; reuse mode can only be exercised by placing evidence at that path.", + "first_step": "Add an ancestry_binding_sha256 field to a future PR1094-style receipt and derive the reuse ancestor from committed archives, as this package does.", + "blocked_by": "Receipt schemas of selected records are frozen; this belongs in the next selected-record integration." + } + ] +} diff --git a/research/frontier1094-ancestry-binding-seed69/VERIFY.json b/research/frontier1094-ancestry-binding-seed69/VERIFY.json new file mode 100644 index 0000000000..3af8a22c73 --- /dev/null +++ b/research/frontier1094-ancestry-binding-seed69/VERIFY.json @@ -0,0 +1,55 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "certificates/replay-coverage/pr741-sw4-v1.json", + "research/community-frontier1042-audit/BASELINE-BINDING.json", + "research/community-frontier1042-audit/RESULT.json", + "research/community-frontier1042-audit/selected-replay.tar.gz", + "research/community-frontier1094-audit/ASSEMBLY.json", + "research/community-frontier1094-audit/REPLAY.json", + "research/community-frontier1094-audit/RESULT.json", + "research/community-frontier741-audit/composed-replay-evidence.tar.gz", + "research/community-frontier799-audit/integrated799-replay.tar.gz", + "research/complex-sw4-frame8/MANIFEST.json", + "research/complex-sw4-frame8/data/SPEC.json", + "research/complex-sw4-frame8/inputs/PR589-EXPECTED.json", + "research/complex-sw4-frame8/verify.py", + "research/e8-bit-p111-tuned/tune/EXPECTED.json", + "research/gauge44-frames-x/MANIFEST.json", + "research/gauge44-frames-x/construction/jx/LOCAL-PINS-jx-X4.json", + "research/gauge44-frames-x/construction/jx/RECIPE-X4.json", + "research/gauge44-frames-x/construction/jx/reproduce_jx.py", + "research/gauge44-frames-x/data/SPEC.json", + "research/gauge44-frames-x/inputs/PR589-EXPECTED.json", + "research/gauge44-frames-x/verify_global.py", + "research/gauge44-leaver8/construction/leaver/reproduce_leaver.py", + "research/gauge44-leaver8/construction/leaver/reproduce_leaver_chain.py", + "research/gauge44-leaver8/construction/reproduce.py", + "research/gauge44-leaver8/independent/audit_local.py", + "research/gauge44-leaver8/verify_global.py", + "research/gauge44-leaver8/verify_manifest.py", + "research/gauge44-slots-t16/verify_manifest.py", + "research/gauge44-slots-t16/verify_t16.py", + "research/gauge44-slots/construction/slots/verify_slots.py", + "research/gauge44-slots/verify_manifest.py", + "scripts/verify_frontier741_bindings.py", + "scripts/verify_frontier741_bridge_coverage.py", + "scripts/verify_frontier799.py", + "scripts/verify_frontier799_bindings.py", + "scripts/verify_replay_coverage.py" + ], + "commands": [ + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 300, + "checks": "Pins the PR1094/PR1042 receipts, binding and archives; rebuilds the PR799/PR741 ancestry from committed archives and requires check_selected to return the exact bound BASELINE-BINDING.json bytes; then runs four variant ancestries plus identity through check_selected, the three pinned reuse-branch statements, and the whole pinned verify_frontier1094.py reuse mode (two stubbed stages), with and without the suggested one-line binding, against EXPECTED.json." + } + ] +} diff --git a/research/frontier1094-ancestry-binding-seed69/verify.py b/research/frontier1094-ancestry-binding-seed69/verify.py new file mode 100644 index 0000000000..8ab46ea981 --- /dev/null +++ b/research/frontier1094-ancestry-binding-seed69/verify.py @@ -0,0 +1,301 @@ +#!/usr/bin/env python3 +"""Certify the PR799/PR741 ancestry binding behind the selected #1094 reuse replay. + +The committed PR799 and PR741 replay archives are rebuilt into the +check_selected layout. The unchanged check must return the exact bytes bound by +the published #1042 receipt and its archived replay. The pinned reuse-branch +statements of verify_frontier1094.py, and the whole pinned verifier in a scratch +root, then run on variant ancestors. The timing, bit_result and bit_supplier +variants pass check_selected but differ from the bound binding; the pinned code +accepts them and the one-line comparison suggested in README.md rejects them. +Identity is accepted by both, and a kappa control is rejected by check_selected. + +Seed-69 adversarial audit. Sagar Thakrar with substantial Anthropic Claude +assistance. Apache-2.0. +""" +import ast +import hashlib +import json +import os +from pathlib import Path +import shutil +import subprocess +import sys +import tarfile +import tempfile + +PACKAGE = Path(__file__).resolve().parent +ROOT = PACKAGE.parents[1] + +A1094 = ROOT/'research/community-frontier1094-audit' +A1042 = ROOT/'research/community-frontier1042-audit' +ARCHIVE799 = ROOT/'research/community-frontier799-audit/integrated799-replay.tar.gz' +ARCHIVE741 = ROOT/'research/community-frontier741-audit/composed-replay-evidence.tar.gz' +# Audited verifier bytes: (path, Git blob, SHA256). Read from Git if the live file changes. +VERIFIER1094 = ('scripts/verify_frontier1094.py', '96e6c1386bd052b9bcaf136d934406f3f0c3f777', + 'c7e20f59968ed5736fb859735de4de207de3418083e37012310ebcded946b949') +VERIFIER1042 = ('scripts/verify_frontier1042.py', 'e4f129b0570865330e39ae11eafafe7167f7e374', + '700fdcaeb6e8f57f6e63c71c2dd1652fc5b183e8d706cd092779bdc0d271e854') +RECEIPT1042_SHA256 = 'bf12c6ed3b412539638b76addb40591a631609b2ab9e5ee0db1f6bbe067d0ec0' +BINDING_SHA256 = '22575ff21833fdfcfc7d67d7d9b3b433cf13a3165628ebcb9aaae239b8145472' +EXPECTED = json.loads((PACKAGE/'EXPECTED.json').read_bytes()) + + +def require(condition, message): + if not condition: + raise SystemExit('FAIL: ' + message) + + +def sha(data): + return hashlib.sha256(data).hexdigest() + + +def read(path): + return json.loads(Path(path).read_bytes()) + + +def write(path, value): + Path(path).write_text(json.dumps(value, indent=2)+'\n') + + +def canonical(binding): + """The serialization verify_frontier1042.py writes to BASELINE-BINDING.json.""" + return (json.dumps(binding, indent=2)+'\n').encode() + + +def differing(a, b, path=''): + if isinstance(a, dict) and isinstance(b, dict): + return [p for k in sorted(set(a) | set(b)) for p in differing(a.get(k), b.get(k), path+'/'+k)] + return [] if a == b else [path] + + +def pinned_source(entry): + name, blob, digest = entry + data = (ROOT/name).read_bytes() if (ROOT/name).is_file() else b'' + if sha(data) != digest: + data = subprocess.run(['git', 'cat-file', 'blob', blob], cwd=ROOT, + capture_output=True, check=True).stdout + require(sha(data) == digest, 'Pinned audited source: ' + name) + return data + + +def extract(archive, target): + with tarfile.open(archive) as tf: + members = tf.getmembers() + require(all(m.isfile() or m.isdir() for m in members), 'Archive contains links or devices') + tf.extractall(target, filter='data') + + +def reuse_branch(): + """Return the three pinned reuse-branch statements and the suggested binding.""" + tree = ast.parse(pinned_source(VERIFIER1094)) + main = [n for n in tree.body if isinstance(n, ast.FunctionDef) and n.name == 'main'] + require(len(main) == 1, 'One main function') + body = main[0].body + calls = [n for n in ast.walk(main[0]) if isinstance(n, ast.Call) and + isinstance(n.func, ast.Name) and n.func.id == 'check_selected'] + require(len(calls) == 1, 'One check_selected call in verify_frontier1094.py') + index = [i for i, n in enumerate(body) if isinstance(n, ast.Expr) and n.value is calls[0]] + require(len(index) == 1, 'The check_selected call is a bare expression statement') + i = index[0] + statements = body[i-1:i+2] + text = [ast.unparse(n) for n in statements] + require(text == EXPECTED['pinned_reuse_branch'], 'Pinned reuse-branch statements') + require(sum(isinstance(n, ast.Constant) and n.value == 'BASELINE-BINDING.json' + for n in ast.walk(tree)) == 1, 'BASELINE-BINDING.json is read once, by hash only') + fixed = ast.parse(EXPECTED['suggested_binding']).body + pinned = ast.Module(body=statements, type_ignores=[]) + patched = ast.Module(body=[statements[0], *fixed, statements[2]], type_ignores=[]) + return (compile(ast.fix_missing_locations(pinned), VERIFIER1094[0], 'exec'), + compile(ast.fix_missing_locations(patched), 'suggested-binding', 'exec')) + + +def writer_pattern(): + """verify_frontier1042.py records exactly check_selected's return value.""" + tree = ast.parse(pinned_source(VERIFIER1042)) + text = [ast.unparse(n) for n in ast.walk(tree) if isinstance(n, (ast.Assign, ast.Expr))] + require(EXPECTED['writer_statements'][0] in text and EXPECTED['writer_statements'][1] in text, + 'PR1042 writer serializes the check_selected return value') + + +def run_branch(code, ancestor, receipt): + """Execute pinned or suggested statements as the reuse branch would.""" + scope = dict(Path=Path, check_selected=check_selected, read=read, + require=source_require, + sha=lambda p: sha(Path(p).read_bytes()), baseline=A1042, + receipt=dict(receipt, baseline=str(ancestor))) + try: + exec(code, scope) + except (ValueError, KeyError, FileNotFoundError) as error: + return 'REJECT: ' + str(error) + return 'ACCEPT' + + +COPIED = ['scripts/verify_replay_coverage.py', 'scripts/verify_frontier741_bridge_coverage.py', + 'scripts/verify_frontier741_bindings.py', 'scripts/verify_frontier799_bindings.py', + 'scripts/verify_frontier799.py', 'certificates/replay-coverage/pr741-sw4-v1.json', + 'research/complex-sw4-frame8/verify.py', 'research/complex-sw4-frame8/MANIFEST.json', + 'research/complex-sw4-frame8/data/SPEC.json', 'research/complex-sw4-frame8/inputs/PR589-EXPECTED.json', + 'research/e8-bit-p111-tuned/tune/EXPECTED.json', 'research/gauge44-frames-x'] +STUB_CANDIDATE = '''import shutil, sys +from pathlib import Path +strict = Path(sys.argv[sys.argv.index('--work')+1])/'strict' +strict.mkdir(parents=True) +for name in ('REPLAY.json', 'ASSEMBLY.json'): + shutil.copyfile(Path(%r)/name, strict/name) +''' + + +def end_to_end(tmp, variants, r1042): + """Run the whole pinned PR1094 reuse mode in a scratch root, stubbing two stages. + + Stubbed: the historical-source stage and the rare-pattern candidate stage, + which copies the published PR1094 REPLAY/ASSEMBLY. The receipt's baseline + path is redirected to each variant, as if it were placed at the recorded path. + """ + source = pinned_source(VERIFIER1094).decode() + old = " check_selected(ancestor, ancestor/'ancestor')\n" + require(source.count(old) == 1, 'One bare reuse recheck line') + fixed = source.replace(old, ' ' + EXPECTED['suggested_binding'].replace(' / ', '/') + '\n') + archive = tmp/'b1042' + extract(A1042/'selected-replay.tar.gz', archive) + require((archive/'RESULT.json').read_bytes() == (A1042/'RESULT.json').read_bytes(), 'Archived PR1042 receipt') + dropped = ('PYTHONOPTIMIZE', 'PYTHONPATH', 'PYTHONSAFEPATH', 'FORCE_COLOR', 'PYTHON_COLORS') + env = {k: v for k, v in os.environ.items() if k not in dropped} | {'NO_COLOR': '1', 'PYTHON_COLORS': '0'} + rows = {} + for label, text in [('pinned_reuse_mode', source), ('suggested_reuse_mode', fixed)]: + root = tmp/('root-' + label) + for name in COPIED + [s['script'] for s in r1042['stages']]: + target = root/name + target.parent.mkdir(parents=True, exist_ok=True) + if (ROOT/name).is_dir(): + shutil.copytree(ROOT/name, target, ignore=shutil.ignore_patterns('__pycache__')) + else: + shutil.copyfile(ROOT/name, target) + (root/'scripts/verify_frontier1094.py').write_text(text) + (root/'scripts/verify_selected_result.py').write_text("print('stubbed historical-source stage')\n") + stub = root/'research/complex-t16-rare-pattern-exchanges/verify.py' + stub.parent.mkdir(parents=True) + stub.write_text(STUB_CANDIDATE % str(A1094)) + (root/'research/community-frontier1042-audit').mkdir(parents=True) + for name, work in variants: + receipt = dict(r1042, baseline=str(work)) + for path in (archive/'RESULT.json', root/'research/community-frontier1042-audit/RESULT.json'): + write(path, receipt) + p = subprocess.run([sys.executable, '-B', str(root/'scripts/verify_frontier1094.py'), + '--work', str(tmp/('run-' + label + '-' + name)), '--baseline1042', str(archive)], + capture_output=True, text=True, env=env, timeout=300) + last = (p.stdout if p.returncode == 0 else p.stderr).strip().splitlines() + rows.setdefault(name, {})[label] = 'exit %d: %s' % (p.returncode, last[-1] if last else '') + return rows + + +def rebind(work): + """A consistent rerun records the ancestry check in ANCESTRY.json and RESULT.json.""" + binding = check_ancestry(work/'ancestor/bit', work/'ancestor/complex') + for name, field in [('ANCESTRY.json', 'binding'), ('RESULT.json', 'ancestry')]: + value = read(work/name) + value[field] = binding + write(work/name, value) + + +def timing(work): + receipt = read(work/'ancestor/complex/RECEIPT.json') + receipt['stages'][0]['seconds'] += 1.0 + write(work/'ancestor/complex/STAGES.json', receipt['stages']) + require('STAGES.json' in receipt['artifacts'], 'Stage record is an inventoried artifact') + receipt['artifacts']['STAGES.json'] = sha((work/'ancestor/complex/STAGES.json').read_bytes()) + write(work/'ancestor/complex/RECEIPT.json', receipt) + rebind(work) + + +def bit_result(work): + value = read(work/'ancestor/bit/RESULT9.json') + value['next_grid_point_rejected'] = 'not-recorded' + write(work/'ancestor/bit/RESULT9.json', value) + rebind(work) + + +def bit_supplier(work): + value = read(work/'global/ASSEMBLY.json') + value['bit_supplier']['commit'] = '0'*40 + value['bit_supplier']['git_blob_sha1'] = '0'*40 + write(work/'global/ASSEMBLY.json', value) + + +def kappa(work): + value = read(work/'RESULT.json') + value['kappa'] = '1661634653669568/1000000000000000000' + write(work/'RESULT.json', value) + + +VARIANTS = [('identity', None), ('timing', timing), ('bit_result', bit_result), + ('bit_supplier', bit_supplier), ('kappa', kappa)] + + +def load_checkers(): + """Require every declared live input at its pin before importing the checkers.""" + rows = [r for r in read(PACKAGE/'SOURCES.json')['files'] if r['usage'] == 'input'] + for row in rows: + require(sha((ROOT/row['path']).read_bytes()) == row['sha256'], 'Pinned input: ' + row['path']) + pinned = {r['path']: r['sha256'] for r in rows} + require(pinned['research/community-frontier1042-audit/RESULT.json'] == RECEIPT1042_SHA256 and + pinned['research/community-frontier1042-audit/BASELINE-BINDING.json'] == BINDING_SHA256, + 'Receipt and binding pins') + global check_selected, check_ancestry, source_require + sys.path.insert(0, str(ROOT/'scripts')) + from verify_replay_coverage import check_selected, require as source_require + from verify_frontier741_bridge_coverage import check as check_ancestry + + +def main(): + require(sys.version_info >= (3, 12), 'Python 3.12 or later') + require(not sys.flags.optimize, 'Inherited checks require assertions') + load_checkers() + r1094, r1042 = read(A1094/'RESULT.json'), read(A1042/'RESULT.json') + bound = (A1042/'BASELINE-BINDING.json').read_bytes() + require(r1094['status'] == 'PASS_COMPLETE_PR1094_COMPOSITION' and r1094['reused_completed_baseline'] is True and + r1094['baseline_receipt_sha256'] == RECEIPT1042_SHA256, 'PR1094 receipt names the PR1042 receipt') + require(r1042['status'] == 'PASS_COMPLETE_PR1042_COMPOSITION' and r1042['reused_completed_baseline'] is True and + r1042['baseline_binding_sha256'] == sha(bound) == BINDING_SHA256, 'PR1042 receipt names the binding') + with tarfile.open(A1042/'selected-replay.tar.gz') as tf: + for name in ('RESULT.json', 'BASELINE-BINDING.json'): + require(tf.extractfile(name).read() == (A1042/name).read_bytes(), 'Archived PR1042 replay: ' + name) + baselines = dict(pr1094=r1094['baseline'], pr1042=r1042['baseline']) + require(baselines == EXPECTED['recorded_baselines'], 'Recorded machine-local baselines') + writer_pattern() + pinned, patched = reuse_branch() + with tempfile.TemporaryDirectory(prefix='ancestry1094-') as tmp: + base = Path(tmp)/'base' + require(not base.resolve().is_relative_to(ROOT), 'Use external scratch space') + extract(ARCHIVE799, base) + extract(ARCHIVE741, base/'ancestor') + rows = {} + for name, mutate in VARIANTS: + work = Path(tmp)/name + shutil.copytree(base, work) + if mutate: + mutate(work) + try: + binding = check_selected(work, work/'ancestor') + row = dict(check_selected='PASS', binding_sha256=sha(canonical(binding)), + differs_from_bound=differing(binding, json.loads(bound))) + except (ValueError, KeyError, AssertionError) as error: + row = dict(check_selected='REJECT: ' + str(error)) + row['pinned_reuse_branch'] = run_branch(pinned, work, r1042) + row['suggested_binding'] = run_branch(patched, work, r1042) + rows[name] = row + print(name, json.dumps(row, sort_keys=True), flush=True) + identity = rows['identity'] + require(identity['check_selected'] == 'PASS' and identity['binding_sha256'] == sha(bound) and + identity['differs_from_bound'] == [], 'Committed archives rebuild the exact bound binding') + require(rows == EXPECTED['variants'], 'Variant outcomes') + full = end_to_end(Path(tmp), [(name, Path(tmp)/name) for name, _ in VARIANTS], r1042) + for name, row in full.items(): + print(name, json.dumps(row, sort_keys=True), flush=True) + require(full == EXPECTED['end_to_end'], 'End-to-end reuse-mode outcomes') + print('PASS_FRONTIER1094_ANCESTRY_BINDING_AUDIT', sha(bound)) + + +if __name__ == '__main__': + main()