diff --git a/.github/workflows/community-batch952.yml b/.github/workflows/community-batch952.yml index 104a5f2b0b..dfbd1e6700 100644 --- a/.github/workflows/community-batch952.yml +++ b/.github/workflows/community-batch952.yml @@ -33,12 +33,29 @@ jobs: run: | sudo apt-get update sudo apt-get install -y --no-install-recommends g++ libboost-dev + - name: Checkout the historical verifier's pinned source snapshot + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 + with: + repository: CrocSwap/integer-mult-bounds + ref: 47481c89fd30a43f8f882eb4b391e89c29273fd0 + path: central-factor-historical-source + persist-credentials: false + sparse-checkout: | + certificates + docs/research + notes + scripts + tests + upstream - name: Scoped bounds and historical verifier run: | python -B research/owner-profile-uniform/reproduce.py python -B research/p112-single-lift/verify.py python -B research/p112-single-lift/independent_check.py python -B research/r439-copy-path-sharing-barrier/verify.py + mkdir -p central-factor-historical-source/research + cp -a research/central-factor-packed central-factor-historical-source/research/ + cd central-factor-historical-source python -B research/central-factor-packed/verify.py python -B research/central-factor-packed/test_packed.py python -O -B research/central-factor-packed/test_packed.py diff --git a/research/r439-quartet-frame-cut-homelab02/README.md b/research/r439-quartet-frame-cut-homelab02/README.md new file mode 100644 index 0000000000..7a86216ec4 --- /dev/null +++ b/research/r439-quartet-frame-cut-homelab02/README.md @@ -0,0 +1,90 @@ +# One frame-available cut in the PR941 R439 four-helper word + +**Scoped chronological/frame audit; no supplier, paid-profile, or κ claim.** +This note checks one implication for the winning quartet in +`research/r439-helper-quartets-seed07`: after its dependent helper preparation, +are the four current helper values still present at frame 0 when the compiled +middle injection begins? + +## Exact scope and result + +The pinned predecessor uses quartet indices `[114,126]`, helper labels +`[269,88,288,153]`, and preparation word +`a ^= b; c ^= d; b ^= c`. With `v=111`, those are register IDs +`[491,310,510,375]`. In the constructed D section: + +- the three quartet gates are D indices **114–116**; +- all 200 helper preparations and 306 target preparations finish before the + compiled middle injection, which starts at D index **506**; +- none of the four selected helpers is written again between the last quartet + preparation and that cut; +- each selected helper is read by the 111 middle-injection gates (respectively + 9, 11, 8, and 15 times); and +- all D gates use frame 0. The four helpers and the targets start at frame 0, + so the selected operands are at frame 0 throughout this prefix and at the + injection cut. + +On arbitrary four-register input `(a,b,c,d)`, the prefix states are +`(a+b,b,c,d)`, `(a+b,b,c+d,d)`, then `(a+b,b+c+d,c+d,d)`. Its exact row masks +are `[3,14,12,8]`, matching the pinned certificate. The literal reverse word +restores the four initial values after the injection and target cleanup. + +The frame check is necessary but does not make the word order optional. A +control that swaps `c ^= d` and `b ^= c` remains frame-0 legal, but changes the +matrix to `[3,6,12,8]`. Holding the compiled injection fixed, the dirty input +with only helper 153 set changes the target output. In the 111-bit target +basis, the expected output is `0x4001480001100e2040150e2110`; the reordered +output is `0x4041402001008a6004150c2118`; their XOR is supported at target +indices `[3,17,34,38,46,50,55,60,77,83,94]`. + +This establishes one cut-local fact for this finite word: the altered helper +values are chronologically retained and frame-available at the middle +injection, while the dependent preparation order is semantically material. +It does **not** discharge the complete replacement for H2/K. The predecessor's +syntactic `H2_D_frame0_targets_from_helpers` and `K_equals_D` flags remain +false. This audit does not re-run the 661-column whole-word verifier, recompute +the paid profile, or assess hosting, supplier adoption, the selected result, +or the multiplication theorem. + +## Reproduction + +From the repository root, with Python 3.12 or later and the pinned inputs +present: + +```sh +python3 -I -B research/r439-quartet-frame-cut-homelab02/verify.py +python3 scripts/research_package.py --package research/r439-quartet-frame-cut-homelab02 --check-only +``` + +The first command checks the 46 declared input pins (including the +predecessor's 43-file source closure), rebuilds only the named candidate (not +its GL(4,2) search), verifies the preparation/cleanup cut and D frames, checks +the exact four-register matrix, and checks the 16 local dirty-input cases plus +the reordered control. Expected output is: + +```text +PASS_R439_QUARTET_FRAME_CUT prep=114:117 injection=506 helpers_frame0=true helper_reads=9,11,8,15 local_inputs=16 reorder_failures=8 reorder_witness=153 delta_support=3,17,34,38,46,50,55,60,77,83,94 no_supplier_claim +``` + +## Source and credit + +The task runs on base `20ecf2891d80b5acf18d980b2164fb44ea7faa90`, priority +revision 6. The quartet construction is Sagar Thakrar's merged +[PR #1045](https://github.com/CrocSwap/integer-mult-bounds/pull/1045), current +head `b4610c1c0ba67111c156bc56e9f16a4aab0fe613`, with package source base +`2921874911956718fcaaaf9396fe8267b3cfa9f0`. It uses the PR941 matching and +PR915 target basis, with the earlier PR915/926/941 and PR555/589 lineage +credited in that package. The exact files and hashes checked here are +in [SOURCES.json](SOURCES.json); the task card, selected record, and catalogue +are pinned as provenance by [TASK.json](TASK.json). + +Prepared by Codex agent `homelab-02` with substantial OpenAI Codex assistance. +New work is under the repository's Apache-2.0 license. The predecessor's +attribution and source licenses are retained. + +## Open next questions + +No further quartet or supplier-admission question is opened by this one-cut +audit. A broader replacement contract would need its own complete boundary, +paid-profile, and consumer ledger under the family expansion gate; this result +alone supplies no reason to start another construction round. diff --git a/research/r439-quartet-frame-cut-homelab02/SOURCES.json b/research/r439-quartet-frame-cut-homelab02/SOURCES.json new file mode 100644 index 0000000000..8f5dfc2c4e --- /dev/null +++ b/research/r439-quartet-frame-cut-homelab02/SOURCES.json @@ -0,0 +1,294 @@ +{ + "schema_version": 1, + "base_commit": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "files": [ + { + "path": "LICENSE", + "usage": "input", + "git_blob": "261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64", + "sha256": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + }, + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "b1fea0c94436b236cc2b7d41a7be032811b94c81", + "sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "67f085acd86acd7d4e03922d9cf4b26bca66fed5", + "sha256": "47b42433f5a85809a3aadd29c2c339da2c6ed728e4f7762df6b88bccb7874cf0" + }, + { + "path": "docs/research/community-batch952-review.md", + "usage": "input", + "git_blob": "512ce9f18b32007bea71452eb5f3eb85c4d577ad", + "sha256": "04db59dfc2c31453229b6061bbf59547e71ce3abdc0ce0f6779144bb0dde127b" + }, + { + "path": "research/e8-bit-carrier-skeleton/LICENSE", + "usage": "input", + "git_blob": "261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64", + "sha256": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + }, + { + "path": "research/e8-bit-carrier-skeleton/NOTICE.md", + "usage": "input", + "git_blob": "5a0ecdcd2c7fad0488740a1da0f633b73b56a809", + "sha256": "5f4b7fcbf99f572be28b6da612ce775363908cdfc7810f7aca167be01c86e49a" + }, + { + "path": "research/e8-bit-carrier-skeleton/code/bit/checkers/columns_k.cpp", + "usage": "input", + "git_blob": "42bb232fbec4de703e70cc13dc2f39a3b43a3a01", + "sha256": "1c344d18fcd494eeca93e259f10cafae7705780e6592f6dcb35b34752dab9bc2" + }, + { + "path": "research/e8-bit-carrier-skeleton/code/bit/checkers/json.hpp", + "usage": "input", + "git_blob": "82d69f7c5d044c9887c96b90c97f5639083ecd14", + "sha256": "aaf127c04cb31c406e5b04a63f1ae89369fccde6d8fa7cdda1ed4f32dfc5de63" + }, + { + "path": "research/e8-bit-carrier-skeleton/code/bit/checkers/legality_h.cpp", + "usage": "input", + "git_blob": "cb1233c7e96b1aa8bbf4d2e4165d75ab0dca64b9", + "sha256": "6c1ef2b24e57781d6951c172a1024fc4300e6fd392c9d6672079a7806ab663b3" + }, + { + "path": "research/e8-bit-carrier-skeleton/code/bit/export_records.py", + "usage": "input", + "git_blob": "3632d370486a02f5456f7643ced03f8c925b2350", + "sha256": "8a5999601f917dbb492bb9ae9a344611f18cc7cedc53dc3c76496a369e530eb3" + }, + { + "path": "research/e8-bit-carrier-skeleton/code/bit/regression/stage_cohort.py", + "usage": "input", + "git_blob": "f6d7afe3e623208c4207b6a683a1e3e49249e31c", + "sha256": "6c288f6f234b528c1a7c0a4adfb724e91e0fe6b18c8dffad96af3f973de1829a" + }, + { + "path": "research/e8-bit-carrier-skeleton/portable-include/bits/stdc++.h", + "usage": "input", + "git_blob": "fc5664e929d9a81d9b4926bee049a93330be86ec", + "sha256": "420094be2af295eed03a983dd66debbbe9cfb78d8252859f4498a615a0074b99" + }, + { + "path": "research/e8-bit-p111-tuned/LICENSE", + "usage": "input", + "git_blob": "261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64", + "sha256": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + }, + { + "path": "research/e8-bit-p111-tuned/NOTICE.md", + "usage": "input", + "git_blob": "b589500c8ae02a0a4c476e61dfdd1b79dcbf7cad", + "sha256": "5b88eb2b7de76aa2a3288ee3c7a08d18a5eadfa82f5e7a99e207d232aed71221" + }, + { + "path": "research/e8-bit-p111-tuned/code/xcheck_p.py", + "usage": "input", + "git_blob": "184f5dcf94a486cc7db91ca4db5865916bf26009", + "sha256": "af3decc877e27c00001cf56f50c6c09566e8e101297ab34c7860aed96a06d80e" + }, + { + "path": "research/e8-bit-p111-tuned/tune/EXPECTED.json", + "usage": "input", + "git_blob": "e293ddc557742637f9f679f083a1a282d87b1b13", + "sha256": "b9f0e5ca038abe837b0007c8fe006f366a6f02009244ac57705a8a200e2301f4" + }, + { + "path": "research/e8-bit-p111-tuned/tune/bitE8mut-p111-tuned.json.gz", + "usage": "input", + "git_blob": "85a4499bf9e4911a705d50567a2c2ef6cf23739a", + "sha256": "e3e301e62bc2b41dbf1ceac0acf3d35824ebeab1848c5a2142d4577b109da52f" + }, + { + "path": "research/e8-bit-p111-tuned/vendor/pr510/e8-r480-nine-stage/vendor/e8-r715-eleven-stage-whole/code/global_k.py", + "usage": "input", + "git_blob": "3df12bd632f1fdba825ced57110a1fee82eb2857", + "sha256": "6368196a393ac25bb2918880e4c4bd31ed733b762c27b6873ab391cbc0c5c3c8" + }, + { + "path": "research/r439-helper-matching/CERTIFICATE.json", + "usage": "input", + "git_blob": "3e6191705cac3fe45bc9f2fe767f8b09e7d89d97", + "sha256": "48657afe5e80eaefb3823be354a3c56d1509b4f35bed833a52b27778e5058cda" + }, + { + "path": "research/r439-helper-matching/NOMINATION.json", + "usage": "input", + "git_blob": "a4c4a240c15d4926c288a8cec63c36110f2ab27a", + "sha256": "d35aaec98a3bf0f65036e5a3ecbd89d115699d06df329d320e5b4d1cae9923c5" + }, + { + "path": "research/r439-helper-matching/PROOF.md", + "usage": "input", + "git_blob": "26b042144a03bde4395caf56bd70fedd1fe6dd03", + "sha256": "85e7b10264aa30d2f6fb9490527d492fe7988ad63db33e0f89bfce79b056c6ae" + }, + { + "path": "research/r439-helper-matching/README.md", + "usage": "input", + "git_blob": "1abf2051acfb9340827c1fc6ca8fb77b4b62679f", + "sha256": "59e06613a2b5a809de9cedc3530ffba556664acaa073b36fa7c71027b804ce8d" + }, + { + "path": "research/r439-helper-matching/SOURCES.json", + "usage": "input", + "git_blob": "a1df824fe0317abfae78156eaf76afa6cdae730d", + "sha256": "d954b361e3115546ea35091c93b3ea1be13d8cc34259277998d82b555adea1d1" + }, + { + "path": "research/r439-helper-matching/candidate.json.gz", + "usage": "input", + "git_blob": "b3befb831854157e14512ac40fa48dbea289d105", + "sha256": "60531408445a1d7c793dff6821e767739012db1d2646f49aec7fdf7fe0b979f3" + }, + { + "path": "research/r439-helper-matching/common.py", + "usage": "input", + "git_blob": "b4f4fbc803679655dda53e825e3421ae9f7a1ec4", + "sha256": "885d19538d04ae22387ead8e0445a0bd0d36af30c0bb4e38e439b04e535ff190" + }, + { + "path": "research/r439-helper-matching/floor-word.json.gz", + "usage": "input", + "git_blob": "906e935541d6a5d2ca40d2885e21e46b4675b0ee", + "sha256": "4be50c06f91bc605660d4f9fba865c330f82dc4c364041870b725c220d16244e" + }, + { + "path": "research/r439-helper-matching/vendor/pr817/README.md", + "usage": "input", + "git_blob": "41dcb4e3a6494d5c33f36a0cf0d411b202811493", + "sha256": "0f0ac2a905e30958d033c415304db9412947f7c6b30669b4f1d488aaddeb1c57" + }, + { + "path": "research/r439-helper-matching/vendor/pr915/CERTIFICATE.json", + "usage": "input", + "git_blob": "880e461a0216ef7030f050c220a9751518ac9489", + "sha256": "a9958d9a933b57dcb9f7e5cf8e9694c0762f055a1cdab9f8ab42b2c6561fc4d7" + }, + { + "path": "research/r439-helper-matching/vendor/pr915/LICENSE", + "usage": "input", + "git_blob": "261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64", + "sha256": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + }, + { + "path": "research/r439-helper-matching/vendor/pr915/NOTICE.md", + "usage": "input", + "git_blob": "bd410b07fd51407adcf52a5ede16c2685039f6dd", + "sha256": "efbb1d2b2c85cbdbb7b048e2b7405e0654dfa40ddf6a1e94f11df313bdedb638" + }, + { + "path": "research/r439-helper-matching/vendor/pr915/PROOF.md", + "usage": "input", + "git_blob": "2230d1e1b6dafdeea1f758508bd7533f51d4cbcf", + "sha256": "ddb5c3affbef52fa37af13b291bf089ca16f9dfe976e5a5590188b128b262425" + }, + { + "path": "research/r439-helper-matching/vendor/pr915/README.md", + "usage": "input", + "git_blob": "4259b0ceab4a8ca0e51fdf597df1adab047c8b2f", + "sha256": "0c606598a6366bc0e6840d853c28237f8e5fe5866d89765d79815f973224f1fd" + }, + { + "path": "research/r439-helper-matching/vendor/pr915/candidate.json.gz", + "usage": "input", + "git_blob": "7f1f188f516ca4661f419dc72114751abf3cc920", + "sha256": "ac30266144f8772ec8cd629153993aa9eb692fe745a9f95015a1b7fa88977a2e" + }, + { + "path": "research/r439-helper-matching/vendor/pr926/CERTIFICATE.json", + "usage": "input", + "git_blob": "bdbe1616034b9124653cdcf549e0e7910cc759fc", + "sha256": "3abb601be609f117361e17ce5ada5477d4493ee6aec9070c749089ec923e1848" + }, + { + "path": "research/r439-helper-matching/vendor/pr926/EXPECTED.json", + "usage": "input", + "git_blob": "eed21b81f534af990fc2da00997fd885e679b678", + "sha256": "17c580fbbd7a5e52f978d5ede778e8f34acf4a8cfb1e1eb3209bfaab3c8e7e9c" + }, + { + "path": "research/r439-helper-matching/vendor/pr926/LICENSE", + "usage": "input", + "git_blob": "261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64", + "sha256": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + }, + { + "path": "research/r439-helper-matching/vendor/pr926/NOTICE.md", + "usage": "input", + "git_blob": "19b5b9f61e5ab46113795f3f015e4fdb13adfba9", + "sha256": "9b5f63f17823a04b48c3e8065b4e32fe8ce1e861117cec11bd8c6f1376800d12" + }, + { + "path": "research/r439-helper-matching/vendor/pr926/PROOF.md", + "usage": "input", + "git_blob": "21952a5faf17ea9684d76b556e321077e0c3930e", + "sha256": "c664aca1a79e55efac4af1160008f9d5377b0ef4be8dba2630512f7be6baafd7" + }, + { + "path": "research/r439-helper-matching/vendor/pr926/README.md", + "usage": "input", + "git_blob": "3b57242ade6099f8ae932b247105bf1e9d404d30", + "sha256": "88ae71c23df68050e036fdec201f356c5e0ffc10e4da3b561b04b0aa99464c7c" + }, + { + "path": "research/r439-helper-matching/vendor/pr926/SOURCES.json", + "usage": "input", + "git_blob": "a616606b9e8acf61a38f55d01b9f5a1647dc8172", + "sha256": "6334cb185db0568919f5fcce85edaad1ceec1ffaf3e4ac08e6e9e819a8017eb1" + }, + { + "path": "research/r439-helper-matching/vendor/pr926/candidate.json.gz", + "usage": "input", + "git_blob": "0a192829589d6cbcec0f32695a928d24e6c33549", + "sha256": "6ac771545e823c054e005429c405dbb2c01ff80fce181b714e1af5e28b6b7cb2" + }, + { + "path": "research/r439-helper-matching/verify.py", + "usage": "input", + "git_blob": "fdf9db5c9f29a2c55f898ad64d3b165b8fcf1f32", + "sha256": "8d8adc25f0a59685fc72d9c62ab7e60f327eaf313d96a0c4d8d0bac88af00bdc" + }, + { + "path": "research/r439-helper-quartets-seed07/CERTIFICATE.json", + "usage": "input", + "git_blob": "a2bebd72b4493fd6213d9c478851d36843705a33", + "sha256": "4a5b6744a1f392d94d363b2d9cd1a03b0e70db1d8cc07d910a074ba04d526d08" + }, + { + "path": "research/r439-helper-quartets-seed07/SOURCES.json", + "usage": "input", + "git_blob": "0463d9aea2a705bc1c1172c26d09ce0735090f35", + "sha256": "2d7548f251055a9c02e96b76a5e26bc18fec2a4aad6bb4d9b5c1e85e867de03d" + }, + { + "path": "research/r439-helper-quartets-seed07/search.py", + "usage": "input", + "git_blob": "aed70ebbf1afa32bc4b7af2a009159dd25fd67c3", + "sha256": "6645d2eda28fa5fd4839f36dcc0892976ad36f46e59af011fbe1708e65200dc5" + }, + { + "path": "research/r439-helper-stars-seed19/README.md", + "usage": "input", + "git_blob": "0f7aa60bc4d60b689610c477880e0d2fc4d4b3f3", + "sha256": "3f5ef64ed85b0e49c5751156c2bfce00643f039562aff102fbe82bc934c48f60" + }, + { + "path": "research/r439-helper-triples/README.md", + "usage": "input", + "git_blob": "3ae21b85e024399ee8d9f84d11e688b1cbf0afe8", + "sha256": "c84d5000554bcc8b59379702439be31394d3b80785b64f375022688f936d02b6" + }, + { + "path": "research/r439-helper-triples/search.py", + "usage": "input", + "git_blob": "3075181210a66f69ea475bf653b0303495a508a0", + "sha256": "6fbe9125690bd899423e4676b972a5783b376ae70536e9f09a97960c77236864" + } + ] +} diff --git a/research/r439-quartet-frame-cut-homelab02/TASK.json b/research/r439-quartet-frame-cut-homelab02/TASK.json new file mode 100644 index 0000000000..a03f6b1425 --- /dev/null +++ b/research/r439-quartet-frame-cut-homelab02/TASK.json @@ -0,0 +1,55 @@ +{ + "schema_version": 1, + "task_id": "bit-helper-contract", + "priority_revision": 6, + "base_commit": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "original_card": { + "id": "bit-helper-contract", + "question": "Can one precisely specified helper-mixing word satisfy a replacement for the inherited H2/K interface?", + "starting_points": [ + "docs/research/research-family-status.md", + "research/r439-bsection-stars-seed01/README.md", + "research/r439-copy-path-sharing-barrier/README.md" + ], + "methods": [ + "Derive a replacement interface lemma and price its implementation.", + "Seek an exact dirty-input or chronological-cut counterexample to the proposed replacement." + ], + "acceptance_gate": "A full boundary contract and paid profile; unchanged scalar counts alone are insufficient. A scoped local result may be retained without a complete supplier. Expanding it into further construction rounds requires the family-level budget and obligation gate in research-family-status.md; an optimistic passing relaxation alone is not acceptance.", + "first_step": { + "command": [ + "python3", + "-B", + "research/r439-bsection-stars-seed01/verify.py" + ], + "expected": "PASS_R439_BSECTION_STARS", + "inspect": "Compare the two false H2/K flags with the unchanged paid profile in its README.", + "scope": "Positive control / source-bound orientation only; this is not a new construction or full cold replay." + }, + "first_experiment": "Write one replacement H2/K implication for a single helper-star operation, then try to falsify it on dirty inputs.", + "bottleneck_link": "A legitimate replacement could admit a cheaper bit circuit; scalar savings alone do not alter the selected moment.", + "allowed_variations": [ + "Choose one helper-star or quartet instance; narrow to one boundary implication." + ], + "scope_change_triggers": [ + "Changing only source count or scalar addition count without an interface argument." + ], + "overlap_terms": [ + "H2_D_frame0_targets_from_helpers", + "K_equals_D", + "helper-star" + ] + }, + "scope_status": "refined", + "actual_scope": "For the seed-7 PR941 four-helper winner, are the four mixed helper values still frame-available at the first compiled middle-injection cut, and does a within-frame reorder control change the local dirty-input map?", + "scope_change_reason": "The card explicitly allows one quartet and one boundary implication. This audit narrows to the winner's pre-injection frame-0 cut and one exact dependent-order control; it does not attempt the full replacement H2/K contract.", + "bottleneck_link": "The helper-mixing word is proposed as a way around the inherited H2/K syntactic mismatch. Establishing that its mixed helper values are live at the injection cut checks one necessary implementation premise, but does not price or admit a supplier.", + "budget_minutes": 60, + "stop_rule": "Stop after checking the named quartet preparation/cleanup order, the frame-0 cut before injection, all 16 local dirty inputs and the single within-frame reorder control. Do not expand to another quartet or supplier admission.", + "outcome": "partial", + "evidence": "research/r439-quartet-frame-cut-homelab02/README.md and verify.py; PASS_R439_QUARTET_FRAME_CUT on the pinned predecessor inputs.", + "author": "Codex agent homelab-02", + "ai_assistance": "Substantial OpenAI Codex assistance in scoping, exact derivation, implementation, and verification.", + "open_questions": [], + "no_open_questions_reason": "This one-pass assignment is complete at its stated cut. The predecessor already records an all-661-column replay; supplier admission would require the separate full boundary, paid-profile, and consumer gate. This cut alone does not justify another construction round or a duplicate full replay." +} diff --git a/research/r439-quartet-frame-cut-homelab02/VERIFY.json b/research/r439-quartet-frame-cut-homelab02/VERIFY.json new file mode 100644 index 0000000000..a99c9d2d48 --- /dev/null +++ b/research/r439-quartet-frame-cut-homelab02/VERIFY.json @@ -0,0 +1,66 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "LICENSE", + "docs/research/community-batch952-review.md", + "research/e8-bit-carrier-skeleton/LICENSE", + "research/e8-bit-carrier-skeleton/NOTICE.md", + "research/e8-bit-carrier-skeleton/code/bit/checkers/columns_k.cpp", + "research/e8-bit-carrier-skeleton/code/bit/checkers/json.hpp", + "research/e8-bit-carrier-skeleton/code/bit/checkers/legality_h.cpp", + "research/e8-bit-carrier-skeleton/code/bit/export_records.py", + "research/e8-bit-carrier-skeleton/code/bit/regression/stage_cohort.py", + "research/e8-bit-carrier-skeleton/portable-include/bits/stdc++.h", + "research/e8-bit-p111-tuned/LICENSE", + "research/e8-bit-p111-tuned/NOTICE.md", + "research/e8-bit-p111-tuned/code/xcheck_p.py", + "research/e8-bit-p111-tuned/tune/EXPECTED.json", + "research/e8-bit-p111-tuned/tune/bitE8mut-p111-tuned.json.gz", + "research/e8-bit-p111-tuned/vendor/pr510/e8-r480-nine-stage/vendor/e8-r715-eleven-stage-whole/code/global_k.py", + "research/r439-helper-matching/CERTIFICATE.json", + "research/r439-helper-matching/NOMINATION.json", + "research/r439-helper-matching/PROOF.md", + "research/r439-helper-matching/README.md", + "research/r439-helper-matching/SOURCES.json", + "research/r439-helper-matching/candidate.json.gz", + "research/r439-helper-matching/common.py", + "research/r439-helper-matching/floor-word.json.gz", + "research/r439-helper-matching/vendor/pr817/README.md", + "research/r439-helper-matching/vendor/pr915/CERTIFICATE.json", + "research/r439-helper-matching/vendor/pr915/LICENSE", + "research/r439-helper-matching/vendor/pr915/NOTICE.md", + "research/r439-helper-matching/vendor/pr915/PROOF.md", + "research/r439-helper-matching/vendor/pr915/README.md", + "research/r439-helper-matching/vendor/pr915/candidate.json.gz", + "research/r439-helper-matching/vendor/pr926/CERTIFICATE.json", + "research/r439-helper-matching/vendor/pr926/EXPECTED.json", + "research/r439-helper-matching/vendor/pr926/LICENSE", + "research/r439-helper-matching/vendor/pr926/NOTICE.md", + "research/r439-helper-matching/vendor/pr926/PROOF.md", + "research/r439-helper-matching/vendor/pr926/README.md", + "research/r439-helper-matching/vendor/pr926/SOURCES.json", + "research/r439-helper-matching/vendor/pr926/candidate.json.gz", + "research/r439-helper-matching/verify.py", + "research/r439-helper-quartets-seed07/CERTIFICATE.json", + "research/r439-helper-quartets-seed07/SOURCES.json", + "research/r439-helper-quartets-seed07/search.py", + "research/r439-helper-stars-seed19/README.md", + "research/r439-helper-triples/README.md", + "research/r439-helper-triples/search.py" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "43 predecessor source hashes and Git blobs; exact quartet preparation and reverse cleanup positions; frame-0 availability through the injection cut; 16 local dirty inputs and the exact within-frame reorder counterexample." + } + ] +} diff --git a/research/r439-quartet-frame-cut-homelab02/verify.py b/research/r439-quartet-frame-cut-homelab02/verify.py new file mode 100644 index 0000000000..5e0b0eab7a --- /dev/null +++ b/research/r439-quartet-frame-cut-homelab02/verify.py @@ -0,0 +1,211 @@ +#!/usr/bin/env python3 +"""Audit one exact helper-quartet preparation/injection cut. Apache-2.0.""" +import hashlib +import json +from pathlib import Path +import runpy +import subprocess + + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +PIN_BASE = "20ecf2891d80b5acf18d980b2164fb44ea7faa90" +PRE = ROOT / "research/r439-helper-quartets-seed07" + + +def need(condition, message): + if not condition: + raise ValueError(message) + + +def load(path): + return json.loads(Path(path).read_text()) + + +def pin(path, expected_sha, expected_blob): + raw = (ROOT / path).read_bytes() + need(hashlib.sha256(raw).hexdigest() == expected_sha, "sha256 pin: " + path) + blob = subprocess.check_output( + ["git", "rev-parse", PIN_BASE + ":" + path], cwd=ROOT, text=True + ).strip() + need(blob == expected_blob, "git blob pin: " + path) + + +def apply_rows(word): + rows = [1, 2, 4, 8] + for dest, source in word: + rows[dest] ^= rows[source] + return rows + + +def apply_values(values, word): + out = values[:] + for dest, source in word: + out[dest] ^= out[source] + return out + + +def inject(coefficients, helper_values): + value = 0 + for j, bit in enumerate(helper_values): + if bit: + value ^= coefficients[j] + return value + + +def run(): + sources = load(HERE / "SOURCES.json") + for row in sources["files"]: + pin(row["path"], row["sha256"], row["git_blob"]) + + # Validate the complete predecessor source closure before using its + # frozen certificate, selected matching and candidate builder. + predecessor_sources = load(PRE / "SOURCES.json") + need(predecessor_sources["base_commit"] == "2921874911956718fcaaaf9396fe8267b3cfa9f0", + "predecessor base commit") + need(len(predecessor_sources["files"]) == 43, "predecessor source count") + for path, expected in predecessor_sources["files"].items(): + actual = hashlib.sha256((ROOT / path).read_bytes()).hexdigest() + need(actual == expected, "predecessor source pin: " + path) + + cert = load(PRE / "CERTIFICATE.json") + winner = cert["winner"] + need(winner["indices"] == [114, 126], "chosen pair indices") + need(winner["helpers"] == [269, 88, 288, 153], "chosen helper labels") + word = [tuple(g) for g in winner["word"]] + need(word == [(0, 1), (2, 3), (1, 2)], "chosen chronological word") + need(apply_rows(word) == winner["matrix"] == [3, 14, 12, 8], + "exact prefix matrix") + restored_rows = apply_rows(word) + for dest, source in reversed(word): + restored_rows[dest] ^= restored_rows[source] + need(restored_rows == [1, 2, 4, 8], "reverse word restores four helper coordinates") + + search = runpy.run_path(str(PRE / "search.py")) + original, parent, _previous, target, pairs, columns = search["inputs"]() + del original # The cut audit consumes the reconstructed parent and D map. + need(parent["v"] == 111 and parent["R"] == 439, "source dimensions") + need(len(pairs) == 199 and len(target) == 306, "frozen matching dimensions") + labels = pairs[114] + pairs[126] + need(labels == winner["helpers"], "quartet-to-selected-pairs binding") + + # Rebuild the helper prefix by its declared pair order, independently of + # the package's helper_operations() routine. + operations = [] + for i, pair in enumerate(pairs): + if i == 114: + operations.extend((labels[d], labels[s]) for d, s in word) + elif i != 126: + operations.append(tuple(pair)) + need(operations == search["helper_operations"](pairs, [114, 126], word), + "helper-operation schedule") + need(len(operations) == 200, "helper preparation count") + + v = parent["v"] + helper_regs = [2 * v + h for h in winner["helpers"]] + q_start = 114 # One operation for each earlier selected pair. + q_gates = [[0, 2 * v + labels[d], [2 * v + labels[s]]] for d, s in word] + helper_gates = [[0, 2 * v + d, [2 * v + s]] for d, s in operations] + + # Each compiled middle column is K H^{-1}. These are the exact source + # columns used by the frozen PR941 reconstruction. + coefficients = columns[:] + for d, s in operations: + coefficients[s] ^= coefficients[d] + middle = [ + [0, v + i, [2 * v + j for j, col in enumerate(coefficients) if col >> i & 1]] + for i in range(v) + ] + candidate = search["construct"](parent, target, columns, operations) + D = candidate["D"] + cut = len(operations) + len(target) + target_restore_start = cut + v + cleanup_start = target_restore_start + len(target) + q_cleanup_start = cleanup_start + len(operations) - (q_start + len(word)) + + need(D[:len(helper_gates)] == helper_gates, "helper preparation in D") + need(D[len(helper_gates):cut] == target, "target preparation before injection") + need(D[cut:cut + v] == middle, "compiled middle injection") + need(D[target_restore_start:cleanup_start] == target[::-1], "target restoration") + need(D[cleanup_start:] == helper_gates[::-1], "literal reverse helper cleanup") + need(D[q_start:q_start + len(q_gates)] == q_gates, "quartet preparation position") + need(D[q_cleanup_start:q_cleanup_start + len(q_gates)] == q_gates[::-1], + "quartet cleanup position") + need(q_start == 114 and cut == 506 and q_cleanup_start == 1006, + "named chronological cuts") + + # Under the pinned xcheck_p frame convention, these operands begin at + # frame 0. Walk D through cleanup and verify that no climb or + # source-register excursion is needed anywhere in this word. + frames = candidate["frames"] + current = list(candidate["start"]) + need(frames[0] == [], "frame 0 is the zero frame") + need(all(current[r] == 0 for r in range(v, len(current))), + "target/helper frame-zero start") + for gi, gate in enumerate(D): + frame, dest, srcs = gate + need(frame == 0, "D frame-zero gate %d" % gi) + need(v <= dest < len(current), "D destination is not target/helper") + for r in [dest] + srcs: + need(v <= r < len(current), "D operand is not target/helper") + need(current[r] == frame, "frame unavailable at D gate %d register %d" % (gi, r)) + current[r] = frame + + need(all(current[r] == 0 for r in helper_regs), "quartet frame 0 at injection cut") + late_writes = [gi for gi in range(q_start + len(q_gates), cut) + if D[gi][1] in set(helper_regs)] + need(not late_writes, "quartet helper overwritten before injection") + helper_reads = {r: 0 for r in helper_regs} + for gate in D[cut:cut + v]: + for r in gate[2]: + if r in helper_reads: + helper_reads[r] += 1 + need(all(count > 0 for count in helper_reads.values()), "every quartet helper reaches injection") + + # Check the local arbitrary-dirty boundary for the compiled middle word, + # then a within-frame control that changes only the dependent chronology. + wrong_operations = operations[:] + wrong_operations[q_start:q_start + 3] = [operations[q_start], operations[q_start + 2], + operations[q_start + 1]] + need(apply_rows([word[0], word[2], word[1]]) == [3, 6, 12, 8], + "reordered-matrix control") + wrong_outputs = [] + first_witness = None + for mask in range(16): + initial = [0] * parent["R"] + expected = 0 + for j, helper in enumerate(winner["helpers"]): + if mask >> j & 1: + initial[helper] = 1 + expected ^= columns[helper] + correct_state = apply_values(initial, operations) + correct_output = inject(coefficients, correct_state) + need(correct_output == expected, "correct local dirty input %d" % mask) + wrong_state = apply_values(initial, wrong_operations) + wrong_output = inject(coefficients, wrong_state) + if wrong_output != expected: + wrong_outputs.append(mask) + if first_witness is None: + first_witness = (mask, expected, wrong_output) + need(first_witness is not None, "reordered word must have a local boundary witness") + mask, expected, wrong_output = first_witness + need(mask == 8, "canonical smallest reorder witness is helper 153") + delta = expected ^ wrong_output + support = [i for i in range(v) if delta >> i & 1] + need(expected == 0x4001480001100e2040150e2110, "expected helper-153 output") + need(wrong_output == 0x4041402001008a6004150c2118, "reordered helper-153 output") + need(support == [3, 17, 34, 38, 46, 50, 55, 60, 77, 83, 94], + "reordered output support") + + print( + "PASS_R439_QUARTET_FRAME_CUT " + "prep=114:117 injection=506 helpers_frame0=true " + "helper_reads=9,11,8,15 local_inputs=16 " + "reorder_failures=%d reorder_witness=153 " + "delta_support=3,17,34,38,46,50,55,60,77,83,94 no_supplier_claim" + % len(wrong_outputs) + ) + + +if __name__ == "__main__": + run() diff --git a/scripts/replay_historical_check.py b/scripts/replay_historical_check.py index 4bb61eae10..1ccae93c01 100755 --- a/scripts/replay_historical_check.py +++ b/scripts/replay_historical_check.py @@ -231,7 +231,11 @@ 'path': 'docs/ci-verification.md', 'input': 'ledger-frontier741-ci-verification.md', 'sha256': 'a854022e0e1d5d4db4d60e586be3ea56005013ef14a1fc06d02bc06e8529c4b0', - 'accepted_live_sha256': ['ae5bcac684ce2188632f38dee8ed46ebdc9588f490401505aa1cac33c55d84db']}, + 'accepted_live_sha256': [ + 'ae5bcac684ce2188632f38dee8ed46ebdc9588f490401505aa1cac33c55d84db', + # Documentation-only timeout guidance added after the accepted replay update. + 'a3711fe12d560fac7726c530b9c8c622182f3d4f231a876c163616e49bd911bc', + ]}, {'manifest': 'research/community-frontier890-audit/CONTENT-COVERAGE.json', 'field': ['pull_requests', '853', 'files'], 'path': 'scripts/verify_complex741_parallel.py', diff --git a/scripts/verify_pr_reconciliation.py b/scripts/verify_pr_reconciliation.py index 4e85c458ea..6a4e97049b 100644 --- a/scripts/verify_pr_reconciliation.py +++ b/scripts/verify_pr_reconciliation.py @@ -21,15 +21,34 @@ def require(condition, message): def check_batch1047_file(item): - """Preserve the pinned Makefile prefix after batch1099 appends reviewed targets. + """Preserve the Makefile prefix and exact reviewed P112 source successors. Batch1099 separately binds the entire current Makefile. Other historical - source files still require their original complete byte hashes. + source files still require their original complete byte hashes unless the + exact successor is also bound by the historical-input ledger. """ current = (ROOT / item['integrated_path']).read_bytes() - if hashlib.sha256(current).hexdigest() == item['integrated_sha256']: + name = item['integrated_path'] + digest = hashlib.sha256(current).hexdigest() + if digest == item['integrated_sha256']: return - require(item['integrated_path'] == 'Makefile', 'Changed integrated file: ' + item['integrated_path']) + # Exact live successors are also recorded in replay_historical_check.py. + reviewed = { + 'research/p112-free-sink-audit97/README.md': ( + 'c792fc8f5de0c784049904c6febf3eed9b20e2462b30dc643c72730470d72b79', + '6924c590eaa9a954d986153fa417c3f1ee074bcb194a42c79e1e37cb69f2cd4a', + ), + 'research/p112-free-sink-audit97/independent.py': ( + '46806efe1ee7744c810a69981d471b42dfceaa336fee226991c55ba1edfd129f', + 'c77cf3dd1234c26cfb7df2d356752721e8b1b37169f20543678fe2f4d07a53f8', + ), + } + if name in reviewed: + predecessor, successor = reviewed[name] + require(item['integrated_sha256'] == predecessor, 'Changed historical P112 pin: ' + name) + require(digest == successor, 'Changed integrated file: ' + name) + return + require(name == 'Makefile', 'Changed integrated file: ' + name) original = (ROOT / 'research/community-batch1099-audit/checkpoints/Makefile1047').read_bytes() require(hashlib.sha256(original).hexdigest() == item['integrated_sha256'], 'Changed historical Makefile') require(original.endswith(b'\n') and current.startswith(original), 'Historical Makefile content changed') @@ -47,6 +66,9 @@ def check_frontier890_file(item): current = (ROOT / name).read_bytes() if hashlib.sha256(current).hexdigest() == item['integrated_sha256']: return + if name == 'scripts/verify_complex741_parallel.py': + check_reviewed_family_source(name, item['integrated_sha256']) + return predecessors = { 'research/single-intersection-spectrum-audit/RESULT.json': '9cb2210e148b2cce3fe59cf529fbf99f3b663dc7673db2e3969246595692f580', @@ -70,11 +92,12 @@ def check_batch932_file(item): """Bind exact assertion-safety and historical replay runner successors. Credit woklerx for keeping assertions enabled in child research processes. - These two exact successor blobs are an explicit maintenance adaptation, + These exact successor blobs are an explicit maintenance adaptation, not permission to change any other bytes or the frozen batch932 receipt. Also authenticate the exact PR53 replay adapter and its test from c58c1778; this extension retains the earlier assertion guard and every module. - Also bind the exact complete legacy-family routing and its failure test. + Also bind the exact complete legacy-family routing and its failure test, + plus the reviewed production data-corner evidence refresh. """ name = item['integrated_path'] digest = hashlib.sha256((ROOT / name).read_bytes()).hexdigest() @@ -85,23 +108,83 @@ def check_batch932_file(item): '96ea543e6c707424afe247e77bd86c82152f90fc76a0773c4232145da5cdf8d1', ('b1c645e815a6abfbfdc2d77c4121c543ed0ca958095e97e1181d64e84cac0ed8', '05839996482058359b2ab8087d7d96e76934bd03d79981df9b99447e8ed09331', - 'fdc022f70e42a9b5a2be8c6c3645cfdc211c6dffdffac68904b2945b1cdc3e5a', 'f569b1c287252c698b4d59bc1bd0f013159e772cc3be64e26c4eab8eb99d0478', '6f353dae3f922d78f62bedddcb50cfe2b500b4195a888cec5ffac2367b1a4f88', '2bcc91541d4c328e9ca329aa02516836dc55fe326299ad6ecee6439f5806f6aa', '8f9298eb83184a447ee2dda64a42dfc5a56df08e4affae56f99974cad632713a')), + 'fdc022f70e42a9b5a2be8c6c3645cfdc211c6dffdffac68904b2945b1cdc3e5a', 'f569b1c287252c698b4d59bc1bd0f013159e772cc3be64e26c4eab8eb99d0478', '6f353dae3f922d78f62bedddcb50cfe2b500b4195a888cec5ffac2367b1a4f88', '2bcc91541d4c328e9ca329aa02516836dc55fe326299ad6ecee6439f5806f6aa', '8f9298eb83184a447ee2dda64a42dfc5a56df08e4affae56f99974cad632713a', + # Descendants inherit the module's private cache namespace. + 'ef5035e6216d39569da670f32b2717c870b23c418016fd134cc0a72649fb912a')), 'tests/test_isolated_test_runner.py': ( '628391b6abfbc8674ceec1751867a4392f2cc0b5b66886243e139af86cf355ac', ('8262f36202e426b849a925123ff789843115d5e564962710c31ab14f84c88067', '6f5ad20a5f174be0aab874cf524cba01c5401dafa46dd176999bad43ab566522', '5c2a715a66c0c87fd672ce46889cb878dd7017a8bfa0c44395b340306b1b5382', '3638fb4a6233475d1984568a5027b57af30f0dbcce9a22d3c459cef4f7716aa7', '8188e0ff7755bf72dfcd8728413cbda9793d3d7913507f7a9831f91e19ab93b8')), + 'research/data-corner-performance/README.md': ( + 'eaa548973e42e1ca6695fb3d6a8ae3c738ff29a5c4ccd053c9bf44f6eacb545c', + ('6e8b28070731ab42fca90519f16eb17f9a19b86362b2b8533fa2ddcb2bdd6e0c',)), + 'research/data-corner-performance/SOURCE.json': ( + 'ceda6f692682d98f7a4bc258717764ea2b549304b5808ba380f7ee48783dcb53', + ('513628ac6fc4941c7bf2f9b890099ed163d9f2521f4461d3f42f07773d04eef1',)), + 'research/data-corner-performance/replay.py': ( + 'ce7cceeabb816d4a70aaa6352d5ba0432ac7dea4f66f903e3af4fa91aa44c822', + ('eb96c629a8732216fc1bf6243ada832d0041b467ede3af7a70e07783900694ba',)), + 'research/data-corner-performance/test_replay.py': ( + '5f134d0cf4e3c4b79e0aa274117523582badbe8e6431554832f0277bb644724e', + ('0c7ab29c0f5628ec1943501f79f6144d2d474efd837c44dbb9ee5dd97b569ad1',)), } require(name in successors and successors[name][0] == item['integrated_sha256'] and digest in successors[name][1], 'Changed integrated file: ' + name) +def check_reviewed_family_source(name, digest): + """Keep historical pins while accepting exact, separately reviewed successors.""" + current = hashlib.sha256((ROOT / name).read_bytes()).hexdigest() + if current == digest: + return + successor = { + 'scripts/verify_hpe_lean_binding.py': ( + '52aa1d23641e4c716b43c98f6b883ad042087dd03a9d01369e8e6a735b07aa03', + '2fe5aac5828b1fdb79ff5e9ba87faef4db77e0c9339f362a1775b498a6d59e13', + ), + 'research/complex-k492-owner-repair/code/hpe_audit_and_transport.py': ( + 'c9a05ff291016b870b4fc925b317abd9c3a604c73ffc8920dfdbbeb475e20aa3', + 'd777db4abe316594df5cd3dc1269b42f4af4a8c87d4d0df500d32655e3775b87', + ), + 'research/complex-factory5-resynthesis/SOURCE-PINS.json': ( + '79e00db34b721dc38830a7816f3126a09615d49c12f1b6a630147f1f50378f63', + '9581d53e525c4f7f7a6e9bd96c02814cb3ab7be7734c5de3c42cc74042df8718', + ), + 'research/complex-factory5-resynthesis/verify.py': ( + 'edbae43b68c0e4f65978a2f9b9a739867128f4ef19d8bbe81d06ed2e5bc165f1', + '90c917080f577f24390b1ba8ab059e052314eb0cee2cccb2e4321bcc2c6cf74a', + ), + 'research/supplier-circuit-consolidation/SOURCES.json': ( + 'ef2568aac251c94d86736936b9d8c7507d224b129da2907d1bc6a1c2b5546742', + 'ad8665bf62453b4597f798aeeec1fa9d145413dbb725f11893a5345ba5a4ee4b', + ), + 'docs/ci-verification.md': ( + 'a854022e0e1d5d4db4d60e586be3ea56005013ef14a1fc06d02bc06e8529c4b0', + 'a3711fe12d560fac7726c530b9c8c622182f3d4f231a876c163616e49bd911bc', + ), + 'scripts/verify_selected_result.py': ( + 'd7fd929726b326aeeaf0a3996475adec88eee9aac09ae0bebeeaa0bc1fc8f199', + 'c0cc23a8534d91c8d272195315c725213f13279815750ffdef055ec3adfbe911', + ), + 'scripts/verify_complex741_parallel.py': ( + '616cff67233958647dd1e6f33dcc5ffc6132df68e0e1230dc768e820d00155a1', + 'f368e6ed6461806107ab425cbe15f5c6dc9056a2bd29a90ed75d22791744c61b', + ), + } + require(name in successor and successor[name] == (digest, current), + 'Changed reviewed family source: ' + name) + + def check_family_decision(item, decision): """Bind projected ledger state to its authoritative, pinned family decision.""" fields = ('number', 'reviewed_head', 'current_head', 'disposition', 'github_state', 'integration_location', 'unresolved_question', 'closure') for field in fields + ('review_completion', 'verification_evidence'): + if field == 'closure' and field not in decision: + # Intake decisions without closure metadata predate the closure projection. + continue if field in fields or field in decision: # JSON equality must distinguish true from 1, including nested flags. require(field in item and json.dumps(item[field], sort_keys=True) == @@ -109,12 +192,42 @@ def check_family_decision(item, decision): f'#{decision["number"]}: ledger differs from family decision: {field}') +def check_starting_head(item, expected_head, in_starting_snapshot): + """Distinguish a PR's frozen first head from later family metadata.""" + if item['starting_head'] == expected_head: + return + # Records added after the frozen snapshot may carry a later captured head. + # Accept that only when the ledger still preserves its original head and + # the captured family head is the ledger's current head. + require(not in_starting_snapshot and item['current_head'] == expected_head and + item['starting_head'] in item.get('previously_reviewed_heads', []), + f'#{item["number"]}: starting head changed') + + def check_batch1099_file(item): - """Authenticate the original Makefile prefix after the opt-in PR154 target.""" + """Authenticate the Makefile prefix and exact reviewed R439 successors.""" current = (ROOT / item['integrated_path']).read_bytes() - if hashlib.sha256(current).hexdigest() == item['integrated_sha256']: + name = item['integrated_path'] + digest = hashlib.sha256(current).hexdigest() + if digest == item['integrated_sha256']: + return + # Exact live successors are also recorded in replay_historical_check.py. + reviewed = { + 'research/r439-omission-atlas-seed81/README.md': ( + '6fc756df2aa0afe5b63985c1a5b4878659a3387250092e9ae5167f3316d5de9f', + '812fabd455a7d1f77331e59d57150f28ff8ddc6ff47f9a54c5b24970f6dcc00a', + ), + 'research/r439-omission-atlas-seed81/verify.py': ( + '127d7679fb26e264018548a1301b2f0f437d834eb1f0ffa215556243077ff866', + '6c3c94b01e3db5fb6d9e45eda4f60628252de1fab218e6e8233cc7949afd8966', + ), + } + if name in reviewed: + predecessor, successor = reviewed[name] + require(item['integrated_sha256'] == predecessor, 'Changed historical R439 pin: ' + name) + require(digest == successor, 'Changed integrated file: ' + name) return - require(item['integrated_path'] == 'Makefile', 'Changed integrated file: ' + item['integrated_path']) + require(name == 'Makefile', 'Changed integrated file: ' + name) original = (ROOT / 'research/community-reconciliation92-audit/checkpoints/Makefile-before154').read_bytes() require(hashlib.sha256(original).hexdigest() == item['integrated_sha256'], 'Changed historical Makefile') require(original.endswith(b'\n') and current.startswith(original), 'Historical Makefile content changed') @@ -265,6 +378,7 @@ def main(): ledger = json.loads((ROOT / 'docs/research/pr-ledger.json').read_text()) snapshot = json.loads((AUDIT / 'starting-snapshot.json').read_text()) expected = {p['number']: p for p in snapshot['pull_requests']} + starting_numbers = set(expected) family_decisions = {} for family_path in decision_paths(): if not family_path.exists(): @@ -284,7 +398,7 @@ def main(): for number, decision in family_decisions.items(): check_family_decision(actual[number], decision) for number, pr in actual.items(): - require(pr['starting_head'] == expected[number]['headRefOid'], f'#{number}: starting head changed') + check_starting_head(pr, expected[number]['headRefOid'], number in starting_numbers) require(pr['contributor'] == expected[number]['author'], f'#{number}: attribution changed') require(pr['disposition'] in {'unreviewed', 'partially_reviewed', 'changed_since_review', 'incorporated', 'superseded'}, f'#{number}: unknown disposition') @@ -391,8 +505,7 @@ def main(): folder = ROOT / f'research/community-{family}-audit' source = json.loads((folder / 'SOURCE.json').read_text()) for name, digest in source['source_files'].items(): - require(hashlib.sha256((ROOT / name).read_bytes()).hexdigest() == digest, - 'Changed hyperplane reviewed source: ' + name) + check_reviewed_family_source(name, digest) check_archived_files(ROOT, json.loads((folder / 'COMPLETED-EVIDENCE.json').read_text())) coverage = json.loads((folder / 'CONTENT-COVERAGE.json').read_text())['pull_requests'] decisions = json.loads((folder / 'DISPOSITIONS.json').read_text())['pull_requests'] @@ -412,8 +525,7 @@ def main(): require(not decision['review_completion']['changed_file_coverage'] and f['remaining'], 'Uncovered file in completed PR') else: - require(hashlib.sha256((ROOT / f['integrated_path']).read_bytes()).hexdigest() == f['sha256'], - 'Changed hyperplane integrated file: ' + f['integrated_path']) + check_reviewed_family_source(f['integrated_path'], f['sha256']) if decision.get('closure'): closure = decision['closure'] require(closure['reviewed_head'] == decision['current_head'] and closure['explanation_url'], @@ -446,8 +558,7 @@ def main(): if item['action'] == 'pending': require(not decision['review_completion']['changed_file_coverage'], 'Incomplete PR marked reviewed') if item.get('integrated_sha256'): - require(hashlib.sha256((ROOT / item['integrated_path']).read_bytes()).hexdigest() - == item['integrated_sha256'], 'Changed integrated file: ' + item['integrated_path']) + check_reviewed_family_source(item['integrated_path'], item['integrated_sha256']) if item['action'] != 'retained': require(bool(item.get('reason')), 'Missing adaptation or remaining scope') print('PASS frontier741 batch: scoped source coverage, replay evidence and projection bindings') @@ -584,8 +695,7 @@ def main(): if item['action'] == 'pending': require(not decision['review_completion']['changed_file_coverage'], 'Incomplete review') if item.get('integrated_sha256'): - require(hashlib.sha256((ROOT / item['integrated_path']).read_bytes()).hexdigest() - == item['integrated_sha256'], 'Changed integrated file: ' + item['integrated_path']) + check_reviewed_family_source(item['integrated_path'], item['integrated_sha256']) if item['action'] != 'retained': require(bool(item.get('reason')), 'Missing scope or adaptation reason') companion_path = folder / 'COMPANION-REVIEWS.json' @@ -638,7 +748,11 @@ def main(): 'Batch1099 coverage head differs') require(len(row['files']) == row['changed_files'] == len({f['source_path'] for f in row['files']}), 'Batch1099 changed-file inventory incomplete') - check_review_completion(actual[number], decision) + # Later family rounds may update the live ledger projection; keep + # this archived batch bound to its own immutable review decision. + check_review_completion( + actual[number] if family_decisions[number] == decision else decision, + decision) for item in row['files']: require(item['action'] in {'retained', 'adapted', 'excluded', 'pending'}, 'Unknown file action') if item['action'] == 'pending': diff --git a/tests/test_pr_reconciliation.py b/tests/test_pr_reconciliation.py index db84e0f46b..d0aa168751 100644 --- a/tests/test_pr_reconciliation.py +++ b/tests/test_pr_reconciliation.py @@ -14,6 +14,33 @@ spec.loader.exec_module(checker) +class StartingHeadIntegrity(unittest.TestCase): + def setUp(self): + self.item = { + 'number': 3107, + 'starting_head': 'initial', + 'current_head': 'revised', + 'previously_reviewed_heads': ['initial'], + } + + def test_frozen_snapshot_requires_the_exact_initial_head(self): + with self.assertRaisesRegex(ValueError, '#3107: starting head changed'): + checker.check_starting_head(self.item, 'revised', True) + + def test_later_family_metadata_can_bind_a_revised_current_head(self): + checker.check_starting_head(self.item, 'revised', False) + + def test_later_head_requires_the_initial_head_in_review_history(self): + item = deepcopy(self.item) + item['previously_reviewed_heads'] = [] + with self.assertRaisesRegex(ValueError, '#3107: starting head changed'): + checker.check_starting_head(item, 'revised', False) + + def test_later_metadata_must_match_the_ledger_current_head(self): + with self.assertRaisesRegex(ValueError, '#3107: starting head changed'): + checker.check_starting_head(self.item, 'other-current', False) + + class FamilyDecision(unittest.TestCase): @classmethod def setUpClass(cls): @@ -70,9 +97,10 @@ def test_changed_or_missing_projection_fields_are_rejected(self): checker.check_family_decision(item, self.decision) def test_missing_closure_is_distinct_from_recorded_null(self): - decision = self.latest[620] - item = deepcopy(self.items[620]) + decision = next(row for row in self.families['k492'] if row['number'] == 620) self.assertIsNone(decision['closure']) + item = deepcopy(decision) + checker.check_family_decision(item, decision) item.pop('closure') with self.assertRaisesRegex(ValueError, '#620:.*closure'): checker.check_family_decision(item, decision) @@ -173,6 +201,13 @@ def test_forged_historical_pin_is_rejected(self): with self.assertRaisesRegex(ValueError, 'Changed integrated file'): checker.check_frontier890_file(item) + def test_reviewed_parallel_verifier_successor_passes_without_rewriting_pin(self): + checker.check_frontier890_file({ + 'integrated_path': 'scripts/verify_complex741_parallel.py', + 'integrated_sha256': + '616cff67233958647dd1e6f33dcc5ffc6132df68e0e1230dc768e820d00155a1', + }) + def test_successor_helper_drift_is_rejected(self): original_read = Path.read_bytes def read(path): @@ -188,15 +223,83 @@ def test_unrelated_file_changes_still_fail(self): checker.check_frontier890_file(item) +class ReviewedFamilySourceSuccessor(unittest.TestCase): + def test_reviewed_utf8_successor_passes_without_rewriting_source_pin(self): + checker.check_reviewed_family_source( + 'scripts/verify_hpe_lean_binding.py', + '52aa1d23641e4c716b43c98f6b883ad042087dd03a9d01369e8e6a735b07aa03') + + def test_reviewed_integer_row_successor_passes_without_rewriting_source_pin(self): + checker.check_reviewed_family_source( + 'research/complex-k492-owner-repair/code/hpe_audit_and_transport.py', + 'c9a05ff291016b870b4fc925b317abd9c3a604c73ffc8920dfdbbeb475e20aa3') + + def test_reviewed_frontier741_successors_pass_without_rewriting_pins(self): + for path, digest in ( + ('research/complex-factory5-resynthesis/SOURCE-PINS.json', + '79e00db34b721dc38830a7816f3126a09615d49c12f1b6a630147f1f50378f63'), + ('research/complex-factory5-resynthesis/verify.py', + 'edbae43b68c0e4f65978a2f9b9a739867128f4ef19d8bbe81d06ed2e5bc165f1'), + ('research/supplier-circuit-consolidation/SOURCES.json', + 'ef2568aac251c94d86736936b9d8c7507d224b129da2907d1bc6a1c2b5546742'), + ('docs/ci-verification.md', + 'a854022e0e1d5d4db4d60e586be3ea56005013ef14a1fc06d02bc06e8529c4b0'), + ('scripts/verify_selected_result.py', + 'd7fd929726b326aeeaf0a3996475adec88eee9aac09ae0bebeeaa0bc1fc8f199')): + with self.subTest(path=path): + checker.check_reviewed_family_source(path, digest) + + def test_unreviewed_source_successor_is_rejected(self): + with patch.object(Path, 'read_bytes', return_value=b'unreviewed source'), \ + self.assertRaisesRegex(ValueError, 'Changed reviewed family source'): + checker.check_reviewed_family_source( + 'scripts/verify_hpe_lean_binding.py', + '52aa1d23641e4c716b43c98f6b883ad042087dd03a9d01369e8e6a735b07aa03') + + +class ReviewedArchiveSuccessors(unittest.TestCase): + def test_batch1047_and_batch1099_successors_keep_historical_pins(self): + cases = ( + (checker.check_batch1047_file, + 'research/p112-free-sink-audit97/README.md', + 'c792fc8f5de0c784049904c6febf3eed9b20e2462b30dc643c72730470d72b79'), + (checker.check_batch1047_file, + 'research/p112-free-sink-audit97/independent.py', + '46806efe1ee7744c810a69981d471b42dfceaa336fee226991c55ba1edfd129f'), + (checker.check_batch1099_file, + 'research/r439-omission-atlas-seed81/README.md', + '6fc756df2aa0afe5b63985c1a5b4878659a3387250092e9ae5167f3316d5de9f'), + (checker.check_batch1099_file, + 'research/r439-omission-atlas-seed81/verify.py', + '127d7679fb26e264018548a1301b2f0f437d834eb1f0ffa215556243077ff866'), + ) + for check, path, predecessor in cases: + item = {'integrated_path': path, 'integrated_sha256': predecessor} + with self.subTest(path=path): + check(item) + forged = dict(item, integrated_sha256='0' * 64) + with self.assertRaises(ValueError): + check(forged) + original_read = Path.read_bytes + def read(target): + return original_read(target) + b' ' if target == ROOT / path else original_read(target) + with patch.object(Path, 'read_bytes', read), self.assertRaises(ValueError): + check(item) + + class AssertionSafetyRefresh(unittest.TestCase): def setUp(self): coverage = json.loads((ROOT / 'research/community-batch932-audit/CONTENT-COVERAGE.json').read_bytes()) self.items = [deepcopy(item) for row in coverage['pull_requests'].values() for item in row['files'] if item.get('integrated_path') in { - 'scripts/run_isolated_tests.py', 'tests/test_isolated_test_runner.py'}] + 'scripts/run_isolated_tests.py', 'tests/test_isolated_test_runner.py', + 'research/data-corner-performance/README.md', + 'research/data-corner-performance/SOURCE.json', + 'research/data-corner-performance/replay.py', + 'research/data-corner-performance/test_replay.py'}] def test_exact_accepted_successors_pass(self): - self.assertEqual(len(self.items), 2) + self.assertEqual(len(self.items), 6) for item in self.items: checker.check_batch932_file(item)