diff --git a/research/h25-cache-source-handoff/CHECKSUMS.sha256 b/research/h25-cache-source-handoff/CHECKSUMS.sha256 new file mode 100644 index 0000000000..cfba81e35c --- /dev/null +++ b/research/h25-cache-source-handoff/CHECKSUMS.sha256 @@ -0,0 +1,116 @@ +bff26544f0199d19ed7fcb9f2ecaa9fd3b145c3881efc494bd6f1bf3a6ae0234 CONTRIBUTOR-TASKS.md +82369ee64aa1c1a05b9b166fa888812428178ba5206cafa1bdae35a385cea010 MANIFEST.json +e882026f56e02090f62e57c8f1cb18fb7329e7648e889cd81538bb9550d73d9e README.md +c3bd33b2a58ef0e0472398b089795d50672ef26d209eaa961650703c406a9d5f STATUS.json +bbb1539c3a6e0021e226ba26ad5b4e780b7fbbfa7e04918a97e424f51835c975 VALIDATION.json +9c2c5ffdbfc692b48ddba780258df7694ba376ef43e7d5ab14e8760a041851ad snapshot/areas/cache-epoch-genuine-context-v1/cache_epoch_context_assembly_v1.py.txt +4eeb55857ff84aff47c17aaa3736bbeba2d525d1ed9ea129ffd35272669b00ff snapshot/areas/cache-epoch-products-v5/SOURCE-CASE-CONTEXTS.json +f279ab86fc17c6a517b035f19d56863919cbd8304de4e7d5332457c6159aec10 snapshot/areas/cache-epoch-products-v5/epoch_authority_products_v1.py.txt +d317c9866566cd6147c96566879f26f364e7e6801ac3eed0800b6ed8eedd01a2 snapshot/areas/cache-epoch-products-v5/epoch_cache_products_v1.py.txt +18679fd1eb6ae99c4b375756511427c26718f77674c2d8fcc490e25ceb47cba5 snapshot/areas/cache-epoch-products-v5/epoch_data_products_v1.py.txt +1e8202b7a4c17fc8dfb0a001085c26bf2ec26a69eb6c8501763773324c2bd9a1 snapshot/areas/cache-epoch-products-v5/epoch_scientific_driver_v1.py.txt +fcffe77b6a84d5b422b03e3d068924a701c1594cdb9ec305115827e3fad7d4b6 snapshot/areas/cache-full-contract-completion-v1/cache_epoch_source_controls.py.txt +4a11f90727c636bdbaaf683d1ac95aa9234324698fb594a7da92a92f6a45c7eb snapshot/areas/cache-s0308-source-completion-v1/contracts/CALLER-EQUALITY-DEFINITION-v1.json +6ab22ebb387f15f9a1fd91e257ecae649eb4b177af32d4652c2eaec061e3b48c snapshot/areas/cache-s0308-source-completion-v1/contracts/COMPLETE-SYMBOLIC-COST-DEFINITION-v1.json +e4599f79a9dd46a66c9b6cf63ceb7c03d19a0b98a550315b66d5b43dd544d691 snapshot/areas/cache-s0308-source-completion-v1/coverage/COVERAGE-SPEC-v1.json +4ee86e91c36c1651da2fa31506da27b3e479ae1883b0a0563818508cda839124 snapshot/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/FREEZE-v1.json +65b3d33068b0549ddb4a9e7e18a9912bebad69c309a8a29ae4fd532e9f428211 snapshot/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/g12_epoch_authority_selector_v1.py.txt +20a8a94e96bfa6213d4f04244dabecf059b4c8c7e8ffa7e9409a8b87cfeef494 snapshot/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/g12_epoch_cache_selector_v1.py.txt +a346025d5b6e2b26246521c6af6292643a4c2c3286b33ff3996dcf051cd6be26 snapshot/areas/cache-s0308-source-completion-v2/continuation/reference-producer-v2/g12_reference_driver_v2.py.txt +1f88ec187415abfd058728b7bf37fb6d9550e8bb3a080da4841d32be4019fe72 snapshot/areas/cache-s0308-source-completion-v2/g12-custody/DESIGN-v1.json +63abb4fb916b4b661dd47c0eadb62498c6adb96b2d6f0db338f1d89704e90f12 snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/COST-BILL-v1.json +f7a71e8cf29b002fc98fb9a4a847c2257e5f8daa366bef60339b4e321067f02f snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/DESIGN-CORRECTION-v2.json +31afc1a99450482602b8403482a748fa245c1a6cb4bd6ff42afbb1d143232c49 snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/FREEZE-v1.json +998972cf17cca61c10d17978e900390c6e22e8f48a2682de0fc591fba9d12ca2 snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/NEGATIVE-BRANCHES-v1.json +380416b2020654151afb95b716020ce5cdfaf68100e1841eb50a267d1af0b132 snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-INVERSE-v1.json +71e6de8edd7c3ac2f6a2b4aa859373e48f1b7caeec3e515ae4ad53466df40228 snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-MAP-v1.json +5080c15fc408ed0bae011c055920f410c57237150172c1d56da57f569caecd4c snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-READY-PINS-v1.json +8bb604ba1b101ba228e9a3b26a24f4369bb9712cf4f0381d2b0f504bfd925441 snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/STAGE-DERIVATION-v1.json +c5cc97adcc7648bb0a140253a78ef4433414dd9f8b079181c7ded42fc88b10f4 snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/STATIC-VERIFICATION-v1.json +a998407a80692769a6ff4000a6af06a2a567b21f28677eb13075de6e7b27c392 snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/INTEGRATION-EDGES-v1.json +c9d72a79ce3a828815d3d0370a1f95f210e1a41edeed767c55ff9d0614126fa4 snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_N22_custody_v1.py.txt +2a5d202dabd78d5de54fac29db7fdfaf8836866425d93842f2b22d747fa52d0c snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_P07_custody_v1.py.txt +28c1a44750b9745a5ad6e930f9a83cf256b3a90905f5f30d08a89aca54c828da snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_N22_custody_v1.py.txt +cae88bf247ee775d6d7fc1264cb2af1d487e4c19168ca787c7c16aba16452220 snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_P07_custody_v1.py.txt +3079a096df1072a83056f3f8a8cbf9e766fdddb488e36dddb36544c7929f988a snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_epoch_authority_custody_v1.py.txt +89ad17cfa90e895e2cb105e80cc57c82be4bf1a4a85a9d44322016c4344e3849 snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/g12_reference_cold_consumer_v1.py.txt +160b8c5de808b9b31532608a89fa5e209110caea132145cd431ffade4403079e snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/g12_reference_parent_v1.py.txt +43aaabc69841b0a90fae599011de85f4736f42ced64344c49d6cd93f20297f9f snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/integration/g12_reference_adapter_v1.py.txt +033cf284a1c011b861743efcee0281bea8859583e3fcad423cf80a1a80c24a92 snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/FREEZE.json +70f16a3c6e699f7dfbf66137af957323e244d039a647e75e8481855e6d61a610 snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/g12_reference_cold_consumer_v1.py.txt +5210fe391ef0361639676f6736cd6de1a6dfcb1f6bdaa58f2ced086e7cc35859 snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/g12_reference_parent_v1.py.txt +055e8192e28f2076c45ca22cf4dd1692e0a10e93eb9a2a1153d84229a72ef6fa snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/integration/g12_reference_adapter_v1.py.txt +ab8420e82d30e04185dcb1f42b213906c36b3103dc90cf1523c4d72c3efbe097 snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/DELTA-v2.json +716dfb49f659651eb41c0965a2189db6efcad1587b25e307b19523bfbd05c7d3 snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/FREEZE-v2.json +baa1dcf93dd4246be19f75fcedba9fdb614267c39ac89882ed22d234461b0466 snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/SOURCE-INVERSE-v2.json +04f0e573d6df6c0ef278758db0ac0b991e79a9904f5da3ce50d122b046f70c29 snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/SOURCE-MAP-v2.json +7589715b307f4e840634b0ad8686cf0e3e5b4981076dc6300f7f38a4b246d2f7 snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/STATIC-VERIFICATION-v2.json +a2d7fcaa1d3267bb43f14bfa1422759f77ede73641ed1f2a4fe55448792eec4a snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_N22_v2.py.txt +dc0e3c32a2412d8a872f8568ecbaff99a41785fadd79b0bbfc2341e0e51ede74 snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_P07_v2.py.txt +5b7709012375e7e6600840c2c86bf90f44382499d1670b15ce325b30c14a2b48 snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_support_N22_v2.py.txt +7c41cb423b18df69de48573817f92fae1a21be2751af7ad97768480ffa0b4a19 snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_support_P07_v2.py.txt +fccc3456630a4a60f8e7d3736501ca3d5c7cb4ef303aaba32862c90a98d6a6e4 snapshot/areas/cache-s0308-source-completion-v2/p02-feasibility/DESIGN-v3.json +fd77b4b09811cdae50e2a1a6ae128c84362e31d7fb56097427f10a2550b52e59 snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/COST-OWNERSHIP-v1.json +2b67b4823abb027e57d5e67d644d17d2c26e4577537d557c8198256d376d40ed snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/DRIVER-SOURCE-MAP-v1.json +257b4a73dba448ad4905ed900c2e457bd36844c160e13b12140ef47d7d2617fa snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/FREEZE-v1.json +748f83201125604233873b46b9d833f6bc49838554e8246353b81c5c1b1616ba snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/HELPER-SOURCE-MAP-v1.json +133950d6f513b234c62457e657a5d137443dedbc1a52afec38974654fc364054 snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/REFERENCE-BINDING-PROJECTION-SCHEMA-v1.json +2606738411455dd9b686d64e16a6b4161e873c3da8ceaf4da0114dfedf7770f6 snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/REFERENCE-BRIDGE-HANDOFF-v1.json +61b9a647cd8f744bb2452ec22356c7b291dd19acd8eb78ce384bc38c7e5b6626 snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/STATIC-SOURCE-PROOF-v1.json +298b9951e5a0971bf4a7eb19ee789688c860e828a429036fd7fbc37352d69c04 snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/cache_epoch_source_controls_p02_two_yield_v1.py.txt +d20b623af0d125b5be43073e3aa30da808cda385f21fabc5cc1877e7c0904227 snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/p02_driver_additions_v1.py.txt +833074436879e62c28a46bc365d368952736ced77a096ffb30398cea0a1b558e snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/p02_two_suspension_driver_v1.py.txt +deef1b8534a46e892cceeb755c4b9f5915816c31f8cdb255094d75a87a77baa7 snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/DESIGN-v3.json +e3b79641915661c18b2249818664579624c494ac19e2673d118f4c26b77f37bd snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/DESIGN-v4.json +40dbe4c87839c19552eaa2a653f1023d4d8946a4fe0d327dc207ac1823a73751 snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/EXACT-DELTA-v2-to-v3.json +a2acdd7089faa98ac0669dea665d9e1b92cff4b0e4a2469f522e2b18646053fe snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/EXACT-DELTA-v3-to-v4.json +c4c22b8464f691a13084c097f08ff1b377b4ba1daf312998fa6edfc113ef7dc2 snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/FREEZE-v3.json +a1825d27d6721c10b0442173aa4ff246fc115fb4bf9f29fb50e2d87091f763e9 snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/FREEZE-v4.json +e72330e2bff276552c7e3a749fea1acab095b41715d0cd79fc580f66d7a28298 snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/SOURCE-INTERFACES-v2.json +1d51889836e1dbc73f68c96395308bbd5de45279db1078c25d44402e2c414b05 snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/SOURCE-INTERFACES-v3.json +a1773498e738ac9a193f6772c117c5d35be7494c9e7e2abda16143d11045cf5a snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/SOURCE-PINS-v3.json +9e32514288fed2b1d2873387bf81861ffcd9e1b56d2ab4828be13a311e629106 snapshot/areas/cache-s0308-source-completion-v2/parent/AUTHORIZATION-v2.json +a849c4c78e1f150d305217bb7ebf29dec5f96a896dc888c2cfb9c564267a1336 snapshot/areas/cache-s0308-source-completion-v2/parent/BOUNDED-SOURCE-CANDIDATE-COVERAGE-v3.json +c88736fce81d737ae13ac1bf47500dc9d72920bd4910efe1b49074797d6e3231 snapshot/areas/fresh-controller-composition-v2/composed_controller.py.txt +7b3304eaf4884e3029df5095e2b0950c18d1544ad21431a07c033b85e53bd4f7 snapshot/areas/fresh-round-consumer-integration-v2/fresh_supervisor.py.txt +8c3c6420cbf9eeb978e3b4d6e1a8a47d409ef48714823bc3d781034084d602c2 snapshot/review/cache-s0308-source-completion-v2/fixed-case-independent/COLD-SOURCE-REVIEW-v2.json +fa4213006b1d524e0b0a23460947c5f1fcb29bbd4ecff57fff21c9d2333b29e1 snapshot/review/cache-s0308-source-completion-v2/fixed-case-independent/REQUEST-PENDING-SOURCE-REVIEW-v2.json +b607426361abe712116326629ddb016615000c160fd4670545d4afc3a18be411 snapshot/review/cache-s0308-source-completion-v2/fresh-independent/G08-DISPOSITION-REVIEW-v1.json +8889df7287b97c7af56f02f6eec5b5ef464bdcea7e21d47a3ddb3adcca7b41b9 snapshot/review/cache-s0308-source-completion-v2/fresh-independent/P08-CONTROLLER-REVIEW-v2.json +dd78fbbe4060e16f58294ee4e8e0c667943e50ed0052d10500a1ac50da9f1a75 snapshot/review/cache-s0308-source-completion-v2/g12-custody-independent/G12-CUSTODY-DESIGN-CLARIFICATION-v1.json +748af02d5766eae9a1f60890780817e3230e91d61b374e0c5e0b4621852e1ae3 snapshot/review/cache-s0308-source-completion-v2/g12-custody-independent/G12-CUSTODY-DESIGN-REVIEW-v1.json +a9261f686d4fbe6ca40258335231a730dc7e3319be7cedf7c39e189a57c7f367 snapshot/review/cache-s0308-source-completion-v2/g12-custody-independent/G12-CUSTODY-SOURCE-SCOPE-CLARIFICATION-v1.json +0d611f41462951d2d875947ba0e156121d876324afa21a4713fd546c873736ad snapshot/review/cache-s0308-source-completion-v2/g12-custody-independent/SOURCE-SCOPE-CLARIFICATION-FREEZE-v1.json +197247e53e93e0a4385adce804ae278fe48806d6ba829d3827c7ea8a7fb727d2 snapshot/review/cache-s0308-source-completion-v2/g12-custody-source-independent/G12-CUSTODY-SOURCE-REVIEW-v1.json +37303886fe57deff19a59f0b1c37974ee5550ce637ac626ce0aa183a5a654f4f snapshot/review/cache-s0308-source-completion-v2/g12-custody-source-independent/STATIC-SOURCE-VERIFICATION-v1.json +add8245e21be2a902556837090dd454989bb5e4f97e4821fefdcf7b41c2b308d snapshot/review/cache-s0308-source-completion-v2/g12-protocol-independent/FREEZE-v2.json +feecd63be55243fe2a7d07da8ac1f7cfcec6558362e694b82219a1be232ab7bc snapshot/review/cache-s0308-source-completion-v2/g12-protocol-independent/G12-CANDIDATE-PROTOCOL-REVIEW-v1.json +9b9043fa83f1a052a6708105431db20efd37b88bc0f23adc36491edd27b867ee snapshot/review/cache-s0308-source-completion-v2/g12-protocol-independent/G12-CANDIDATE-PROTOCOL-REVIEW-v2.json +d78a97545c84854b5da0905485c232030f7b4d3884bd51088c2d3ffa604632dd snapshot/review/cache-s0308-source-completion-v2/g12-protocol-independent/GRAPH-ADDENDUM-v1.json +435dc0887b9d8c97c9304fc047b2d9e3e64e7a21c475037b50b9df36c4c0b858 snapshot/review/cache-s0308-source-completion-v2/g12-protocol-independent/SUCCESSOR-DELTA-STATIC-v2.json +fce81e866a7dac29721db03f18d6d720ae78a61b81f1f84333f34b626364a227 snapshot/review/cache-s0308-source-completion-v2/g12-protocol-independent/verify_candidate_delta_v2.py.txt +b8ba9b1fcea3b386c0fd360ea15fae0d56651fd85bba039671a4bc43cd6bf65a snapshot/review/cache-s0308-source-completion-v2/g13-binding-independent/REVIEW-v1.json +3449872d91c4d6425fea5126cae70192ebd959cf5af2e1f69ec85c795c86b4c9 snapshot/review/cache-s0308-source-completion-v2/late-independent/SOURCE-REVIEW-v2.json +814461756b5a55908a0f8400afc4b3617389d28e5dc7b079ee51021da28c7517 snapshot/review/cache-s0308-source-completion-v2/p02-independent/P02-DESIGN-v2-REVIEW-v1.json +1b2b0b8894c9d18db4df0446789f614c421a953882bdc59ec0f44a3bf26ae543 snapshot/review/cache-s0308-source-completion-v2/p02-independent/P02-DESIGN-v3-DELTA-REVIEW-v1.json +de9651b280643ec11eb0e7f8e38d79a3aac5568dc88e129387121acab39ac66d snapshot/review/cache-s0308-source-completion-v2/p02-protocol-independent/INDEPENDENT-STATIC-EVIDENCE-v1.json +6f649d3dc9893836b731c01f0ab2ad5830aae88e393ab5f0def9e92d8ea52c7d snapshot/review/cache-s0308-source-completion-v2/p02-protocol-independent/P02-PROTOCOL-REVIEW-v1.json +4ec4a33e95a458a8f8c98c6d2db8d251c3c87fd951caf113b8c3b39b35e6a34f snapshot/review/cache-s0308-source-completion-v2/p02-reference-independent/INDEPENDENT-STATIC-EVIDENCE-v1.json +b53c92ef3774d159fde456eb0545d34365d67e0c0a6bfd944693fda044d28373 snapshot/review/cache-s0308-source-completion-v2/p02-reference-independent/P02-REFERENCE-DESIGN-v3-REVIEW-v1.json +cef8eadbb4e51fd61d650c9a8b24add49ee5c5d4a5cc356504b5c1c9bcc32e2f snapshot/review/cache-s0308-source-completion-v2/p02-reference-independent/P02-REFERENCE-DESIGN-v4-DELTA-REVIEW-v1.json +13d8887ad7a9869de5710aa7713a93ec3e723d2f75433196a6158579d26a3a95 snapshot/review/cache-s0308-source-completion-v2/roles-armed-independent/SC4-SOURCE-REVIEW-v1.json +3ed0d29f385508c96eb940ee31d7d4b142374a1b636f295af57f4660c2575bd9 snapshot/review/cache-s0308-source-completion-v2/roles-armed-independent/SMALL-CASES-SOURCE-REVIEW-v1.json +0c0ed109bd6d1bdbfa457c2f25c437b5a97cad44fd590b989d0fb74cd20544ce snapshot/review/strict-source-review-20261030T231709Z/parent/NEXT-SOURCE-CHECKLIST-v1.json +bd882e3dadb1b6aeaa63ee824f1a1c58f8ef2546b6840a2bffa46885a184d3eb snapshot/run_guarded_v3.py.txt +8ac3ccf5a3923d46c3f470d2cb1d2d1440fb72ad4344f4c08501c12d7be6ad1d snapshot/stages/combined-finite-v8/areas/cache-validity/cache_controls_v8.py.txt +6e507bb0c7e00d090a60289fddb6c55e90c946d0850c42c3c5e3e15c27604a68 snapshot/stages/combined-finite-v8/baseline/engine/compare_side_verifier.py.txt +df989a831aac43cc1af95169dad8c64a7548760e6e1f96976da996703f2c8f7a snapshot/stages/combined-finite-v8/baseline/engine/finite_controls.py.txt +e473c38245c3668715b5a78dfe980b2fe3ed0d0c9b8c97c666fbae6ecf1fffd5 snapshot/stages/combined-finite-v8/baseline/engine/native_backend.py.txt +e9c3c9194a08718bd1575c1cf08c6c6772d3b644c2e274c25a84a1f9249d06cc snapshot/stages/combined-finite-v8/baseline/engine/native_gf2.c.txt +9c994378171c20a91539418d93cb8387e1daa93465d6862beefea90e12999c2a snapshot/stages/combined-finite-v8/baseline/engine/profile_side_verifier.py.txt +d623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1 snapshot/stages/combined-finite-v8/baseline/engine/source/complex_circuit.py.txt +0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b snapshot/stages/combined-finite-v8/baseline/engine/source/complex_network.py.txt +0d976d2eb6b845f20d4a3396591a806f966688b88693cd6a5f8a0c9e48925e36 snapshot/stages/combined-finite-v8/baseline/full_driver.py.txt +c00c9c215d0b81a91dd5dffddacfd2225c4bc40fe3ba43c7b93677bb686591cc snapshot/stages/combined-finite-v8/integration/data_adapters.py.txt +f5a2d33f2b4d3651f214156a0e7094c2bb516ce2d5ab7698d18c11f98f35dee0 snapshot/stages/combined-finite-v8/integration/full_driver.py.txt +9cbb7368f89e71d1e6cc46db5dc77efed3e03ed2a801c98c88fe316e4d9f3ef2 snapshot/stages/combined-finite-v8/integration/probe_binding_v3.py.txt diff --git a/research/h25-cache-source-handoff/CONTRIBUTOR-TASKS.md b/research/h25-cache-source-handoff/CONTRIBUTOR-TASKS.md new file mode 100644 index 0000000000..349cd2c6da --- /dev/null +++ b/research/h25-cache-source-handoff/CONTRIBUTOR-TASKS.md @@ -0,0 +1,33 @@ +# Contributor tasks: N22, P07 and P02 + +Please claim a task on this PR with the exact branch/head, intended files and a bounded work period. Link resulting fixes or reviews back to the same conversation. Local source work is paused and has released these tasks; this request does not reserve the work for Clear1nsight. Coordinate N22/P07 together and let P02 proceed independently. Preserve this frozen snapshot and publish corrections as new files/versions or a separate scoped package. + +## A. Repair and review G12 for N22 and P07 + +**Why it matters.** N22 must reach the real capacity boundary through 85,196 genuine retained original entries and a pending next original store. P07 additionally checks that the original fallback completes every remaining case with the independent original count and outputs. Both depend on trustworthy reference production, transport and cleanup. The accepted local protocol is already supplied; reuse its exact accepted scope instead of starting over. + +**First repair: identity representation.** In [parent source](snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/g12_reference_parent_v1.py.txt), lines 1645-1648, `candidate_pin` emits the manifest identity as a tuple. The [consumer](snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/g12_reference_cold_consumer_v1.py.txt) installs that value in a FileRecord whose validator requires an exact dictionary. Choose one handoff representation and an explicit checked conversion at the consumer boundary, preserving every identity/type/currentness check. The review identifies exact spans and the subsequent string-key accesses. + +**Second repair: cleanup and first failure.** Bare `finally` close loops in the parent preflight paths can replace an earlier error with a later close error and stop before closing remaining descriptors. Reuse the existing first-primary/ordered-secondary handling. Every known descriptor close must be attempted independently, with the original primary preserved and unknown/failed cleanup still non-successful. Preserve both original rejected branches in the new evidence. + +**Required independent review.** Inspect the exact changed pins, source maps and reversible changes to predecessors. Verify both known findings are resolved. Then finish the explicitly unreviewed remainder: all 18 negative branches, schema predicates, syscall races, allocation failures, ownership/currentness and aliases, and cleanup outcomes. Do not treat the author's static counts or an AST parse as independent correctness evidence. Review the actual parent-to-adapter-to-consumer-to-candidate path, not separate compatible-looking snippets. + +**Acceptance for this task.** An independent source review must explicitly accept the corrected integrated scope and identify remaining external obligations. A repaired draft, accepted design or isolated local protocol does not by itself add N22/P07 body credit. Whole source adoption and runtime results remain separate. + +**Avoid expanding scope.** The [scope clarification](snapshot/review/cache-s0308-source-completion-v2/g12-custody-independent/G12-CUSTODY-SOURCE-SCOPE-CLARIFICATION-v1.json) removes the added requirement to construct a new enclosing accounting API as an original source prerequisite. Preserve the full symbolic cost categories and unknown tails. Do not reopen a generic accounting-framework project to fix these two source defects. + +## B. Implement and review P02's accepted reference bridge + +**Why it matters.** P02 requires full typed/order equality for original roles, rank events, trace and outputs, plus original native-counter evidence. Authentic references come from the original baseline and candidate modes. Keep their producers and the optimized candidate's independent comparison boundary unchanged. + +**First step.** Implement the exact [v4 design](snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/DESIGN-v4.json), using [source interfaces](snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/SOURCE-INTERFACES-v3.json) and [source pins](snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/SOURCE-PINS-v3.json). The local helper and two-suspension driver are already supplied. The missing bridge has four scoped pieces: reference parent, original-producer adapter, cold consumer and a minimally derived reference-bound driver. Do not imply these four pieces have already passed source review. + +**Critical ordering.** Validate the original pure namespace, run and validate the native lane, and require both known writer chains and their streams/descriptors closed. Only then retain both outputs, compare all six raw outputs and full trace, jointly recheck identities and seal the pair. Earlier retention of only the pure side was rejected; preserve that failure history. Unknown writers, aliases, closure or source drift must reject. + +**Acceptance for this task.** Supply exact source pins/maps, a complete inverse to the accepted local driver, unchanged original helper/producers, and independent review of the parent/adapter/consumer/driver graph, strict decoding, artifact custody, first-error preservation, cleanup and symbolic costs. The design review already accepted the corrected mechanism at its stated scope; implementation review remains required. + +## C. Independent review and later qualification + +Reviewers can separately assess A or B after freezing the author's exact files. Return accepted scope, concrete findings, checked evidence and unreviewed obligations. Do not count both a design and its implementation as separate original candidates. Preserve the fixed denominator of 52 and the distinction between bounded source acceptance, complete adoption, actual execution, full-caller validation and measured gain. + +Before any future runtime work, establish a complete source closure and explicit owner, guards, resource limits and funding for that environment. Preserve original oracles, assertions, types/order, rejection controls, raw failures and full cost accounting. No scientific replay or target execution is requested as part of this archive's integrity check. A new contributor's runtime allowance must be declared independently; the historical local 2400-second allowance is not transferable. diff --git a/research/h25-cache-source-handoff/MANIFEST.json b/research/h25-cache-source-handoff/MANIFEST.json new file mode 100644 index 0000000000..fb859de15c --- /dev/null +++ b/research/h25-cache-source-handoff/MANIFEST.json @@ -0,0 +1,2593 @@ +{ + "base_commit": "2485805a6d47f36ea83ddde6327d453ac82d44dc", + "files": [ + { + "bytes": 81941, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-genuine-context-v1/cache_epoch_context_assembly_v1.py", + "path": "snapshot/areas/cache-epoch-genuine-context-v1/cache_epoch_context_assembly_v1.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "9c2c5ffdbfc692b48ddba780258df7694ba376ef43e7d5ab14e8760a041851ad" + }, + { + "bytes": 19587, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/SOURCE-CASE-CONTEXTS.json", + "path": "snapshot/areas/cache-epoch-products-v5/SOURCE-CASE-CONTEXTS.json", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "4eeb55857ff84aff47c17aaa3736bbeba2d525d1ed9ea129ffd35272669b00ff" + }, + { + "bytes": 137642, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_authority_products_v1.py", + "path": "snapshot/areas/cache-epoch-products-v5/epoch_authority_products_v1.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "f279ab86fc17c6a517b035f19d56863919cbd8304de4e7d5332457c6159aec10" + }, + { + "bytes": 171075, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_cache_products_v1.py", + "path": "snapshot/areas/cache-epoch-products-v5/epoch_cache_products_v1.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "d317c9866566cd6147c96566879f26f364e7e6801ac3eed0800b6ed8eedd01a2" + }, + { + "bytes": 103903, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_data_products_v1.py", + "path": "snapshot/areas/cache-epoch-products-v5/epoch_data_products_v1.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "18679fd1eb6ae99c4b375756511427c26718f77674c2d8fcc490e25ceb47cba5" + }, + { + "bytes": 89606, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_scientific_driver_v1.py", + "path": "snapshot/areas/cache-epoch-products-v5/epoch_scientific_driver_v1.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "1e8202b7a4c17fc8dfb0a001085c26bf2ec26a69eb6c8501763773324c2bd9a1" + }, + { + "bytes": 65591, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-full-contract-completion-v1/cache_epoch_source_controls.py", + "path": "snapshot/areas/cache-full-contract-completion-v1/cache_epoch_source_controls.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "fcffe77b6a84d5b422b03e3d068924a701c1594cdb9ec305115827e3fad7d4b6" + }, + { + "bytes": 10515, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v1/contracts/CALLER-EQUALITY-DEFINITION-v1.json", + "path": "snapshot/areas/cache-s0308-source-completion-v1/contracts/CALLER-EQUALITY-DEFINITION-v1.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "4a11f90727c636bdbaaf683d1ac95aa9234324698fb594a7da92a92f6a45c7eb" + }, + { + "bytes": 9184, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v1/contracts/COMPLETE-SYMBOLIC-COST-DEFINITION-v1.json", + "path": "snapshot/areas/cache-s0308-source-completion-v1/contracts/COMPLETE-SYMBOLIC-COST-DEFINITION-v1.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "6ab22ebb387f15f9a1fd91e257ecae649eb4b177af32d4652c2eaec061e3b48c" + }, + { + "bytes": 85486, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v1/coverage/COVERAGE-SPEC-v1.json", + "path": "snapshot/areas/cache-s0308-source-completion-v1/coverage/COVERAGE-SPEC-v1.json", + "publication_mode": "0644", + "selection_reason": "selected-source-or-review", + "sha256": "e4599f79a9dd46a66c9b6cf63ceb7c03d19a0b98a550315b66d5b43dd544d691" + }, + { + "bytes": 2012, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/FREEZE-v1.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/FREEZE-v1.json", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "4ee86e91c36c1651da2fa31506da27b3e479ae1883b0a0563818508cda839124" + }, + { + "bytes": 137642, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/g12_epoch_authority_selector_v1.py", + "path": "snapshot/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/g12_epoch_authority_selector_v1.py.txt", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "65b3d33068b0549ddb4a9e7e18a9912bebad69c309a8a29ae4fd532e9f428211" + }, + { + "bytes": 172718, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/g12_epoch_cache_selector_v1.py", + "path": "snapshot/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/g12_epoch_cache_selector_v1.py.txt", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "20a8a94e96bfa6213d4f04244dabecf059b4c8c7e8ffa7e9409a8b87cfeef494" + }, + { + "bytes": 70246, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/reference-producer-v2/g12_reference_driver_v2.py", + "path": "snapshot/areas/cache-s0308-source-completion-v2/continuation/reference-producer-v2/g12_reference_driver_v2.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "a346025d5b6e2b26246521c6af6292643a4c2c3286b33ff3996dcf051cd6be26" + }, + { + "bytes": 10141, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/COST-BILL-v1.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/COST-BILL-v1.json", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "63abb4fb916b4b661dd47c0eadb62498c6adb96b2d6f0db338f1d89704e90f12" + }, + { + "bytes": 4347, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/DESIGN-CORRECTION-v2.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/DESIGN-CORRECTION-v2.json", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "f7a71e8cf29b002fc98fb9a4a847c2257e5f8daa366bef60339b4e321067f02f" + }, + { + "bytes": 10990, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/FREEZE-v1.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/FREEZE-v1.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "31afc1a99450482602b8403482a748fa245c1a6cb4bd6ff42afbb1d143232c49" + }, + { + "bytes": 40911, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/NEGATIVE-BRANCHES-v1.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/NEGATIVE-BRANCHES-v1.json", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "998972cf17cca61c10d17978e900390c6e22e8f48a2682de0fc591fba9d12ca2" + }, + { + "bytes": 9784, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-INVERSE-v1.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-INVERSE-v1.json", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "380416b2020654151afb95b716020ce5cdfaf68100e1841eb50a267d1af0b132" + }, + { + "bytes": 89494, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-MAP-v1.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-MAP-v1.json", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "71e6de8edd7c3ac2f6a2b4aa859373e48f1b7caeec3e515ae4ad53466df40228" + }, + { + "bytes": 3767, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-READY-PINS-v1.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-READY-PINS-v1.json", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "5080c15fc408ed0bae011c055920f410c57237150172c1d56da57f569caecd4c" + }, + { + "bytes": 5367, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/STAGE-DERIVATION-v1.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/STAGE-DERIVATION-v1.json", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "8bb604ba1b101ba228e9a3b26a24f4369bb9712cf4f0381d2b0f504bfd925441" + }, + { + "bytes": 3143, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/STATIC-VERIFICATION-v1.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/STATIC-VERIFICATION-v1.json", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "c5cc97adcc7648bb0a140253a78ef4433414dd9f8b079181c7ded42fc88b10f4" + }, + { + "bytes": 4392, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/INTEGRATION-EDGES-v1.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/INTEGRATION-EDGES-v1.json", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "a998407a80692769a6ff4000a6af06a2a567b21f28677eb13075de6e7b27c392" + }, + { + "bytes": 128363, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_N22_custody_v1.py", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_N22_custody_v1.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "c9d72a79ce3a828815d3d0370a1f95f210e1a41edeed767c55ff9d0614126fa4" + }, + { + "bytes": 128363, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_P07_custody_v1.py", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_P07_custody_v1.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "2a5d202dabd78d5de54fac29db7fdfaf8836866425d93842f2b22d747fa52d0c" + }, + { + "bytes": 33549, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_N22_custody_v1.py", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_N22_custody_v1.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "28c1a44750b9745a5ad6e930f9a83cf256b3a90905f5f30d08a89aca54c828da" + }, + { + "bytes": 33549, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_P07_custody_v1.py", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_P07_custody_v1.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "cae88bf247ee775d6d7fc1264cb2af1d487e4c19168ca787c7c16aba16452220" + }, + { + "bytes": 139604, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_epoch_authority_custody_v1.py", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_epoch_authority_custody_v1.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "3079a096df1072a83056f3f8a8cbf9e766fdddb488e36dddb36544c7929f988a" + }, + { + "bytes": 61159, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/g12_reference_cold_consumer_v1.py", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/g12_reference_cold_consumer_v1.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "89ad17cfa90e895e2cb105e80cc57c82be4bf1a4a85a9d44322016c4344e3849" + }, + { + "bytes": 94080, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/g12_reference_parent_v1.py", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/g12_reference_parent_v1.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "160b8c5de808b9b31532608a89fa5e209110caea132145cd431ffade4403079e" + }, + { + "bytes": 21740, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/integration/g12_reference_adapter_v1.py", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/integration/g12_reference_adapter_v1.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "43aaabc69841b0a90fae599011de85f4736f42ced64344c49d6cd93f20297f9f" + }, + { + "bytes": 699, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/FREEZE.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/FREEZE.json", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "033cf284a1c011b861743efcee0281bea8859583e3fcad423cf80a1a80c24a92" + }, + { + "bytes": 59367, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/g12_reference_cold_consumer_v1.py", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/g12_reference_cold_consumer_v1.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "70f16a3c6e699f7dfbf66137af957323e244d039a647e75e8481855e6d61a610" + }, + { + "bytes": 92203, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/g12_reference_parent_v1.py", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/g12_reference_parent_v1.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "5210fe391ef0361639676f6736cd6de1a6dfcb1f6bdaa58f2ced086e7cc35859" + }, + { + "bytes": 19770, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/integration/g12_reference_adapter_v1.py", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/integration/g12_reference_adapter_v1.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "055e8192e28f2076c45ca22cf4dd1692e0a10e93eb9a2a1153d84229a72ef6fa" + }, + { + "bytes": 60181, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody/DESIGN-v1.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody/DESIGN-v1.json", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "1f88ec187415abfd058728b7bf37fb6d9550e8bb3a080da4841d32be4019fe72" + }, + { + "bytes": 3304, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/DELTA-v2.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/DELTA-v2.json", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "ab8420e82d30e04185dcb1f42b213906c36b3103dc90cf1523c4d72c3efbe097" + }, + { + "bytes": 4764, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/FREEZE-v2.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/FREEZE-v2.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "716dfb49f659651eb41c0965a2189db6efcad1587b25e307b19523bfbd05c7d3" + }, + { + "bytes": 7471, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/SOURCE-INVERSE-v2.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/SOURCE-INVERSE-v2.json", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "baa1dcf93dd4246be19f75fcedba9fdb614267c39ac89882ed22d234461b0466" + }, + { + "bytes": 17778, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/SOURCE-MAP-v2.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/SOURCE-MAP-v2.json", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "04f0e573d6df6c0ef278758db0ac0b991e79a9904f5da3ce50d122b046f70c29" + }, + { + "bytes": 32201, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/STATIC-VERIFICATION-v2.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/STATIC-VERIFICATION-v2.json", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "7589715b307f4e840634b0ad8686cf0e3e5b4981076dc6300f7f38a4b246d2f7" + }, + { + "bytes": 128331, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_N22_v2.py", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_N22_v2.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "a2d7fcaa1d3267bb43f14bfa1422759f77ede73641ed1f2a4fe55448792eec4a" + }, + { + "bytes": 128331, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_P07_v2.py", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_P07_v2.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "dc0e3c32a2412d8a872f8568ecbaff99a41785fadd79b0bbfc2341e0e51ede74" + }, + { + "bytes": 33517, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_support_N22_v2.py", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_support_N22_v2.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "5b7709012375e7e6600840c2c86bf90f44382499d1670b15ce325b30c14a2b48" + }, + { + "bytes": 33517, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_support_P07_v2.py", + "path": "snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_support_P07_v2.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "7c41cb423b18df69de48573817f92fae1a21be2751af7ad97768480ffa0b4a19" + }, + { + "bytes": 32255, + "original_mode": "0o664", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-feasibility/DESIGN-v3.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/p02-feasibility/DESIGN-v3.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "fccc3456630a4a60f8e7d3736501ca3d5c7cb4ef303aaba32862c90a98d6a6e4" + }, + { + "bytes": 4715, + "original_mode": "0o664", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-implementation/COST-OWNERSHIP-v1.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/COST-OWNERSHIP-v1.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "fd77b4b09811cdae50e2a1a6ae128c84362e31d7fb56097427f10a2550b52e59" + }, + { + "bytes": 39443, + "original_mode": "0o664", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-implementation/DRIVER-SOURCE-MAP-v1.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/DRIVER-SOURCE-MAP-v1.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "2b67b4823abb027e57d5e67d644d17d2c26e4577537d557c8198256d376d40ed" + }, + { + "bytes": 6581, + "original_mode": "0o664", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-implementation/FREEZE-v1.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/FREEZE-v1.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "257b4a73dba448ad4905ed900c2e457bd36844c160e13b12140ef47d7d2617fa" + }, + { + "bytes": 1626, + "original_mode": "0o664", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-implementation/HELPER-SOURCE-MAP-v1.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/HELPER-SOURCE-MAP-v1.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "748f83201125604233873b46b9d833f6bc49838554e8246353b81c5c1b1616ba" + }, + { + "bytes": 15170, + "original_mode": "0o664", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-implementation/REFERENCE-BINDING-PROJECTION-SCHEMA-v1.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/REFERENCE-BINDING-PROJECTION-SCHEMA-v1.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "133950d6f513b234c62457e657a5d137443dedbc1a52afec38974654fc364054" + }, + { + "bytes": 10071, + "original_mode": "0o664", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-implementation/REFERENCE-BRIDGE-HANDOFF-v1.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/REFERENCE-BRIDGE-HANDOFF-v1.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "2606738411455dd9b686d64e16a6b4161e873c3da8ceaf4da0114dfedf7770f6" + }, + { + "bytes": 13229, + "original_mode": "0o664", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-implementation/STATIC-SOURCE-PROOF-v1.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/STATIC-SOURCE-PROOF-v1.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "61b9a647cd8f744bb2452ec22356c7b291dd19acd8eb78ce384bc38c7e5b6626" + }, + { + "bytes": 65648, + "original_mode": "0o664", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-implementation/cache_epoch_source_controls_p02_two_yield_v1.py", + "path": "snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/cache_epoch_source_controls_p02_two_yield_v1.py.txt", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "298b9951e5a0971bf4a7eb19ee789688c860e828a429036fd7fbc37352d69c04" + }, + { + "bytes": 32602, + "original_mode": "0o664", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-implementation/p02_driver_additions_v1.py.txt", + "path": "snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/p02_driver_additions_v1.py.txt", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "d20b623af0d125b5be43073e3aa30da808cda385f21fabc5cc1877e7c0904227" + }, + { + "bytes": 169084, + "original_mode": "0o664", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-implementation/p02_two_suspension_driver_v1.py", + "path": "snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/p02_two_suspension_driver_v1.py.txt", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "833074436879e62c28a46bc365d368952736ced77a096ffb30398cea0a1b558e" + }, + { + "bytes": 53696, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-reference-bridge/DESIGN-v3.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/DESIGN-v3.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "deef1b8534a46e892cceeb755c4b9f5915816c31f8cdb255094d75a87a77baa7" + }, + { + "bytes": 55647, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-reference-bridge/DESIGN-v4.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/DESIGN-v4.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "e3b79641915661c18b2249818664579624c494ac19e2673d118f4c26b77f37bd" + }, + { + "bytes": 51666, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-reference-bridge/EXACT-DELTA-v2-to-v3.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/EXACT-DELTA-v2-to-v3.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "40dbe4c87839c19552eaa2a653f1023d4d8946a4fe0d327dc207ac1823a73751" + }, + { + "bytes": 9724, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-reference-bridge/EXACT-DELTA-v3-to-v4.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/EXACT-DELTA-v3-to-v4.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "a2acdd7089faa98ac0669dea665d9e1b92cff4b0e4a2469f522e2b18646053fe" + }, + { + "bytes": 2904, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-reference-bridge/FREEZE-v3.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/FREEZE-v3.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "c4c22b8464f691a13084c097f08ff1b377b4ba1daf312998fa6edfc113ef7dc2" + }, + { + "bytes": 2982, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-reference-bridge/FREEZE-v4.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/FREEZE-v4.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "a1825d27d6721c10b0442173aa4ff246fc115fb4bf9f29fb50e2d87091f763e9" + }, + { + "bytes": 11276, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-reference-bridge/SOURCE-INTERFACES-v2.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/SOURCE-INTERFACES-v2.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "e72330e2bff276552c7e3a749fea1acab095b41715d0cd79fc580f66d7a28298" + }, + { + "bytes": 12560, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-reference-bridge/SOURCE-INTERFACES-v3.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/SOURCE-INTERFACES-v3.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "1d51889836e1dbc73f68c96395308bbd5de45279db1078c25d44402e2c414b05" + }, + { + "bytes": 10881, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-reference-bridge/SOURCE-PINS-v3.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/SOURCE-PINS-v3.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "a1773498e738ac9a193f6772c117c5d35be7494c9e7e2abda16143d11045cf5a" + }, + { + "bytes": 2545, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/parent/AUTHORIZATION-v2.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/parent/AUTHORIZATION-v2.json", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "9e32514288fed2b1d2873387bf81861ffcd9e1b56d2ab4828be13a311e629106" + }, + { + "bytes": 14166, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/parent/BOUNDED-SOURCE-CANDIDATE-COVERAGE-v3.json", + "path": "snapshot/areas/cache-s0308-source-completion-v2/parent/BOUNDED-SOURCE-CANDIDATE-COVERAGE-v3.json", + "publication_mode": "0644", + "selection_reason": "selected-source-or-review", + "sha256": "a849c4c78e1f150d305217bb7ebf29dec5f96a896dc888c2cfb9c564267a1336" + }, + { + "bytes": 81343, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/fresh-controller-composition-v2/composed_controller.py", + "path": "snapshot/areas/fresh-controller-composition-v2/composed_controller.py.txt", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "c88736fce81d737ae13ac1bf47500dc9d72920bd4910efe1b49074797d6e3231" + }, + { + "bytes": 44563, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/fresh-round-consumer-integration-v2/fresh_supervisor.py", + "path": "snapshot/areas/fresh-round-consumer-integration-v2/fresh_supervisor.py.txt", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "7b3304eaf4884e3029df5095e2b0950c18d1544ad21431a07c033b85e53bd4f7" + }, + { + "bytes": 24225, + "original_mode": "0o664", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/fixed-case-independent/COLD-SOURCE-REVIEW-v2.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/fixed-case-independent/COLD-SOURCE-REVIEW-v2.json", + "publication_mode": "0644", + "selection_reason": "historical-bounded-acceptance-review", + "sha256": "8c3c6420cbf9eeb978e3b4d6e1a8a47d409ef48714823bc3d781034084d602c2" + }, + { + "bytes": 9142, + "original_mode": "0o664", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/fixed-case-independent/REQUEST-PENDING-SOURCE-REVIEW-v2.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/fixed-case-independent/REQUEST-PENDING-SOURCE-REVIEW-v2.json", + "publication_mode": "0644", + "selection_reason": "historical-bounded-acceptance-review", + "sha256": "fa4213006b1d524e0b0a23460947c5f1fcb29bbd4ecff57fff21c9d2333b29e1" + }, + { + "bytes": 8202, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/fresh-independent/G08-DISPOSITION-REVIEW-v1.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/fresh-independent/G08-DISPOSITION-REVIEW-v1.json", + "publication_mode": "0644", + "selection_reason": "historical-bounded-acceptance-review", + "sha256": "b607426361abe712116326629ddb016615000c160fd4670545d4afc3a18be411" + }, + { + "bytes": 4222, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/fresh-independent/P08-CONTROLLER-REVIEW-v2.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/fresh-independent/P08-CONTROLLER-REVIEW-v2.json", + "publication_mode": "0644", + "selection_reason": "historical-bounded-acceptance-review", + "sha256": "8889df7287b97c7af56f02f6eec5b5ef464bdcea7e21d47a3ddb3adcca7b41b9" + }, + { + "bytes": 10062, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-custody-independent/G12-CUSTODY-DESIGN-CLARIFICATION-v1.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/g12-custody-independent/G12-CUSTODY-DESIGN-CLARIFICATION-v1.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "dd78fbbe4060e16f58294ee4e8e0c667943e50ed0052d10500a1ac50da9f1a75" + }, + { + "bytes": 26124, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-custody-independent/G12-CUSTODY-DESIGN-REVIEW-v1.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/g12-custody-independent/G12-CUSTODY-DESIGN-REVIEW-v1.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "748af02d5766eae9a1f60890780817e3230e91d61b374e0c5e0b4621852e1ae3" + }, + { + "bytes": 10874, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-custody-independent/G12-CUSTODY-SOURCE-SCOPE-CLARIFICATION-v1.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/g12-custody-independent/G12-CUSTODY-SOURCE-SCOPE-CLARIFICATION-v1.json", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "a9261f686d4fbe6ca40258335231a730dc7e3319be7cedf7c39e189a57c7f367" + }, + { + "bytes": 714, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-custody-independent/SOURCE-SCOPE-CLARIFICATION-FREEZE-v1.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/g12-custody-independent/SOURCE-SCOPE-CLARIFICATION-FREEZE-v1.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "0d611f41462951d2d875947ba0e156121d876324afa21a4713fd546c873736ad" + }, + { + "bytes": 20090, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-custody-source-independent/G12-CUSTODY-SOURCE-REVIEW-v1.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/g12-custody-source-independent/G12-CUSTODY-SOURCE-REVIEW-v1.json", + "publication_mode": "0644", + "selection_reason": "selected-source-or-review", + "sha256": "197247e53e93e0a4385adce804ae278fe48806d6ba829d3827c7ea8a7fb727d2" + }, + { + "bytes": 15591, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-custody-source-independent/STATIC-SOURCE-VERIFICATION-v1.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/g12-custody-source-independent/STATIC-SOURCE-VERIFICATION-v1.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "37303886fe57deff19a59f0b1c37974ee5550ce637ac626ce0aa183a5a654f4f" + }, + { + "bytes": 3091, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-protocol-independent/FREEZE-v2.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/g12-protocol-independent/FREEZE-v2.json", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "add8245e21be2a902556837090dd454989bb5e4f97e4821fefdcf7b41c2b308d" + }, + { + "bytes": 33560, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-protocol-independent/G12-CANDIDATE-PROTOCOL-REVIEW-v1.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/g12-protocol-independent/G12-CANDIDATE-PROTOCOL-REVIEW-v1.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "feecd63be55243fe2a7d07da8ac1f7cfcec6558362e694b82219a1be232ab7bc" + }, + { + "bytes": 29269, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-protocol-independent/G12-CANDIDATE-PROTOCOL-REVIEW-v2.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/g12-protocol-independent/G12-CANDIDATE-PROTOCOL-REVIEW-v2.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "9b9043fa83f1a052a6708105431db20efd37b88bc0f23adc36491edd27b867ee" + }, + { + "bytes": 13092, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-protocol-independent/GRAPH-ADDENDUM-v1.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/g12-protocol-independent/GRAPH-ADDENDUM-v1.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "d78a97545c84854b5da0905485c232030f7b4d3884bd51088c2d3ffa604632dd" + }, + { + "bytes": 21505, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-protocol-independent/SUCCESSOR-DELTA-STATIC-v2.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/g12-protocol-independent/SUCCESSOR-DELTA-STATIC-v2.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "435dc0887b9d8c97c9304fc047b2d9e3e64e7a21c475037b50b9df36c4c0b858" + }, + { + "bytes": 11202, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-protocol-independent/verify_candidate_delta_v2.py", + "path": "snapshot/review/cache-s0308-source-completion-v2/g12-protocol-independent/verify_candidate_delta_v2.py.txt", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "fce81e866a7dac29721db03f18d6d720ae78a61b81f1f84333f34b626364a227" + }, + { + "bytes": 5950, + "original_mode": "0o664", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g13-binding-independent/REVIEW-v1.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/g13-binding-independent/REVIEW-v1.json", + "publication_mode": "0644", + "selection_reason": "historical-bounded-acceptance-review", + "sha256": "b8ba9b1fcea3b386c0fd360ea15fae0d56651fd85bba039671a4bc43cd6bf65a" + }, + { + "bytes": 58859, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/late-independent/SOURCE-REVIEW-v2.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/late-independent/SOURCE-REVIEW-v2.json", + "publication_mode": "0644", + "selection_reason": "historical-bounded-acceptance-review", + "sha256": "3449872d91c4d6425fea5126cae70192ebd959cf5af2e1f69ec85c795c86b4c9" + }, + { + "bytes": 15254, + "original_mode": "0o664", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/p02-independent/P02-DESIGN-v2-REVIEW-v1.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/p02-independent/P02-DESIGN-v2-REVIEW-v1.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "814461756b5a55908a0f8400afc4b3617389d28e5dc7b079ee51021da28c7517" + }, + { + "bytes": 6019, + "original_mode": "0o664", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/p02-independent/P02-DESIGN-v3-DELTA-REVIEW-v1.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/p02-independent/P02-DESIGN-v3-DELTA-REVIEW-v1.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "1b2b0b8894c9d18db4df0446789f614c421a953882bdc59ec0f44a3bf26ae543" + }, + { + "bytes": 11480, + "original_mode": "0o664", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/p02-protocol-independent/INDEPENDENT-STATIC-EVIDENCE-v1.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/p02-protocol-independent/INDEPENDENT-STATIC-EVIDENCE-v1.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "de9651b280643ec11eb0e7f8e38d79a3aac5568dc88e129387121acab39ac66d" + }, + { + "bytes": 13606, + "original_mode": "0o664", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/p02-protocol-independent/P02-PROTOCOL-REVIEW-v1.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/p02-protocol-independent/P02-PROTOCOL-REVIEW-v1.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "6f649d3dc9893836b731c01f0ab2ad5830aae88e393ab5f0def9e92d8ea52c7d" + }, + { + "bytes": 15242, + "original_mode": "0o664", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/p02-reference-independent/INDEPENDENT-STATIC-EVIDENCE-v1.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/p02-reference-independent/INDEPENDENT-STATIC-EVIDENCE-v1.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "4ec4a33e95a458a8f8c98c6d2db8d251c3c87fd951caf113b8c3b39b35e6a34f" + }, + { + "bytes": 12596, + "original_mode": "0o664", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/p02-reference-independent/P02-REFERENCE-DESIGN-v3-REVIEW-v1.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/p02-reference-independent/P02-REFERENCE-DESIGN-v3-REVIEW-v1.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "b53c92ef3774d159fde456eb0545d34365d67e0c0a6bfd944693fda044d28373" + }, + { + "bytes": 7407, + "original_mode": "0o664", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/p02-reference-independent/P02-REFERENCE-DESIGN-v4-DELTA-REVIEW-v1.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/p02-reference-independent/P02-REFERENCE-DESIGN-v4-DELTA-REVIEW-v1.json", + "publication_mode": "0644", + "selection_reason": "selected-source-or-review", + "sha256": "cef8eadbb4e51fd61d650c9a8b24add49ee5c5d4a5cc356504b5c1c9bcc32e2f" + }, + { + "bytes": 16145, + "original_mode": "0o664", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/roles-armed-independent/SC4-SOURCE-REVIEW-v1.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/roles-armed-independent/SC4-SOURCE-REVIEW-v1.json", + "publication_mode": "0644", + "selection_reason": "historical-bounded-acceptance-review", + "sha256": "13d8887ad7a9869de5710aa7713a93ec3e723d2f75433196a6158579d26a3a95" + }, + { + "bytes": 7874, + "original_mode": "0o664", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/roles-armed-independent/SMALL-CASES-SOURCE-REVIEW-v1.json", + "path": "snapshot/review/cache-s0308-source-completion-v2/roles-armed-independent/SMALL-CASES-SOURCE-REVIEW-v1.json", + "publication_mode": "0644", + "selection_reason": "historical-bounded-acceptance-review", + "sha256": "3ed0d29f385508c96eb940ee31d7d4b142374a1b636f295af57f4660c2575bd9" + }, + { + "bytes": 8029, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/strict-source-review-20261030T231709Z/parent/NEXT-SOURCE-CHECKLIST-v1.json", + "path": "snapshot/review/strict-source-review-20261030T231709Z/parent/NEXT-SOURCE-CHECKLIST-v1.json", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "0c0ed109bd6d1bdbfa457c2f25c437b5a97cad44fd590b989d0fb74cd20544ce" + }, + { + "bytes": 15493, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/run_guarded_v3.py", + "path": "snapshot/run_guarded_v3.py.txt", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "bd882e3dadb1b6aeaa63ee824f1a1c58f8ef2546b6840a2bffa46885a184d3eb" + }, + { + "bytes": 100708, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/cache-validity/cache_controls_v8.py", + "path": "snapshot/stages/combined-finite-v8/areas/cache-validity/cache_controls_v8.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "8ac3ccf5a3923d46c3f470d2cb1d2d1440fb72ad4344f4c08501c12d7be6ad1d" + }, + { + "bytes": 10571, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/engine/compare_side_verifier.py", + "path": "snapshot/stages/combined-finite-v8/baseline/engine/compare_side_verifier.py.txt", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "6e507bb0c7e00d090a60289fddb6c55e90c946d0850c42c3c5e3e15c27604a68" + }, + { + "bytes": 23815, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/engine/finite_controls.py", + "path": "snapshot/stages/combined-finite-v8/baseline/engine/finite_controls.py.txt", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "df989a831aac43cc1af95169dad8c64a7548760e6e1f96976da996703f2c8f7a" + }, + { + "bytes": 20334, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/engine/native_backend.py", + "path": "snapshot/stages/combined-finite-v8/baseline/engine/native_backend.py.txt", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "e473c38245c3668715b5a78dfe980b2fe3ed0d0c9b8c97c666fbae6ecf1fffd5" + }, + { + "bytes": 7425, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/engine/native_gf2.c", + "path": "snapshot/stages/combined-finite-v8/baseline/engine/native_gf2.c.txt", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "e9c3c9194a08718bd1575c1cf08c6c6772d3b644c2e274c25a84a1f9249d06cc" + }, + { + "bytes": 8959, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/engine/profile_side_verifier.py", + "path": "snapshot/stages/combined-finite-v8/baseline/engine/profile_side_verifier.py.txt", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "9c994378171c20a91539418d93cb8387e1daa93465d6862beefea90e12999c2a" + }, + { + "bytes": 19732, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/engine/source/complex_circuit.py", + "path": "snapshot/stages/combined-finite-v8/baseline/engine/source/complex_circuit.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "d623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1" + }, + { + "bytes": 6105, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/engine/source/complex_network.py", + "path": "snapshot/stages/combined-finite-v8/baseline/engine/source/complex_network.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b" + }, + { + "bytes": 20178, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/full_driver.py", + "path": "snapshot/stages/combined-finite-v8/baseline/full_driver.py.txt", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "0d976d2eb6b845f20d4a3396591a806f966688b88693cd6a5f8a0c9e48925e36" + }, + { + "bytes": 80465, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/data_adapters.py", + "path": "snapshot/stages/combined-finite-v8/integration/data_adapters.py.txt", + "publication_mode": "0644", + "selection_reason": "required-original-source-or-direct-freeze-input", + "sha256": "c00c9c215d0b81a91dd5dffddacfd2225c4bc40fe3ba43c7b93677bb686591cc" + }, + { + "bytes": 38851, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/full_driver.py", + "path": "snapshot/stages/combined-finite-v8/integration/full_driver.py.txt", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "f5a2d33f2b4d3651f214156a0e7094c2bb516ce2d5ab7698d18c11f98f35dee0" + }, + { + "bytes": 40799, + "original_mode": "0o444", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/probe_binding_v3.py", + "path": "snapshot/stages/combined-finite-v8/integration/probe_binding_v3.py.txt", + "publication_mode": "0644", + "selection_reason": "direct-pinned-input", + "sha256": "9cbb7368f89e71d1e6cc46db5dc77efed3e03ed2a801c98c88fe316e4d9f3ef2" + } + ], + "measured_gain": false, + "original_bytes_conserved": true, + "reference_index": [ + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/CLI-FAULT-SOURCE-PINS-v3.json", + "sha256": "d3733658f54067edcc518c4222559b0f2bc040aab6e43b6facf30dc98a8798fb" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v2/epoch_case_pre_role_failure_v2.py", + "sha256": "69df433711521d709c7045c8b6f9cd13ad92f4165d4b533d559b5447c46464e8" + }, + { + "bundled_path": "snapshot/areas/cache-epoch-products-v5/epoch_scientific_driver_v1.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_scientific_driver_v1.py", + "sha256": "1e8202b7a4c17fc8dfb0a001085c26bf2ec26a69eb6c8501763773324c2bd9a1" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/BILL-AND-RESOURCE.json", + "sha256": "61109d429c4d78df3ec55e65a5c4879c58342c49a8ac4fe30f3892ecc117570d" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-full-contract-completion-v1/CONTROL-BILL.json", + "sha256": "33d3a55103c8c92e7f29220e1774544dba1cfd6a19d2cf1f3aa0a4589c5a4511" + }, + { + "bundled_path": "snapshot/areas/cache-full-contract-completion-v1/cache_epoch_source_controls.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-full-contract-completion-v1/cache_epoch_source_controls.py", + "sha256": "fcffe77b6a84d5b422b03e3d068924a701c1594cdb9ec305115827e3fad7d4b6" + }, + { + "bundled_path": "snapshot/areas/cache-epoch-products-v5/SOURCE-CASE-CONTEXTS.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/SOURCE-CASE-CONTEXTS.json", + "sha256": "4eeb55857ff84aff47c17aaa3736bbeba2d525d1ed9ea129ffd35272669b00ff" + }, + { + "bundled_path": "snapshot/areas/cache-epoch-products-v5/epoch_cache_products_v1.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_cache_products_v1.py", + "sha256": "d317c9866566cd6147c96566879f26f364e7e6801ac3eed0800b6ed8eedd01a2" + }, + { + "bundled_path": "snapshot/areas/cache-epoch-products-v5/epoch_data_products_v1.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_data_products_v1.py", + "sha256": "18679fd1eb6ae99c4b375756511427c26718f77674c2d8fcc490e25ceb47cba5" + }, + { + "bundled_path": "snapshot/areas/cache-epoch-products-v5/epoch_authority_products_v1.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_authority_products_v1.py", + "sha256": "f279ab86fc17c6a517b035f19d56863919cbd8304de4e7d5332457c6159aec10" + }, + { + "bundled_path": "snapshot/stages/combined-finite-v8/baseline/engine/source/complex_circuit.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/engine/source/complex_circuit.py", + "sha256": "d623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1" + }, + { + "bundled_path": "snapshot/stages/combined-finite-v8/baseline/engine/source/complex_network.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/engine/source/complex_network.py", + "sha256": "0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b" + }, + { + "bundled_path": "snapshot/stages/combined-finite-v8/areas/cache-validity/cache_controls_v8.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/cache-validity/cache_controls_v8.py", + "sha256": "8ac3ccf5a3923d46c3f470d2cb1d2d1440fb72ad4344f4c08501c12d7be6ad1d" + }, + { + "bundled_path": "snapshot/stages/combined-finite-v8/integration/data_adapters.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/data_adapters.py", + "sha256": "c00c9c215d0b81a91dd5dffddacfd2225c4bc40fe3ba43c7b93677bb686591cc" + }, + { + "bundled_path": "snapshot/areas/cache-epoch-genuine-context-v1/cache_epoch_context_assembly_v1.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-genuine-context-v1/cache_epoch_context_assembly_v1.py", + "sha256": "9c2c5ffdbfc692b48ddba780258df7694ba376ef43e7d5ab14e8760a041851ad" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/CONTROL-FAULT-SOURCE-PINS.json", + "sha256": "acd47a2097495eb3f3455ec579fa408fc9126140ac3cb2e77ddc1804ad70491b" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/CLI-FAULT-SOURCE-PINS-v4.json", + "sha256": "7900cfc574374ffc21d9f8d512ccc20d7ed02980d138bf84e86b89756cbd883a" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/OUTER-FAULT-SOURCE-PINS-v5.json", + "sha256": "c4d8d7daffa60f3ae0a97995829127d0fcf144a01a61b840ed9d3bbcc368ed4d" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v1/parent/AUTHORIZATION-v1.json", + "sha256": "6a1c639c18ceb486290a9d45290d0e1b189e85ace94c518021d8997054a5905f" + }, + { + "bundled_path": "snapshot/review/strict-source-review-20261030T231709Z/parent/NEXT-SOURCE-CHECKLIST-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/strict-source-review-20261030T231709Z/parent/NEXT-SOURCE-CHECKLIST-v1.json", + "sha256": "0c0ed109bd6d1bdbfa457c2f25c437b5a97cad44fd590b989d0fb74cd20544ce" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v1/contracts/COMPLETE-SYMBOLIC-COST-DEFINITION-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v1/contracts/COMPLETE-SYMBOLIC-COST-DEFINITION-v1.json", + "sha256": "6ab22ebb387f15f9a1fd91e257ecae649eb4b177af32d4652c2eaec061e3b48c" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody/DESIGN-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody/DESIGN-v1.json", + "sha256": "1f88ec187415abfd058728b7bf37fb6d9550e8bb3a080da4841d32be4019fe72" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/parent/AUTHORIZATION-v2.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/parent/AUTHORIZATION-v2.json", + "sha256": "9e32514288fed2b1d2873387bf81861ffcd9e1b56d2ab4828be13a311e629106" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/FREEZE.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/FREEZE.json", + "sha256": "033cf284a1c011b861743efcee0281bea8859583e3fcad423cf80a1a80c24a92" + }, + { + "bundled_path": "snapshot/review/cache-s0308-source-completion-v2/g12-custody-independent/G12-CUSTODY-SOURCE-SCOPE-CLARIFICATION-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-custody-independent/G12-CUSTODY-SOURCE-SCOPE-CLARIFICATION-v1.json", + "sha256": "a9261f686d4fbe6ca40258335231a730dc7e3319be7cedf7c39e189a57c7f367" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/COST-BILL-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/COST-BILL-v1.json", + "sha256": "63abb4fb916b4b661dd47c0eadb62498c6adb96b2d6f0db338f1d89704e90f12" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/DESIGN-CORRECTION-v2.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/DESIGN-CORRECTION-v2.json", + "sha256": "f7a71e8cf29b002fc98fb9a4a847c2257e5f8daa366bef60339b4e321067f02f" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/NEGATIVE-BRANCHES-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/NEGATIVE-BRANCHES-v1.json", + "sha256": "998972cf17cca61c10d17978e900390c6e22e8f48a2682de0fc591fba9d12ca2" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-INVERSE-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-INVERSE-v1.json", + "sha256": "380416b2020654151afb95b716020ce5cdfaf68100e1841eb50a267d1af0b132" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-MAP-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-MAP-v1.json", + "sha256": "71e6de8edd7c3ac2f6a2b4aa859373e48f1b7caeec3e515ae4ad53466df40228" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-READY-PINS-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-READY-PINS-v1.json", + "sha256": "5080c15fc408ed0bae011c055920f410c57237150172c1d56da57f569caecd4c" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/STAGE-DERIVATION-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/STAGE-DERIVATION-v1.json", + "sha256": "8bb604ba1b101ba228e9a3b26a24f4369bb9712cf4f0381d2b0f504bfd925441" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/STATIC-VERIFICATION-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/STATIC-VERIFICATION-v1.json", + "sha256": "c5cc97adcc7648bb0a140253a78ef4433414dd9f8b079181c7ded42fc88b10f4" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/INTEGRATION-EDGES-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/INTEGRATION-EDGES-v1.json", + "sha256": "a998407a80692769a6ff4000a6af06a2a567b21f28677eb13075de6e7b27c392" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_N22_custody_v1.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_N22_custody_v1.py", + "sha256": "c9d72a79ce3a828815d3d0370a1f95f210e1a41edeed767c55ff9d0614126fa4" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_P07_custody_v1.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_P07_custody_v1.py", + "sha256": "2a5d202dabd78d5de54fac29db7fdfaf8836866425d93842f2b22d747fa52d0c" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_N22_custody_v1.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_N22_custody_v1.py", + "sha256": "28c1a44750b9745a5ad6e930f9a83cf256b3a90905f5f30d08a89aca54c828da" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_P07_custody_v1.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_P07_custody_v1.py", + "sha256": "cae88bf247ee775d6d7fc1264cb2af1d487e4c19168ca787c7c16aba16452220" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_epoch_authority_custody_v1.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_epoch_authority_custody_v1.py", + "sha256": "3079a096df1072a83056f3f8a8cbf9e766fdddb488e36dddb36544c7929f988a" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/g12_reference_cold_consumer_v1.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/g12_reference_cold_consumer_v1.py", + "sha256": "89ad17cfa90e895e2cb105e80cc57c82be4bf1a4a85a9d44322016c4344e3849" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/g12_reference_parent_v1.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/g12_reference_parent_v1.py", + "sha256": "160b8c5de808b9b31532608a89fa5e209110caea132145cd431ffade4403079e" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/integration/g12_reference_adapter_v1.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/integration/g12_reference_adapter_v1.py", + "sha256": "43aaabc69841b0a90fae599011de85f4736f42ced64344c49d6cd93f20297f9f" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/g12_reference_cold_consumer_v1.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/g12_reference_cold_consumer_v1.py", + "sha256": "70f16a3c6e699f7dfbf66137af957323e244d039a647e75e8481855e6d61a610" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/g12_reference_parent_v1.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/g12_reference_parent_v1.py", + "sha256": "5210fe391ef0361639676f6736cd6de1a6dfcb1f6bdaa58f2ced086e7cc35859" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/integration/g12_reference_adapter_v1.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/integration/g12_reference_adapter_v1.py", + "sha256": "055e8192e28f2076c45ca22cf4dd1692e0a10e93eb9a2a1153d84229a72ef6fa" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/continuation/reference-producer-v2/g12_reference_driver_v2.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/reference-producer-v2/g12_reference_driver_v2.py", + "sha256": "a346025d5b6e2b26246521c6af6292643a4c2c3286b33ff3996dcf051cd6be26" + }, + { + "bundled_path": "snapshot/run_guarded_v3.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/run_guarded_v3.py", + "sha256": "bd882e3dadb1b6aeaa63ee824f1a1c58f8ef2546b6840a2bffa46885a184d3eb" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/reference-custody-map/REPORT-v1.json", + "sha256": "014f127a932b0c0f7e931fce4efd57372b93fc19c976df350601b829a45cda92" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody/SOURCE-PINS-v1.json", + "sha256": "e586cb66935781f85668822ba8f118353652e223d9aa57835d206c714cc2c702" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/SOURCE-INVERSE-v2.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/SOURCE-INVERSE-v2.json", + "sha256": "baa1dcf93dd4246be19f75fcedba9fdb614267c39ac89882ed22d234461b0466" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/FREEZE-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/FREEZE-v1.json", + "sha256": "4ee86e91c36c1651da2fa31506da27b3e479ae1883b0a0563818508cda839124" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/SOURCE-MAP-v2.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/SOURCE-MAP-v2.json", + "sha256": "04f0e573d6df6c0ef278758db0ac0b991e79a9904f5da3ce50d122b046f70c29" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/STATIC-VERIFICATION-v2.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/STATIC-VERIFICATION-v2.json", + "sha256": "7589715b307f4e840634b0ad8686cf0e3e5b4981076dc6300f7f38a4b246d2f7" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/DELTA-v2.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/DELTA-v2.json", + "sha256": "ab8420e82d30e04185dcb1f42b213906c36b3103dc90cf1523c4d72c3efbe097" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_N22_v2.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_N22_v2.py", + "sha256": "a2d7fcaa1d3267bb43f14bfa1422759f77ede73641ed1f2a4fe55448792eec4a" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_P07_v2.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_P07_v2.py", + "sha256": "dc0e3c32a2412d8a872f8568ecbaff99a41785fadd79b0bbfc2341e0e51ede74" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_support_N22_v2.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_support_N22_v2.py", + "sha256": "5b7709012375e7e6600840c2c86bf90f44382499d1670b15ce325b30c14a2b48" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_support_P07_v2.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_support_P07_v2.py", + "sha256": "7c41cb423b18df69de48573817f92fae1a21be2751af7ad97768480ffa0b4a19" + }, + { + "bundled_path": "snapshot/review/cache-s0308-source-completion-v2/g12-protocol-independent/FREEZE-v2.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-protocol-independent/FREEZE-v2.json", + "sha256": "add8245e21be2a902556837090dd454989bb5e4f97e4821fefdcf7b41c2b308d" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/g12_candidate_driver_N22_v1.py", + "sha256": "46f515efa7ebdc60e20b64ef2ebdfb542ecb8c90371d339a951ccabb2a205e09" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/g12_candidate_driver_P07_v1.py", + "sha256": "e6f1038f5a75466d95fd3e8c3d44df483d76f97deff9f966bd6140b2d0bc28a7" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/g12_candidate_driver_support_N22_v1.py", + "sha256": "b4a8ec11d4b390d8a8f7167d8149b067be0572f977a1f2286c1719052437fccb" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/g12_candidate_driver_support_P07_v1.py", + "sha256": "a918ff01875267c4945a0dbc6d914a904c3eb38b9f5de8256bdc47394b19dcb7" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/SOURCE-INVERSE-v1.json", + "sha256": "083d171828102a8c138810d05f9110fc6136c2017a09ab11d8d63c433afd387e" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/helper-variant-v1/cache_epoch_source_controls_p07_yield_v1.py", + "sha256": "eae1fca1f951a572a3487e5136454d80f16124cc02fef296793830c50431b061" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/g12_epoch_authority_selector_v1.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/g12_epoch_authority_selector_v1.py", + "sha256": "65b3d33068b0549ddb4a9e7e18a9912bebad69c309a8a29ae4fd532e9f428211" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/g12_cache_selector_source_v1.py", + "sha256": "a9b4019ce368b6f89553ceb98c5451593d0d11ebda699dcb626cab323297375c" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/g12_common_source_v1.py", + "sha256": "8ac6902915ec8afb09914fc5f229e175d864e6aae9fe367f127e1bbd654ed42a" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/g12_epoch_cache_selector_v1.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/g12_epoch_cache_selector_v1.py", + "sha256": "20a8a94e96bfa6213d4f04244dabecf059b4c8c7e8ffa7e9409a8b87cfeef494" + }, + { + "bundled_path": "snapshot/stages/combined-finite-v8/baseline/engine/native_backend.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/engine/native_backend.py", + "sha256": "e473c38245c3668715b5a78dfe980b2fe3ed0d0c9b8c97c666fbae6ecf1fffd5" + }, + { + "bundled_path": "snapshot/stages/combined-finite-v8/baseline/full_driver.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/full_driver.py", + "sha256": "0d976d2eb6b845f20d4a3396591a806f966688b88693cd6a5f8a0c9e48925e36" + }, + { + "bundled_path": "snapshot/review/cache-s0308-source-completion-v2/p02-independent/P02-DESIGN-v2-REVIEW-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/p02-independent/P02-DESIGN-v2-REVIEW-v1.json", + "sha256": "814461756b5a55908a0f8400afc4b3617389d28e5dc7b079ee51021da28c7517" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-feasibility/DESIGN-v2.json", + "sha256": "1135d7813cde42dcdb4465941d13c9d0f088947936a2129eba2c484b694911ac" + }, + { + "bundled_path": "snapshot/stages/combined-finite-v8/baseline/engine/compare_side_verifier.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/engine/compare_side_verifier.py", + "sha256": "6e507bb0c7e00d090a60289fddb6c55e90c946d0850c42c3c5e3e15c27604a68" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v1/coverage/COVERAGE-SPEC-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v1/coverage/COVERAGE-SPEC-v1.json", + "sha256": "e4599f79a9dd46a66c9b6cf63ceb7c03d19a0b98a550315b66d5b43dd544d691" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/armed-context/disposition-v1/g08_p01_n12_disposition_driver_v1.py", + "sha256": "ebbc86771d2397a1f0392dec414fd3fd1fb170c612c91a81d5bf412ba63ebc23" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/armed-remaining/P02-EXACT-GATE-v1.json", + "sha256": "02394a44baabf0b893511352acf9d78f1a0e4a0e975cfab7374193e9f87eab79" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/fresh-independent/G12-DESIGN-REVIEW-v1.json", + "sha256": "a5199f838e8b8dfc05357ad097cdea6baa3a1b697780d504703869e6ff61a38f" + }, + { + "bundled_path": "snapshot/stages/combined-finite-v8/baseline/engine/native_gf2.c.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/engine/native_gf2.c", + "sha256": "e9c3c9194a08718bd1575c1cf08c6c6772d3b644c2e274c25a84a1f9249d06cc" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/fresh-independent/P07-HELPER-REVIEW-v1.json", + "sha256": "92d70867fa5df4802467631cca12950312c6abdf70584c05181d8af2f60e36d2" + }, + { + "bundled_path": "snapshot/stages/combined-finite-v8/baseline/engine/profile_side_verifier.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/engine/profile_side_verifier.py", + "sha256": "9c994378171c20a91539418d93cb8387e1daa93465d6862beefea90e12999c2a" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-feasibility/DESIGN-v1.json", + "sha256": "b7af3e131d5b0084da1507df7a2728e3af17e79346b874e60f6c134fb49c1bf4" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/p02_two_suspension_driver_v1.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-implementation/p02_two_suspension_driver_v1.py", + "sha256": "833074436879e62c28a46bc365d368952736ced77a096ffb30398cea0a1b558e" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/cache_epoch_source_controls_p02_two_yield_v1.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-implementation/cache_epoch_source_controls_p02_two_yield_v1.py", + "sha256": "298b9951e5a0971bf4a7eb19ee789688c860e828a429036fd7fbc37352d69c04" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-feasibility/EXACT-DELTA-v2-to-v3.json", + "sha256": "f6d744ecdafab1463465a486ec4e7a68fb958881830864504e171e6d6f99c0a1" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/p02-feasibility/DESIGN-v3.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-feasibility/DESIGN-v3.json", + "sha256": "fccc3456630a4a60f8e7d3736501ca3d5c7cb4ef303aaba32862c90a98d6a6e4" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/p02_driver_additions_v1.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-implementation/p02_driver_additions_v1.py.txt", + "sha256": "d20b623af0d125b5be43073e3aa30da808cda385f21fabc5cc1877e7c0904227" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/HELPER-SOURCE-MAP-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-implementation/HELPER-SOURCE-MAP-v1.json", + "sha256": "748f83201125604233873b46b9d833f6bc49838554e8246353b81c5c1b1616ba" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/DRIVER-SOURCE-MAP-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-implementation/DRIVER-SOURCE-MAP-v1.json", + "sha256": "2b67b4823abb027e57d5e67d644d17d2c26e4577537d557c8198256d376d40ed" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/REFERENCE-BINDING-PROJECTION-SCHEMA-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-implementation/REFERENCE-BINDING-PROJECTION-SCHEMA-v1.json", + "sha256": "133950d6f513b234c62457e657a5d137443dedbc1a52afec38974654fc364054" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/REFERENCE-BRIDGE-HANDOFF-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-implementation/REFERENCE-BRIDGE-HANDOFF-v1.json", + "sha256": "2606738411455dd9b686d64e16a6b4161e873c3da8ceaf4da0114dfedf7770f6" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/STATIC-SOURCE-PROOF-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-implementation/STATIC-SOURCE-PROOF-v1.json", + "sha256": "61b9a647cd8f744bb2452ec22356c7b291dd19acd8eb78ce384bc38c7e5b6626" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/COST-OWNERSHIP-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-implementation/COST-OWNERSHIP-v1.json", + "sha256": "fd77b4b09811cdae50e2a1a6ae128c84362e31d7fb56097427f10a2550b52e59" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-feasibility/FREEZE-v2.json", + "sha256": "f5bc03a851bf0736b610281a080d3b0d151a37b8589cc31287edfeb84d883f6d" + }, + { + "bundled_path": "snapshot/review/cache-s0308-source-completion-v2/p02-independent/P02-DESIGN-v3-DELTA-REVIEW-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/p02-independent/P02-DESIGN-v3-DELTA-REVIEW-v1.json", + "sha256": "1b2b0b8894c9d18db4df0446789f614c421a953882bdc59ec0f44a3bf26ae543" + }, + { + "bundled_path": "snapshot/review/cache-s0308-source-completion-v2/p02-protocol-independent/P02-PROTOCOL-REVIEW-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/p02-protocol-independent/P02-PROTOCOL-REVIEW-v1.json", + "sha256": "6f649d3dc9893836b731c01f0ab2ad5830aae88e393ab5f0def9e92d8ea52c7d" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/FREEZE-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-implementation/FREEZE-v1.json", + "sha256": "257b4a73dba448ad4905ed900c2e457bd36844c160e13b12140ef47d7d2617fa" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/SOURCE-INTERFACES-v2.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-reference-bridge/SOURCE-INTERFACES-v2.json", + "sha256": "e72330e2bff276552c7e3a749fea1acab095b41715d0cd79fc580f66d7a28298" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v1/contracts/CALLER-EQUALITY-DEFINITION-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v1/contracts/CALLER-EQUALITY-DEFINITION-v1.json", + "sha256": "4a11f90727c636bdbaaf683d1ac95aa9234324698fb594a7da92a92f6a45c7eb" + }, + { + "bundled_path": "snapshot/review/cache-s0308-source-completion-v2/g12-custody-independent/SOURCE-SCOPE-CLARIFICATION-FREEZE-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-custody-independent/SOURCE-SCOPE-CLARIFICATION-FREEZE-v1.json", + "sha256": "0d611f41462951d2d875947ba0e156121d876324afa21a4713fd546c873736ad" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/SOURCE-INTERFACES-v3.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-reference-bridge/SOURCE-INTERFACES-v3.json", + "sha256": "1d51889836e1dbc73f68c96395308bbd5de45279db1078c25d44402e2c414b05" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/SOURCE-PINS-v3.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-reference-bridge/SOURCE-PINS-v3.json", + "sha256": "a1773498e738ac9a193f6772c117c5d35be7494c9e7e2abda16143d11045cf5a" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-reference-bridge/DESIGN-v2.json", + "sha256": "4a3f5b8b73c0ae082a7b3cc91edaaf33f53a2a495361c7dbfa08774811ce884a" + }, + { + "bundled_path": "snapshot/review/cache-s0308-source-completion-v2/p02-reference-independent/P02-REFERENCE-DESIGN-v3-REVIEW-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/p02-reference-independent/P02-REFERENCE-DESIGN-v3-REVIEW-v1.json", + "sha256": "b53c92ef3774d159fde456eb0545d34365d67e0c0a6bfd944693fda044d28373" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/DESIGN-v3.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-reference-bridge/DESIGN-v3.json", + "sha256": "deef1b8534a46e892cceeb755c4b9f5915816c31f8cdb255094d75a87a77baa7" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/DESIGN-v4.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-reference-bridge/DESIGN-v4.json", + "sha256": "e3b79641915661c18b2249818664579624c494ac19e2673d118f4c26b77f37bd" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/EXACT-DELTA-v2-to-v3.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-reference-bridge/EXACT-DELTA-v2-to-v3.json", + "sha256": "40dbe4c87839c19552eaa2a653f1023d4d8946a4fe0d327dc207ac1823a73751" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-reference-bridge/FREEZE-v2.json", + "sha256": "05dd24ccb8fad4757f83b3682820ed1cbfde56c84e600930074613260036c24d" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/EXACT-DELTA-v3-to-v4.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-reference-bridge/EXACT-DELTA-v3-to-v4.json", + "sha256": "a2acdd7089faa98ac0669dea665d9e1b92cff4b0e4a2469f522e2b18646053fe" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/FREEZE-v3.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-reference-bridge/FREEZE-v3.json", + "sha256": "c4c22b8464f691a13084c097f08ff1b377b4ba1daf312998fa6edfc113ef7dc2" + }, + { + "bundled_path": "snapshot/areas/fresh-round-consumer-integration-v2/fresh_supervisor.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/fresh-round-consumer-integration-v2/fresh_supervisor.py", + "sha256": "7b3304eaf4884e3029df5095e2b0950c18d1544ad21431a07c033b85e53bd4f7" + }, + { + "bundled_path": "snapshot/areas/fresh-controller-composition-v2/composed_controller.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/fresh-controller-composition-v2/composed_controller.py", + "sha256": "c88736fce81d737ae13ac1bf47500dc9d72920bd4910efe1b49074797d6e3231" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-reference-bridge/SOURCE-PINS-v2.json", + "sha256": "f296ebb06f3b89f1737d456db3e6cc3a7061546275eabce84c1b18aecb3579d2" + }, + { + "bundled_path": "snapshot/stages/combined-finite-v8/baseline/engine/finite_controls.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/engine/finite_controls.py", + "sha256": "df989a831aac43cc1af95169dad8c64a7548760e6e1f96976da996703f2c8f7a" + }, + { + "bundled_path": "snapshot/review/cache-s0308-source-completion-v2/g12-custody-independent/G12-CUSTODY-DESIGN-REVIEW-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-custody-independent/G12-CUSTODY-DESIGN-REVIEW-v1.json", + "sha256": "748af02d5766eae9a1f60890780817e3230e91d61b374e0c5e0b4621852e1ae3" + }, + { + "bundled_path": "snapshot/stages/combined-finite-v8/integration/probe_binding_v3.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/probe_binding_v3.py", + "sha256": "9cbb7368f89e71d1e6cc46db5dc77efed3e03ed2a801c98c88fe316e4d9f3ef2" + }, + { + "bundled_path": "snapshot/stages/combined-finite-v8/integration/full_driver.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/full_driver.py", + "sha256": "f5a2d33f2b4d3651f214156a0e7094c2bb516ce2d5ab7698d18c11f98f35dee0" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v1/parent/SOURCE-ROUND-REPORT-v1.json", + "sha256": "fb3944cbc97fc268e3891be2f8c97341ca991b0f55d749346c8c613d4d2eacbf" + }, + { + "bundled_path": "snapshot/review/cache-s0308-source-completion-v2/fixed-case-independent/COLD-SOURCE-REVIEW-v2.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/fixed-case-independent/COLD-SOURCE-REVIEW-v2.json", + "sha256": "8c3c6420cbf9eeb978e3b4d6e1a8a47d409ef48714823bc3d781034084d602c2" + }, + { + "bundled_path": "snapshot/review/cache-s0308-source-completion-v2/fresh-independent/G08-DISPOSITION-REVIEW-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/fresh-independent/G08-DISPOSITION-REVIEW-v1.json", + "sha256": "b607426361abe712116326629ddb016615000c160fd4670545d4afc3a18be411" + }, + { + "bundled_path": "snapshot/review/cache-s0308-source-completion-v2/fixed-case-independent/REQUEST-PENDING-SOURCE-REVIEW-v2.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/fixed-case-independent/REQUEST-PENDING-SOURCE-REVIEW-v2.json", + "sha256": "fa4213006b1d524e0b0a23460947c5f1fcb29bbd4ecff57fff21c9d2333b29e1" + }, + { + "bundled_path": "snapshot/review/cache-s0308-source-completion-v2/roles-armed-independent/SMALL-CASES-SOURCE-REVIEW-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/roles-armed-independent/SMALL-CASES-SOURCE-REVIEW-v1.json", + "sha256": "3ed0d29f385508c96eb940ee31d7d4b142374a1b636f295af57f4660c2575bd9" + }, + { + "bundled_path": "snapshot/review/cache-s0308-source-completion-v2/late-independent/SOURCE-REVIEW-v2.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/late-independent/SOURCE-REVIEW-v2.json", + "sha256": "3449872d91c4d6425fea5126cae70192ebd959cf5af2e1f69ec85c795c86b4c9" + }, + { + "bundled_path": "snapshot/review/cache-s0308-source-completion-v2/fresh-independent/P08-CONTROLLER-REVIEW-v2.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/fresh-independent/P08-CONTROLLER-REVIEW-v2.json", + "sha256": "8889df7287b97c7af56f02f6eec5b5ef464bdcea7e21d47a3ddb3adcca7b41b9" + }, + { + "bundled_path": "snapshot/review/cache-s0308-source-completion-v2/roles-armed-independent/SC4-SOURCE-REVIEW-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/roles-armed-independent/SC4-SOURCE-REVIEW-v1.json", + "sha256": "13d8887ad7a9869de5710aa7713a93ec3e723d2f75433196a6158579d26a3a95" + }, + { + "bundled_path": "snapshot/review/cache-s0308-source-completion-v2/g13-binding-independent/REVIEW-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g13-binding-independent/REVIEW-v1.json", + "sha256": "b8ba9b1fcea3b386c0fd360ea15fae0d56651fd85bba039671a4bc43cd6bf65a" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/parent/BOUNDED-SOURCE-CANDIDATE-COVERAGE-v2.json", + "sha256": "f53a11d091758bdda7ec80e3698901003eca82ba797e5680ede9c826add80c22" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/MINIMAL-DESIGN-v3.json", + "sha256": "2855653b4d2ff6a0ffc00228028ca2c0ade8ae3d4414ac706e2549ef0ef28452" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/FREEZE.json", + "sha256": "89283b5a45a8ed52ef4781a8199787b70c9d08f772da1b1ff769244422890d02" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/SOURCE-INVERSES.json", + "sha256": "8c65e27812da750711f982e9f6535fe9fbff0a69003ed89f4394c9f663e6dc13" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/N01/driver.py", + "sha256": "e6f358ab9f49c4f76967b6f1fdcb9ad708fefce590ef5eb7498452f05b480a0b" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/N02/data.py", + "sha256": "0a57eea26ebeac4e55eb3463f050f057904b5fc04425693d98a0e90d1a0d806d" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/N02/authority.py", + "sha256": "bb08697bab414c60e308d4e2bcf8b1c2cd168a80187ff331a5f99c8af39c4fda" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/N02/driver.py", + "sha256": "c9bc6d09199d84c74933cb0bb810223a4c30e867f77fd62917de7b6d65ec2e3e" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/N03/driver.py", + "sha256": "6c4f11d8966aa9101a7d4912f45c4a4109d471d5e346410293839db3f920f46a" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/N04/driver.py", + "sha256": "4f2741ebab0e315e85b1d726c10dd0efa6f8b0601c3482b7e9332f87f8766cfc" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/N05/driver.py", + "sha256": "9f74e0e6987f35b52347e63ce1a687e8a09f94f1d84bc725768ad71730945329" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/N06/driver.py", + "sha256": "f3a56bb930ebfdfde78fd0b67b2876a08c6d9454aafb3a9702db3bf490d87d28" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/N07/driver.py", + "sha256": "d67bdf02d508dd214fbfb54facb7b6208fb6957d9bd61330f43968d1d253d1ab" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/N08/driver.py", + "sha256": "8141f205b6753e4cddfaf98e678affeade7cf91ac33acb7eafc00bb065951e0a" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/N09/driver.py", + "sha256": "b6ccfdc7c6ffcf2fe05a8781788ccd1e854a62e0e4e7555574b52a404254d244" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/N10/cache.py", + "sha256": "ef34ce20a2d95384b51911cc97ada40f287d89e3938b56845cd2c301c3de8f1b" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/N10/authority.py", + "sha256": "9b40b02f0fe6e6b9bf00a884c50b574c4a1c82a48f80101097e67c311c61ada5" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/N10/driver.py", + "sha256": "0ee7c070c67c38dfe8ecd3b571735155cc7f55ce06e81735bba1f9302451854c" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/N11/cache.py", + "sha256": "38e504bb39507a702ca2f6a6e68be11c74a9a7a0e873c47c30b38374d4447ae3" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/N11/authority.py", + "sha256": "192feb2807d4bb822b033db13d5114cbe1e70ef751b0091f750e11561249979e" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/N11/driver.py", + "sha256": "f35fbd0df78e37c0d242dc44d0ec908f0f64e54450691649188021bd3a474949" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/N18/driver.py", + "sha256": "dea615e2d36465b553fca5fd921910957f8b8a3e97a50428afdbcb1f50d8d275" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/N24/driver.py", + "sha256": "db8593eabbc6026a81191e1e3f3428b2810527b7aa5fac5f1cd23e691991fab3" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/V2_OWNER_FIRST_CAPTURE/driver.py", + "sha256": "f98e1bcc2db5abae43896b4f597d43a222b9615cd251da1c455245b06109dbc0" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/V2_OWNER_LATE_GRAPH/driver.py", + "sha256": "20bc5dd56b283030be46b5134377d757469becffbbe1ad5c57f639a1173cf989" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/V2_ORIGIN_FIRST_ALL_ROUTES.route_index=1/driver.py", + "sha256": "582c080caea7633c122894482e22e1dbfe43be1c44e25a0e8b7fdd77fb304b19" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/V2_ORIGIN_FIRST_ALL_ROUTES.route_index=2/driver.py", + "sha256": "bab69bb60c779c7067636d09e1064359fbb37f195da30e4de50b3a9a3dc6df35" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/V2_ORIGIN_FIRST_ALL_ROUTES.route_index=3/driver.py", + "sha256": "b0149ecd00c776c35b31bffb16a835d010a0b877568260556e87c3a46eae6287" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/V2_ORIGIN_FIRST_ALL_ROUTES.route_index=4/driver.py", + "sha256": "f55cd5422b910e7e6cb453b7f09353fe212c00063db777550dc6c39919c2ddd6" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/V2_ORIGIN_FIRST_ALL_ROUTES.route_index=5/driver.py", + "sha256": "b3b3035f6ace243204a1d79a476ab29d8d8752171324500c673af649f97295b3" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/V2_ORIGIN_FIRST_ALL_ROUTES.route_index=6/driver.py", + "sha256": "8a2a6465f976f91eef826df9f498095399cb3aecb3facc4fd0b09adb5f0e0014" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/V3_INSTANCE_KEY_DOMAIN/driver.py", + "sha256": "d09384b3dd6e4f9888a9266df0dc782f22e96e7a997e421cd6adbdfd08424547" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/V3_FIXED_RECORD_BINDINGS.fixed_record_field=class_origin/driver.py", + "sha256": "53079f449f9b6c61489f96128d53e57136ab21a36c11dd640d298fac3b583174" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/V3_FIXED_RECORD_BINDINGS.fixed_record_field=method_origin/driver.py", + "sha256": "2b1806e9bddbd7766b93ecebcf82f8fc8b837f8c951fd545685ca95b4412af50" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/V3_INSTANCE_METHOD_SHADOW/driver.py", + "sha256": "25372ef33e2ad9675ee81f31656d60163ce336631c29cd8907c90cb1b985932f" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/V3_INSTANCE_STATE_SCHEMA.state_schema_field=phase/driver.py", + "sha256": "a0c48ecb8cd0a0df814da88a2e8d1ec35c4a655ff41df8f45643eee6ab0aa3d7" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/V3_INSTANCE_STATE_SCHEMA.state_schema_field=serial/driver.py", + "sha256": "8eee5c1ac9a1c0e87670c336ca04fe9e51b0d768ea07b7e36c0fb2d40ebee492" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/products/V3_INSTANCE_STATE_SCHEMA.state_schema_field=failure/driver.py", + "sha256": "f66d734dc88e1b520df9429e0d93667c24e29886e82c91b8e0c7425fac7d03d4" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/SOURCE-MAP.json", + "sha256": "1a3060b6ac55decce3633ebef597597b55ea258990373004eed3e1ea2f5570e0" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/BASE-SOURCE-CLOSURE-REFERENCE.json", + "sha256": "aceee759ebdfad55487318f982cf7a2820d830c10c2a426e715fc251feb80822" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/cold-cases/source-v4/shared/cache_epoch_source_controls.py", + "sha256": "fcffe77b6a84d5b422b03e3d068924a701c1594cdb9ec305115827e3fad7d4b6" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/fixed-case-independent/COLD-SOURCE-REVIEW-v1.json", + "sha256": "d855bfc0183d9bd99254d46ed45ab3b5674987c681033ad465d82b6d7cafaff5" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/request-pending/DESIGN-v1.json", + "sha256": "2b65f47db4a94cf0e0809df2e09a80b9e7be78de5e740e47d264ec1d416676d6" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/request-pending/DESIGN-REFINEMENT-v1.json", + "sha256": "a34dae3d71a14121e3ccd5e22300ba3e6502d79fbcf735538f63473a3472d99f" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/request-pending/v2/REFINEMENT-v2.json", + "sha256": "4fcaedb7ee46ffb50ca90a0bdb585ba5caa06c2adb69d3dfc73fdd6bb0561918" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/request-pending/v2/FREEZE-SOURCE-v2.json", + "sha256": "9d7854cb1fbc91c672e5c2573dd84fa6712488d76ea5ac4c4b5231c54fa38075" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/request-pending/v2/g1011_epoch_cache.py", + "sha256": "f8200af69c829ec3e6bcdb47f6c4da5df7ccce5d5e3c8f084e0b6bee2c2428ff" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/request-pending/v2/g1011_driver.py", + "sha256": "6ddd318057975afac47fe1ea0e5d59c2da28eb964d82932202847088b9468d12" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/fixed-case-independent/REQUEST-PENDING-SOURCE-REVIEW-v1.json", + "sha256": "6edff2c00d242bf4fcf156240abcf7eeef90e5c2c9e6ad9633cdfc3292abc973" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/request-pending/v2/g1011_cache_extension.py.txt", + "sha256": "23396ebc12a61543c739f8e6fd1990528158da8939fae1e3942affbe93d213fd" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/request-pending/v2/g1011_driver_entry.py.txt", + "sha256": "f915b3971218ac1365d35cd2e78a47f20b1ca5248346dd88fff2d7d6b715833c" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/request-pending/v2/author_g1011_source.py", + "sha256": "0814bd4b43a25ce00729220271597f61298c08388b321c108d28ffd96e0502e0" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/request-pending/v2/CACHE.patch", + "sha256": "523848a161ba0b0bee335a60c67a059a18df61603b8515e80385c4cb2a805fd4" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/request-pending/v2/DRIVER.patch", + "sha256": "e29f96162946ecb6dd7fdd01a0700cdac1d289f9c816385999e90b02368432d6" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/request-pending/v2/V1-TO-V2.patch", + "sha256": "8c10cd214a119534e481af7bb348dd3feb881c4eaf85413c1bae1253d0eabb5e" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/request-pending/v2/SOURCE-INVERSE-v1.json", + "sha256": "94ee5efbe62cfe8042c390b04fa0c3f7a07824edc4a8245a09e193b2ced8e36a" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/request-pending/v2/STATIC-CHECKS-v2.json", + "sha256": "2559c29525894b1033abb0f7a5aab190b74b4898d1c3258aea7bb1529608a6bd" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/request-pending/v2/REPORT-v2.json", + "sha256": "97984306c4e8924083e5e126ac6d3b506322c1d283c943f50ef35da0e5dcf133" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/armed-context/g08_p01_n12_driver.py", + "sha256": "1f11ee403a25f91fcc134c1272a7776f2652955f5b6749518744257f8b7f666b" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/armed-context/disposition-v1/BOUNDARY-DESIGN-v2.json", + "sha256": "d85b6b852c647e0d21451b48fecd93ef6fe4ebe543fc0ebe1c31250bab9209a8" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/armed-context/disposition-v1/FREEZE-v1.json", + "sha256": "14ce2bf290df7ec847d15dffc3852a01921cb51a289852c354793bd5a1a81772" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/armed-context/disposition-v1/SOURCE-INVERSE-v1.json", + "sha256": "31327ad71d68a95c50837ab8fa78a357390efbb9a6f20efd23c653be21b8342f" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/armed-context/disposition-v1/g08_disposition_predicate_v1.py.txt", + "sha256": "21d27700237075d0bfdbf0f46773fcf3faaf4e5b47d2e1e9fae17da6516aba8b" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/armed-context/disposition-v1/g08_entry_tail_v1.py.txt", + "sha256": "f9b0ccadfd24acaaf2a7efef8d73d993c64e3e6afe7a31ce0072f6cbb7c3fda1" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/armed-context/disposition-v1/g08_controller_v1.py.txt", + "sha256": "f75dcade875fd9e6a2e1db3992c24e0397307004f3a6100b81d1e3c6dcf85ae5" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/armed-context/disposition-v1/g08_observed_stop_v1.py.txt", + "sha256": "12e8358a81b65d64c7886d01912b7cbe81594812da155da290e5bf52e5fece09" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/armed-context/disposition-v1/author_g08_disposition_source_v1.py", + "sha256": "a1b95aa4fd914bda7f35cb709783998d90c4b5c86e36157a8ccb4f326bfeec47" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/armed-context/disposition-v1/G08-DISPOSITION-v1.patch", + "sha256": "255aac04c8529613a6908629d78e03c5db10e43d8eba95749585b15f81b305ba" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/armed-context/disposition-v1/STATIC-CHECKS-v1.json", + "sha256": "0e2b1bf04a0a65e9a67266a2f6014ba9f9bec5d5b82bf3d7a878610574dbfa52" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/armed-context/disposition-v1/REPORT-v1.json", + "sha256": "88f3ee4e791f567ab487e70459989b538f0972c0b666072d26905b70c656e2fb" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/candidate-transport-v1/g12_reference_transport_v1.py", + "sha256": "c4fcac756671cb8927158b11952eb9795222d76ba1d102523a2313d8dad358d2" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody/FREEZE-v1.json", + "sha256": "08a58558e04168894152a3478823a3eb6d99a328e9c38b23447a84ec7f8ec8f1" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/JOBS.json", + "sha256": "a7e5e47c6e8fe8432e334a22e6eeac4ee40275c940943f608133627246586315" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/STAGE.json", + "sha256": "01ea38c458c66f24e5e7bafb06359c6390fefd842163db217e0773707def3da4" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/reference-custody-map/FREEZE-v1.json", + "sha256": "982b0370a6b9ed17c126f3066d3e7aed5d3abbda9c26f65ff42c315e8c3c88ba" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/reference-producer-v2/SOURCE-BOUNDARY-v2.json", + "sha256": "4130f4c2467791a347673181320226bdbaf6ff86c8d84c6349adae7124a75342" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/reference-producer-v2/FREEZE-v2.json", + "sha256": "6dcde16350158117c916a5254321dfb1b938de67950a9c0360200444fa8c3fe8" + }, + { + "bundled_path": "snapshot/review/cache-s0308-source-completion-v2/g12-custody-independent/G12-CUSTODY-DESIGN-CLARIFICATION-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-custody-independent/G12-CUSTODY-DESIGN-CLARIFICATION-v1.json", + "sha256": "dd78fbbe4060e16f58294ee4e8e0c667943e50ed0052d10500a1ac50da9f1a75" + }, + { + "bundled_path": "snapshot/review/cache-s0308-source-completion-v2/g12-protocol-independent/G12-CANDIDATE-PROTOCOL-REVIEW-v2.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-protocol-independent/G12-CANDIDATE-PROTOCOL-REVIEW-v2.json", + "sha256": "9b9043fa83f1a052a6708105431db20efd37b88bc0f23adc36491edd27b867ee" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/FREEZE-v2.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/FREEZE-v2.json", + "sha256": "716dfb49f659651eb41c0965a2189db6efcad1587b25e307b19523bfbd05c7d3" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/FREEZE-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/FREEZE-v1.json", + "sha256": "31afc1a99450482602b8403482a748fa245c1a6cb4bd6ff42afbb1d143232c49" + }, + { + "bundled_path": "snapshot/review/cache-s0308-source-completion-v2/g12-custody-source-independent/STATIC-SOURCE-VERIFICATION-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-custody-source-independent/STATIC-SOURCE-VERIFICATION-v1.json", + "sha256": "37303886fe57deff19a59f0b1c37974ee5550ce637ac626ce0aa183a5a654f4f" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-protocol-independent/FREEZE-v1.json", + "sha256": "93cd3138cd6961fdf2e2df61c66bd970fd6d788606cff874b2ba655063b8d504" + }, + { + "bundled_path": "snapshot/review/cache-s0308-source-completion-v2/g12-protocol-independent/G12-CANDIDATE-PROTOCOL-REVIEW-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-protocol-independent/G12-CANDIDATE-PROTOCOL-REVIEW-v1.json", + "sha256": "feecd63be55243fe2a7d07da8ac1f7cfcec6558362e694b82219a1be232ab7bc" + }, + { + "bundled_path": "snapshot/review/cache-s0308-source-completion-v2/g12-protocol-independent/GRAPH-ADDENDUM-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-protocol-independent/GRAPH-ADDENDUM-v1.json", + "sha256": "d78a97545c84854b5da0905485c232030f7b4d3884bd51088c2d3ffa604632dd" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-protocol-independent/STATIC-VERIFICATION-v1.json", + "sha256": "e6db24ed8e2dd7927cab57680af61e8cde80b2b6a3e117630af3434c64f0b46b" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-protocol-independent/verify_candidate_source_v1.py", + "sha256": "74c36c6aa47797c11d68a8116db1a338e591a63cf79ced28f6c80713b30c8f8a" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/RECOVERY-CHECKPOINT-v2.json", + "sha256": "b1d41b9873398193898ef69bf383f1cc2712711690d63ecf983aab0a0c3581c6" + }, + { + "bundled_path": "snapshot/review/cache-s0308-source-completion-v2/g12-protocol-independent/SUCCESSOR-DELTA-STATIC-v2.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-protocol-independent/SUCCESSOR-DELTA-STATIC-v2.json", + "sha256": "435dc0887b9d8c97c9304fc047b2d9e3e64e7a21c475037b50b9df36c4c0b858" + }, + { + "bundled_path": "snapshot/review/cache-s0308-source-completion-v2/g12-protocol-independent/verify_candidate_delta_v2.py.txt", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-protocol-independent/verify_candidate_delta_v2.py", + "sha256": "fce81e866a7dac29721db03f18d6d720ae78a61b81f1f84333f34b626364a227" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g13-binding/cache_epoch_context_assembly_g13_v2.py", + "sha256": "66b8cc255bd3264333eeb22dceed1ab54ddbe1c17ef6bf615cacaf25360334b1" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g13-binding/FREEZE-v1.sha256", + "sha256": "28d293392c0bd47143897bcce910b409f72c829c728fc40c483c4908c7457b04" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g13-binding/STATUS-v1.json", + "sha256": "4db2c06429601b8a5a6037fe35f6406e297c9fefa283e340a69d896799acf617" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g13-binding-independent/EVIDENCE-v1.json", + "sha256": "e7afacb80d64d674fa645a0e0c23fa36baf5fc4d760fb0fa3e12489fbd803df2" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/late-cases/source-v3/cases/N23/epoch_late_driver_v1.py", + "sha256": "1295b8d5cb2c43f7e395d7b6812aaec3c9efc618d4ce4589bb30922279bd1d28" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/late-independent/SOURCE-DELTA-CHECKS-v2.json", + "sha256": "2f4d09aa3754769c41d2fb1a36e52f3724365d4b792fb5dea1affaeda5da844f" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/late-independent/SOURCE-REVIEW-v1.json", + "sha256": "e831a26bc7cce130b3b4718a23772c9d887378ca17637d3a98f6e0a9552e1d91" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/late-independent/DESIGN-REVIEW-v1.json", + "sha256": "47ca0b9aee2f7052b1ce506d2738f035543a30e54c5ce9b2857a70b63a57f746" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/late-independent/DESIGN-FREEZE-v1.json", + "sha256": "aae386bcf9bb137c563153c437e94818e35fbcb1c4aee1c9a23049e748166877" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/late-independent/ORIGINAL-HELPER-CENSUS-v1.json", + "sha256": "ef56f81652d8754a03e6bfa3f99b6a56c2dcf384e26aae9390cdd855dfa9cf54" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/late-independent/SOURCE-CHECKS-v1.json", + "sha256": "e81e72aa80293d2dad96e6732f4c5593910fbeb2e6ab1d9bc7b44ba3a37169e5" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/late-independent/V2-REVIEW-FREEZE-v1.json", + "sha256": "51f49d1a1d52ee859723f2e5908951e0ba8943be72f530cedb62aa88ae4aea5c" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/late-cases/source-v3/cases/N20/epoch_authority_n20_v1.py", + "sha256": "3f1226d93725b1c9df1aa7256188287a64b36611a6628e9fd02970b187931eac" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/late-cases/source-v3/cases/N20/epoch_late_driver_v1.py", + "sha256": "54bcf67665f85c1d29f9674d7b213f92d5e2915b6518f84f2e745f8885e6ece1" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/adapters.py", + "sha256": "f7ca7f4f03ac63c1a95ba42f06149543211566de5e29f487a3dc4d08c5ee9b94" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/late-cases/source-v3/cache_epoch_source_controls.py", + "sha256": "516432a9f3532ee3c0ebe255aa641ed05179d98fe127e041baff3a1d211c674a" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/late-cases/source-v3/cases/P03/epoch_late_driver_v1.py", + "sha256": "4ba1212f8d4ae3ad7970c59fd11e1851abbf834536bb4e36eb606d4e94fc814b" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/late-cases/source-v3/cases/V2_ROLE_CLEANUP_ONLY/epoch_late_driver_v1.py", + "sha256": "731063ffe96a7ae17185deb7bb844e3f7d596f615ee6e29558fd724c1bf0bc5d" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/late-cases/source-v3/cases/V3_CLI_DISARM_ONLY/epoch_late_driver_v1.py", + "sha256": "3913114122460afbb4ca31543cdd6cf873ecbe507d11c7bfee53b0fd0ae93f9a" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_adapters_cli_fault_v3.py", + "sha256": "57bcea26dd7abff4ab68a662be1b3a0de101af162d9e3077b45e31eb5e6aff69" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_authority_cli_disarm_only_fault_v3.py", + "sha256": "5f3450b5f278627d33ad313e52bd022c81f831c34934f2ed8725131ff406885a" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_cache_cli_fault_v3.py", + "sha256": "8d2f19273c8f7990c53fe2d12249677a716df5da52106193e005b76d5539eeb1" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_data_cli_disarm_only_fault_v3.py", + "sha256": "18679fd1eb6ae99c4b375756511427c26718f77674c2d8fcc490e25ceb47cba5" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/late-cases/source-v3/cases/V3_CLI_BODY_DISARM/epoch_late_driver_v1.py", + "sha256": "d80fa9f24c14e1fac7a583db08434e286a0606dd7d93f1b3769bad6e76f2a70b" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_authority_cli_body_disarm_fault_v3.py", + "sha256": "5f3450b5f278627d33ad313e52bd022c81f831c34934f2ed8725131ff406885a" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_data_cli_body_disarm_fault_v3.py", + "sha256": "18679fd1eb6ae99c4b375756511427c26718f77674c2d8fcc490e25ceb47cba5" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/late-cases/source-v3/cases/V3_CLI_BODY_DISARM_RETIREMENT/epoch_late_driver_v1.py", + "sha256": "c642d9b23c4f2efbcd075450ab942bf1e486cc16dbe134255dd1281ddbaf31ef" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_authority_cli_body_disarm_retirement_fault_v3.py", + "sha256": "b5b7cfb68f3dfa73c9183f79c1ce4364ba25493b8c58986e4f95c7c1883592b3" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_data_cli_body_disarm_retirement_fault_v3.py", + "sha256": "182565e53294e306e3c2dce51388f699ea3c7f66b9af22812a7a52269c680f34" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/late-cases/source-v3/cases/V4_ARGV_ONLY/epoch_late_driver_v1.py", + "sha256": "ed1b6b4d57b7fd47341c52ba71520af6ae43927330b9a169ec4014fecac0d0d6" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_adapter_cli_restore_only_fault_v4.py", + "sha256": "f7ca7f4f03ac63c1a95ba42f06149543211566de5e29f487a3dc4d08c5ee9b94" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_authority_cli_restore_only_fault_v4.py", + "sha256": "f279ab86fc17c6a517b035f19d56863919cbd8304de4e7d5332457c6159aec10" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_cache_cli_restore_only_fault_v4.py", + "sha256": "d317c9866566cd6147c96566879f26f364e7e6801ac3eed0800b6ed8eedd01a2" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_data_cli_restore_only_fault_v4.py", + "sha256": "18679fd1eb6ae99c4b375756511427c26718f77674c2d8fcc490e25ceb47cba5" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/late-cases/source-v3/cases/V4_BODY_ARGV_DISARM_RETIREMENT/epoch_late_driver_v1.py", + "sha256": "d8cbefeca8af9d336a1ce92352fd9d5a2fd2f17c0540c542a34f5d686ad6b8ba" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_adapter_cli_body_restore_disarm_retirement_fault_v4.py", + "sha256": "57bcea26dd7abff4ab68a662be1b3a0de101af162d9e3077b45e31eb5e6aff69" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_authority_cli_body_restore_disarm_retirement_fault_v4.py", + "sha256": "64556c881af5f1e4fee9628ea059bb80c65883ed14f8b4413f6452b10c448b83" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_cache_cli_body_restore_disarm_retirement_fault_v4.py", + "sha256": "d317c9866566cd6147c96566879f26f364e7e6801ac3eed0800b6ed8eedd01a2" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_data_cli_body_restore_disarm_retirement_fault_v4.py", + "sha256": "667ff800f023173af0cb07ef985d0aa7345d624ed4f904670622a7dc1ac08e5d" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/late-cases/source-v3/cases/V4_ARGV_DISARM_RETIREMENT/epoch_late_driver_v1.py", + "sha256": "0d0ed51687a95c1cb5b0df04e1e1d7311c9ad19d5453762e853fe41d7bfe7502" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_adapter_cli_restore_disarm_retirement_fault_v4.py", + "sha256": "57bcea26dd7abff4ab68a662be1b3a0de101af162d9e3077b45e31eb5e6aff69" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_authority_cli_restore_disarm_retirement_fault_v4.py", + "sha256": "64556c881af5f1e4fee9628ea059bb80c65883ed14f8b4413f6452b10c448b83" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_cache_cli_restore_disarm_retirement_fault_v4.py", + "sha256": "d317c9866566cd6147c96566879f26f364e7e6801ac3eed0800b6ed8eedd01a2" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_data_cli_restore_disarm_retirement_fault_v4.py", + "sha256": "667ff800f023173af0cb07ef985d0aa7345d624ed4f904670622a7dc1ac08e5d" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/late-cases/source-v3/cases/V4_ARGV_BEFORE_DISARM_RETIREMENT/epoch_late_driver_v1.py", + "sha256": "1eccb1026e8435dc754fd833fac5798858919eb26852ffb1e94a25fb6a480751" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_adapter_cli_restore_before_disarm_retirement_fault_v4.py", + "sha256": "57bcea26dd7abff4ab68a662be1b3a0de101af162d9e3077b45e31eb5e6aff69" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_authority_cli_restore_before_disarm_retirement_fault_v4.py", + "sha256": "64556c881af5f1e4fee9628ea059bb80c65883ed14f8b4413f6452b10c448b83" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_cache_cli_restore_before_disarm_retirement_fault_v4.py", + "sha256": "d317c9866566cd6147c96566879f26f364e7e6801ac3eed0800b6ed8eedd01a2" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_data_cli_restore_before_disarm_retirement_fault_v4.py", + "sha256": "667ff800f023173af0cb07ef985d0aa7345d624ed4f904670622a7dc1ac08e5d" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/late-cases/source-v3/cases/V4_ROLE_RAW_JOURNAL/epoch_late_driver_v1.py", + "sha256": "222d23c9241966f3e10135c7308d46457d84763eac4279fa28d90f97df0eea09" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_adapter_cli_role_raw_journal_fault_v4.py", + "sha256": "f7ca7f4f03ac63c1a95ba42f06149543211566de5e29f487a3dc4d08c5ee9b94" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_authority_cli_role_raw_journal_fault_v4.py", + "sha256": "23177353bc42187c40ab50d1833e1ff014b1d464f109a44567f7005e332efc87" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_cache_cli_role_raw_journal_fault_v4.py", + "sha256": "b11ca58a17382e162833ed3a1091e0f975ab595bfba860dc6eb42ea4931655f2" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_data_cli_role_raw_journal_fault_v4.py", + "sha256": "18679fd1eb6ae99c4b375756511427c26718f77674c2d8fcc490e25ceb47cba5" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/late-cases/source-v3/cases/V4_CLI_RAW_JOURNAL/epoch_late_driver_v1.py", + "sha256": "421547f2ac40020bba3fd7fd817fb616f4669a8ac9d249e68b884f25a71c771f" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_adapter_cli_arm_raw_journal_fault_v4.py", + "sha256": "57bcea26dd7abff4ab68a662be1b3a0de101af162d9e3077b45e31eb5e6aff69" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_authority_cli_arm_raw_journal_fault_v4.py", + "sha256": "553393031b6f561e81b72a6ce87f3947fd99e9e269f0945b9ff0850ef7a7c9da" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_cache_cli_arm_raw_journal_fault_v4.py", + "sha256": "b11ca58a17382e162833ed3a1091e0f975ab595bfba860dc6eb42ea4931655f2" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_data_cli_arm_raw_journal_fault_v4.py", + "sha256": "d7743b4e865906801e02ee3665c7d65e9a8ca27af8cf168a563482551f09a952" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/late-cases/source-v3/FREEZE.json", + "sha256": "6f96d7f38babc00a8109dd6ac735df0cd7f6e7f513b176ef93c0936ccd20910f" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/late-cases/source-v3/GRAPH-CLOSURE-DELTA.json", + "sha256": "e46ce2282d4eb7ecb6c5aa7a310c5ed47b8d45bdc6e80ecf06176edf47882eb7" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/late-cases/source-v3/SOURCE-MAP.json", + "sha256": "254b18ea6c9d411c2a4d3330ffb28efe1c331f8d4b94e7aea6afa36a5ef512a4" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/late-cases/source-v3/SOURCE-INVERSES.json", + "sha256": "bbe07df1a70e02a60a9a62ef5c3e51e5a617c2dfbb719c5c89a71a153da5b57f" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/late-cases/source-v3/SOURCE-READINESS.json", + "sha256": "44202f4f372190b7d198d4a0281c945e6831728988a219ffdf003fcf3e3ac8e4" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-feasibility/FREEZE-v1.json", + "sha256": "b88c28e8deeb07e77266d262988c6534191544926a16f17f24dcfa0e101a63f2" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-feasibility/SOURCE-PROOF-v1.json", + "sha256": "e9b0e1e0b471c02185c13d891d1188e42a7235f2579ae721d33ab3d45ad8e521" + }, + { + "bundled_path": "snapshot/review/cache-s0308-source-completion-v2/p02-protocol-independent/INDEPENDENT-STATIC-EVIDENCE-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/p02-protocol-independent/INDEPENDENT-STATIC-EVIDENCE-v1.json", + "sha256": "de9651b280643ec11eb0e7f8e38d79a3aac5568dc88e129387121acab39ac66d" + }, + { + "bundled_path": "snapshot/review/cache-s0308-source-completion-v2/p02-reference-independent/INDEPENDENT-STATIC-EVIDENCE-v1.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/p02-reference-independent/INDEPENDENT-STATIC-EVIDENCE-v1.json", + "sha256": "4ec4a33e95a458a8f8c98c6d2db8d251c3c87fd951caf113b8c3b39b35e6a34f" + }, + { + "bundled_path": "snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/FREEZE-v4.json", + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/p02-reference-bridge/FREEZE-v4.json", + "sha256": "a1825d27d6721c10b0442173aa4ff246fc115fb4bf9f29fb50e2d87091f763e9" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/entry-roles/SC4-SOURCE-READINESS-v1.json", + "sha256": "243c33b7732206327ad7b955235b4e1f388c5f791c36626c1723a06d7a06b53b" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/roles-armed-independent/SC4-DESIGN-REVIEW-v3.json", + "sha256": "4998233eee05111a7a877ca8a9ca1531c1b015f36ba43dde992f18dfedbd62ce" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/entry-roles/SC4-CANDIDATE-FREEZE-v1.json", + "sha256": "a7e79a2aec9ffe1b0b281d10c695893b00c819f7f170b9c3a065d4ba8a230dae" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/entry-roles/SC4-FULL-BASELINE-INVERSE-v1.json", + "sha256": "b8e84807d4c1feb39f12b88d2685a7d4975792a04007a8d4ac080553ac53cf39" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/entry-roles/SC4-FULL-CANDIDATE-INVERSE-v1.json", + "sha256": "5b64d587ba1fc18eb4d79645f073a549a26235193011198b3e6f5b50c64dda36" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/entry-roles/SC4-ABSENT-INVERSE-v1.json", + "sha256": "e1489fd9fefc24c7466081cfac131005fa30ed1eab45a09565e43279bf63e8f1" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/entry-roles/SC4-HELPER-INVERSE-v1.json", + "sha256": "09e8eb2886f61c95436220c45b23d3526892c9645dad618e55c488e49ade9cfa" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/disposition/controller-v1/p08_controlled_driver_v2.py", + "sha256": "c9920851a03f971f2bfecad063c00dcd8ec09f352d0fb8a9e0eba9d328fab3b7" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/parent/ENTRY-ROLES-SOURCE-GATE-v1.json", + "sha256": "66fc0c99705b60fc59b24c5c565f649af9eae6204e7c4a8bc271de35f427f797" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_adapter_main_absent_record_fault_v5.py", + "sha256": "f7ca7f4f03ac63c1a95ba42f06149543211566de5e29f487a3dc4d08c5ee9b94" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_authority_main_absent_record_fault_v5.py", + "sha256": "35d65a6e8c37b1021460a5da6bf1a141d41e4ac33ac5816cf2111ba16190d6ba" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_cache_main_absent_record_fault_v5.py", + "sha256": "25f3e43001a53cb2cadc926f4371e3c555056b735a5cd3151e01e5a166fb54c4" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_data_main_absent_record_fault_v5.py", + "sha256": "18679fd1eb6ae99c4b375756511427c26718f77674c2d8fcc490e25ceb47cba5" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_driver_main_absent_record_fault_v5.py", + "sha256": "ec93ad847940da23b56e765e7d9fd6887ff6ca50c524c55feb3e395530552c87" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v1/contracts/INVOCATION-ROLE-POLICY-v1.json", + "sha256": "ee59734fbd4a9e0e75dc02f8e3861489065e7d3f6b5ed2b3cfb6be981d4e7ecb" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/entry-roles/sc4_full_baseline_driver_v1.py", + "sha256": "4d963f3b4b034b57fe1751ccb30779eb90f48c52f78ff17805f8b9b6c8c6facd" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/entry-roles/sc4_full_candidate_driver_v1.py", + "sha256": "92b507a2667b0d0085f63fb35176167806272934fef8149da691043411c81db0" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/entry-roles/sc4_absent_record_driver_v1.py", + "sha256": "e4b08e79f7fb8c1fd0f00b4ec7fa4dc429e4181fc368ef653642280267a7e121" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/entry-roles/cache_epoch_source_controls_sc4_v1.py", + "sha256": "df6713a68c94cd7e718e8e6f2c3de3e62aeb43dd5314b55b03cb81ee4dd657ca" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/entry-roles/sc4_entry_selection_v1.py", + "sha256": "aee146e0684b784f99bb89916e61d52c22efdb123aecd92843b7a5cc7d7adeb7" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/entry-roles/SC4-SOURCE-SELECTIONS-v1.json", + "sha256": "2583e630fc5162cddb4994ae103b19686eee8143d447ca4cfc3294554d4dddb0" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/entry-roles/SC4-SOURCE-SPAN-AND-RECORD-MAP-v1.json", + "sha256": "faa24467debe6e61e0b4ec6a5069cfe0b894a043380ef7eacf7e56cdd8967fe1" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/armed-remaining/REPORT-v1.json", + "sha256": "0f7ff996d48bdf90013b4b6669a177a9a54b7e74a8e4324d65c7428981c75b3a" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/armed-remaining/STATIC-CHECKS-v1.json", + "sha256": "63d4fceaff5450fc794b4ade3378d4c411f3c4ce8fa6b8dae2dc193d0ad1007f" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/armed-remaining/SMALL-CASES-DESIGN-v2.json", + "sha256": "ea9cde807d0acb910f538505dab02c35633361dc799f0911376d12ba25487aa8" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/roles-armed-independent/SMALL-CASES-DESIGN-REVIEW-v1.json", + "sha256": "95bdbfb99a50228330dfb774c4cadffabf48cef855e1193120cb2a48ae7bfb31" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/armed-remaining/FREEZE-v1.json", + "sha256": "877cd6c2e85c2afd2524245ece764f69c292648f39c0e9f0f5d31f8e0a554c0d" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/armed-remaining/SOURCE-INVERSE-v1.json", + "sha256": "2224f91e901f6957e28772f4d96d4e88191aa0c631fdf6838ed3cf82ba4be20a" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/armed-remaining/g08_six_small_driver_v1.py", + "sha256": "3380c0ab5f212ed2866deb0a55c7ffd867c8a42f0d7bc034e6fb1a5d524a2e96" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/astra-execution-cache/SOURCE-SCOPE-ERRATUM.json", + "sha256": "3e3e9b763803835408a5e2e89b8c5ce2c96e078ef6e8eef125151795ff6481dc" + }, + { + "bundled_path": null, + "original_path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/astra-execution-cache/REVIEW.json", + "sha256": "755aca77c7b303b8bd855a32bf61f082b91e47374e54dc2814bcbf5cde095871" + } + ], + "reference_scope": "Only manifest files are bundled. Null mappings retain historical or out-of-scope dependencies; no complete runtime closure or all-49 independent replay is claimed. Absolute paths in frozen source/review bytes are historical identities, never commands to execute.", + "schema": "h25-cache-source-handoff-v1", + "source_adoption": false, + "status": "ARCHIVAL_SOURCE_AND_REVIEW_HANDOFF_ONLY", + "target_execution": false +} diff --git a/research/h25-cache-source-handoff/README.md b/research/h25-cache-source-handoff/README.md new file mode 100644 index 0000000000..786bff5698 --- /dev/null +++ b/research/h25-cache-source-handoff/README.md @@ -0,0 +1,60 @@ +# H25 cache-source components and contribution handoff + +This archive publishes reusable source work and the exact remaining blockers for **N22, P07 and P02**. It is a source-and-review handoff. The accepted local protocols, accepted P02 reference-bridge design and rejected G12 integration are separate components with different acceptance scopes. + +The local checkpoint records **49 of 52 bounded source candidates accepted**. That count is historical source-review evidence. This export does not reproduce the complete evidence closure for all 49, qualify complete source adoption, run a candidate, validate the complete caller or measure a speedup. All three requested candidates remain open. The six-area source effort is paused; contributors are invited to take the explicit tasks below. + +## Components and evidence + +| Component | Status | Starting point | +|---|---|---| +| N22/P07 local candidate protocol | Independently accepted within its local source scope; external reference custody remains required | [protocol review](snapshot/review/cache-s0308-source-completion-v2/g12-protocol-independent/G12-CANDIDATE-PROTOCOL-REVIEW-v2.json), [frozen source list](snapshot/areas/cache-s0308-source-completion-v2/g12-protocol-repair/FREEZE-v2.json) | +| N22/P07 parent, adapter, consumer and candidate integration | Authored source rejected on two established defects; review incomplete | [rejection](snapshot/review/cache-s0308-source-completion-v2/g12-custody-source-independent/G12-CUSTODY-SOURCE-REVIEW-v1.json), [frozen source list](snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/FREEZE-v1.json) | +| P02 local two-suspension protocol | Independently accepted only at the local protocol boundary | [protocol review](snapshot/review/cache-s0308-source-completion-v2/p02-protocol-independent/P02-PROTOCOL-REVIEW-v1.json), [frozen source list](snapshot/areas/cache-s0308-source-completion-v2/p02-implementation/FREEZE-v1.json) | +| P02 dual-reference bridge | Corrected v4 design accepted; concrete bridge implementation and review outstanding | [accepted design](snapshot/areas/cache-s0308-source-completion-v2/p02-reference-bridge/DESIGN-v4.json), [review](snapshot/review/cache-s0308-source-completion-v2/p02-reference-independent/P02-REFERENCE-DESIGN-v4-DELTA-REVIEW-v1.json) | + +See [CONTRIBUTOR-TASKS.md](CONTRIBUTOR-TASKS.md) for independently claimable work and acceptance tests. Use the new PR conversation as the canonical coordination thread. Claim a lane there before editing; N22 and P07 share G12 and should have one coordinated owner. P02 can proceed separately. A reviewer should be independent of the author whose change they assess. + +## How to read the archive + +Start with [the original coverage specification](snapshot/areas/cache-s0308-source-completion-v1/coverage/COVERAGE-SPEC-v1.json), then the task-specific review and source. [MANIFEST.json](MANIFEST.json) maps every preserved original path to its public relative path, size and SHA-256. Code snapshots have an additional `.txt` suffix so they are inert reading material; their content bytes and embedded predecessor credit are unchanged. Frozen JSON documents preserve their original paths and status at creation. A later review can reject a source file whose author freeze says ready: the decision table above and the latest cited reviews govern this handoff. + +Every named source in the selected G12 implementation freeze and the P02 reference source-pin set is bundled. This is a curated source archive, not a portable runtime installation. The manifest's reference index explicitly shows other references that are outside this export. Reconstruct and independently review the relevant dependency closure before any future integration; do not replace missing references with dummy values, cached PASS results or caller-supplied success flags. Original local authorization records are historical evidence and do not grant a contributor access or authority. + +## Reproduction and validation scope + +From the repository root: + +```sh +cd research/h25-cache-source-handoff +sha256sum -c CHECKSUMS.sha256 +``` + +This checks archival bytes only and should be a short metadata operation; its duration is host dependent. No target imports, candidate/helper execution, compiler, native work, scientific run or decoder is performed by this command. There is no registered runtime replay in this package. The `.py.txt` files must not be run as validation of this handoff. + +Publication checks compare every copied byte against its frozen source, verify selected review/source hashes, check the relative documentation links, and verify the committed file inventory. They do not re-award source acceptance. [VALIDATION.json](VALIDATION.json) records the exact metadata-only checks and unrun obligations. The original failed source and reviews remain retained. + +## Existing independently usable packages + +- [PR6316](https://github.com/CrocSwap/integer-mult-bounds/pull/6316), `f99829cfc669c0aa61d7d505b0a58f7e697c6582`: bounded retained-log handling and finite controls. +- [PR6317](https://github.com/CrocSwap/integer-mult-bounds/pull/6317), `336015471e4f1bb95998f293aa76823fe11e33d5`: lossless evidence archive and exact-restoration controls. + +Both were freshly observed open and unmerged while preparing this handoff. Their validation and limitations remain in those PRs; they are not duplicated or dependencies of this archive. The common H25 predecessor is [PR6029](https://github.com/CrocSwap/integer-mult-bounds/pull/6029), `e05aad954689d0ee21baff19b4674f1fcb2e838f`. Its historical performance claims do not transfer to the new cache candidates. + +## Cost and completion boundaries + +The local checkpoint records 63.770533479 policy-charged seconds out of a 2400-second guarded allowance. That is not a complete physical-time total or a budget grant to external contributors. Historical timing gaps, current complete costs and the final metadata-publication timing tail remain unknown. This packaging operation does not resolve them. No minimum percentage improvement is imposed; any future gain must be measured with the preserved full checks and complete stated costs. + +Complete source acceptance, adoption, actual execution, full-caller equality and measured gain are separate obligations. Reaching 52/52 source candidates would not complete the six-area goal. Mathematical work, the selected frontier and existing packages are unchanged. + +## Open next questions + +1. Can a narrowly corrected G12 handoff and cleanup implementation satisfy the remaining independent source checks for both N22 and P07? +2. Can a contributor implement the accepted P02 v4 bridge while preserving the original producers, ordering and independent reference evidence? +3. After source acceptance, can the complete caller and full cost gates be qualified in an explicitly budgeted environment? + +The smallest useful first steps, blockers and success tests are in [CONTRIBUTOR-TASKS.md](CONTRIBUTOR-TASKS.md). A focused repair, independent rejection or clearly evidenced partial result is useful. + +## Credit + +Chris R / Clear1nsight; substantial OpenAI Codex assistance, including the separately attributed source authors and independent agent reviewers retained in the snapshot. Prior source and PR6029 contributor notices remain in their exact source bytes. The original Douglas R. Colkitt circuit/network lineage and all intermediate native and verification contributors retain their attribution. See the repository Apache-2.0 LICENSE and NOTICE. Local agent review is not independent human review or a formal proof-kernel result. diff --git a/research/h25-cache-source-handoff/STATUS.json b/research/h25-cache-source-handoff/STATUS.json new file mode 100644 index 0000000000..934682c054 --- /dev/null +++ b/research/h25-cache-source-handoff/STATUS.json @@ -0,0 +1,29 @@ +{ + "schema": "h25-cache-handoff-status-v1", + "recorded_utc": "2026-10-31T03:18:51.366188+00:00", + "bounded_source_count_historical": 49, + "original_body_denominator": 52, + "remaining": [ + "N22", + "P07", + "P02" + ], + "source_efforts": "paused_released_for_external_contribution", + "new_source_credit": 0, + "runtime_qualified": false, + "complete_caller_validated": false, + "measured_gain": false, + "known_g12_findings": [ + "G12-CUSTODY-SOURCE-001", + "G12-CUSTODY-SOURCE-002" + ], + "p02_bridge": "accepted_design_implementation_pending", + "guarded_policy_seconds_recorded": "63.770533479", + "guarded_policy_cap_seconds_historical": 2400, + "complete_physical_costs": null, + "final_publication_tail": "OPEN_NOT_ZERO", + "existing_prs": [ + 6316, + 6317 + ] +} diff --git a/research/h25-cache-source-handoff/VALIDATION.json b/research/h25-cache-source-handoff/VALIDATION.json new file mode 100644 index 0000000000..b9027b3cb0 --- /dev/null +++ b/research/h25-cache-source-handoff/VALIDATION.json @@ -0,0 +1,34 @@ +{ + "all_original_bytes_and_sha256_match": true, + "all_selected_json_parses": true, + "artifact_files": 111, + "compiler_operations": 0, + "complete_physical_time": null, + "created_utc": "2026-10-31T03:19:38.752435+00:00", + "decoder_operations": 0, + "historical_review_evidence_only": true, + "metadata_check_elapsed_seconds": 0.05738557002041489, + "new_candidate_acceptance": false, + "new_independent_semantic_review": false, + "original_content_bytes": 4158563, + "publication_tail": "OPEN_NOT_ZERO", + "relative_document_links_checked": 19, + "required_freeze_and_p02_pin_references_mapped": 53, + "review_decisions": { + "g12_integration": "REJECTED_TWO_ESTABLISHED_SOURCE_DEFECTS_BOUNDED_REVIEW", + "g12_local": "ACCEPT_BOUNDED_CANDIDATE_PROTOCOL_SOURCE_V2", + "p02_bridge_design": "ACCEPT_EXACT_V4_REFERENCE_BRIDGE_SOURCE_DESIGN_ONLY", + "p02_local": "ACCEPT_LOCAL_PROTOCOL_SOURCE_ONLY_REFERENCE_BRIDGE_CLOSED" + }, + "runtime_closure_claimed": false, + "schema": "h25-cache-source-handoff-metadata-validation-v1", + "scientific_operations": 0, + "target_operations": 0, + "unrun": [ + "target source imports and helper execution", + "complete dependency reconstruction", + "candidate implementation/adoption", + "complete caller and original runtime controls", + "scientific replay and complete performance measurement" + ] +} diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-epoch-genuine-context-v1/cache_epoch_context_assembly_v1.py.txt b/research/h25-cache-source-handoff/snapshot/areas/cache-epoch-genuine-context-v1/cache_epoch_context_assembly_v1.py.txt new file mode 100644 index 0000000000..01f1e1ba2a --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-epoch-genuine-context-v1/cache_epoch_context_assembly_v1.py.txt @@ -0,0 +1,98 @@ +"""SOURCE-only factory: produces reviewed Python source and launch DATA. + +It neither creates a stage, launches a process, imports a target nor creates a +Root/capability/profile. Parent source-stage/command/context review is mandatory. +""" +import ast +import hashlib + + +def _need(value,message): + if not value:raise RuntimeError(message) + + +def _sha(value):return hashlib.sha256(value).hexdigest() + + +def _absolute(value): + _need(type(value) is str and value.startswith('/') and value!='/' and + not value.endswith('/') and '\x00' not in value and all(p not in ('','.','..') for p in value.split('/')[1:]), + 'Canonical absolute parent path required') + return value + + +def assemble_finite_sources(pristine,entry_source): + """Pure text factory; exact frozen inputs required; no authority returned.""" + _need(type(pristine) is dict and all(type(k) is str for k in pristine),'Exact plain source input key domain') + _need(set(pristine)==set(INPUT_PINS),'Exact source input census') + for name,expected in INPUT_PINS.items(): + _need(type(pristine[name]) is bytes and _sha(pristine[name])==expected,'Frozen source input differs: '+name) + _need(type(entry_source) is bytes and _sha(entry_source)==ENTRY_SOURCE_SHA256,'Exact finite entry source') + entry=entry_source.decode('utf-8');products={};inverses=[];driver_rows={} + for case,name in FINITE_CASES.items(): + old=pristine[name].decode('utf-8');new=old + edits=[('return authority, descriptor, bundle','return authority, descriptor, bundle, module'), + ('_INITIAL_COLD_AUTHORITY, _INITIAL_COLD_CALLER_DESCRIPTOR, _INITIAL_EPOCH_BUNDLE = _initial_cold_authority()', + '_INITIAL_COLD_AUTHORITY, _INITIAL_COLD_CALLER_DESCRIPTOR, _INITIAL_EPOCH_BUNDLE, _INITIAL_EPOCH_AUTHORITY_MODULE = _initial_cold_authority()')] + for before,after in edits: + _need(new.count(before)==1,'Actual retain-module transformation differs');new=new.replace(before,after) + marker="\nif __name__ == '__main__':\n _run_epoch_with_stop_evidence()\n" + _need(new.endswith(marker),'Actual original automatic entry differs') + insertion="\nimport types\n_EPOCH_FINITE_CASE_ID = "+repr(case)+"\n"+entry+"\nif __name__ == '__main__':\n _epoch_finite_case_entry()\n" + new=new[:-len(marker)]+insertion + ast.parse(new) + key=case+'/integration/scientific_driver.py';products[key]=new.encode('utf-8') + restored=new[:-len(insertion)]+marker + for before,after in reversed(edits): + _need(restored.count(after)==1,'Actual inverse occurrence differs');restored=restored.replace(after,before) + _need(restored==old,'Whole actual driver inverse differs') + driver_rows[case]={'sha256':_sha(products[key]),'source_key':key} + inverses.append({'case':case,'old_sha256':_sha(pristine[name]),'new_sha256':_sha(products[key]),'edits':edits,'old_entry':marker,'new_entry':insertion,'actual_reverse_byte_match':True}) + old=pristine['controls'].decode('utf-8');tree=ast.parse(old) + node=next(n for n in tree.body if isinstance(n,ast.Assign) and any(isinstance(t,ast.Name) and t.id=='V5_OUTER_FAULT_SOURCE_PINS' for t in n.targets)) + oldmap=ast.literal_eval(node.value);newmap={k:dict(v) for k,v in oldmap.items()} + for case,kind in CASE_KINDS.items():newmap[kind]['driver_sha256']=driver_rows[case]['sha256'] + lines=old.splitlines(keepends=True);before=''.join(lines[node.lineno-1:node.end_lineno]);after='V5_OUTER_FAULT_SOURCE_PINS = '+repr(newmap)+'\n' + new=''.join(lines[:node.lineno-1])+after+''.join(lines[node.end_lineno:]);new=new.replace('import ast\n','import json\nimport ast\n',1) + original_defs={n.name:ast.dump(n,include_attributes=False) for n in tree.body if isinstance(n,ast.FunctionDef)} + current_defs={n.name:ast.dump(n,include_attributes=False) for n in ast.parse(new).body if isinstance(n,ast.FunctionDef)} + _need(original_defs==current_defs,'Control function bodies changed') + restored=new.replace('import json\nimport ast\n','import ast\n',1);_need(restored.count(after)==1,'Actual control inverse census');restored=restored.replace(after,before) + _need(restored==old,'Whole actual control inverse differs') + products['integration/cache_epoch_source_controls.py']=new.encode('utf-8') + inverses.append({'case':'controls','old_sha256':_sha(pristine['controls']),'new_sha256':_sha(products['integration/cache_epoch_source_controls.py']),'old_map_text':before,'new_map_text':after,'added_import':'import json\n','all_function_AST_unchanged':True,'actual_reverse_byte_match':True}) + _need({key:_sha(value) for key,value in products.items()}==EXPECTED_PRODUCT_PINS,'Reviewed concrete output pin mismatch') + return {'schema':'cache-epoch-finite-source-products-v1','products':products,'driver_rows':driver_rows,'inverses':inverses,'Root_or_runtime_authority_created':False} + + +def bind_original_root_command(case,stage_root,output,optimize=0): + """Exact existing Root._entry argv DATA, no process or filesystem action.""" + _need(type(case) is str and case in FINITE_CASES,'Only two reviewed finite case roles') + stage_root=_absolute(stage_root);output=_absolute(output);anchor=stage_root+'/baseline/anchor.json' + _need(not output.startswith(stage_root+'/') and output!=stage_root,'Fresh output must be outside source stage') + _need(type(optimize) is int and optimize in (0,1),'Exact existing Root optimize modes') + flags=('-S','-s','-P','-B')+ (('-O',) if optimize else ()) + integration=stage_root+'/integration';driver=integration+'/scientific_driver.py' + argv=('/usr/bin/python3.12',)+flags+(integration+'/full_driver.py','--root-sha256',ROOT_SHA256, + '--provider',integration+'/probe_binding_v3.py',PROVIDER_SHA256,'--driver',driver, + EXPECTED_PRODUCT_PINS[case+'/integration/scientific_driver.py'],'--integration',integration,'--', + '--cache-control-sha256',EXPECTED_PRODUCT_PINS['integration/cache_epoch_source_controls.py'], + '--cache-control-case',case,'--lanes','baseline','--finite-only','--output',output,'--anchor',anchor) + return {'schema':'existing-original-Root-command-binding-DATA-v1','case':case,'argv':argv,'environment':ROOT_ENVIRONMENT, + 'stage_overlay':STAGE_OVERLAYS[case],'base_stage_reference':BASE_STAGE_REFERENCE, + 'control_source_sha256':EXPECTED_PRODUCT_PINS['integration/cache_epoch_source_controls.py'], + 'original_full_sources_and_operations_preserved':True,'selected_finite_source_case_only':True, + 'stage_installed':False,'command_or_native_execution_granted':False, + 'remaining_gates':('independent source/context/stage/command review','genuine parent guard/current native profiles and original full control union','180Root/2400global/1GiB complete costs/funding','native NATIVE01 policy remains parked')} + +# Exact immutable factory input/output and existing Root command pins +INPUT_PINS = {'epoch_driver_main_primary_outer_fault_v5.py': '551d0b7d2e1deea057138f5c11bd5edf76cd3fc2ebb7049a20db7231de9eba32', 'epoch_driver_main_cleanup_only_fault_v5.py': '74e11d01724c0c031a542bcec411e9572e2cc46ecca8ee1b579614a3f9fc0f8b', 'controls': 'd3a7e252bb42f2c0c8a4e5c6080757cbf1977fd9b316bcd933bb58a843240a73'} +ENTRY_SOURCE_SHA256 = 'cf5ec1b66943ba6a254272c6d38d0c0b45761b818d1863c0c4716d4be074981c' +FINITE_CASES = {'V5_MAIN_PRIMARY_OUTER': 'epoch_driver_main_primary_outer_fault_v5.py', 'V5_MAIN_CLEANUP_ONLY': 'epoch_driver_main_cleanup_only_fault_v5.py'} +CASE_KINDS = {'V5_MAIN_PRIMARY_OUTER': 'main_primary_outer', 'V5_MAIN_CLEANUP_ONLY': 'main_cleanup_only'} +EXPECTED_PRODUCT_PINS = {'V5_MAIN_PRIMARY_OUTER/integration/scientific_driver.py': '96ba87197551d991606ddfdb6a86296a39edf2e1b63417a1767d59b357bacc3d', 'V5_MAIN_CLEANUP_ONLY/integration/scientific_driver.py': '070352ecdf1e226c9267ce822317452d3e64f74191abd468f970b241d6c7b074', 'integration/cache_epoch_source_controls.py': '0dfe789e2d0a5650f759538b628f0e6cdf8c5847df999f26f69ddbb7c23ebaf7'} +ROOT_SHA256 = 'f5a2d33f2b4d3651f214156a0e7094c2bb516ce2d5ab7698d18c11f98f35dee0' +PROVIDER_SHA256 = '9cbb7368f89e71d1e6cc46db5dc77efed3e03ed2a801c98c88fe316e4d9f3ef2' +ROOT_ENVIRONMENT = {'PATH': '/usr/bin:/bin', 'PYTHONHASHSEED': '0', 'LANG': 'C.UTF-8', 'LC_ALL': 'C.UTF-8', 'TZ': 'UTC', 'PYTHONDONTWRITEBYTECODE': '1'} +STAGE_OVERLAYS = {'V5_MAIN_PRIMARY_OUTER': {'integration/data_adapters.py': {'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_data_main_primary_outer_fault_v5.py', 'sha256': '3694f577651e8baaf4be1d07baff9ba7fa0f312a8d1620836c35988f03a43954'}, 'areas/cache-validity/cache_contract_v8.py': {'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_cache_main_primary_outer_fault_v5.py', 'sha256': 'd317c9866566cd6147c96566879f26f364e7e6801ac3eed0800b6ed8eedd01a2'}, 'areas/cache-validity/cold_authority_v7.py': {'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_authority_main_primary_outer_fault_v5.py', 'sha256': '091fcb583a160b72c95896380ade42f46873c97794d11fe88ab168fb00d099dd'}, 'integration/adapters.py': {'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_adapter_main_primary_outer_fault_v5.py', 'sha256': 'f7ca7f4f03ac63c1a95ba42f06149543211566de5e29f487a3dc4d08c5ee9b94'}, 'integration/scientific_driver.py': {'packet_source': 'finite_v5_main_primary_outer_driver.py', 'sha256': '96ba87197551d991606ddfdb6a86296a39edf2e1b63417a1767d59b357bacc3d'}, 'integration/cache_epoch_source_controls.py': {'packet_source': 'finite_source_controls.py', 'sha256': '0dfe789e2d0a5650f759538b628f0e6cdf8c5847df999f26f69ddbb7c23ebaf7'}, 'areas/cache-validity/reference_scientific_driver.py.txt': {'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/reference_scientific_driver.py.txt', 'sha256': '8027a1b24d08a598c2aa9e91cfe791edd58d1b87b17ce5957cee2d5da49d5c2f'}}, 'V5_MAIN_CLEANUP_ONLY': {'integration/data_adapters.py': {'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_data_main_cleanup_only_fault_v5.py', 'sha256': '3694f577651e8baaf4be1d07baff9ba7fa0f312a8d1620836c35988f03a43954'}, 'areas/cache-validity/cache_contract_v8.py': {'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_cache_main_cleanup_only_fault_v5.py', 'sha256': 'd317c9866566cd6147c96566879f26f364e7e6801ac3eed0800b6ed8eedd01a2'}, 'areas/cache-validity/cold_authority_v7.py': {'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_authority_main_cleanup_only_fault_v5.py', 'sha256': '091fcb583a160b72c95896380ade42f46873c97794d11fe88ab168fb00d099dd'}, 'integration/adapters.py': {'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_adapter_main_cleanup_only_fault_v5.py', 'sha256': 'f7ca7f4f03ac63c1a95ba42f06149543211566de5e29f487a3dc4d08c5ee9b94'}, 'integration/scientific_driver.py': {'packet_source': 'finite_v5_main_cleanup_only_driver.py', 'sha256': '070352ecdf1e226c9267ce822317452d3e64f74191abd468f970b241d6c7b074'}, 'integration/cache_epoch_source_controls.py': {'packet_source': 'finite_source_controls.py', 'sha256': '0dfe789e2d0a5650f759538b628f0e6cdf8c5847df999f26f69ddbb7c23ebaf7'}, 'areas/cache-validity/reference_scientific_driver.py.txt': {'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/reference_scientific_driver.py.txt', 'sha256': '8027a1b24d08a598c2aa9e91cfe791edd58d1b87b17ce5957cee2d5da49d5c2f'}}} +BASE_STAGE_REFERENCE = {'manifest': {'path': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/STAGE.json', 'sha256': '01ea38c458c66f24e5e7bafb06359c6390fefd842163db217e0773707def3da4', 'bytes': 32276}, 'all_source_members_by_reference': [{'logical_path': 'JOBS.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/JOBS.json', 'sha256': 'a7e5e47c6e8fe8432e334a22e6eeac4ee40275c940943f608133627246586315', 'mode': 292}, {'logical_path': 'PLAN.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/PLAN.json', 'sha256': '18870508891b325f1c3cc42673c50ea56cd9cd0dd6d3f2beb62aa9056a6946ff', 'mode': 292}, {'logical_path': 'PLAN.md', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/PLAN.md', 'sha256': 'd5acfa0e58005a62d879a75940ce32984b3bc7f43b811598236a3c96cbe25043', 'mode': 292}, {'logical_path': 'areas/cache-validity/cache_contract_v3.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/cache-validity/cache_contract_v3.py', 'sha256': '6f02e6add3ae91d020316881fc157278d607fbe1a1f15d3480c5725a65ecbe9c', 'mode': 292}, {'logical_path': 'areas/cache-validity/cache_contract_v8.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/cache-validity/cache_contract_v8.py', 'sha256': '133c55e269b354542f86a2a1099f48cff052293d06da310f98b7cb33cb85258f', 'mode': 292}, {'logical_path': 'areas/cache-validity/cache_controls_v3.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/cache-validity/cache_controls_v3.py', 'sha256': '22b3c592d978c343e09af2e8e54a2822c9598e042036c0c2847e9ca6fb28599c', 'mode': 292}, {'logical_path': 'areas/cache-validity/cache_controls_v8.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/cache-validity/cache_controls_v8.py', 'sha256': '8ac3ccf5a3923d46c3f470d2cb1d2d1440fb72ad4344f4c08501c12d7be6ad1d', 'mode': 292}, {'logical_path': 'areas/cache-validity/cold_authority_controls_v7.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/cache-validity/cold_authority_controls_v7.py', 'sha256': '1dbf78b7c60a9280d12fcc01c8dfcfd7c04b465fa3af5511390268776194862b', 'mode': 292}, {'logical_path': 'areas/cache-validity/cold_authority_v7.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/cache-validity/cold_authority_v7.py', 'sha256': '2a941111bdfd91037dfcbc5552aced004809240a7e2b43bfbce39fb35798af39', 'mode': 292}, {'logical_path': 'areas/cache-validity/probe-native/bootstrap_controls_v2.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/cache-validity/probe-native/bootstrap_controls_v2.py', 'sha256': '8a7a36bfe214399dd2e86a301131e52cac956d56a9da7d4b1b017b0054805198', 'mode': 292}, {'logical_path': 'areas/cache-validity/probe-native/dict_probe_v2.c', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/cache-validity/probe-native/dict_probe_v2.c', 'sha256': 'fb73100813f67855edd89523371b0723564dc1e8d5804401a1b775d5475e7ac8', 'mode': 292}, {'logical_path': 'areas/cache-validity/probe-native/direct_controls.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/cache-validity/probe-native/direct_controls.py', 'sha256': 'dc02d910b507254e90fa39f22dec501405eb1beea3be77a41d2071f0b952929e', 'mode': 292}, {'logical_path': 'areas/cache-validity/probe-native/metadata_controls_v3.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/cache-validity/probe-native/metadata_controls_v3.py', 'sha256': '052ed10033d302d6d404b8e6e298343dc87b278ce9c3db68fd891865fb79d273', 'mode': 292}, {'logical_path': 'areas/cache-validity/probe-native/native_tcb_controls_v1.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/cache-validity/probe-native/native_tcb_controls_v1.py', 'sha256': '63b1804caa7f89915662a1424f788c3becad13520e1f63212a338fb45aaa2c5a', 'mode': 292}, {'logical_path': 'areas/cache-validity/probe-native/native_tcb_v1.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/cache-validity/probe-native/native_tcb_v1.py', 'sha256': '865943df5cfdbf9383362d7fb2b76c6d0fd895cf0a0e20d550a26b579606b5d7', 'mode': 292}, {'logical_path': 'areas/cache-validity/probe-native/probe_bounds_fixture_v2.c', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/cache-validity/probe-native/probe_bounds_fixture_v2.c', 'sha256': '7fd587ddcdd92655d0dfb5f29ad01b30a6f72c972b800ddcff16eb87e1c21273', 'mode': 292}, {'logical_path': 'areas/cache-validity/probe-native/probe_watcher_fixture.c', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/cache-validity/probe-native/probe_watcher_fixture.c', 'sha256': 'c24b2d87b5492abd069b77a9724e13e12a28f0a797ddcfc5684c9ce612975c1b', 'mode': 292}, {'logical_path': 'areas/construction/construction_controls_v2.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/construction/construction_controls_v2.py', 'sha256': 'c9b14ab4e4ad9cd860551843accb911a8fdab7b46a85dc6bfa319c1f621af94b', 'mode': 292}, {'logical_path': 'areas/construction/construction_v2.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/construction/construction_v2.py', 'sha256': 'ed7fd6c8a93c524c4d28245e48d75d6b949234a5a60f6affb8025f27ef9506b5', 'mode': 292}, {'logical_path': 'areas/hashing-traces/digest_snapshot.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/hashing-traces/digest_snapshot.py', 'sha256': 'ca58134de323f8d0df6e79a9d925f353736dc0c5c17e66191669c5028259e04f', 'mode': 292}, {'logical_path': 'areas/hashing-traces/inventory_controls.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/hashing-traces/inventory_controls.py', 'sha256': '7e0a2ed81085b75c70387f4ed07eeefd537f12dce408feda645f86964a3653dc', 'mode': 292}, {'logical_path': 'areas/hashing-traces/metadata_controls.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/hashing-traces/metadata_controls.py', 'sha256': 'd36bd3b9d6c0825dda0d35705e40bf30acf538ad003a4a1f03f96181de447f46', 'mode': 292}, {'logical_path': 'areas/hashing-traces/native_observation_controls.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/hashing-traces/native_observation_controls.py', 'sha256': '7b427ed79cdc261f5bdddd7a82e03d595a9d1dcba76a40201608795b5ded2d35', 'mode': 292}, {'logical_path': 'areas/hashing-traces/row_interner.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/hashing-traces/row_interner.py', 'sha256': '2aa3d56f411457daa3ec59d6f2577849c3864acfe2bd8da2a231b89c89b0fd0c', 'mode': 292}, {'logical_path': 'areas/serialization/bounded_serialization.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/serialization/bounded_serialization.py', 'sha256': '4edd0ae36b0fe98fe99d8658391a52568cc59888f1ae11e69cbb01f9544c74cb', 'mode': 292}, {'logical_path': 'areas/serialization/serialization_controls.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/serialization/serialization_controls.py', 'sha256': '72951102beea04abeed35011c82f4518e886dff921e0e515025ae0e1e61f9e09', 'mode': 292}, {'logical_path': 'baseline/CODE-SOURCES.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/CODE-SOURCES.json', 'sha256': '0ce6a3c120fc4f8f7ab98f044b3d7a72ce72310972c3846a4835bfc01e16a0d7', 'mode': 292}, {'logical_path': 'baseline/README.md', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/README.md', 'sha256': '654841654eb8f88c6ad80f5cebb424548a8c2236f237869434e03d6a83eeaa64', 'mode': 292}, {'logical_path': 'baseline/SOURCE-PINS.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/SOURCE-PINS.json', 'sha256': '88bba3caf5975f30fa7abceaea9454110cf3b069233e8241a2ca13d1dff171a7', 'mode': 292}, {'logical_path': 'baseline/SOURCES.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/SOURCES.json', 'sha256': 'ef4ceeef85aaa99a8c859e227ce2f75b1c421571e7e8ac235096ba49d375231a', 'mode': 292}, {'logical_path': 'baseline/TASK.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/TASK.json', 'sha256': 'ad8f73482b2c4b9361f8989326715a943d4981fce21d6871bd4f2f8fc6fc4b38', 'mode': 292}, {'logical_path': 'baseline/VALIDATION.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/VALIDATION.json', 'sha256': '57276f66428aa11d1d8757384a93b16549d64e9c28fa59d904f07b37092e231a', 'mode': 292}, {'logical_path': 'baseline/VERIFY.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/VERIFY.json', 'sha256': '3c003082b10da57a213694de649e9097c79bf0dbfe9197c2bd11a8ffecb8cd78', 'mode': 292}, {'logical_path': 'baseline/anchor.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/anchor.json', 'sha256': 'bbe53360088e1d7183a9801d3954bd723f580cb283d2f8dd0bb7a54ebb80c298', 'mode': 292}, {'logical_path': 'baseline/archive_support.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/archive_support.py', 'sha256': '825093689fea974ec5cb88a133d73715b9f2d50da60a53a4efabeecc92bff63f', 'mode': 292}, {'logical_path': 'baseline/check_artifacts.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/check_artifacts.py', 'sha256': '115d36662856ded048d3a57210b4cbe4a8091375e79d5fcac2856d5d0cfe234f', 'mode': 292}, {'logical_path': 'baseline/engine/compare_side_verifier.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/engine/compare_side_verifier.py', 'sha256': '6e507bb0c7e00d090a60289fddb6c55e90c946d0850c42c3c5e3e15c27604a68', 'mode': 292}, {'logical_path': 'baseline/engine/finite_controls.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/engine/finite_controls.py', 'sha256': 'df989a831aac43cc1af95169dad8c64a7548760e6e1f96976da996703f2c8f7a', 'mode': 292}, {'logical_path': 'baseline/engine/native_backend.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/engine/native_backend.py', 'sha256': 'e473c38245c3668715b5a78dfe980b2fe3ed0d0c9b8c97c666fbae6ecf1fffd5', 'mode': 292}, {'logical_path': 'baseline/engine/native_gf2.c', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/engine/native_gf2.c', 'sha256': 'e9c3c9194a08718bd1575c1cf08c6c6772d3b644c2e274c25a84a1f9249d06cc', 'mode': 292}, {'logical_path': 'baseline/engine/profile_side_verifier.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/engine/profile_side_verifier.py', 'sha256': '9c994378171c20a91539418d93cb8387e1daa93465d6862beefea90e12999c2a', 'mode': 292}, {'logical_path': 'baseline/engine/source/complex_circuit.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/engine/source/complex_circuit.py', 'sha256': 'd623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1', 'mode': 292}, {'logical_path': 'baseline/engine/source/complex_network.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/engine/source/complex_network.py', 'sha256': '0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b', 'mode': 292}, {'logical_path': 'baseline/evidence/COMPLETE-GATE.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/COMPLETE-GATE.json', 'sha256': '7754b29600bede1e0fe553b1cac324e7934c9fddf37988295758b33c1def094b', 'mode': 292}, {'logical_path': 'baseline/evidence/ENVIRONMENT.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/ENVIRONMENT.json', 'sha256': '4918c9ec4329426934e9ede063443449bf506f6adeb47bcef2dc07df279db384', 'mode': 292}, {'logical_path': 'baseline/evidence/FIRST-PAIR-GATE.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/FIRST-PAIR-GATE.json', 'sha256': '72b996e102a16f0c9188d761ba2e7d67e7dc1c049c49eee419f2aede5d1fc9bc', 'mode': 292}, {'logical_path': 'baseline/evidence/FULL-PAIR-ADMISSION.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/FULL-PAIR-ADMISSION.json', 'sha256': '03f45f5805095357143a9650c8c1c87e549e0635e388c7f1ed5f5315a4606829', 'mode': 292}, {'logical_path': 'baseline/evidence/INDEPENDENT-REVIEW.md', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/INDEPENDENT-REVIEW.md', 'sha256': 'ea6afa3a610379d1a499513ed772afceb502883ede31c05a2da1ac7d50562b2f', 'mode': 292}, {'logical_path': 'baseline/evidence/INPUT-COMMIT.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/INPUT-COMMIT.json', 'sha256': '895c4ab09ce14b12d3fa658d6be3fd3ea561117d22ec07b106dd78832131428b', 'mode': 292}, {'logical_path': 'baseline/evidence/LOCAL-INPUT-INDEX-STOP.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/LOCAL-INPUT-INDEX-STOP.json', 'sha256': '49a246a34440f29c31844dabaf8429237c14efcfdecf8786e6585a75573099aa', 'mode': 292}, {'logical_path': 'baseline/evidence/PLAN.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/PLAN.json', 'sha256': '0eca7918e548fc080a9d773ac8c5d416d422fb9b4bc46e2c42bd802e218da813', 'mode': 292}, {'logical_path': 'baseline/evidence/PROFILE-v1-FAILURE.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/PROFILE-v1-FAILURE.json', 'sha256': '399f182d37f0fae525c5eacc58e3c6cf96a370647cbeed693a46b80aafa8127f', 'mode': 292}, {'logical_path': 'baseline/evidence/RESULTS.md', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/RESULTS.md', 'sha256': 'b4e339d46da3639b028579134b52c5e2fc5b38a838a05317cc20e3b4bacb094f', 'mode': 292}, {'logical_path': 'baseline/evidence/SOURCE-DESIGN.md', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/SOURCE-DESIGN.md', 'sha256': '609a4c6aee119ddaed9f10dc2726ece18436179ad9caaced70cebaa58066f8eb', 'mode': 292}, {'logical_path': 'baseline/evidence/UPSTREAM-REFRESH.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/UPSTREAM-REFRESH.json', 'sha256': '43983db67b72244c58b30780086846fa771525ee6e5c70b9187605a365d4b693', 'mode': 292}, {'logical_path': 'baseline/evidence/canonical/MANIFEST.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/canonical/MANIFEST.json', 'sha256': '297e157fd2bac8f801cba6b7491368cf7dd49bae2df59483161e084a1b5fae8c', 'mode': 292}, {'logical_path': 'baseline/evidence/canonical/complement-transcript.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/canonical/complement-transcript.json', 'sha256': '36ef2bbc469c1e701bfc06b0d240aa31575f82132e8d204f0fa2e1802b21fea8', 'mode': 292}, {'logical_path': 'baseline/evidence/canonical/complex-network.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/canonical/complex-network.json', 'sha256': '1f763d95c7ff163aa71d13cd82784f16665be8afb21f75e76941e2119562098f', 'mode': 292}, {'logical_path': 'baseline/evidence/canonical/full-return.lossless.json.gz', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/canonical/full-return.lossless.json.gz', 'sha256': '2ccdc80933fe4b3d774cf71ad2877864aca64e7de48b62c6391f449f2d2a67c2', 'mode': 292}, {'logical_path': 'baseline/evidence/canonical/original-stdout.txt', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/canonical/original-stdout.txt', 'sha256': '8f77b724810ec05fb19b35d75d8002d31a6e22ed342a36ee28a5caef8d643015', 'mode': 292}, {'logical_path': 'baseline/evidence/canonical/rank-trace.json.gz', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/canonical/rank-trace.json.gz', 'sha256': '20e76cd894807cf84ca740312fdc2a73d1d70740e2f0c5ec55b3d0afdd9311fa', 'mode': 292}, {'logical_path': 'baseline/evidence/canonical/witness.json.gz', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/canonical/witness.json.gz', 'sha256': '8e1b8b03320d5e077c0414c3644396faf182bdfa1a72d8067c8fea8a33dbf5d0', 'mode': 292}, {'logical_path': 'baseline/evidence/publication-v1-failure/REVISION.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/publication-v1-failure/REVISION.json', 'sha256': 'd62dc4890189a23c56920bf83f33ce54568489cd5595a6ee51805179222cb5b8', 'mode': 292}, {'logical_path': 'baseline/evidence/publication-v1-failure/receipt.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/publication-v1-failure/receipt.json', 'sha256': '92765dc5ef0d28bc8830fdd1ce6388a38dd9986a7d29ebf2bd9a362d231d2b4a', 'mode': 292}, {'logical_path': 'baseline/evidence/publication-v1-failure/stderr.txt', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/publication-v1-failure/stderr.txt', 'sha256': '9cc43b411c844bdc69171311f26efbba2d063c20cc5f1ece45f465f92ece9515', 'mode': 292}, {'logical_path': 'baseline/evidence/publication-v1-failure/stdout.txt', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/publication-v1-failure/stdout.txt', 'sha256': '3a5034b4208e91f156d7658387ea85eb1d0ad98fa283c0e3185e41bf0e4c7342', 'mode': 292}, {'logical_path': 'baseline/evidence/publication-v1-failure/usage.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/publication-v1-failure/usage.json', 'sha256': '3f6041fd2731e9551108507c3ca417e521ffb6ab50c4ac5e5489474311e0d7bc', 'mode': 292}, {'logical_path': 'baseline/evidence/publication-v1-failure/verify_full.py.txt', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/publication-v1-failure/verify_full.py.txt', 'sha256': '427968bde006b0ce605547483433ab1f178be9531ffa9136b8e35245a6dd979e', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-B1/receipt.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-B1/receipt.json', 'sha256': '5d99810564df133b6dc181eee9eb5c5221f1116df2776e956d87d864858a5d27', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-B1/scientific-receipt.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-B1/scientific-receipt.json', 'sha256': 'd15bbc1abf12e04badc6a43fbc95a09495554e17241f3849118d1a1e04e9dd31', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-B1/stderr.txt', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-B1/stderr.txt', 'sha256': 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-B1/stdout.txt', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-B1/stdout.txt', 'sha256': '0f6e7069212f9ee752d4123475fde0ca526fc9c41d68bf952022e7cd41612f43', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-B1/usage.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-B1/usage.json', 'sha256': '094d04029c545f0600ad31fabdde4dc28064182c73492203450602cb0dbb0505', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-B2/receipt.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-B2/receipt.json', 'sha256': '525d68ac1dbc164c68ae0b2d5064eb1fa44de475f990550b3412d3fa78bc3e3d', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-B2/scientific-receipt.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-B2/scientific-receipt.json', 'sha256': '78981f93ef8e47517f46e0ce97045846807baf7329f6a488c536c5a64ace9ac7', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-B2/stderr.txt', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-B2/stderr.txt', 'sha256': 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-B2/stdout.txt', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-B2/stdout.txt', 'sha256': '8f7a10dda0295c3d396017a48eeadd0319a160fe1e4d6993df82426b197c5a2d', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-B2/usage.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-B2/usage.json', 'sha256': 'ea4d1f8d0d8a09fa3aef146f15481db589c19d43ce5c56ce03e295f6b28cd891', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-B3/receipt.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-B3/receipt.json', 'sha256': '6b8eae21187c05dc00a6665b6831bc7ebe3451d2c5f57dc171435c9276c95506', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-B3/scientific-receipt.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-B3/scientific-receipt.json', 'sha256': '0c7916eb347d9702d19bfe22e192ab3b19d165dfd8221df59e1a40b69eee7495', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-B3/stderr.txt', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-B3/stderr.txt', 'sha256': 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-B3/stdout.txt', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-B3/stdout.txt', 'sha256': '61a94286b63bbfb14e6dca09aed4b5c0d1ecb3deb146ce3bf15b6a7ff44a74fe', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-B3/usage.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-B3/usage.json', 'sha256': 'e7372d8ce6add9c3bec1f86aa0779af62e278e2ed1e5074377658010f4dcbfc8', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-C1/receipt.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-C1/receipt.json', 'sha256': 'e49cc524d24b158d3d42e61ace73696b23b063b1cbda0f957b19a7b9d8cce934', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-C1/scientific-finite-controls.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-C1/scientific-finite-controls.json', 'sha256': '7571beca3195287602b694654354560ddf0a885840e819217b8392fddb341342', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-C1/scientific-receipt.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-C1/scientific-receipt.json', 'sha256': 'f477afec2b289b560cdd6583ec53428d27a62aa541f3c781671e7ffbcf4c91e8', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-C1/stderr.txt', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-C1/stderr.txt', 'sha256': 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-C1/stdout.txt', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-C1/stdout.txt', 'sha256': '6707c1cb48a8836730dac7da627201e50ce69ae0e6d77be9dddc6e531a3c22dd', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-C1/usage.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-C1/usage.json', 'sha256': '1315deb855cfc8733bc6142062022a456da2f164ce32085773e9d2d9e6552a84', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-C2/receipt.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-C2/receipt.json', 'sha256': 'f19ca9455e0a5032293917518187be3e90d8cf664be0a0a94cdb8bda70fa7e73', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-C2/scientific-finite-controls.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-C2/scientific-finite-controls.json', 'sha256': '32e9152e923672843de3176f6d0e29a3506fe62ed5ffbc5f5a75f2fa71e25969', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-C2/scientific-receipt.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-C2/scientific-receipt.json', 'sha256': '3e196c680f0fd0169804da7c8215bc4ff03d231e7af08ee35c76005bc4b8822c', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-C2/stderr.txt', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-C2/stderr.txt', 'sha256': 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-C2/stdout.txt', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-C2/stdout.txt', 'sha256': '1bef720cc7a18ef23b9c9336ebcea0fc327ce72b8ab8ad1fd94b5dfde51bcc7c', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-C2/usage.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-C2/usage.json', 'sha256': 'fc7436309d37516f21ba5838e88b1ba6025c060e22b1012ae5b05cfbcd238886', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-C3/receipt.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-C3/receipt.json', 'sha256': 'e8423e8bd005321fb1e5b806f639814c1ef54e8caa0e3cc98b8ba6d4f3ac32ce', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-C3/scientific-finite-controls.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-C3/scientific-finite-controls.json', 'sha256': '307191c8c2c7fc026b0b11b1c204a5d597876fc1e6b4752427f81795c041e237', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-C3/scientific-receipt.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-C3/scientific-receipt.json', 'sha256': '81ba879f026ee8ed0be4c4be1bbddd4043771fcb2c0617bf392c922253be29eb', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-C3/stderr.txt', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-C3/stderr.txt', 'sha256': 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-C3/stdout.txt', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-C3/stdout.txt', 'sha256': '847d85da1c1e4660bb9b76c4a266c828c51f5d61820ff93f81a27d3496a842b0', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-C3/usage.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-C3/usage.json', 'sha256': '4a0c22609a9850a10f473e43e8b28bde3ba486f47943c6373636cdf321bac3fb', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-profile-v1/receipt.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-profile-v1/receipt.json', 'sha256': 'b44f2319460c2f3de5a802fe611b79d6ea914197eaec5232fa85c48e7e30a65c', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-profile-v1/stderr.txt', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-profile-v1/stderr.txt', 'sha256': 'd4a8ee4b536eefd9269d82bf2d3821971a2f9e3bac20c6a720249eaf11746b76', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-profile-v1/stdout.txt', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-profile-v1/stdout.txt', 'sha256': 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-profile-v1/usage.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-profile-v1/usage.json', 'sha256': '66b32a9d199a7045d9bb74d68a195b2456510e22e554e9f13786500152212e78', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-profile-v2/receipt.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-profile-v2/receipt.json', 'sha256': '6884b826de535b6ddefa0b7304cec41cfd4ff1c3cfef42930cb18c34d69226cf', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-profile-v2/scientific-receipt.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-profile-v2/scientific-receipt.json', 'sha256': 'bc3fda46c74b84d0634f65e1a1e3a4a4fb8295dd7d058520b5e30b39d2d05d8a', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-profile-v2/stderr.txt', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-profile-v2/stderr.txt', 'sha256': 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-profile-v2/stdout.txt', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-profile-v2/stdout.txt', 'sha256': '33c1a3007fd8c27abbfe2f7cbbda2afc0d9c81a5b1285c899d67b1c2fe2b0dec', 'mode': 292}, {'logical_path': 'baseline/evidence/runs/full-network-profile-v2/usage.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/evidence/runs/full-network-profile-v2/usage.json', 'sha256': 'c1eb62c1868fc3583c60c953d547ec3b29bc30dcc811cc9d132364aef6c0c15b', 'mode': 292}, {'logical_path': 'baseline/frozen/scripts/audit_short_guards.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/scripts/audit_short_guards.py', 'sha256': 'c2c929c956e617bee739963b517b9069e0d067cfebc6820f401a4e90a1769eb1', 'mode': 292}, {'logical_path': 'baseline/frozen/scripts/certify.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/scripts/certify.py', 'sha256': '2348d95008276c5d5764f7e028c3918e484582cd589bd4d9b82919161745e53e', 'mode': 292}, {'logical_path': 'baseline/frozen/scripts/compact_control_layer.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/scripts/compact_control_layer.py', 'sha256': 'e814c9f8d84f2e5d3aa2e06c36697f27f110218addc40ff8df2801fde861ff9f', 'mode': 292}, {'logical_path': 'baseline/frozen/scripts/complex_circuit.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/scripts/complex_circuit.py', 'sha256': 'd623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1', 'mode': 292}, {'logical_path': 'baseline/frozen/scripts/complex_network.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/scripts/complex_network.py', 'sha256': '0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b', 'mode': 292}, {'logical_path': 'baseline/frozen/scripts/exclusion_circuit.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/scripts/exclusion_circuit.py', 'sha256': 'f9fbcd6e85e442cbd0926ac0887414e20735b2dc923d2d5822c803ceb46726d3', 'mode': 292}, {'logical_path': 'baseline/frozen/scripts/paired_exclusion_circuit.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/scripts/paired_exclusion_circuit.py', 'sha256': '8f05f04cf06217befd6d0ee0f2d7d0c5c5eb32cfab8c9a8ca7917fd6d620b7d2', 'mode': 292}, {'logical_path': 'baseline/frozen/scripts/paired_network.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/scripts/paired_network.py', 'sha256': '991223dc3c1374284c361ed017e42bf732dd971fa0bea2be2282cfb18257b3f7', 'mode': 292}, {'logical_path': 'baseline/frozen/scripts/prepare_layers.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/scripts/prepare_layers.py', 'sha256': 'a6e2adc612f264b1c0e51d18ce6315de9ae5e2ae2420aa22e99a22d8bf304947', 'mode': 292}, {'logical_path': 'baseline/frozen/scripts/search_network.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/scripts/search_network.py', 'sha256': '3a4faa5037d9b8e7ca5828afac193a96b6966a8b114f14937921795b24ec4f6a', 'mode': 292}, {'logical_path': 'baseline/frozen/scripts/shared_point_circuit.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/scripts/shared_point_circuit.py', 'sha256': '360d9bffc0f55315fe294789b72c71c79e0991524555b3a5f42a2ca504d7da95', 'mode': 292}, {'logical_path': 'baseline/frozen/scripts/shared_point_network.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/scripts/shared_point_network.py', 'sha256': 'a85e7f0d8c42d6a27e3846308571ca324a1824ac5c2d59e4daa5c7673c33c697', 'mode': 292}, {'logical_path': 'baseline/frozen/upstream/LICENSE', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/upstream/LICENSE', 'sha256': 'c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4', 'mode': 292}, {'logical_path': 'baseline/frozen/upstream/README.md', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/upstream/README.md', 'sha256': '8d1ceff898a4e0e681679f91c4def485820be9e99f04e4861f2ce601a364723e', 'mode': 292}, {'logical_path': 'baseline/frozen/upstream/build/figures/multiplication-flow.tex', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/upstream/build/figures/multiplication-flow.tex', 'sha256': '3654d2728b0c98919d61760e1802804ed616546a747f9167a93e17bb8697f320', 'mode': 292}, {'logical_path': 'baseline/frozen/upstream/build/figures/proof-map.tex', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/upstream/build/figures/proof-map.tex', 'sha256': '76d4deacf07bea355412abcfd798c7cbe6dcccef29a4a420a9e2a7b158f23848', 'mode': 292}, {'logical_path': 'baseline/frozen/upstream/build/main.tex', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/upstream/build/main.tex', 'sha256': '42f0f506976bc2084374a71e97edc1549689a7accf35dda4db2a18af4f13c1aa', 'mode': 292}, {'logical_path': 'baseline/frozen/upstream/build/references.bib', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/upstream/build/references.bib', 'sha256': '33cc2df13ccf85330849e8fb34d4ac7613b23f625787457a5b7b9aa6d7369476', 'mode': 292}, {'logical_path': 'baseline/frozen/upstream/build/sections/00-introduction.tex', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/upstream/build/sections/00-introduction.tex', 'sha256': '98721f03682ccf1cc7d0850b07adabaa2d8f3afe552e3861753eba9d284d0da0', 'mode': 292}, {'logical_path': 'baseline/frozen/upstream/build/sections/01-history.tex', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/upstream/build/sections/01-history.tex', 'sha256': '798956c8150c31e3e2f5f29c47110d25ce619faad1374f4d3a0f15fa3ee33ead', 'mode': 292}, {'logical_path': 'baseline/frozen/upstream/build/sections/02-streams.tex', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/upstream/build/sections/02-streams.tex', 'sha256': '606c80db61cad13aa0c3b6060dc4b88dbbe7ac60cdd831aa93f28d908fd09dab', 'mode': 292}, {'logical_path': 'baseline/frozen/upstream/build/sections/03-motifs.tex', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/upstream/build/sections/03-motifs.tex', 'sha256': 'ed76761194988a01af77ead0ea6469cb5dcd29690ab985a0b5a4006b0f2b69bb', 'mode': 292}, {'logical_path': 'baseline/frozen/upstream/build/sections/04-swap.tex', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/upstream/build/sections/04-swap.tex', 'sha256': '412b170ccaab38dba96e95e3cbfae09f4876a9818f8d278776a746b0f8044906', 'mode': 292}, {'logical_path': 'baseline/frozen/upstream/build/sections/05-layers.tex', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/upstream/build/sections/05-layers.tex', 'sha256': '20cfc8d12099d4e4ed9e3e7eeb6162edd9b6e0e076f24693364cd24377252594', 'mode': 292}, {'logical_path': 'baseline/frozen/upstream/build/sections/06-transforms.tex', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/upstream/build/sections/06-transforms.tex', 'sha256': '924316e4bc905066281d8f9e8746a49d8829aeb393688608deb1e61c3c87853c', 'mode': 292}, {'logical_path': 'baseline/frozen/upstream/build/sections/07-resampling.tex', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/upstream/build/sections/07-resampling.tex', 'sha256': '8a6b91670f9163afb54892489fa2210c77fe1b058f0325ec7d18b44b94be6e2c', 'mode': 292}, {'logical_path': 'baseline/frozen/upstream/build/sections/08-assembly.tex', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/upstream/build/sections/08-assembly.tex', 'sha256': '763d7945b1e1ec4ebae9b799bcefcc45fa9bae6e2ffad799868a9c3d513dbd4a', 'mode': 292}, {'logical_path': 'baseline/frozen/upstream/build/sections/09-exact-arithmetic.tex', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/upstream/build/sections/09-exact-arithmetic.tex', 'sha256': '5714e5d0656c78c6a1fde8d01fd11f1ba856a7ea94149b283bd9a50fdbf516c3', 'mode': 292}, {'logical_path': 'baseline/frozen/upstream/build/sections/10-transposition.tex', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/upstream/build/sections/10-transposition.tex', 'sha256': 'c14ad8d56112f6578678a58211bc8d63c3a4b60e55078ac73bc38f7348e713cb', 'mode': 292}, {'logical_path': 'baseline/frozen/upstream/build/sections/11-grouped-rectangles.tex', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/upstream/build/sections/11-grouped-rectangles.tex', 'sha256': '6525cd0a01980e56accfeaf06e9d875bc699197ba42c6e22b69435e352275174', 'mode': 292}, {'logical_path': 'baseline/frozen/upstream/formalization.yaml', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/upstream/formalization.yaml', 'sha256': '2dcbd0d6e6a22475f53d49bfdfcac9b6d2b470653c332a9f56522f5be166edb9', 'mode': 292}, {'logical_path': 'baseline/frozen/upstream/manifest.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/frozen/upstream/manifest.json', 'sha256': '16ab13971694cabab09440c47ebf2fc0496a9d35fc3af33950fda3498f8e2392', 'mode': 292}, {'logical_path': 'baseline/full_B.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/full_B.py', 'sha256': '4ab2f554c1323a26bc2ffd11a4e692e21382a269b5fdb117d226ef76f34578d8', 'mode': 292}, {'logical_path': 'baseline/full_C.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/full_C.py', 'sha256': '1ba8e7b76077d8d108039ab238d73c59e25929f1abcb5b9fde5944d5f978ebf4', 'mode': 292}, {'logical_path': 'baseline/full_driver.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/full_driver.py', 'sha256': '0d976d2eb6b845f20d4a3396591a806f966688b88693cd6a5f8a0c9e48925e36', 'mode': 292}, {'logical_path': 'baseline/guard.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/guard.py', 'sha256': '7540f8cc4ae4d12ed86c844ef0837a74184d3ada653979608c295c09f200a751', 'mode': 292}, {'logical_path': 'baseline/reference/certificates/complex-network.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/reference/certificates/complex-network.json', 'sha256': '1f763d95c7ff163aa71d13cd82784f16665be8afb21f75e76941e2119562098f', 'mode': 292}, {'logical_path': 'baseline/reference/certificates/selected-result.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/reference/certificates/selected-result.json', 'sha256': '2a0220e866417774606e0f991e41b9c1d26b1f43b97857238cf478dbc7d330b5', 'mode': 292}, {'logical_path': 'baseline/replay.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/replay.py', 'sha256': '5f8dd1deb7ebc9634b220ed533cad534862892ee59a01803195f34296c740d90', 'mode': 292}, {'logical_path': 'baseline/verify.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/verify.py', 'sha256': '04c37b6e3dc50bfb3b954672f4f2e04f354a084ff465f3df09f59736c7eac01b', 'mode': 292}, {'logical_path': 'baseline/verify_full.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/verify_full.py', 'sha256': 'c65351d258bac75ae661298a351861452c81f990dd82768da819c1910cba8cd8', 'mode': 292}, {'logical_path': 'integration/CONTROL-CONTRACT.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/CONTROL-CONTRACT.json', 'sha256': '72262ab0e85077a4297b92edbfb97c6841be60d2f4bf9dd2abe5de1b962ffd5a', 'mode': 292}, {'logical_path': 'integration/DERIVATION.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/DERIVATION.json', 'sha256': '6a1b9148c48fe9016a3dc98c1aec339fba3efe73f421ecac2d3cb12d87c53256', 'mode': 292}, {'logical_path': 'integration/RUNTIME-PROFILE.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/RUNTIME-PROFILE.json', 'sha256': 'ad0ec2aea01b83f97bdeafd9e9208360127fee870d024d353879b5ed99237109', 'mode': 292}, {'logical_path': 'integration/SOURCE-INSTALL-RECEIPT.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/SOURCE-INSTALL-RECEIPT.json', 'sha256': '3b39e0f7bff8fb9f866de134201f8d6673b4d29a76550786981671de41d41de1', 'mode': 292}, {'logical_path': 'integration/adapters.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/adapters.py', 'sha256': 'f7ca7f4f03ac63c1a95ba42f06149543211566de5e29f487a3dc4d08c5ee9b94', 'mode': 292}, {'logical_path': 'integration/cold_build_evidence.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/cold_build_evidence.py', 'sha256': 'aa0a315110e031e19291970c9611fe5e0f91465fa20eaec51e81186099563f78', 'mode': 292}, {'logical_path': 'integration/cold_build_evidence_controls.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/cold_build_evidence_controls.py', 'sha256': '37db9881193f0ecf111f8ce94b6ef84cd3b22d1123b3266ced25390aa48d5a52', 'mode': 292}, {'logical_path': 'integration/composition_controls.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/composition_controls.py', 'sha256': '0dee5193093d7179031b90cf070ed8194fd5980ee9b36400227cd4d64a82eed8', 'mode': 292}, {'logical_path': 'integration/data_adapters.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/data_adapters.py', 'sha256': 'c00c9c215d0b81a91dd5dffddacfd2225c4bc40fe3ba43c7b93677bb686591cc', 'mode': 292}, {'logical_path': 'integration/derive_backend.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/derive_backend.py', 'sha256': 'f2bec9dd90c178b92eb3902559382b4fc4d3ee42f542fd13fadb8b2a38ca4867', 'mode': 292}, {'logical_path': 'integration/derive_driver.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/derive_driver.py', 'sha256': 'a18d312e6992786fa7b2cf8a613eea068e0ad282ff684d03781a5928bde2692a', 'mode': 292}, {'logical_path': 'integration/derive_row_bind_v3.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/derive_row_bind_v3.py', 'sha256': '5aeee9364d29147ef4e1bfffba532f7392833a6158d73d1da50ed6c772f061af', 'mode': 292}, {'logical_path': 'integration/full_driver.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/full_driver.py', 'sha256': 'f5a2d33f2b4d3651f214156a0e7094c2bb516ce2d5ab7698d18c11f98f35dee0', 'mode': 292}, {'logical_path': 'integration/guarded_adapters_v4.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/guarded_adapters_v4.py', 'sha256': '5579fe0838d8c6acf63834990269479c6c32024a1662846ed0a075c25d13954c', 'mode': 292}, {'logical_path': 'integration/native_packet.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/native_packet.py', 'sha256': '6adbcd1dfeb77fb6da7ee8f725796b1bfdbf0a4f397ef23f3a266a6b89d55892', 'mode': 292}, {'logical_path': 'integration/probe_binding_v3.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/probe_binding_v3.py', 'sha256': '9cbb7368f89e71d1e6cc46db5dc77efed3e03ed2a801c98c88fe316e4d9f3ef2', 'mode': 292}, {'logical_path': 'integration/row_interner_v3.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/row_interner_v3.py', 'sha256': '364b45c100be73a7ace44ab664f3c792020dad6f33f7788b62aaeab67c0c5aa9', 'mode': 292}, {'logical_path': 'integration/scientific_driver.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/scientific_driver.py', 'sha256': '8027a1b24d08a598c2aa9e91cfe791edd58d1b87b17ce5957cee2d5da49d5c2f', 'mode': 292}, {'logical_path': 'priorities/runtime-guards/CALL-BUDGET.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/runtime-guards/CALL-BUDGET.json', 'sha256': '74d62c6ca7790fb6f087b1312029ae9f6a00beca6a6a9b12a1a80afc3df15fec', 'mode': 292}, {'logical_path': 'priorities/runtime-guards/IMPLEMENTATION.md', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/runtime-guards/IMPLEMENTATION.md', 'sha256': 'a6809f40f406188af9bf70df2d6c3ac2b31292c4a08bbf2a99ebd17b92dd6605', 'mode': 292}, {'logical_path': 'priorities/runtime-guards/PROPOSAL.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/runtime-guards/PROPOSAL.json', 'sha256': 'f6da354ca6e6dc1647b8aa78ebb0cb4fe84af8ca13deafa851ad527e7124451d', 'mode': 292}, {'logical_path': 'priorities/runtime-guards/RESEARCH.md', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/runtime-guards/RESEARCH.md', 'sha256': '58a3497b7586f7b9c173867abadcffa71a587c01a80abcb376b9109428e1b5e9', 'mode': 292}, {'logical_path': 'priorities/runtime-guards/STATIC-CHECK.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/runtime-guards/STATIC-CHECK.json', 'sha256': '4587e1ef1102eff216de65f9db111f1bacb393a1e509fd9fcf6a2d2a9ebd3160', 'mode': 292}, {'logical_path': 'priorities/runtime-guards/guard_candidate.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/runtime-guards/guard_candidate.py', 'sha256': '320435ec4125544f2b2aedf74f21469b232d08683fe76f0913607516254bbd29', 'mode': 292}, {'logical_path': 'priorities/runtime-guards/guard_controls.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/runtime-guards/guard_controls.py', 'sha256': '514e3d08793323cf216c7a1f76cafdc8dbba4ab4656e64167c788985f9e63291', 'mode': 292}, {'logical_path': 'priorities/set-reuse/CALL-BUDGET.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/set-reuse/CALL-BUDGET.json', 'sha256': '2d6a50081b4d6f13cba9c7afcaed9c46c5d7c6cba6ed9da60eebcd1d4f1bacd5', 'mode': 292}, {'logical_path': 'priorities/set-reuse/IMPLEMENTATION.md', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/set-reuse/IMPLEMENTATION.md', 'sha256': '6b0a86226046bc421134f18a0cd77ebc4d5dce07e0feb3b67de8c2a852856452', 'mode': 292}, {'logical_path': 'priorities/set-reuse/OWNERSHIP.md', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/set-reuse/OWNERSHIP.md', 'sha256': 'ca2ad5a604aed35b6e29132aee32ccad318885c0c844e3c71a3986bf937ba099', 'mode': 292}, {'logical_path': 'priorities/set-reuse/PORTABILITY-SOURCE.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/set-reuse/PORTABILITY-SOURCE.json', 'sha256': '2c385ad61b64fb7e58d915ac597eb223d65365fcf1737dbd6320a2b438f3cc82', 'mode': 292}, {'logical_path': 'priorities/set-reuse/PORTABILITY.md', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/set-reuse/PORTABILITY.md', 'sha256': '8f2e5b95ade7b100634d1d875d7ac8fbef608ed74e2539f340a22d0c17a212e1', 'mode': 292}, {'logical_path': 'priorities/set-reuse/PROPOSAL.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/set-reuse/PROPOSAL.json', 'sha256': 'b9e3edff540fb0fa9f679e868a8fbcc2a6072d1a00d263b11757e60d0abca55d', 'mode': 292}, {'logical_path': 'priorities/set-reuse/RESEARCH.md', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/set-reuse/RESEARCH.md', 'sha256': 'e722b267cf86574f0c62846156ce6a049f0cf539f3eba1de48d9b1ec58f22bc8', 'mode': 292}, {'logical_path': 'priorities/set-reuse/SOURCE-READINESS.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/set-reuse/SOURCE-READINESS.json', 'sha256': '4ac8964004938d4d02840e135254b3bc1a57c0cc3f1018ed50909bf79a1cb556', 'mode': 292}, {'logical_path': 'priorities/set-reuse/cpython-3.12.15-fractions.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/set-reuse/cpython-3.12.15-fractions.py', 'sha256': 'd52d1ab9d5be26924e4914a5e40069c992bbfa68f773694c2e5ee8452d0766a0', 'mode': 292}, {'logical_path': 'priorities/set-reuse/finite_set_controls.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/set-reuse/finite_set_controls.py', 'sha256': '760f151efd18b281c7045e979d2c3f95ce58c5d8bb1340e34d2afa68bd072919', 'mode': 292}, {'logical_path': 'priorities/set-reuse/set_reuse.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/set-reuse/set_reuse.py', 'sha256': 'eeeead34731e73f74dff250f354e57b72314c4e18670848bfa9f48c87de1305d', 'mode': 292}, {'logical_path': 'priorities/trace-encoding/ADAPTER.md', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/trace-encoding/ADAPTER.md', 'sha256': '964464a343806c89472c9965dc976ca47f61323c0b4afae6db276ab97e84d47f', 'mode': 292}, {'logical_path': 'priorities/trace-encoding/CALL-BUDGET.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/trace-encoding/CALL-BUDGET.json', 'sha256': '917d6ec6a8327e785e48b119c47df26f49091f83bf2b7414383d4cc3cad71aab', 'mode': 292}, {'logical_path': 'priorities/trace-encoding/PROPOSAL.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/trace-encoding/PROPOSAL.json', 'sha256': 'ba8c9852a8c82fc96099aade07dcd56989fec998dc9acbb9b39d90e1898dc50d', 'mode': 292}, {'logical_path': 'priorities/trace-encoding/RESEARCH.md', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/trace-encoding/RESEARCH.md', 'sha256': 'aca1bbf6047d5300e4f813ef2cab0a7a9197ea50c5f62e7d77b4c60eba207d60', 'mode': 292}, {'logical_path': 'priorities/trace-encoding/SOURCE-READINESS.json', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/trace-encoding/SOURCE-READINESS.json', 'sha256': '23afdefab937a1da4ed46676940fab2e897aad5e76996c3002928040f00244df', 'mode': 292}, {'logical_path': 'priorities/trace-encoding/trace_adapter.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/trace-encoding/trace_adapter.py', 'sha256': '4bdb401271ffd049c52eff0edc28d8d604a11faf66fec419555a82cbd3b32d60', 'mode': 292}, {'logical_path': 'priorities/trace-encoding/trace_controls.py', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/trace-encoding/trace_controls.py', 'sha256': '527bb08e870dc2ee19bebf101e7353c6db8422a5702a80bca231b54d2a4af447', 'mode': 292}, {'logical_path': 'priorities/trace-encoding/trace_encoder.c', 'reference': '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/priorities/trace-encoding/trace_encoder.c', 'sha256': '57d6f0f71d5bfd2145397ac0159837d32990b276fead2ec1b1d6854d8913bd7e', 'mode': 292}], 'actual_original_scope': 'Entire original immutable stage source closure preserved; no native fixture/compiler/header generated or source copied here.', 'legacy_metadata_not_a_new_command_grant': ['JOBS.json', 'PLAN.json', 'PLAN.md', 'STAGE.json'], 'actual_stage_created': False} diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-epoch-products-v5/SOURCE-CASE-CONTEXTS.json b/research/h25-cache-source-handoff/snapshot/areas/cache-epoch-products-v5/SOURCE-CASE-CONTEXTS.json new file mode 100644 index 0000000000..1d9202a301 --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-epoch-products-v5/SOURCE-CASE-CONTEXTS.json @@ -0,0 +1,157 @@ +{ + "N23": { + "does_not_cross": "No FULLNone gate, no private request or native arithmetic is reached.", + "entry": "actual suite.products[roles](actual_circuit,actual_checks,{_h25_missing_roles:1})", + "fault": "Only the real Suite class retire member is temporarily replaced by the pinned fixed Python cleanup function raising the distinct S object. No original role body/private source caller is replaced.", + "genuine_objects": "Actual original ComplexSideCircuit and Checks created by their source constructors; actual Suite from original loaders and epoch derive. Fresh Suite active is False, terminal False, no error/registry authority is invented. No private epoch arm is called.", + "oracle": "Original source code[roles] on the nonempty plain literal dict raises exact KeyError args(roles,) with a traceback frame matching the actual generated role code. Automatic role finally retains this actual P by identity and distinct S/uncertainty; helper terminates metadata. An unrelated outer LookupError remains handled and cannot become P.", + "source_checkpoint": "FACTORIES_ADMITTED after actual Suite construction; operation5 current source check must succeed before the fixed retirement fault. Generated actual role product is retained in Suite/proofs." + }, + "P08": { + "P08_early_variants": "Real candidate prepare/install/bind/seal context from exact paired immutable images, activeFalse; actual original arm source fault at entry or after actual original set arm; actual epoch_arm source-entry fault before FULLNone. Distinct real disarm wrapper calls original function once then S; actual retirement wrapper calls original metadata retirement once then R. Exact source bytes and type/args/frame/P-S-R/owner/argv oracles required. No FullNone write, no dummy arm or fake active flag.", + "P08_original_body": "Remains OPEN under current EPOCH_FULLNone. Only a separately independently admitted actual full source-control context could exercise its unchanged original AttributeError/actual labels-frame/P-S-R oracle through same complete armed path. A FullNone/phase refusal is never its PASS.", + "baseline_cleanup_cases": "Actual original prepare(arm=baseline) state and original install/seal API; enabledFalse is genuine source outcome, no candidate flag mutation, no private Suite/epoch authority. Original P1 lease is genuinely sealed/eligible and armed by actual data_adapters.arm, then original disarm. Pinned normal script for cleanup-only, actual original Checks.verify_labels public-data failure script for body cases; original private P08 oracle not replaced. Separate Root/source/native/context/cost qualification required.", + "no_manual_authority": "Context JSON supplies no Root/capability/current native profile or execution grant. No actual context constructed here.", + "original_candidate_body_oracle_qualified": false, + "production_entry": "Same _epoch_cli_boundary called by main and controls, both actual arming operations inside scope, actual caller pre-arm argv passed", + "source_images": { + "bytes": 7020, + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/CLI-FAULT-SOURCE-PINS-v3.json", + "sha256": "d3733658f54067edcc518c4222559b0f2bc040aab6e43b6facf30dc98a8798fb" + } + }, + "V2_ORIGIN_FIRST_ALL_ROUTES": { + "context": "Each variant starts with an actual unarmed Suite/current operation5 validation from a separate genuine cold owner. Phase gates after the first source guard are irrelevant to the intended failure; no phase is rewritten.", + "fault": "Replace only current EpochLedger.origin class member with the fixed Python forbidden callback; retain original function objects unchanged.", + "oracle": "Exact RuntimeError(Epoch engine class binding differs) with actual independently captured engine_guard code frame; forbidden callback log remains empty and arithmetic counters unchanged. Restoring that owned fault member does not revive or reset FAILED origin state; parent disposes the child.", + "variants": [ + { + "fresh_child_required": true, + "operation_index": 1, + "route": "derive" + }, + { + "fresh_child_required": true, + "operation_index": 2, + "route": "product" + }, + { + "fresh_child_required": true, + "operation_index": 3, + "route": "stages" + }, + { + "fresh_child_required": true, + "operation_index": 4, + "route": "seal" + }, + { + "fresh_child_required": true, + "operation_index": 5, + "route": "check" + }, + { + "fresh_child_required": true, + "operation_index": 6, + "route": "manifest" + } + ] + }, + "V2_OWNER_FIRST_CAPTURE": { + "actual_source_selection": "CONTROL-FAULT-SOURCE-PINS.json first image plus exact paired driver pin. Future actual Root must authenticate those actual distinct bytes; production hashes never accept a control image.", + "context": "Actual consumed load ticket, exact factory context including disposition_state and original genuine factory handles/args; owner record is allocated by real install_epoch_circuit before invoke. No private epoch arm or FULL contract is required for source fixture acquisition under a separate admitted native-control profile.", + "fault": "A fixed Python RuntimeError statement immediately after prepare_epoch_cache_contract returned with real parent binding published and before the first capture_graph0 call.", + "oracle": "Exact literal marker, actual admit code frame and actual pinned authority file SHA/code ownership; prepared/owner record pointers are actual State binding; origin_handle is None; raw primary is the caught P; actual parent one-shot teardown attempted, no receipt manufactured; any real close failure has distinct raw S/uncertainty." + }, + "V2_OWNER_LATE_GRAPH": { + "actual_source_selection": "CONTROL-FAULT-SOURCE-PINS.json late image and paired driver; no production source-map spoofing.", + "fault": "Fixed Python RuntimeError after original origin capture/update and before factory graph completion.", + "oracle": "Exact late marker and actual admit frame; record.origin_handle is an actual returned origin handle, failure fence quarantines it, actual State binding retains the genuine owner through parent one-shot cleanup. No stage string is treated as a handle." + }, + "V2_ROLE_CLEANUP_ONLY": { + "FULLNone_bypass": false, + "entry": "same actual generated role product with plain roles0/sources{}/gates[]/outputs{} code", + "genuine_scope": "A separate fresh unarmed actual Suite and original source objects, never reused after N23. This is a cleanup-only source control, not a substitute for any full role scenario.", + "oracle": "Actual original body returns its roles0 result without a private call; automatic retirement S is the raised primary by identity and frame, secondary remains None, uncertainty/terminal metadata recorded. Unrelated handled LookupError is not borrowed." + }, + "V3_CLI": { + "P08_early_variants": "Real candidate prepare/install/bind/seal context from exact paired immutable images, activeFalse; actual original arm source fault at entry or after actual original set arm; actual epoch_arm source-entry fault before FULLNone. Distinct real disarm wrapper calls original function once then S; actual retirement wrapper calls original metadata retirement once then R. Exact source bytes and type/args/frame/P-S-R/owner/argv oracles required. No FullNone write, no dummy arm or fake active flag.", + "P08_original_body": "Remains OPEN under current EPOCH_FULLNone. Only a separately independently admitted actual full source-control context could exercise its unchanged original AttributeError/actual labels-frame/P-S-R oracle through same complete armed path. A FullNone/phase refusal is never its PASS.", + "baseline_cleanup_cases": "Actual original prepare(arm=baseline) state and original install/seal API; enabledFalse is genuine source outcome, no candidate flag mutation, no private Suite/epoch authority. Original P1 lease is genuinely sealed/eligible and armed by actual data_adapters.arm, then original disarm. Pinned normal script for cleanup-only, actual original Checks.verify_labels public-data failure script for body cases; original private P08 oracle not replaced. Separate Root/source/native/context/cost qualification required.", + "no_manual_authority": "Context JSON supplies no Root/capability/current native profile or execution grant. No actual context constructed here.", + "original_candidate_body_oracle_qualified": false, + "production_entry": "Same _epoch_cli_boundary called by main and controls, both actual arming operations inside scope, actual caller pre-arm argv passed", + "source_images": { + "bytes": 7020, + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/CLI-FAULT-SOURCE-PINS-v3.json", + "sha256": "d3733658f54067edcc518c4222559b0f2bc040aab6e43b6facf30dc98a8798fb" + } + }, + "V3_instance": { + "cases": [ + "origin instance-method exact-str shadow", + "remove origins key then add foreign colliding key; foreign equality forbidden", + "distinct class_origin and method_origin binding replacements", + "foreign phase/failure or bool serial; native typed schema refusal before equality/__class__ callbacks" + ], + "cleanup": "Restore only the owned fault binding; never reset actual origin table or reviveFAILED generation. Parent disposes each child and pays real one-shot cleanup. Rejected instance dictionaries are not written by failure custody; actual error retained in captured independent box and known origin/Suite dictionaries.", + "guard": "Native dictionary identity, string-key scan, exact names/census, fixed bindings, precise mutable scalar schema, class/member/environment, all before mutable method dispatch. COLD/serial1 legitimate capture/failure interval retained.", + "scope": "Actual engine authentication namespace only. No universal arbitrary private/native heap adversary is assumed." + }, + "V4_raw_journal": { + "actual_CLI_context": "Genuine candidate source-context prepare/install/bind/seal outcome, Suite unarmed and errorsNone, original pre-arm owner. Actual fixed source arm function raises exact P BEFORE epoch_arm/FULLNone; original disarm executes then S; actual metadata retire executes then fresh R; same callee append source port delivers J.", + "actual_contexts_created": 0, + "actual_role_context": "Actual original Label/Checks/circuit and derived untouched Suite; _live first; actual generated role missing-roles KeyError P; automatic role finally invokes actual source retire wrapper, fresh R and then fixed Python optional append J.", + "no_native_arithmetic": "CLI _counts before/after identical; role body fails on original roles key before private requests.", + "oracle": "P exact outward object/frame; S exact observed post-original disarm; R fresh at actual retire frame and fixed channel error matches actual caller raw slot; no secondary list R, J exact declared port frame; terminal/notactive/no pending/registry/uncertainty; ACK after direct raw transfer.", + "source_port_images_are_not_production": true + }, + "V4_restore": { + "actual_context": "Actual original baseline prepare/install/bind/seal outcome enabledFalse with real original P1 pre-arm owner. No private Suite or active flag is fabricated. Exact distinct data/adapter/cache/authority/driver images checked before work.", + "entry": "SAME production _epoch_cli_boundary including both original arms/argv/runpy/disarm/retirement. Actual original normal91B script or independent original verify_labels AttributeError script, matching source hash.", + "faults": "Fixed actual-driver source port: after original argv assignment then A; before original assignment then A (does not assert restored pointer); original disarm once then S; actual data epoch_retire once then external R. No native setter fault experiment.", + "not_original_candidate_P08": true, + "oracle": "Exact native exception type/args, actual code frames, P/A/S/R identities/fixed records and real original disarmed owner. Body P remains outward; otherwise A remains outward through S/R. Before case observes failed restoration before source-case parent restores its own argv fixture." + }, + "V5_actual_main": { + "absent_record_case": "Future genuine full candidate source context reaches actual Suite construction/install/bind/seal. Exact fixed driver source raises P immediately before common CLI record allocation. Original disarm attempted, data inner metadata retire R1/J1; actual main outer retire R2/J2; STOP first P and native-owned teardown. Fixed raw slots and distinct channel/exception identities observed before replay negative.", + "absent_record_context_status": "OPEN. Current selected source literals FULLNone prohibit this actual full path. Source tuple/pin DATA does not admit a stronger FULL context. Future independently reviewed typed FULL/source assembly, including exact updated case tuple pins, required; control never mutates FULL, maps, active flags or origin records.", + "actual_contexts_created": 0, + "cleanup_oracle": "Exact main/STOP/error code frames and types/args/raw object identity; fixed raw main E local/record; actual STOP first-primary literal; every existing known cache-binding owner must have original teardown attempted. No unknown native owner disposition is invented.", + "entry": "All3 bodies call SAME actual _run_epoch_with_stop_evidence, which invokes actual main_epoch. No function substitution, source-body extraction/shortcut or fake state injection. Genuine cold driver state/packet are None at case entry. Exact paired image hashes checked before adverse work.", + "finite_cases": "main_primary_outer: real baseline --finite-only CLI reaches actual native/factory/data preparation, publishes actual state, then fixed ValueError P; original outer data retirement then fixed fresh RuntimeError E. main_cleanup_only: real baseline --finite-only CLI completes original finite controls/terminal/late protocol and return, then outer E. Both require real original guarded cold context and full costs; no FULLNone expected error.", + "source_port_not_native_qualification": "Plain fixed ValueError before record construction models declared source boundary; fresh ordinary R and J from fixed Python copies do not qualify actual OOM/async/native setter behavior." + }, + "actual_contexts_created": 0, + "all_original155_212_24_and32_retained": true, + "candidate_original_P08_body": "OPEN; unchanged original body, no early source case/finitelane/None refusal replacement.", + "common_mandatory_context": { + "execution": "SOURCE only here. Actual parent source-control context/profile/native ownership/command/cost admission is required before any future creation or invocation. All source-case operations use the same original OS/CPython/native TCB scope; no extra no-signal/no-thread/hostile-code premise is introduced.", + "ownership": "One fresh actual parent failure state is reachable from actual driver_module._EXECUTION[state] and from its real owned_states before any cache acquisition. All native owners use the existing profile/teardown/outer-cost requirements; no test model, fake assembler, manually set active flag or registry/origin reset.", + "source_identity": "Future independently authenticated original Root/capability/provider plus the exact paired immutable driver/authority/cache/data/control source images; every actual object is created by their actual source loaders/factories. Type names or the values in this JSON do not establish admission.", + "stop": "Parent retains actual errors/raw observations before formatting, runs actual epoch_cleanup_owned exactly once per acquired owner before late audit, records uncertainty and all costs, and discards the child after each negative. A copy/source case cannot be relabeled as production or a family PASS." + }, + "existing_masking_case_contexts": { + "N03_N07": "Actual FACTORIES_ADMITTED or CALLERS_INSTALLED phase, exact finite slot/role error and actual authorize frame.", + "N10": "Actual new clone has returned, raw RuntimeGuard initialized and owner.runtime is actual raw guard; GLOBALS_COMMITTED is reached by real stages, before actual finish. No manual phase or raw object fabrication. Extra module slot must fail actual ledger namespace census with check frame.", + "N18": "Actual retirement then structural retired/consumed refusal before FULLNone; exact arm error/frame.", + "N24": "Separate fresh nonterminal unconsumed generation; exact FULLNone error/frame. No FULL contract is overwritten." + }, + "external_unknown_controller_cleanup_prerequisite_closed": false, + "grants_live_Root_native_or_private_epoch_authority": false, + "no_source_scenario_or_runtime_PASS_created": true, + "predecessor_V2_P08_description": { + "actual_path": "Actual original adapters.arm, actual source-case runpy, actual generated verify_labels original body, original argv restoration, actual original adapters.disarm, automatic helper retirement. Production main still runs original data arm and private epoch arm gates before entering the same helper. The helper supplies no authority or private arm.", + "case_script": { + "bytes": 313, + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v2/epoch_case_pre_role_failure_v2.py", + "sha256": "69df433711521d709c7045c8b6f9cd13ad92f4165d4b533d559b5447c46464e8" + }, + "does_not_claim": "This source case exercises failure custody/argv/disarm at the shared actual boundary. It is not a historical full CLI scientific run or a current Root/profile grant.", + "entry": "actual driver._epoch_cli_boundary used by production main; real runpy.run_path on the pinned source-case script", + "genuine_objects": "A separate fresh genuine unarmed Suite and actual original Checks object whose class has the actual installed labels product. The original P1 owner is sealed by its real source method after source installation, with cli_active False, used False, circuit/checks/triples/current None; fixture objects were constructed outside its armed interval. The separately reviewed pinned source-case parent attests this finite CLI fixture before actual adapters.arm. No captured circuit, active flag, token, sealed flag or Root capability is fabricated; no set-reuse allowance is used by the intended pre-role failure. Driver/data/_EXECUTION identities must match.", + "input_mutation": "The public ordinary checks.c field is set to None. A freshly owned data-only ModuleType input slot supplies that genuine Checks to the fixed source script. The unique sys.modules entry must be absent beforehand and only that exact owned entry is removed afterward; semantic authority/origin registries are never reset.", + "oracle": "Exact AttributeError args(NoneType object has no attribute active), actual labels code frame and actual CLI helper frame; argv is the identical original list; original P1 owner cli_active False and current/circuit/checks/triples None; actual P retained and distinct cleanup S/uncertainty retained. The control never manually calls epoch_retire." + }, + "schema": "h25-cache-products-source-case-contexts-v5" +} diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-epoch-products-v5/epoch_authority_products_v1.py.txt b/research/h25-cache-source-handoff/snapshot/areas/cache-epoch-products-v5/epoch_authority_products_v1.py.txt new file mode 100644 index 0000000000..5f825d8e9c --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-epoch-products-v5/epoch_authority_products_v1.py.txt @@ -0,0 +1,2431 @@ +"""Separate V7 cold authority; SOURCE ONLY until the parent's execution gate. + +Raw-load before any candidate exposure. All later checking routines are private +closures over the original primitive/stdlib token. They never dispatch through +a mutable public validator before authenticating it. No native code lives here. +""" +import _ast +import ast +import builtins +import copy +import copyreg +import genericpath +import hashlib +import io +import ntpath +import os +import pathlib +import posixpath +import sys +import types + +SOURCE_REVIEW_GATE = None +EXECUTION_GATE = None +NATIVE_GATE = None +FULL_FUNDING_GATE = None +ROOT_SHA256 = 'f5a2d33f2b4d3651f214156a0e7094c2bb516ce2d5ab7698d18c11f98f35dee0' +PROVIDER_SHA256 = '9cbb7368f89e71d1e6cc46db5dc77efed3e03ed2a801c98c88fe316e4d9f3ef2' +BACKEND_SHA256 = 'e473c38245c3668715b5a78dfe980b2fe3ed0d0c9b8c97c666fbae6ecf1fffd5' +CACHE_PRODUCER_SHA256 = '133c55e269b354542f86a2a1099f48cff052293d06da310f98b7cb33cb85258f' +_CAPTURE_ONCE = [] + + +def capture_authority(root, capability, api): + """Return load/invoke/check/runtime_guard/check_product/set_guard/source. + + The trusted parent calls this entry once immediately after raw source exec. + A later backend instance derives provenance from this original token; it + cannot substitute a newly captured stdlib or a self-reported class record. + """ + if _CAPTURE_ONCE: + raise RuntimeError('Cold authority can only be captured once before exposure') + _CAPTURE_ONCE.append(True) + type0, id0, len0, next0, tuple0, list0 = type, id, len, next, tuple, list + dict0, str0, bytes0, object0, int0 = dict, str, bytes, object, int + error0, base_error0, value_error0 = RuntimeError, BaseException, ValueError + function_type, module_type, code_type = types.FunctionType, types.ModuleType, types.CodeType + builtin_type, cell_type = types.BuiltinFunctionType, types.CellType + static_type, class_type, property_type = staticmethod, classmethod, property + dict_get, dict_items, dict_iter = dict.get, dict.items, dict.__iter__ + dict_len, dict_set, dict_del, dict_clear = dict.__len__, dict.__setitem__, dict.__delitem__, dict.clear + object_get = object.__getattribute__ + type_get = type.__getattribute__ + module_dict_get = module_type.__dict__['__dict__'].__get__ + class_dict_get = type.__dict__['__dict__'].__get__ + class_mro_get = type.__dict__['__mro__'].__get__ + cell_get = cell_type.__dict__['cell_contents'].__get__ + function_fields = tuple((name, function_type.__dict__[name].__get__) for name in + ('__code__', '__globals__', '__builtins__', '__defaults__', + '__kwdefaults__', '__closure__', '__dict__')) + proxy_type = type(type.__dict__) + proxy_get, proxy_iter, proxy_items, proxy_len = proxy_type.get, proxy_type.__iter__, proxy_type.items, proxy_type.__len__ + builtin_self_get = builtin_type.__dict__['__self__'].__get__ + builtin_namespace = builtins.__dict__ + missing = object0() + missing_id = id0(missing) + initial_sys_modules = sys.modules + initial_sys_flags = sys.flags + initial_optimize = sys.flags.optimize + sys_owner = sys + sys_namespace = module_dict_get(sys_owner, module_type) + authority_namespace = globals() + root_pin, provider_pin, backend_pin = ROOT_SHA256, PROVIDER_SHA256, BACKEND_SHA256 + cache_pin = CACHE_PRODUCER_SHA256 + max_source, max_functions, max_classes = 1048576, 8192, 2048 + registry, by_namespace, products, backend_guards = {}, {}, {}, {} + transitions = [] + initial_std_modules = (_ast, ast, copy, copyreg, genericpath, hashlib, io, + ntpath, os, pathlib, posixpath, types) + producer_rules = ( + ('320435ec4125544f2b2aedf74f21469b232d08683fe76f0913607516254bbd29', 'make_runtime_guard', 'backend_guard'), + ('f7ca7f4f03ac63c1a95ba42f06149543211566de5e29f487a3dc4d08c5ee9b94', 'extra_guard_type', 'extra_guard'), + ('4bdb401271ffd049c52eff0edc28d8d604a11faf66fec419555a82cbd3b32d60', 'make_trace_type', 'trace'), + ('364b45c100be73a7ace44ab664f3c792020dad6f33f7788b62aaeab67c0c5aa9', 'make_row_interner', 'row_function'), + ('364b45c100be73a7ace44ab664f3c792020dad6f33f7788b62aaeab67c0c5aa9', 'make_runtime_guard', 'row_guard'), + ('364b45c100be73a7ace44ab664f3c792020dad6f33f7788b62aaeab67c0c5aa9', 'make_cache_runtime_guard', 'row_guard'), + ('5aeee9364d29147ef4e1bfffba532f7392833a6158d73d1da50ed6c772f061af', 'derive_row_bind', 'row_bind'), + (cache_pin, 'compose_runtime_guard', 'cache_guard')) + + def need(ok, message): + if not ok: + raise error0(message) + + def string_domain(owner, domains): + key = iterator = kind = None + try: + identity = id0(owner) + prior = dict_get(domains, identity, missing) + if prior is not missing: + return prior + kind = type0(owner) + if kind is dict0: + iterator = dict_iter(owner) + elif kind is proxy_type: + iterator = proxy_iter(owner) + else: + return False + while True: + key = next0(iterator, missing) + if key is missing: + break + if type0(key) is not str0: + dict_set(domains, identity, False) + return False + key = None + dict_set(domains, identity, True) + return True + finally: + key = iterator = kind = owner = None + + def get_id(owner, name, domains): + try: + if type0(name) is not str0 or not string_domain(owner, domains): + return -1 + if type0(owner) is dict0: + return id0(dict_get(owner, name, missing)) + return id0(proxy_get(owner, name, missing)) + finally: + owner = None + + def identity_mapping(owner, expected): + """Non-string dispatch dictionaries: identity scan, never key equality.""" + iterator = pair = key = value = None + try: + if type0(owner) is not dict0 or dict_len(owner) != len0(expected): + return False + iterator = iter0(dict_items(owner)) + while True: + pair = next0(iterator, missing) + if pair is missing: + break + key, value = pair + found = False + for old_key, old_value in expected: + if key is old_key: + if value is not old_value: + return False + found = True + break + if not found: + return False + pair = key = value = None + return True + finally: + iterator = pair = key = value = owner = None + + iter0 = iter + + def code_names(code): + pending, result, seen = [code], [], {} + while pending: + current = pending.pop() + need(type0(current) is code_type, 'Cold authority code shape differs') + for name in current.co_names: + need(type0(name) is str0, 'Cold authority code name shape differs') + if dict_get(seen, name, missing) is missing: + dict_set(seen, name, True) + result.append(name) + for value in current.co_consts: + if type0(value) is code_type: + pending.append(value) + return tuple0(result) + + def raw_function_record(function): + need(type0(function) is function_type, 'Cold authority requires exact functions') + values = tuple0(getter(function, function_type) for _, getter in function_fields) + code, namespace, builtins_owner, defaults, keywords, closure, attributes = values + domains = {} + try: + need(type0(namespace) is dict0 and type0(builtins_owner) is dict0 and + string_domain(namespace, domains) and string_domain(builtins_owner, domains), + 'Cold authority initial function dictionary domain differs') + keyword_items = () + if keywords is not None: + need(type0(keywords) is dict0 and string_domain(keywords, domains), + 'Cold authority initial keyword defaults differ') + keyword_items = tuple0(dict_items(keywords)) + cells = () if closure is None else tuple0((cell, cell_get(cell, cell_type)) for cell in closure) + lookups = tuple0((name, dict_get(namespace, name, missing), dict_get(builtins_owner, name, missing)) + for name in code_names(code)) + need(type0(attributes) is dict0 and string_domain(attributes, domains), + 'Cold authority function attribute dictionary differs') + return (function, values, keyword_items, cells, lookups, tuple0(dict_items(attributes))) + finally: + dict_clear(domains) + + def capture_graph(initial_functions, initial_classes): + """Called only at initial source load or directly after an admitted producer.""" + functions, classes, seen_functions, seen_classes = [], [], {}, {} + pending_functions, pending_classes = list0(initial_functions), list0(initial_classes) + while pending_functions or pending_classes: + while pending_classes: + cls = pending_classes.pop() + need(type0(cls) is type0, 'Cold authority class metaclass differs') + if dict_get(seen_classes, id0(cls), missing) is not missing: + continue + need(len0(classes) < max_classes, 'Cold authority class census exceeds bound') + dict_set(seen_classes, id0(cls), cls) + mro = class_mro_get(cls, type0) + proxy = class_dict_get(cls, type0) + members = tuple0(proxy_items(proxy)) + classes.append((cls, mro, proxy, members)) + for base in mro[1:]: + if type0(base) is type0: + pending_classes.append(base) + for name, value in members: + need(type0(name) is str0, 'Cold authority class member name differs') + kind = type0(value) + if kind is function_type: + pending_functions.append(value) + elif kind is static_type or kind is class_type: + underlying = object_get(value, '__func__') + if type0(underlying) is function_type: + pending_functions.append(underlying) + elif kind is property_type: + for field in ('fget', 'fset', 'fdel'): + underlying = object_get(value, field) + if type0(underlying) is function_type: + pending_functions.append(underlying) + if pending_functions: + function = pending_functions.pop() + if dict_get(seen_functions, id0(function), missing) is not missing: + continue + need(len0(functions) < max_functions, 'Cold authority function census exceeds bound') + record = raw_function_record(function) + dict_set(seen_functions, id0(function), function) + functions.append(record) + for cell, value in record[3]: + if type0(value) is function_type: + pending_functions.append(value) + defaults = record[1][3] + if defaults is not None: + need(type0(defaults) is tuple0, 'Cold authority positional defaults shape differs') + for value in defaults: + if type0(value) is function_type: + pending_functions.append(value) + for name, value in record[2] + record[5]: + if type0(value) is function_type: + pending_functions.append(value) + # Source-owned function helpers reached through effective globals + # are authenticated transitively, including validator helpers. + for name, value, builtin_value in record[4]: + if type0(value) is function_type: + pending_functions.append(value) + return (tuple0(functions), tuple0(classes)) + + def expected_global(namespace, name, expected): + if name != 'RuntimeGuard': + return expected + record = dict_get(by_namespace, id0(namespace), missing) + if record is not missing and record[2] is namespace and record[12] == 'backend': + return dict_get(backend_guards, id0(record[0]), missing) + return expected + + def fresh_function(record, domains, builtin_values): + function, values, keyword_items, cells, lookups, attributes_items = record + if type0(function) is not function_type: + return False + field_key = ('function-fields', id0(function)) + observed_fields = dict_get(domains, field_key, missing) + if observed_fields is missing: + scalar_fields = [] + for (_, getter), expected in zip0(function_fields, values): + observed_id = id0(getter(function, function_type)) + if observed_id != id0(expected): + return False + scalar_fields.append(observed_id) + dict_set(domains, field_key, tuple0(scalar_fields)) + else: + if len0(observed_fields) != len0(values): + return False + for observed_id, expected in zip0(observed_fields, values): + if observed_id != id0(expected): + return False + code, namespace, builtins_owner, defaults, keywords, closure, attributes = values + if keywords is not None: + if type0(keywords) is not dict0 or dict_len(keywords) != len0(keyword_items): + return False + for name, expected in keyword_items: + if get_id(keywords, name, domains) != id0(expected): + return False + for cell, expected in cells: + try: + if id0(cell_get(cell, cell_type)) != id0(expected): + return False + except value_error0: + return False + if dict_len(attributes) != len0(attributes_items): + return False + for name, expected in attributes_items: + if get_id(attributes, name, domains) != id0(expected): + return False + lookup_key = ('function-lookups', id0(function), id0(code), + id0(namespace), id0(builtins_owner)) + observed_lookups = dict_get(domains, lookup_key, missing) + if observed_lookups is missing: + scalar_lookups = [] + for name, expected, expected_builtin in lookups: + observed_global = get_id(namespace, name, domains) + if observed_global != id0(expected_global(namespace, name, expected)): + return False + # A false builtin_values path must not observe builtin keys or + # values. The absent slot is completed only in a later true path. + if builtin_values: + observed_builtin = get_id(builtins_owner, name, domains) + if observed_builtin != id0(expected_builtin): + return False + scalar_lookups.append((name, observed_global, True, observed_builtin)) + else: + scalar_lookups.append((name, observed_global, False, 0)) + dict_set(domains, lookup_key, tuple0(scalar_lookups)) + else: + if len0(observed_lookups) != len0(lookups): + return False + completed_lookups = None + index = 0 + for (name, expected, expected_builtin), observed in zip0(lookups, observed_lookups): + if observed[0] != name: + return False + if observed[1] != id0(expected_global(namespace, name, expected)): + return False + if builtin_values: + if observed[2]: + observed_builtin = observed[3] + else: + observed_builtin = get_id(builtins_owner, name, domains) + if observed_builtin != id0(expected_builtin): + return False + if not observed[2]: + if completed_lookups is None: + completed_lookups = list0(observed_lookups) + completed_lookups[index] = (name, observed[1], True, observed_builtin) + index += 1 + if completed_lookups is not None: + dict_set(domains, lookup_key, tuple0(completed_lookups)) + return True + + zip0 = zip + + def fresh_graph(graph, domains, builtin_values, message): + functions, classes = graph + for cls, mro, proxy, members in classes: + if not (type0(cls) is type0 and class_mro_get(cls, type0) is mro and + proxy_len(proxy) == len0(members)): + need(False, message + ': class dispatch') + for name, expected in members: + if not (get_id(proxy, name, domains) == id0(expected)): + need(False, message + ': class member ' + name) + for record in functions: + if not (fresh_function(record, domains, builtin_values)): + need(False, message + ': function environment') + + def module_image(module, name, kind, path, digest, source_bytes, *, stdlib=False): + need(type0(module) is module_type, 'Cold authority module exact type differs') + namespace = module_dict_get(module, module_type) + domains = {} + try: + need(type0(namespace) is dict0 and string_domain(namespace, domains), + 'Cold authority module dictionary domain differs') + items = tuple0(dict_items(namespace)) + functions, classes = [], [] + for field, value in items: + if type0(value) is function_type: + if stdlib or value.__globals__ is namespace: + functions.append(value) + elif type0(value) is type0: + declared = type_get(value, '__module__') + if stdlib or (type0(declared) is str0 and declared == name): + classes.append(value) + graph = capture_graph(functions, classes) + mappings = [] + selected = ('_CANONICAL_BUILTINS', '_TYPE_BUILTINS') if kind == 'backend' else () + for field in selected: + mapping = dict_get(namespace, field, missing) + need(type0(mapping) is dict0, 'Cold authority backend dispatch dictionary differs') + mappings.append((field, mapping, tuple0(dict_items(mapping)))) + original_guard = dict_get(namespace, 'RuntimeGuard', missing) if kind == 'backend' else None + if kind == 'backend': + need(type0(original_guard) is type0, 'Cold authority original RuntimeGuard differs') + handle = object0() + return (handle, module, namespace, name, path, digest, source_bytes, + items, graph[0], graph[1], tuple0(mappings), original_guard, kind) + finally: + dict_clear(domains) + + def record_for(handle): + record = dict_get(registry, id0(handle), missing) + need(record is not missing and record[0] is handle, 'Cold authority handle is not registered') + return record + + def fresh_module(record, domains, builtin_values, *, registry_slot=True, exact_census=True, prefix='Cold authority'): + module, namespace = record[1], record[2] + if not (type0(module) is module_type and module_dict_get(module, module_type) is namespace): + need(False, prefix + ': module owner differs') + if registry_slot: + if not (get_id(initial_sys_modules, record[3], domains) == id0(module)): + need(False, prefix + ': registered module slot differs') + if exact_census: + if not (dict_len(namespace) == len0(record[7])): + need(False, prefix + ': namespace census differs') + for name, expected in record[7]: + if not (get_id(namespace, name, domains) == id0(expected_global(namespace, name, expected))): + need(False, prefix + ': namespace binding ' + name) + for name, mapping, expected in record[10]: + if not (identity_mapping(mapping, expected)): + need(False, prefix + ': dispatch dictionary ' + name) + fresh_graph((record[8], record[9]), domains, builtin_values, prefix) + + need(type0(root) is module_type and type0(api) is tuple0 and len0(api) == 4, + 'Cold authority requires the actual pristine root and sealed fourtuple') + root_namespace = module_dict_get(root, module_type) + root_api_graph = capture_graph(api, ()) + root_hash = dict_get(root_namespace, '_hash_regular', missing) + root_compile = dict_get(root_namespace, '_COMPILE', missing) + root_exec = dict_get(root_namespace, '_EXEC', missing) + root_identity = api[0] + initial_builtin_items = tuple0(dict_items(builtin_namespace)) + stdlib_records = tuple0(module_image(module, module.__name__, 'stdlib', None, None, None, stdlib=True) + for module in initial_std_modules) + stdlib_mappings = tuple0((mapping, tuple0(dict_items(mapping))) for mapping in + (copy._deepcopy_dispatch, copy.dispatch_table, copyreg.dispatch_table)) + self_graph = capture_graph((dict_get(authority_namespace, 'capture_authority'),), ()) + self_items = tuple0(dict_items(authority_namespace)) + + def root_and_stdlib(domains): + need(type0(sys_owner) is module_type and module_dict_get(sys_owner, module_type) is sys_namespace and + get_id(sys_namespace, 'modules', domains) == id0(initial_sys_modules) and + get_id(sys_namespace, 'flags', domains) == id0(initial_sys_flags), + 'Cold authority interpreter owner differs') + need(dict_len(builtin_namespace) == len0(initial_builtin_items), 'Cold authority builtin census differs') + for name, expected in initial_builtin_items: + need(get_id(builtin_namespace, name, domains) == id0(expected), 'Cold authority builtin binding ' + name) + for name, expected in self_items: + need(get_id(authority_namespace, name, domains) == id0(expected), 'Cold authority source binding ' + name) + fresh_graph(self_graph, domains, True, 'Cold authority source') + fresh_graph(root_api_graph, domains, True, 'Cold authority root entry') + dict_clear(domains) + need(root_identity() == root_pin, 'Cold authority actual root source identity differs') + dict_clear(domains) + for record in stdlib_records: + fresh_module(record, domains, True, registry_slot=True, exact_census=False, prefix='Cold authority initial stdlib') + for mapping, expected in stdlib_mappings: + need(identity_mapping(mapping, expected), 'Cold authority initial copy dispatch differs') + + def check_registered(domains): + for record in tuple0(registry.values()): + fresh_module(record, domains, True) + + def cold_check(handle=None): + domains = {} + try: + root_and_stdlib(domains) + check_registered(domains) + if handle is not None: + record = record_for(handle) + dict_clear(domains) + digest, size, raw = root_hash(record[4], max_source, False) + need(digest == record[5], 'Cold authority source file changed') + return record + return None + finally: + dict_clear(domains) + + def load(path, digest, name, kind='module'): + cold_check() + need(type0(path) is str0 and path.startswith('/') and type0(digest) is str0 and len0(digest) == 64 and + type0(name) is str0 and name and type0(kind) is str0 and kind in ('module', 'backend'), + 'Cold authority source-load argument shape differs') + for character in digest: + need(character in '0123456789abcdef', 'Cold authority source digest is not lowercase SHA256') + need((kind == 'backend') == (digest == backend_pin), 'Cold authority original backend classification differs') + domains = {} + try: + need(get_id(initial_sys_modules, name, domains) == missing_id, 'Cold authority module name already registered') + finally: + dict_clear(domains) + observed, size, source_bytes = root_hash(path, max_source, True) + need(observed == digest and type0(source_bytes) is bytes0, 'Cold authority source bytes differ') + module = module_type(name) + namespace = module_dict_get(module, module_type) + namespace.update({'__file__': path, '__builtins__': builtin_namespace}) + # Dataclass/import ownership sees the correct unique slot during exec. + dict_set(initial_sys_modules, name, module) + try: + code = root_compile(source_bytes, path, 'exec', dont_inherit=True, optimize=initial_optimize) + root_exec(code, namespace) + record = module_image(module, name, kind, path, digest, source_bytes) + dict_set(registry, id0(record[0]), record) + dict_set(by_namespace, id0(namespace), record) + if kind == 'backend': + dict_set(backend_guards, id0(record[0]), record[11]) + cold_check(record[0]) + except base_error0: + # A failed source is retained in the unique slot for evidence and + # cannot be retried/reclassified as an unobserved clean load. + raise + return (module, record[0]) + + def make_caller_descriptor(operations, label): + """Mint only at original capture or an authenticated entry-three return. + + The caller checks the dispatcher record INLINE before invoking it. This + is not a claim that the dispatcher can authenticate its own replacement + code. Its already-admitted active frame checks all target/helper objects. + """ + pending, seen, records = list0(operations), {}, [] + while pending: + function = pending.pop() + if dict_get(seen, id0(function), missing) is not missing: + continue + need(len0(records) < max_functions, 'Cold authority caller helper census exceeds bound') + raw = raw_function_record(function) + record = (function,) + raw[1][:6] + (raw[2], raw[3]) + dict_set(seen, id0(function), function) + records.append(record) + for cell, value in record[8]: + if type0(value) is function_type: + pending.append(value) + records = tuple0(records) + field_getters = function_fields[:6] + primitives = (type0, function_type, id0, len0, field_getters, cell_type, + cell_get, error0, value_error0, tuple0, dict0, str0, + dict_get, dict_len, dict_iter, next0, dict_clear, missing, zip0) + + def dispatch(index, *args, **kwargs): + # The active caller has already authenticated this actual function. + # This pretarget block uses captured C primitives only. In particular + # it does not call need(), fresh_function(), or any other validator. + if type0(index) is not int0 or index < 0 or index >= len0(operations): + raise error0(label + ': operation index differs') + for record in records: + function = record[0] + if type0(function) is not function_type: + raise error0(label + ': target exact function differs') + for (name, getter), expected in zip0(field_getters, record[1:7]): + if id0(getter(function, function_type)) != id0(expected): + raise error0(label + ': target function environment differs') + keywords = record[5] + if keywords is not None: + if type0(keywords) is not dict0 or dict_len(keywords) != len0(record[7]): + raise error0(label + ': target keyword census differs') + iterator = current = None + valid_domain = True + try: + iterator = dict_iter(keywords) + while True: + current = next0(iterator, missing) + if current is missing: + break + if type0(current) is not str0: + valid_domain = False + break + current = None + finally: + # Foreign current keys never survive a retained error. + iterator = current = None + if not valid_domain: + raise error0(label + ': target keyword key domain differs') + for name, expected in record[7]: + if id0(dict_get(keywords, name, missing)) != id0(expected): + raise error0(label + ': target keyword value differs') + for cell, expected in record[8]: + try: + observed_id = id0(cell_get(cell, cell_type)) + except value_error0: + raise error0(label + ': target closure became empty') from None + if observed_id != id0(expected): + raise error0(label + ': target closure value differs') + # The chosen function object comes from the original immutable + # operations tuple, not a mutable late attribute or caller registry. + return operations[index](*args, **kwargs) + + raw_dispatch = raw_function_record(dispatch) + dispatch_record = (dispatch,) + raw_dispatch[1][:6] + (raw_dispatch[2], raw_dispatch[3]) + need(dispatch_record[4] is None and dispatch_record[5] is None and not dispatch_record[7], + 'Cold authority dispatcher source defaults contract differs') + return ('h25-cold-authority-caller-v1', operations, dispatch, + dispatch_record, records, primitives) + + def runtime_guard(handle): + record = cold_check(handle) + def guarded_helpers(): + domains = {} + try: + fresh_module(record, domains, False, prefix='Runtime drift: cache collector') + finally: + dict_clear(domains) + child_descriptor = make_caller_descriptor((guarded_helpers,), 'Runtime drift: cache collector caller') + return (guarded_helpers, child_descriptor) + + def known_backend(module): + need(type0(module) is module_type, 'Cold authority producer backend type differs') + namespace = module_dict_get(module, module_type) + record = dict_get(by_namespace, id0(namespace), missing) + need(record is not missing and record[1] is module and record[12] == 'backend' and record[5] == backend_pin, + 'Cold authority producer backend provenance differs') + return record + + def known_guard(cls): + need(type0(cls) is type0, 'Cold authority exact guard class differs') + for record in tuple0(registry.values()): + if record[12] == 'backend' and cls is record[11]: + return None + product = dict_get(products, id0(cls), missing) + need(product is not missing and product[0] is cls and product[6] in + ('backend_guard', 'extra_guard', 'row_guard', 'cache_guard'), + 'Cold authority guard was not produced by an admitted source') + domains = {} + try: + fresh_graph(product[5], domains, True, 'Cold authority producer base product') + finally: + dict_clear(domains) + return product + + def classify(record, export): + for digest, name, role in producer_rules: + if digest is not None and record[5] == digest and export == name: + return role + return None + + def validate_producer_arguments(record, export, role, args, kwargs): + domains = {} + try: + need(type0(kwargs) is dict0 and string_domain(kwargs, domains) and not kwargs, + 'Cold authority reviewed producers require positional arguments') + if role == 'backend_guard': + need(len0(args) == 1, 'Cold authority backend guard arguments differ') + known_backend(args[0]) + elif role == 'extra_guard': + need(len0(args) == 3 and type0(args[2]) is tuple0, 'Cold authority trace guard arguments differ') + known_guard(args[0]); known_backend(args[1]) + for entry in args[2]: + need(type0(entry) is tuple0 and len0(entry) == 3, + 'Cold authority trace entry shape differs') + owner, name, function = entry + need(type0(owner) is module_type and type0(name) is str0 and + type0(function) is builtin_type and + builtin_self_get(function, builtin_type) is owner and + get_id(module_dict_get(owner, module_type), name, domains) == id0(function), + 'Cold authority trace entry owner differs') + elif role == 'trace': + need(len0(args) == 2 and type0(args[1]) is module_type, 'Cold authority trace producer arguments differ') + known_backend(args[0]) + elif role == 'row_function': + need(not args, 'Cold authority row interner arguments differ') + elif role == 'row_guard': + need(len0(args) == 2, 'Cold authority row guard arguments differ') + known_guard(args[0]) + product = dict_get(products, id0(args[1]), missing) + need(product is not missing and product[0] is args[1] and product[1] is record[0] and + product[2] == 'make_row_interner' and product[6] == 'row_function', + 'Cold authority row helper provenance differs') + fresh_graph(product[5], domains, True, 'Cold authority producer row helper') + elif role == 'cache_guard': + need(len0(args) == 2 and type0(args[1]) is dict0 and string_domain(args[1], domains), + 'Cold authority cache guard arguments differ') + known_guard(args[0]) + owner = dict_get(args[1], 'owner', missing) + need(type0(owner) is dict_get(record[2], '_Owner', missing), + 'Cold authority prepared cache owner class differs') + elif role == 'row_bind': + need(len0(args) == 2 and type0(args[0]) is function_type and type0(args[1]) is bytes0, + 'Cold authority row bind arguments differ') + found = False + for backend_record in tuple0(registry.values()): + if (backend_record[12] == 'backend' and args[0] is dict_get(backend_record[2], 'bind', missing) and + args[1] is backend_record[6]): + found = True + break + need(found, 'Cold authority row bind is not the original registered function/source') + finally: + dict_clear(domains) + + def invoke(handle, export, *args, **kwargs): + record = cold_check(handle) + need(type0(export) is str0, 'Cold authority export name must be exact str') + function = dict_get(record[2], export, missing) + need(type0(function) is function_type and function.__globals__ is record[2], + 'Cold authority export is not an owned source function') + role = classify(record, export) + if role is not None: + validate_producer_arguments(record, export, role, args, kwargs) + result = function(*args, **kwargs) + if role is not None: + # Do not retain a row producer's enclosing tuple or mutable AST. + product = result[0] if type0(result) is tuple0 and len0(result) and type0(result[0]) is function_type else result + expected_kind = function_type if role in ('row_function', 'row_bind') else type0 + need(type0(product) is expected_kind and dict_get(products, id0(product), missing) is missing, + 'Cold authority producer did not return a fresh exact product') + graph = capture_graph((product,) if expected_kind is function_type else (), + (product,) if expected_kind is type0 else ()) + product_record = (product, handle, export, args, tuple0(dict_items(kwargs)), graph, role) + dict_set(products, id0(product), product_record) + domains = {} + try: + fresh_graph(graph, domains, True, 'Cold authority new product') + finally: + dict_clear(domains) + return result + + def check_product(obj, producer_handle, export, args_tuple, kwargs_dict): + record_for(producer_handle) + cold_check(producer_handle) + need(type0(args_tuple) is tuple0 and type0(kwargs_dict) is dict0 and type0(export) is str0, + 'Cold authority product proof arguments differ') + product = dict_get(products, id0(obj), missing) + need(product is not missing and product[0] is obj and product[1] is producer_handle and product[2] == export, + 'Cold authority product provenance differs') + need(len0(args_tuple) == len0(product[3]), 'Cold authority product positional census differs') + for actual, expected in zip0(args_tuple, product[3]): + need(actual is expected, 'Cold authority product positional identity differs') + domains = {} + try: + need(dict_len(kwargs_dict) == len0(product[4]), 'Cold authority product keyword census differs') + for name, expected in product[4]: + need(get_id(kwargs_dict, name, domains) == id0(expected), 'Cold authority product keyword identity differs') + fresh_graph(product[5], domains, True, 'Cold authority registered product') + finally: + dict_clear(domains) + return None + + def set_backend_guard(handle, cls): + record = cold_check(handle) + need(record[12] == 'backend', 'Cold authority guard transition requires original backend') + product = known_guard(cls) + domains = {} + try: + if product is not None: + fresh_graph(product[5], domains, True, 'Cold authority guard transition product') + old = dict_get(backend_guards, id0(handle), missing) + need(dict_get(record[2], 'RuntimeGuard', missing) is old, + 'Cold authority backend guard changed outside the transition ledger') + dict_clear(domains) + dict_set(record[2], 'RuntimeGuard', cls) + dict_set(backend_guards, id0(handle), cls) + transitions.append((handle, old, cls, product)) + fresh_module(record, domains, True) + finally: + dict_clear(domains) + return None + + def source(handle): + record = cold_check(handle) + return (record[1], record[4], record[5], record[6]) + + # Final initial-root validation occurs before any source can receive a token. + cold_check() + need(api[1](capability, provider_pin) is not None, 'Cold authority root capability differs') + operations = (load, invoke, cold_check, runtime_guard, check_product, set_backend_guard, source) + descriptor = make_caller_descriptor(operations, 'Cold authority caller') + # Original raw loader only: capture this transport immediately and retain + # the immutable descriptor privately. No later attribute read is authority. + load.__dict__['_h25_caller_descriptor'] = descriptor + return operations + + +"""Concrete SOURCE ONLY epoch ledger. No execution/profile grant is embedded.""" +import ast +import builtins +import hashlib +import types + +SOURCE_EXECUTION_CONTRACT = None +FULL_EXECUTION_CONTRACT = None +_FUNCTION = types.FunctionType +_MODULE = types.ModuleType +_CODE = types.CodeType +_TYPE, _ID, _LEN = type, id, len +_DICT, _TUPLE, _STR, _INT, _BOOL = dict, tuple, str, int, bool +_GET, _ITEMS, _CLEAR = dict.get, dict.items, dict.clear +_CLASS_DICT = type.__dict__['__dict__'].__get__ +_CLASS_MRO = type.__dict__['__mro__'].__get__ +_CELL = types.CellType.__dict__['cell_contents'].__get__ +_FFIELDS = tuple((name, _FUNCTION.__dict__[name].__get__) for name in + ('__code__', '__globals__', '__builtins__', '__defaults__', + '__kwdefaults__', '__closure__', '__dict__')) +_MISSING = object() +SLOTS = ( + ('module', 'echelon'), ('module', 'rank'), ('module', 'compile_roles'), + ('module', 'verify_role_frames'), ('circuit', 'add'), ('circuit', '__init__'), + ('checks', 'verify_map'), ('checks', '__init__'), ('checks', 'label'), + ('checks', 'target_frame'), ('checks', 'verify_labels'), + ('checks', 'residual_ok'), ('checks', 'label_ok'), + ('label', 'complement_in'), ('label', 'nondegenerate')) +ROLE_FOR_SLOT = { + ('module', 'echelon'): ('canonical',), + ('module', 'rank'): ('rank_trace',), + ('module', 'compile_roles'): ('phase',), + ('module', 'verify_role_frames'): ('roles', 'roles_observer'), + ('circuit', 'add'): ('construction_add',), + ('circuit', '__init__'): ('construction_init', 'phase'), + ('checks', 'verify_map'): ('p1', 'phase'), + ('checks', '__init__'): ('C1', 'checks_capture', 'phase'), + ('checks', 'label'): ('C2',), ('checks', 'target_frame'): ('C3',), + ('checks', 'verify_labels'): ('labels', 'phase'), + ('checks', 'residual_ok'): ('public_residual',), + ('checks', 'label_ok'): ('public_label',), + ('label', 'complement_in'): ('native_complement',), + ('label', 'nondegenerate'): ('native_gram',)} + + +def need(condition, message): + if not condition: + raise RuntimeError(message) + + +def string_keys(mapping): + need(_TYPE(mapping) is _DICT, 'Epoch namespace is not exact dict') + for key in mapping: + need(_TYPE(key) is _STR, 'Epoch foreign namespace key') + + +def names(code): + pending, result = [code], [] + while pending: + value = pending.pop() + need(_TYPE(value) is _CODE, 'Epoch code type') + for name in value.co_names: + if name not in result: + result.append(name) + pending.extend(x for x in value.co_consts if _TYPE(x) is _CODE) + return tuple(result) + + +def function_record(function): + need(_TYPE(function) is _FUNCTION, 'Epoch exact function required') + fields = tuple(getter(function, _FUNCTION) for _, getter in _FFIELDS) + code, namespace, builtin_owner, defaults, keywords, closure, attrs = fields + string_keys(namespace); string_keys(builtin_owner); string_keys(attrs) + if defaults is not None: + need(_TYPE(defaults) is _TUPLE, 'Epoch defaults type') + if keywords is not None: + string_keys(keywords) + cells = () if closure is None else tuple((cell, _CELL(cell, types.CellType)) for cell in closure) + lookups = tuple((name, _GET(namespace, name, _MISSING), + _GET(builtin_owner, name, _MISSING)) for name in names(code)) + return (function, fields, () if keywords is None else tuple(keywords.items()), + cells, lookups, tuple(attrs.items())) + + +def check_fields(record): + function, fields, keywords, cells, lookups, attrs = record + need(_TYPE(function) is _FUNCTION, 'Epoch function replacement') + for (_, getter), expected in zip(_FFIELDS, fields): + need(getter(function, _FUNCTION) is expected, 'Epoch function field changed') + current_keywords = fields[4] + if current_keywords is not None: + string_keys(current_keywords) + need(len(current_keywords) == len(keywords), 'Epoch keyword census') + for name, expected in keywords: + need(_GET(current_keywords, name, _MISSING) is expected, 'Epoch keyword value') + for cell, expected in cells: + need(_CELL(cell, types.CellType) is expected, 'Epoch closure cell changed') + current_attrs = fields[6] + string_keys(current_attrs) + need(len(current_attrs) == len(attrs), 'Epoch function attributes census') + for name, expected in attrs: + need(_GET(current_attrs, name, _MISSING) is expected, 'Epoch function attribute') + + +def class_record(cls): + need(_TYPE(cls) is _TYPE, 'Epoch class metaclass') + proxy = _CLASS_DICT(cls, _TYPE) + members = tuple(proxy.items()) + need(all(_TYPE(k) is _STR for k, _ in members), 'Epoch class key domain') + return (cls, _CLASS_MRO(cls, _TYPE), members) + + +def graph(functions, classes, canonical_functions=None, canonical_classes=None): + """Explicit class roots; arbitrary state/tuple cells never imply provenance.""" + functions, classes = list(functions), list(classes) + seen_f, seen_c, records_f, records_c = {}, {}, [], [] + canonical_functions = {} if canonical_functions is None else canonical_functions + canonical_classes = {} if canonical_classes is None else canonical_classes + while functions or classes: + while classes: + cls = classes.pop() + if id(cls) in seen_c: + continue + need(len(seen_c) < 2048, 'Epoch class graph bound') + seen_c[id(cls)] = cls + rec = canonical_classes.get(id(cls)) + rec = class_record(cls) if rec is None else rec + need(rec[0] is cls, 'Epoch class canonical identity') + records_c.append(rec) + for base in rec[1][1:]: + if type(base) is type: + classes.append(base) + for _, value in rec[2]: + if type(value) is _FUNCTION: + functions.append(value) + elif type(value) in (staticmethod, classmethod): + functions.append(value.__func__) + elif type(value) is property: + functions.extend(x for x in (value.fget, value.fset, value.fdel) if x is not None) + if functions: + function = functions.pop() + if id(function) in seen_f: + continue + need(len(seen_f) < 8192, 'Epoch function graph bound') + seen_f[id(function)] = function + rec = canonical_functions.get(id(function)) + rec = function_record(function) if rec is None else rec + need(rec[0] is function, 'Epoch original function canonical identity') + records_f.append(rec) + for _, value in rec[3]: + if type(value) is _FUNCTION: + functions.append(value) + defaults = rec[1][3] + if defaults is not None: + functions.extend(x for x in defaults if type(x) is _FUNCTION) + functions.extend(x for _, x in rec[2] + rec[5] if type(x) is _FUNCTION) + functions.extend(x for _, x, _ in rec[4] if type(x) is _FUNCTION) + return tuple(records_f), tuple(records_c) + + +class EpochLedger: + """One original generation; no generic external record/admission operation.""" + def __init__(self): + self.origins = {} + self.phase = 'COLD' + self.serial = 0 + self.failure = None + self.class_origin = class_record(type(self)) + self.method_origin = tuple(function_record(v) for _, v in self.class_origin[2] + if type(v) is _FUNCTION) + + def guard_engine(self): + cls, mro, members = self.class_origin + need(type(self) is cls and _CLASS_MRO(cls, type) is mro, 'Epoch engine class drift') + current = _CLASS_DICT(cls, type) + need(len(current) == len(members), 'Epoch engine member census') + for name, value in members: + need(current.get(name, _MISSING) is value, 'Epoch engine member drift') + for rec in self.method_origin: + check_fields(rec) + + def capture(self, module, backend, source_bytes, factory_results, authority_graph, missing_token): + self.guard_engine() + need(self.phase == 'COLD', 'Epoch original capture is one shot') + need(type(module) is _MODULE and type(backend) is _MODULE and type(source_bytes) is bytes, + 'Epoch original inputs') + namespace = module.__dict__; string_keys(namespace) + need(hashlib.sha256(source_bytes).hexdigest() == + 'd623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1', 'Epoch original source hash') + # Caller authenticates backend + each pristine factory BEFORE this call. + label = backend.guard_module(module) + checks, circuit = namespace['Checks'], namespace['ComplexSideCircuit'] + need(label is namespace['Label'], 'Epoch original Label identity') + need(type(factory_results) is tuple and len(factory_results) == 3, 'Epoch actual factory outputs') + p1, construction, prepared = factory_results + need(type(prepared) is dict and prepared['owner'].module is module, 'Epoch actual prepared owner') + compiled = compile(source_bytes, namespace['__file__'], 'exec', dont_inherit=True) + source_codes = {x.co_name: x for x in compiled.co_consts if type(x) is _CODE} + for cls, name in ((label, 'Label'), (checks, 'Checks'), (circuit, 'ComplexSideCircuit')): + expected = {x.co_name: x for x in source_codes[name].co_consts if type(x) is _CODE} + attrs = _CLASS_DICT(cls, type) + need(set(attrs) == set(expected) | {'__module__','__doc__','__dict__','__weakref__'}, + 'Epoch original class census') + for field, code in expected.items(): + function = attrs[field] + need(type(function) is _FUNCTION and function.__globals__ is namespace and + function.__builtins__ is builtins.__dict__ and function.__defaults__ is None and + function.__kwdefaults__ is None and function.__closure__ is None and + backend._code_shape(function.__code__) == backend._code_shape(code), + 'Epoch original class source/calling contract') + need(type(authority_graph) is tuple and len(authority_graph)==2, 'Epoch original authority graph') + fg, original_classes = authority_graph + cg=tuple((row[0],row[1],row[3]) for row in original_classes) + need(all(type(row) is tuple and len(row)==6 for row in fg), 'Epoch original raw-record schema') + self.serial += 1; handle = object() + origin = {'handle':handle,'module':module,'namespace':namespace,'backend':backend, + 'label':label,'checks':checks,'circuit':circuit,'items':tuple(namespace.items()), + 'functions':fg,'classes':cg,'function_map':{id(x[0]):x for x in fg}, + 'class_map':{id(x[0]):x for x in cg},'slots':{},'visible':{},'edges':[], + 'products':[],'factory_results':factory_results,'generation':self.serial, + 'raw_guard':None,'suite':None,'phase':'ORIGINAL','missing':missing_token,'authority_classes':original_classes, + 'primary_error':None,'secondary_error':None,'uncertain':False} + owners = {'module':namespace,'label':label,'checks':checks,'circuit':circuit} + for kind, name in SLOTS: + owner = owners[kind] + value = owner[name] if type(owner) is dict else _CLASS_DICT(owner,type)[name] + origin['slots'][kind,name] = (owner,value,value,()) + origin['visible'][kind,name] = value + self.origins[id(handle)] = origin; self.phase = 'ORIGINAL' + return handle + + def origin(self, handle): + self.guard_engine() + origin = self.origins.get(id(handle)) + need(origin is not None and origin['handle'] is handle, 'Epoch origin handle') + need(origin['phase'] != 'FAILED', 'Epoch failed generation') + return origin + + def enroll_suite(self, handle, suite): + origin = self.origin(handle) + need(origin['phase'] == 'ORIGINAL' and origin['suite'] is None, 'Epoch suite one shot') + origin['suite'] = suite + origin['phase'] = 'FACTORIES_ADMITTED' + return origin['generation'] + + def authorize(self, handle, kind, name, old, new, role, product_graph): + origin = self.origin(handle) + need(origin['phase'] in ('FACTORIES_ADMITTED','CALLERS_INSTALLED','NATIVE_PRODUCTS_PREPARED'), + 'Epoch transition phase') + need(type(kind) is str and type(name) is str and type(role) is str and + (kind,name) in origin['slots'] and role in ROLE_FOR_SLOT[kind,name], 'Epoch finite slot/role') + owner, first, prior, chain = origin['slots'][kind,name] + need(old is prior and new is not prior, 'Epoch preceding endpoint identity') + current = owner[name] if type(owner) is dict else _CLASS_DICT(owner,type).get(name,_MISSING) + need(current is old, 'Epoch unauthorized prior change') + need(type(new) is _FUNCTION, 'Epoch callable product type') + # Product comes only from the authenticated suite builder; it supplies + # the complete graph after its strict source/code inverse validation. + need(type(product_graph) is tuple and len(product_graph)==2, 'Epoch product graph shape') + origin['products'].append(product_graph) + origin['slots'][kind,name] = (owner,first,new,chain+((old,new,role),)) + origin['edges'].append((kind,name,old,new,role,origin['generation'])) + return None + + def register_product(self,handle,suite,role,function,product_graph): + origin=self.origin(handle) + allowed=('C1','C2','C3','labels','roles','canonical','public_label', + 'public_residual','private_label','private_residual','prepare','finish') + need(type(role) is str and role in allowed and type(function) is _FUNCTION, + 'Epoch private product role/type') + if origin['suite'] is None: + need(origin.get('creating') is True,'Epoch factory not active') + origin['suite']=suite;origin['phase']='FACTORIES_ADMITTED' + need(origin['suite'] is suite,'Epoch source suite ownership') + proof=suite.proofs.get(id(function)) + need(proof is not None and proof[0] is function and proof[1]==role, + 'Epoch actual factory product proof') + origin['products'].append(product_graph) + origin.setdefault('private_products',{})[role]=function + return None + + def install(self, handle, kind, name, new): + origin = self.origin(handle) + owner, first, endpoint, chain = origin['slots'][kind,name] + need(endpoint is new and chain, 'Epoch install requires declared product') + prior = chain[-1][0] + if type(owner) is dict: + need(owner.get(name,_MISSING) is prior, 'Epoch global old identity') + owner[name] = new + else: + need(_CLASS_DICT(owner,type).get(name,_MISSING) is prior, 'Epoch class old identity') + type.__setattr__(owner,name,new) + origin['visible'][kind,name]=new + + def observed_transition(self, handle, kind, name, old, new, role, product_graph): + """Source-owned existing wrapper operation, verified with old retained ref.""" + origin=self.origin(handle) + owner, first, prior, chain=origin['slots'][kind,name] + need(old is prior, 'Epoch observed old identity') + current=owner[name] if type(owner) is dict else _CLASS_DICT(owner,type).get(name,_MISSING) + need(current is new and role in ROLE_FOR_SLOT[kind,name], 'Epoch observed source endpoint') + need(type(new) is _FUNCTION, 'Epoch observed function') + origin['products'].append(product_graph) + origin['slots'][kind,name]=(owner,first,new,chain+((old,new,role),)) + origin['visible'][kind,name]=new + origin['edges'].append((kind,name,old,new,role,origin['generation'])) + + def expected(self, owner, name, old): + for origin in self.origins.values(): + for (kind, field), (slot_owner, first, endpoint, chain) in origin['slots'].items(): + if slot_owner is owner and field == name and chain: + if old is first or any(old is item[0] for item in chain): + return origin['visible'][kind,field] + return old + + def expected_lookup(self, raw_record, namespace, name, expected): + # Exact ORIGINAL function-record identity/function + original namespace + # and lookup name/object. Products never become a replacement origin. + for origin in self.origins.values(): + canonical=origin['function_map'].get(id(raw_record[0])) + if canonical is raw_record and namespace is origin['namespace']: + for old_name, old_value, old_builtin in canonical[4]: + if old_name==name and old_value is expected: + return self.expected(namespace,name,expected) + return expected + + def original_record(self, function): + for origin in self.origins.values(): + record=origin['function_map'].get(id(function)) + if record is not None and record[0] is function:return record + return None + + def original_class(self, cls): + for origin in self.origins.values(): + for record in origin['authority_classes']: + if record[0] is cls:return record + return None + + def projected_member(self, cls, name, expected): + return self.expected(cls,name,expected) + + def check(self, handle): + origin=self.origin(handle); namespace=origin['namespace'];string_keys(namespace) + need(origin['module'].__dict__ is namespace and len(namespace)==len(origin['items']), + 'Epoch source namespace owner/census') + for name, value in origin['items']: + need(namespace.get(name,_MISSING) is self.expected(namespace,name,value), 'Epoch module current binding') + graphs=((origin['functions'],origin['classes']),)+tuple(origin['products']) + seen=set() + for functions, classes in graphs: + for cls,mro,members in classes: + need(type(cls) is type and _CLASS_MRO(cls,type) is mro, 'Epoch class dispatch') + proxy=_CLASS_DICT(cls,type);need(len(proxy)==len(members),'Epoch class census') + for name,value in members: + need(proxy.get(name,_MISSING) is self.expected(cls,name,value),'Epoch class current member') + for rec in functions: + if id(rec[0]) in seen:continue + seen.add(id(rec[0]));check_fields(rec) + fn, fields, keywords, cells, lookups,attrs=rec + ns,builtin_owner=fields[1:3];string_keys(ns);string_keys(builtin_owner) + for name,old,old_builtin in lookups: + need(ns.get(name,origin['missing']) is self.expected_lookup(rec,ns,name,old), 'Epoch current effective global') + need(builtin_owner.get(name,origin['missing']) is old_builtin,'Epoch current effective builtin') + return None + + def phase_to(self,handle,expected,new): + origin=self.origin(handle);need(origin['phase']==expected,'Epoch phase transition') + origin['phase']=new;return None + + def fix_raw_guard(self,handle,raw): + origin=self.origin(handle) + need(origin['phase']=='NATIVE_PRODUCTS_PREPARED' and origin['raw_guard'] is None,'Epoch raw guard phase') + origin['raw_guard']=raw;origin['phase']='GLOBALS_COMMITTED' + + def finish_bind(self,handle,result,owner): + origin=self.origin(handle) + need(origin['phase']=='GLOBALS_COMMITTED' and type(result) is dict and + result.get('runtime_guard') is origin['raw_guard'] and owner.runtime is origin['raw_guard'], + 'Epoch actual raw/final runtime guard') + self.check(handle) + result['runtime_guard'].check() + origin['phase']='FINAL_CAPTURED' + + def fail(self,handle,error): + origin=self.origins.get(id(handle)) + if origin is not None and origin['handle'] is handle: + origin['phase']='FAILED';origin['failure']=error + self.failure=error + + +# Source supplement to the versioned authority; initial source loading is parent-owned. + +def _epoch_closure(function): + need(type(function) is types.FunctionType, 'Epoch wrapper exact function') + return {} if function.__closure__ is None else dict(zip(function.__code__.co_freevars, + (cell.cell_contents for cell in function.__closure__))) + + +def _epoch_code_constant(code, name): + values=[x for x in code.co_consts if type(x) is types.CodeType and x.co_name==name] + need(len(values)==1, 'Epoch exact nested code '+name) + return values[0] + + +def _epoch_operations(ledger, legacy, capture_graph0, raw_function0, descriptor_factory, + record_for0, cold_check0, root, capability, api, missing, + engine_guard, bundle_cell): + pending={} + entries={} + def before(): + engine_guard();cold_check0() + + def owned(handle, digest=None): + before();record=cold_check0(handle) + if digest is not None:need(record[5]==digest,'Epoch selected source pin') + return record + + def suite_guard(handle,suite): + before() + origin=ledger.origin(handle) + record=owned(origin['cache_handle'],EPOCH_CACHE_SHA256) + cls=record[2].get('_EpochSuite') + need(type(suite) is cls and (origin['suite'] is suite or origin['suite'] is None and origin.get('creating') is True),'Epoch actual suite class/generation') + need(suite.handle is handle and suite.module is origin['module'] and + suite.namespace is origin['namespace'] and suite.label is origin['label'] and + suite.checks_class is origin['checks'] and suite.E0 is origin['slots']['module','echelon'][1] and + suite.owner is origin['factory_results'][2]['owner'],'Epoch fixed suite source bindings') + return origin,record + + def product_graph(origin,functions=(),classes=()): + fg,cg=capture_graph0(tuple(functions),tuple(classes)+(origin['label'],origin['checks'],origin['circuit'])) + return fg,tuple((x[0],x[1],x[3]) for x in cg) + + def graph_fields_only(value): + functions,classes=value + for rec in functions: + check_fields(rec) + namespace,builtin_owner=rec[1][1:3] + string_keys(namespace);string_keys(builtin_owner) + for name,expected,expected_builtin in rec[4]: + need(namespace.get(name,missing) is ledger.expected_lookup(rec,namespace,name,expected),'Epoch factory current effective global') + need(builtin_owner.get(name,missing) is expected_builtin,'Epoch factory current effective builtin') + for cls,mro,members in classes: + need(type(cls) is type and type.__dict__['__mro__'].__get__(cls,type) is mro,'Epoch factory class MRO') + proxy=type.__dict__['__dict__'].__get__(cls,type) + need(len(proxy)==len(members),'Epoch factory class census') + for name,expected in members:need(proxy.get(name,missing) is ledger.projected_member(cls,name,expected),'Epoch factory class source') + + def admit(stage,*args): + before();need(type(stage) is str,'Epoch admission stage type') + if stage=='driver_entry': + need(len(args)==3,'Epoch driver entry argument grammar') + function,phase_class,invocation_token=args + need(type(function) is types.FunctionType and function.__name__=='main_epoch' and + function.__globals__ is sys.modules['__main__'].__dict__ and type(phase_class) is type and + function.__globals__.get('Phases') is phase_class,'Epoch actual root-installed driver identity') + need(id(invocation_token) not in entries,'Epoch duplicate initial driver invocation') + fg,cg=capture_graph0((function,),(phase_class,)) + record=next(row for row in fg if row[0] is function) + entries[id(invocation_token)]=(invocation_token,record,(fg,tuple((x[0],x[1],x[3]) for x in cg)),phase_class) + return record + if stage=='load': + need(len(args)==1,'Epoch original loader arguments') + backend_handle=args[0];record=owned(backend_handle,BACKEND_SHA256) + need(record[12]=='backend' and record[3]=='native_backend','Epoch production backend owner') + need(sys.modules.get('complex_circuit') is None,'Epoch fresh production module required') + loader=record[2].get('load_source') + need(type(loader) is types.FunctionType and loader.__globals__ is record[2],'Epoch original loader binding') + module=legacy[1](backend_handle,'load_source','complex_circuit') + need(type(module) is types.ModuleType and module.__name__=='complex_circuit','Epoch actual loaded module') + raw=record[1].verify_sources() + ticket=object();pending[id(ticket)]=(ticket,module,backend_handle,record[1],raw) + return module,ticket + need(stage=='factories' and len(args)==7,'Epoch original factory arguments') + ticket,set_handle,construction_handle,cache_handle,cache_args,cache_kwargs,context=args + item=pending.pop(id(ticket),None) + need(item is not None and item[0] is ticket,'Epoch one-shot genuine load ticket') + module,backend_handle,backend,raw=item[1:] + owned(backend_handle,BACKEND_SHA256);owned(set_handle,EPOCH_SET_SHA256) + owned(construction_handle,EPOCH_CONSTRUCTION_SHA256);cache_record=owned(cache_handle,EPOCH_CACHE_SHA256) + need(type(cache_args) is tuple and len(cache_args)==2 and type(cache_kwargs) is dict and + all(type(k) is str for k in cache_kwargs),'Epoch cache factory transport') + need(set(cache_kwargs)=={'bootstrap_root','bootstrap_capability','bootstrap_api','factory_environment'} and + cache_kwargs['bootstrap_root'] is root and cache_kwargs['bootstrap_capability'] is capability and + cache_kwargs['bootstrap_api'] is api,'Epoch actual original bootstrap/factory context') + need(type(context) is dict and all(type(k) is str for k in context) and set(context)=={'data_handle','data_module','phase_function','phase_class','phase_owner','driver_function','driver_record','invocation_token','disposition_state'},'Epoch exact source context key domain') + data_record=owned(context['data_handle'],EPOCH_DATA_SHA256) + need(context['data_module'] is data_record[1],'Epoch current data adapter owner') + phase_fn=context['phase_function'];phase_owner=context['phase_owner'] + need(type(phase_fn) is types.FunctionType and type(phase_owner) is context['phase_class'] and + phase_fn is context['phase_class'].__dict__['wrap'] and + phase_fn.__globals__ is sys.modules['__main__'].__dict__,'Epoch genuine driver phase factory') + # Reference code is source authenticated DATA, compiled but never executed. + reference_path=pathlib.Path(__file__).with_name('reference_scientific_driver.py.txt') + reference=reference_path.read_bytes() + need(hashlib.sha256(reference).hexdigest()==EPOCH_REFERENCE_DRIVER_SHA256,'Epoch reference driver source') + original_code=compile(reference,phase_fn.__code__.co_filename,'exec',dont_inherit=True,optimize=sys.flags.optimize) + phase_code=_epoch_code_constant(_epoch_code_constant(original_code,'Phases'),'wrap') + need(backend._code_shape(phase_code)==backend._code_shape(phase_fn.__code__) and + phase_fn.__defaults__ is None and phase_fn.__kwdefaults__ is None and phase_fn.__closure__ is None, + 'Epoch original phase source/calling contract') + entry=entries.pop(id(context['invocation_token']),None) + need(entry is not None and entry[0] is context['invocation_token'] and entry[1] is context['driver_record'] and + entry[3] is context['phase_class'],'Epoch original consumed driver-entry authority') + graph_fields_only(entry[2]) + driver_record=context['driver_record'];check_fields(driver_record) + need(driver_record[0] is context['driver_function'] and driver_record[0].__globals__ is phase_fn.__globals__, + 'Epoch initial driver function record') + disposition_state=context['disposition_state'] + need(type(disposition_state) is dict and all(type(k) is str for k in disposition_state),'Epoch actual parent disposition state') + execution=driver_record[0].__globals__['_EXECUTION'] + need(type(execution) is dict and all(type(k) is str for k in execution) and execution.get('state') is disposition_state, + 'Epoch existing parent failure path must own acquisition state') + record=disposition_state.get('epoch_acquisition') + need(type(record) is dict and all(type(k) is str for k in record) and + disposition_state.get('cache_binding',missing) is None and disposition_state.get('authority') is legacy and + disposition_state.get('backend_handle') is backend_handle and disposition_state.get('enabled') is True and + type(disposition_state.get('owned_states')) is list and any(x is disposition_state for x in disposition_state['owned_states']) and + disposition_state.get('cache_teardown_attempted') is False,'Epoch continuously reachable disposition route') + # The pristine original functions/factories run before their mutations. + backend.guard_module(module) + p1=legacy[1](set_handle,'bind_verify_map',module) + construction=legacy[1](construction_handle,'bind_construction',module) + prepared=legacy[1](cache_handle,'prepare_epoch_cache_contract',module,*cache_args, + **cache_kwargs,disposition_state=disposition_state,disposition_record=record) + need(disposition_state['cache_binding'] is prepared and record['prepared'] is prepared and record['published'] is True, + 'Epoch acquisition handoff preceded graph/capture') + fg,cg=capture_graph0(tuple(v for v in module.__dict__.values() if type(v) is types.FunctionType), + (module.Label,module.Checks,module.ComplexSideCircuit)) + handle=ledger.capture(module,backend,raw,(p1,construction,prepared),(fg,cg),missing) + record['origin_handle']=handle + origin=ledger.origin(handle) + origin.update({'backend_handle':backend_handle,'cache_handle':cache_handle, + 'set_handle':set_handle,'construction_handle':construction_handle,'context':context, + 'data_record':data_record,'phase_record':raw_function0(phase_fn),'driver_record':driver_record, + 'creating':False,'native_pending':None,'driver_graph':entry[2]}) + roots=tuple(v for mapping in (p1,construction) for v in mapping.values() if type(v) is types.FunctionType) + ff,fc=capture_graph0(roots,(type(p1['owner']),type(construction['owner']),type(prepared['owner']))) + origin['factory_graph']=(ff,tuple((x[0],x[1],x[3]) for x in fc)) + origin['factory_items']=tuple((mapping,tuple(mapping.items())) for mapping in (p1,construction)) + record['phase']='ORIGIN_ACCEPTED_PARENT_OWNED' + return handle,p1,construction,prepared + + def derive(handle,context): + before() + origin=ledger.origin(handle);cache_record=owned(origin['cache_handle'],EPOCH_CACHE_SHA256) + need(origin['phase']=='ORIGINAL' and origin['context'] is context and not origin['creating'], + 'Epoch suite creation provenance') + creator=cache_record[2].get('create_epoch_suite') + need(type(creator) is types.FunctionType and creator.__globals__ is cache_record[2],'Epoch suite source creator') + origin['creating']=True + try: + p1,construction,prepared=origin['factory_results'] + prepared['owner']._epoch_creator_record=(bundle_cell[0][3],handle,context) + suite=creator(bundle_cell[0][3],handle,origin['module'],origin['backend'].verify_sources(), + prepared,p1,construction,context,origin['generation']) + need(origin['suite'] is suite,'Epoch multiproduct creator ownership') + origin['suite_snapshot']=(suite.registry,suite.products,suite.caller_caps,suite.descriptor, + suite.prepared,suite.p1,suite.construction) + return suite + except BaseException as error: + ledger.fail(handle,error);raise + finally:origin['creating']=False + + def check_factory(origin): + for mapping,items in origin['factory_items']: + need(type(mapping) is dict and len(mapping)==len(items),'Epoch original factory output census') + for key,value in items:need(mapping.get(key,missing) is value,'Epoch factory output binding') + graph_fields_only(origin['factory_graph']) + graph_fields_only(origin['driver_graph']) + + def wrap_proof(origin,suite,kind,name,role,function): + need(type(function) is types.FunctionType,'Epoch wrapper function type') + owner,first,old,chain=origin['slots'][kind,name] + p1,construction,prepared=origin['factory_results'];context=origin['context'] + if role=='construction_add':need(function is construction['add'],'Epoch original construction add product') + elif role=='p1':need(function is p1['verify_map'],'Epoch original P1 product') + elif role in ('public_label','public_residual'): + need(function is suite.products[role],'Epoch genuine public source product') + elif role=='checks_capture': + maker=origin['data_record'][2]['install_epoch_circuit'] + need(function.__code__ is _epoch_code_constant(maker.__code__,'captured_checks') and + function.__globals__ is origin['data_record'][2],'Epoch original checks observer source') + cells=_epoch_closure(function) + need(set(cells)=={'original_checks_init','capture_checks'} and cells['original_checks_init'] is old, + 'Epoch checks observer original constructor') + method=cells['capture_checks'] + need(type(method) is types.MethodType and method.__self__ is p1['owner'] and + method.__func__ is type(p1['owner']).__dict__['capture_checks'],'Epoch P1 capture method') + elif role=='phase': + check_fields(origin['phase_record']);phase=context['phase_function'];cells=_epoch_closure(function) + need(function.__code__ is _epoch_code_constant(phase.__code__,'observed') and + function.__globals__ is phase.__globals__ and set(cells)=={'self','name','original'} and + cells['self'] is context['phase_owner'] and cells['original'] is old and + type(cells['name']) is str,'Epoch genuine original phase product') + expected={('circuit','__init__'):'side_construction',('checks','__init__'):'checks_initialization', + ('module','compile_roles'):'compile_roles',('checks','verify_map'):'verify_map', + ('checks','verify_labels'):'verify_labels'} + need((kind,name) in expected and cells['name']==expected[kind,name],'Epoch phase identity') + elif role=='roles_observer': + check_fields(origin['driver_record']);maker=context['driver_function'];cells=_epoch_closure(function) + need(function.__code__ is _epoch_code_constant(maker.__code__,'observe_roles') and + function.__globals__ is maker.__globals__ and + set(cells)=={'captures','original_roles','phases'} and cells['original_roles'] is old and + cells['phases'] is context['phase_owner'] and type(cells['captures']) is dict, + 'Epoch actual role observation source') + else:need(False,'Epoch undeclared existing wrapper role') + defaults=function.__defaults__ + need(function.__kwdefaults__ is None and (type(defaults) is tuple and len(defaults)==1 and defaults[0] is None if role=='roles_observer' else defaults is None),'Epoch wrapper default contract') + return old + + def product(handle,suite,action,*args): + origin,record=suite_guard(handle,suite) + need(type(action) is str,'Epoch product action type') + if action=='product': + role,function=args + need(origin['creating'] is True or origin['suite'] is suite,'Epoch genuine source-product creator') + # Complete source factories already verified reconstructive inverses; + # both actual function and exact proof record must be in that suite. + if origin.get('suite_fields') is None:origin['suite_fields']=object.__getattribute__(suite,'__dict__') + proof=suite.proofs.get(id(function)) + need(proof is not None and proof[0] is function and suite.products[role] is function, + 'Epoch multiproduct proof member') + check_fields(raw_function0(function)) + return ledger.register_product(handle,suite,role,function, + product_graph(origin,(function,),(type(suite),))) + if action=='install': + kind,name,role,function=args + need(suite.products.get(role) is function,'Epoch registered callsite product') + old=origin['slots'][kind,name][2] + ledger.authorize(handle,kind,name,old,function,role,product_graph(origin,(function,),(type(suite),))) + ledger.install(handle,kind,name,function) + return None + if action=='existing': + kind,name,role,function=args;check_factory(origin) + old=wrap_proof(origin,suite,kind,name,role,function) + ledger.authorize(handle,kind,name,old,function,role,product_graph(origin,(function,),(type(suite),))) + ledger.install(handle,kind,name,function) + return None + need(action=='construction_init' and not args,'Epoch constructor wrapper action') + check_factory(origin);p1,construction,prepared=origin['factory_results'] + wrapper=construction['wrap_constructor'](construction['original_init'],p1['owner'].capture_c) + old=origin['slots']['circuit','__init__'][2] + ledger.authorize(handle,'circuit','__init__',old,wrapper,'construction_init',product_graph(origin,(wrapper,),(type(suite),))) + ledger.install(handle,'circuit','__init__',wrapper) + return wrapper + + def stages(handle,suite,stage,*args): + origin,record=suite_guard(handle,suite) + need(type(stage) is str,'Epoch bind stage type') + if stage=='reconcile': + need(origin['phase']=='FACTORIES_ADMITTED','Epoch prebind phase') + # Every nonnative slot was installed through the source-owned API. + ledger.check(handle);origin['phase']='CALLERS_INSTALLED';return None + if stage=='prepare': + need(origin['phase']=='CALLERS_INSTALLED' and len(args)==5,'Epoch native preparation stage') + module,label,original_functions,complement,gram=args + need(module is origin['module'] and label is origin['label'] and type(original_functions) is list, + 'Epoch actual original bind arguments') + rank_calls,trace,native,row,final_guard=suite.bind_inputs + owned(origin['backend_handle'],BACKEND_SHA256) + backend=origin['backend'];check_fields(origin['phase_record']);check_fields(origin['driver_record']) + # The original trace factory ran after original guard_module and + # before the original native closures were assigned. + oldrank=origin['slots']['module','rank'][2];traced=module.rank + cells=_epoch_closure(traced) + need(traced.__code__ is _epoch_code_constant(backend.attach_trace.__code__,'traced_rank') and + traced.__globals__ is backend.__dict__ and cells['original_rank'] is oldrank and + cells['rank_calls'] is rank_calls,'Epoch original rank trace source') + ledger.observed_transition(handle,'module','rank',oldrank,traced,'rank_trace',product_graph(origin,(traced,))) + expected_helpers=[dict(origin['items'])[name] for name in backend._HELPER_NAMES] + expected_helpers.extend(v for name,v in origin['class_map'][id(label)][2] if type(v) is types.FunctionType) + need(len(original_functions)==len(expected_helpers) and all(a is b for a,b in zip(original_functions,expected_helpers)), + 'Epoch retained original bind function list') + records=[] + for name,fn,role,native_name in (('complement_in',complement,'native_complement','complement'),('nondegenerate',gram,'native_gram','gram_rank')): + expected_code=_epoch_code_constant(suite.bind_expected_code,name) + need(backend._code_shape(fn.__code__)==backend._code_shape(expected_code) and + fn.__globals__ is backend.__dict__ and fn.__builtins__ is builtins.__dict__ and + fn.__defaults__ is None and fn.__kwdefaults__ is None,'Epoch native closure code/calling source') + values=_epoch_closure(fn);need(values.get('runtime',missing) is None,'Epoch native pending runtime') + need(values.get('label',label) is label,'Epoch native Label closure') + entry=native.__dict__[native_name] + need(type(entry) is types.BuiltinFunctionType and entry.__self__ is native and + values.get('native_complement' if name=='complement_in' else 'native_gram') is entry, + 'Epoch current native entry closure') + for field,value in values.items(): + if field=='runtime':continue + expected={'label':label,'complement_trace':trace,'rank_calls':rank_calls,'rank_row_intern':row, + 'original_complement':origin['slots']['label','complement_in'][1], + 'original_nondegenerate':origin['slots']['label','nondegenerate'][1], + 'original_dot':dict(origin['items'])['dot'],'original_rank':dict(origin['items'])['rank']}.get(field,missing) + if expected is not missing:need(value is expected,'Epoch native captured argument '+field) + elif field=='counters':need(type(value) is dict and set(value)=={'complement_native','complement_fallback','gram_native','gram_fallback'} and all(type(v) is int and v==0 for v in value.values()),'Epoch actual initial counters') + elif field not in ('native_complement','native_gram'):need(False,'Epoch unexpected native closure field '+field) + cell=dict(zip(fn.__code__.co_freevars,fn.__closure__))['runtime'] + records.append((name,fn,role,cell,raw_function0(fn))) + origin['native_pending']=tuple(records);origin['phase']='NATIVE_PRODUCTS_PREPARED';return None + if stage=='commit': + need(len(args)==1 and origin['phase']=='NATIVE_PRODUCTS_PREPARED','Epoch global commit stage') + raw=args[0];need(type(raw) is suite.bind_inputs[4],'Epoch exact actual raw guard allocation') + for name,fn,role,cell,initial in origin['native_pending']: + need(cell.cell_contents is raw,'Epoch exact fixed runtime-cell endpoint') + fields=raw_function0(fn) + need(len(fields[1])==len(initial[1]) and all(a is b for a,b in zip(fields[1],initial[1])) and len(fields[3])==len(initial[3]),'Epoch native closure fields changed') + for (oldcell,oldvalue),(newcell,newvalue) in zip(initial[3],fields[3]): + need(oldcell is newcell and (newvalue is raw if oldcell is cell else newvalue is oldvalue),'Epoch native cell transition') + old=origin['slots']['label',name][2] + ledger.observed_transition(handle,'label',name,old,fn,role,product_graph(origin,(fn,),(type(raw),))) + ledger.fix_raw_guard(handle,raw) + old=origin['slots']['module','echelon'][2];hook=suite.products['canonical'] + # Only initialization can observe GLOBALS_COMMITTED; no epoch is armed. + origin['phase']='NATIVE_PRODUCTS_PREPARED' + ledger.authorize(handle,'module','echelon',old,hook,'canonical',product_graph(origin,(hook,),(type(suite),))) + ledger.install(handle,'module','echelon',hook);origin['phase']='GLOBALS_COMMITTED' + ledger.check(handle);return None + need(stage=='finish' and len(args)==2,'Epoch final binding stage') + return ledger.finish_bind(handle,args[0],args[1]) + + def seal(handle,suite): + origin,record=suite_guard(handle,suite) + need(origin['phase']=='FINAL_CAPTURED','Epoch seal after actual final graph') + ledger.check(handle);origin['phase']='SEALED';return None + + def check(handle,suite): + origin,record=suite_guard(handle,suite) + need(origin['phase'] in ('FACTORIES_ADMITTED','CALLERS_INSTALLED','GLOBALS_COMMITTED','FINAL_CAPTURED','SEALED'), + 'Epoch current binding phase') + if 'suite_snapshot' in origin: + values=origin['suite_snapshot'] + need(all(a is b for a,b in zip(values,(suite.registry,suite.products,suite.caller_caps,suite.descriptor, + suite.prepared,suite.p1,suite.construction))),'Epoch fixed suite data binding') + for role,fn in origin.get('private_products',{}).items(): + need(suite.products.get(role) is fn,'Epoch actual product dispatch identity') + graph_fields_only(origin['driver_graph']) + ledger.check(handle);return None + + def manifest(handle): + before();origin=ledger.origin(handle) + return {'schema':'h25-epoch-source-manifest-v1','generation':origin['generation'], + 'phase':origin['phase'],'edge_count':len(origin['edges']), + 'source_sha256':'d623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1', + 'runtime_admission':False,'full_execution_contract':None} + + # This fence owns failed installations. It runs metadata disposal only; + # no failed source/native check is retried and no origin is recaptured. + engine_guard() + getattrs=object.__getattribute__;setattrs=object.__setattr__ + ledger_fields=getattrs(ledger,'__dict__');origins0=ledger_fields['origins'] + failure_box=[None] + clear0=dict.clear;get0=dict.get;type0=type;id0=id;dict0=dict;str0=str + def failed(handle,error): + origin=get0(origins0,id0(handle)) + if origin is None or get0(origin,'handle') is not handle:return None + origin['phase']='FAILED' + if origin['primary_error'] is None:origin['primary_error']=error + if failure_box[0] is None:failure_box[0]=error + # Do not write a rejected/current instance namespace here. The actual + # origin/Suite dictionaries and independent failure_box own P; Core.fail + # remains the legitimate source transition for its diagnostic scalar. + suite=get0(origin,'suite') + if suite is None:return None + fields=get0(origin,'suite_fields') + if fields is None:return None + if get0(fields,'primary_error') is None:fields['primary_error']=error + fields['active']=False;fields['terminal']=True;fields['pending']=None + fields['checks']=None;fields['checks_c']=None;fields['checks_h']=None + try: + registry=get0(fields,'registry') + if type0(registry) is not dict0:raise RuntimeError('Epoch failed registry is not exact metadata dict') + clear0(registry) + except BaseException as secondary: + origin['uncertain']=True;fields['uncertain']=True + if origin['secondary_error'] is None:origin['secondary_error']=secondary + if get0(fields,'secondary_error') is None:fields['secondary_error']=secondary + return None + + def plain0(value): + if type0(value) is not dict0:return False + for key in value: + if type0(key) is not str0:return False + return True + + def protect(function): + def operation(*args,**kwargs): + try: + engine_guard() + return function(*args,**kwargs) + except BaseException as primary: + if function is admit: + if len(args)==8 and type0(args[0]) is str and args[0]=='factories': + context=args[-1] + if plain0(context): + state=get0(context,'disposition_state') + record=get0(state,'epoch_acquisition') if plain0(state) else None + if plain0(record): + if get0(record,'primary') is None:record['primary']=primary + handle=get0(record,'origin_handle') + if handle is not None:failed(handle,primary) + elif args:failed(args[0],primary) + raise + return operation + + return tuple(protect(fn) for fn in (admit,derive,product,stages,seal,check,manifest)) + + +EPOCH_CACHE_SHA256 = 'd317c9866566cd6147c96566879f26f364e7e6801ac3eed0800b6ed8eedd01a2' +EPOCH_DATA_SHA256 = '18679fd1eb6ae99c4b375756511427c26718f77674c2d8fcc490e25ceb47cba5' +EPOCH_SET_SHA256 = 'eeeead34731e73f74dff250f354e57b72314c4e18670848bfa9f48c87de1305d' +EPOCH_CONSTRUCTION_SHA256 = 'ed7fd6c8a93c524c4d28245e48d75d6b949234a5a60f6affb8025f27ef9506b5' +EPOCH_REFERENCE_DRIVER_SHA256 = '8027a1b24d08a598c2aa9e91cfe791edd58d1b87b17ce5957cee2d5da49d5c2f' + +def capture_epoch_authority(root, capability, api): + """Return load/invoke/check/runtime_guard/check_product/set_guard/source. + + The trusted parent calls this entry once immediately after raw source exec. + A later backend instance derives provenance from this original token; it + cannot substitute a newly captured stdlib or a self-reported class record. + """ + if _CAPTURE_ONCE: + raise RuntimeError('Cold authority can only be captured once before exposure') + _CAPTURE_ONCE.append(True) + type0, id0, len0, next0, tuple0, list0 = type, id, len, next, tuple, list + dict0, str0, bytes0, object0, int0 = dict, str, bytes, object, int + error0, base_error0, value_error0 = RuntimeError, BaseException, ValueError + function_type, module_type, code_type = types.FunctionType, types.ModuleType, types.CodeType + builtin_type, cell_type = types.BuiltinFunctionType, types.CellType + static_type, class_type, property_type = staticmethod, classmethod, property + dict_get, dict_items, dict_iter = dict.get, dict.items, dict.__iter__ + dict_len, dict_set, dict_del, dict_clear = dict.__len__, dict.__setitem__, dict.__delitem__, dict.clear + object_get = object.__getattribute__ + type_get = type.__getattribute__ + module_dict_get = module_type.__dict__['__dict__'].__get__ + class_dict_get = type.__dict__['__dict__'].__get__ + class_mro_get = type.__dict__['__mro__'].__get__ + cell_get = cell_type.__dict__['cell_contents'].__get__ + function_fields = tuple((name, function_type.__dict__[name].__get__) for name in + ('__code__', '__globals__', '__builtins__', '__defaults__', + '__kwdefaults__', '__closure__', '__dict__')) + proxy_type = type(type.__dict__) + proxy_get, proxy_iter, proxy_items, proxy_len = proxy_type.get, proxy_type.__iter__, proxy_type.items, proxy_type.__len__ + builtin_self_get = builtin_type.__dict__['__self__'].__get__ + builtin_namespace = builtins.__dict__ + missing = object0() + missing_id = id0(missing) + initial_sys_modules = sys.modules + initial_sys_flags = sys.flags + initial_optimize = sys.flags.optimize + sys_owner = sys + sys_namespace = module_dict_get(sys_owner, module_type) + authority_namespace = globals() + root_pin, provider_pin, backend_pin = ROOT_SHA256, PROVIDER_SHA256, BACKEND_SHA256 + cache_pin = EPOCH_CACHE_SHA256 + max_source, max_functions, max_classes = 1048576, 8192, 2048 + registry, by_namespace, products, backend_guards = {}, {}, {}, {} + transitions = [] + ledger = EpochLedger() + bundle_cell = [] + descriptor_cell = [] + engine_class = EpochLedger + engine_mro = class_mro_get(engine_class, type0) + engine_members = tuple0(proxy_items(class_dict_get(engine_class,type0))) + engine_dict_get = proxy_get(class_dict_get(engine_class,type0),'__dict__').__get__ + engine_namespace = engine_dict_get(ledger,engine_class) + if type0(engine_namespace) is not dict0:raise error0('Epoch engine instance dictionary differs') + initial_iterator=initial_key=None + initial_valid=True + try: + initial_iterator=dict_iter(engine_namespace) + while True: + initial_key=next0(initial_iterator,missing) + if initial_key is missing:break + if type0(initial_key) is not str0:initial_valid=False;break + initial_key=None + finally:initial_iterator=initial_key=None + if not initial_valid:raise error0('Epoch engine instance key domain differs') + engine_namespace_names = tuple0(dict_iter(engine_namespace)) + engine_origins = dict_get(engine_namespace,'origins',missing) + engine_class_origin = dict_get(engine_namespace,'class_origin',missing) + engine_method_origin = dict_get(engine_namespace,'method_origin',missing) + engine_functions = tuple0((value,tuple0(getter(value,function_type) for _,getter in function_fields)) + for name,value in engine_members if type0(value) is function_type) + def engine_guard(): + if type0(ledger) is not engine_class or class_mro_get(engine_class,type0) is not engine_mro: + raise error0('Epoch engine class identity differs') + actual_namespace=engine_dict_get(ledger,engine_class) + if type0(actual_namespace) is not dict0 or actual_namespace is not engine_namespace: + raise error0('Epoch engine instance namespace differs') + iterator=current=None + valid_domain=True + try: + iterator=dict_iter(actual_namespace) + while True: + current=next0(iterator,missing) + if current is missing:break + if type0(current) is not str0:valid_domain=False;break + current=None + finally:iterator=current=None + if not valid_domain:raise error0('Epoch engine instance key domain differs') + if dict_len(actual_namespace)!=len0(engine_namespace_names): + raise error0('Epoch engine instance member census differs') + for field in engine_namespace_names: + if dict_get(actual_namespace,field,missing) is missing: + raise error0('Epoch engine instance member binding differs') + if dict_get(actual_namespace,'origins',missing) is not engine_origins: + raise error0('Epoch engine instance origins binding differs') + if dict_get(actual_namespace,'class_origin',missing) is not engine_class_origin or dict_get(actual_namespace,'method_origin',missing) is not engine_method_origin: + raise error0('Epoch engine fixed record binding differs') + current_phase=dict_get(actual_namespace,'phase',missing) + current_serial=dict_get(actual_namespace,'serial',missing) + current_failure=dict_get(actual_namespace,'failure',missing) + if type0(current_phase) is not str0 or current_phase not in ('COLD','ORIGINAL'): + raise error0('Epoch engine phase schema differs') + if type0(current_serial) is not int0 or current_serial<0 or current_serial>1 or (current_phase=='ORIGINAL' and current_serial!=1): + raise error0('Epoch engine serial schema differs') + # COLD/1 is a real in-progress or failed original capture interval. + # failure is None or an actual native BaseException subclass instance; + # the native type MRO avoids arbitrary __class__/isinstance callbacks. + if current_failure is not None: + failure_type=type0(current_failure) + failure_bases=class_mro_get(failure_type,type0) + valid_failure=False + for base in failure_bases: + if base is base_error0:valid_failure=True;break + if not valid_failure:raise error0('Epoch engine failure schema differs') + proxy=class_dict_get(engine_class,type0) + if proxy_len(proxy)!=len0(engine_members):raise error0('Epoch engine class census differs') + for name,value in engine_members: + if proxy_get(proxy,name,missing) is not value:raise error0('Epoch engine class binding differs') + for function,fields in engine_functions: + for (_,getter),expected in zip0(function_fields,fields): + if getter(function,function_type) is not expected:raise error0('Epoch engine method environment differs') + initial_std_modules = (_ast, ast, copy, copyreg, genericpath, hashlib, io, + ntpath, os, pathlib, posixpath, types) + producer_rules = ( + ('320435ec4125544f2b2aedf74f21469b232d08683fe76f0913607516254bbd29', 'make_runtime_guard', 'backend_guard'), + ('f7ca7f4f03ac63c1a95ba42f06149543211566de5e29f487a3dc4d08c5ee9b94', 'extra_guard_type', 'extra_guard'), + ('4bdb401271ffd049c52eff0edc28d8d604a11faf66fec419555a82cbd3b32d60', 'make_trace_type', 'trace'), + ('364b45c100be73a7ace44ab664f3c792020dad6f33f7788b62aaeab67c0c5aa9', 'make_row_interner', 'row_function'), + ('364b45c100be73a7ace44ab664f3c792020dad6f33f7788b62aaeab67c0c5aa9', 'make_runtime_guard', 'row_guard'), + ('364b45c100be73a7ace44ab664f3c792020dad6f33f7788b62aaeab67c0c5aa9', 'make_cache_runtime_guard', 'row_guard'), + ('5aeee9364d29147ef4e1bfffba532f7392833a6158d73d1da50ed6c772f061af', 'derive_row_bind', 'row_bind'), + (cache_pin, 'compose_runtime_guard', 'cache_guard'), + (cache_pin, 'compose_epoch_runtime_guard', 'epoch_guard')) + + def need(ok, message): + if not ok: + raise error0(message) + + def string_domain(owner, domains): + key = iterator = kind = None + try: + identity = id0(owner) + prior = dict_get(domains, identity, missing) + if prior is not missing: + return prior + kind = type0(owner) + if kind is dict0: + iterator = dict_iter(owner) + elif kind is proxy_type: + iterator = proxy_iter(owner) + else: + return False + while True: + key = next0(iterator, missing) + if key is missing: + break + if type0(key) is not str0: + dict_set(domains, identity, False) + return False + key = None + dict_set(domains, identity, True) + return True + finally: + key = iterator = kind = owner = None + + def get_id(owner, name, domains): + try: + if type0(name) is not str0 or not string_domain(owner, domains): + return -1 + if type0(owner) is dict0: + return id0(dict_get(owner, name, missing)) + return id0(proxy_get(owner, name, missing)) + finally: + owner = None + + def identity_mapping(owner, expected): + """Non-string dispatch dictionaries: identity scan, never key equality.""" + iterator = pair = key = value = None + try: + if type0(owner) is not dict0 or dict_len(owner) != len0(expected): + return False + iterator = iter0(dict_items(owner)) + while True: + pair = next0(iterator, missing) + if pair is missing: + break + key, value = pair + found = False + for old_key, old_value in expected: + if key is old_key: + if value is not old_value: + return False + found = True + break + if not found: + return False + pair = key = value = None + return True + finally: + iterator = pair = key = value = owner = None + + iter0 = iter + + def code_names(code): + pending, result, seen = [code], [], {} + while pending: + current = pending.pop() + need(type0(current) is code_type, 'Cold authority code shape differs') + for name in current.co_names: + need(type0(name) is str0, 'Cold authority code name shape differs') + if dict_get(seen, name, missing) is missing: + dict_set(seen, name, True) + result.append(name) + for value in current.co_consts: + if type0(value) is code_type: + pending.append(value) + return tuple0(result) + + def raw_function_record(function): + need(type0(function) is function_type, 'Cold authority requires exact functions') + values = tuple0(getter(function, function_type) for _, getter in function_fields) + code, namespace, builtins_owner, defaults, keywords, closure, attributes = values + domains = {} + try: + need(type0(namespace) is dict0 and type0(builtins_owner) is dict0 and + string_domain(namespace, domains) and string_domain(builtins_owner, domains), + 'Cold authority initial function dictionary domain differs') + keyword_items = () + if keywords is not None: + need(type0(keywords) is dict0 and string_domain(keywords, domains), + 'Cold authority initial keyword defaults differ') + keyword_items = tuple0(dict_items(keywords)) + cells = () if closure is None else tuple0((cell, cell_get(cell, cell_type)) for cell in closure) + lookups = tuple0((name, dict_get(namespace, name, missing), dict_get(builtins_owner, name, missing)) + for name in code_names(code)) + need(type0(attributes) is dict0 and string_domain(attributes, domains), + 'Cold authority function attribute dictionary differs') + return (function, values, keyword_items, cells, lookups, tuple0(dict_items(attributes))) + finally: + dict_clear(domains) + + def capture_graph(initial_functions, initial_classes): + """Called only at initial source load or directly after an admitted producer.""" + functions, classes, seen_functions, seen_classes = [], [], {}, {} + pending_functions, pending_classes = list0(initial_functions), list0(initial_classes) + while pending_functions or pending_classes: + while pending_classes: + cls = pending_classes.pop() + need(type0(cls) is type0, 'Cold authority class metaclass differs') + if dict_get(seen_classes, id0(cls), missing) is not missing: + continue + need(len0(classes) < max_classes, 'Cold authority class census exceeds bound') + dict_set(seen_classes, id0(cls), cls) + mro = class_mro_get(cls, type0) + proxy = class_dict_get(cls, type0) + engine_guard() + canonical_class = ledger.original_class(cls) + members = tuple0(proxy_items(proxy)) if canonical_class is None else canonical_class[3] + classes.append((cls, mro, proxy, members) if canonical_class is None else canonical_class) + for base in mro[1:]: + if type0(base) is type0: + pending_classes.append(base) + for name, value in members: + need(type0(name) is str0, 'Cold authority class member name differs') + kind = type0(value) + if kind is function_type: + pending_functions.append(value) + elif kind is static_type or kind is class_type: + underlying = object_get(value, '__func__') + if type0(underlying) is function_type: + pending_functions.append(underlying) + elif kind is property_type: + for field in ('fget', 'fset', 'fdel'): + underlying = object_get(value, field) + if type0(underlying) is function_type: + pending_functions.append(underlying) + if pending_functions: + function = pending_functions.pop() + if dict_get(seen_functions, id0(function), missing) is not missing: + continue + need(len0(functions) < max_functions, 'Cold authority function census exceeds bound') + engine_guard() + canonical_function = ledger.original_record(function) + record = raw_function_record(function) if canonical_function is None else canonical_function + dict_set(seen_functions, id0(function), function) + functions.append(record) + for cell, value in record[3]: + if type0(value) is function_type: + pending_functions.append(value) + defaults = record[1][3] + if defaults is not None: + need(type0(defaults) is tuple0, 'Cold authority positional defaults shape differs') + for value in defaults: + if type0(value) is function_type: + pending_functions.append(value) + for name, value in record[2] + record[5]: + if type0(value) is function_type: + pending_functions.append(value) + # Source-owned function helpers reached through effective globals + # are authenticated transitively, including validator helpers. + for name, value, builtin_value in record[4]: + if type0(value) is function_type: + pending_functions.append(value) + return (tuple0(functions), tuple0(classes)) + + def expected_global(namespace, name, expected, original_record=None): + engine_guard() + if original_record is not None: + projected = ledger.expected_lookup(original_record,namespace,name,expected) + else: + projected = ledger.expected(namespace,name,expected) + if projected is not expected:return projected + if name != 'RuntimeGuard': + return expected + record = dict_get(by_namespace, id0(namespace), missing) + if record is not missing and record[2] is namespace and record[12] == 'backend': + return dict_get(backend_guards, id0(record[0]), missing) + return expected + + def fresh_function(record, domains, builtin_values): + function, values, keyword_items, cells, lookups, attributes_items = record + if type0(function) is not function_type: + return False + field_key = ('function-fields', id0(function)) + observed_fields = dict_get(domains, field_key, missing) + if observed_fields is missing: + scalar_fields = [] + for (_, getter), expected in zip0(function_fields, values): + observed_id = id0(getter(function, function_type)) + if observed_id != id0(expected): + return False + scalar_fields.append(observed_id) + dict_set(domains, field_key, tuple0(scalar_fields)) + else: + if len0(observed_fields) != len0(values): + return False + for observed_id, expected in zip0(observed_fields, values): + if observed_id != id0(expected): + return False + code, namespace, builtins_owner, defaults, keywords, closure, attributes = values + if keywords is not None: + if type0(keywords) is not dict0 or dict_len(keywords) != len0(keyword_items): + return False + for name, expected in keyword_items: + if get_id(keywords, name, domains) != id0(expected): + return False + for cell, expected in cells: + try: + if id0(cell_get(cell, cell_type)) != id0(expected): + return False + except value_error0: + return False + if dict_len(attributes) != len0(attributes_items): + return False + for name, expected in attributes_items: + if get_id(attributes, name, domains) != id0(expected): + return False + lookup_key = ('function-lookups', id0(function), id0(code), + id0(namespace), id0(builtins_owner)) + observed_lookups = dict_get(domains, lookup_key, missing) + if observed_lookups is missing: + scalar_lookups = [] + for name, expected, expected_builtin in lookups: + observed_global = get_id(namespace, name, domains) + if observed_global != id0(expected_global(namespace, name, expected, record)): + return False + # A false builtin_values path must not observe builtin keys or + # values. The absent slot is completed only in a later true path. + if builtin_values: + observed_builtin = get_id(builtins_owner, name, domains) + if observed_builtin != id0(expected_builtin): + return False + scalar_lookups.append((name, observed_global, True, observed_builtin)) + else: + scalar_lookups.append((name, observed_global, False, 0)) + dict_set(domains, lookup_key, tuple0(scalar_lookups)) + else: + if len0(observed_lookups) != len0(lookups): + return False + completed_lookups = None + index = 0 + for (name, expected, expected_builtin), observed in zip0(lookups, observed_lookups): + if observed[0] != name: + return False + if observed[1] != id0(expected_global(namespace, name, expected, record)): + return False + if builtin_values: + if observed[2]: + observed_builtin = observed[3] + else: + observed_builtin = get_id(builtins_owner, name, domains) + if observed_builtin != id0(expected_builtin): + return False + if not observed[2]: + if completed_lookups is None: + completed_lookups = list0(observed_lookups) + completed_lookups[index] = (name, observed[1], True, observed_builtin) + index += 1 + if completed_lookups is not None: + dict_set(domains, lookup_key, tuple0(completed_lookups)) + return True + + zip0 = zip + + def fresh_graph(graph, domains, builtin_values, message): + functions, classes = graph + for cls, mro, proxy, members in classes: + if not (type0(cls) is type0 and class_mro_get(cls, type0) is mro and + proxy_len(proxy) == len0(members)): + need(False, message + ': class dispatch') + for name, expected in members: + if not (get_id(proxy, name, domains) == id0(ledger.projected_member(cls, name, expected))): + need(False, message + ': class member ' + name) + for record in functions: + if not (fresh_function(record, domains, builtin_values)): + need(False, message + ': function environment') + + def module_image(module, name, kind, path, digest, source_bytes, *, stdlib=False): + need(type0(module) is module_type, 'Cold authority module exact type differs') + namespace = module_dict_get(module, module_type) + domains = {} + try: + need(type0(namespace) is dict0 and string_domain(namespace, domains), + 'Cold authority module dictionary domain differs') + items = tuple0(dict_items(namespace)) + functions, classes = [], [] + for field, value in items: + if type0(value) is function_type: + if stdlib or value.__globals__ is namespace: + functions.append(value) + elif type0(value) is type0: + declared = type_get(value, '__module__') + if stdlib or (type0(declared) is str0 and declared == name): + classes.append(value) + graph = capture_graph(functions, classes) + mappings = [] + selected = ('_CANONICAL_BUILTINS', '_TYPE_BUILTINS') if kind == 'backend' else () + for field in selected: + mapping = dict_get(namespace, field, missing) + need(type0(mapping) is dict0, 'Cold authority backend dispatch dictionary differs') + mappings.append((field, mapping, tuple0(dict_items(mapping)))) + original_guard = dict_get(namespace, 'RuntimeGuard', missing) if kind == 'backend' else None + if kind == 'backend': + need(type0(original_guard) is type0, 'Cold authority original RuntimeGuard differs') + handle = object0() + return (handle, module, namespace, name, path, digest, source_bytes, + items, graph[0], graph[1], tuple0(mappings), original_guard, kind) + finally: + dict_clear(domains) + + def record_for(handle): + record = dict_get(registry, id0(handle), missing) + need(record is not missing and record[0] is handle, 'Cold authority handle is not registered') + return record + + def fresh_module(record, domains, builtin_values, *, registry_slot=True, exact_census=True, prefix='Cold authority'): + module, namespace = record[1], record[2] + if not (type0(module) is module_type and module_dict_get(module, module_type) is namespace): + need(False, prefix + ': module owner differs') + if registry_slot: + if not (get_id(initial_sys_modules, record[3], domains) == id0(module)): + need(False, prefix + ': registered module slot differs') + if exact_census: + if not (dict_len(namespace) == len0(record[7])): + need(False, prefix + ': namespace census differs') + for name, expected in record[7]: + if not (get_id(namespace, name, domains) == id0(expected_global(namespace, name, expected))): + need(False, prefix + ': namespace binding ' + name) + for name, mapping, expected in record[10]: + if not (identity_mapping(mapping, expected)): + need(False, prefix + ': dispatch dictionary ' + name) + fresh_graph((record[8], record[9]), domains, builtin_values, prefix) + + need(type0(root) is module_type and type0(api) is tuple0 and len0(api) == 4, + 'Cold authority requires the actual pristine root and sealed fourtuple') + root_namespace = module_dict_get(root, module_type) + root_api_graph = capture_graph(api, ()) + root_hash = dict_get(root_namespace, '_hash_regular', missing) + root_compile = dict_get(root_namespace, '_COMPILE', missing) + root_exec = dict_get(root_namespace, '_EXEC', missing) + root_identity = api[0] + initial_builtin_items = tuple0(dict_items(builtin_namespace)) + stdlib_records = tuple0(module_image(module, module.__name__, 'stdlib', None, None, None, stdlib=True) + for module in initial_std_modules) + stdlib_mappings = tuple0((mapping, tuple0(dict_items(mapping))) for mapping in + (copy._deepcopy_dispatch, copy.dispatch_table, copyreg.dispatch_table)) + self_graph = capture_graph((dict_get(authority_namespace, 'capture_epoch_authority'),), (EpochLedger,)) + self_items = tuple0(dict_items(authority_namespace)) + + def root_and_stdlib(domains): + need(type0(sys_owner) is module_type and module_dict_get(sys_owner, module_type) is sys_namespace and + get_id(sys_namespace, 'modules', domains) == id0(initial_sys_modules) and + get_id(sys_namespace, 'flags', domains) == id0(initial_sys_flags), + 'Cold authority interpreter owner differs') + need(dict_len(builtin_namespace) == len0(initial_builtin_items), 'Cold authority builtin census differs') + for name, expected in initial_builtin_items: + need(get_id(builtin_namespace, name, domains) == id0(expected), 'Cold authority builtin binding ' + name) + for name, expected in self_items: + need(get_id(authority_namespace, name, domains) == id0(expected), 'Cold authority source binding ' + name) + fresh_graph(self_graph, domains, True, 'Cold authority source') + fresh_graph(root_api_graph, domains, True, 'Cold authority root entry') + dict_clear(domains) + need(root_identity() == root_pin, 'Cold authority actual root source identity differs') + dict_clear(domains) + for record in stdlib_records: + fresh_module(record, domains, True, registry_slot=True, exact_census=False, prefix='Cold authority initial stdlib') + for mapping, expected in stdlib_mappings: + need(identity_mapping(mapping, expected), 'Cold authority initial copy dispatch differs') + + def check_registered(domains): + for record in tuple0(registry.values()): + fresh_module(record, domains, True) + for product_record in tuple0(products.values()): + fresh_graph(product_record[5], domains, True, 'Epoch current registered source product') + + def cold_check(handle=None): + domains = {} + try: + root_and_stdlib(domains) + check_registered(domains) + if handle is not None: + record = record_for(handle) + dict_clear(domains) + digest, size, raw = root_hash(record[4], max_source, False) + need(digest == record[5], 'Cold authority source file changed') + return record + return None + finally: + dict_clear(domains) + + def load(path, digest, name, kind='module'): + cold_check() + need(type0(path) is str0 and path.startswith('/') and type0(digest) is str0 and len0(digest) == 64 and + type0(name) is str0 and name and type0(kind) is str0 and kind in ('module', 'backend'), + 'Cold authority source-load argument shape differs') + for character in digest: + need(character in '0123456789abcdef', 'Cold authority source digest is not lowercase SHA256') + need((kind == 'backend') == (digest == backend_pin), 'Cold authority original backend classification differs') + domains = {} + try: + need(get_id(initial_sys_modules, name, domains) == missing_id, 'Cold authority module name already registered') + finally: + dict_clear(domains) + observed, size, source_bytes = root_hash(path, max_source, True) + need(observed == digest and type0(source_bytes) is bytes0, 'Cold authority source bytes differ') + module = module_type(name) + namespace = module_dict_get(module, module_type) + namespace.update({'__file__': path, '__builtins__': builtin_namespace}) + # Dataclass/import ownership sees the correct unique slot during exec. + dict_set(initial_sys_modules, name, module) + try: + code = root_compile(source_bytes, path, 'exec', dont_inherit=True, optimize=initial_optimize) + root_exec(code, namespace) + record = module_image(module, name, kind, path, digest, source_bytes) + dict_set(registry, id0(record[0]), record) + dict_set(by_namespace, id0(namespace), record) + if kind == 'backend': + dict_set(backend_guards, id0(record[0]), record[11]) + cold_check(record[0]) + except base_error0: + # A failed source is retained in the unique slot for evidence and + # cannot be retried/reclassified as an unobserved clean load. + raise + return (module, record[0]) + + def make_caller_descriptor(operations, label): + """Mint only at original capture or an authenticated entry-three return. + + The caller checks the dispatcher record INLINE before invoking it. This + is not a claim that the dispatcher can authenticate its own replacement + code. Its already-admitted active frame checks all target/helper objects. + """ + pending, seen, records = list0(operations), {}, [] + # Authenticate every borrowed ledger/support helper before invocation. + pending.extend(value for name,value in tuple0(dict_items(authority_namespace)) if type0(value) is function_type) + pending.extend(value for name,value in engine_members if type0(value) is function_type) + while pending: + function = pending.pop() + if dict_get(seen, id0(function), missing) is not missing: + continue + need(len0(records) < max_functions, 'Cold authority caller helper census exceeds bound') + raw = raw_function_record(function) + record = (function,) + raw[1][:6] + (raw[2], raw[3]) + dict_set(seen, id0(function), function) + records.append(record) + for cell, value in record[8]: + if type0(value) is function_type: + pending.append(value) + records = tuple0(records) + field_getters = function_fields[:6] + primitives = (type0, function_type, id0, len0, field_getters, cell_type, + cell_get, error0, value_error0, tuple0, dict0, str0, + dict_get, dict_len, dict_iter, next0, dict_clear, missing, zip0) + + def dispatch(index, *args, **kwargs): + # The active caller has already authenticated this actual function. + # This pretarget block uses captured C primitives only. In particular + # it does not call need(), fresh_function(), or any other validator. + if type0(index) is not int0 or index < 0 or index >= len0(operations): + raise error0(label + ': operation index differs') + for record in records: + function = record[0] + if type0(function) is not function_type: + raise error0(label + ': target exact function differs') + for (name, getter), expected in zip0(field_getters, record[1:7]): + if id0(getter(function, function_type)) != id0(expected): + raise error0(label + ': target function environment differs') + keywords = record[5] + if keywords is not None: + if type0(keywords) is not dict0 or dict_len(keywords) != len0(record[7]): + raise error0(label + ': target keyword census differs') + iterator = current = None + valid_domain = True + try: + iterator = dict_iter(keywords) + while True: + current = next0(iterator, missing) + if current is missing: + break + if type0(current) is not str0: + valid_domain = False + break + current = None + finally: + # Foreign current keys never survive a retained error. + iterator = current = None + if not valid_domain: + raise error0(label + ': target keyword key domain differs') + for name, expected in record[7]: + if id0(dict_get(keywords, name, missing)) != id0(expected): + raise error0(label + ': target keyword value differs') + for cell, expected in record[8]: + try: + observed_id = id0(cell_get(cell, cell_type)) + except value_error0: + raise error0(label + ': target closure became empty') from None + if observed_id != id0(expected): + raise error0(label + ': target closure value differs') + # The chosen function object comes from the original immutable + # operations tuple, not a mutable late attribute or caller registry. + if bundle_cell: + attrs = function_fields[6][1](bundle_cell[0][1][0], function_type) + iterator = current = None + valid = type0(attrs) is dict0 and dict_len(attrs)==2 + try: + if valid: + iterator=dict_iter(attrs) + while True: + current=next0(iterator,missing) + if current is missing:break + if type0(current) is not str0:valid=False;break + current=None + finally:iterator=current=None + if not valid or dict_get(attrs,'_h25_epoch_bundle',missing) is not bundle_cell[0]: + raise error0('Epoch immutable bootstrap bundle transport differs') + if dict_get(attrs,'_h25_caller_descriptor',missing) is not descriptor_cell[0]: + raise error0('Epoch original caller descriptor transport differs') + return operations[index](*args, **kwargs) + + raw_dispatch = raw_function_record(dispatch) + dispatch_record = (dispatch,) + raw_dispatch[1][:6] + (raw_dispatch[2], raw_dispatch[3]) + need(dispatch_record[4] is None and dispatch_record[5] is None and not dispatch_record[7], + 'Cold authority dispatcher source defaults contract differs') + return ('h25-cold-authority-caller-v1', operations, dispatch, + dispatch_record, records, primitives) + + def runtime_guard(handle): + record = cold_check(handle) + def guarded_helpers(): + domains = {} + try: + fresh_module(record, domains, False, prefix='Runtime drift: cache collector') + finally: + dict_clear(domains) + child_descriptor = make_caller_descriptor((guarded_helpers,), 'Runtime drift: cache collector caller') + return (guarded_helpers, child_descriptor) + + def known_backend(module): + need(type0(module) is module_type, 'Cold authority producer backend type differs') + namespace = module_dict_get(module, module_type) + record = dict_get(by_namespace, id0(namespace), missing) + need(record is not missing and record[1] is module and record[12] == 'backend' and record[5] == backend_pin, + 'Cold authority producer backend provenance differs') + return record + + def known_guard(cls): + need(type0(cls) is type0, 'Cold authority exact guard class differs') + for record in tuple0(registry.values()): + if record[12] == 'backend' and cls is record[11]: + return None + product = dict_get(products, id0(cls), missing) + need(product is not missing and product[0] is cls and product[6] in + ('backend_guard', 'extra_guard', 'row_guard', 'cache_guard', 'epoch_guard'), + 'Cold authority guard was not produced by an admitted source') + domains = {} + try: + fresh_graph(product[5], domains, True, 'Cold authority producer base product') + finally: + dict_clear(domains) + return product + + def classify(record, export): + for digest, name, role in producer_rules: + if digest is not None and record[5] == digest and export == name: + return role + return None + + def validate_producer_arguments(record, export, role, args, kwargs): + domains = {} + try: + need(type0(kwargs) is dict0 and string_domain(kwargs, domains) and not kwargs, + 'Cold authority reviewed producers require positional arguments') + if role == 'backend_guard': + need(len0(args) == 1, 'Cold authority backend guard arguments differ') + known_backend(args[0]) + elif role == 'extra_guard': + need(len0(args) == 3 and type0(args[2]) is tuple0, 'Cold authority trace guard arguments differ') + known_guard(args[0]); known_backend(args[1]) + for entry in args[2]: + need(type0(entry) is tuple0 and len0(entry) == 3, + 'Cold authority trace entry shape differs') + owner, name, function = entry + need(type0(owner) is module_type and type0(name) is str0 and + type0(function) is builtin_type and + builtin_self_get(function, builtin_type) is owner and + get_id(module_dict_get(owner, module_type), name, domains) == id0(function), + 'Cold authority trace entry owner differs') + elif role == 'trace': + need(len0(args) == 2 and type0(args[1]) is module_type, 'Cold authority trace producer arguments differ') + known_backend(args[0]) + elif role == 'row_function': + need(not args, 'Cold authority row interner arguments differ') + elif role == 'row_guard': + need(len0(args) == 2, 'Cold authority row guard arguments differ') + known_guard(args[0]) + product = dict_get(products, id0(args[1]), missing) + need(product is not missing and product[0] is args[1] and product[1] is record[0] and + product[2] == 'make_row_interner' and product[6] == 'row_function', + 'Cold authority row helper provenance differs') + fresh_graph(product[5], domains, True, 'Cold authority producer row helper') + elif role == 'cache_guard': + need(len0(args) == 2 and type0(args[1]) is dict0 and string_domain(args[1], domains), + 'Cold authority cache guard arguments differ') + known_guard(args[0]) + owner = dict_get(args[1], 'owner', missing) + need(type0(owner) is dict_get(record[2], '_Owner', missing), + 'Cold authority prepared cache owner class differs') + elif role == 'epoch_guard': + need(len0(args)==2, 'Epoch guard exact source arguments') + known_guard(args[0]) + suite=args[1] + need(type0(suite) is dict_get(record[2], '_EpochSuite', missing), 'Epoch guard source suite class') + origin=ledger.origin(suite.handle) + need(origin['suite'] is suite and origin['cache_handle'] is record[0], 'Epoch guard actual source generation') + elif role == 'row_bind': + need(len0(args) == 2 and type0(args[0]) is function_type and type0(args[1]) is bytes0, + 'Cold authority row bind arguments differ') + found = False + for backend_record in tuple0(registry.values()): + if (backend_record[12] == 'backend' and args[0] is dict_get(backend_record[2], 'bind', missing) and + args[1] is backend_record[6]): + found = True + break + need(found, 'Cold authority row bind is not the original registered function/source') + finally: + dict_clear(domains) + + def invoke(handle, export, *args, **kwargs): + record = cold_check(handle) + need(type0(export) is str0, 'Cold authority export name must be exact str') + function = dict_get(record[2], export, missing) + need(type0(function) is function_type and function.__globals__ is record[2], + 'Cold authority export is not an owned source function') + role = classify(record, export) + if role is not None: + validate_producer_arguments(record, export, role, args, kwargs) + result = function(*args, **kwargs) + if role is not None: + # Do not retain a row producer's enclosing tuple or mutable AST. + product = result[0] if type0(result) is tuple0 and len0(result) and type0(result[0]) is function_type else result + expected_kind = function_type if role in ('row_function', 'row_bind') else type0 + need(type0(product) is expected_kind and dict_get(products, id0(product), missing) is missing, + 'Cold authority producer did not return a fresh exact product') + graph = capture_graph((product,) if expected_kind is function_type else (), + (product,) if expected_kind is type0 else ()) + product_record = (product, handle, export, args, tuple0(dict_items(kwargs)), graph, role) + dict_set(products, id0(product), product_record) + domains = {} + try: + fresh_graph(graph, domains, True, 'Cold authority new product') + finally: + dict_clear(domains) + return result + + def check_product(obj, producer_handle, export, args_tuple, kwargs_dict): + record_for(producer_handle) + cold_check(producer_handle) + need(type0(args_tuple) is tuple0 and type0(kwargs_dict) is dict0 and type0(export) is str0, + 'Cold authority product proof arguments differ') + product = dict_get(products, id0(obj), missing) + need(product is not missing and product[0] is obj and product[1] is producer_handle and product[2] == export, + 'Cold authority product provenance differs') + need(len0(args_tuple) == len0(product[3]), 'Cold authority product positional census differs') + for actual, expected in zip0(args_tuple, product[3]): + need(actual is expected, 'Cold authority product positional identity differs') + domains = {} + try: + need(dict_len(kwargs_dict) == len0(product[4]), 'Cold authority product keyword census differs') + for name, expected in product[4]: + need(get_id(kwargs_dict, name, domains) == id0(expected), 'Cold authority product keyword identity differs') + fresh_graph(product[5], domains, True, 'Cold authority registered product') + finally: + dict_clear(domains) + return None + + def set_backend_guard(handle, cls): + record = cold_check(handle) + need(record[12] == 'backend', 'Cold authority guard transition requires original backend') + product = known_guard(cls) + domains = {} + try: + if product is not None: + fresh_graph(product[5], domains, True, 'Cold authority guard transition product') + old = dict_get(backend_guards, id0(handle), missing) + need(dict_get(record[2], 'RuntimeGuard', missing) is old, + 'Cold authority backend guard changed outside the transition ledger') + dict_clear(domains) + dict_set(record[2], 'RuntimeGuard', cls) + dict_set(backend_guards, id0(handle), cls) + transitions.append((handle, old, cls, product)) + fresh_module(record, domains, True) + finally: + dict_clear(domains) + return None + + def source(handle): + record = cold_check(handle) + return (record[1], record[4], record[5], record[6]) + + # Final initial-root validation occurs before any source can receive a token. + cold_check() + need(api[1](capability, provider_pin) is not None, 'Cold authority root capability differs') + operations = (load, invoke, cold_check, runtime_guard, check_product, set_backend_guard, source) + descriptor = make_caller_descriptor(operations, 'Cold authority caller') + # Original raw loader only: capture this transport immediately and retain + # the immutable descriptor privately. No later attribute read is authority. + load.__dict__['_h25_caller_descriptor'] = descriptor + descriptor_cell.append(descriptor) + epoch_operations = _epoch_operations(ledger, operations, capture_graph, raw_function_record, + make_caller_descriptor, record_for, cold_check, root, capability, api, missing, engine_guard, bundle_cell) + epoch_descriptor = make_caller_descriptor(epoch_operations, 'Epoch authority caller') + bundle = ('h25-cold-authority-epoch-bundle-v1', operations, epoch_operations, epoch_descriptor) + bundle_cell.append(bundle) + load.__dict__['_h25_epoch_bundle'] = bundle + return bundle diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-epoch-products-v5/epoch_cache_products_v1.py.txt b/research/h25-cache-source-handoff/snapshot/areas/cache-epoch-products-v5/epoch_cache_products_v1.py.txt new file mode 100644 index 0000000000..e35baaa9e3 --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-epoch-products-v5/epoch_cache_products_v1.py.txt @@ -0,0 +1,2739 @@ +"""Source-derived verdict wrappers with current-data and live-runtime authority. + +Parent-owned installation only. No scientific module imports, arithmetic +replacement, immutable Label replacement or shared reference answers. Generic +Label data may use literal uncached expressions; custom Checks/verdict mappings +are rejected. Serial stability is the existing native backend contract. + +V7 preserves the V5 public-dictionary collision contract, the V6 backend/deep +guard split, and the real row interner at both full and light guard boundaries. +All cold entries are invoked through one source-closed early authority. Ordered +base/trace preflight retains the original existing-drift first error. Private +owner/guard state corruption remains excluded; no instance-key safety is claimed. +This source-only draft requires independent source and concrete stage admission. + +V5 replaces the all-public entry census with a fresh admitted native collision- +path inspector. The inspector returns True or NotImplemented metadata only; +entry and exit always inspect current state. All source arithmetic/public dict +operations, canonical scans and authority remain Python-owned and unchanged. +No path, version stamp, validation PASS or arithmetic answer is saved by the +inspector. Compile/runtime/full gates remain closed pending independent review. + +The concrete caller must exclude unrelated callbacks/finalizers, signals, +pending callbacks, concurrent mutation and private corruption for the whole +admitted request: initial guard through key/preparation/probes/original work, +exit guards and authority commit/return. GIL ownership and snapshots alone do +not establish that premise. Unsupported fallback retains separately scoped +literal callbacks and receives no authority. + +""" +from __future__ import annotations + +import _thread +import ast +import builtins +import copy +import gc +import hashlib +from pathlib import Path +import sys +from types import BuiltinFunctionType, CodeType, FunctionType, GetSetDescriptorType, ModuleType + +V8_SOURCE_DRAFT = False +V8_ROW_SOURCE_SHA256 = "364b45c100be73a7ace44ab664f3c792020dad6f33f7788b62aaeab67c0c5aa9" +V8_ROW_PRODUCER_SHA256 = "5aeee9364d29147ef4e1bfffba532f7392833a6158d73d1da50ed6c772f061af" +BACKEND_SOURCE_SHA256 = "e473c38245c3668715b5a78dfe980b2fe3ed0d0c9b8c97c666fbae6ecf1fffd5" +SOURCE_SHA256 = "d623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1" +# Exact provider bytes frozen by the disjoint native source author. +PROBE_PROVIDER_SHA256 = "9cbb7368f89e71d1e6cc46db5dc77efed3e03ed2a801c98c88fe316e4d9f3ef2" +# Correctness-only source pins. Actual parent/native admission and full funding +# remain separate gates; no runtime or performance permission follows here. +BOOTSTRAP_ROOT_SHA256 = "f5a2d33f2b4d3651f214156a0e7094c2bb516ce2d5ab7698d18c11f98f35dee0" +_NOT_IMPLEMENTED = NotImplemented +_TYPE, _OBJECT, _DICT, _TUPLE, _INT, _STR, _BOOL = type, object, dict, tuple, int, str, bool +_LEN, _SORTED, _ID, _COMPILE = len, sorted, id, compile +_GET, _ITEMS, _CLEAR = dict.get, dict.items, dict.clear +_OBJGET, _TYPEGET = object.__getattribute__, type.__getattribute__ +_ERROR, _BASE_ERROR, _VALUE_ERROR = RuntimeError, BaseException, ValueError +_BUILTINS = builtins.__dict__ +_ANY = _BUILTINS["any"] +_GETTRACE, _GETPROFILE, _THREADCOUNT = sys.gettrace, sys.getprofile, _thread._count +_MISSING = object() + + +def _need(condition, message): + if not condition: + raise _ERROR(message) + + +def _record(function): + _need(_TYPE(function) is FunctionType, "Cache contract requires ordinary functions") + closure = function.__closure__ + return (function, function.__code__, function.__globals__, function.__builtins__, + function.__defaults__, function.__kwdefaults__, closure, + () if closure is None else _TUPLE((cell, cell.cell_contents) for cell in closure)) + + +def _fresh(record): + function, code, namespace, builtins_owner, defaults, kwdefaults, closure, cells = record + if not (function.__code__ is code and function.__globals__ is namespace and + function.__builtins__ is builtins_owner and function.__defaults__ is defaults and + function.__kwdefaults__ is kwdefaults and function.__closure__ is closure): + return False + for cell, value in cells: + try: + if cell.cell_contents is not value: + return False + except _VALUE_ERROR: + return False + return True + + +def _string_key_domain(namespace): + """Return shape metadata only; release observed key/iterator before return. + + Exact dict does not by itself prevent equality callbacks on named lookup. + The closed guard interval excludes concurrent mutation and unrelated + allocation finalizers; this function does not disable garbage collection. + """ + if _TYPE(namespace) is not _DICT: + return False + current = iterator = None + try: + iterator = _DICT.__iter__(namespace) + for current in iterator: + if _TYPE(current) is not _STR: + return False + return True + finally: + current = None + iterator = None + namespace = None + + +def _observed_fresh(record, observations): + """Share scalar actual metadata, never a PASS or independently expected row. + + Function/cell objects below come from retained expected records. Current + defaults/code/globals/cell values are consumed only by captured id and are + never bound to local variables or retained in a traceback. Every expected + record still compares separately, in original field/cell order. + """ + current = key = None + try: + function, code, namespace, builtins_owner, defaults, kwdefaults, closure, cells = record + if _TYPE(function) is not FunctionType: + return False + key = (0, _ID(function)) + current = _GET(observations, key, _MISSING) + if current is _MISSING: + current = (_ID(function.__code__), _ID(function.__globals__), + _ID(function.__builtins__), _ID(function.__defaults__), + _ID(function.__kwdefaults__), _ID(function.__closure__)) + observations[key] = current + if not (current[0] == _ID(code) and current[1] == _ID(namespace) and + current[2] == _ID(builtins_owner) and current[3] == _ID(defaults) and + current[4] == _ID(kwdefaults) and current[5] == _ID(closure)): + return False + for cell, value in cells: + key = (1, _ID(cell)) + current = _GET(observations, key, _MISSING) + if current is _MISSING: + try: + current = (True, _ID(cell.cell_contents)) + except _VALUE_ERROR: + current = (False, 0) + observations[key] = current + if not current[0] or current[1] != _ID(value): + return False + return True + finally: + current = key = None + observations = None + + +def _ordinary(cls): + if _TYPE(cls) is not _TYPE or _TYPEGET(cls, "__mro__") != (cls, _OBJECT): + return False + members = _TYPEGET(cls, "__dict__") + if "__getattr__" in members or _TYPEGET(cls, "__getattribute__") is not _OBJECT.__getattribute__: + return False + if _TYPEGET(cls, "__new__") is not _OBJECT.__new__: + return False + for name in ("__dict__", "__weakref__"): + descriptor = members.get(name) + if _TYPE(descriptor) is not GetSetDescriptorType or descriptor.__objclass__ is not cls: + return False + return True + + +def _plain_fields(instance, cls): + if _TYPE(instance) is not cls: + return None + namespace = _OBJGET(instance, "__dict__") + if _TYPE(namespace) is not _DICT: + return None + # Validate before string-key lookup: injected custom keys could otherwise + # invoke equality against an ordinary field name. + for name in namespace: + if _TYPE(name) is not _STR: + return None + return namespace + + +def _canonical(instance, label): + """Current exact data, never Label.key alone; no custom operand dispatch.""" + namespace = _plain_fields(instance, label) + if namespace is None or _LEN(namespace) != 3: + return None + basis = _GET(namespace, "basis", _MISSING) + dim = _GET(namespace, "dim", _MISSING) + key = _GET(namespace, "key", _MISSING) + if _TYPE(basis) is not _DICT or _TYPE(dim) is not _INT or _TYPE(key) is not _TUPLE: + return None + if dim != _LEN(basis) or _LEN(key) != dim: + return None + for value in key: + if _TYPE(value) is not _INT: + return None + pivots = 0 + values = [] + for pivot, value in _ITEMS(basis): + if _TYPE(pivot) is not _INT or _TYPE(value) is not _INT: + return None + if pivot <= 0 or pivot & (pivot - 1) or value <= 0 or value & -value != pivot: + return None + pivots |= pivot + values.append(value) + for pivot, value in _ITEMS(basis): + if value & pivots != pivot: + return None + if _TUPLE(_SORTED(values)) != key: + return None + # key is now an exact immutable representation of the canonical mapping. + return key + + +def _hooks_clear(): + """Known hook exclusion, not a promise against signals/finalizers/threads.""" + if _GETTRACE() is not None or _GETPROFILE() is not None or _THREADCOUNT() != 0: + return False + callbacks = gc.callbacks + if _TYPE(callbacks) is not list or _LEN(callbacks): + return False + monitoring = getattr(sys, "monitoring", None) + if monitoring is not None: + for tool in range(6): + if monitoring.get_tool(tool) is not None: + return False + return True + + +class _State: + __slots__ = ("checks", "mapping", "authority") + + def __init__(self, checks, mapping): + self.checks, self.mapping, self.authority = checks, mapping, {} + + +class _Ticket: + __slots__ = ("state", "signature", "c", "h", "hit", "expected") + + def __init__(self, state, signature, circuit, height): + self.state, self.signature, self.c, self.h = state, signature, circuit, height + self.hit, self.expected = False, _MISSING + + +class _Owner: + def __init__(self, module, source_records, class_names, probe_provider, probe_binding, + bootstrap_root, bootstrap_capability, bootstrap_api, bootstrap_validate, bootstrap_load, + bootstrap_identity, collector_guard, collector_descriptor): + self.collector_guard = collector_guard + self.collector_descriptor = collector_descriptor + self.module, self.namespace = module, module.__dict__ + self.checks_class, self.label = self.namespace["Checks"], self.namespace["Label"] + self.source_records, self.class_names = source_records, class_names + self.odd = self.namespace["odd"] + self.probe_provider, self.probe_binding = probe_provider, probe_binding + self.probe_namespace = probe_provider.__dict__ + self.probe_class = _TYPE(probe_binding) + self.probe_validate = probe_provider.validate_binding + self.probe_inspect = probe_binding.inspect + self.probe_counters = probe_binding.counters + self.probe_close = probe_binding.close + self.probe_namespace_items = _TUPLE(self.probe_namespace.items()) + self.probe_class_mro = _TYPEGET(self.probe_class, "__mro__") + self.probe_class_items = _TUPLE(_TYPEGET(self.probe_class, "__dict__").items()) + probe_functions = [value for _, value in self.probe_namespace_items if _TYPE(value) is FunctionType] + probe_functions.extend(value for _, value in self.probe_class_items if _TYPE(value) is FunctionType) + self.probe_records = _TUPLE(_record(function) for function in probe_functions) + self.bootstrap_root, self.bootstrap_capability = bootstrap_root, bootstrap_capability + self.bootstrap_api = bootstrap_api + self.bootstrap_validate, self.bootstrap_load = bootstrap_validate, bootstrap_load + self.bootstrap_identity = bootstrap_identity + self.bootstrap_namespace = bootstrap_root.__dict__ + self.bootstrap_namespace_items = _TUPLE(self.bootstrap_namespace.items()) + self.bootstrap_class = _TYPE(bootstrap_capability) + self.bootstrap_class_mro = _TYPEGET(self.bootstrap_class, "__mro__") + self.bootstrap_class_items = _TUPLE(_TYPEGET(self.bootstrap_class, "__dict__").items()) + bootstrap_functions = [value for _, value in self.bootstrap_namespace_items + if _TYPE(value) is FunctionType] + bootstrap_functions.extend(value for _, value in self.bootstrap_class_items + if _TYPE(value) is FunctionType) + bootstrap_functions.extend(bootstrap_api) + self.bootstrap_records = _TUPLE(_record(function) for function in bootstrap_functions) + self.probe_closed = False + self.teardown_stop = None + self.teardown_primary_error = None + self.teardown_close_error = None + self.runtime = None + self.composed_guard = None + self.composed_guard_records = () + self.base_guard_records = () + self.base_guard_classes = () + self.binding_derivation = None + self.factory_environment = None + self.base_guard = None + self.methods = {} + self.method_records = () + self.states = {} + self.receipt = {"schema": "h25-cache-contract-v8", "source_sha256": SOURCE_SHA256, + "requests": 0, "entry_checks": 0, "exit_checks": 0, + "probe_entry_calls": 0, "probe_exit_calls": 0, + "probe_safe_observations": 0, "probe_unsupported_observations": 0, + "probe_exit_rejections": 0, + "snapshots": 0, "eligible_requests": 0, "uncached_requests": 0, + "authorized_hits": 0, "authorized_results": 0, + "invalidations": 0, "peak_authority_entries": 0, + "current_authority_entries": 0, "teardowns": 0} + + def _clear(self, state): + count = _LEN(state.authority) + if count: + _CLEAR(state.authority) + self.receipt["current_authority_entries"] -= count + self.receipt["invalidations"] += 1 + + def _lookup_state(self, checks): + state = _GET(self.states, _ID(checks)) + if state is not None and state.checks is checks: + return state + return None + + def enter(self, checks): + _need(self.runtime is not None, "Cache contract runtime is not attached") + self.runtime.check() + self.receipt["entry_checks"] += 1 + self.receipt["requests"] += 1 + # Do not read verdicts/everything/key here. Original key errors precede + # original verdict access errors; custom Checks itself is unsupported. + _need(_plain_fields(checks, self.checks_class) is not None, + "Unsupported cache contract Checks dispatch or fields") + return checks + + def _data(self, checks, key, operands, kind): + self.receipt["snapshots"] += 1 + namespace = _plain_fields(checks, self.checks_class) + if namespace is None: + return None + circuit, height = _GET(namespace, "c", _MISSING), _GET(namespace, "h", _MISSING) + if circuit is _MISSING or _TYPE(height) is not _INT: + return None + keys = [] + for operand in operands: + value = _canonical(operand, self.label) + if value is None: + return None + keys.append(value) + if kind == "label": + everything = _GET(namespace, "everything", _MISSING) + whole_key = _canonical(everything, self.label) + if whole_key is None or _TYPE(key) is not _TUPLE or key != ("label", keys[0]): + return None + signature = (kind, keys[0], whole_key) + else: + if _TYPE(key) is not _TUPLE or key != (keys[0], keys[1]): + return None + signature = (kind, keys[0], keys[1]) + return signature, circuit, height + + def _probe_safe(self, mapping, key, *, exit_boundary=False): + """Fresh metadata only. inspect itself checks admitted provider/native state.""" + self.check_bootstrap() + counter = "probe_exit_calls" if exit_boundary else "probe_entry_calls" + self.receipt[counter] += 1 + result = self.probe_inspect(mapping, key) + if result is True: + self.receipt["probe_safe_observations"] += 1 + return True + if result is _NOT_IMPLEMENTED: + self.receipt["probe_unsupported_observations"] += 1 + return False + raise _ERROR("Cache probe returned non-metadata result") + + def prepare(self, checks, key, operands, kind): + namespace = _plain_fields(checks, self.checks_class) + _need(namespace is not None, "Unsupported cache contract Checks fields") + mapping = _GET(namespace, "verdicts", _MISSING) + state = self._lookup_state(checks) + if mapping is _MISSING: + if state is not None: + self._clear(state) + self.receipt["uncached_requests"] += 1 + return None # original `self.verdicts` raises at its original site + _need(_TYPE(mapping) is _DICT, "Unsupported cache contract verdict mapping") + if state is None or state.mapping is not mapping: + if state is not None: + self._clear(state) + state = _State(checks, mapping) + self.states[_ID(checks)] = state + # Preserve original key construction and canonical/type admission before + # the native helper may hash an exact supported request key. + data = self._data(checks, key, operands, kind) if _hooks_clear() else None + public_safe = data is not None and self._probe_safe(mapping, key) + if not public_safe: + self._clear(state) # no hash/equality involving unsupported key + self.receipt["uncached_requests"] += 1 + return None + self.receipt["eligible_requests"] += 1 + signature, circuit, height = data + return _Ticket(state, signature, circuit, height) + + def reuse(self, ticket, key): + if ticket is None: + return False + record = _GET(ticket.state.authority, key) + if record is None: + return False + signature, circuit, height, result = record + if signature != ticket.signature or circuit is not ticket.c or height != ticket.h: + return False + ticket.hit, ticket.expected = True, result + return True + + def finish(self, checks, key, operands, kind, ticket, result): + self.runtime.check() + self.receipt["exit_checks"] += 1 + if ticket is None: + state = self._lookup_state(checks) + if state is not None: + self._clear(state) # callbacks may have made reentrant requests + return result + namespace = _plain_fields(checks, self.checks_class) + same_mapping = namespace is not None and _GET(namespace, "verdicts", _MISSING) is ticket.state.mapping + data = self._data(checks, key, operands, kind) if same_mapping and _hooks_clear() else None + if (not same_mapping or + data is None or data[0] != ticket.signature or + data[1] is not ticket.c or data[2] != ticket.h): + self._clear(ticket.state) + raise _ERROR("Cache data changed during request") + if not self._probe_safe(ticket.state.mapping, key, exit_boundary=True): + self._clear(ticket.state) + self.receipt["probe_exit_rejections"] += 1 + raise _ERROR("Cache probe unsupported at exit") + if ticket.hit and result is not ticket.expected: + self._clear(ticket.state) + raise _ERROR("Cache verdict authority changed") + if _TYPE(result) is not _BOOL: + self._clear(ticket.state) + return result + if ticket.hit: + self.receipt["authorized_hits"] += 1 + authority = ticket.state.authority + if key not in authority: + self.receipt["current_authority_entries"] += 1 + count = self.receipt["current_authority_entries"] + if count > self.receipt["peak_authority_entries"]: + self.receipt["peak_authority_entries"] = count + authority[key] = (ticket.signature, ticket.c, ticket.h, result) + self.receipt["authorized_results"] += 1 + return result + + def abort(self, checks): + state = self._lookup_state(checks) + if state is not None: + self._clear(state) + + def check_bootstrap(self): + """Freshness relative to the actual root authenticated by the parent. + + Exact types and snapshots enforce continuity; they do not independently + authenticate an arbitrary caller-supplied root. Parent bootstrap identity + is an explicit prerequisite, established before loading this adapter. + """ + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:16 + _ca_desc = self.collector_descriptor + _ca_runtime_operations = _ca_desc[1] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if _ca_type(_ca_runtime_operations) is not _ca_p[9] or _ca_p[3](_ca_runtime_operations) != 1 or _ca_runtime_operations[0] is not self.collector_guard: + raise _ca_error("Runtime drift: cache collector operation identity differs") + if _ca_runtime_operations is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Runtime drift: cache collector dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Runtime drift: cache collector dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Runtime drift: cache collector dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Runtime drift: cache collector dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Runtime drift: cache collector dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:16 + _ca_dispatch(0) + _need(_TYPE(self.bootstrap_root) is ModuleType and + _string_key_domain(self.bootstrap_root.__dict__), + "Unsupported cache bootstrap lookup key domain") + _need(_TYPE(self.bootstrap_root) is ModuleType and + self.bootstrap_root.__dict__ is self.bootstrap_namespace and + _LEN(self.bootstrap_namespace) == _LEN(self.bootstrap_namespace_items), + "Runtime drift: cache bootstrap root namespace") + for name, value in self.bootstrap_namespace_items: + _need(_GET(self.bootstrap_namespace, name, _MISSING) is value, + "Runtime drift: cache bootstrap root binding " + name) + _need(_TYPE(self.bootstrap_api) is _TUPLE and _LEN(self.bootstrap_api) == 4 and + self.bootstrap_api[0] is self.bootstrap_identity and + self.bootstrap_api[1] is self.bootstrap_validate and + self.bootstrap_api[2] is self.bootstrap_load, + "Runtime drift: cache captured bootstrap entry") + _need(_TYPE(self.bootstrap_capability) is self.bootstrap_class and + _TYPEGET(self.bootstrap_class, "__mro__") is self.bootstrap_class_mro, + "Runtime drift: cache bootstrap capability class") + members = _TYPEGET(self.bootstrap_class, "__dict__") + _need(_LEN(members) == _LEN(self.bootstrap_class_items), + "Runtime drift: cache bootstrap capability members") + for name, value in self.bootstrap_class_items: + _need(members.get(name) is value, + "Runtime drift: cache bootstrap capability member " + name) + for record in self.bootstrap_records: + _need(_fresh(record), "Runtime drift: cache bootstrap function calling environment") + root_digest = self.bootstrap_identity() + _need(_TYPE(root_digest) is _STR and root_digest == BOOTSTRAP_ROOT_SHA256, + "Cache bootstrap source identity differs") + _need(self.bootstrap_validate(self.bootstrap_capability, PROBE_PROVIDER_SHA256) is self.probe_provider, + "Cache bootstrap authenticated provider identity differs") + + def teardown(self): + for state in self.states.values(): + self._clear(state) + _CLEAR(self.states) + self.receipt["teardowns"] += 1 + _need(not self.probe_closed, "Cache probe was already closed") + expected_calls = self.receipt["probe_entry_calls"] + self.receipt["probe_exit_calls"] + native_counters = None + primary_error = close_error = None + stage = "validation" + try: + self.check_bootstrap() + self.probe_validate(self.probe_binding) + stage = "counters" + native_counters = self.probe_counters() + stage = "accounting" + _need(_TYPE(native_counters) is _DICT and + _TYPE(_GET(native_counters, "calls")) is _INT and + native_counters["calls"] == expected_calls and + _TYPE(_GET(native_counters, "counter_overflow")) is _INT and + native_counters["counter_overflow"] == 0, + "Cache native probe call accounting or saturation differs") + except _BASE_ERROR as error: + primary_error = error + finally: + try: + # Captured provider close attempts its captured native disarm and + # registry removal even when its own freshness/audit rejects. + self.probe_close() + except _BASE_ERROR as error: + close_error = error + finally: + self.probe_closed = True + if primary_error is not None or close_error is not None: + self.teardown_primary_error = primary_error + self.teardown_close_error = close_error + observed = (_GET(native_counters, "calls") + if _TYPE(native_counters) is _DICT else None) + self.teardown_stop = { + "status": "STOP", "stage": stage if primary_error is not None else "close", + "expected_probe_calls": expected_calls, + "observed_probe_calls": observed, + "attempted_minus_native": (expected_calls - observed + if _TYPE(observed) is _INT else None), + "native_probe": native_counters, + "native_counters_available": native_counters is not None, + "close_attempted": True, "owner_terminal": True, + "primary_error": (None if primary_error is None else + (_TYPE(primary_error).__name__, _STR(primary_error))), + "close_error": (None if close_error is None else + (_TYPE(close_error).__name__, _STR(close_error))), + } + # Preserve the actual primary exception object, including its + # traceback. A cleanup failure remains explicit as its cause. + if primary_error is not None: + if close_error is not None: + raise primary_error from close_error + raise primary_error + raise close_error + result = _DICT(self.receipt) + result["native_probe"] = native_counters + result["probe_closed"] = True + return result + + +def _code_named(code, name): + for item in code.co_consts: + if _TYPE(item) is CodeType and item.co_name == name: + return item + raise _ERROR("Cache contract expected source code was absent: " + name) + + +def _authenticate(function, expected, namespace): + _need(_TYPE(function) is FunctionType and function.__globals__ is namespace and + function.__builtins__ is _BUILTINS and function.__closure__ is None and + function.__defaults__ is None and function.__kwdefaults__ is None and + _code_equal(function.__code__, expected), "Cache contract original source authentication failed") + return _record(function) + + +def _generate(module, original_ast, owner, kind): + """Retain literal key/membership/body/store/return subtrees unchanged.""" + original = copy.deepcopy(original_ast) + body = original.body + _need(_LEN(body) == 4 and _TYPE(body[0]) is ast.Expr and + _TYPE(body[1]) is ast.Assign and _TYPE(body[2]) is ast.If and + _TYPE(body[3]) is ast.Return, "Cache contract original method AST shape changed") + original_dump = ast.dump(original, include_attributes=False) + operands = "(lab,)" if kind == "label" else "(small, big)" + template = ast.parse(''' +def _factory(_h25_cache_owner, _h25_cache_error): + def _method(self): + _h25_cache_checks = _h25_cache_owner.enter(self) + try: + _H25_KEY + _h25_cache_ticket = _h25_cache_owner.prepare(self, key, OPERANDS, KIND) + _H25_IF + _h25_cache_result = _H25_RETURN + return _h25_cache_owner.finish(self, key, OPERANDS, KIND, + _h25_cache_ticket, _h25_cache_result) + except _h25_cache_error: + _h25_cache_owner.abort(_h25_cache_checks) + raise + return _method +''') + factory = template.body[0] + method = factory.body[0] + method.name, method.args = original.name, original.args + method.body.insert(0, body[0]) + factory.body[1].value.id = original.name + guarded = method.body[2] + guarded.body[0] = body[1] + original_if = body[2] + original_if.test = ast.BoolOp(op=ast.Or(), values=[original_if.test, + ast.UnaryOp(op=ast.Not(), operand=ast.parse( + "_h25_cache_owner.reuse(_h25_cache_ticket, key)", mode="eval").body)]) + guarded.body[2] = original_if + guarded.body[3].value = body[3].value + + class Replace(ast.NodeTransformer): + def visit_Name(self, node): + if node.id == "OPERANDS": + return ast.copy_location(ast.parse(operands, mode="eval").body, node) + if node.id == "KIND": + return ast.copy_location(ast.Constant(value=kind), node) + return node + + Replace().visit(template) + ast.fix_missing_locations(template) + compiled = _COMPILE(template, "", "exec", dont_inherit=True, + optimize=sys.flags.optimize) + # FunctionType avoids adding even temporary globals to the scientific module. + make = FunctionType(_code_named(compiled, "_factory"), module.__dict__) + generated = make(owner, _BASE_ERROR) + _need(ast.dump(original_ast, include_attributes=False) == original_dump, + "Cache contract generator mutated the original AST") + return generated + + +def _bootstrap_api(bootstrap_root, bootstrap_capability, bootstrap_api): + """Use the independently authenticated actual parent root and capability. + + The parent establishes root identity before this adapter is loaded. This is + not admission of arbitrary duck-typed root callbacks. All provider source + reads, hashing, compile and execution belong exclusively to that root. + """ + _need(_TYPE(PROBE_PROVIDER_SHA256) is _STR and _LEN(PROBE_PROVIDER_SHA256) == 64, + "Cache probe provider source pin is not configured") + _need(_TYPE(BOOTSTRAP_ROOT_SHA256) is _STR and _LEN(BOOTSTRAP_ROOT_SHA256) == 64, + "Cache trusted bootstrap root pin is not configured") + _need(_TYPE(bootstrap_root) is ModuleType, "Cache requires the actual trusted parent bootstrap root") + namespace = bootstrap_root.__dict__ + _need(_TYPE(bootstrap_api) is _TUPLE and _LEN(bootstrap_api) == 4 and + not _ANY(_TYPE(function) is not FunctionType or function.__globals__ is not namespace + for function in bootstrap_api), + "Cache bootstrap entries are not the parent's sealed source-bound API") + # The parent sealed these closures before driver/scientific code. Their + # captured pristine guard runs before mutable root helper lookup; no late + # capture of public root validate/load attributes occurs here. + identity, validate, load, diagnostics = bootstrap_api + root_digest = identity() + _need(_TYPE(root_digest) is _STR and root_digest == BOOTSTRAP_ROOT_SHA256, + "Cache trusted bootstrap root source differs") + provider = validate(bootstrap_capability, PROBE_PROVIDER_SHA256) + _need(_TYPE(provider) is ModuleType, "Cache bootstrap provider type differs") + return provider, validate, load, identity + + +def _load_probe(extension_path, expected_extension_sha256, bootstrap_root, bootstrap_capability, + bootstrap_api): + """The trusted root owns cold native admission; every load is independent.""" + provider, validate, load, identity = _bootstrap_api(bootstrap_root, bootstrap_capability, bootstrap_api) + binding = load(bootstrap_capability, extension_path, expected_extension_sha256) + try: + _need(validate(bootstrap_capability, PROBE_PROVIDER_SHA256) is provider, + "Cache bootstrap provider changed during loading") + _need(_TYPE(binding) is provider.ProbeBinding, "Cache probe binding type differs") + provider.validate_binding(binding) + except _BASE_ERROR as primary_error: + try: + binding.close() + except _BASE_ERROR as close_error: + raise primary_error from close_error + raise + return provider, binding, validate, load, identity + + +def prepare_cache_contract(module, extension_path, expected_extension_sha256, + *, bootstrap_root, bootstrap_capability, bootstrap_api, factory_environment, + source_sha256=SOURCE_SHA256): + """Return methods/owner; parent installs only after original P1 admission.""" + _need(not V8_SOURCE_DRAFT, "V8 source draft is not executable") + # The early source-closed guard precedes every new helper. The parent-root + # identity still precedes all scientific-source reads and native operations. + _need(_TYPE(factory_environment) is _BackendFactoryEnvironment, + "Cache v7 requires the parent's early factory environment") + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:1 + _ca_desc = factory_environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if factory_environment.cold_authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:1 + _ca_dispatch(2, factory_environment.cache_handle) + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:2 + _ca_desc = factory_environment.collector_descriptor + _ca_runtime_operations = _ca_desc[1] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if _ca_type(_ca_runtime_operations) is not _ca_p[9] or _ca_p[3](_ca_runtime_operations) != 1 or _ca_runtime_operations[0] is not factory_environment.collector_guard: + raise _ca_error("Runtime drift: cache collector operation identity differs") + if _ca_runtime_operations is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Runtime drift: cache collector dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Runtime drift: cache collector dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Runtime drift: cache collector dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Runtime drift: cache collector dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Runtime drift: cache collector dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:2 + _ca_dispatch(0) + _bootstrap_api(bootstrap_root, bootstrap_capability, bootstrap_api) + _need(_TYPE(module) is ModuleType, "Cache contract requires an exact source module") + namespace = module.__dict__ + _need(_string_key_domain(namespace), "Unsupported cache contract source lookup key domain") + path = Path(namespace["__file__"]) + raw = path.read_bytes() + _need(source_sha256 == SOURCE_SHA256 and hashlib.sha256(raw).hexdigest() == SOURCE_SHA256, + "Cache contract scientific source differs") + _need(_GET(namespace, "__builtins__") is _BUILTINS and "any" not in namespace and + _GET(_BUILTINS, "any") is _ANY, "Cache contract odd calling environment differs") + compiled = _COMPILE(raw, str(path), "exec", dont_inherit=True, optimize=sys.flags.optimize) + records = [_authenticate(namespace["odd"], _code_named(compiled, "odd"), namespace)] + checks = namespace["Checks"] + _need(_ordinary(checks) and _ordinary(namespace["Label"]), "Cache contract original class dispatch differs") + members = _TYPEGET(checks, "__dict__") + expected_names = {"__module__", "__doc__", "__dict__", "__weakref__"} + for code in _code_named(compiled, "Checks").co_consts: + if _TYPE(code) is CodeType: + expected_names.add(code.co_name) + records.append(_authenticate(members.get(code.co_name), code, namespace)) + _need(set(members) == expected_names, "Cache contract original Checks members differ") + parsed = ast.parse(raw, filename=str(path)) + checks_ast = next(item for item in parsed.body if _TYPE(item) is ast.ClassDef and item.name == "Checks") + provider, probe_binding, bootstrap_validate, bootstrap_load, bootstrap_identity = _load_probe( + extension_path, expected_extension_sha256, bootstrap_root, bootstrap_capability, bootstrap_api) + try: + owner = _Owner(module, _TUPLE(records), frozenset(expected_names), provider, probe_binding, + bootstrap_root, bootstrap_capability, bootstrap_api, bootstrap_validate, bootstrap_load, + bootstrap_identity, factory_environment.collector_guard, + factory_environment.collector_descriptor) + owner.factory_environment = factory_environment + for name, kind in (("residual_ok", "residual"), ("label_ok", "label")): + method = next(item for item in checks_ast.body if _TYPE(item) is ast.FunctionDef and item.name == name) + owner.methods[name] = _generate(module, method, owner, kind) + owner.method_records = _TUPLE(_record(value) for value in owner.methods.values()) + except _BASE_ERROR as primary_error: + try: + probe_binding.close() + except _BASE_ERROR as close_error: + raise primary_error from close_error + raise + return {"residual_ok": owner.methods["residual_ok"], "label_ok": owner.methods["label_ok"], + "owner": owner, "receipt": owner.receipt} + + +def _constant_equal(actual, expected): + """No custom constant equality; clear actual roots on every error path.""" + try: + if _TYPE(actual) is not _TYPE(expected): + return False + kind = _TYPE(actual) + if actual is None or actual is Ellipsis: + return actual is expected + if kind is _INT or kind is _BOOL or kind is _STR or kind is bytes: + return actual == expected + if kind is _TUPLE: + if _LEN(actual) != _LEN(expected): + return False + for index in range(_LEN(actual)): + if not _constant_equal(actual[index], expected[index]): + return False + return True + if kind is CodeType: + return _code_equal(actual, expected) + return False + finally: + actual = expected = None + kind = None + + +def _code_equal(actual, expected): + """Compare every executable/code metadata field through exact primitives.""" + try: + if _TYPE(actual) is not CodeType or _TYPE(expected) is not CodeType: + return False + for field in ("co_argcount", "co_posonlyargcount", "co_kwonlyargcount", + "co_nlocals", "co_stacksize", "co_flags", "co_code", + "co_names", "co_varnames", "co_freevars", "co_cellvars", + "co_exceptiontable", "co_linetable", "co_firstlineno", + "co_filename", "co_name", "co_qualname", "co_consts"): + if not _constant_equal(_OBJGET(actual, field), _OBJGET(expected, field)): + return False + return True + finally: + actual = expected = None + + +class _BackendFactoryEnvironment: + """Private per-backend projection of the ONE initial authority token. + + Later source modules are authenticated by that token before this function + runs; this object never promotes late stdlib observations to initial trust. + Expected references remain until this private owner is released. Current + observations, scientific answers, native handles and validation PASS do not. + """ + __slots__ = ("backend", "namespace", "bind", "source_bytes", "bind_ast", "bind_record", + "cold_authority", "cold_caller_descriptor", "backend_handle", "cache_handle", + "collector_guard", "collector_descriptor", + "stdlib_method_owners", "receipt") + + def __setattr__(self, name, value): + raise _ERROR("Backend factory environment is immutable") + + +def capture_backend_factory_environment(backend, *, cold_authority, cold_caller_descriptor, backend_handle, cache_handle, + bootstrap_root, bootstrap_capability, bootstrap_api): + """Invoke through the source-closed authority before scientific exposure. + + The authority was captured before ANY candidate import. Its current check + proves continuity to that initial boundary before deriving this backend's + private expected projection. All mutable helpers here are authenticated by + the outer invoke entry before this function or its first _need is entered. + """ + _need(not V8_SOURCE_DRAFT, "V8 source draft is not executable") + _need(_TYPE(cold_authority) is _TUPLE and _LEN(cold_authority) == 7, + "Backend factory requires the initial seven-entry authority") + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:3 + _ca_desc = cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if cold_authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:3 + _ca_dispatch(2, cache_handle) + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:4 + _ca_desc = cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if cold_authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:4 + _ca_dispatch(2, backend_handle) + _bootstrap_api(bootstrap_root, bootstrap_capability, bootstrap_api) + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:5 + _ca_desc = cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if cold_authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:5 + source_module, filename, source_digest, raw = _ca_dispatch(6, backend_handle) + _need(source_module is backend and source_digest == BACKEND_SOURCE_SHA256 and + _TYPE(raw) is bytes and _TYPE(backend) is ModuleType and + _string_key_domain(backend.__dict__), "Backend factory original source differs") + namespace = backend.__dict__ + _need(_GET(namespace, "__builtins__") is _BUILTINS, + "Backend factory original builtin owner differs") + bind = _GET(namespace, "bind") + parsed = ast.parse(raw, filename=filename) + bind_ast = next(statement for statement in parsed.body + if _TYPE(statement) is ast.FunctionDef and statement.name == "bind") + compiled = _COMPILE(raw, filename, "exec", dont_inherit=True, optimize=sys.flags.optimize) + _need(_TYPE(bind) is FunctionType and bind.__globals__ is namespace and + bind.__builtins__ is _BUILTINS and bind.__closure__ is None and + bind.__kwdefaults__ is None and _TYPE(bind.__defaults__) is _TUPLE and + _LEN(bind.__defaults__) == 2 and bind.__defaults__[0] is None and + bind.__defaults__[1] is None and _code_equal(bind.__code__, _code_named(compiled, "bind")), + "Backend factory original bind calling code differs") + # These are references projected AFTER the early token checked its own + # initial records; they are only for the preserved descriptor control. + method_owners = [] + for name in ("read_bytes", "resolve", "open"): + for cls in _TYPEGET(Path, "__mro__"): + _need(_TYPE(cls) is _TYPE, "Backend factory pathlib metaclass differs") + members = _TYPEGET(cls, "__dict__") + if name in members: + function = members[name] + _need(_TYPE(function) is FunctionType, + "Backend factory pathlib method is not ordinary source") + method_owners.append((cls, _TYPEGET(cls, "__mro__"), name, function)) + break + else: + raise _ERROR("Backend factory pathlib method is absent") + environment = _OBJECT.__new__(_BackendFactoryEnvironment) + # V8 runtime operation has an explicit producer-owned pair result. + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:6 + _ca_desc = cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if cold_authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:6 + collector_guard, collector_descriptor = _ca_dispatch(3, cache_handle) + fields = { + "backend": backend, "namespace": namespace, "bind": bind, "source_bytes": raw, + "bind_ast": ast.dump(bind_ast, include_attributes=False), "bind_record": _record(bind), + "cold_authority": cold_authority, "cold_caller_descriptor": cold_caller_descriptor, + "backend_handle": backend_handle, "cache_handle": cache_handle, + "collector_guard": collector_guard, "collector_descriptor": collector_descriptor, + "stdlib_method_owners": _TUPLE(method_owners), + "receipt": ("same-initial-pre-candidate-authority-token", BACKEND_SOURCE_SHA256, + "initial-system-stdlib-provenance-is-parent-premise", + "each-complete-factory-bind-interval-no-mutation-or-untrusted-callbacks")} + for name, value in fields.items(): + _OBJECT.__setattr__(environment, name, value) + return environment + + +def _check_factory_environment(environment, backend, expected_guard): + """Outer authority.invoke authenticates this validator before entry.""" + _need(_TYPE(environment) is _BackendFactoryEnvironment, + "Backend factory requires the initial authority projection") + authority = environment.cold_authority + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:7 + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:7 + _ca_dispatch(2, environment.cache_handle) + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:8 + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:8 + _ca_dispatch(2, environment.backend_handle) + _need(environment.backend is backend and _TYPE(backend) is ModuleType and + backend.__dict__ is environment.namespace and + _string_key_domain(environment.namespace), + "Backend factory environment owner or lookup domain differs") + _need(_GET(environment.namespace, "RuntimeGuard") is expected_guard, + "Backend factory composed guard is not the intentionally installed guard") + _need(_GET(environment.namespace, "bind") is environment.bind and + _fresh(environment.bind_record), "Backend factory original public bind changed") + + +def bind_cache_backend(backend, module, native, prepared, environment, + *, row_producer_handle, row_handle, rank_row_intern, final_guard, + rank_calls=None, complement_trace=None): + """Keep the real row observer; derive exactly its two callback guard targets. + + The first producer reverses its row observer/parameter back to the original + backend. This second transform reverses its two check_backend attributes + back to THAT exact row-derived function. Public backend.bind stays original. + """ + _need(not V8_SOURCE_DRAFT, "V8 source draft is not executable") + owner = prepared["owner"] + _need(owner.factory_environment is environment and owner.composed_guard is not None and + owner.runtime is None, "Backend factory requires a fresh composed cache guard") + authority = environment.cold_authority + _check_factory_environment(environment, backend, final_guard) + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:9 + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:9 + _ca_dispatch(4, owner.composed_guard, environment.cache_handle, "compose_runtime_guard", + (owner.base_guard, prepared), {}) + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:10 + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:10 + _ca_dispatch(4, rank_row_intern, row_handle, "make_row_interner", (), {}) + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:11 + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:11 + _ca_dispatch(4, final_guard, row_handle, "make_cache_runtime_guard", + (owner.composed_guard, rank_row_intern), {}) + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:12 + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:12 + row_source = _ca_dispatch(6, row_handle) + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:13 + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:13 + producer_source = _ca_dispatch(6, row_producer_handle) + _need(row_source[2] == V8_ROW_SOURCE_SHA256 and + producer_source[2] == V8_ROW_PRODUCER_SHA256, + "Backend factory row source pin differs") + _need(_TYPE(final_guard) is _TYPE and _LEN(_TYPEGET(final_guard, "__mro__")) > 1 and + _TYPEGET(final_guard, "__mro__")[1] is owner.composed_guard, + "Backend factory requires the exact registered final row guard") + # Class constructors and both virtual methods were admitted by the product + # checker BEFORE original bind can enter the first self.check dispatch. + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:14 + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:14 + row_product = _ca_dispatch(1, row_producer_handle, "derive_row_bind", + environment.bind, environment.source_bytes) + row_reference = row_receipt = packet = original = future = parsed = None + derived = restored = restored_tree = tree = None + try: + _need(_TYPE(row_product) is _TUPLE and _LEN(row_product) == 3, + "Backend factory row producer transport differs") + row_reference, row_receipt, packet = row_product + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:17 + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:17 + _ca_dispatch(4, row_reference, row_producer_handle, "derive_row_bind", + (environment.bind, environment.source_bytes), {}) + _need(_TYPE(packet) is _TUPLE and _LEN(packet) == 2 and + _TYPE(packet[0]) is ast.FunctionDef and _TYPE(packet[1]) is list, + "Backend factory private row AST packet differs") + original, future = packet + # Check the producer's transported tree against its immediately sealed + # callable before modifying any AST. Only source-owned AST enters here. + original_tree = ast.Module(body=copy.deepcopy(future) + [copy.deepcopy(original)], type_ignores=[]) + ast.fix_missing_locations(original_tree) + original_code = _code_named(_COMPILE(original_tree, row_reference.__code__.co_filename, "exec", + dont_inherit=True, optimize=sys.flags.optimize), "bind") + _need(_code_equal(original_code, row_reference.__code__), + "Backend factory transported row AST differs from its registered callable") + derived = copy.deepcopy(original) + replacements = [] + for statement in derived.body: + if _TYPE(statement) is ast.FunctionDef and statement.name in ("complement_in", "nondegenerate"): + _need(_LEN(statement.body) > 0 and _TYPE(statement.body[0]) is ast.Expr, + "Backend factory expected callback guard expression is absent") + call = statement.body[0].value + _need(_TYPE(call) is ast.Call and not call.args and not call.keywords and + _TYPE(call.func) is ast.Attribute and call.func.attr == "check" and + _TYPE(call.func.value) is ast.Name and call.func.value.id == "runtime", + "Backend factory callback guard expression changed") + call.func.attr = "check_backend" + replacements.append(call.func) + _need(_LEN(replacements) == 2, + "Backend factory must replace exactly two row-reference callback guard calls") + restored = copy.deepcopy(derived) + restored_count = 0 + for statement in restored.body: + if _TYPE(statement) is ast.FunctionDef and statement.name in ("complement_in", "nondegenerate"): + statement.body[0].value.func.attr = "check" + restored_count += 1 + _need(restored_count == 2 and + ast.dump(restored, include_attributes=False) == ast.dump(original, include_attributes=False), + "Backend factory changed more than the two admitted row-reference guard calls") + restored_tree = ast.Module(body=copy.deepcopy(future) + [restored], type_ignores=[]) + ast.fix_missing_locations(restored_tree) + restored_code = _code_named(_COMPILE(restored_tree, row_reference.__code__.co_filename, "exec", + dont_inherit=True, optimize=sys.flags.optimize), "bind") + _need(_code_equal(restored_code, row_reference.__code__), + "Backend factory reversed calling code differs from the row reference") + tree = ast.Module(body=copy.deepcopy(future) + [derived], type_ignores=[]) + ast.fix_missing_locations(tree) + code = _code_named(_COMPILE(tree, row_reference.__code__.co_filename, "exec", + dont_inherit=True, optimize=sys.flags.optimize), "bind") + clone = FunctionType(code, row_reference.__globals__, row_reference.__name__, + row_reference.__defaults__, row_reference.__closure__) + clone.__kwdefaults__ = row_reference.__kwdefaults__ + _need(clone.__globals__ is row_reference.__globals__ and + clone.__builtins__ is row_reference.__builtins__ and + clone.__defaults__ is row_reference.__defaults__ and + clone.__kwdefaults__ is row_reference.__kwdefaults__ and + clone.__closure__ is row_reference.__closure__, + "Backend factory changed effective row-reference dispatch ownership") + # Pay fresh producer, row, cache and original backend checks again at + # the complete bind boundary. No earlier PASS is carried into this call. + _check_factory_environment(environment, backend, final_guard) + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:18 + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:18 + _ca_dispatch(4, row_reference, row_producer_handle, "derive_row_bind", + (environment.bind, environment.source_bytes), {}) + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:19 + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:19 + _ca_dispatch(4, final_guard, row_handle, "make_cache_runtime_guard", + (owner.composed_guard, rank_row_intern), {}) + _need(_TYPE(module) is ModuleType and _string_key_domain(module.__dict__), + "Backend factory scientific lookup domain changed") + result = clone(module, native, rank_calls, complement_trace, rank_row_intern) + _need(_GET(environment.namespace, "bind") is environment.bind, + "Backend factory replaced the original public bind") + owner.binding_derivation = { + "source_sha256": BACKEND_SOURCE_SHA256, + "row_source_sha256": V8_ROW_SOURCE_SHA256, + "row_producer_sha256": V8_ROW_PRODUCER_SHA256, + "row_derivation": _DICT(row_receipt), + "changed_callback_calls": 2, "restored_ast_identical": True, + "restored_code_identical": True, "transported_ast_matches_registered_row_callable": True, + "original_globals_builtins_defaults_closure": True, + "environment_reference": "exact private row-derived callable", + "exact_final_row_class_product_checked_before_bind": True, + "early_environment": environment.receipt} + return result + finally: + # Producer-owned expected callable records remain paid in the authority. + # The mutable AST transport is private temporary work, never retained. + row_product = row_reference = row_receipt = packet = original = future = parsed = None + original_tree = original_code = derived = restored = restored_tree = tree = None + replacements = statement = call = restored_code = code = clone = None + + +def compose_runtime_guard(base, prepared): + """Initialize cache owner before final native/Label guard capture. + + Install all Checks phase wrappers before backend.bind. Seal P1 afterward. + This is a factory for one isolated candidate module, not a global registry. + """ + _need(not V8_SOURCE_DRAFT, "V8 source draft is not executable") + owner = prepared["owner"] + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:15 + _ca_desc = owner.factory_environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if owner.factory_environment.cold_authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:15 + _ca_dispatch(2, owner.factory_environment.cache_handle) + _need(_TYPE(base) is _TYPE, "Cache composition requires an exact guard class") + base_records, base_classes = [], [] + for cls in _TYPEGET(base, "__mro__"): + if cls is _OBJECT: + continue + _need(_TYPE(cls) is _TYPE, "Cache base guard has custom metaclass dispatch") + entries = _TUPLE(_TYPEGET(cls, "__dict__").items()) + base_classes.append((cls, _TYPEGET(cls, "__mro__"), entries)) + base_records.extend(_record(value) for _, value in entries if _TYPE(value) is FunctionType) + owner.base_guard = base + owner.base_guard_records = _TUPLE(base_records) + owner.base_guard_classes = _TUPLE(base_classes) + + collector_guard = owner.collector_guard + collector_descriptor = owner.collector_descriptor + primitive_clear = _CLEAR + canonical_builtins = owner.factory_environment.backend._CANONICAL_BUILTINS + + class CacheRuntimeGuard(base): + def __init__(self, module, label, native, original_functions): + _need(module is owner.module and label is owner.label and owner.runtime is None, + "Cache guard owner differs or was already attached") + _need(_ordinary(owner.checks_class), "Cache guard Checks class dispatch differs") + members = _TYPEGET(owner.checks_class, "__dict__") + _need(frozenset(members) == owner.class_names, + "Cache guard Checks member names differ") + for name, method in owner.methods.items(): + _need(members.get(name) is method, "Cache guard prepared method was not installed") + for record in owner.source_records + owner.method_records + owner.probe_records + owner.bootstrap_records: + _need(_fresh(record), "Cache guard source changed before capture") + _need(_GET(owner.namespace, "odd") is owner.odd and "any" not in owner.namespace and + _GET(_BUILTINS, "any") is _ANY, "Cache guard odd environment changed before capture") + owner.check_bootstrap() + owner.probe_validate(owner.probe_binding) + self._cache_class_mro = _TYPEGET(owner.checks_class, "__mro__") + self._cache_class_items = _TUPLE(members.items()) + functions = [value for _, value in self._cache_class_items if _TYPE(value) is FunctionType] + self._cache_functions = owner.source_records + owner.method_records + _TUPLE(_record(f) for f in functions) + owner.runtime = self + # owner state and every wrapper closure now have final identities. + base.__init__(self, module, label, native, original_functions) + + def _ordered_base_preflight(self): + """Original raw/P2 then trace order, with key gates at first lookup. + + Every predicate is repeated by unchanged base.check afterwards and + is fully charged. The new scans add admission only immediately + before the relevant dictionary's first named lookup. Private guard + instance state remains excluded; there is no instance-key promise. + """ + if not (_TYPE(self.module) is ModuleType and self.module.__dict__ is self.namespace): + raise _ERROR("Runtime drift: source module dispatch") + if not (_TYPE(self.label) is _TYPE and self.label.__mro__ is self.mro): + raise _ERROR("Runtime drift: Label class dispatch") + if not _string_key_domain(self.namespace): + raise _ERROR("Unsupported cache guard scientific lookup key domain") + for name, value in self.global_items: + if not (_GET(self.namespace, name) is value): + raise _ERROR("Runtime drift: source helper " + name) + builtins_admitted = False + for name, expected in _ITEMS(canonical_builtins): + # Preserve the original 'name not in namespace and ...' + # short-circuit. A shadow error wins before builtin admission. + if name in self.namespace: + raise _ERROR("Runtime drift: builtin lookup " + name) + if not builtins_admitted: + if not _string_key_domain(_BUILTINS): + raise _ERROR("Unsupported cache guard builtin lookup key domain") + builtins_admitted = True + if not (_GET(_BUILTINS, name) is expected): + raise _ERROR("Runtime drift: builtin lookup " + name) + attributes = self.label.__dict__ + if not (_LEN(attributes) == _LEN(self.class_items)): + raise _ERROR("Runtime drift: Label descriptors") + for name, value in self.class_items: + if not (attributes.get(name) is value): + raise _ERROR("Runtime drift: Label member " + name) + for function, code, namespace, effective_builtins, defaults, kwdefaults, closure, cells in self.functions: + if not (function.__code__ is code and function.__globals__ is namespace and + function.__builtins__ is effective_builtins and function.__defaults__ is defaults and + function.__kwdefaults__ is kwdefaults and function.__closure__ is closure): + raise _ERROR("Runtime drift: function code or calling environment") + for cell, value in cells: + # Original empty-cell ValueError propagates at this point. + if not (cell.cell_contents is value): + raise _ERROR("Runtime drift: wrapper closure") + if not (_TYPE(self.native) is ModuleType): + raise _ERROR("Runtime drift: native module dispatch") + if not _string_key_domain(self.native.__dict__): + raise _ERROR("Unsupported cache guard native lookup key domain") + for name, function in self.native_items: + if not (_GET(self.native.__dict__, name) is function): + raise _ERROR("Runtime drift: native entry point " + name) + # Read only inherited private state, after the whole original base. + # Its arbitrary corruption is excluded by the pre-existing contract. + for trace_owner, name, function in _GET(_OBJGET(self, "__dict__"), "_h25_entries", ()): + if not (_TYPE(trace_owner) is ModuleType): + raise _ERROR("Runtime drift: trace encoder entry point " + name) + if not _string_key_domain(trace_owner.__dict__): + raise _ERROR("Unsupported cache guard trace lookup key domain") + if not (_GET(trace_owner.__dict__, name) is function): + raise _ERROR("Runtime drift: trace encoder entry point " + name) + + def _check_scientific(self, observations): + if not (_TYPE(owner.module) is ModuleType and owner.module.__dict__ is owner.namespace and + _GET(owner.namespace, "Checks") is owner.checks_class and + _GET(owner.namespace, "odd") is owner.odd and "any" not in owner.namespace and + _GET(_BUILTINS, "any") is _ANY): + raise _ERROR("Runtime drift: cache source or odd lookup") + if not (_TYPE(owner.checks_class) is _TYPE and + _TYPEGET(owner.checks_class, "__mro__") is self._cache_class_mro): + raise _ERROR("Runtime drift: cache Checks dispatch") + members = _TYPEGET(owner.checks_class, "__dict__") + if _LEN(members) != _LEN(self._cache_class_items): + raise _ERROR("Runtime drift: cache Checks members") + for name, value in self._cache_class_items: + if members.get(name) is not value: + raise _ERROR("Runtime drift: cache Checks member " + name) + for record in self._cache_functions: + if not _observed_fresh(record, observations): + raise _ERROR("Runtime drift: cache function calling environment") + + def _check_provider(self, observations): + if not (_TYPE(owner.probe_provider) is ModuleType and + _string_key_domain(owner.probe_provider.__dict__)): + raise _ERROR("Unsupported cache provider lookup key domain") + if not (_TYPE(owner.probe_provider) is ModuleType and + owner.probe_provider.__dict__ is owner.probe_namespace and + _LEN(owner.probe_namespace) == _LEN(owner.probe_namespace_items)): + raise _ERROR("Runtime drift: cache probe provider namespace") + for name, value in owner.probe_namespace_items: + if _GET(owner.probe_namespace, name, _MISSING) is not value: + raise _ERROR("Runtime drift: cache probe provider binding " + name) + if not (_TYPE(owner.probe_binding) is owner.probe_class and + _TYPEGET(owner.probe_class, "__mro__") is owner.probe_class_mro): + raise _ERROR("Runtime drift: cache probe binding class") + probe_members = _TYPEGET(owner.probe_class, "__dict__") + if _LEN(probe_members) != _LEN(owner.probe_class_items): + raise _ERROR("Runtime drift: cache probe class members") + for name, value in owner.probe_class_items: + if probe_members.get(name) is not value: + raise _ERROR("Runtime drift: cache probe class member " + name) + for record in owner.probe_records: + if not _observed_fresh(record, observations): + raise _ERROR("Runtime drift: cache probe function calling environment") + # The next public provider call owns a separate fresh context. No + # current scalar observation or PASS crosses that boundary. + primitive_clear(observations) + owner.probe_validate(owner.probe_binding) + + def check(self): + """Full direct/cache-boundary semantics; never the light shortcut.""" + observations = {} + try: + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:20 + _ca_desc = collector_descriptor + _ca_runtime_operations = _ca_desc[1] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if _ca_type(_ca_runtime_operations) is not _ca_p[9] or _ca_p[3](_ca_runtime_operations) != 1 or _ca_runtime_operations[0] is not collector_guard: + raise _ca_error("Runtime drift: cache collector operation identity differs") + if _ca_runtime_operations is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Runtime drift: cache collector dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Runtime drift: cache collector dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Runtime drift: cache collector dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Runtime drift: cache collector dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Runtime drift: cache collector dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:20 + _ca_dispatch(0) + self._ordered_base_preflight() + base.check(self) + owner.check_bootstrap() + self._check_scientific(observations) + self._check_provider(observations) + finally: + primitive_clear(observations) + observations = None + + def check_backend(self): + """Actual backend callbacks retain all base and scientific checks.""" + observations = {} + try: + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:21 + _ca_desc = collector_descriptor + _ca_runtime_operations = _ca_desc[1] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if _ca_type(_ca_runtime_operations) is not _ca_p[9] or _ca_p[3](_ca_runtime_operations) != 1 or _ca_runtime_operations[0] is not collector_guard: + raise _ca_error("Runtime drift: cache collector operation identity differs") + if _ca_runtime_operations is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Runtime drift: cache collector dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Runtime drift: cache collector dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Runtime drift: cache collector dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Runtime drift: cache collector dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Runtime drift: cache collector dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:21 + _ca_dispatch(0) + self._ordered_base_preflight() + base.check(self) + self._check_scientific(observations) + _need(not owner.probe_closed, "Cache probe owner is closed") + finally: + primitive_clear(observations) + observations = None + + _need(owner.composed_guard is None, "Cache owner guard was already composed") + owner.composed_guard = CacheRuntimeGuard + owner.composed_guard_records = _TUPLE(_record(value) for value in + _TYPEGET(CacheRuntimeGuard, "__dict__").values() if _TYPE(value) is FunctionType) + return CacheRuntimeGuard + + +# Appended, verbatim, to the independently pinned V8 cache source by the packet. +# This extension is not a standalone import target. +import ast as _epoch_ast +import copy as _epoch_copy +import types as _epoch_types +import sys as _epoch_sys + +EPOCH_FULL_EXECUTION_CONTRACT = None +_EPOCH_SUITES = {} +_EPOCH_BINDERS = {} +_EPOCH_ROLES = ('C1','C2','C3','labels','roles','canonical','public_label', + 'public_residual','private_label','private_residual','prepare','finish') + + +def _epoch_need(ok, message): + if not ok: + raise RuntimeError(message) + + +def _epoch_fn_record(fn): + _epoch_need(type(fn) is _epoch_types.FunctionType, 'Epoch exact callable') + attrs=fn.__dict__;keywords=fn.__kwdefaults__ + _epoch_need(type(attrs) is dict and all(type(k) is str for k in attrs),'Epoch callable attribute key domain') + _epoch_need(keywords is None or type(keywords) is dict and all(type(k) is str for k in keywords),'Epoch callable keyword key domain') + return (fn, fn.__code__, fn.__globals__, fn.__builtins__, fn.__defaults__, + keywords, fn.__closure__, + () if fn.__closure__ is None else tuple((c,c.cell_contents) for c in fn.__closure__), + attrs,tuple(attrs.items()),() if keywords is None else tuple(keywords.items())) + + +def _epoch_fn_fresh(rec): + fn,code,ns,bi,defaults,keywords,closure,cells,attrs,attribute_items,keyword_items=rec + _epoch_need(type(fn) is _epoch_types.FunctionType and fn.__code__ is code and + fn.__globals__ is ns and fn.__builtins__ is bi and fn.__defaults__ is defaults and + fn.__kwdefaults__ is keywords and fn.__closure__ is closure and fn.__dict__ is attrs,'Epoch callable fields drift') + _epoch_need(type(attrs) is dict and all(type(k) is str for k in attrs) and len(attrs)==len(attribute_items),'Epoch callable attribute census/domain') + for name,value in attribute_items:_epoch_need(attrs.get(name) is value,'Epoch callable attribute drift') + if keywords is not None: + _epoch_need(type(keywords) is dict and all(type(k) is str for k in keywords) and len(keywords)==len(keyword_items),'Epoch callable keyword census/domain') + for name,value in keyword_items:_epoch_need(keywords.get(name) is value,'Epoch callable keyword drift') + for cell,value in cells: + _epoch_need(cell.cell_contents is value,'Epoch callable cell drift') + + +def _epoch_checked(owner, assembler, index, *args): + record=_EPOCH_BINDERS.get(id(owner)) + _epoch_need(record is not None and record[0] is owner and record[1] is assembler, + 'Epoch assembler is not the genuine owned export argument') + _epoch_fn_fresh(record[2]) + _epoch_need(type(index) is int and 0<=index<4,'Epoch assembler operation') + return assembler(index,*args) + + +def _epoch_call(descriptor, index, *args, **kwargs): + """Actual caller-side primitive gate, before calling the epoch dispatcher.""" + _epoch_need(type(descriptor) is tuple and len(descriptor)==6,'Epoch caller descriptor shape') + p=descriptor[5]; dispatch=descriptor[2]; rec=descriptor[3] + _epoch_need(type(p) is tuple and len(p)==19 and p[0] is type and p[1] is _epoch_types.FunctionType and p[2] is id and p[18] is zip and type(rec) is tuple and len(rec)==9,'Epoch native caller primitives') + typ,ft,identity=p[0],p[1],p[2] + if dispatch is not rec[0] or typ(dispatch) is not ft: + raise RuntimeError('Epoch caller dispatcher identity') + for (name,getter),expected in p[18](p[4],rec[1:7]): + if identity(getter(dispatch,ft)) != identity(expected): + raise RuntimeError('Epoch caller dispatcher fields') + if rec[4] is not None or rec[5] is not None or rec[7]: + raise RuntimeError('Epoch dispatcher defaults') + for cell,expected in rec[8]: + if p[6](cell,p[5]) is not expected: + raise RuntimeError('Epoch dispatcher cell') + return dispatch(index,*args,**kwargs) + + +def _epoch_named(code,name): + _epoch_need(type(code) is _epoch_types.CodeType,'Epoch code object') + matches=[x for x in code.co_consts if type(x) is _epoch_types.CodeType and x.co_name==name] + _epoch_need(len(matches)==1,'Epoch unique code constant '+name) + return matches[0] + + +def _epoch_ast_function(source, path): + node=_epoch_ast.parse(source) + for name in path: + values=[x for x in node.body if isinstance(x,(_epoch_ast.ClassDef,_epoch_ast.FunctionDef)) and x.name==name] + _epoch_need(len(values)==1,'Epoch unique source function '+name) + node=values[0] + _epoch_need(type(node) is _epoch_ast.FunctionDef,'Epoch function source') + return _epoch_copy.deepcopy(node) + + +def _epoch_locations(actual, original): + _epoch_need(_epoch_ast.dump(actual,include_attributes=False)== + _epoch_ast.dump(original,include_attributes=False),'Epoch inverse unlisted AST change') + for left,right in zip(_epoch_ast.walk(actual),_epoch_ast.walk(original)): + for key in ('lineno','col_offset','end_lineno','end_col_offset'): + if hasattr(right,key):setattr(left,key,getattr(right,key)) + return actual + + +def _epoch_factory(node, namespace, captures, filename): + """Generate actual callable; explicit captures never become module globals.""" + params=list(captures) + factory=_epoch_ast.FunctionDef(name='_epoch_factory',args=_epoch_ast.arguments( + posonlyargs=[],args=[_epoch_ast.arg(arg=x) for x in params],vararg=None, + kwonlyargs=[],kw_defaults=[],kwarg=None,defaults=[]), + body=[node,_epoch_ast.Return(value=_epoch_ast.Name(id=node.name,ctx=_epoch_ast.Load()))], + decorator_list=[]) + tree=_epoch_ast.Module(body=[factory],type_ignores=[]);_epoch_ast.fix_missing_locations(tree) + code=compile(tree,filename,'exec',dont_inherit=True,optimize=_epoch_sys.flags.optimize) + make=_epoch_types.FunctionType(_epoch_named(code,'_epoch_factory'),namespace) + result=make(*(captures[x] for x in params)) + _epoch_need(result.__globals__ is namespace and result.__builtins__ is namespace['__builtins__'], + 'Epoch generated function owners') + return result,tree + + +def _epoch_inverse_ctor(actual,original,site): + node=_epoch_copy.deepcopy(actual) + doc=[] + if node.body and isinstance(node.body[0],_epoch_ast.Expr) and isinstance(node.body[0].value,_epoch_ast.Constant): + doc=[node.body.pop(0)] + _epoch_need(len(node.body)==1 and type(node.body[0]) is _epoch_ast.Try,'Epoch constructor inverse try') + trial=node.body[0] + _epoch_need(len(trial.handlers)==1 and not trial.orelse and not trial.finalbody,'Epoch constructor inverse handler') + expected_handler=_epoch_ast.parse('try:\n pass\nexcept _ep_error as _ep_primary:\n _ep_cancel(_ep_primary)\n raise').body[0].handlers[0] + _epoch_need(_epoch_ast.dump(trial.handlers[0],include_attributes=False)==_epoch_ast.dump(expected_handler,include_attributes=False),'Epoch constructor inverse error cleanup') + class Undo(_epoch_ast.NodeTransformer): + calls=0;commits=0 + def visit_Call(self,value): + if type(value.func) is _epoch_ast.Name and value.func.id=='_ep_ctor': + _epoch_need(len(value.args)==4 and type(value.args[0]) is _epoch_ast.Constant and value.args[0].value==site and not value.keywords and type(value.args[1]) is _epoch_ast.Name and value.args[1].id=='self' and _epoch_ast.dump(value.args[2],include_attributes=False)==_epoch_ast.dump(_epoch_ast.parse('None' if site=='C1' else 'node' if site=='C2' else 'key',mode='eval').body,include_attributes=False),'Epoch constructor inverse call') + self.calls+=1 + return _epoch_ast.copy_location(_epoch_ast.Call(func=_epoch_ast.Name(id='Label',ctx=_epoch_ast.Load()),args=[value.args[3]],keywords=[]),value) + return self.generic_visit(value) + def visit_Expr(self,value): + if type(value.value) is _epoch_ast.Call and type(value.value.func) is _epoch_ast.Name and value.value.func.id=='_ep_commit': + _epoch_need(len(value.value.args)==2 and not value.value.keywords and type(value.value.args[0]) is _epoch_ast.Constant and value.value.args[0].value==site and type(value.value.args[1]) is _epoch_ast.Name and value.value.args[1].id=='self','Epoch inverse store commit') + self.commits+=1;return None + return self.generic_visit(value) + undo=Undo();node.body=doc+trial.body;node=undo.visit(node) + _epoch_need(undo.calls==undo.commits==1,'Epoch exact one constructor/store') + return _epoch_locations(node,original) + + +def _epoch_verify_source_inverse(source,path,restored,function,filename): + tree=_epoch_ast.parse(source);owner=tree + for name in path[:-1]: + found=[x for x in owner.body if isinstance(x,(_epoch_ast.ClassDef,_epoch_ast.FunctionDef)) and x.name==name] + _epoch_need(len(found)==1,'Epoch inverse enclosing source');owner=found[0] + positions=[i for i,x in enumerate(owner.body) if type(x) is _epoch_ast.FunctionDef and x.name==path[-1]] + _epoch_need(len(positions)==1,'Epoch inverse target function') + owner.body[positions[0]]=_epoch_copy.deepcopy(restored) + _epoch_ast.fix_missing_locations(tree) + code=compile(tree,filename,'exec',dont_inherit=True,optimize=_epoch_sys.flags.optimize) + for name in path:code=_epoch_named(code,name) + _epoch_need(_code_equal(code,function.__code__),'Epoch complete source/code inverse') + return None + + +def _epoch_constructor_product(original,site,suite): + node=_epoch_copy.deepcopy(original) + class Edit(_epoch_ast.NodeTransformer): + count=0 + def visit_Assign(self,value): + call=value.value + if type(call) is _epoch_ast.Call and type(call.func) is _epoch_ast.Name and call.func.id=='Label': + _epoch_need(len(call.args)==1 and not call.keywords,'Epoch constructor old call shape') + key=_epoch_ast.Constant(value=None) if site=='C1' else _epoch_ast.Name(id='node' if site=='C2' else 'key',ctx=_epoch_ast.Load()) + value.value=_epoch_ast.copy_location(_epoch_ast.Call(func=_epoch_ast.Name(id='_ep_ctor',ctx=_epoch_ast.Load()),args=[_epoch_ast.Constant(value=site),_epoch_ast.Name(id='self',ctx=_epoch_ast.Load()),key,call.args[0]],keywords=[]),call) + self.count+=1 + # Store continuation is AFTER the exact original original assignment. + store=any(type(x) is _epoch_ast.Attribute and x.attr=='everything' or + type(x) is _epoch_ast.Subscript and type(x.value) is _epoch_ast.Attribute and x.value.attr=='cache' for x in value.targets) + if store: + commit=_epoch_ast.Expr(value=_epoch_ast.Call(func=_epoch_ast.Name(id='_ep_commit',ctx=_epoch_ast.Load()),args=[_epoch_ast.Constant(value=site),_epoch_ast.Name(id='self',ctx=_epoch_ast.Load())],keywords=[])) + return [value,_epoch_ast.copy_location(commit,value)] + return value + edit=Edit();node=edit.visit(node);_epoch_need(edit.count==1,'Epoch source exactly one Label call') + doc=[] + if node.body and isinstance(node.body[0],_epoch_ast.Expr) and isinstance(node.body[0].value,_epoch_ast.Constant):doc=[node.body.pop(0)] + handler=_epoch_ast.parse('try:\n pass\nexcept _ep_error as _ep_primary:\n _ep_cancel(_ep_primary)\n raise').body[0].handlers + node.body=doc+[_epoch_ast.Try(body=node.body,handlers=handler,orelse=[],finalbody=[])] + _epoch_ast.fix_missing_locations(node);restored=_epoch_inverse_ctor(node,original,site) + _epoch_verify_source_inverse(suite.source,('Checks',original.name),restored,getattr(suite.checks_class,original.name),suite.filename) + return _epoch_factory(node,suite.namespace,{'_ep_ctor':suite.construct,'_ep_commit':suite.commit,'_ep_cancel':suite.cancel,'_ep_error':BaseException},suite.filename),node,restored + + +def _epoch_inverse_caller(actual,original,roles): + node=_epoch_copy.deepcopy(actual) + if roles: + doc=[] + if node.body and isinstance(node.body[0],_epoch_ast.Expr) and isinstance(node.body[0].value,_epoch_ast.Constant):doc=[node.body.pop(0)] + _epoch_need(len(node.body)==2 and type(node.body[1]) is _epoch_ast.Try,'Epoch role retirement inverse') + initial=_epoch_ast.parse('_ep_role_primary = None').body[0] + _epoch_need(_epoch_ast.dump(node.body[0],include_attributes=False)==_epoch_ast.dump(initial,include_attributes=False),'Epoch explicit role primary local') + trial=node.body[1] + expected=_epoch_ast.parse('_ep_retire(_ep_role_primary)').body[0] + handler=_epoch_ast.parse('try:\n pass\nexcept _ep_error as _ep_role_error:\n _ep_role_primary = _ep_role_error\n raise').body[0].handlers[0] + _epoch_need(len(trial.handlers)==1 and _epoch_ast.dump(trial.handlers[0],include_attributes=False)==_epoch_ast.dump(handler,include_attributes=False) and not trial.orelse and len(trial.finalbody)==1 and _epoch_ast.dump(trial.finalbody[0],include_attributes=False)==_epoch_ast.dump(expected,include_attributes=False),'Epoch exact preserving role finalizer') + node.body=doc+trial.body + class Undo(_epoch_ast.NodeTransformer): + count=0 + def visit_Call(self,value): + if type(value.func) is _epoch_ast.Name and value.func.id=='_ep_request': + _epoch_need(len(value.args)>=3 and not value.keywords and type(value.args[0]) is _epoch_ast.Name and value.args[0].id=='_ep_cap' and type(value.args[2]) is _epoch_ast.Attribute and value.args[2].attr in ('label_ok','residual_ok') and type(value.args[1]) is _epoch_ast.Constant and value.args[1].value==('label' if value.args[2].attr=='label_ok' else 'residual'),'Epoch caller inverse grammar') + self.count+=1 + return _epoch_ast.copy_location(_epoch_ast.Call(func=value.args[2],args=value.args[3:],keywords=[]),value) + return self.generic_visit(value) + undo=Undo();node=undo.visit(node);_epoch_need(undo.count==(4 if roles else 3),'Epoch all caller sites') + return _epoch_locations(node,original) + + +def _epoch_caller_product(original,suite,roles): + node=_epoch_copy.deepcopy(original);cap=object();suite.caller_caps[id(cap)]=(cap,'roles' if roles else 'labels') + class Edit(_epoch_ast.NodeTransformer): + count=0 + def visit_Call(self,value): + value=self.generic_visit(value) + if type(value.func) is _epoch_ast.Attribute and value.func.attr in ('label_ok','residual_ok'): + _epoch_need(not value.keywords,'Epoch caller keyword change') + kind='label' if value.func.attr=='label_ok' else 'residual' + self.count+=1 + return _epoch_ast.copy_location(_epoch_ast.Call(func=_epoch_ast.Name(id='_ep_request',ctx=_epoch_ast.Load()),args=[_epoch_ast.Name(id='_ep_cap',ctx=_epoch_ast.Load()),_epoch_ast.Constant(value=kind),value.func]+value.args,keywords=[]),value) + return value + edit=Edit();node=edit.visit(node);_epoch_need(edit.count==(4 if roles else 3),'Epoch exact caller count') + if roles: + doc=[] + if node.body and isinstance(node.body[0],_epoch_ast.Expr) and isinstance(node.body[0].value,_epoch_ast.Constant):doc=[node.body.pop(0)] + handler=_epoch_ast.parse('try:\n pass\nexcept _ep_error as _ep_role_error:\n _ep_role_primary = _ep_role_error\n raise').body[0].handlers + node.body=doc+_epoch_ast.parse('_ep_role_primary = None').body+[_epoch_ast.Try(body=node.body,handlers=handler,orelse=[],finalbody=_epoch_ast.parse('_ep_retire(_ep_role_primary)').body)] + _epoch_ast.fix_missing_locations(node);restored=_epoch_inverse_caller(node,original,roles) + _epoch_verify_source_inverse(suite.source,(original.name,) if roles else ('Checks',original.name),restored,suite.namespace[original.name] if roles else getattr(suite.checks_class,original.name),suite.filename) + return _epoch_factory(node,suite.namespace,{'_ep_request':suite.request,'_ep_cap':cap,'_ep_retire':suite.role_retire,'_ep_error':BaseException},suite.filename),node,restored + + +def _epoch_template(original,kind): + values=[x for x in _generate.__code__.co_consts if type(x) is str and 'def _factory(' in x and '_H25_KEY' in x] + _epoch_need(len(values)==1,'Epoch exact V8 template source') + template=_epoch_ast.parse(values[0]);factory=template.body[0];method=factory.body[0] + body=_epoch_copy.deepcopy(original.body);method.name=original.name;method.args=_epoch_copy.deepcopy(original.args) + method.body.insert(0,body[0]);factory.body[1].value.id=original.name + guarded=method.body[2];guarded.body[0]=body[1] + conditional=body[2];conditional.test=_epoch_ast.BoolOp(op=_epoch_ast.Or(),values=[conditional.test,_epoch_ast.UnaryOp(op=_epoch_ast.Not(),operand=_epoch_ast.parse('_h25_cache_owner.reuse(_h25_cache_ticket, key)',mode='eval').body)]) + guarded.body[2]=conditional;guarded.body[3].value=body[3].value + operands='(lab,)' if kind=='label' else '(small, big)' + class Replace(_epoch_ast.NodeTransformer): + def visit_Name(self,value): + if value.id=='OPERANDS':return _epoch_ast.copy_location(_epoch_ast.parse(operands,mode='eval').body,value) + if value.id=='KIND':return _epoch_ast.copy_location(_epoch_ast.Constant(value=kind),value) + return value + template=Replace().visit(template);_epoch_ast.fix_missing_locations(template) + return template + + +def _epoch_v8_product(original,kind,suite,private): + baseline=_epoch_template(original,kind) + base_code=_epoch_named(_epoch_named(compile(baseline,'','exec',dont_inherit=True,optimize=_epoch_sys.flags.optimize),'_factory'),original.name) + _epoch_need(_code_equal(base_code,suite.original_public[kind].__code__),'Epoch reconstruction differs from actual V8 method') + tree=_epoch_copy.deepcopy(baseline);factory=tree.body[0];method=factory.body[0] + if private: + method.args.kwonlyargs.append(_epoch_ast.arg(arg='_ep_request')) + method.args.kw_defaults.append(None) + factory.args.args.extend([_epoch_ast.arg(arg='_ep_prepare'),_epoch_ast.arg(arg='_ep_finish')]) + class Replace(_epoch_ast.NodeTransformer): + count=0 + def visit_Call(self,value): + value=self.generic_visit(value) + if type(value.func) is _epoch_ast.Attribute and type(value.func.value) is _epoch_ast.Name and value.func.value.id=='_h25_cache_owner' and value.func.attr in ('prepare','finish'): + name=value.func.attr;value.func=_epoch_ast.Name(id='_ep_'+name,ctx=_epoch_ast.Load()) + value.args.insert(0,_epoch_ast.Name(id='_h25_cache_owner',ctx=_epoch_ast.Load())) + value.keywords.append(_epoch_ast.keyword(arg='_ep_request',value=_epoch_ast.Name(id='_ep_request',ctx=_epoch_ast.Load()))) + self.count+=1 + return value + edit=Replace();tree=edit.visit(tree);_epoch_need(edit.count==2,'Epoch private method exact two targets') + captures=(suite.owner,BaseException,suite.prepare,suite.finish) + else: + factory.args.args.append(_epoch_ast.arg(arg='_ep_public')) + method.body.insert(2,_epoch_ast.Expr(value=_epoch_ast.Call(func=_epoch_ast.Name(id='_ep_public',ctx=_epoch_ast.Load()),args=[_epoch_ast.Name(id='self',ctx=_epoch_ast.Load())],keywords=[]))) + captures=(suite.owner,BaseException,suite.public_entry) + _epoch_ast.fix_missing_locations(tree) + restored=_epoch_copy.deepcopy(tree);rf=restored.body[0];rm=rf.body[0] + if private: + _epoch_need(rm.args.kwonlyargs[-1].arg=='_ep_request' and rm.args.kw_defaults[-1] is None,'Epoch request required keyword') + rm.args.kwonlyargs.pop();rm.args.kw_defaults.pop();_epoch_need([x.arg for x in rf.args.args[-2:]]==['_ep_prepare','_ep_finish'],'Epoch private capture grammar');rf.args.args=rf.args.args[:-2] + class Undo(_epoch_ast.NodeTransformer): + count=0 + def visit_Call(self,value): + if type(value.func) is _epoch_ast.Name and value.func.id in ('_ep_prepare','_ep_finish'): + _epoch_need(type(value.args[0]) is _epoch_ast.Name and value.args[0].id=='_h25_cache_owner' and len(value.keywords)==1 and value.keywords[0].arg=='_ep_request' and type(value.keywords[0].value) is _epoch_ast.Name and value.keywords[0].value.id=='_ep_request','Epoch private inverse call') + value.func=_epoch_ast.Attribute(value=value.args.pop(0),attr=value.func.id[4:],ctx=_epoch_ast.Load());value.keywords=[];self.count+=1 + return self.generic_visit(value) + undo=Undo();restored=undo.visit(restored);_epoch_need(undo.count==2,'Epoch private inverse count') + else: + expected=_epoch_ast.parse('_ep_public(self)').body[0] + _epoch_need(_epoch_ast.dump(rm.body[2],include_attributes=False)==_epoch_ast.dump(expected,include_attributes=False),'Epoch public observer inverse') + _epoch_need(rf.args.args[-1].arg=='_ep_public','Epoch public capture grammar');rm.body.pop(2);rf.args.args.pop() + _epoch_locations(restored,baseline) + restored_code=_epoch_named(_epoch_named(compile(restored,'','exec',dont_inherit=True,optimize=_epoch_sys.flags.optimize),'_factory'),original.name) + _epoch_need(_code_equal(restored_code,suite.original_public[kind].__code__),'Epoch whole V8 code inverse') + code=compile(tree,'','exec',dont_inherit=True,optimize=_epoch_sys.flags.optimize) + make=_epoch_types.FunctionType(_epoch_named(code,'_factory'),suite.namespace) + result=make(*captures) + return result,tree,restored + + +def _epoch_data_product(name,suite): + original=_epoch_ast_function(suite.cache_source,('_Owner',name));node=_epoch_copy.deepcopy(original) + node.args.kwonlyargs.append(_epoch_ast.arg(arg='_ep_request'));node.args.kw_defaults.append(None) + class Edit(_epoch_ast.NodeTransformer): + count=0 + def visit_Call(self,value): + value=self.generic_visit(value) + if type(value.func) is _epoch_ast.Attribute and type(value.func.value) is _epoch_ast.Name and value.func.value.id=='self' and value.func.attr=='_data': + value.func=_epoch_ast.Name(id='_ep_data',ctx=_epoch_ast.Load());value.args=[_epoch_ast.Name(id='_ep_request',ctx=_epoch_ast.Load()),_epoch_ast.Constant(value='entry' if name=='prepare' else 'finish')]+value.args;self.count+=1 + return value + edit=Edit();node=edit.visit(node);_epoch_need(edit.count==1,'Epoch exact private _data substitution') + restored=_epoch_copy.deepcopy(node);restored.args.kwonlyargs.pop();restored.args.kw_defaults.pop() + class Undo(_epoch_ast.NodeTransformer): + count=0 + def visit_Call(self,value): + if type(value.func) is _epoch_ast.Name and value.func.id=='_ep_data': + _epoch_need(len(value.args)==6 and not value.keywords and type(value.args[0]) is _epoch_ast.Name and value.args[0].id=='_ep_request' and type(value.args[1]) is _epoch_ast.Constant and value.args[1].value==('entry' if name=='prepare' else 'finish'),'Epoch data inverse grammar') + value.func=_epoch_ast.Attribute(value=_epoch_ast.Name(id='self',ctx=_epoch_ast.Load()),attr='_data',ctx=_epoch_ast.Load());value.args=value.args[2:];self.count+=1 + return self.generic_visit(value) + undo=Undo();restored=undo.visit(restored);_epoch_need(undo.count==1,'Epoch data inverse count');_epoch_locations(restored,original) + _epoch_verify_source_inverse(suite.cache_source,('_Owner',name),restored,getattr(_Owner,name),_Owner.prepare.__code__.co_filename) + fn,tree=_epoch_factory(node,globals(),{'_ep_data':suite.data},_Owner.prepare.__code__.co_filename) + return fn,tree,restored + + +class _EpochSuite: + def __init__(self,descriptor,handle,module,source,prepared,p1,construction,context,generation): + self.descriptor=descriptor;self.handle=handle;self.module=module;self.namespace=module.__dict__ + self.filename=self.namespace['__file__'];self.source=source;self.owner=prepared['owner'] + self.prepared=prepared;self.p1=p1;self.construction=construction;self.context=context + self.label=self.namespace['Label'];self.checks_class=self.namespace['Checks'];self.E0=self.namespace['echelon'] + self.generation=generation;self.invocation_consumed=False;self.active=False;self.terminal=False;self.pending=None;self.checks=None;self.checks_c=None;self.checks_h=None + self.registry={};self.request_live=None;self.caller_caps={};self.products={};self.proofs={} + self.role_retirement_channel={'started':False,'error':None,'journal_error':None,'acknowledged':False} + self.emergency_retirement_channel={'started':False,'error':None,'journal_error':None,'acknowledged':False} + self.inner_retirement_channel={'started':False,'error':None,'journal_error':None,'acknowledged':False} + self.outer_retirement_channel={'started':False,'error':None,'journal_error':None,'acknowledged':False} + self.role_retirement_error=None;self.emergency_retirement_error=None;self.emergency_journal_error=None + self.inner_retirement_error=None;self.inner_journal_error=None;self.outer_retirement_error=None;self.outer_journal_error=None + self.secondary=[];self.primary_error=None;self.secondary_error=None;self.uncertain=False;self.raw_guard=None;self.installed=False + self.receipt={'constructors':0,'basis_loads':0,'key_loads':0,'commits':0,'signature_views':0,'retirements':0,'capacity_retirements':0,'private_requests':0} + self.original_public={'label':prepared['label_ok'],'residual':prepared['residual_ok']} + self.original_source_cache=Path(__file__).read_bytes() + _epoch_need(self.original_source_cache[:94922] and hashlib.sha256(self.original_source_cache[:94922]).hexdigest()=='133c55e269b354542f86a2a1099f48cff052293d06da310f98b7cb33cb85258f','Epoch original V8 cache prefix') + self.cache_source=self.original_source_cache[:94922].decode('utf-8') + self._build() + suite=self + def assembler(index,*args): + _epoch_need(type(index) is int and 0<=index<4,'Epoch assembler exact operation') + _epoch_fn_fresh(suite.assembler_record) + return (suite.instrument_bind,suite.native_prepare,suite.native_commit,suite.finish_bind)[index](*args) + self.assembler=assembler;self.assembler_record=_epoch_fn_record(assembler) + _EPOCH_BINDERS[id(self.owner)]=(self.owner,assembler,self.assembler_record,self) + + def call(self,index,*args): + return _epoch_call(self.descriptor,index,*args) + + def _product(self,role,fn,tree,restored): + _epoch_need(role in _EPOCH_ROLES and role not in self.products,'Epoch unique product role') + self.products[role]=fn + self.proofs[id(fn)]=(fn,role,_epoch_ast.dump(tree,include_attributes=True),_epoch_ast.dump(restored,include_attributes=True),_epoch_fn_record(fn)) + self.call(2,self.handle,self,'product',role,fn) + return fn + + def _build(self): + for site,name in (('C1','__init__'),('C2','label'),('C3','target_frame')): + original=_epoch_ast_function(self.source,('Checks',name)) + (pair,node,restored)=_epoch_constructor_product(original,site,self) + fn,tree=pair;self._product(site,fn,tree,restored) + for role,name,isroles in (('labels','verify_labels',False),('roles','verify_role_frames',True)): + original=_epoch_ast_function(self.source,(name,) if isroles else ('Checks',name)) + pair,node,restored=_epoch_caller_product(original,self,isroles);fn,tree=pair;self._product(role,fn,tree,restored) + for name in ('prepare','finish'): + fn,tree,restored=_epoch_data_product(name,self);self._product(name,fn,tree,restored) + for kind,name in (('label','label_ok'),('residual','residual_ok')): + original=_epoch_ast_function(self.source,('Checks',name)) + for private in (False,True): + fn,tree,restored=_epoch_v8_product(original,kind,self,private) + self._product(('private_' if private else 'public_')+kind,fn,tree,restored) + suite=self;original=self.E0 + def canonical(vectors): + return suite.canonical(vectors) + # Exact original callable is retained, never looked up through new H. + self._product('canonical',canonical,_epoch_ast.parse('def canonical(vectors):\n return suite.canonical(vectors)'),_epoch_ast.parse('def canonical(vectors):\n return original(vectors)')) + + def install(self): + _epoch_need(not self.installed,'Epoch installation one shot') + for kind,name,role in (('checks','__init__','C1'),('checks','label','C2'),('checks','target_frame','C3'),('checks','verify_labels','labels'),('module','verify_role_frames','roles')): + self.call(2,self.handle,self,'install',kind,name,role,self.products[role]) + for kind,name in (('label','label_ok'),('residual','residual_ok')): + self.owner.methods[name]=self.products['public_'+kind] + self.prepared[name]=self.owner.methods[name] + self.owner.method_records=tuple(_record(v) for v in self.owner.methods.values()) + self.installed=True + return None + + def guard_bindings(self): + self.call(5,self.handle,self) + + def current(self): + self.guard_bindings() + _epoch_need(not self.owner.probe_closed,'Epoch native owner closed') + if self.owner.runtime is not None:self.owner.runtime.check() + + def arm(self,invocation_token): + _epoch_need(not self.terminal and not self.invocation_consumed,'Epoch retired/consumed generation cannot arm') + _epoch_need(type(EPOCH_FULL_EXECUTION_CONTRACT) is dict and EPOCH_FULL_EXECUTION_CONTRACT.get('status')=='INDEPENDENT_COMPLETE_COST_AND_CALLER_APPROVED','Epoch full context is not admitted') + _epoch_need(not self.active and not self.terminal and self.raw_guard is not None,'Epoch arm generation') + _epoch_need(_epoch_sys.flags.optimize==0,'Epoch requires original assertions') + _epoch_need(invocation_token is self.context['invocation_token'] and not self.invocation_consumed,'Epoch unique actual full CLI invocation') + _epoch_need(self.context['driver_function'].__globals__ is self.context['phase_function'].__globals__,'Epoch actual driver invocation owner') + self.current();self.invocation_consumed=True;self.active=True + + def canonical(self,vectors): + pending=self.pending + if pending is None or not self.active:return self.E0(vectors) + self.current() + if pending['basis'] is not None: + self.retire('normalizer-reentry');return self.E0(vectors) + result=self.E0(vectors) + if self.pending is pending and self.active: + _epoch_need(type(result) is dict,'Epoch actual normalizer dict') + pending['basis']=result + return result + + def construct(self,site,checks,key,vectors): + if not self.active:return self.label(vectors) + self.current() + _epoch_need(type(site) is str and site in ('C1','C2','C3') and type(checks) is self.checks_class,'Epoch constructor site/owner') + if self.pending is not None: + self.retire('nested-constructor');raise RuntimeError('Epoch nested private constructor') + if site!='C1' and self.checks is not checks: + self.retire('wrong-checks');return self.label(vectors) + pending={'site':site,'checks':checks,'key':key,'basis':None,'label':None,'tuple':None} + self.pending=pending + try: + value=self.label(vectors) + if self.pending is not pending or not self.active:return value + _epoch_need(type(value) is self.label and pending['basis'] is not None,'Epoch genuine constructor pairing') + basis=value.basis;self.receipt['basis_loads']+=1 + actual_key=value.key;self.receipt['key_loads']+=1 + _epoch_need(basis is pending['basis'] and type(actual_key) is tuple,'Epoch actual basis/key tuple') + pending['label']=value;pending['tuple']=actual_key;self.receipt['constructors']+=1 + return value + except BaseException as primary: + self.cancel(primary);raise + + def commit(self,site,checks): + pending=self.pending + if pending is None:return None + _epoch_need(pending['site']==site and pending['checks'] is checks and pending['label'] is not None,'Epoch store continuation') + value=pending['label'] + stored=checks.everything if site=='C1' else checks.cache[pending['key']] + _epoch_need(stored is value,'Epoch original successful store identity') + if site=='C1': + if self.checks is not None or type(checks.h) is not int: + self.retire('public-checks-generation-or-height');return None + self.checks=checks;self.checks_c=checks.c;self.checks_h=checks.h + _epoch_need(self.checks is checks,'Epoch committed Checks mismatch') + if len(self.registry)>=85196: + self.receipt['capacity_retirements']+=1;self.retire('metadata-capacity');return None + self.registry[id(value)]=(value,pending['basis'],pending['tuple'],len(pending['tuple']),checks,site,self.generation) + self.pending=None;self.receipt['commits']+=1 + + def cancel(self,primary): + if self.primary_error is None:self.primary_error=primary + try:self.retire('constructor-or-store') + except BaseException as secondary: + self.uncertain=True + if self.secondary_error is None:self.secondary_error=secondary + try:self.secondary.append(secondary) + except BaseException:pass + return None + + def public_entry(self,checks): + if self.active:self.retire('public-entry') + + def request(self,cap,kind,bound,*operands): + _epoch_need(type(kind) is str and kind in ('label','residual'),'Epoch request kind type') + record=self.caller_caps.get(id(cap)) + _epoch_need(record is not None and record[0] is cap,'Epoch caller capability') + if not self.active:return bound(*operands) + self.current() + _epoch_need(type(bound) is _epoch_types.MethodType and bound.__self__ is self.checks and + bound.__func__ is self.products['public_'+kind],'Epoch actual method/Checks binding') + if type(self.checks.h) is not int or self.checks.c is not self.checks_c or self.checks.h is not self.checks_h: + self.retire('changed-checks-context');return bound(*operands) + if self.request_live is not None: + self.retire('request-reentry');return bound(*operands) + _epoch_need(kind in ('label','residual') and len(operands)==(1 if kind=='label' else 2),'Epoch operand arity') + registered=[] + for value in operands: + item=self.registry.get(id(value)) + if item is None or item[0] is not value or item[4] is not self.checks or item[6]!=self.generation: + self.retire('unregistered-operand');return bound(*operands) + registered.append(item) + req={'nonce':object(),'checks':self.checks,'operands':operands,'registered':tuple(registered),'kind':kind,'generation':self.generation,'stage':0,'views':set()} + self.request_live=req;self.receipt['private_requests']+=1 + try:return self.products['private_'+kind](self.checks,*operands,_ep_request=req) + finally: + req['stage']=3;self.request_live=None + + def _request(self,req,stage): + _epoch_need(type(req) is dict and self.request_live is req and type(req['stage']) is int and req['stage']==stage and req['generation']==self.generation,'Epoch consumed invocation/stage') + + def prepare(self,owner,checks,key,operands,kind,*,_ep_request): + self._request(_ep_request,0);_ep_request['stage']=1 + ticket=self.products['prepare'](owner,checks,key,operands,kind,_ep_request=_ep_request) + if ticket is None:self.retire('unsupported-mapping-or-hooks') + return ticket + + def finish(self,owner,checks,key,operands,kind,ticket,result,*,_ep_request): + self._request(_ep_request,1);_ep_request['stage']=2 + return self.products['finish'](owner,checks,key,operands,kind,ticket,result,_ep_request=_ep_request) + + def data(self,req,stage,checks,key,operands,kind): + self._request(req,1 if stage=='entry' else 2) + _epoch_need(stage not in req['views'],'Epoch repeated signature view');req['views'].add(stage) + if not self.active:return self.owner._data(checks,key,operands,kind) + self.guard_bindings() + if type(checks.h) is not int or checks.c is not self.checks_c or checks.h is not self.checks_h: + self.retire('changed-checks-view');return self.owner._data(checks,key,operands,kind) + _epoch_need(checks is req['checks'] and kind==req['kind'] and len(operands)==len(req['operands']) and all(a is b for a,b in zip(operands,req['operands'])),'Epoch request operand identity') + values=req['registered'] + if kind=='label': + whole=self.registry.get(id(checks.everything)) + if whole is None or whole[0] is not checks.everything: + self.retire('unregistered-everything');return self.owner._data(checks,key,operands,kind) + _epoch_need(type(key) is tuple and len(key)==2 and type(key[0]) is str and key[0]=='label' and key[1] is values[0][2],'Epoch actual label key components') + signature=(kind,values[0][2],whole[2]) + else: + _epoch_need(type(key) is tuple and len(key)==2 and key[0] is values[0][2] and key[1] is values[1][2],'Epoch actual residual key tuple objects') + signature=(kind,values[0][2],values[1][2]) + self.receipt['signature_views']+=1 + return signature,checks.c,checks.h + + def retire(self,reason): + self.active=False;self.terminal=True;self.pending=None + self.registry.clear();self.checks=None;self.checks_c=None;self.checks_h=None + if not self.receipt['retirements']:self.receipt['retirements']=1 + return None + + def role_retire(self,primary=None): + channel=self.role_retirement_channel + try:return self.retire_preserving('last-role',primary,channel) + finally: + self.role_retirement_error=channel['error'] + channel['acknowledged']=True + + def instrument_bind(self,node,row_reference,future,rank_calls,complement_trace,native,rank_row_intern,final_guard): + _epoch_need(type(node) is _epoch_ast.FunctionDef,'Epoch bind AST') + self.bind_inputs=(rank_calls,complement_trace,native,rank_row_intern,final_guard) + self.call(3,self.handle,self,'reconcile') + original=_epoch_copy.deepcopy(node);result=_epoch_copy.deepcopy(node) + _epoch_need(not any(x.arg=='epoch_assembler' for x in result.args.kwonlyargs),'Epoch duplicate assembler argument') + result.args.kwonlyargs.append(_epoch_ast.arg(arg='epoch_assembler'));result.args.kw_defaults.append(None) + count_a=count_b=0;body=[] + for statement in result.body: + if type(statement) is _epoch_ast.Assign and len(statement.targets)==1 and type(statement.targets[0]) is _epoch_ast.Attribute and statement.targets[0].attr=='complement_in': + body.extend(_epoch_ast.parse('epoch_assembler(1,module,label,original_functions,complement_in,nondegenerate)').body);count_a+=1 + body.append(statement) + if type(statement) is _epoch_ast.Assign and len(statement.targets)==1 and type(statement.targets[0]) is _epoch_ast.Name and statement.targets[0].id=='runtime' and type(statement.value) is _epoch_ast.Call and type(statement.value.func) is _epoch_ast.Attribute and statement.value.func.attr=='__new__': + body.extend(_epoch_ast.parse('epoch_assembler(2,module,label,original_functions,runtime)').body);count_b+=1 + _epoch_need(count_a==count_b==1,'Epoch unique native install stages');result.body=body + restored=_epoch_copy.deepcopy(result);restored.args.kwonlyargs.pop();restored.args.kw_defaults.pop() + removed=[];kept=[] + for statement in restored.body: + if type(statement) is _epoch_ast.Expr and type(statement.value) is _epoch_ast.Call and type(statement.value.func) is _epoch_ast.Name and statement.value.func.id=='epoch_assembler': + removed.append(statement);continue + kept.append(statement) + _epoch_need(len(removed)==2 and [_epoch_ast.dump(x,include_attributes=False) for x in removed]==[_epoch_ast.dump(x,include_attributes=False) for x in _epoch_ast.parse('epoch_assembler(1,module,label,original_functions,complement_in,nondegenerate)\nepoch_assembler(2,module,label,original_functions,runtime)').body],'Epoch inverse stage grammar');restored.body=kept;_epoch_locations(restored,original) + self.bind_inverse={'original':_epoch_ast.dump(original,include_attributes=True),'derived':_epoch_ast.dump(result,include_attributes=True),'restored':_epoch_ast.dump(restored,include_attributes=True)} + expected_tree=_epoch_ast.Module(body=_epoch_copy.deepcopy(future)+[result],type_ignores=[]) + _epoch_ast.fix_missing_locations(expected_tree) + self.bind_expected_code=_epoch_named(compile(expected_tree,row_reference.__code__.co_filename,'exec',dont_inherit=True,optimize=_epoch_sys.flags.optimize),'bind') + return result + + def native_prepare(self,module,label,original_functions,complement,gram): + _epoch_need(module is self.module and label is self.label and type(original_functions) is list,'Epoch native original inputs') + self.call(3,self.handle,self,'prepare',module,label,original_functions,complement,gram) + + def native_commit(self,module,label,original_functions,raw): + _epoch_need(module is self.module and label is self.label,'Epoch native commit module') + self.raw_guard=raw + self.call(3,self.handle,self,'commit',raw) + + def finish_bind(self,result): + self.call(3,self.handle,self,'finish',result,self.owner) + return result + + +def create_epoch_suite(descriptor,handle,module,source,prepared,p1,construction,context,generation): + _epoch_need(type(descriptor) is tuple and type(context) is dict,'Epoch genuine factory inputs') + _epoch_need(type(prepared) is dict and all(type(k) is str for k in prepared),'Epoch prepared factory result') + owner=prepared['owner'];_epoch_need(type(owner) is _Owner and id(owner) not in _EPOCH_SUITES,'Epoch owner already registered') + creator=object.__getattribute__(owner,'__dict__').get('_epoch_creator_record') + _epoch_need(type(creator) is tuple and len(creator)==3 and creator[0] is descriptor and creator[1] is handle and creator[2] is context,'Epoch source-owned creation record') + suite=_EpochSuite(descriptor,handle,module,source,prepared,p1,construction,context,generation) + _EPOCH_SUITES[id(owner)]=(owner,suite) + return suite + + +def compose_epoch_runtime_guard(base,suite): + _epoch_need(type(base) is type and type(suite) is _EpochSuite and + id(suite.owner) in _EPOCH_SUITES and _EPOCH_SUITES[id(suite.owner)][0] is suite.owner and + _EPOCH_SUITES[id(suite.owner)][1] is suite,'Epoch owned guard source suite') + class EpochRuntimeGuard(base): + def check(self): + base.check(self) + suite.guard_bindings() + def check_backend(self): + base.check_backend(self) + suite.guard_bindings() + _epoch_need(getattr(suite,'epoch_guard',None) is None,'Epoch guard already composed') + suite.epoch_guard=EpochRuntimeGuard + return EpochRuntimeGuard + + +def _epoch_validate(prepared,assembler): + _epoch_need(type(prepared) is dict and all(type(k) is str for k in prepared),'Epoch prepared key domain') + owner=prepared.get('owner') + record=_EPOCH_BINDERS.get(id(owner)) + _epoch_need(record is not None and record[0] is owner and record[1] is assembler,'Epoch required genuine assembler') + _epoch_fn_fresh(record[2]) + return owner + + +def epoch_suite_call(suite,index,*args): + """Owned-source helper for adapters; not an implicit public epoch flag.""" + _epoch_need(type(suite) is _EpochSuite,'Epoch exact suite') + record=_EPOCH_SUITES.get(id(suite.owner)) + _epoch_need(record is not None and record[0] is suite.owner and record[1] is suite,'Epoch suite registry') + _epoch_need(type(index) is int and 0<=index<7,'Epoch suite operation') + return (suite.install,suite.apply_existing,suite.construction_init, + suite.phase_wrap,suite.arm,suite.seal,suite.retire_preserving)[index](*args) + + +def _epoch_suite_apply_existing(self,kind,name,role,function): + return self.call(2,self.handle,self,'existing',kind,name,role,function) + + +def _epoch_suite_construction_init(self): + return self.call(2,self.handle,self,'construction_init') + + +def _epoch_suite_phase_wrap(self,phases,kind,owner,attribute,name): + # Genuine original phase factory constructs its exact function on a private + # temporary module; the source ledger authorizes before the real store. + temporary=_epoch_types.ModuleType('_h25_epoch_phase_temporary') + original=getattr(owner,attribute);setattr(temporary,attribute,original) + actual_original,observed=phases.wrap(temporary,attribute,name) + _epoch_need(actual_original is original,'Epoch original phase factory result') + self.call(2,self.handle,self,'existing',kind,attribute,'phase',observed) + return original,observed + + +def _epoch_suite_seal(self): + self.call(4,self.handle,self) + + +def _epoch_suite_retire_preserving(self,reason,primary=None,error_channel=None): + channel=self.emergency_retirement_channel if error_channel is None else error_channel + _epoch_need(channel['started'] is False and channel['acknowledged'] is False,'Epoch retirement channel already consumed') + channel['started']=True + if primary is not None and self.primary_error is None:self.primary_error=primary + try:self.retire(reason) + except BaseException as cleanup_error: + channel['error']=cleanup_error # fixed raw owner before any optional growth + self.uncertain=True + if primary is None: + if self.primary_error is None:self.primary_error=cleanup_error + elif cleanup_error is not primary: + if self.secondary_error is None:self.secondary_error=cleanup_error + try:self.secondary.append(cleanup_error) + except BaseException as journal_error: + channel['journal_error']=journal_error + # A failed retirement cannot leave private invocation authority active. + # Only plain source-owned metadata is touched; no native guard/close is + # retried and no ambient exception state chooses the designated error. + self.active=False;self.terminal=True;self.pending=None + self.checks=None;self.checks_c=None;self.checks_h=None + try:dict.clear(self.registry) + except BaseException as metadata_error: + if self.secondary_error is None:self.secondary_error=metadata_error + try:self.secondary.append(metadata_error) + except BaseException:pass + if primary is None:raise cleanup_error + return None + + +# These exact class members are installed at source module initialization before +# cold authority capture of this module, never by a running target or caller. +_EpochSuite.apply_existing=_epoch_suite_apply_existing +_EpochSuite.construction_init=_epoch_suite_construction_init +_EpochSuite.phase_wrap=_epoch_suite_phase_wrap +_EpochSuite.seal=_epoch_suite_seal +_EpochSuite.retire_preserving=_epoch_suite_retire_preserving + + +def _epoch_guard_base(owner,assembler): + record=_EPOCH_BINDERS.get(id(owner)) + _epoch_need(record is not None and record[0] is owner and record[1] is assembler, + 'Epoch genuine guard-base assembler') + _epoch_fn_fresh(record[2]);suite=record[3] + result=getattr(suite,'epoch_guard',None) + _epoch_need(type(result) is type and result.__mro__[1] is owner.composed_guard, + 'Epoch exact additional guard base') + return result + + + +def bind_epoch_cache_backend(backend, module, native, prepared, environment, *, row_producer_handle, row_handle, rank_row_intern, final_guard, rank_calls=None, complement_trace=None, epoch_assembler): + """Keep the real row observer; derive exactly its two callback guard targets. + + The first producer reverses its row observer/parameter back to the original + backend. This second transform reverses its two check_backend attributes + back to THAT exact row-derived function. Public backend.bind stays original. + """ + _epoch_validate(prepared, epoch_assembler) + _need(not V8_SOURCE_DRAFT, 'V8 source draft is not executable') + owner = prepared['owner'] + _need(owner.factory_environment is environment and owner.composed_guard is not None and (owner.runtime is None), 'Backend factory requires a fresh composed cache guard') + authority = environment.cold_authority + _check_factory_environment(environment, backend, final_guard) + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + _ca_dispatch(4, owner.composed_guard, environment.cache_handle, 'compose_runtime_guard', (owner.base_guard, prepared), {}) + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + _ca_dispatch(4, rank_row_intern, row_handle, 'make_row_interner', (), {}) + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + _ca_dispatch(4, final_guard, row_handle, 'make_cache_runtime_guard', (_epoch_guard_base(owner, epoch_assembler), rank_row_intern), {}) + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + row_source = _ca_dispatch(6, row_handle) + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + producer_source = _ca_dispatch(6, row_producer_handle) + _need(row_source[2] == V8_ROW_SOURCE_SHA256 and producer_source[2] == V8_ROW_PRODUCER_SHA256, 'Backend factory row source pin differs') + _need(_TYPE(final_guard) is _TYPE and _LEN(_TYPEGET(final_guard, '__mro__')) > 1 and (_TYPEGET(final_guard, '__mro__')[1] is _epoch_guard_base(owner, epoch_assembler)), 'Backend factory requires the exact registered final row guard') + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + row_product = _ca_dispatch(1, row_producer_handle, 'derive_row_bind', environment.bind, environment.source_bytes) + row_reference = row_receipt = packet = original = future = parsed = None + derived = restored = restored_tree = tree = None + try: + _need(_TYPE(row_product) is _TUPLE and _LEN(row_product) == 3, 'Backend factory row producer transport differs') + row_reference, row_receipt, packet = row_product + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + _ca_dispatch(4, row_reference, row_producer_handle, 'derive_row_bind', (environment.bind, environment.source_bytes), {}) + _need(_TYPE(packet) is _TUPLE and _LEN(packet) == 2 and (_TYPE(packet[0]) is ast.FunctionDef) and (_TYPE(packet[1]) is list), 'Backend factory private row AST packet differs') + original, future = packet + original_tree = ast.Module(body=copy.deepcopy(future) + [copy.deepcopy(original)], type_ignores=[]) + ast.fix_missing_locations(original_tree) + original_code = _code_named(_COMPILE(original_tree, row_reference.__code__.co_filename, 'exec', dont_inherit=True, optimize=sys.flags.optimize), 'bind') + _need(_code_equal(original_code, row_reference.__code__), 'Backend factory transported row AST differs from its registered callable') + derived = copy.deepcopy(original) + replacements = [] + for statement in derived.body: + if _TYPE(statement) is ast.FunctionDef and statement.name in ('complement_in', 'nondegenerate'): + _need(_LEN(statement.body) > 0 and _TYPE(statement.body[0]) is ast.Expr, 'Backend factory expected callback guard expression is absent') + call = statement.body[0].value + _need(_TYPE(call) is ast.Call and (not call.args) and (not call.keywords) and (_TYPE(call.func) is ast.Attribute) and (call.func.attr == 'check') and (_TYPE(call.func.value) is ast.Name) and (call.func.value.id == 'runtime'), 'Backend factory callback guard expression changed') + call.func.attr = 'check_backend' + replacements.append(call.func) + _need(_LEN(replacements) == 2, 'Backend factory must replace exactly two row-reference callback guard calls') + restored = copy.deepcopy(derived) + restored_count = 0 + for statement in restored.body: + if _TYPE(statement) is ast.FunctionDef and statement.name in ('complement_in', 'nondegenerate'): + statement.body[0].value.func.attr = 'check' + restored_count += 1 + _need(restored_count == 2 and ast.dump(restored, include_attributes=False) == ast.dump(original, include_attributes=False), 'Backend factory changed more than the two admitted row-reference guard calls') + restored_tree = ast.Module(body=copy.deepcopy(future) + [restored], type_ignores=[]) + ast.fix_missing_locations(restored_tree) + restored_code = _code_named(_COMPILE(restored_tree, row_reference.__code__.co_filename, 'exec', dont_inherit=True, optimize=sys.flags.optimize), 'bind') + _need(_code_equal(restored_code, row_reference.__code__), 'Backend factory reversed calling code differs from the row reference') + derived = _epoch_checked(owner, epoch_assembler, 0, derived, row_reference, future, rank_calls, complement_trace, native, rank_row_intern, final_guard) + tree = ast.Module(body=copy.deepcopy(future) + [derived], type_ignores=[]) + ast.fix_missing_locations(tree) + code = _code_named(_COMPILE(tree, row_reference.__code__.co_filename, 'exec', dont_inherit=True, optimize=sys.flags.optimize), 'bind') + clone = FunctionType(code, row_reference.__globals__, row_reference.__name__, row_reference.__defaults__, row_reference.__closure__) + clone.__kwdefaults__ = row_reference.__kwdefaults__ + _need(clone.__globals__ is row_reference.__globals__ and clone.__builtins__ is row_reference.__builtins__ and (clone.__defaults__ is row_reference.__defaults__) and (clone.__kwdefaults__ is row_reference.__kwdefaults__) and (clone.__closure__ is row_reference.__closure__), 'Backend factory changed effective row-reference dispatch ownership') + _check_factory_environment(environment, backend, final_guard) + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + _ca_dispatch(4, row_reference, row_producer_handle, 'derive_row_bind', (environment.bind, environment.source_bytes), {}) + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + _ca_dispatch(4, final_guard, row_handle, 'make_cache_runtime_guard', (_epoch_guard_base(owner, epoch_assembler), rank_row_intern), {}) + _need(_TYPE(module) is ModuleType and _string_key_domain(module.__dict__), 'Backend factory scientific lookup domain changed') + result = clone(module, native, rank_calls, complement_trace, rank_row_intern, epoch_assembler=epoch_assembler) + _need(_GET(environment.namespace, 'bind') is environment.bind, 'Backend factory replaced the original public bind') + owner.binding_derivation = {'source_sha256': BACKEND_SOURCE_SHA256, 'row_source_sha256': V8_ROW_SOURCE_SHA256, 'row_producer_sha256': V8_ROW_PRODUCER_SHA256, 'row_derivation': _DICT(row_receipt), 'changed_callback_calls': 2, 'restored_ast_identical': True, 'restored_code_identical': True, 'transported_ast_matches_registered_row_callable': True, 'original_globals_builtins_defaults_closure': True, 'environment_reference': 'exact private row-derived callable', 'exact_final_row_class_product_checked_before_bind': True, 'early_environment': environment.receipt} + result = _epoch_checked(owner, epoch_assembler, 3, result) + return result + finally: + row_product = row_reference = row_receipt = packet = original = future = parsed = None + original_tree = original_code = derived = restored = restored_tree = tree = None + replacements = statement = call = restored_code = code = clone = None + + +# SOURCE supplement embedded after the unchanged legacy cache prefix. +def _epoch_require_disposition(state,record): + _need(_TYPE(state) is _DICT and _string_key_domain(state) and _TYPE(record) is _DICT and _string_key_domain(record),'Epoch exact acquisition disposition dictionaries') + _need(set(record)=={'phase','prepared','owner','probe_binding','close_attempted','close_result','primary','secondary','uncertain','published','origin_handle'} and + _GET(state,'epoch_acquisition') is record and _GET(state,'cache_binding',_MISSING) is None and + _TYPE(record['phase']) is _STR and record['phase']=='BEFORE_ACQUISITION' and record['prepared'] is None and record['owner'] is None and + record['probe_binding'] is None and record['close_attempted'] is False and record['published'] is False and + record['close_result'] is None and record['primary'] is None and record['secondary'] is None and + record['uncertain'] is False and record['origin_handle'] is None, + 'Epoch pending disposition identity and initial state') + + +def prepare_epoch_cache_contract(module, extension_path, expected_extension_sha256, *, bootstrap_root, bootstrap_capability, bootstrap_api, factory_environment, source_sha256=SOURCE_SHA256, disposition_state, disposition_record): + """Return methods/owner; parent installs only after original P1 admission.""" + _need(not V8_SOURCE_DRAFT, 'V8 source draft is not executable') + _need(_TYPE(factory_environment) is _BackendFactoryEnvironment, "Cache v7 requires the parent's early factory environment") + _ca_desc = factory_environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if factory_environment.cold_authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + _ca_dispatch(2, factory_environment.cache_handle) + _ca_desc = factory_environment.collector_descriptor + _ca_runtime_operations = _ca_desc[1] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if _ca_type(_ca_runtime_operations) is not _ca_p[9] or _ca_p[3](_ca_runtime_operations) != 1 or _ca_runtime_operations[0] is not factory_environment.collector_guard: + raise _ca_error('Runtime drift: cache collector operation identity differs') + if _ca_runtime_operations is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Runtime drift: cache collector dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Runtime drift: cache collector dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Runtime drift: cache collector dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Runtime drift: cache collector dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Runtime drift: cache collector dispatcher cell differs') + _ca_dispatch(0) + _bootstrap_api(bootstrap_root, bootstrap_capability, bootstrap_api) + _epoch_require_disposition(disposition_state, disposition_record) + _need(_TYPE(module) is ModuleType, 'Cache contract requires an exact source module') + namespace = module.__dict__ + _need(_string_key_domain(namespace), 'Unsupported cache contract source lookup key domain') + path = Path(namespace['__file__']) + raw = path.read_bytes() + _need(source_sha256 == SOURCE_SHA256 and hashlib.sha256(raw).hexdigest() == SOURCE_SHA256, 'Cache contract scientific source differs') + _need(_GET(namespace, '__builtins__') is _BUILTINS and 'any' not in namespace and (_GET(_BUILTINS, 'any') is _ANY), 'Cache contract odd calling environment differs') + compiled = _COMPILE(raw, str(path), 'exec', dont_inherit=True, optimize=sys.flags.optimize) + records = [_authenticate(namespace['odd'], _code_named(compiled, 'odd'), namespace)] + checks = namespace['Checks'] + _need(_ordinary(checks) and _ordinary(namespace['Label']), 'Cache contract original class dispatch differs') + members = _TYPEGET(checks, '__dict__') + expected_names = {'__module__', '__doc__', '__dict__', '__weakref__'} + for code in _code_named(compiled, 'Checks').co_consts: + if _TYPE(code) is CodeType: + expected_names.add(code.co_name) + records.append(_authenticate(members.get(code.co_name), code, namespace)) + _need(set(members) == expected_names, 'Cache contract original Checks members differ') + parsed = ast.parse(raw, filename=str(path)) + checks_ast = next((item for item in parsed.body if _TYPE(item) is ast.ClassDef and item.name == 'Checks')) + probe_binding = None + owner = None + prepared = None + try: + provider, probe_binding, bootstrap_validate, bootstrap_load, bootstrap_identity = _load_probe(extension_path, expected_extension_sha256, bootstrap_root, bootstrap_capability, bootstrap_api) + disposition_record['probe_binding'] = probe_binding + disposition_record['phase'] = 'NATIVE_LOCALLY_OWNED' + owner = _Owner(module, _TUPLE(records), frozenset(expected_names), provider, probe_binding, bootstrap_root, bootstrap_capability, bootstrap_api, bootstrap_validate, bootstrap_load, bootstrap_identity, factory_environment.collector_guard, factory_environment.collector_descriptor) + owner.factory_environment = factory_environment + for name, kind in (('residual_ok', 'residual'), ('label_ok', 'label')): + method = next((item for item in checks_ast.body if _TYPE(item) is ast.FunctionDef and item.name == name)) + owner.methods[name] = _generate(module, method, owner, kind) + owner.method_records = _TUPLE((_record(value) for value in owner.methods.values())) + disposition_record['owner'] = owner + prepared = {'residual_ok': owner.methods['residual_ok'], 'label_ok': owner.methods['label_ok'], 'owner': owner, 'receipt': owner.receipt} + disposition_record['prepared'] = prepared + disposition_state['cache_binding'] = prepared + disposition_record['published'] = True + disposition_record['phase'] = 'PARENT_OWNED' + return prepared + except _BASE_ERROR as primary_error: + if disposition_record['primary'] is None: + disposition_record['primary'] = primary_error + if prepared is not None and _GET(disposition_state, 'cache_binding') is prepared: + disposition_record['published'] = True + disposition_record['phase'] = 'PARENT_OWNED_FAILURE' + raise + if probe_binding is None: + disposition_record['phase'] = 'FAILURE_BEFORE_BINDING_RETURN' + disposition_record['uncertain'] = True + raise + disposition_record['close_attempted'] = True + disposition_record['phase'] = 'LOCAL_CLOSE_ATTEMPTING' + try: + disposition_record['close_result'] = probe_binding.close() + except _BASE_ERROR as close_error: + disposition_record['secondary'] = close_error + disposition_record['uncertain'] = True + disposition_record['phase'] = 'LOCAL_CLOSE_FAILED' + raise primary_error from close_error + disposition_record['phase'] = 'LOCAL_CLOSE_RETURNED' + raise diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-epoch-products-v5/epoch_data_products_v1.py.txt b/research/h25-cache-source-handoff/snapshot/areas/cache-epoch-products-v5/epoch_data_products_v1.py.txt new file mode 100644 index 0000000000..33a9042bfc --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-epoch-products-v5/epoch_data_products_v1.py.txt @@ -0,0 +1,1664 @@ +"""Source-only draft for parent-reviewed data-handling integration. + +Installed only by the parent into a new immutable stage. Original adapters and +reference modules are independent. Every helper/control import and scientific +operation below runs only inside the parent-owned serial guarded process. +""" +import hashlib +import json +import os +from pathlib import Path, PurePosixPath +import stat +import sys +from types import ModuleType + +import adapters +import native_packet + +# Final V8 author census is configured only after the source packet freezes. +EXPECTED_CACHE_TRANSCRIPT_RECORDS = 155 +EXPECTED_V7_CONSUMER_CASES = ('source-before-native', 'source-before-trace', 'builtin-before-native', 'builtin-shadow-and-key-cleanup', 'row-calling-environment-full-and-light', 'row-key-first-error-and-cleanup', 'actual-row-native-observation', 'cold-_code_named-code', 'cold-_code_named-defaults', 'cold-_code_named-globals', 'cold-_check_factory_environment-code', 'cold-_check_factory_environment-defaults', 'cold-_check_factory_environment-globals', 'final-class-__init__-code', 'final-class-__init__-defaults', 'final-class-__init__-closure', 'final-class-check-code', 'final-class-check-defaults', 'final-class-check-closure', 'final-class-check_backend-code', 'final-class-check_backend-defaults', 'final-class-check_backend-closure', 'unregistered-final-subclass', 'restored-final-class-binds') +EXPECTED_V8_CALLER_CASES = ('cold-dispatcher-code', 'cold-dispatcher-defaults', 'cold-dispatcher-kwdefaults', 'cold-dispatcher-closure', 'runtime-dispatcher-code', 'runtime-dispatcher-defaults', 'runtime-dispatcher-kwdefaults', 'runtime-dispatcher-closure', 'runtime-collector-code', 'runtime-collector-defaults', 'runtime-collector-kwdefaults', 'runtime-collector-closure') +EXPECTED_AUTHORITY_CONTROL_CASES = ('A1-authority-entry-and-helper-fields', 'A2-caller-dispatcher-fields', 'A3-every-owned-module-helper', 'A4-registered-product-methods-and-closure-helpers', 'A5-foreign-key-failure-disposal', 'A6-runtime-child-dispatcher-and-helper-fields') + +DATA_CONTROL_STATUS = { + 'construction': 'PASS', + 'serialization': 'SERIALIZATION_FINITE_PASS', + 'cache_validity': 'PASS', + 'cold_authority': 'PASS', + 'rank_metadata': 'AREA6_METADATA_HELPER_CONTROLS_PASS', + 'rank_native': 'NATIVE_OBSERVATION_DIFFERENTIAL_CONTROLS_PASS', + 'inventory': 'INVENTORY_DIFFERENTIAL_CONTROLS_PASS', + 'combined_composition': 'BOUNDED_COMBINED_COMPOSITION_PASS', + 'cache_reference_v3': 'PASS', + 'native_initial_tcb': 'NATIVE_INITIAL_TCB_CONTROLS_PASS', + **native_packet.CONTROL_STATUS, +} +_MODULES = ( + ('construction', 'areas/construction/construction_v2.py', '_h25_data_construction'), + ('construction_controls', 'areas/construction/construction_controls_v2.py', '_h25_data_construction_controls'), + ('serializer', 'areas/serialization/bounded_serialization.py', 'bounded_serialization'), + ('serialization_controls', 'areas/serialization/serialization_controls.py', '_h25_data_serialization_controls'), + ('cache', 'areas/cache-validity/cache_contract_v8.py', '_h25_data_cache'), + ('cache_controls', 'areas/cache-validity/cache_controls_v8.py', '_h25_data_cache_controls'), + ('cold_authority_controls', 'areas/cache-validity/cold_authority_controls_v7.py', '_h25_data_cold_authority_controls'), + ('cache_reference', 'areas/cache-validity/cache_contract_v3.py', '_h25_data_cache_reference'), + ('cache_reference_controls', 'areas/cache-validity/cache_controls_v3.py', '_h25_data_cache_reference_controls'), + ('rows', 'integration/row_interner_v3.py', '_h25_data_rows'), + ('row_derivation', 'integration/derive_row_bind_v3.py', '_h25_data_private_row_derivation'), + ('digests', 'areas/hashing-traces/digest_snapshot.py', '_h25_data_digests'), + ('metadata_controls', 'areas/hashing-traces/metadata_controls.py', '_h25_data_metadata_controls'), + ('native_controls', 'areas/hashing-traces/native_observation_controls.py', '_h25_data_native_controls'), + ('inventory_controls', 'areas/hashing-traces/inventory_controls.py', '_h25_data_inventory_controls'), + ('derive_backend', 'integration/derive_backend.py', '_h25_data_backend_derivation'), + ('composition_controls', 'integration/composition_controls.py', '_h25_data_composition_controls'), +) + +_CONTROL_CONTRACT = {'cache_counts': {'binding_rejections': 12, + 'cases': 29, + 'requests': 71, + 'source_admission_rejections': 2, + 'tamper_rejections': 1, + 'unsupported_rejections': 2}, + 'construction_normal_names': ['complete-constructor-h8', + 'complete-constructor-h9', + 'exact-add-0', + 'exact-add-1', + 'exact-add-2', + 'exact-add-3', + 'exact-add-4', + 'exact-add-5', + 'exact-add-6', + 'exact-add-7', + 'exact-add-8', + 'exact-add-9', + 'exact-add-10', + 'overlap-assertion-matching-mode', + 'negative-index', + 'index-outside', + 'none-index', + 'float-index', + 'bool-index', + 'unhashable-kind', + 'mask-callback', + 'index-callback', + 'kind-callback', + 'support-callback', + 'lookup-callback', + 'unarmed-construction-remains-incremental', + 'retired-complete-index-and-private-snapshot', + 'resumed-run-loses-frozen-tail-qualification', + 'resumed-duplicate-restores-same-dictionary', + 'reinitialized-run-loses-qualification-h8', + 'retired-object-literal-reinitialization-h8', + 'reinitialized-run-loses-qualification-h9', + 'retired-object-literal-reinitialization-h9', + 'reinitialized-run-loses-qualification-h7', + 'retired-object-literal-reinitialization-h7', + 'resumption-restores-original-index-after-graph-edits', + 'lookup-entry-mutation', + 'lookup-replacement', + 'snapshot-binding', + 'double-finalize', + 'wrong-finalizer', + 'factory-rejects-changed-original-add', + 'factory-rejects-source-builtin-shadow', + 'seal-rejects-late-add-replacement', + 'scope-cannot-be-rearmed', + 'hook-bearing-constructor-trace', + 'hook-bearing-constructor-profile', + 'hook-bearing-constructor-gc', + 'hook-bearing-constructor-thread', + 'hook-bearing-constructor-signal', + 'hook-bearing-constructor-monitoring', + 'invalid-dimension-original-assertion', + 'malformed-complete-index-before-clear', + 'generic-subclass-add-fallback', + 'factory-rejects-original-defaults', + 'factory-rejects-original-code', + 'factory-rejects-original-helper', + 'factory-rejects-original-descriptor', + 'owner-rejects-changed-wrapper-defaults', + 'public-total-helper-restores-before-add', + 'p1-original-authentication-and-final-wrapper-composition'], + 'construction_optimized_names': ['complete-constructor-h8', + 'complete-constructor-h9', + 'exact-add-0', + 'exact-add-1', + 'exact-add-2', + 'exact-add-3', + 'exact-add-4', + 'exact-add-5', + 'exact-add-6', + 'exact-add-7', + 'exact-add-8', + 'exact-add-9', + 'exact-add-10', + 'overlap-assertion-matching-mode', + 'negative-index', + 'index-outside', + 'none-index', + 'float-index', + 'bool-index', + 'unhashable-kind', + 'mask-callback', + 'index-callback', + 'kind-callback', + 'support-callback', + 'lookup-callback', + 'unarmed-construction-remains-incremental', + 'retired-complete-index-and-private-snapshot', + 'resumed-run-loses-frozen-tail-qualification', + 'resumed-duplicate-restores-same-dictionary', + 'reinitialized-run-loses-qualification-h8', + 'retired-object-literal-reinitialization-h8', + 'reinitialized-run-loses-qualification-h9', + 'retired-object-literal-reinitialization-h9', + 'reinitialized-run-loses-qualification-h7', + 'retired-object-literal-reinitialization-h7', + 'resumption-restores-original-index-after-graph-edits', + 'lookup-entry-mutation', + 'lookup-replacement', + 'snapshot-binding', + 'double-finalize', + 'wrong-finalizer', + 'factory-rejects-changed-original-add', + 'factory-rejects-source-builtin-shadow', + 'seal-rejects-late-add-replacement', + 'scope-cannot-be-rearmed', + 'hook-bearing-constructor-trace', + 'hook-bearing-constructor-profile', + 'hook-bearing-constructor-gc', + 'hook-bearing-constructor-thread', + 'hook-bearing-constructor-signal', + 'hook-bearing-constructor-monitoring', + 'malformed-complete-index-before-clear', + 'generic-subclass-add-fallback', + 'factory-rejects-original-defaults', + 'factory-rejects-original-code', + 'factory-rejects-original-helper', + 'factory-rejects-original-descriptor', + 'owner-rejects-changed-wrapper-defaults', + 'public-total-helper-restores-before-add', + 'p1-original-authentication-and-final-wrapper-composition'], + 'inventory_cases': [['valid', 'value'], + ['list-pins', 'value'], + ['wrong-digest', 'error'], + ['missing', 'error'], + ['extra', 'error'], + ['extra-nonexact', 'value'], + ['symlink', 'error'], + ['root-symlink', 'error'], + ['changed-mode', 'value'], + ['fresh-call-after-mutation', 'error'], + ['restored', 'value']], + 'rank_guard_mutation_names': ['__code__', + '__defaults__', + '__kwdefaults__', + '_LEN', + '_GET', + '_MAX_ENTRIES', + 'make_row_interner', + 'make_runtime_guard', + 'builtin/len', + 'builtin/int', + 'cell/exact_int', + 'cell/exact_tuple', + 'cell/exact_type', + 'cell/get', + 'cell/length', + 'cell/max_entries', + 'cell/max_rows', + 'cell/max_value', + 'cell/missing', + 'cell/table', + 'empty-cell'], + 'serialization_names': ['ordinary', + 'empty', + 'rows-1', + 'rows-1023', + 'rows-1024', + 'rows-1025', + 'rows-2048', + 'byte-bound-169', + 'byte-bound-170', + 'byte-bound-171', + 'scalars-unicode-wide', + 'wide-unlimited', + 'wide-digit-error', + 'interned-rank-rows', + 'depth-30', + 'depth-33', + 'circular', + 'callback-list', + 'callback-dict', + 'callback-error', + 'int-subclass', + 'unsupported-object', + 'malformed-result', + 'malformed-witness', + 'malformed-rank', + 'nonstring-supported-keys', + 'expected-result_sha256', + 'expected-exact_witness_sha256', + 'expected-rank_trace_sha256', + 'expected-rank_call_count', + 'expected-rank_distinct_matrix_count', + 'failure-stage_create', + 'failure-stage_open', + 'failure-stage_write', + 'failure-stage_flush', + 'failure-stage_after_close', + 'failure-stage_hash', + 'failure-final_open-result.json', + 'failure-final_write-result.json', + 'failure-final_flush-result.json', + 'failure-final_after_close-result.json', + 'failure-final_open-witness.json', + 'failure-final_write-witness.json', + 'failure-final_flush-witness.json', + 'failure-final_after_close-witness.json', + 'failure-final_open-rank-trace.json', + 'failure-final_write-rank-trace.json', + 'failure-final_flush-rank-trace.json', + 'failure-final_after_close-rank-trace.json', + 'short-final-0', + 'short-final-1', + 'copy-corrupt-content', + 'stage-mutated-size', + 'copy-read-error', + 'copy-hash-error', + 'cleanup-unlink-error', + 'cleanup-rmdir-error', + 'primary-plus-close-error', + 'primary-plus-manifest-error', + 'drift-reference_global', + 'drift-json_default', + 'drift-expected_value', + 'drift-effective_builtin', + 'drift-json_global_shadow', + 'drift-keyword_default', + 'exit-json-drift', + 'fallback-exit-json-drift', + 'existing-finals', + 'state-mutation-between-writes', + 'path-subclass-fallback']} + + +def need(condition, message): + if not condition: + raise RuntimeError(message) + + +def _relative(name): + need(type(name) is str, 'Stage path must be exact text') + path = PurePosixPath(name) + need(bool(path.parts) and not path.is_absolute() and '..' not in path.parts and + '\\' not in name and path.as_posix() == name, 'Noncanonical stage path: ' + name) + return name + + +def _row(path): + need(path.is_file() and not path.is_symlink(), 'Missing or symlinked data source: ' + str(path)) + hasher = hashlib.sha256() + with path.open('rb') as stream: + for block in iter(lambda: stream.read(1024 * 1024), b''): + hasher.update(block) + return {'sha256': hasher.hexdigest(), 'mode': stat.S_IMODE(path.stat().st_mode)} + + +def _manifest(root): + path = root / 'STAGE.json' + need(path.is_file() and not path.is_symlink(), 'Missing regular data stage manifest') + manifest = json.loads(path.read_bytes()) + need(manifest.get('schema') == 'h25-data-handling-immutable-stage-v1' and + type(manifest.get('files')) is dict, 'Wrong immutable data stage contract') + for name in manifest['files']: + _relative(name) + return manifest + + +def custody(root): + """Fresh complete new helper/control/integration source census and hashes.""" + manifest = _manifest(root) + selected = {name for name in manifest['files'] + if (name.startswith(('areas/', 'integration/')) or '/' not in name) + and Path(name).suffix in ('.py', '.c')} + actual = set() + for path in root.iterdir(): + need(not path.is_symlink(), 'Symlink in stage root: ' + str(path)) + if path.is_file() and path.suffix in ('.py', '.c'): + actual.add(path.name) + for directory in (root / 'areas', root / 'integration'): + need(directory.is_dir() and not directory.is_symlink(), 'Missing regular new source directory') + for path in directory.rglob('*'): + need(not path.is_symlink(), 'Symlink in new data source tree: ' + str(path)) + if path.is_file() and path.suffix in ('.py', '.c'): + actual.add(path.relative_to(root).as_posix()) + need(actual == selected, 'Complete new data source census changed') + need({name for _, name, _ in _MODULES} | {'integration/full_driver.py', 'integration/scientific_driver.py', 'integration/data_adapters.py', + 'integration/native_packet.py', 'integration/probe_binding_v3.py', + 'integration/guarded_adapters_v4.py', 'areas/cache-validity/cold_authority_v7.py'} <= selected, + 'Required data-handling source missing from stage') + result = {} + for name in sorted(selected): + observed = _row(root / name) + need(observed == manifest['files'][name], 'New data source custody failed: ' + name) + result[name] = observed + return result + + +def _load(root, relative, name, source_custody): + need(relative in source_custody and _row(root / relative) == source_custody[relative], + 'Fresh data import custody failed: ' + relative) + return adapters.load(root / relative, name) + + +def prepare(root, backend, comparison, extensions, arm, source_custody, packet, *, + authority, cold_caller_descriptor, integration_handles, backend_handle, adapters_handle, setup_handle, + factory_environment, preloaded_cache): + """Both arms load/pay the same complete controls; production installation differs.""" + need(arm in ('baseline', 'candidate'), 'Unsupported data arm') + # Preserve the original preceding field evaluations before source dispatch. + _prepared_backend_source = Path(backend.__file__) + _prepared_comparison_source = Path(comparison.__file__) + _prepared_set_adapter = extensions['set_adapter'] + # BEGIN evaluated dispatch arguments data_adapters:366 + _ca_args = (backend_handle,) + _ca_kwargs = {} + # END evaluated dispatch arguments data_adapters:366 + # BEGIN caller admission data_adapters:366 + _ca_desc = cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission data_adapters:366 + _prepared_backend_source_pin = _ca_dispatch(6, *_ca_args, **_ca_kwargs)[2] + state = {'arm': arm, 'enabled': arm == 'candidate', 'controls': {}, + 'construction_binding': None, 'cache_binding': None, 'row_helper': None, + 'writer': None, 'writer_handle': None, 'backend_derivation': None, + 'runtime_before': None, 'runtime_after': None, 'final_receipt': None, + 'backend_source': _prepared_backend_source, + 'comparison_source': _prepared_comparison_source, 'set_adapter': _prepared_set_adapter, + 'native_packet': packet, 'authority': authority, 'authority_handles': {}, + 'cold_caller_descriptor': cold_caller_descriptor, + 'early_authority_handles': tuple(sorted(integration_handles.items())), + 'cold_authority_input_census': None, + 'backend_handle': backend_handle, 'adapters_handle': adapters_handle, + 'setup_handle': setup_handle, 'backend_source_pin': _prepared_backend_source_pin, + 'factory_environment': factory_environment, 'cache_teardown_attempted': False, + 'cache_teardown_receipt': None, 'cache_teardown_stop': None, 'cleanup_errors': []} + state['owned_states'] = [state] + for key, relative, name in _MODULES: + need(relative in source_custody and _row(root / relative) == source_custody[relative], + 'Fresh data authority import custody failed: ' + relative) + if key == 'cache': + need(type(preloaded_cache) is tuple and len(preloaded_cache) == 2, + 'The original early cache module/handle pair is required') + state[key], state['authority_handles'][key] = preloaded_cache + # BEGIN evaluated dispatch arguments data_adapters:389 + _ca_args = (state['authority_handles'][key],) + _ca_kwargs = {} + # END evaluated dispatch arguments data_adapters:389 + # BEGIN caller admission data_adapters:389 + _ca_desc = cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission data_adapters:389 + admitted = _ca_dispatch(6, *_ca_args, **_ca_kwargs) + need(admitted[0] is state[key] and admitted[1] == str(root / relative) and + admitted[2] == source_custody[relative]['sha256'], + 'The early cache module differs from the actual immutable stage') + else: + # BEGIN evaluated dispatch arguments data_adapters:394 + _ca_args = (str(root / relative), source_custody[relative]['sha256'], name) + _ca_kwargs = {} + # END evaluated dispatch arguments data_adapters:394 + # BEGIN caller admission data_adapters:394 + _ca_desc = cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission data_adapters:394 + state[key], state['authority_handles'][key] = _ca_dispatch(0, *_ca_args, **_ca_kwargs) + return state + + +def isolated_state(prototype, arm): + """Independent mutable scope for bounded controls; code modules may be shared.""" + need(arm in ('baseline', 'candidate'), 'Unsupported isolated data arm') + state = {'arm': arm, 'enabled': arm == 'candidate', 'controls': {}, + 'construction_binding': None, 'cache_binding': None, 'row_helper': None, + 'writer': None, 'writer_handle': None, 'backend_derivation': None, + 'runtime_before': None, 'runtime_after': None, 'final_receipt': None, + 'backend_source': prototype['backend_source'], + 'comparison_source': prototype['comparison_source'], 'set_adapter': prototype['set_adapter']} + state.update({'native_packet': prototype['native_packet'], 'owned_states': prototype['owned_states'], + 'authority': prototype['authority'], 'authority_handles': prototype['authority_handles'], + 'cold_caller_descriptor': prototype['cold_caller_descriptor'], + 'adapters_handle': prototype['adapters_handle'], 'setup_handle': prototype['setup_handle'], + 'backend_source_pin': prototype['backend_source_pin'], 'backend_handle': None, + 'factory_environment': None, + 'cache_teardown_attempted': False, 'cache_teardown_receipt': None, + 'cache_teardown_stop': None, 'cleanup_errors': []}) + state['owned_states'].append(state) + for key, _, _ in _MODULES: + if key in prototype: + state[key] = prototype[key] + return state + + +def require_execution_contract(arm, finite_only): + native_packet.require_execution_contract(arm, finite_only) + + +def _backend(state, suffix): + return adapters.load(state['backend_source'], '_h25_data_backend_' + suffix) + +def _authority_backend(state, suffix): + # Initial stdlib provenance belongs to the original early authority. This + # later fresh backend is raw source-loaded before its scientific exposure. + # BEGIN evaluated dispatch arguments data_adapters:433 + _ca_args = (str(state['backend_source']), state['backend_source_pin'], '_h25_data_authority_backend_' + suffix) + _ca_kwargs = {'kind': 'backend'} + # END evaluated dispatch arguments data_adapters:433 + # BEGIN caller admission data_adapters:433 + _ca_desc = state['cold_caller_descriptor'] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if state['authority'] is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission data_adapters:433 + return _ca_dispatch(0, *_ca_args, **_ca_kwargs) + + + +def capture_factory_environment(state, backend, backend_handle): + """Authenticate each fresh backend before its own scientific exposure.""" + packet = state['native_packet'] + # BEGIN evaluated dispatch arguments data_adapters:441 + _ca_args = (state['authority_handles']['cache'], 'capture_backend_factory_environment', backend) + _ca_kwargs = {'cold_authority': state['authority'], 'cold_caller_descriptor': state['cold_caller_descriptor'], 'backend_handle': backend_handle, 'cache_handle': state['authority_handles']['cache'], 'bootstrap_root': packet['bootstrap_root'], 'bootstrap_capability': packet['bootstrap_capability'], 'bootstrap_api': packet['bootstrap_api']} + # END evaluated dispatch arguments data_adapters:441 + # BEGIN caller admission data_adapters:441 + _ca_desc = state['cold_caller_descriptor'] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if state['authority'] is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission data_adapters:441 + return _ca_dispatch(1, *_ca_args, **_ca_kwargs) + + + +def _check_controls(state, *, include_late=False): + controls = state['controls'] + expected_status = {name: status for name, status in DATA_CONTROL_STATUS.items() + if include_late or name != 'bootstrap_late'} + need(set(controls) == set(expected_status), 'Complete data control union missing') + for name, expected in expected_status.items(): + need(type(controls[name]) is dict and controls[name].get('status') == expected, + 'Data control did not pass: ' + name) + expected_names = _CONTROL_CONTRACT['construction_optimized_names' if sys.flags.optimize else 'construction_normal_names'] + construction = controls['construction'] + need(construction.get('schema') == 'h25-construction-controls-v2' and + construction.get('cases') == len(expected_names) and + construction.get('optimized') is bool(sys.flags.optimize) and + [row['name'] for row in construction.get('controls', [])] == expected_names and + all(row['status'] == 'PASS' for row in construction['controls']), + 'Exact construction control census changed') + serialization = controls['serialization'] + need(serialization.get('case_count') == 70 and serialization.get('optimization') == sys.flags.optimize and + [row['case'] for row in serialization.get('cases', [])] == _CONTROL_CONTRACT['serialization_names'], + 'Exact serialization control census changed') + cache_counts = dict(_CONTROL_CONTRACT['cache_counts'], cases=30, requests=74) + cache = controls['cache_validity'] + need(cache.get('counts') == cache_counts and + type(EXPECTED_CACHE_TRANSCRIPT_RECORDS) is int and + cache.get('transcript_record_count') == EXPECTED_CACHE_TRANSCRIPT_RECORDS and + cache.get('native_consumer_case_count') == 10 and + cache.get('native_consumer_cases') == [ + 'empty-first-result-authority', 'offhash-foreign-key', 'offhash-value-resize', + 'eligible-native-exit-unsupported', 'provider-function-binding', + 'binding-inspect-code', 'binding-inspect-defaults', 'isolated-module-close', + 'teardown-validation-rejection', 'teardown-attempted-native-accounting-rejection'], + 'Exact retained native-consumer control census changed') + need(cache.get('v6_consumer_case_count') == 18 and + len(cache.get('v6_consumer_cases', [])) == 18, 'Exact additive v6 control count changed') + need(type(EXPECTED_V7_CONSUMER_CASES) is tuple and + cache.get('v7_consumer_case_count') == len(EXPECTED_V7_CONSUMER_CASES) and + cache.get('v7_consumer_cases') == list(EXPECTED_V7_CONSUMER_CASES), + 'Exact additive V7 control census is unconfigured or changed') + need(type(EXPECTED_V8_CALLER_CASES) is tuple and + cache.get('v8_caller_case_count') == len(EXPECTED_V8_CALLER_CASES) and + cache.get('v8_caller_cases') == list(EXPECTED_V8_CALLER_CASES), + 'Exact additive V8 caller control census is unconfigured or changed') + authority_controls = controls['cold_authority'] + authority_rows = authority_controls.get('records', []) + need(authority_controls.get('schema') == 'h25-cold-authority-controls-v7' and + type(EXPECTED_AUTHORITY_CONTROL_CASES) is tuple and + authority_controls.get('expected_records') == authority_controls.get('observed_record_count') == len(authority_rows) == 6 and + [row['case'] for row in authority_rows] == list(EXPECTED_AUTHORITY_CONTROL_CASES) and + all(type(row['expected_cases']) is int and type(row['observed_cases']) is int and + row['expected_cases'] == row['observed_cases'] for row in authority_rows) and + authority_controls.get('expected_subcases') == authority_controls.get('observed_subcases') == + sum(row['observed_cases'] for row in authority_rows) and + authority_controls.get('scientific_calls') == authority_controls.get('native_private_calls') == 0, + 'Exact cold authority grouped and derived subcase census changed') + metadata_native = controls['native_metadata'] + need(metadata_native.get('schema') == 'h25-native-metadata-controls-v3' and + metadata_native.get('observed_record_count') == len(metadata_native.get('records', [])) == 16 and + metadata_native.get('native_lifecycle_before') == metadata_native.get('native_lifecycle_after'), + 'Exact additive native metadata control census changed') + need(controls['cache_reference_v3'].get('counts') == cache_counts, + 'Separate bounded v3 reference control census changed') + initial_tcb = controls['native_initial_tcb'] + need(initial_tcb.get('schema') == 'h25-native-tcb-controls-v1' and + len(initial_tcb.get('records', [])) == 5 and initial_tcb.get('expected_records') == 5 and + initial_tcb.get('scientific_calls') == 0 and initial_tcb.get('probe_native_imports') == 0, + 'Initial native TCB control census changed') + native_controls = controls['native_probe'] + need(native_controls.get('records') == 62 and + native_controls['direct'].get('inspection_calls') == 58 and + len(native_controls['direct'].get('records', [])) == 60 and + len(native_controls.get('disarmed', [])) == 1 and len(native_controls.get('bounds', [])) == 1, + 'Native metadata direct/fixture census changed') + need(len(controls['bootstrap_preload'].get('records', [])) == 21 and + controls['bootstrap_preload'].get('scientific_calls') == 0, 'Bootstrap preload census changed') + if include_late: + need(state['native_packet']['late_completed'] is True and + len(controls['bootstrap_late'].get('records', [])) == 1, 'Bootstrap late-last census changed') + metadata = controls['rank_metadata'] + rows, guard, digests = metadata['rows'], metadata['guard'], metadata['digests'] + need(rows['status'] == 'ROW_METADATA_CONTROLS_PASS' and rows['event_fixture_count'] == 8 and + rows['unsupported_cases'] == 9 and rows['table_cap_tested'] == 4096 and rows['callback_events'] == [], + 'Exact immutable-row control census changed') + need(guard['status'] == 'OBSERVATION_GUARD_CONTROLS_PASS' and guard['base_check_calls'] == 43 and + len(guard['mutations']) == 21 and + {row[0] for row in guard['mutations']} == set(_CONTROL_CONTRACT['rank_guard_mutation_names']), + 'Exact observation-guard control census changed') + need(digests['status'] == 'DIGEST_SNAPSHOT_CONTROLS_PASS' and + digests['declared_fixture_bytes'] == 2097172 and digests['same_snapshot_sha_calls'] == 3 and + digests['stream_request_bytes'] == [1048576] * 4 and + digests['read_once_same_snapshot'] is True and digests['fresh_after_mutation'] is True, + 'Exact same-call digest control census changed') + native = controls['rank_native'] + need(native['rank_events'] == 17 and len(native['outcomes']) == 18 and + native['callbacks'] == ['basis.values', 'basis.values'] and + native['counters'] == {'complement_native': 0, 'complement_fallback': 0, + 'gram_native': 14, 'gram_fallback': 4}, + 'Exact native observation control census changed') + need([list(row) for row in controls['inventory']['cases']] == _CONTROL_CONTRACT['inventory_cases'], + 'Exact inventory control census changed') + composition = controls['combined_composition'] + need(composition['height'] == 8 and composition['optimized'] == sys.flags.optimize and + composition['arms'] == ['baseline', 'candidate'] and + set(composition['files']) == {'result.json', 'witness.json', 'rank-trace.json', 'complements.json'} and + composition['production_writer_expected_unchanged'] is True and + composition['production_writer_executed'] is False and composition['full_h25_gate_passed'] is False, + 'Exact bounded composition scope changed') + + +def run_controls(state, native, output, phases, reference_driver, candidate_inventory, extensions): + """Isolated backends: production's finalized class/owner state is untouched.""" + controls = state['controls'] + controls.update(state['native_packet']['controls']) + controls['construction'] = phases.call( + 'data_construction_controls', state['construction_controls'].run_controls, + _backend(state, 'construction_controls'), state['set_adapter'], state['construction']) + comparison = adapters.load(state['comparison_source'], '_h25_data_comparison_controls') + controls['serialization'] = phases.call( + 'data_serialization_controls', state['serialization_controls'].run_controls, + comparison, output / 'serialization-controls') + controls['cache_reference_v3'] = phases.call( + 'data_cache_reference_v3_controls', state['cache_reference_controls'].run_controls, + _backend(state, 'cache_reference_controls'), native, state['cache_reference']) + packet = state['native_packet'] + cache_backend, cache_backend_handle = _authority_backend(state, 'cache_controls') + cache_environment = capture_factory_environment(state, cache_backend, cache_backend_handle) + # BEGIN evaluated dispatch arguments data_adapters:576 + _ca_args = (state['setup_handle'], 'trace_entries', state['authority'], extensions) + _ca_kwargs = {'cold_caller_descriptor': state['cold_caller_descriptor']} + # END evaluated dispatch arguments data_adapters:576 + # BEGIN caller admission data_adapters:576 + _ca_desc = state['cold_caller_descriptor'] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if state['authority'] is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission data_adapters:576 + cache_trace_entries = _ca_dispatch(1, *_ca_args, **_ca_kwargs) + # BEGIN evaluated dispatch arguments data_adapters:579 + _ca_args = (state['setup_handle'], 'compose_guard_stack', state['authority'], cache_backend, cache_backend_handle, extensions['authority_handles']['guard_adapter'], state['adapters_handle'], cache_trace_entries) + _ca_kwargs = {'cold_caller_descriptor': state['cold_caller_descriptor']} + # END evaluated dispatch arguments data_adapters:579 + # BEGIN caller admission data_adapters:579 + _ca_desc = state['cold_caller_descriptor'] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if state['authority'] is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission data_adapters:579 + _ca_dispatch(1, *_ca_args, **_ca_kwargs) + # BEGIN evaluated dispatch arguments data_adapters:585 + _ca_args = (state['authority_handles']['cache_controls'], 'run_controls', cache_backend, native, state['cache'], packet['extension_path'], packet['extension_sha256']) + _ca_kwargs = {'bootstrap_root': packet['bootstrap_root'], 'bootstrap_capability': packet['bootstrap_capability'], 'bootstrap_api': packet['bootstrap_api'], 'cold_authority': state['authority'], 'cold_caller_descriptor': state['cold_caller_descriptor'], 'cache_handle': state['authority_handles']['cache'], 'backend_handle': cache_backend_handle, 'row_handle': state['authority_handles']['rows'], 'row_producer_handle': state['authority_handles']['row_derivation'], 'factory_environment': cache_environment} + # END evaluated dispatch arguments data_adapters:585 + # BEGIN caller admission data_adapters:585 + _ca_desc = state['cold_caller_descriptor'] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if state['authority'] is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission data_adapters:585 + controls['cache_validity'] = phases.call('data_cache_controls', _ca_dispatch, 1, *_ca_args, **_ca_kwargs) + controls['rank_metadata'] = phases.call( + 'data_rank_metadata_controls', state['metadata_controls'].run_controls, + state['rows'], state['digests'], output / 'digest-controls') + reference_backend = _backend(state, 'rank_reference') + candidate_backend = _backend(state, 'rank_candidate') + phases.call('data_control_backend_derivation', state['derive_backend'].install, candidate_backend) + reference_module = reference_backend.load_source('_h25_data_rank_reference') + candidate_module = candidate_backend.load_source('_h25_data_rank_candidate') + reference_calls, candidate_calls = [], [] + helper = state['rows'].make_row_interner() + candidate_backend.RuntimeGuard = state['rows'].make_runtime_guard(candidate_backend.RuntimeGuard, helper) + reference_binding = reference_backend.bind(reference_module, native, reference_calls) + candidate_binding = candidate_backend.bind(candidate_module, native, candidate_calls, rank_row_intern=helper) + reference = {'module': reference_module, 'binding': reference_binding, 'rank_calls': reference_calls} + candidate = {'module': candidate_module, 'binding': candidate_binding, 'rank_calls': candidate_calls} + controls['rank_native'] = phases.call( + 'data_rank_native_controls', state['native_controls'].run_bound_controls, reference, candidate, helper) + reference_inventory = adapters.load(reference_driver, '_h25_data_inventory_reference').inventory + controls['inventory'] = phases.call( + 'data_inventory_controls', state['inventory_controls'].run_controls, + reference_inventory, candidate_inventory, output / 'inventory-controls') + controls['combined_composition'] = phases.call( + 'data_combined_composition_controls', state['composition_controls'].run_controls, + sys.modules[__name__], state, extensions, native, comparison, phases, output / 'composition-controls') + # Generic authority controls use only already registered original products + # plus one fresh metadata-only row helper. Final cache/private row products + # retain their separate V8 consumer controls. + # BEGIN evaluated dispatch arguments data_adapters:621 + _ca_args = (state['authority_handles']['rows'], 'make_row_interner') + _ca_kwargs = {} + # END evaluated dispatch arguments data_adapters:621 + # BEGIN caller admission data_adapters:621 + _ca_desc = state['cold_caller_descriptor'] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if state['authority'] is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission data_adapters:621 + authority_row_helper = _ca_dispatch(1, *_ca_args, **_ca_kwargs) + authority_products = tuple(extensions['authority_product_cases']) + ( + ('fresh-row-helper', authority_row_helper, state['authority_handles']['rows'], + 'make_row_interner', (), {}),) + authority_modules = [('production-backend', state['backend_handle']), + ('cache-control-backend', cache_backend_handle)] + authority_modules.extend(('composition-backend-' + str(index), owned['backend_handle']) + for index, owned in enumerate(state['owned_states'][1:])) + authority_modules.extend(('early-' + name, handle) for name, handle in state['early_authority_handles']) + authority_modules.extend(('setup-' + name, handle) for name, handle in sorted(extensions['authority_handles'].items())) + authority_modules.extend(('data-' + name, handle) for name, handle in sorted(state['authority_handles'].items())) + unique_modules, seen_handles = [], set() + for label, handle in authority_modules: + if id(handle) not in seen_handles: + unique_modules.append((label, handle)) + seen_handles.add(id(handle)) + authority_modules = tuple(unique_modules) + # BEGIN evaluated dispatch arguments data_adapters:639 + _ca_args = (state['authority_handles']['cold_authority_controls'], 'run_controls', state['authority'], state['cold_caller_descriptor'], authority_modules, authority_products) + _ca_kwargs = {} + # END evaluated dispatch arguments data_adapters:639 + # BEGIN caller admission data_adapters:639 + _ca_desc = state['cold_caller_descriptor'] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if state['authority'] is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission data_adapters:639 + controls['cold_authority'] = phases.call('data_cold_authority_controls', _ca_dispatch, 1, *_ca_args, **_ca_kwargs) + state['cold_authority_input_census'] = { + 'module_labels': [label for label, _ in authority_modules], + 'module_handle_count': len(authority_modules), + 'product_labels': [row[0] for row in authority_products], + 'product_count': len(authority_products), + 'product_scope': 'Original P2 guard and trace class plus fresh row helper; final cache/private/final-row controls remain in V8.'} + _check_controls(state) + return controls + + +def _runtime_images(writer): + """Fresh bounded hash reads of actual interpreter/JSON runtime file paths. + + This records file custody, not a claim about arbitrary process memory. The + writer separately checks live module/class/function bindings at entry/exit. + """ + paths = {'python_executable': Path(sys.executable).resolve()} + modules = {} + for owner, _, _ in writer._h25_serialization_bindings: + if type(owner) is ModuleType and owner.__name__ in ('json', 'json.encoder', '_json'): + modules[owner.__name__] = owner + need(set(modules) == {'json', 'json.encoder', '_json'}, 'Actual JSON runtime module census changed') + for name, module in modules.items(): + need(type(module.__file__) is str, 'JSON runtime path missing') + paths[name] = Path(module.__file__).resolve() + result = {} + for name, path in sorted(paths.items()): + need(path.is_file() and not path.is_symlink(), 'JSON runtime image missing') + before = path.stat() + hasher, count = hashlib.sha256(), 0 + with path.open('rb') as stream: + for block in iter(lambda: stream.read(1024 * 1024), b''): + count += len(block) + hasher.update(block) + after = path.stat() + identity = lambda value: (value.st_dev, value.st_ino, value.st_mode, value.st_size, + value.st_mtime_ns, value.st_ctime_ns) + need(identity(before) == identity(after) and count == before.st_size, 'JSON runtime image changed while read') + result[name] = {'path': str(path), 'sha256': hasher.hexdigest(), 'bytes': count, + 'mode': stat.S_IMODE(after.st_mode)} + return result + + +def install_circuit(state, extensions, module, comparison): + """Original P1/cache/construction admission precedes every class mutation.""" + if not state['enabled']: + adapters.install_set(extensions, module) + state['writer'] = comparison.write_scientific + state['writer_handle'] = state['writer'] + return + p1 = state['set_adapter'].bind_verify_map(module) + construction = state['construction'].bind_construction(module) + packet = state['native_packet'] + # BEGIN evaluated dispatch arguments data_adapters:694 + _ca_args = (state['authority_handles']['cache'], 'prepare_cache_contract', module, packet['extension_path'], packet['extension_sha256']) + _ca_kwargs = {'bootstrap_root': packet['bootstrap_root'], 'bootstrap_capability': packet['bootstrap_capability'], 'bootstrap_api': packet['bootstrap_api'], 'factory_environment': state['factory_environment']} + # END evaluated dispatch arguments data_adapters:694 + # BEGIN caller admission data_adapters:694 + _ca_desc = state['cold_caller_descriptor'] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if state['authority'] is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission data_adapters:694 + cache = _ca_dispatch(1, *_ca_args, **_ca_kwargs) + # Register ownership before any class mutation/writer setup can fail. + state['cache_binding'] = cache + original_checks_init = module.Checks.__init__ + capture_checks = p1['owner'].capture_checks + + def captured_checks(self, *args, **kwargs): + result = original_checks_init(self, *args, **kwargs) + capture_checks(self) + return result + + module.Checks.verify_map = p1['verify_map'] + module.ComplexSideCircuit.add = construction['add'] + module.ComplexSideCircuit.__init__ = construction['wrap_constructor']( + construction['original_init'], p1['owner'].capture_c) + module.Checks.__init__ = captured_checks + module.Checks.residual_ok = cache['residual_ok'] + module.Checks.label_ok = cache['label_ok'] + extensions['set_binding'] = p1 + state['construction_binding'], state['cache_binding'] = construction, cache + writer = state['serializer'].make_writer( + comparison.write_scientific, comparison.canonical, comparison.EXPECTED, comparison.require) + need(writer._h25_serialization_faults_enabled is False, 'Production serializer contains test faults') + state['writer'] = state['writer_handle'] = writer + state['runtime_before'] = _runtime_images(writer) + + +def bind_native(state, backend, module, native, rank_calls, complement): + """Call only after every CS/Checks/phase/observer wrapper is final.""" + authority, handles = state['authority'], state['authority_handles'] + if not state['enabled']: + # BEGIN evaluated dispatch arguments data_adapters:729 + _ca_args = (state['backend_handle'], 'bind', module, native, rank_calls, complement) + _ca_kwargs = {} + # END evaluated dispatch arguments data_adapters:729 + # BEGIN caller admission data_adapters:729 + _ca_desc = state['cold_caller_descriptor'] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission data_adapters:729 + return _ca_dispatch(1, *_ca_args, **_ca_kwargs) + # BEGIN evaluated dispatch arguments data_adapters:730 + _ca_args = (handles['rows'], 'make_row_interner') + _ca_kwargs = {} + # END evaluated dispatch arguments data_adapters:730 + # BEGIN caller admission data_adapters:730 + _ca_desc = state['cold_caller_descriptor'] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission data_adapters:730 + helper = _ca_dispatch(1, *_ca_args, **_ca_kwargs) + state['row_helper'] = helper + # BEGIN evaluated dispatch arguments data_adapters:732 + _ca_args = (handles['cache'], 'compose_runtime_guard', backend.RuntimeGuard, state['cache_binding']) + _ca_kwargs = {} + # END evaluated dispatch arguments data_adapters:732 + # BEGIN caller admission data_adapters:732 + _ca_desc = state['cold_caller_descriptor'] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission data_adapters:732 + cache_guard = _ca_dispatch(1, *_ca_args, **_ca_kwargs) + # BEGIN evaluated dispatch arguments data_adapters:734 + _ca_args = (handles['rows'], 'make_cache_runtime_guard', cache_guard, helper) + _ca_kwargs = {} + # END evaluated dispatch arguments data_adapters:734 + # BEGIN caller admission data_adapters:734 + _ca_desc = state['cold_caller_descriptor'] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission data_adapters:734 + final_guard = _ca_dispatch(1, *_ca_args, **_ca_kwargs) + # BEGIN evaluated dispatch arguments data_adapters:735 + _ca_args = (state['backend_handle'], final_guard) + _ca_kwargs = {} + # END evaluated dispatch arguments data_adapters:735 + # BEGIN caller admission data_adapters:735 + _ca_desc = state['cold_caller_descriptor'] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission data_adapters:735 + _ca_dispatch(5, *_ca_args, **_ca_kwargs) + # BEGIN evaluated dispatch arguments data_adapters:736 + _ca_args = (handles['cache'], 'bind_cache_backend', backend, module, native, state['cache_binding'], state['factory_environment']) + _ca_kwargs = {'row_producer_handle': handles['row_derivation'], 'row_handle': handles['rows'], 'rank_row_intern': helper, 'final_guard': final_guard, 'rank_calls': rank_calls, 'complement_trace': complement} + # END evaluated dispatch arguments data_adapters:736 + # BEGIN caller admission data_adapters:736 + _ca_desc = state['cold_caller_descriptor'] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission data_adapters:736 + result = _ca_dispatch(1, *_ca_args, **_ca_kwargs) + state['backend_derivation'] = state['cache_binding']['owner'].binding_derivation + return result + + +def seal(state): + if state['enabled']: + state['construction_binding']['owner'].seal() + + +def arm(state, extensions): + if state['enabled']: + # Fresh Fraction/source/class check immediately before optimized + # construction; the original later P1 check remains unchanged. + need(extensions['set_binding']['owner']._fresh(), 'Fresh original P1 environment required before construction') + state['construction_binding']['owner'].arm_cli() + adapters.arm(extensions) + + +def scientific_writer(state): + need(state['writer'] is state['writer_handle'], 'Scientific writer binding changed') + return state['writer_handle'] + + +def finite_receipt(state): + _check_controls(state, include_late=True) + return {'schema': 'h25-data-handling-v2', 'enabled': state['enabled'], 'arm': state['arm'], + 'controls': state['controls'], 'full_caller_run': False, + 'cold_authority_input_census': state['cold_authority_input_census'], + 'full_candidate_admission': False, + 'native_packet': native_packet.receipt(state['native_packet']), + 'cache_teardown_stops': [item['cache_teardown_stop'] for item in state['owned_states'] + if item['cache_teardown_stop'] is not None], + 'admission_hold': 'Final cache V8 complete cost and caller equality are unqualified; source/execution/funding gates remain separate'} + + +def finish(state, binding): + """After exact outputs and original source checks; cleanup remains timed.""" + _check_controls(state) + binding['runtime_guard'].check() + if not state['enabled']: + result = {'schema': 'h25-data-handling-v2', 'enabled': False, 'arm': 'baseline', + 'controls': state['controls'], 'full_caller_run': True} + else: + writer = scientific_writer(state) + need(writer._h25_serialization_faults_enabled is False and + type(writer.last_operation) is dict and + writer.last_operation.get('status') == 'BOUNDED_SERIALIZATION_PASS', + 'Complete candidate did not use the bounded scientific writer') + state['runtime_after'] = _runtime_images(writer) + need(state['runtime_after'] == state['runtime_before'], 'JSON runtime image custody changed') + construction = state['construction_binding']['owner'].finish() + cache = teardown_cache(state) + need(cache['teardowns'] == 1 and cache['current_authority_entries'] == 0, + 'Cache private state cleanup incomplete') + result = {'schema': 'h25-data-handling-v2', 'enabled': True, 'arm': 'candidate', + 'controls': state['controls'], 'full_caller_run': True, + 'construction': construction, 'cache_validity': cache, + 'serialization': writer.last_operation, + 'rank_observation': {'native_success_only': True, 'collector': 'exact built-in list', + 'table_entry_cap': 4096, 'rank_answers_cached': False}, + 'backend_derivation': state['backend_derivation'], + 'serialization_runtime_files': state['runtime_before']} + result['cold_authority_input_census'] = state['cold_authority_input_census'] + state['final_receipt'] = result + return result + + +def transport(root, baseline, output): + """Original bounded historical artifact transport; no scientific imports.""" + need(sys.flags.optimize == 0, 'Transport requires original assertions enabled') + output = output.resolve() + need(not output.exists() and not output.is_relative_to(root), 'Fresh external transport evidence required') + original_before = adapters.custody(root, 'all') + data_before = custody(root) + manifest = _manifest(root) + baseline_names = {name for name in manifest['files'] if name.startswith('baseline/')} + need(baseline_names, 'Historical transport closure absent') + before = {} + for name in sorted(baseline_names): + observed = _row(root / name) + need(observed == manifest['files'][name], 'Historical transport stage custody failed: ' + name) + before[name] = observed + checker_path = baseline / 'check_artifacts.py' + checker_name = checker_path.relative_to(root).as_posix() + need(checker_name in before and _row(checker_path) == before[checker_name], + 'Fresh historical checker source admission failed') + checker = adapters.load(checker_path, '_h25_data_historical_transport') + old_argv = sys.argv + try: + sys.argv = [str(checker_path)] + checker.main() + finally: + sys.argv = old_argv + for name, expected in before.items(): + need(_row(root / name) == expected, 'Historical transport closure changed: ' + name) + need(adapters.custody(root, 'all') == original_before and custody(root) == data_before, + 'Transport integration source custody changed') + need(_manifest(root) == manifest, 'Transport stage manifest changed') + output.mkdir(parents=True) + receipt = {'schema': 'h25-data-handling-transport-v1', 'status': 'H25_DATA_HANDLING_TRANSPORT_PASS', + 'mode': 'transport', 'optimized': sys.flags.optimize, + 'historical_checker_sha256': before[checker_name]['sha256'], + 'scientific_cli_run': False, 'native_build_run': False, + 'new_source_custody': original_before, 'data_source_custody': data_before} + (output / 'receipt.json').write_text(json.dumps(receipt, indent=2, sort_keys=True) + '\n') + print(json.dumps(receipt, sort_keys=True)) + return receipt + + +def teardown_cache(state): + """Exactly one terminal attempt; retain actual owner's diagnostic on failure.""" + if state['cache_binding'] is None: + return None + need(not state['native_packet']['late_started'], 'Cache teardown forbidden after late audit control') + need(not state['cache_teardown_attempted'], 'Cache teardown already attempted') + state['cache_teardown_attempted'] = True + owner = state['cache_binding']['owner'] + try: + receipt = owner.teardown() + except BaseException: + # Copy only the JSON-ready diagnostic; never manufacture missing counters. + try: + state['cache_teardown_stop'] = owner.teardown_stop + except BaseException as diagnostic_error: + state['cleanup_errors'].append({'stage': 'read-owner-teardown-stop', + 'type': type(diagnostic_error).__name__}) + raise + state['cache_teardown_receipt'] = receipt + return receipt + + +def cleanup_owned(state): + """Failure-path cleanup, preserving primary exceptions and every STOP record.""" + if state is None or state['native_packet']['late_started']: + return [] + errors = [] + for owned in reversed(state['owned_states']): + if owned['cache_binding'] is not None and not owned['cache_teardown_attempted']: + try: + teardown_cache(owned) + except BaseException as error: + item = {'type': type(error).__name__, 'message': str(error), + 'arm': owned['arm'], 'cache_teardown_stop': owned['cache_teardown_stop']} + owned['cleanup_errors'].append(item) + errors.append(item) + return errors + + +def finish_before_late(state): + """Finish every owner and native qualification before adding the late hook.""" + _check_controls(state) + errors = cleanup_owned(state) + need(not errors, 'Terminal native/cache cleanup failed; retained STOP diagnostics required') + need(all(owned['cache_binding'] is None or owned['cache_teardown_attempted'] + for owned in state['owned_states']), 'An owned native cache remains live') + native_packet.before_late(state['native_packet']) + + +def finish_late_last(state): + """No native/scientific API, guard, or owner call is permitted after this.""" + state['controls']['bootstrap_late'] = native_packet.late_last(state['native_packet']) + _check_controls(state, include_late=True) # Pure control-result validation only. + if state['final_receipt'] is not None: + state['final_receipt']['native_packet'] = native_packet.receipt(state['native_packet']) + return None + + +def stop_diagnostics(state): + """Pure recorded evidence, safe after the deliberately terminal late control.""" + if state is None: + return None + return {'controls_completed': sorted(state['controls']), + 'native_packet': native_packet.receipt(state['native_packet']), + 'owners': [{'arm': item['arm'], 'teardown_attempted': item['cache_teardown_attempted'], + 'teardown_receipt': item['cache_teardown_receipt'], + 'teardown_stop': item['cache_teardown_stop'], 'cleanup_errors': item['cleanup_errors']} + for item in state['owned_states']]} + + +# Appended to the unchanged legacy data adapter. Legacy install/bind/control APIs stay intact. +import types as _epoch_data_types + + +def _epoch_data_dispatch(state,descriptor,index,*args,**kwargs): + need(type(state) is dict and all(type(k) is str for k in state),'Epoch source state domain') + legacy=state['cold_caller_descriptor'];p=legacy[5];dispatch=legacy[2];record=legacy[3] + need(type(p) is tuple and len(p)==19 and p[0] is type and p[1] is _epoch_data_types.FunctionType and p[2] is id, + 'Epoch legacy native caller primitives') + if dispatch is not record[0] or type(dispatch) is not p[1]:raise RuntimeError('Epoch legacy dispatcher identity') + for (_,getter),expected in zip(p[4],record[1:7]): + if getter(dispatch,p[1]) is not expected:raise RuntimeError('Epoch legacy dispatcher fields') + for cell,expected in record[8]: + if p[6](cell,p[5]) is not expected:raise RuntimeError('Epoch legacy dispatcher cell') + dispatch(2) + # New authority dispatcher checks this exact immutable bootstrap transport at + # each invocation before target entry; the read is inside that closed scope. + authority=state['authority'];need(authority is legacy[1] and len(authority)==7,'Epoch legacy source tuple') + attrs=_epoch_data_types.FunctionType.__dict__['__dict__'].__get__(authority[0],_epoch_data_types.FunctionType) + bundle=attrs.get('_h25_epoch_bundle') + need(type(bundle) is tuple and len(bundle)==4 and bundle[0]=='h25-cold-authority-epoch-bundle-v1' and + bundle[1] is authority and bundle[3] is descriptor,'Epoch actual initial bundle transport') + p=descriptor[5];dispatch=descriptor[2];record=descriptor[3] + need(type(p) is tuple and len(p)==19 and p[0] is type and p[1] is _epoch_data_types.FunctionType and p[2] is id,'Epoch native caller primitives') + if dispatch is not record[0] or type(dispatch) is not p[1]:raise RuntimeError('Epoch dispatcher identity') + for (_,getter),expected in zip(p[4],record[1:7]): + if getter(dispatch,p[1]) is not expected:raise RuntimeError('Epoch dispatcher fields') + for cell,expected in record[8]: + if p[6](cell,p[5]) is not expected:raise RuntimeError('Epoch dispatcher cell') + return dispatch(index,*args,**kwargs) + + +def _epoch_cache_invoke(state,export,*args,**kwargs): + descriptor=state['cold_caller_descriptor'];p=descriptor[5];dispatch=descriptor[2];rec=descriptor[3] + need(type(export) is str and type(p) is tuple and p[0] is type and p[1] is _epoch_data_types.FunctionType and p[2] is id,'Epoch source cache export') + if dispatch is not rec[0] or type(dispatch) is not p[1]:raise RuntimeError('Epoch cache dispatcher identity') + for (_,getter),expected in zip(p[4],rec[1:7]): + if getter(dispatch,p[1]) is not expected:raise RuntimeError('Epoch cache dispatcher fields') + for cell,expected in rec[8]: + if p[6](cell,p[5]) is not expected:raise RuntimeError('Epoch cache dispatcher cell') + return dispatch(1,state['authority_handles']['cache'],export,*args,**kwargs) + + +def epoch_load(state,descriptor): + return _epoch_data_dispatch(state,descriptor,0,'load',state['backend_handle']) + + +def install_epoch_circuit(state,extensions,module,comparison,descriptor,load_ticket,context): + """New production-only export. All legacy isolated/control callers use install_circuit.""" + need(state['enabled'] is True,'Epoch candidate-owned installation only') + packet=state['native_packet'] + need(state['cache_binding'] is None and 'epoch_acquisition' not in state,'Epoch fresh acquisition disposition') + state['epoch_acquisition']={'phase':'BEFORE_ACQUISITION','prepared':None,'owner':None,'probe_binding':None, + 'close_attempted':False,'close_result':None,'primary':None,'secondary':None,'uncertain':False, + 'published':False,'origin_handle':None} + handle,p1,construction,cache=_epoch_data_dispatch(state,descriptor,0,'factories',load_ticket, + extensions['authority_handles']['set_adapter'],state['authority_handles']['construction'], + state['authority_handles']['cache'],(packet['extension_path'],packet['extension_sha256']), + {'bootstrap_root':packet['bootstrap_root'],'bootstrap_capability':packet['bootstrap_capability'], + 'bootstrap_api':packet['bootstrap_api'],'factory_environment':state['factory_environment']},context) + need(state['cache_binding'] is cache and state['epoch_acquisition']['prepared'] is cache,'Epoch continuous acquisition handoff') + suite=_epoch_data_dispatch(state,descriptor,1,handle,context) + state['epoch_suite']=suite;state['epoch_descriptor']=descriptor + _epoch_cache_invoke(state,'epoch_suite_call',suite,0) + original_checks_init=module.Checks.__init__ + capture_checks=p1['owner'].capture_checks + def captured_checks(self,*args,**kwargs): + result=original_checks_init(self,*args,**kwargs) + capture_checks(self) + return result + _epoch_cache_invoke(state,'epoch_suite_call',suite,1,'checks','verify_map','p1',p1['verify_map']) + _epoch_cache_invoke(state,'epoch_suite_call',suite,1,'circuit','add','construction_add',construction['add']) + _epoch_cache_invoke(state,'epoch_suite_call',suite,2) + _epoch_cache_invoke(state,'epoch_suite_call',suite,1,'checks','__init__','checks_capture',captured_checks) + _epoch_cache_invoke(state,'epoch_suite_call',suite,1,'checks','residual_ok','public_residual',cache['residual_ok']) + _epoch_cache_invoke(state,'epoch_suite_call',suite,1,'checks','label_ok','public_label',cache['label_ok']) + extensions['set_binding']=p1 + state['construction_binding'],state['cache_binding']=construction,cache + writer=state['serializer'].make_writer(comparison.write_scientific,comparison.canonical,comparison.EXPECTED,comparison.require) + need(writer._h25_serialization_faults_enabled is False,'Production serializer contains test faults') + state['writer']=state['writer_handle']=writer + state['runtime_before']=_runtime_images(writer) + return suite + + +def epoch_phase_wrap(state,phases,kind,owner,attribute,name): + suite=state['epoch_suite'] + return _epoch_cache_invoke(state,'epoch_suite_call',suite,3,phases,kind,owner,attribute,name) + + +def epoch_role_observer(state,function): + return _epoch_cache_invoke(state,'epoch_suite_call',state['epoch_suite'],1, + 'module','verify_role_frames','roles_observer',function) + + +def epoch_seal(state): + return _epoch_cache_invoke(state,'epoch_suite_call',state['epoch_suite'],5) + + +def epoch_arm(state,invocation_token): + return _epoch_cache_invoke(state,'epoch_suite_call',state['epoch_suite'],4,invocation_token) + + +def epoch_retire(state,reason,primary=None,secondary=None,restoration_error=None,error_channel=None,cleanup_scope=None): + if state is None:return None + record=state.get('epoch_acquisition') + if record is not None and primary is not None and record['primary'] is None:record['primary']=primary + if record is not None and restoration_error is not None and restoration_error is not primary: + if record['secondary'] is None:record['secondary']=restoration_error + record['uncertain']=True + if record is not None and secondary is not None and secondary is not primary: + if record['secondary'] is None:record['secondary']=secondary + record['uncertain']=True + suite=state.get('epoch_suite') + if suite is None:return None + if primary is not None and suite.primary_error is None:suite.primary_error=primary + if restoration_error is not None and restoration_error is not primary: + if suite.secondary_error is None:suite.secondary_error=restoration_error + suite.uncertain=True + if secondary is not None and secondary is not primary: + if suite.secondary_error is None:suite.secondary_error=secondary + suite.uncertain=True + try:suite.secondary.append(secondary) + except BaseException:pass + # Retirement is source-only plain metadata disposal, not a late native check. + cleanup=state.get('epoch_cli_cleanup') + scope=('outer' if error_channel is None else 'inner') if cleanup_scope is None else cleanup_scope + need(type(scope) is str and scope in ('inner','outer'),'Epoch exact retirement scope') + outer=scope=='outer' + if error_channel is not None:channel=error_channel + elif cleanup is not None:channel=cleanup['outer_retirement_channel' if outer else 'retirement_channel'] + else:channel=suite.outer_retirement_channel if outer else suite.inner_retirement_channel + try:return suite.retire_preserving(reason,primary,channel) + finally: + # Every declared attempt has its own channel and fixed R/J handoff. + # No ACKed channel is cleared, reused or inferred from journal growth. + if outer: + suite.outer_retirement_error=channel['error'];suite.outer_journal_error=channel['journal_error'] + else: + suite.inner_retirement_error=channel['error'];suite.inner_journal_error=channel['journal_error'] + if cleanup is not None and channel['error'] is not None: + name='outer_retirement_error' if outer else 'retirement_error' + if cleanup[name] is None:cleanup[name]=channel['error'] + cleanup['uncertain']=True + channel['acknowledged']=True + + + +def epoch_stop_diagnostics(state): + result=stop_diagnostics(state) + if state is not None and state.get('epoch_suite') is not None: + suite=state['epoch_suite'] + result=dict(result) + result['epoch']={'receipt':dict(suite.receipt),'active':suite.active,'terminal':suite.terminal, + 'pending':suite.pending is not None,'registry_entries':len(suite.registry), + 'secondary_types':[type(error).__name__ for error in suite.secondary], + 'uncertain':suite.uncertain,'primary_type':None if suite.primary_error is None else type(suite.primary_error).__name__, + 'first_secondary_type':None if suite.secondary_error is None else type(suite.secondary_error).__name__, + 'inner_retirement_type':None if suite.inner_retirement_error is None else type(suite.inner_retirement_error).__name__, + 'inner_journal_type':None if suite.inner_journal_error is None else type(suite.inner_journal_error).__name__, + 'outer_retirement_type':None if suite.outer_retirement_error is None else type(suite.outer_retirement_error).__name__, + 'outer_journal_type':None if suite.outer_journal_error is None else type(suite.outer_journal_error).__name__, + 'runtime_or_resource_admitted':False} + if state is not None and state.get('epoch_acquisition') is not None: + record=state['epoch_acquisition'];result=dict(result) + result['epoch_acquisition']={'phase':record['phase'],'published':record['published'], + 'close_attempted':record['close_attempted'],'uncertain':record['uncertain'], + 'primary_type':None if record['primary'] is None else type(record['primary']).__name__, + 'secondary_type':None if record['secondary'] is None else type(record['secondary']).__name__, + 'actual_close_result_retained':record['close_result'] is not None, + 'owner_acquisition_does_not_grant_provenance':True} + if state is not None and state.get('epoch_cli_cleanup') is not None: + record=state['epoch_cli_cleanup'];result=dict(result) + result['epoch_cli_cleanup']={'primary_type':None if record['primary'] is None else type(record['primary']).__name__, + 'argv_error_type':None if record['argv_error'] is None else type(record['argv_error']).__name__, + 'disarm_error_type':None if record['disarm_error'] is None else type(record['disarm_error']).__name__, + 'retirement_error_type':None if record['retirement_error'] is None else type(record['retirement_error']).__name__, + 'outer_retirement_error_type':None if record['outer_retirement_error'] is None else type(record['outer_retirement_error']).__name__, + 'retirement_journal_error_type':None if record['retirement_channel']['journal_error'] is None else type(record['retirement_channel']['journal_error']).__name__, + 'raw_retirement_acknowledged':record['retirement_channel']['acknowledged'], + 'uncertain':record['uncertain']} + return result + + +def epoch_driver_entry(authority,legacy_descriptor,epoch_descriptor,function,phase_class,invocation_token): + """Mint the initial driver record through the source-owned authority.""" + return _epoch_data_dispatch({'authority':authority,'cold_caller_descriptor':legacy_descriptor}, + epoch_descriptor,0,'driver_entry',function,phase_class,invocation_token) + + +def epoch_cleanup_owned(state): + """Pending/acquired owners remain on the original parent cleanup path.""" + if state is None or state['native_packet']['late_started']:return [] + errors=[] + for owned in reversed(state['owned_states']): + record=owned.get('epoch_acquisition') + if record is None or owned['cache_binding'] is None or owned['cache_teardown_attempted']:continue + record['close_attempted']=True;record['phase']='PARENT_CLOSE_ATTEMPTING' + try: + teardown_cache(owned) + except BaseException as secondary: + if record['secondary'] is None:record['secondary']=secondary + record['uncertain']=True;record['phase']='PARENT_CLOSE_FAILED' + # Retain the raw error before any evidence formatting/allocation. + item={'type':type(secondary).__name__,'arm':owned['arm'],'cache_teardown_stop':owned['cache_teardown_stop']} + owned['cleanup_errors'].append(item);errors.append(item) + else: + record['close_result']=owned['cache_teardown_receipt'];record['phase']='PARENT_TEARDOWN_RETURNED' + errors.extend(cleanup_owned(state)) # legacy owners; attempted epoch owner is skipped + return errors + + + +def bind_epoch_native(state, backend, module, native, rank_calls, complement): + """Call only after every CS/Checks/phase/observer wrapper is final.""" + need(state['enabled'] is True and state.get('epoch_suite') is not None, 'Epoch genuine candidate bind path required') + authority, handles = (state['authority'], state['authority_handles']) + if not state['enabled']: + _ca_args = (state['backend_handle'], 'bind', module, native, rank_calls, complement) + _ca_kwargs = {} + _ca_desc = state['cold_caller_descriptor'] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + return _ca_dispatch(1, *_ca_args, **_ca_kwargs) + _ca_args = (handles['rows'], 'make_row_interner') + _ca_kwargs = {} + _ca_desc = state['cold_caller_descriptor'] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + helper = _ca_dispatch(1, *_ca_args, **_ca_kwargs) + state['row_helper'] = helper + _ca_args = (handles['cache'], 'compose_runtime_guard', backend.RuntimeGuard, state['cache_binding']) + _ca_kwargs = {} + _ca_desc = state['cold_caller_descriptor'] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + cache_guard = _ca_dispatch(1, *_ca_args, **_ca_kwargs) + cache_guard = _epoch_cache_invoke(state, 'compose_epoch_runtime_guard', cache_guard, state['epoch_suite']) + _ca_args = (handles['rows'], 'make_cache_runtime_guard', cache_guard, helper) + _ca_kwargs = {} + _ca_desc = state['cold_caller_descriptor'] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + final_guard = _ca_dispatch(1, *_ca_args, **_ca_kwargs) + _ca_args = (state['backend_handle'], final_guard) + _ca_kwargs = {} + _ca_desc = state['cold_caller_descriptor'] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + _ca_dispatch(5, *_ca_args, **_ca_kwargs) + _ca_args = (handles['cache'], 'bind_epoch_cache_backend', backend, module, native, state['cache_binding'], state['factory_environment']) + _ca_kwargs = {'row_producer_handle': handles['row_derivation'], 'row_handle': handles['rows'], 'rank_row_intern': helper, 'final_guard': final_guard, 'rank_calls': rank_calls, 'complement_trace': complement, 'epoch_assembler': state['epoch_suite'].assembler} + _ca_desc = state['cold_caller_descriptor'] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + result = _ca_dispatch(1, *_ca_args, **_ca_kwargs) + state['backend_derivation'] = state['cache_binding']['owner'].binding_derivation + return result diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-epoch-products-v5/epoch_scientific_driver_v1.py.txt b/research/h25-cache-source-handoff/snapshot/areas/cache-epoch-products-v5/epoch_scientific_driver_v1.py.txt new file mode 100644 index 0000000000..3ae194abcc --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-epoch-products-v5/epoch_scientific_driver_v1.py.txt @@ -0,0 +1,1270 @@ +#!/usr/bin/env python3 +"""One complete frozen complex-network CLI with retained exact observations. + +Parent-owned serial wall/RSS/aggregate guard is mandatory. Profile mode is one +literal baseline diagnostic/anchor, not a performance sample. Both benchmark +modes require its immutable anchor. No search, retry, orchestration or network. +""" +from __future__ import annotations + +# Actual source-authenticated root injects these three values before driver exec. +# Capture them before importing any candidate, scientific, or orchestration code. +_CAPTURED_BOOTSTRAP_ROOT = bootstrap_root +_CAPTURED_BOOTSTRAP_CAPABILITY = bootstrap_capability +_CAPTURED_BOOTSTRAP_API = bootstrap_api +if type(_CAPTURED_BOOTSTRAP_API) is not tuple or len(_CAPTURED_BOOTSTRAP_API) != 4: + raise RuntimeError('Driver requires the parent-sealed exact four-entry bootstrap API') +_INITIAL_ROOT_IDENTITY = _CAPTURED_BOOTSTRAP_API[0]() +if (type(_CAPTURED_BOOTSTRAP_ROOT) is not _CAPTURED_BOOTSTRAP_ROOT.ModuleType or + any(type(entry) is not _CAPTURED_BOOTSTRAP_ROOT.FunctionType or + entry.__globals__ is not _CAPTURED_BOOTSTRAP_ROOT.__dict__ + for entry in _CAPTURED_BOOTSTRAP_API)): + raise RuntimeError('Driver bootstrap API is not bound to the actual root namespace') + +# Accepted helper/control sources and parent-inspected native dependency tuple. +# These are static expected pins; finite and full execution gates remain closed. +EXPECTED_BOOTSTRAP_ROOT_SHA256 = 'f5a2d33f2b4d3651f214156a0e7094c2bb516ce2d5ab7698d18c11f98f35dee0' +NATIVE_TCB_HELPER_SHA256 = '865943df5cfdbf9383362d7fb2b76c6d0fd895cf0a0e20d550a26b579606b5d7' +NATIVE_TCB_CONTROLS_SHA256 = '63b1804caa7f89915662a1424f788c3becad13520e1f63212a338fb45aaa2c5a' +NATIVE_TCB_EXPECTED_FILES = (('/usr/bin/python3.12', 'e50d468e8b0adfb05733f5b87b3cff34829c4a8c1aea50c865aa8bdfe4bb150f', 8020928), + ('/usr/lib/python3.12/lib-dynload/_hashlib.cpython-312-x86_64-linux-gnu.so', + '8dc6cda6dd9495b95a2bfb5b26e8cf06b72f36dc0213d958b9277a958287f0fe', + 64368), + ('/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2', + 'c20a2dc8917c755f02b94049356320fe1f62ac7d9f8994731f807d9df39302da', + 236616), + ('/usr/lib/x86_64-linux-gnu/libc.so.6', + '3a15d66867d83762c7f2f1e37359cb8f6c5743edb369c65285cb0b1c4f7498bf', + 2129424), + ('/usr/lib/x86_64-linux-gnu/libcrypto.so.3', + '6866ed711dab8927e1bf82bf1cd30e828bdfc34f3cc1e83b1c9eb01ce6c37d9a', + 5309400), + ('/usr/lib/x86_64-linux-gnu/libexpat.so.1.9.1', + '286682ecbc5e59a638963b1a4e6351e65eb32fcf4bdcb9cb7569b6a61fe06a8d', + 186624), + ('/usr/lib/x86_64-linux-gnu/libm.so.6', + 'fce00b6f25f459cf4ae0b7fae4257909a1a8a86f9149e7c029a5d617baf1ccd0', + 952616), + ('/usr/lib/x86_64-linux-gnu/libz.so.1.3', + 'f61677c7bdb7c2aa2a243ea781bfd16afcb361cede7b4ef76127a9d8eb9a5242', + 113000)) +NATIVE_TCB_EXPECTED_HASHLIB_ORIGIN = '/usr/lib/python3.12/lib-dynload/_hashlib.cpython-312-x86_64-linux-gnu.so' + + +def _initial_native_tcb(): + root, api = _CAPTURED_BOOTSTRAP_ROOT, _CAPTURED_BOOTSTRAP_API + if (type(EXPECTED_BOOTSTRAP_ROOT_SHA256) is not str or + _INITIAL_ROOT_IDENTITY != EXPECTED_BOOTSTRAP_ROOT_SHA256 or + type(NATIVE_TCB_HELPER_SHA256) is not str or len(NATIVE_TCB_HELPER_SHA256) != 64 or + type(NATIVE_TCB_EXPECTED_FILES) is not tuple or + type(NATIVE_TCB_EXPECTED_HASHLIB_ORIGIN) is not str): + raise RuntimeError('Initial native TCB source and expected dependency tuple are not configured') + helper_path = __file__.rsplit('/', 2)[0] + '/areas/cache-validity/probe-native/native_tcb_v1.py' + api[0]() + digest, _, source = root._hash_regular(helper_path, 262144, True) + if digest != NATIVE_TCB_HELPER_SHA256: + raise RuntimeError('Initial native TCB helper source differs') + helper = root.ModuleType('_h25_initial_native_tcb') + namespace = helper.__dict__ + namespace.update({'__file__': helper_path, '__builtins__': root.builtins.__dict__}) + api[0]() + code = root._COMPILE(source, helper_path, 'exec', dont_inherit=True, optimize=root._OPTIMIZE) + api[0]() + root._EXEC(code, namespace) + api[0]() + receipt = namespace['verify_native_tcb'](root, api, NATIVE_TCB_EXPECTED_FILES, + NATIVE_TCB_EXPECTED_HASHLIB_ORIGIN) + if type(NATIVE_TCB_CONTROLS_SHA256) is not str or len(NATIVE_TCB_CONTROLS_SHA256) != 64: + raise RuntimeError('Initial native TCB control source pin is not configured') + control_path = __file__.rsplit('/', 2)[0] + '/areas/cache-validity/probe-native/native_tcb_controls_v1.py' + api[0]() + digest, _, control_source = root._hash_regular(control_path, 262144, True) + if digest != NATIVE_TCB_CONTROLS_SHA256: + raise RuntimeError('Initial native TCB controls source differs') + control_namespace = {'__name__': '_h25_initial_native_tcb_controls', '__file__': control_path, + '__builtins__': root.builtins.__dict__} + api[0]() + control_code = root._COMPILE(control_source, control_path, 'exec', dont_inherit=True, optimize=root._OPTIMIZE) + api[0]() + root._EXEC(control_code, control_namespace) + argv = root.sys.argv + if (type(argv) is not list or any(type(arg) is not str for arg in argv) or + argv.count('--output') != 1 or argv.index('--output') + 1 >= len(argv)): + raise RuntimeError('Early TCB controls require the unique parent --output argument') + output = argv[argv.index('--output') + 1] + stage_root = __file__.rsplit('/', 2)[0] + if (not output.startswith('/') or output.endswith('/') or + any(part in ('', '.', '..') for part in output.split('/')[1:]) or + output == stage_root or output.startswith(stage_root + '/')): + raise RuntimeError('Early TCB controls require a canonical absolute output outside the stage') + # Parent owns an existing nonsymlink output parent. mkdir is exclusive: + # a preexisting output, file, or symlink is rejected before any fixture write. + api[0]() + root.posix.mkdir(output, 0o700) + control_directory = output + '/initial-tcb-controls' + root.posix.mkdir(control_directory, 0o700) + api[0]() + controls = control_namespace['run_controls']( + helper, root, api, NATIVE_TCB_EXPECTED_FILES, NATIVE_TCB_EXPECTED_HASHLIB_ORIGIN, control_directory) + if (controls.get('schema') != 'h25-native-tcb-controls-v1' or + controls.get('expected_records') != 5 or len(controls.get('records', [])) != 5 or + controls.get('scientific_calls') != 0 or controls.get('probe_native_imports') != 0): + raise RuntimeError('Initial native TCB control census differs') + controls['status'] = 'NATIVE_INITIAL_TCB_CONTROLS_PASS' + return receipt, controls, output + + +# Child outer wall/CPU/RSS includes this entire initial trust check. +# It assumes the declared trusted OS/native startup; it does not prove itself. +INITIAL_NATIVE_TCB_RECEIPT, INITIAL_NATIVE_TCB_CONTROLS, _INITIAL_OUTPUT = _initial_native_tcb() + +# This independent bootstrap support captures the initial system-stdlib +# continuity boundary before any adapter or scientific module is exposed. +# No late candidate-created snapshot is accepted as initial authentication. +COLD_AUTHORITY_SHA256 = 'f279ab86fc17c6a517b035f19d56863919cbd8304de4e7d5332457c6159aec10' + + +def _initial_cold_authority(): + root, cap, api = (_CAPTURED_BOOTSTRAP_ROOT, _CAPTURED_BOOTSTRAP_CAPABILITY, + _CAPTURED_BOOTSTRAP_API) + if type(COLD_AUTHORITY_SHA256) is not str or len(COLD_AUTHORITY_SHA256) != 64: + raise RuntimeError('Initial cold authority source pin is not configured') + source_path = __file__.rsplit('/', 2)[0] + '/areas/cache-validity/cold_authority_v7.py' + api[0]() + digest, _, source = root._hash_regular(source_path, 1048576, True) + if digest != COLD_AUTHORITY_SHA256: + raise RuntimeError('Initial cold authority source differs') + module = root.ModuleType('_h25_initial_cold_authority') + namespace = module.__dict__ + namespace.update({'__file__': source_path, '__builtins__': root.builtins.__dict__}) + api[0]() + code = root._COMPILE(source, source_path, 'exec', dont_inherit=True, optimize=root._OPTIMIZE) + api[0]() + root._EXEC(code, namespace) + # The actual source bytes have just executed under the admitted initial + # interpreter/system-stdlib premise. Capture precedes every candidate import. + api[0]() + bundle = namespace['capture_epoch_authority'](root, cap, api); authority = bundle[1] + if (type(authority) is not tuple or len(authority) != 7 or + any(type(entry) is not root.FunctionType for entry in authority)): + raise RuntimeError('Initial cold authority must expose the sealed seven-entry tuple') + # Read fresh transport exactly once, before any candidate exposure. + transport = root.FunctionType.__dict__['__dict__'].__get__(authority[0], root.FunctionType) + descriptor = transport['_h25_caller_descriptor'] + if type(descriptor) is not tuple or len(descriptor) != 6 or descriptor[1] is not authority: + raise RuntimeError('Initial cold authority caller descriptor differs') + return authority, descriptor, bundle + + +import importlib +import typing +_INITIAL_COLD_AUTHORITY, _INITIAL_COLD_CALLER_DESCRIPTOR, _INITIAL_EPOCH_BUNDLE = _initial_cold_authority() + +import time +START_WALL = time.perf_counter() +import argparse +from contextlib import redirect_stdout +from fractions import Fraction +import hashlib +import io +import json +import os +from pathlib import Path +import resource +import runpy +import shutil +import stat +import sys + +sys.dont_write_bytecode = True +# Independent source pins are literal final-stage configuration. These modules +# are admitted by the pre-exposure authority, including their live helper code. +# Driver/source identity does not depend on a hash of itself. +EARLY_INTEGRATION_SOURCE_PINS = ({'adapters': ('integration/adapters.py', 'f7ca7f4f03ac63c1a95ba42f06149543211566de5e29f487a3dc4d08c5ee9b94'), 'cold_build_evidence': ('integration/cold_build_evidence.py', 'aa0a315110e031e19291970c9611fe5e0f91465fa20eaec51e81186099563f78'), 'native_packet': ('integration/native_packet.py', '6adbcd1dfeb77fb6da7ee8f725796b1bfdbf0a4f397ef23f3a266a6b89d55892'), 'data_adapters': ('integration/data_adapters.py', '18679fd1eb6ae99c4b375756511427c26718f77674c2d8fcc490e25ceb47cba5'), 'guarded_adapters_v4': ('integration/guarded_adapters_v4.py', '5579fe0838d8c6acf63834990269479c6c32024a1662846ed0a075c25d13954c'), '_h25_data_cache': ('areas/cache-validity/cache_contract_v8.py', 'd317c9866566cd6147c96566879f26f364e7e6801ac3eed0800b6ed8eedd01a2')} + + + + + + +) +_INITIAL_INTEGRATION_MODULES = {} +_INITIAL_INTEGRATION_HANDLES = {} +for _entry_name, (_entry_relative, _entry_digest) in EARLY_INTEGRATION_SOURCE_PINS.items(): + if type(_entry_digest) is not str or len(_entry_digest) != 64: + raise RuntimeError('Early integration source pin is not configured: ' + _entry_name) + # BEGIN evaluated dispatch arguments scientific_driver:195 + _ca_args = (__file__.rsplit('/', 2)[0] + '/' + _entry_relative, _entry_digest, _entry_name) + _ca_kwargs = {} + # END evaluated dispatch arguments scientific_driver:195 + # BEGIN caller admission scientific_driver:195 + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission scientific_driver:195 + _entry_module, _entry_handle = _ca_dispatch(0, *_ca_args, **_ca_kwargs) + if type(_entry_module) is not _CAPTURED_BOOTSTRAP_ROOT.ModuleType or sys.modules.get(_entry_name) is not _entry_module: + raise RuntimeError('Early integration module registry identity differs: ' + _entry_name) + _INITIAL_INTEGRATION_MODULES[_entry_name] = _entry_module + _INITIAL_INTEGRATION_HANDLES[_entry_name] = _entry_handle +adapters = _INITIAL_INTEGRATION_MODULES['adapters'] +native_packet = _INITIAL_INTEGRATION_MODULES['native_packet'] +data_adapters = _INITIAL_INTEGRATION_MODULES['data_adapters'] +guarded_adapters_v4 = _INITIAL_INTEGRATION_MODULES['guarded_adapters_v4'] +_EXECUTION = {'output': Path(_INITIAL_OUTPUT), 'state': None, 'packet': None} +ROUND = Path(__file__).resolve().parent.parent +HERE = ROUND / "baseline" +REFERENCE_DRIVER_SHA = "0d976d2eb6b845f20d4a3396591a806f966688b88693cd6a5f8a0c9e48925e36" +BASE = "19fdb086ea96af9a9f87936a2b888e10af4ed810" +UPSTREAM = "adc7f1241b42e322a6451854ab7e4b4c146bf78a" +PIN_SHA = "88bba3caf5975f30fa7abceaea9454110cf3b069233e8241a2ca13d1dff171a7" +REFERENCE_SHA = "1f763d95c7ff163aa71d13cd82784f16665be8afb21f75e76941e2119562098f" +ENGINE_PINS = { + "native_gf2.c": "e9c3c9194a08718bd1575c1cf08c6c6772d3b644c2e274c25a84a1f9249d06cc", + "native_backend.py": "e473c38245c3668715b5a78dfe980b2fe3ed0d0c9b8c97c666fbae6ecf1fffd5", + "finite_controls.py": "df989a831aac43cc1af95169dad8c64a7548760e6e1f96976da996703f2c8f7a", + "compare_side_verifier.py": "6e507bb0c7e00d090a60289fddb6c55e90c946d0850c42c3c5e3e15c27604a68", + "profile_side_verifier.py": "9c994378171c20a91539418d93cb8387e1daa93465d6862beefea90e12999c2a", + "source/complex_circuit.py": "d623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1", + "source/complex_network.py": "0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b", +} +COMPLEMENT_EXPECTED = { + "calls": 238685, + "canonical_stream_bytes": 55839507, + "sha256": "7dec2bf33303c37e1c699609e83768d61df7e19104d34a26a148f66d5ccc4838", + "schema": "v2-jsonl:call,us,vs,result(type=list+values or type=None); ordered exact integer vectors", +} +EXPECTED_STDOUT = ( + "PASS conditional 59/100000000000 > 2^-31; minimum margin 14779261/25000000000000000\n" + "Side roles per invocation 108195 vs original 3693800\n" +) + + +def need(condition, message): + if not condition: + raise RuntimeError(message) + + +def sha(data): + return hashlib.sha256(data).hexdigest() + + +def canonical(value): + return json.dumps(value, sort_keys=True, separators=(",", ":"), ensure_ascii=True).encode("ascii") + + +def cpu(): + own = resource.getrusage(resource.RUSAGE_SELF) + children = resource.getrusage(resource.RUSAGE_CHILDREN) + return own.ru_utime + own.ru_stime + children.ru_utime + children.ru_stime + + +def inventory(root, pins, *, exact=True): + need(root.is_dir() and not root.is_symlink(), "Missing or symlinked input root") + files = {} + for path in sorted(root.rglob("*")): + need(not path.is_symlink(), "Symlink in frozen inputs: " + str(path)) + if path.is_file(): + relative = str(path.relative_to(root)) + if relative not in pins: + need(not exact, "Undeclared frozen input: " + relative) + continue + raw = path.read_bytes() + expected = pins[relative][0] if type(pins[relative]) is list else pins[relative] + need(sha(raw) == expected, "Frozen input digest changed: " + relative) + files[relative] = {"sha256": sha(raw), "mode": stat.S_IMODE(path.stat().st_mode), "bytes": len(raw)} + need(set(files) == set(pins), "Frozen input inventory incomplete") + return files + +# Preserve the literal baseline function; main selects a local arm function. +original_inventory = inventory + +def candidate_inventory(root, pins, *, exact=True): + need(root.is_dir() and not root.is_symlink(), "Missing or symlinked input root") + files = {} + for path in sorted(root.rglob("*")): + need(not path.is_symlink(), "Symlink in frozen inputs: " + str(path)) + if path.is_file(): + relative = str(path.relative_to(root)) + if relative not in pins: + need(not exact, "Undeclared frozen input: " + relative) + continue + raw = path.read_bytes() + expected = pins[relative][0] if type(pins[relative]) is list else pins[relative] + raw_digest = sha(raw) + need(raw_digest == expected, "Frozen input digest changed: " + relative) + files[relative] = {"sha256": raw_digest, "mode": stat.S_IMODE(path.stat().st_mode), "bytes": len(raw)} + need(set(files) == set(pins), "Frozen input inventory incomplete") + return files + + +def typed(value): + """Lossless full return representation, including order and exact types.""" + kind = type(value) + if kind is Fraction: + return ["Fraction", value.numerator, value.denominator] + if value is None: + return ["None"] + if kind is bool: + return ["bool", value] + if kind is int: + return ["int", str(value)] + if kind is float: + return ["float", value.hex()] + if kind is str: + return ["str", value] + if kind is list or kind is tuple: + return [kind.__name__, [typed(item) for item in value]] + if kind is dict: + return ["dict", [[typed(key), typed(item)] for key, item in value.items()]] + raise TypeError("Unsupported exact full-certificate return type: " + kind.__name__) + + +class Phases: + """Broad phase observations; no per-arithmetic resource sampling. + + Every call retains the old timing fields. Memory samples are paid by both + arms, including nested side_construction so snapshots/retirement are visible. + """ + def __init__(self): + self.rows = {} + + @staticmethod + def memory(): + with open("/proc/self/status", "rb") as stream: + raw = stream.read(65537) + need(len(raw) <= 65536, "Process status diagnostic exceeded its bound") + current = None + for line in raw.splitlines(): + if line.startswith(b"VmRSS:"): + fields = line.split() + need(len(fields) == 3 and fields[2] == b"kB", "Unexpected process RSS diagnostic units") + current = int(fields[1]) * 1024 + break + need(current is not None, "Current process RSS diagnostic unavailable") + highwater = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss * 1024 + return {"current_vmrss_bytes": current, "process_ru_maxrss_bytes": highwater} + + def call(self, name, function, *args, **kwargs): + wall, used = time.perf_counter(), cpu() + memory_before = self.memory() + primary_failure = False + try: + return function(*args, **kwargs) + except BaseException: + primary_failure = True + raise + finally: + memory_after, memory_error = None, None + try: + memory_after = self.memory() + except BaseException as error: + # Do not replace an original failure with diagnostic failure. + memory_error = {"type": type(error).__name__} + if not primary_failure: + raise + row = self.rows.setdefault(name, {"calls": 0, "wall_seconds": 0.0, + "cpu_seconds_with_children": 0.0, + "memory_samples": [], + "memory_semantics": "VmRSS is current resident bytes; ru_maxrss is process high-water bytes; neither is an additive phase peak"}) + row["calls"] += 1 + row["memory_samples"].append({"before": memory_before, "after": memory_after, + "diagnostic_error": memory_error}) + row["wall_seconds"] += time.perf_counter() - wall + row["cpu_seconds_with_children"] += cpu() - used + + def wrap(self, owner, attribute, name): + original = getattr(owner, attribute) + def observed(*args, **kwargs): + return self.call(name, original, *args, **kwargs) + setattr(owner, attribute, observed) + return original, observed + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--frozen-root", type=Path, default=HERE / "frozen") + parser.add_argument("--reference", type=Path, default=HERE / "reference/certificates/complex-network.json") + parser.add_argument("--lanes", choices=("baseline", "candidate"), required=True) + parser.add_argument("--finite-only", action="store_true") + parser.add_argument("--output", type=Path, required=True, help="New external directory; every write stays below it") + parser.add_argument("--anchor", type=Path, default=HERE / "anchor.json") + args = parser.parse_args() + args.data_lanes = args.lanes + args.lanes = "all" # Both comparison arms retain the complete original native/bookkeeping baseline. + if args.data_lanes == "transport": + need(args.frozen_root == HERE / "frozen" and + args.reference == HERE / "reference/certificates/complex-network.json" and + args.anchor == HERE / "anchor.json", "Transport uses only the original fixed historical inputs") + data_adapters.transport(ROUND, HERE, args.output) + return + inventory = candidate_inventory if args.data_lanes == "candidate" else original_inventory + args.mode = "candidate" # Every new arm starts from the original native C configuration. + need(args.finite_only or sys.flags.optimize == 0, "Every full-caller mode requires original assertions") + need(sys.implementation.name == "cpython" and sys.version_info[:2] == (3, 12), "Frozen CPython 3.12 required") + data_adapters.require_execution_contract(args.data_lanes, args.finite_only) + need((args.mode == "profile") == (args.anchor is None), "Profile creates the anchor; both benchmark arms require --anchor") + frozen, reference = args.frozen_root.resolve(), args.reference.resolve() + output = args.output.resolve() + need(str(output) == _INITIAL_OUTPUT and output.is_dir() and not output.is_symlink() and + {path.name for path in output.iterdir()} == {'initial-tcb-controls'} and + (output / 'initial-tcb-controls').is_dir() and + not (output / 'initial-tcb-controls').is_symlink() and + not list((output / 'initial-tcb-controls').iterdir()), + "Early TCB output ownership or fresh control directory changed") + need(not output.is_relative_to(HERE) and not output.is_relative_to(frozen), "Output must be outside immutable sources") + need(reference.is_file() and not reference.is_symlink(), "Reference certificate missing or symlinked") + source_pin_bytes = (HERE / "SOURCE-PINS.json").read_bytes() + need(sha(source_pin_bytes) == PIN_SHA, "Source inventory pin changed") + pins = json.loads(source_pin_bytes) + need(len(pins) == 32, "Frozen closure must contain twelve scripts, manifest and nineteen payloads") + reference_bytes = reference.read_bytes() + need(sha(reference_bytes) == REFERENCE_SHA, "Original full certificate reference changed") + driver_before = Path(__file__).read_bytes() + new_custody_before = adapters.custody(ROUND, args.lanes) + data_custody_before = data_adapters.custody(ROUND) + reference_driver_before = (HERE / "full_driver.py").read_bytes() + need(sha(reference_driver_before) == REFERENCE_DRIVER_SHA, "Reference driver pin changed") + anchor_bytes = None if args.anchor is None else args.anchor.read_bytes() + expected_anchor = None if anchor_bytes is None else json.loads(anchor_bytes) + if expected_anchor is not None: + need(expected_anchor.get("schema") == "gf2-full-network-anchor-v1" and + expected_anchor.get("base_commit") == BASE and expected_anchor.get("source_pin_sha256") == PIN_SHA and + expected_anchor.get("driver_sha256") == REFERENCE_DRIVER_SHA and + expected_anchor.get("engine_pins") == ENGINE_PINS, + "Anchor source/driver/engine identity differs; no benchmark permitted") + _EXECUTION['output'] = output + compiler_tmp = output / "compiler-tmp" + compiler_tmp.mkdir() + os.environ["TMPDIR"] = str(compiler_tmp) + phases = Phases() + (output / 'initial-native-tcb.json').write_bytes(canonical(INITIAL_NATIVE_TCB_RECEIPT) + b'\n') + (output / 'initial-tcb-controls' / 'receipt.json').write_bytes(canonical(INITIAL_NATIVE_TCB_CONTROLS) + b'\n') + frozen_before = phases.call("input_custody", inventory, frozen, pins) + engine_before = phases.call("engine_custody", inventory, HERE / "engine", ENGINE_PINS) + manifest = json.loads((frozen / "upstream/manifest.json").read_bytes()) + need(manifest["commit"] == UPSTREAM and len(manifest["files"]) == 19, "Wrong pinned upstream manifest") + need({"upstream/" + name for name in manifest["files"]} == + {name for name in pins if name.startswith("upstream/") and name != "upstream/manifest.json"}, + "Source verifier payload closure changed") + for name, info in manifest["files"].items(): + need(info["sha256"] == pins["upstream/" + name][0], "Manifest payload hash differs from independent frozen pin") + + runtime, engine = output / "runtime-root", output / "engine" + phases.call("fresh_root_copy", shutil.copytree, frozen, runtime) + phases.call("fresh_engine_copy", shutil.copytree, HERE / "engine", engine) + # copytree retains readonly source directory permissions. Only this new + # private root is made writable for the original CLI certificate output. + runtime.chmod(0o755) + (runtime / "certificates").mkdir() + runtime_before = inventory(runtime, pins) + copied_engine_before = inventory(engine, ENGINE_PINS) + need(runtime_before == frozen_before and copied_engine_before == engine_before, "Copy changed input bytes or modes") + for name in ("complex_network.py", "complex_circuit.py"): + need((engine / "source" / name).read_bytes() == (runtime / "scripts" / name).read_bytes(), + "PR5929 engine/source differs from the full caller closure") + script_names = {Path(name).stem for name in pins if name.startswith("scripts/")} + engine_names = {"native_backend", "finite_controls", "compare_side_verifier", "profile_side_verifier"} + need(not (script_names | engine_names) & set(sys.modules), "Scientific module already loaded; fresh process required") + sys.path[:0] = [str(engine), str(runtime / "scripts")] + # BEGIN evaluated dispatch arguments scientific_driver:462 + _ca_args = (str(engine / 'native_backend.py'), ENGINE_PINS['native_backend.py'], 'native_backend') + _ca_kwargs = {'kind': 'backend'} + # END evaluated dispatch arguments scientific_driver:462 + # BEGIN caller admission scientific_driver:462 + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission scientific_driver:462 + backend, backend_handle = phases.call('cold_engine_import', _ca_dispatch, 0, *_ca_args, **_ca_kwargs) + # BEGIN evaluated dispatch arguments scientific_driver:465 + _ca_args = (_INITIAL_INTEGRATION_HANDLES['_h25_data_cache'], 'capture_backend_factory_environment', backend) + _ca_kwargs = {'cold_authority': _INITIAL_COLD_AUTHORITY, 'cold_caller_descriptor': _INITIAL_COLD_CALLER_DESCRIPTOR, 'backend_handle': backend_handle, 'cache_handle': _INITIAL_INTEGRATION_HANDLES['_h25_data_cache'], 'bootstrap_root': _CAPTURED_BOOTSTRAP_ROOT, 'bootstrap_capability': _CAPTURED_BOOTSTRAP_CAPABILITY, 'bootstrap_api': _CAPTURED_BOOTSTRAP_API} + # END evaluated dispatch arguments scientific_driver:465 + # BEGIN caller admission scientific_driver:465 + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission scientific_driver:465 + factory_environment = phases.call('cold_backend_factory_environment', _ca_dispatch, 1, *_ca_args, **_ca_kwargs) + comparison = importlib.import_module("compare_side_verifier") + native = None + finite = None + build = None + if args.mode == "candidate": + packet = phases.call("cold_native_metadata_build", native_packet.prepare, + ROUND, output, data_custody_before, _CAPTURED_BOOTSTRAP_ROOT, + _CAPTURED_BOOTSTRAP_CAPABILITY, _CAPTURED_BOOTSTRAP_API) + _EXECUTION['packet'] = packet + packet['controls']['native_initial_tcb'] = INITIAL_NATIVE_TCB_CONTROLS + native, build = phases.call("cold_compile_link_load", backend.build_native, output / "cold-build") + # BEGIN evaluated dispatch arguments scientific_driver:484 + _ca_args = (_INITIAL_INTEGRATION_HANDLES['guarded_adapters_v4'], 'prepare', ROUND, backend, backend_handle, native, output, args.lanes, phases, _INITIAL_COLD_AUTHORITY, _INITIAL_INTEGRATION_HANDLES['adapters'], new_custody_before) + _ca_kwargs = {'cold_caller_descriptor': _INITIAL_COLD_CALLER_DESCRIPTOR} + # END evaluated dispatch arguments scientific_driver:484 + # BEGIN caller admission scientific_driver:484 + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission scientific_driver:484 + extensions = phases.call('new_adapter_preparation', _ca_dispatch, 1, *_ca_args, **_ca_kwargs) + phases.call("all_native_metadata_and_preload_controls", native_packet.run_controls, packet, phases) + finite = phases.call("all_native_finite_independent_controls", importlib.import_module("finite_controls").run_controls, native) + phases.call("all_new_controls", adapters.run_controls, extensions, backend, native, phases) + # BEGIN evaluated dispatch arguments scientific_driver:492 + _ca_args = (_INITIAL_INTEGRATION_HANDLES['data_adapters'], 'prepare', ROUND, backend, comparison, extensions, args.data_lanes, data_custody_before, packet) + _ca_kwargs = {'authority': _INITIAL_COLD_AUTHORITY, 'cold_caller_descriptor': _INITIAL_COLD_CALLER_DESCRIPTOR, 'integration_handles': _INITIAL_INTEGRATION_HANDLES, 'backend_handle': backend_handle, 'adapters_handle': _INITIAL_INTEGRATION_HANDLES['adapters'], 'setup_handle': _INITIAL_INTEGRATION_HANDLES['guarded_adapters_v4'], 'factory_environment': factory_environment, 'preloaded_cache': (_INITIAL_INTEGRATION_MODULES['_h25_data_cache'], _INITIAL_INTEGRATION_HANDLES['_h25_data_cache'])} + # END evaluated dispatch arguments scientific_driver:492 + # BEGIN caller admission scientific_driver:492 + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission scientific_driver:492 + data_state = phases.call('data_adapter_preparation', _ca_dispatch, 1, *_ca_args, **_ca_kwargs) + _EXECUTION['state'] = data_state + phases.call("all_data_controls", data_adapters.run_controls, + data_state, native, output, phases, HERE / "full_driver.py", candidate_inventory, extensions) + (output / "finite-controls.json").write_bytes(canonical(finite) + b"\n") + + if args.finite_only: + phases.call('terminal_native_cleanup_and_checks', data_adapters.finish_before_late, data_state) + # LAST native/scientific call. Everything below is source or receipt work. + phases.call('bootstrap_late_last', data_adapters.finish_late_last, data_state) + need(inventory(frozen, pins) == frozen_before and inventory(HERE / "engine", ENGINE_PINS) == engine_before, "Finite immutable source custody changed") + need(inventory(runtime, pins) == runtime_before and inventory(engine, ENGINE_PINS) == copied_engine_before, "Finite copied source custody changed") + need(adapters.custody(ROUND, args.lanes) == new_custody_before, "Finite new source custody changed") + need(data_adapters.custody(ROUND) == data_custody_before, "Finite data source custody changed") + result = {"status": "H25_DATA_HANDLING_FINITE_PASS", "lanes": args.data_lanes, + "data_handling": data_adapters.finite_receipt(data_state), + "data_source_custody": data_custody_before, + "optimized": sys.flags.optimize, "original_controls": finite, + "new_controls": extensions["controls"], "new_source_custody": new_custody_before, + "driver_sha256": sha(driver_before), + "initial_native_tcb": INITIAL_NATIVE_TCB_RECEIPT, + "native_packet": native_packet.receipt(packet), + "reference_driver_sha256": REFERENCE_DRIVER_SHA, "phases": phases.rows} + (output / "receipt.json").write_text(json.dumps(result, indent=2, sort_keys=True) + "\n") + print(json.dumps(result, sort_keys=True)) + return + + circuit_module = phases.call("cold_complex_module_load", backend.load_source, "complex_circuit") + sys.modules["complex_circuit"] = circuit_module + rank_calls = [] + complement = extensions["trace_type"](circuit_module.Label) + phases.call("private_set_and_data_adapter_installation", data_adapters.install_circuit, + data_state, extensions, circuit_module, comparison) + side_writer = data_adapters.scientific_writer(data_state) + binding = None + captures = {} + phases.wrap(circuit_module.ComplexSideCircuit, "__init__", "side_construction") + phases.wrap(circuit_module.Checks, "__init__", "checks_initialization") + phases.wrap(circuit_module, "compile_roles", "compile_roles") + phases.wrap(circuit_module.Checks, "verify_map", "verify_map") + phases.wrap(circuit_module.Checks, "verify_labels", "verify_labels") + original_roles = circuit_module.verify_role_frames + def observe_roles(c, checks, code=None): + need("side" not in captures and code is not None, "Unexpected role-frame invocation") + result = phases.call("verify_role_frames", original_roles, c, checks, code) + captures["side"] = (c, checks, code, result) + return result + circuit_module.verify_role_frames = observe_roles + + certify = phases.call("cold_certify_import", importlib.import_module, "certify") + phases.wrap(certify, "verify_sources", "original_upstream_verify_sources") + prepare = phases.call("cold_prepare_import", importlib.import_module, "prepare_layers") + search = importlib.import_module("search_network") + phases.wrap(search, "log_integer_bounds", "full_log_integer_bounds") + original_serializable = prepare.serializable + depth = 0 + def observe_serializable(value): + nonlocal depth + outer = depth == 0 + if outer: + need("full_return" not in captures and type(value) is dict, "Unexpected outer serialization") + captures["full_return"] = value + depth += 1 + try: + # Recursion still delegates the original serializable exactly once + # per value; only the outer call is captured/timed. + if outer: + return phases.call("original_serializable", original_serializable, value) + return original_serializable(value) + finally: + depth -= 1 + prepare.serializable = observe_serializable + + # CS/Checks/phase/trace observers are final before either new guard captures them. + binding = phases.call("final_native_binding", data_adapters.bind_native, + data_state, backend, circuit_module, native, rank_calls, complement) + phases.call("construction_lease_sealing", data_adapters.seal, data_state) + phases.call("private_set_lease_sealing", adapters.seal, extensions) + caller = runtime / "scripts/complex_network.py" + old_argv = sys.argv + stdout = io.StringIO() + try: + phases.call("final_private_environment_and_arming", data_adapters.arm, data_state, extensions) + sys.argv = [str(caller)] + with redirect_stdout(stdout): + namespace = phases.call("complete_original_cli", runpy.run_path, str(caller), run_name="__main__") + finally: + sys.argv = old_argv + adapters.disarm(extensions) + cli_stdout = stdout.getvalue() + need(cli_stdout == EXPECTED_STDOUT, "Original CLI stdout changed") + certificate_bytes = (runtime / "certificates/complex-network.json").read_bytes() + need(certificate_bytes == reference_bytes, "Original CLI certificate bytes differ from the pinned reference") + need(sys.modules["complex_circuit"] is circuit_module and + namespace["ComplexSideCircuit"] is circuit_module.ComplexSideCircuit and + namespace["Checks"] is circuit_module.Checks and namespace["compile_roles"] is circuit_module.compile_roles and + namespace["verify_role_frames"] is observe_roles and namespace["serializable"] is observe_serializable, + "Caller used a different scientific module or observation binding") + need(captures.keys() == {"side", "full_return"}, "Missing exact caller observations") + c, checks, code, role_result = captures["side"] + full_return = captures["full_return"] + need(full_return["role_frames"] is role_result and full_return["upstream_commit"] == UPSTREAM, + "Role return or actual source verification boundary changed") + for name in ("side_construction", "checks_initialization", "compile_roles", "verify_map", "verify_labels", + "verify_role_frames", "original_upstream_verify_sources", "full_log_integer_bounds", + "original_serializable", "complete_original_cli"): + need(phases.rows.get(name, {}).get("calls") == 1, "Original phase was omitted or repeated: " + name) + imports = {} + for name in script_names - {"complex_network"}: + module = sys.modules.get(name) + expected_path = engine / "source/complex_circuit.py" if name == "complex_circuit" else runtime / "scripts" / (name + ".py") + need(module is not None and Path(module.__file__).resolve() == expected_path.resolve(), "Unpinned scientific import: " + name) + imports[name] = str(module.__file__) + if binding is not None: + binding["runtime_guard"].check() + need(binding["counters"] == {"complement_native": 238685, "complement_fallback": 0, + "gram_native": 59959, "gram_fallback": 0}, "Native full-call coverage changed") + + side_result = {key: full_return[key] for key in ("circuit", "side_map", "labels", "role_frames")} + witness = { + "support": c.support, "args": c.args, "kind": c.kind, "active": sorted(c.active), + "pieces": [(target, node, (coefficient.numerator, coefficient.denominator)) for target, node, coefficient in c.pieces], + "labels": [(key, list(label.basis.items()), label.dim, label.key) for key, label in checks.cache.items()], + "code": {"roles": code["roles"], "gates": code["gates"], "sources": list(code["sources"].items()), + "outputs": list(code["outputs"].items())}, + } + side_output = output / "side-observations" + side_output.mkdir() + side_receipt = phases.call("identical_lossless_side_serialization", side_writer, + side_output, side_result, witness, rank_calls) + complement_receipt = complement.receipt() + need(complement_receipt == COMPLEMENT_EXPECTED, "Every ordered complement observation must match PR5929") + full_typed_bytes = canonical(typed(full_return)) + (output / "full-return.lossless.json").write_bytes(full_typed_bytes) + (output / "original-stdout.txt").write_text(cli_stdout, encoding="utf-8") + (output / "complement-transcript.json").write_bytes(canonical(complement_receipt) + b"\n") + science = { + "full_cli_certificate_sha256": sha(certificate_bytes), "full_cli_stdout_sha256": sha(cli_stdout.encode("utf-8")), + "full_return_lossless_sha256": sha(full_typed_bytes), "side": side_receipt, + "ordered_complements": complement_receipt, "upstream_commit": UPSTREAM, + } + anchor = {"schema": "gf2-full-network-anchor-v1", "base_commit": BASE, "source_pin_sha256": PIN_SHA, + "driver_sha256": REFERENCE_DRIVER_SHA, "engine_pins": ENGINE_PINS, "science": science} + if expected_anchor is not None: + need(anchor == expected_anchor, "Complete certificate/types/ordered observations differ from frozen anchor") + else: + (output / "anchor.json").write_bytes(canonical(anchor) + b"\n") + need(inventory(frozen, pins) == frozen_before and inventory(HERE / "engine", ENGINE_PINS) == engine_before, + "Immutable source bytes/modes changed") + need(inventory(runtime, pins, exact=False) == runtime_before and inventory(engine, ENGINE_PINS) == copied_engine_before, + "Runtime scientific source bytes/modes changed") + runtime_files = {str(path.relative_to(runtime)) for path in runtime.rglob("*") if path.is_file()} + need(runtime_files == set(pins) | {"certificates/complex-network.json"}, "Unexpected full-caller file side effect") + need(Path(__file__).read_bytes() == driver_before and reference.read_bytes() == reference_bytes and + (anchor_bytes is None or args.anchor.read_bytes() == anchor_bytes), "Driver/reference/anchor changed during run") + need(adapters.custody(ROUND, args.lanes) == new_custody_before, "New source custody changed") + # Snapshot final scientific bookkeeping before the deliberately terminal late hook. + bookkeeping_receipt = adapters.receipt(extensions) + data_receipt = phases.call("data_finalization", data_adapters.finish, data_state, binding) + phases.call('terminal_native_cleanup_and_checks', data_adapters.finish_before_late, data_state) + # LAST native/scientific call. No owner, root API, provider, or native guard follows. + phases.call('bootstrap_late_last', data_adapters.finish_late_last, data_state) + # Honest source custody and receipt work continue after the terminal boundary. + need(data_adapters.custody(ROUND) == data_custody_before, "Data source custody changed") + need(adapters.custody(ROUND, args.lanes) == new_custody_before, "Post-late original source custody changed") + need(inventory(frozen, pins) == frozen_before and inventory(HERE / "engine", ENGINE_PINS) == engine_before, + "Post-late immutable source custody changed") + need(inventory(runtime, pins, exact=False) == runtime_before and inventory(engine, ENGINE_PINS) == copied_engine_before, + "Post-late copied source custody changed") + need(Path(__file__).read_bytes() == driver_before and reference.read_bytes() == reference_bytes and + (anchor_bytes is None or args.anchor.read_bytes() == anchor_bytes), "Post-late driver/reference/anchor changed") + receipt = { + "new_source_custody": new_custody_before, + "status": "FULL_NETWORK_PROFILE_ANCHOR_PASS" if args.mode == "profile" else "FULL_NETWORK_COMPLETE_PASS", + "mode": args.mode, "lanes": args.data_lanes, "bookkeeping": bookkeeping_receipt, + "data_handling": data_receipt, "data_source_custody": data_custody_before, + "reference_driver_sha256": REFERENCE_DRIVER_SHA, + "science": science, "base_commit": BASE, "native_predecessor_pr": 5995, + "driver_sha256": sha(driver_before), "source_pin_sha256": PIN_SHA, + "frozen_custody": frozen_before, "engine_custody": engine_before, "scientific_imports": imports, + "build": build, "finite_controls": finite, + "initial_native_tcb": INITIAL_NATIVE_TCB_RECEIPT, + "native_packet": native_packet.receipt(packet), + "private_root_permission": "runtime-root is0755; copied input file modes are retained and checked; immutable stages are never chmodded", + "compiler_tmpdir": str(compiler_tmp), + "native_calls": None if binding is None else dict(binding["counters"]), + "phases": phases.rows, "driver_wall_seconds_after_initial_tcb_before_receipt": time.perf_counter() - START_WALL, + "process_and_compiler_cpu_seconds_before_receipt": cpu(), + "environment": {"python": sys.version, "executable": sys.executable, "platform": sys.platform}, + "measurement": "Parent outer guard is authoritative and includes pristine root startup, initial native TCB authentication, early cold source authority capture and every factory dependency/product check, three cold metadata compilations plus original cold native/trace builds, every old and new control in BOTH arms, all candidate production admission/guards, IO and terminal cleanup. Baseline receives the complete same control union. Driver wall diagnostic starts after initial TCB and cold authority capture and is not total process wall. Broad phase samples are nested, not additive; VmRSS is current RSS and ru_maxrss is process high-water. Eager witnesses and original observations remain; full funding and equality gates are separate and currently closed.", + "scope": "Complete frozen historical complex-network CLI with retained observations; conditional certificate only. No bare-CLI factor, selected-frontier, new kappa or PR5864 speed claim.", + } + (output / "receipt.json").write_text(json.dumps(receipt, indent=2, sort_keys=True) + "\n") + sys.stdout.write(cli_stdout) + print(json.dumps({"status": receipt["status"], "mode": args.mode, "science": science, + "wall_seconds": receipt["driver_wall_seconds_after_initial_tcb_before_receipt"], + "cpu_seconds_with_compiler": receipt["process_and_compiler_cpu_seconds_before_receipt"], + "phases": phases.rows}, sort_keys=True)) + + +def _run_with_stop_evidence(): + try: + main() + except BaseException as primary_error: + # Nothing in cleanup or evidence assembly may replace this primary object. + try: + state = _EXECUTION['state'] + cleanup_errors = [] + try: + cleanup_errors = data_adapters.cleanup_owned(state) + except BaseException as cleanup_error: + cleanup_errors.append({'type': type(cleanup_error).__name__, 'message': str(cleanup_error)}) + stop = {'schema': 'h25-combined-v2-stop-v1', 'status': 'STOP', + 'primary_error': {'type': type(primary_error).__name__, 'message': str(primary_error)}, + 'primary_cause': None if primary_error.__cause__ is None else { + 'type': type(primary_error.__cause__).__name__, 'message': str(primary_error.__cause__)}, + 'cleanup_errors': cleanup_errors, + 'data': data_adapters.stop_diagnostics(state), + 'native_packet': None if _EXECUTION['packet'] is None else native_packet.receipt(_EXECUTION['packet']), + 'initial_native_tcb': INITIAL_NATIVE_TCB_RECEIPT} + output = _EXECUTION['output'] + if output is not None: + with (output / 'STOP.json').open('x', encoding='utf-8') as stream: + stream.write(json.dumps(stop, sort_keys=True, indent=2) + '\n') + except BaseException as evidence_error: + # Parent retains an independent process transcript even if this fails. + try: + sys.stderr.write('STOP evidence write failed: ' + type(evidence_error).__name__ + '\n') + except BaseException: + pass + raise + + + + +def _epoch_cli_boundary(phases, data_state, extensions, caller, stdout, invocation_token, old_argv): + _epoch_cli_primary = None + _epoch_cli_argv_error = None + _epoch_cli_disarm_error = None + _epoch_cli_retirement_error = None + _epoch_cli_record = None + try: + try: + _epoch_cli_record = {'primary': None, 'argv_error': None, 'disarm_error': None, 'retirement_error': None, 'outer_retirement_error': None, 'uncertain': False, 'argv_owner': old_argv, 'retirement_channel': {'started': False, 'error': None, 'journal_error': None, 'acknowledged': False}, 'outer_retirement_channel': {'started': False, 'error': None, 'journal_error': None, 'acknowledged': False}} + data_state['epoch_cli_cleanup'] = _epoch_cli_record + phases.call('final_private_environment_and_arming', data_adapters.arm, data_state, extensions) + if data_state['enabled']: + data_adapters.epoch_arm(data_state, invocation_token) + sys.argv = [str(caller)] + with redirect_stdout(stdout): + namespace = phases.call('complete_original_cli', runpy.run_path, str(caller), run_name='__main__') + return namespace + except BaseException as _epoch_cli_error: + _epoch_cli_primary = _epoch_cli_error + if _epoch_cli_record is not None: + _epoch_cli_record['primary'] = _epoch_cli_error + raise + finally: + try: + sys.argv = old_argv + except BaseException as _epoch_argv_error: + _epoch_cli_argv_error = _epoch_argv_error + if _epoch_cli_record is not None: + _epoch_cli_record['argv_error'] = _epoch_argv_error + _epoch_cli_record['uncertain'] = True + if _epoch_cli_primary is None: + _epoch_cli_primary = _epoch_argv_error + if _epoch_cli_record is not None: + _epoch_cli_record['primary'] = _epoch_argv_error + try: + adapters.disarm(extensions) + except BaseException as _epoch_disarm_error: + _epoch_cli_disarm_error = _epoch_disarm_error + if _epoch_cli_record is not None: + _epoch_cli_record['disarm_error'] = _epoch_disarm_error + _epoch_cli_record['uncertain'] = True + if _epoch_cli_primary is None: + _epoch_cli_primary = _epoch_disarm_error + if _epoch_cli_record is not None: + _epoch_cli_record['primary'] = _epoch_disarm_error + raise + if _epoch_cli_argv_error is not None: + raise _epoch_cli_primary + finally: + try: + data_adapters.epoch_retire(data_state, 'whole-cli-terminal', _epoch_cli_primary, _epoch_cli_disarm_error, _epoch_cli_argv_error, None if _epoch_cli_record is None else _epoch_cli_record['retirement_channel'], 'inner') + except BaseException as _epoch_retirement_error: + _epoch_cli_retirement_error = _epoch_retirement_error + if _epoch_cli_record is not None: + _epoch_cli_record['retirement_error'] = _epoch_retirement_error + _epoch_cli_record['uncertain'] = True + if _epoch_cli_primary is None: + _epoch_cli_primary = _epoch_retirement_error + if _epoch_cli_record is not None: + _epoch_cli_record['primary'] = _epoch_retirement_error + raise + +def main_epoch(): + _epoch_invocation = object() + _epoch_driver_origin = data_adapters.epoch_driver_entry(_INITIAL_COLD_AUTHORITY, _INITIAL_COLD_CALLER_DESCRIPTOR, _INITIAL_EPOCH_BUNDLE[3], main_epoch, Phases, _epoch_invocation) + data_state = None + _epoch_primary = None + _epoch_outer_retirement_error = None + _epoch_outer_cleanup = None + try: + _epoch_outer_cleanup = {'primary': None, 'retirement_error': None, 'uncertain': False, 'attempted': False} + _EXECUTION['epoch_outer_cleanup'] = _epoch_outer_cleanup + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--frozen-root', type=Path, default=HERE / 'frozen') + parser.add_argument('--reference', type=Path, default=HERE / 'reference/certificates/complex-network.json') + parser.add_argument('--lanes', choices=('baseline', 'candidate'), required=True) + parser.add_argument('--finite-only', action='store_true') + parser.add_argument('--output', type=Path, required=True, help='New external directory; every write stays below it') + parser.add_argument('--anchor', type=Path, default=HERE / 'anchor.json') + args = parser.parse_args() + args.data_lanes = args.lanes + args.lanes = 'all' + if args.data_lanes == 'transport': + need(args.frozen_root == HERE / 'frozen' and args.reference == HERE / 'reference/certificates/complex-network.json' and (args.anchor == HERE / 'anchor.json'), 'Transport uses only the original fixed historical inputs') + data_adapters.transport(ROUND, HERE, args.output) + return + inventory = candidate_inventory if args.data_lanes == 'candidate' else original_inventory + args.mode = 'candidate' + need(args.finite_only or sys.flags.optimize == 0, 'Every full-caller mode requires original assertions') + need(sys.implementation.name == 'cpython' and sys.version_info[:2] == (3, 12), 'Frozen CPython 3.12 required') + data_adapters.require_execution_contract(args.data_lanes, args.finite_only) + need((args.mode == 'profile') == (args.anchor is None), 'Profile creates the anchor; both benchmark arms require --anchor') + frozen, reference = (args.frozen_root.resolve(), args.reference.resolve()) + output = args.output.resolve() + need(str(output) == _INITIAL_OUTPUT and output.is_dir() and (not output.is_symlink()) and ({path.name for path in output.iterdir()} == {'initial-tcb-controls'}) and (output / 'initial-tcb-controls').is_dir() and (not (output / 'initial-tcb-controls').is_symlink()) and (not list((output / 'initial-tcb-controls').iterdir())), 'Early TCB output ownership or fresh control directory changed') + need(not output.is_relative_to(HERE) and (not output.is_relative_to(frozen)), 'Output must be outside immutable sources') + need(reference.is_file() and (not reference.is_symlink()), 'Reference certificate missing or symlinked') + source_pin_bytes = (HERE / 'SOURCE-PINS.json').read_bytes() + need(sha(source_pin_bytes) == PIN_SHA, 'Source inventory pin changed') + pins = json.loads(source_pin_bytes) + need(len(pins) == 32, 'Frozen closure must contain twelve scripts, manifest and nineteen payloads') + reference_bytes = reference.read_bytes() + need(sha(reference_bytes) == REFERENCE_SHA, 'Original full certificate reference changed') + driver_before = Path(__file__).read_bytes() + new_custody_before = adapters.custody(ROUND, args.lanes) + data_custody_before = data_adapters.custody(ROUND) + reference_driver_before = (HERE / 'full_driver.py').read_bytes() + need(sha(reference_driver_before) == REFERENCE_DRIVER_SHA, 'Reference driver pin changed') + anchor_bytes = None if args.anchor is None else args.anchor.read_bytes() + expected_anchor = None if anchor_bytes is None else json.loads(anchor_bytes) + if expected_anchor is not None: + need(expected_anchor.get('schema') == 'gf2-full-network-anchor-v1' and expected_anchor.get('base_commit') == BASE and (expected_anchor.get('source_pin_sha256') == PIN_SHA) and (expected_anchor.get('driver_sha256') == REFERENCE_DRIVER_SHA) and (expected_anchor.get('engine_pins') == ENGINE_PINS), 'Anchor source/driver/engine identity differs; no benchmark permitted') + _EXECUTION['output'] = output + compiler_tmp = output / 'compiler-tmp' + compiler_tmp.mkdir() + os.environ['TMPDIR'] = str(compiler_tmp) + phases = Phases() + (output / 'initial-native-tcb.json').write_bytes(canonical(INITIAL_NATIVE_TCB_RECEIPT) + b'\n') + (output / 'initial-tcb-controls' / 'receipt.json').write_bytes(canonical(INITIAL_NATIVE_TCB_CONTROLS) + b'\n') + frozen_before = phases.call('input_custody', inventory, frozen, pins) + engine_before = phases.call('engine_custody', inventory, HERE / 'engine', ENGINE_PINS) + manifest = json.loads((frozen / 'upstream/manifest.json').read_bytes()) + need(manifest['commit'] == UPSTREAM and len(manifest['files']) == 19, 'Wrong pinned upstream manifest') + need({'upstream/' + name for name in manifest['files']} == {name for name in pins if name.startswith('upstream/') and name != 'upstream/manifest.json'}, 'Source verifier payload closure changed') + for name, info in manifest['files'].items(): + need(info['sha256'] == pins['upstream/' + name][0], 'Manifest payload hash differs from independent frozen pin') + runtime, engine = (output / 'runtime-root', output / 'engine') + phases.call('fresh_root_copy', shutil.copytree, frozen, runtime) + phases.call('fresh_engine_copy', shutil.copytree, HERE / 'engine', engine) + runtime.chmod(493) + (runtime / 'certificates').mkdir() + runtime_before = inventory(runtime, pins) + copied_engine_before = inventory(engine, ENGINE_PINS) + need(runtime_before == frozen_before and copied_engine_before == engine_before, 'Copy changed input bytes or modes') + for name in ('complex_network.py', 'complex_circuit.py'): + need((engine / 'source' / name).read_bytes() == (runtime / 'scripts' / name).read_bytes(), 'PR5929 engine/source differs from the full caller closure') + script_names = {Path(name).stem for name in pins if name.startswith('scripts/')} + engine_names = {'native_backend', 'finite_controls', 'compare_side_verifier', 'profile_side_verifier'} + need(not (script_names | engine_names) & set(sys.modules), 'Scientific module already loaded; fresh process required') + sys.path[:0] = [str(engine), str(runtime / 'scripts')] + _ca_args = (str(engine / 'native_backend.py'), ENGINE_PINS['native_backend.py'], 'native_backend') + _ca_kwargs = {'kind': 'backend'} + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + backend, backend_handle = phases.call('cold_engine_import', _ca_dispatch, 0, *_ca_args, **_ca_kwargs) + _ca_args = (_INITIAL_INTEGRATION_HANDLES['_h25_data_cache'], 'capture_backend_factory_environment', backend) + _ca_kwargs = {'cold_authority': _INITIAL_COLD_AUTHORITY, 'cold_caller_descriptor': _INITIAL_COLD_CALLER_DESCRIPTOR, 'backend_handle': backend_handle, 'cache_handle': _INITIAL_INTEGRATION_HANDLES['_h25_data_cache'], 'bootstrap_root': _CAPTURED_BOOTSTRAP_ROOT, 'bootstrap_capability': _CAPTURED_BOOTSTRAP_CAPABILITY, 'bootstrap_api': _CAPTURED_BOOTSTRAP_API} + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + factory_environment = phases.call('cold_backend_factory_environment', _ca_dispatch, 1, *_ca_args, **_ca_kwargs) + comparison = importlib.import_module('compare_side_verifier') + native = None + finite = None + build = None + if args.mode == 'candidate': + packet = phases.call('cold_native_metadata_build', native_packet.prepare, ROUND, output, data_custody_before, _CAPTURED_BOOTSTRAP_ROOT, _CAPTURED_BOOTSTRAP_CAPABILITY, _CAPTURED_BOOTSTRAP_API) + _EXECUTION['packet'] = packet + packet['controls']['native_initial_tcb'] = INITIAL_NATIVE_TCB_CONTROLS + native, build = phases.call('cold_compile_link_load', backend.build_native, output / 'cold-build') + _ca_args = (_INITIAL_INTEGRATION_HANDLES['guarded_adapters_v4'], 'prepare', ROUND, backend, backend_handle, native, output, args.lanes, phases, _INITIAL_COLD_AUTHORITY, _INITIAL_INTEGRATION_HANDLES['adapters'], new_custody_before) + _ca_kwargs = {'cold_caller_descriptor': _INITIAL_COLD_CALLER_DESCRIPTOR} + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + extensions = phases.call('new_adapter_preparation', _ca_dispatch, 1, *_ca_args, **_ca_kwargs) + phases.call('all_native_metadata_and_preload_controls', native_packet.run_controls, packet, phases) + finite = phases.call('all_native_finite_independent_controls', importlib.import_module('finite_controls').run_controls, native) + phases.call('all_new_controls', adapters.run_controls, extensions, backend, native, phases) + _ca_args = (_INITIAL_INTEGRATION_HANDLES['data_adapters'], 'prepare', ROUND, backend, comparison, extensions, args.data_lanes, data_custody_before, packet) + _ca_kwargs = {'authority': _INITIAL_COLD_AUTHORITY, 'cold_caller_descriptor': _INITIAL_COLD_CALLER_DESCRIPTOR, 'integration_handles': _INITIAL_INTEGRATION_HANDLES, 'backend_handle': backend_handle, 'adapters_handle': _INITIAL_INTEGRATION_HANDLES['adapters'], 'setup_handle': _INITIAL_INTEGRATION_HANDLES['guarded_adapters_v4'], 'factory_environment': factory_environment, 'preloaded_cache': (_INITIAL_INTEGRATION_MODULES['_h25_data_cache'], _INITIAL_INTEGRATION_HANDLES['_h25_data_cache'])} + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + data_state = phases.call('data_adapter_preparation', _ca_dispatch, 1, *_ca_args, **_ca_kwargs) + _EXECUTION['state'] = data_state + phases.call('all_data_controls', data_adapters.run_controls, data_state, native, output, phases, HERE / 'full_driver.py', candidate_inventory, extensions) + (output / 'finite-controls.json').write_bytes(canonical(finite) + b'\n') + if args.finite_only: + phases.call('terminal_native_cleanup_and_checks', data_adapters.finish_before_late, data_state) + phases.call('bootstrap_late_last', data_adapters.finish_late_last, data_state) + need(inventory(frozen, pins) == frozen_before and inventory(HERE / 'engine', ENGINE_PINS) == engine_before, 'Finite immutable source custody changed') + need(inventory(runtime, pins) == runtime_before and inventory(engine, ENGINE_PINS) == copied_engine_before, 'Finite copied source custody changed') + need(adapters.custody(ROUND, args.lanes) == new_custody_before, 'Finite new source custody changed') + need(data_adapters.custody(ROUND) == data_custody_before, 'Finite data source custody changed') + result = {'status': 'H25_DATA_HANDLING_FINITE_PASS', 'lanes': args.data_lanes, 'data_handling': data_adapters.finite_receipt(data_state), 'data_source_custody': data_custody_before, 'optimized': sys.flags.optimize, 'original_controls': finite, 'new_controls': extensions['controls'], 'new_source_custody': new_custody_before, 'driver_sha256': sha(driver_before), 'initial_native_tcb': INITIAL_NATIVE_TCB_RECEIPT, 'native_packet': native_packet.receipt(packet), 'reference_driver_sha256': REFERENCE_DRIVER_SHA, 'phases': phases.rows} + (output / 'receipt.json').write_text(json.dumps(result, indent=2, sort_keys=True) + '\n') + print(json.dumps(result, sort_keys=True)) + return + if data_state['enabled']: + circuit_module, _epoch_load_ticket = phases.call('cold_complex_module_load', data_adapters.epoch_load, data_state, _INITIAL_EPOCH_BUNDLE[3]) + else: + circuit_module = phases.call('cold_complex_module_load', backend.load_source, 'complex_circuit') + sys.modules['complex_circuit'] = circuit_module + rank_calls = [] + complement = extensions['trace_type'](circuit_module.Label) + if data_state['enabled']: + _epoch_context = {'data_handle': _INITIAL_INTEGRATION_HANDLES['data_adapters'], 'data_module': data_adapters, 'phase_function': Phases.wrap, 'phase_class': Phases, 'phase_owner': phases, 'driver_function': main_epoch, 'driver_record': _epoch_driver_origin, 'invocation_token': _epoch_invocation, 'disposition_state': data_state} + phases.call('private_set_and_data_adapter_installation', data_adapters.install_epoch_circuit, data_state, extensions, circuit_module, comparison, _INITIAL_EPOCH_BUNDLE[3], _epoch_load_ticket, _epoch_context) + else: + phases.call('private_set_and_data_adapter_installation', data_adapters.install_circuit, data_state, extensions, circuit_module, comparison) + side_writer = data_adapters.scientific_writer(data_state) + binding = None + captures = {} + if data_state['enabled']: + data_adapters.epoch_phase_wrap(data_state, phases, 'circuit', circuit_module.ComplexSideCircuit, '__init__', 'side_construction') + else: + phases.wrap(circuit_module.ComplexSideCircuit, '__init__', 'side_construction') + if data_state['enabled']: + data_adapters.epoch_phase_wrap(data_state, phases, 'checks', circuit_module.Checks, '__init__', 'checks_initialization') + else: + phases.wrap(circuit_module.Checks, '__init__', 'checks_initialization') + if data_state['enabled']: + data_adapters.epoch_phase_wrap(data_state, phases, 'module', circuit_module, 'compile_roles', 'compile_roles') + else: + phases.wrap(circuit_module, 'compile_roles', 'compile_roles') + if data_state['enabled']: + data_adapters.epoch_phase_wrap(data_state, phases, 'checks', circuit_module.Checks, 'verify_map', 'verify_map') + else: + phases.wrap(circuit_module.Checks, 'verify_map', 'verify_map') + if data_state['enabled']: + data_adapters.epoch_phase_wrap(data_state, phases, 'checks', circuit_module.Checks, 'verify_labels', 'verify_labels') + else: + phases.wrap(circuit_module.Checks, 'verify_labels', 'verify_labels') + original_roles = circuit_module.verify_role_frames + + def observe_roles(c, checks, code=None): + need('side' not in captures and code is not None, 'Unexpected role-frame invocation') + result = phases.call('verify_role_frames', original_roles, c, checks, code) + captures['side'] = (c, checks, code, result) + return result + if data_state['enabled']: + data_adapters.epoch_role_observer(data_state, observe_roles) + else: + circuit_module.verify_role_frames = observe_roles + certify = phases.call('cold_certify_import', importlib.import_module, 'certify') + phases.wrap(certify, 'verify_sources', 'original_upstream_verify_sources') + prepare = phases.call('cold_prepare_import', importlib.import_module, 'prepare_layers') + search = importlib.import_module('search_network') + phases.wrap(search, 'log_integer_bounds', 'full_log_integer_bounds') + original_serializable = prepare.serializable + depth = 0 + + def observe_serializable(value): + nonlocal depth + outer = depth == 0 + if outer: + need('full_return' not in captures and type(value) is dict, 'Unexpected outer serialization') + captures['full_return'] = value + depth += 1 + try: + if outer: + return phases.call('original_serializable', original_serializable, value) + return original_serializable(value) + finally: + depth -= 1 + prepare.serializable = observe_serializable + binding = phases.call('final_native_binding', data_adapters.bind_epoch_native if data_state['enabled'] else data_adapters.bind_native, data_state, backend, circuit_module, native, rank_calls, complement) + phases.call('construction_lease_sealing', data_adapters.seal, data_state) + phases.call('private_set_lease_sealing', adapters.seal, extensions) + if data_state['enabled']: + data_adapters.epoch_seal(data_state) + caller = runtime / 'scripts/complex_network.py' + old_argv = sys.argv + stdout = io.StringIO() + namespace = _epoch_cli_boundary(phases, data_state, extensions, caller, stdout, _epoch_invocation, old_argv) + cli_stdout = stdout.getvalue() + need(cli_stdout == EXPECTED_STDOUT, 'Original CLI stdout changed') + certificate_bytes = (runtime / 'certificates/complex-network.json').read_bytes() + need(certificate_bytes == reference_bytes, 'Original CLI certificate bytes differ from the pinned reference') + need(sys.modules['complex_circuit'] is circuit_module and namespace['ComplexSideCircuit'] is circuit_module.ComplexSideCircuit and (namespace['Checks'] is circuit_module.Checks) and (namespace['compile_roles'] is circuit_module.compile_roles) and (namespace['verify_role_frames'] is observe_roles) and (namespace['serializable'] is observe_serializable), 'Caller used a different scientific module or observation binding') + need(captures.keys() == {'side', 'full_return'}, 'Missing exact caller observations') + c, checks, code, role_result = captures['side'] + full_return = captures['full_return'] + need(full_return['role_frames'] is role_result and full_return['upstream_commit'] == UPSTREAM, 'Role return or actual source verification boundary changed') + for name in ('side_construction', 'checks_initialization', 'compile_roles', 'verify_map', 'verify_labels', 'verify_role_frames', 'original_upstream_verify_sources', 'full_log_integer_bounds', 'original_serializable', 'complete_original_cli'): + need(phases.rows.get(name, {}).get('calls') == 1, 'Original phase was omitted or repeated: ' + name) + imports = {} + for name in script_names - {'complex_network'}: + module = sys.modules.get(name) + expected_path = engine / 'source/complex_circuit.py' if name == 'complex_circuit' else runtime / 'scripts' / (name + '.py') + need(module is not None and Path(module.__file__).resolve() == expected_path.resolve(), 'Unpinned scientific import: ' + name) + imports[name] = str(module.__file__) + if binding is not None: + binding['runtime_guard'].check() + need(binding['counters'] == {'complement_native': 238685, 'complement_fallback': 0, 'gram_native': 59959, 'gram_fallback': 0}, 'Native full-call coverage changed') + side_result = {key: full_return[key] for key in ('circuit', 'side_map', 'labels', 'role_frames')} + witness = {'support': c.support, 'args': c.args, 'kind': c.kind, 'active': sorted(c.active), 'pieces': [(target, node, (coefficient.numerator, coefficient.denominator)) for target, node, coefficient in c.pieces], 'labels': [(key, list(label.basis.items()), label.dim, label.key) for key, label in checks.cache.items()], 'code': {'roles': code['roles'], 'gates': code['gates'], 'sources': list(code['sources'].items()), 'outputs': list(code['outputs'].items())}} + side_output = output / 'side-observations' + side_output.mkdir() + side_receipt = phases.call('identical_lossless_side_serialization', side_writer, side_output, side_result, witness, rank_calls) + complement_receipt = complement.receipt() + need(complement_receipt == COMPLEMENT_EXPECTED, 'Every ordered complement observation must match PR5929') + full_typed_bytes = canonical(typed(full_return)) + (output / 'full-return.lossless.json').write_bytes(full_typed_bytes) + (output / 'original-stdout.txt').write_text(cli_stdout, encoding='utf-8') + (output / 'complement-transcript.json').write_bytes(canonical(complement_receipt) + b'\n') + science = {'full_cli_certificate_sha256': sha(certificate_bytes), 'full_cli_stdout_sha256': sha(cli_stdout.encode('utf-8')), 'full_return_lossless_sha256': sha(full_typed_bytes), 'side': side_receipt, 'ordered_complements': complement_receipt, 'upstream_commit': UPSTREAM} + anchor = {'schema': 'gf2-full-network-anchor-v1', 'base_commit': BASE, 'source_pin_sha256': PIN_SHA, 'driver_sha256': REFERENCE_DRIVER_SHA, 'engine_pins': ENGINE_PINS, 'science': science} + if expected_anchor is not None: + need(anchor == expected_anchor, 'Complete certificate/types/ordered observations differ from frozen anchor') + else: + (output / 'anchor.json').write_bytes(canonical(anchor) + b'\n') + need(inventory(frozen, pins) == frozen_before and inventory(HERE / 'engine', ENGINE_PINS) == engine_before, 'Immutable source bytes/modes changed') + need(inventory(runtime, pins, exact=False) == runtime_before and inventory(engine, ENGINE_PINS) == copied_engine_before, 'Runtime scientific source bytes/modes changed') + runtime_files = {str(path.relative_to(runtime)) for path in runtime.rglob('*') if path.is_file()} + need(runtime_files == set(pins) | {'certificates/complex-network.json'}, 'Unexpected full-caller file side effect') + need(Path(__file__).read_bytes() == driver_before and reference.read_bytes() == reference_bytes and (anchor_bytes is None or args.anchor.read_bytes() == anchor_bytes), 'Driver/reference/anchor changed during run') + need(adapters.custody(ROUND, args.lanes) == new_custody_before, 'New source custody changed') + bookkeeping_receipt = adapters.receipt(extensions) + data_receipt = phases.call('data_finalization', data_adapters.finish, data_state, binding) + phases.call('terminal_native_cleanup_and_checks', data_adapters.finish_before_late, data_state) + phases.call('bootstrap_late_last', data_adapters.finish_late_last, data_state) + need(data_adapters.custody(ROUND) == data_custody_before, 'Data source custody changed') + need(adapters.custody(ROUND, args.lanes) == new_custody_before, 'Post-late original source custody changed') + need(inventory(frozen, pins) == frozen_before and inventory(HERE / 'engine', ENGINE_PINS) == engine_before, 'Post-late immutable source custody changed') + need(inventory(runtime, pins, exact=False) == runtime_before and inventory(engine, ENGINE_PINS) == copied_engine_before, 'Post-late copied source custody changed') + need(Path(__file__).read_bytes() == driver_before and reference.read_bytes() == reference_bytes and (anchor_bytes is None or args.anchor.read_bytes() == anchor_bytes), 'Post-late driver/reference/anchor changed') + receipt = {'new_source_custody': new_custody_before, 'status': 'FULL_NETWORK_PROFILE_ANCHOR_PASS' if args.mode == 'profile' else 'FULL_NETWORK_COMPLETE_PASS', 'mode': args.mode, 'lanes': args.data_lanes, 'bookkeeping': bookkeeping_receipt, 'data_handling': data_receipt, 'data_source_custody': data_custody_before, 'reference_driver_sha256': REFERENCE_DRIVER_SHA, 'science': science, 'base_commit': BASE, 'native_predecessor_pr': 5995, 'driver_sha256': sha(driver_before), 'source_pin_sha256': PIN_SHA, 'frozen_custody': frozen_before, 'engine_custody': engine_before, 'scientific_imports': imports, 'build': build, 'finite_controls': finite, 'initial_native_tcb': INITIAL_NATIVE_TCB_RECEIPT, 'native_packet': native_packet.receipt(packet), 'private_root_permission': 'runtime-root is0755; copied input file modes are retained and checked; immutable stages are never chmodded', 'compiler_tmpdir': str(compiler_tmp), 'native_calls': None if binding is None else dict(binding['counters']), 'phases': phases.rows, 'driver_wall_seconds_after_initial_tcb_before_receipt': time.perf_counter() - START_WALL, 'process_and_compiler_cpu_seconds_before_receipt': cpu(), 'environment': {'python': sys.version, 'executable': sys.executable, 'platform': sys.platform}, 'measurement': 'Parent outer guard is authoritative and includes pristine root startup, initial native TCB authentication, early cold source authority capture and every factory dependency/product check, three cold metadata compilations plus original cold native/trace builds, every old and new control in BOTH arms, all candidate production admission/guards, IO and terminal cleanup. Baseline receives the complete same control union. Driver wall diagnostic starts after initial TCB and cold authority capture and is not total process wall. Broad phase samples are nested, not additive; VmRSS is current RSS and ru_maxrss is process high-water. Eager witnesses and original observations remain; full funding and equality gates are separate and currently closed.', 'scope': 'Complete frozen historical complex-network CLI with retained observations; conditional certificate only. No bare-CLI factor, selected-frontier, new kappa or PR5864 speed claim.'} + (output / 'receipt.json').write_text(json.dumps(receipt, indent=2, sort_keys=True) + '\n') + sys.stdout.write(cli_stdout) + print(json.dumps({'status': receipt['status'], 'mode': args.mode, 'science': science, 'wall_seconds': receipt['driver_wall_seconds_after_initial_tcb_before_receipt'], 'cpu_seconds_with_compiler': receipt['process_and_compiler_cpu_seconds_before_receipt'], 'phases': phases.rows}, sort_keys=True)) + except BaseException as _epoch_error: + _epoch_primary = _epoch_error + if _epoch_outer_cleanup is not None: + _epoch_outer_cleanup['primary'] = _epoch_error + raise + finally: + try: + if _epoch_outer_cleanup is not None: + _epoch_outer_cleanup['attempted'] = True + data_adapters.epoch_retire(data_state, 'whole-cli-terminal', _epoch_primary, None, None, None, 'outer') + except BaseException as _epoch_outer_error: + _epoch_outer_retirement_error = _epoch_outer_error + if _epoch_outer_cleanup is not None: + _epoch_outer_cleanup['retirement_error'] = _epoch_outer_error + _epoch_outer_cleanup['uncertain'] = True + if _epoch_primary is None: + _epoch_primary = _epoch_outer_error + if _epoch_outer_cleanup is not None: + _epoch_outer_cleanup['primary'] = _epoch_outer_error + raise + +def _run_epoch_with_stop_evidence(): + try: + main_epoch() + except BaseException as primary_error: + try: + state = _EXECUTION['state'] + cleanup_errors = [] + try: + cleanup_errors = data_adapters.epoch_cleanup_owned(state) + except BaseException as cleanup_error: + cleanup_errors.append({'type': type(cleanup_error).__name__, 'message': str(cleanup_error)}) + stop = {'schema': 'h25-combined-v2-stop-v1', 'status': 'STOP', 'primary_error': {'type': type(primary_error).__name__, 'message': str(primary_error)}, 'primary_cause': None if primary_error.__cause__ is None else {'type': type(primary_error.__cause__).__name__, 'message': str(primary_error.__cause__)}, 'cleanup_errors': cleanup_errors, 'data': data_adapters.epoch_stop_diagnostics(state), 'native_packet': None if _EXECUTION['packet'] is None else native_packet.receipt(_EXECUTION['packet']), 'initial_native_tcb': INITIAL_NATIVE_TCB_RECEIPT} + output = _EXECUTION['output'] + if output is not None: + with (output / 'STOP.json').open('x', encoding='utf-8') as stream: + stream.write(json.dumps(stop, sort_keys=True, indent=2) + '\n') + except BaseException as evidence_error: + try: + sys.stderr.write('STOP evidence write failed: ' + type(evidence_error).__name__ + '\n') + except BaseException: + pass + raise + +if __name__ == '__main__': + _run_epoch_with_stop_evidence() diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-full-contract-completion-v1/cache_epoch_source_controls.py.txt b/research/h25-cache-source-handoff/snapshot/areas/cache-full-contract-completion-v1/cache_epoch_source_controls.py.txt new file mode 100644 index 0000000000..def9b50770 --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-full-contract-completion-v1/cache_epoch_source_controls.py.txt @@ -0,0 +1,845 @@ +"""Concrete future SOURCE controls. Nothing in this module is an execution grant. + +Each case requires its own genuine source-authenticated cold owner/context from +an independently admitted parent control driver. No test model, fake assembler, +manual active=True, registry reset or changed FULL=None constant is permitted. +The actual construction/current-native/full-profile route is not configured. +Returns retain observations/error objects; they do not mint a family PASS. +""" +import json +import ast +import copy +import types +import hashlib +import sys +import io +from pathlib import Path + +EXECUTION_CONTRACT = None +REQUIRED_IDS = tuple('N%02d'%i for i in range(1,25))+tuple('P%02d'%i for i in range(1,9)) + +CASE_SCRIPT_SHA256 = '69df433711521d709c7045c8b6f9cd13ad92f4165d4b533d559b5447c46464e8' +FAULT_SOURCE_PINS = {'V2 source fault after acquired owner publication': '77bac9cb02d27fc7f2dda6d3a940a77329931eb9f219ff857c7d7cad822072a3', 'V2 source fault after original origin capture': '7524b7811243f7d8457eb45efa8e983f0eb6386467236af4bdef165ce1a3a2f4'} +CLI_FAULT_SOURCE_PINS = {'original_arm_entry': {'actual_arm_function': 'arm', 'adapter_file': 'epoch_adapters_cli_fault_v3.py', 'adapter_sha256': '57bcea26dd7abff4ab68a662be1b3a0de101af162d9e3077b45e31eb5e6aff69', 'authority_file': 'epoch_authority_cli_original_arm_entry_fault_v3.py', 'authority_sha256': '541b581ca9e92a09996023ac478870aecd78f418a91c2523d4aee9e5dbf93ebd', 'cache_file': 'epoch_cache_cli_fault_v3.py', 'cache_sha256': '8d2f19273c8f7990c53fe2d12249677a716df5da52106193e005b76d5539eeb1', 'data_file': 'epoch_data_cli_original_arm_entry_fault_v3.py', 'data_sha256': 'a6a2984acd9f21287800d3b13e86f0b5513387918ea9e8db6af9aedac48b60d1', 'disarm_source_wrapper_calls_actual_original_once': True, 'driver_file': 'epoch_driver_cli_original_arm_entry_fault_v3.py', 'driver_sha256': 'c8c91c1d1716438601af48b9a018c3fccd90af56d384b2ae1b29257de5612726', 'intended_primary_message': 'V3 source-case original_arm_entry', 'kind': 'original_arm_entry', 'live_context_or_authority_granted': False, 'retirement_source_wrapper_calls_actual_original_once': True}, 'original_arm_after_set': {'actual_arm_function': 'arm', 'adapter_file': 'epoch_adapters_cli_fault_v3.py', 'adapter_sha256': '57bcea26dd7abff4ab68a662be1b3a0de101af162d9e3077b45e31eb5e6aff69', 'authority_file': 'epoch_authority_cli_original_arm_after_set_fault_v3.py', 'authority_sha256': '2639b280655e641519a078aeee381436428ac76d54103eeb6ad744e89a06900e', 'cache_file': 'epoch_cache_cli_fault_v3.py', 'cache_sha256': '8d2f19273c8f7990c53fe2d12249677a716df5da52106193e005b76d5539eeb1', 'data_file': 'epoch_data_cli_original_arm_after_set_fault_v3.py', 'data_sha256': '3415eee67bef773d8a2145dd115fec7e499312c779356bd8f756e465aa820d51', 'disarm_source_wrapper_calls_actual_original_once': True, 'driver_file': 'epoch_driver_cli_original_arm_after_set_fault_v3.py', 'driver_sha256': '17c68a4ea1b39da6db77ae8497f8ba532e3fb8c3bf1c81f788731841cbe5e0c8', 'intended_primary_message': 'V3 source-case original_arm_after_set', 'kind': 'original_arm_after_set', 'live_context_or_authority_granted': False, 'retirement_source_wrapper_calls_actual_original_once': True}, 'epoch_arm_entry': {'actual_arm_function': 'epoch_arm', 'adapter_file': 'epoch_adapters_cli_fault_v3.py', 'adapter_sha256': '57bcea26dd7abff4ab68a662be1b3a0de101af162d9e3077b45e31eb5e6aff69', 'authority_file': 'epoch_authority_cli_epoch_arm_entry_fault_v3.py', 'authority_sha256': '6e58f52df3f7f5b0bc9ef790548978d18ab6df20b4f56ed7e5cd46a1ebe50d6d', 'cache_file': 'epoch_cache_cli_fault_v3.py', 'cache_sha256': '8d2f19273c8f7990c53fe2d12249677a716df5da52106193e005b76d5539eeb1', 'data_file': 'epoch_data_cli_epoch_arm_entry_fault_v3.py', 'data_sha256': '035e8a6612ce327af27577f93c830570dedcc0ad1759d75807668e3bdfc04da5', 'disarm_source_wrapper_calls_actual_original_once': True, 'driver_file': 'epoch_driver_cli_epoch_arm_entry_fault_v3.py', 'driver_sha256': '5962859a775721e20240c2e63d8028e24bc73b019ba5104c45703b8bd32e3a75', 'intended_primary_message': 'V3 source-case epoch_arm_entry', 'kind': 'epoch_arm_entry', 'live_context_or_authority_granted': False, 'retirement_source_wrapper_calls_actual_original_once': True}, 'disarm_only': {'actual_arm_function': 'arm', 'adapter_file': 'epoch_adapters_cli_fault_v3.py', 'adapter_sha256': '57bcea26dd7abff4ab68a662be1b3a0de101af162d9e3077b45e31eb5e6aff69', 'authority_file': 'epoch_authority_cli_disarm_only_fault_v3.py', 'authority_sha256': '5f3450b5f278627d33ad313e52bd022c81f831c34934f2ed8725131ff406885a', 'cache_file': 'epoch_cache_cli_fault_v3.py', 'cache_sha256': '8d2f19273c8f7990c53fe2d12249677a716df5da52106193e005b76d5539eeb1', 'data_file': 'epoch_data_cli_disarm_only_fault_v3.py', 'data_sha256': '18679fd1eb6ae99c4b375756511427c26718f77674c2d8fcc490e25ceb47cba5', 'disarm_source_wrapper_calls_actual_original_once': True, 'driver_file': 'epoch_driver_cli_disarm_only_fault_v3.py', 'driver_sha256': 'bbe123c827940fd301e58e89e108702329a747b7d2dcecaf666ae8b3bc869463', 'intended_primary_message': 'V3 source-case disarm_only', 'kind': 'disarm_only', 'live_context_or_authority_granted': False, 'retirement_source_wrapper_calls_actual_original_once': True}, 'body_disarm': {'actual_arm_function': 'arm', 'adapter_file': 'epoch_adapters_cli_fault_v3.py', 'adapter_sha256': '57bcea26dd7abff4ab68a662be1b3a0de101af162d9e3077b45e31eb5e6aff69', 'authority_file': 'epoch_authority_cli_body_disarm_fault_v3.py', 'authority_sha256': '5f3450b5f278627d33ad313e52bd022c81f831c34934f2ed8725131ff406885a', 'cache_file': 'epoch_cache_cli_fault_v3.py', 'cache_sha256': '8d2f19273c8f7990c53fe2d12249677a716df5da52106193e005b76d5539eeb1', 'data_file': 'epoch_data_cli_body_disarm_fault_v3.py', 'data_sha256': '18679fd1eb6ae99c4b375756511427c26718f77674c2d8fcc490e25ceb47cba5', 'disarm_source_wrapper_calls_actual_original_once': True, 'driver_file': 'epoch_driver_cli_body_disarm_fault_v3.py', 'driver_sha256': 'bbe123c827940fd301e58e89e108702329a747b7d2dcecaf666ae8b3bc869463', 'intended_primary_message': 'V3 source-case body_disarm', 'kind': 'body_disarm', 'live_context_or_authority_granted': False, 'retirement_source_wrapper_calls_actual_original_once': True}, 'body_disarm_retirement': {'actual_arm_function': 'arm', 'adapter_file': 'epoch_adapters_cli_fault_v3.py', 'adapter_sha256': '57bcea26dd7abff4ab68a662be1b3a0de101af162d9e3077b45e31eb5e6aff69', 'authority_file': 'epoch_authority_cli_body_disarm_retirement_fault_v3.py', 'authority_sha256': 'b5b7cfb68f3dfa73c9183f79c1ce4364ba25493b8c58986e4f95c7c1883592b3', 'cache_file': 'epoch_cache_cli_fault_v3.py', 'cache_sha256': '8d2f19273c8f7990c53fe2d12249677a716df5da52106193e005b76d5539eeb1', 'data_file': 'epoch_data_cli_body_disarm_retirement_fault_v3.py', 'data_sha256': '182565e53294e306e3c2dce51388f699ea3c7f66b9af22812a7a52269c680f34', 'disarm_source_wrapper_calls_actual_original_once': True, 'driver_file': 'epoch_driver_cli_body_disarm_retirement_fault_v3.py', 'driver_sha256': '7d829ea72c0c11dff4eb154025bfe98bdd5d6fcadfcd75a5f733788a962b554c', 'intended_primary_message': 'V3 source-case body_disarm_retirement', 'kind': 'body_disarm_retirement', 'live_context_or_authority_granted': False, 'retirement_source_wrapper_calls_actual_original_once': True}} + +def _need(value,message): + if not value:raise RuntimeError(message) + + +def _dispatch(c,index,*args): + d=c['bundle'][3];p=d[5];fn=d[2];r=d[3] + _need(type(d) is tuple and len(d)==6 and type(p) is tuple and len(p)==19 and + p[0] is type and p[1] is types.FunctionType and p[2] is id and p[18] is zip, + 'Control genuine native caller primitives') + _need(type(fn) is p[1] and fn is r[0],'Control actual dispatcher') + for (_,get),value in p[18](p[4],r[1:7]): + _need(get(fn,p[1]) is value,'Control dispatcher fields') + _need(r[4] is None and r[5] is None and not r[7],'Control dispatcher grammar') + for cell,value in r[8]:_need(p[6](cell,p[5]) is value,'Control dispatcher cell') + return fn(index,*args) + + +def _live(c): + s=c['state']['epoch_suite'];_dispatch(c,5,s.handle,s) + return s + + +def _ledger(c): + protected=c['bundle'][2][5] + outer=dict(zip(protected.__code__.co_freevars,protected.__closure__)) + function=outer['function'].cell_contents + cells=dict(zip(function.__code__.co_freevars,function.__closure__)) + ledger=cells['ledger'].cell_contents + _need(type(ledger) is c['authority_module'].EpochLedger,'Control actual ledger class') + return ledger + + +def _counts(c): + return tuple(sorted(c['binding']['counters'].items())) if 'binding' in c else () + + +def _reject(c,operation,*args,**kwargs): + before=_counts(c) + try:operation(*args,**kwargs) + except BaseException as error: + _need(_counts(c)==before,'Rejected path performed original native arithmetic') + return {'error':error,'native_before':before,'native_after':_counts(c)} + raise RuntimeError('Required control refusal was absent') + + +def N01(c): + # A foreign backend/source handle never reaches load_source. + return _reject(c,_dispatch,c,0,'load',object()) + + +def N02(c): + # Genuine module from the consumed load ticket; mutate before original guard. + c['module'].__dict__['echelon']=c['foreign_function'] + return _reject(c,_dispatch,c,0,'factories',*c['factory_arguments']) + + +def N03(c): + s=_live(c);ledger=_ledger(c);origin=ledger.origin(s.handle) + _need(origin['phase'] in ('FACTORIES_ADMITTED','CALLERS_INSTALLED'),'N03 needs genuine pre-native finite-ledger context') + result=_reject(c,ledger.authorize,s.handle,'module','echelon',s.E0,c['foreign_function'],'row_function',((),())) + _intended_error(result['error'],RuntimeError,('Epoch finite slot/role',),type(ledger).authorize.__code__) + return result + + + +def N04(c): + s=_live(c);function=s.products['canonical'] + # This same-code/different-default change is checked before product use. + function.__defaults__=(None,) + return _reject(c,_dispatch,c,5,s.handle,s) + + +def N05(c): + s=_live(c);c['module'].__dict__['Label']=c['foreign_class'] + return _reject(c,_dispatch,c,5,s.handle,s) + + +def N06(c): + s=_live(c);c['module'].__dict__['echelon']=c['foreign_function'] + return _reject(c,_dispatch,c,5,s.handle,s) + + +def N07(c): + s=_live(c);ledger=_ledger(c);origin=ledger.origin(s.handle) + _need(origin['phase'] in ('FACTORIES_ADMITTED','CALLERS_INSTALLED'),'N07 needs genuine finite-ledger phase') + result=_reject(c,ledger.authorize,s.handle,'module','unregistered_slot',s.E0,c['foreign_function'],'canonical',((),())) + _intended_error(result['error'],RuntimeError,('Epoch finite slot/role',),type(ledger).authorize.__code__) + return result + + + +def N08(c): + s=_live(c);origin=_ledger(c).origin(s.handle) + original=dict(origin['class_map'][id(s.label)][2])['__init__'] + original.__code__=c['foreign_function'].__code__ + return _reject(c,_dispatch,c,5,s.handle,s) + + +def N09(c): + s=_live(c);del c['module'].__dict__['echelon'] + return _reject(c,s.current) + + +def N10(c): + s=_live(c);ledger=_ledger(c);origin=ledger.origin(s.handle) + _need(origin['phase']=='GLOBALS_COMMITTED' and c['binding']['runtime_guard'] is origin['raw_guard'] and + s.owner.runtime is origin['raw_guard'],'N10 needs actual post-initializer pre-finish checkpoint, never a manual phase change') + c['module'].__dict__['undeclared_source_slot']=object() + result=_reject(c,_dispatch,c,3,s.handle,s,'finish',c['binding'],s.owner) + _intended_error(result['error'],RuntimeError,('Epoch source namespace owner/census',),type(ledger).check.__code__) + return result + + + +def N11(c): + s=_live(c);original=c['registered_row_bind_ast'];bad=copy.deepcopy(original) + bad.body.append(ast.parse('undeclared_arithmetic_change()').body[0]) + # _epoch_locations is the exact production reconstructive structural gate. + return _reject(c,c['cache_module']._epoch_locations,bad,original) + + +def N12(c): + s=_live(c) + return _reject(c,s.construct,'wrong-site',c['checks'],None,c['vectors']) + + +def N13(c): + s=_live(c);req=c['live_request'];values=req['registered'] + original=values[0][2];equal_distinct=tuple(list(original)) + _need(equal_distinct==original and equal_distinct is not original,'Need actual nonempty equal/distinct key fixture') + key=('label',equal_distinct) if req['kind']=='label' else (equal_distinct,values[1][2]) + return _reject(c,s.data,req,'entry',req['checks'],key,req['operands'],req['kind']) + + +def N14(c): + s=_live(c);_need(s.pending is not None,'Need genuine in-flight original constructor checkpoint') + result=_reject(c,s.construct,'C2',c['checks'],c['node'],c['vectors']) + _need(s.terminal and not s.active and s.pending is None,'Nested constructor did not retire') + return result + + +def N15(c): + s=_live(c);primary=None + try:s.products['C2'](c['checks'],c['node']) + except BaseException as error:primary=error + _need(primary is not None and s.pending is None and not s.registry and s.primary_error is primary, + 'Actual original constructor/store failure custody') + return {'primary':primary,'secondary':s.secondary_error,'uncertain':s.uncertain} + + +def N16(c): + s=_live(c);before=len(s.registry) + public=c['module'].Label(c['vectors']) + _need(len(s.registry)==before and id(public) not in s.registry,'Public constructor acquired private authority') + result=_reject(c,s.request,object(),'label',c['checks'].label_ok,public) + return dict(result,public_label=public) + + +def N17(c): + s=_live(c);request=c['consumed_request'] + _need(request['stage']==3,'Need actual consumed invocation') + return _reject(c,s._request,request,0) + + +def N18(c): + s=_live(c);s.retire('source-control-terminal') + result=_reject(c,s.arm,c['invocation_token']) + _intended_error(result['error'],RuntimeError,('Epoch retired/consumed generation cannot arm',),type(s).arm.__code__) + return result + + + +def N19(c): + s=_live(c);lab=c['registered_label'];lab.basis=dict(c['replacement_basis']) + # Real public method enters the old guard then retires before key callbacks. + result=c['checks'].label_ok(lab) + _need(s.terminal and not s.registry,'Public mutable label kept private authority') + _need(type(result) is type(c['literal_expected']) and result==c['literal_expected'],'Literal public result changed') + return {'value':result,'owner':dict(s.owner.receipt),'epoch':dict(s.receipt)} + + +def N20(c): + # Actual unchanged 155 control function contains the canonical 2 HIT / + # 1 complement and wide 1 fallback assertions. This additional invocation + # is fully charged if the parent includes it; no cached receipt is used. + controls=c['legacy_controls'] + result=controls.run_controls(*c['legacy_control_args'],**c['legacy_control_kwargs']) + _need(type(result) is dict and result['v8_caller_case_count']==12 and + result['native_consumer_case_count']==10,'Actual old control census changed') + return result + + +def N21(c): + s=_live(c) + # Parent delivers the actual retained collision/reentry fixture operands; + # no replacement cache method or fake boolean is used by this control. + result=c['checks'].residual_ok(c['callback_small'],c['callback_big']) + _need(not s.active and s.terminal,'Public callback path retained private epoch') + _need(type(result) is type(c['literal_expected']) and result==c['literal_expected'],'Public callback result differs') + return {'value':result,'owner':dict(s.owner.receipt)} + + +def N22(c): + s=_live(c);_need(len(s.registry)==85196 and s.pending is not None,'Need real metadata-capacity checkpoint') + s.commit(c['site'],c['checks']) + _need(s.terminal and not s.registry and s.pending is None,'Capacity did not retire metadata') + answer=c['checks'].label_ok(c['registered_label']) + _need(type(answer) is type(c['literal_expected']) and answer==c['literal_expected'],'Capacity continuation changed original result') + return {'value':answer,'capacity_retirements':s.receipt['capacity_retirements'],'owner':dict(s.owner.receipt)} + + +def N23(c): + s=_live(c) + _need(s.active is False and s.terminal is False and s.primary_error is None and s.secondary_error is None,'Need genuine unarmed fresh role source case') + roles=s.products['roles'];s_context=c['circuit'];checks=c['checks'] + _need(type(checks) is s.checks_class and type(s_context) is s.module.ComplexSideCircuit,'Need actual original source objects') + cls=type(s);original=cls.retire;secondary=RuntimeError('epoch source-case retirement secondary') + def failure(self,reason):raise secondary + caught=None + cls.retire=failure + try: + try:raise LookupError('unrelated outer handled exception') + except LookupError: + try:roles(s_context,checks,{'_h25_missing_roles':1}) + except BaseException as error:caught=error + finally:cls.retire=original + _intended_error(caught,KeyError,('roles',),roles.__code__) + _need(s.primary_error is caught and s.secondary_error is secondary and secondary is not caught and s.uncertain and s.terminal and not s.active and not s.registry and s.pending is None, + 'Automatic role-finally did not preserve actual original body primary') + return {'primary':caught,'secondary':secondary,'uncertain':s.uncertain,'automatic_role_boundary':roles.__code__} + + + +def N24(c): + s=c['state']['epoch_suite'] + _need(c['cache_module'].EPOCH_FULL_EXECUTION_CONTRACT is None and not s.terminal and not s.invocation_consumed, + 'Current FULLNone case requires a fresh otherwise eligible generation') + result=_reject(c,s.arm,c['invocation_token']) + _intended_error(result['error'],RuntimeError,('Epoch full context is not admitted',),type(s).arm.__code__) + return result + + + +def P01(c): + s=_live(c);checks=c['checks'];before=dict(s.receipt) + a=checks.label(c['fresh_active_node']);b=checks.target_frame(c['fresh_output_S']) + for value in (checks.everything,a,b): + record=s.registry.get(id(value)) + _need(record is not None and record[0] is value and record[1] is value.basis and + record[2] is value.key and record[4] is checks and record[6]==s.generation,'Actual post-store pairing') + _need({s.registry[id(x)][5] for x in (checks.everything,a,b)}=={'C1','C2','C3'},'All actual constructor sites') + _need(s.receipt['constructors']-before['constructors']==2 and s.receipt['key_loads']-before['key_loads']==2 and + s.receipt['basis_loads']-before['basis_loads']==2,'Exactly one constructor capture per new label') + return {'before':before,'after':dict(s.receipt),'objects':(checks.everything,a,b)} + + +def P02(c): + s=_live(c) + s.products['labels'](c['checks']) + result=c['module'].verify_role_frames(c['circuit'],c['checks'],c['code']) + _need(type(result) is dict and result==c['reference_role_result'] and not s.registry and not s.active,'Actual caller completion/retirement') + # Independent original cold child supplies raw typed oracle values, never + # an accepted/PASS flag. Its source/provenance/oracle gate remains separate. + _need(c['rank_events']==c['reference_rank_events'] and c['trace'].receipt()==c['reference_trace'], + 'Original ordered rank/complement events changed') + _need(c['binding']['counters']==c['reference_native_counters'],'Original native call counts changed') + _need(c['actual_outputs']==c['reference_outputs'],'Independent original typed outputs changed') + return {'value':result,'native':dict(c['binding']['counters']),'epoch':dict(s.receipt)} + + +def P03(c): + s=_live(c);ledger=_ledger(c);origin=ledger.origin(s.handle) + _need(origin['phase']=='SEALED' and origin['raw_guard'] is s.owner.runtime,'Actual final raw/sealed guard') + _need(len(origin['slots'])==15 and len(c['bundle'][1])==7 and c['bundle'][3][1] is c['bundle'][2], + 'Finite lineages or legacy grammar changed') + ledger.check(s.handle) + return {'edges':tuple(origin['edges']),'phase':origin['phase'],'original_records':origin['functions']} + + +def P04(c): + s=_live(c);n=len(s.registry);label=c['module'].Label(c['vectors']) + _need(len(s.registry)==n and id(label) not in s.registry,'Public Label gained private registration') + answer=c['checks'].label_ok(label) + _need(s.terminal and type(answer) is type(c['literal_expected']) and answer==c['literal_expected'],'Public validated result') + return {'value':answer,'owner':dict(s.owner.receipt)} + + +def P05(c): + s=_live(c);answer=c['checks'].residual_ok(c['small'],c['big']) + _need(s.terminal and not s.registry,'Public reentry did not retire') + _need(type(answer) is type(c['literal_expected']) and answer==c['literal_expected'],'Validated V8 continuation differs') + _need(s.owner.receipt['snapshots']>c['snapshots_before'],'Real current-data validation absent') + return {'value':answer,'owner':dict(s.owner.receipt)} + + +def P06(c): + s=_live(c) + for value,basis,key,dimension,checks,site,generation in s.registry.values(): + _need((checks.everything is value if site=='C1' else any(item is value for item in checks.cache.values())), + 'Registry extends original store lifetime') + s.role_retire() + _need(not s.registry and s.pending is None and s.checks is None,'Last-role references retained') + return {'epoch':dict(s.receipt),'native':_counts(c)} + + +def P07(c): + observed=N22(c) + _need(c['remaining_original_case_count']==c['reference_remaining_case_count'] and + c['remaining_original_outputs']==c['reference_remaining_outputs'],'Capacity skipped original work') + return observed + + +def P08(c): + s=_live(c);driver=c['driver_module'];data=c['data_module'];extensions=c['extensions'] + kind=c['case_kind'] + _need(type(kind) is str and kind in ('original_arm_entry','original_arm_after_set','epoch_arm_entry','body'), + 'P08 exact source-case variant required') + _need(s.active is False and s.terminal is False and s.primary_error is None and + driver.data_adapters is data and driver._EXECUTION['state'] is c['state'] and + driver._INITIAL_EPOCH_BUNDLE is c['bundle'] and c['invocation_token'] is s.context['invocation_token'], + 'P08 genuine untouched parent/source/invocation context') + if kind=='body': + # This original oracle is preserved, not silently replaced by FULLNone. + # Frozen current products cannot qualify this variant; it requires a + # separately independently admitted genuine full source-control context. + _need(type(c['cache_module'].EPOCH_FULL_EXECUTION_CONTRACT) is dict, + 'P08 original-body source context is OPEN; FULLNone is not its expected error') + return _p08_original_body(c,s) + pins=CLI_FAULT_SOURCE_PINS[kind] + modules={'data':data,'driver':driver,'authority':c['authority_module'], + 'cache':c['cache_module'],'adapter':driver.adapters} + for key,module in modules.items(): + _need(hashlib.sha256(Path(module.__file__).read_bytes()).hexdigest()==pins[key+'_sha256'], + 'P08 exact distinct source-case image required; production map is not widened') + expected=data._V3_ARM_ERROR;secondary=driver.adapters._V3_DISARM_ERROR;retirement=c['cache_module']._V3_RETIRE_ERROR + before=_counts(c);old_argv=sys.argv;owner=extensions['set_binding']['owner'];caught=None + _need(owner.cli_active is False and owner.circuit is None and owner.used is False, + 'P08 genuine pre-arm original lease required, never a fabricated active flag') + try:driver._epoch_cli_boundary(c['phases'],c['state'],extensions,c['case_script_path'],io.StringIO(),c['invocation_token'],old_argv) + except BaseException as error:caught=error + arm_function=data.epoch_arm if kind=='epoch_arm_entry' else data.arm + _intended_error(caught,RuntimeError,('V3 source-case '+kind,),arm_function.__code__) + _need(caught is expected and _has_frame(caught,driver._epoch_cli_boundary.__code__), + 'P08 earlier phase/FULL refusal masked actual arming failure') + _need(sys.argv is old_argv and owner.cli_active is False and owner.current is None and + owner.circuit is None and owner.checks is None and owner.triples is None, + 'P08 actual original argv/disarm boundary skipped on arming failure') + _need(_has_frame(secondary,driver.adapters._V3_ORIGINAL_DISARM.__code__) is False and + _has_frame(secondary,driver.adapters.disarm.__code__), 'P08 intended post-original-disarm source error frame') + _need(s.primary_error is caught and s.secondary_error is secondary and secondary is not caught and + any(error is retirement for error in s.secondary) and s.uncertain and s.terminal and not s.active, + 'P08 actual primary/disarm-secondary/retirement custody') + _need(_counts(c)==before,'P08 arming negative performed original native arithmetic') + return {'variant':kind,'primary':caught,'secondary':secondary,'retirement_error':retirement, + 'argv_restored':sys.argv is old_argv,'actual_set_disarmed':owner.cli_active is False,'uncertain':s.uncertain} + + + + +CASES = {name:globals()[name] for name in REQUIRED_IDS} + + +def _has_frame(error,code): + trace=error.__traceback__ + while trace is not None: + if trace.tb_frame.f_code is code:return True + trace=trace.tb_next + return False + + +def _intended_error(error,kind,args,code): + _need(type(error) is kind and type(error.args) is tuple and all(type(x) is str for x in error.args) and + error.args==args and _has_frame(error,code),'Wrong source-case error or earlier phase/FULL gate masked the intended boundary') + + +def V2_ROLE_CLEANUP_ONLY(c): + s=_live(c);roles=s.products['roles'];checks=c['checks'] + _need(s.active is False and s.terminal is False and s.primary_error is None and s.secondary_error is None,'Need fresh unarmed role cleanup-only case') + cls=type(s);original=cls.retire;secondary=RuntimeError('epoch cleanup-only primary') + def failure(self,reason):raise secondary + caught=None;cls.retire=failure + try: + try:raise LookupError('unrelated outer handled exception') + except LookupError: + try:roles(c['circuit'],checks,{'roles':0,'sources':{},'gates':[],'outputs':{}}) + except BaseException as error:caught=error + finally:cls.retire=original + _intended_error(caught,RuntimeError,('epoch cleanup-only primary',),roles.__code__) + _need(caught is secondary and s.primary_error is secondary and s.secondary_error is None and s.uncertain and s.terminal and not s.active and not s.registry, + 'Cleanup-only error was not the actual primary; ambient handled exception leaked') + return {'primary':caught,'secondary':s.secondary_error,'uncertain':s.uncertain} + + +def _owner_failure_case(c,marker,origin_expected): + state=c['state'];data=c['data_module'];before=_counts(c);caught=None + # The context selects a separately pinned pure-Python SOURCE fault copy. + # It never relabels that copy as the production authority source. + authority=c['authority_module'];source=Path(authority.__file__).read_bytes() + _need(hashlib.sha256(source).hexdigest()==FAULT_SOURCE_PINS[marker],'Wrong exact source fault image') + wrapped=c['bundle'][2][0];cells=dict(zip(wrapped.__code__.co_freevars,wrapped.__closure__)) + actual_admit=cells['function'].cell_contents + expected=next(x for x in authority._epoch_operations.__code__.co_consts if type(x) is types.CodeType and x.co_name=='admit') + _need(actual_admit.__globals__ is authority.__dict__ and actual_admit.__code__ is expected,'Actual fault source code ownership') + try:data.install_epoch_circuit(state,c['extensions'],c['module'],c['comparison'],c['bundle'][3],c['load_ticket'],c['factory_context']) + except BaseException as error:caught=error + _intended_error(caught,RuntimeError,(marker,),actual_admit.__code__) + record=state['epoch_acquisition'];prepared=state['cache_binding'] + _need(type(prepared) is dict and record['prepared'] is prepared and record['owner'] is prepared['owner'] and + record['published'] is True and record['primary'] is caught and state['cache_teardown_attempted'] is False, + 'Real acquired owner was not continuously on the existing parent disposition route') + _need((record['origin_handle'] is not None) is origin_expected,'Fault masked by earlier capture/phase boundary') + errors=data.epoch_cleanup_owned(state) + _need(state['cache_teardown_attempted'] is True and record['close_attempted'] is True,'Known-owned terminal cleanup was not attempted') + native_after=_counts(c);again=data.epoch_cleanup_owned(state) + _need(again==[] and _counts(c)==native_after,'Parent cleanup retried its terminal owner') + _need(record['primary'] is caught,'Cleanup replaced the designated factory primary') + if errors:_need(record['secondary'] is not None and record['uncertain'],'Actual cleanup failure lost raw secondary custody') + return {'primary':caught,'secondary':record['secondary'],'uncertain':record['uncertain'], + 'phase':record['phase'],'actual_teardown_receipt':state['cache_teardown_receipt'], + 'native_before':before,'native_after':native_after,'cleanup_errors':errors} + + +def V2_OWNER_FIRST_CAPTURE(c): + return _owner_failure_case(c,'V2 source fault after acquired owner publication',False) + + +def V2_OWNER_LATE_GRAPH(c): + return _owner_failure_case(c,'V2 source fault after original origin capture',True) + + +def V2_ORIGIN_FIRST_ALL_ROUTES(c): + # One fresh genuine source owner per route. The parent schedules all six + # variants separately; no origin/registry reset is used after a rejection. + s=_live(c);ledger=_ledger(c);cls=type(ledger);original=cls.origin;calls=[] + def forbidden(self,handle): + calls.append(handle) + raise AssertionError('foreign origin member was invoked') + index=c['route_index'];_need(type(index) is int and 1<=index<=6,'Exact covered source operation route') + args={1:(s.handle,s.context),2:(s.handle,s,'product'),3:(s.handle,s,'reconcile'), + 4:(s.handle,s),5:(s.handle,s),6:(s.handle,)}[index] + # All retained original function objects remain unchanged. Only the current + # class-member binding changes, so object-only caller checks cannot suffice. + before=_counts(c);caught=None;cls.origin=forbidden + try: + try:_dispatch(c,index,*args) + except BaseException as error:caught=error + finally:cls.origin=original + engine=dict(zip(c['bundle'][2][index].__code__.co_freevars,c['bundle'][2][index].__closure__))['engine_guard'].cell_contents + _intended_error(caught,RuntimeError,('Epoch engine class binding differs',),engine.__code__) + _need(calls==[] and _counts(c)==before,'Foreign class member or native arithmetic ran before primitive source guard') + return {'route':index,'primary':caught,'foreign_calls':tuple(calls),'native_before':before,'native_after':_counts(c)} + + +CASES.update({name:globals()[name] for name in ('V2_ROLE_CLEANUP_ONLY','V2_OWNER_FIRST_CAPTURE','V2_OWNER_LATE_GRAPH','V2_ORIGIN_FIRST_ALL_ROUTES')}) + + +def _p08_original_body(c,s): + # Required original body oracle through the SAME protected production path, + # including its actual arms. No direct helper shortcut, no no-op assembler, + # no current FULLNone overwrite or invented case-Root authority is used. + driver=c['driver_module'];checks=c['checks'];extensions=c['extensions'] + _need(type(checks) is s.checks_class and type(checks).__dict__['verify_labels'] is s.products['labels'], + 'Actual installed labels caller required') + path=c['case_script_path'];_need(hashlib.sha256(path.read_bytes()).hexdigest()==CASE_SCRIPT_SHA256,'Exact pre-role source-case script') + name='_h25_epoch_case_inputs_v2';_need(name not in sys.modules,'Freshly owned source-case input slot') + inputs=types.ModuleType(name);inputs.checks=checks;old_c=checks.c;checks.c=None + old_argv=sys.argv;caught=None;sys.modules[name]=inputs + try: + try:driver._epoch_cli_boundary(c['phases'],c['state'],extensions,path,io.StringIO(),c['invocation_token'],old_argv) + except BaseException as error:caught=error + finally: + checks.c=old_c + if sys.modules.get(name) is inputs:del sys.modules[name] + _intended_error(caught,AttributeError,("'NoneType' object has no attribute 'active'",),s.products['labels'].__code__) + _need(_has_frame(caught,driver._epoch_cli_boundary.__code__) and sys.argv is old_argv, + 'Actual original body/argv protected boundary absent') + owner=extensions['set_binding']['owner'] + secondary=driver.adapters._V3_DISARM_ERROR;retirement=c['cache_module']._V3_RETIRE_ERROR + _need(owner.cli_active is False and owner.current is None and owner.circuit is None and + owner.checks is None and owner.triples is None and s.primary_error is caught and + s.secondary_error is secondary and secondary is not caught and s.uncertain and + any(error is retirement for error in s.secondary), + 'Actual original body/disarm/retirement primary-secondary custody') + return {'variant':'body','primary':caught,'secondary':s.secondary_error,'retirement_error':retirement,'uncertain':s.uncertain} + + +def V3_INSTANCE_KEY_DOMAIN(c): + s=_live(c);ledger=_ledger(c);namespace=object.__getattribute__(ledger,'__dict__') + original=namespace['origins'];calls=[] + class Collision: + def __hash__(self):return hash('origins') + def __eq__(self,other): + calls.append(other) + raise AssertionError('foreign instance key equality invoked') + foreign=Collision();del namespace['origins'];namespace[foreign]=object();caught=None + try: + try:_dispatch(c,5,s.handle,s) + except BaseException as error:caught=error + finally: + # Restore only the owned fault binding. Never reset the captured actual + # origins table or revive a FAILED generation; parent discards child. + dict.__delitem__(namespace,foreign);namespace['origins']=original + guarded=c['bundle'][2][5] + engine=dict(zip(guarded.__code__.co_freevars,guarded.__closure__))['engine_guard'].cell_contents + _intended_error(caught,RuntimeError,('Epoch engine instance key domain differs',),engine.__code__) + _need(calls==[],'Instance key-domain refusal invoked foreign equality') + return {'primary':caught,'foreign_equalities':tuple(calls)} + + +def V3_FIXED_RECORD_BINDINGS(c): + s=_live(c);ledger=_ledger(c);field=c['fixed_record_field'] + _need(type(field) is str and field in ('class_origin','method_origin'),'Exact independently bound fixed-record case') + namespace=object.__getattribute__(ledger,'__dict__');original=namespace[field] + replacement=tuple(list(original));_need(replacement is not original,'Distinct fixed-record binding required') + namespace[field]=replacement;caught=None + try: + try:_dispatch(c,5,s.handle,s) + except BaseException as error:caught=error + finally:namespace[field]=original + guarded=c['bundle'][2][5] + engine=dict(zip(guarded.__code__.co_freevars,guarded.__closure__))['engine_guard'].cell_contents + _intended_error(caught,RuntimeError,('Epoch engine fixed record binding differs',),engine.__code__) + return {'primary':caught,'fixed_record_field':field,'distinct_binding':True} + + +CASES.update({name:globals()[name] for name in ('V3_INSTANCE_KEY_DOMAIN','V3_FIXED_RECORD_BINDINGS')}) + + +def V3_INSTANCE_METHOD_SHADOW(c): + s=_live(c);ledger=_ledger(c);namespace=object.__getattribute__(ledger,'__dict__');calls=[] + _need('origin' not in namespace,'Fresh actual engine has no instance method shadow') + def forbidden(handle): + calls.append(handle) + raise AssertionError('foreign instance origin invoked') + namespace['origin']=forbidden;caught=None + try: + try:_dispatch(c,5,s.handle,s) + except BaseException as error:caught=error + finally:del namespace['origin'] + guarded=c['bundle'][2][5] + engine=dict(zip(guarded.__code__.co_freevars,guarded.__closure__))['engine_guard'].cell_contents + _intended_error(caught,RuntimeError,('Epoch engine instance member census differs',),engine.__code__) + _need(calls==[],'Instance shadow invoked before refusal') + return {'primary':caught,'foreign_calls':tuple(calls)} + + +def V3_INSTANCE_STATE_SCHEMA(c): + s=_live(c);ledger=_ledger(c);namespace=object.__getattribute__(ledger,'__dict__');field=c['state_schema_field'] + _need(type(field) is str and field in ('phase','serial','failure'),'Exact finite changing-field schema case') + original=namespace[field];calls=[] + class Foreign: + def __eq__(self,other): + calls.append(other);raise AssertionError('foreign scalar equality invoked') + @property + def __class__(self): + calls.append('class');raise AssertionError('foreign scalar class callback invoked') + bad=False if field=='serial' else Foreign() + namespace[field]=bad;caught=None + try: + try:_dispatch(c,5,s.handle,s) + except BaseException as error:caught=error + finally:namespace[field]=original + guarded=c['bundle'][2][5] + engine=dict(zip(guarded.__code__.co_freevars,guarded.__closure__))['engine_guard'].cell_contents + _intended_error(caught,RuntimeError,('Epoch engine '+field+' schema differs',),engine.__code__) + _need(calls==[],'Finite state refusal invoked foreign equality/class callback') + return {'primary':caught,'field':field,'foreign_calls':tuple(calls)} + + +CASES.update({name:globals()[name] for name in ('V3_INSTANCE_METHOD_SHADOW','V3_INSTANCE_STATE_SCHEMA')}) + + +def _v3_baseline_cli_case(c,kind): + # Actual baseline prepare/install/seal state, never a toggled candidate flag. + # This is an additive cleanup case, not a replacement for original P08. + driver=c['driver_module'];state=c['state'];extensions=c['extensions'] + _need(state['arm']=='baseline' and state['enabled'] is False and state.get('epoch_suite') is None and + driver._EXECUTION['state'] is state,'Genuine baseline source-case context required') + pins=CLI_FAULT_SOURCE_PINS[kind] + for key,module in {'driver':driver,'data':driver.data_adapters,'adapter':driver.adapters, + 'authority':c['authority_module'],'cache':c['cache_module']}.items(): + _need(hashlib.sha256(Path(module.__file__).read_bytes()).hexdigest()==pins[key+'_sha256'],'Exact baseline source-case images') + path=c['case_script_path'];expected=NORMAL_CASE_SCRIPT_SHA256 if kind=='disarm_only' else CASE_SCRIPT_SHA256 + _need(hashlib.sha256(path.read_bytes()).hexdigest()==expected,'Exact pinned script, never a helper callback') + name='_h25_epoch_case_inputs_v2';_need(name not in sys.modules,'Fresh owned input slot') + inputs=types.ModuleType(name);checks=c['checks'];inputs.checks=checks;old_c=checks.c + if kind!='disarm_only':checks.c=None + old_argv=sys.argv;sys.modules[name]=inputs;caught=None;owner=extensions['set_binding']['owner'] + _need(owner.cli_active is False and owner.circuit is None and owner.used is False,'Genuine original pre-arm baseline lease') + try: + try:driver._epoch_cli_boundary(c['phases'],state,extensions,path,io.StringIO(),None,old_argv) + except BaseException as error:caught=error + finally: + checks.c=old_c + if sys.modules.get(name) is inputs:del sys.modules[name] + secondary=driver.adapters._V3_DISARM_ERROR;record=state['epoch_cli_cleanup'] + if kind=='disarm_only': + _intended_error(caught,RuntimeError,('V3 source-case disarm secondary',),driver.adapters.disarm.__code__) + _need(caught is secondary and record['primary'] is secondary,'First cleanup error must become primary') + else: + _intended_error(caught,AttributeError,("'NoneType' object has no attribute 'active'",),type(checks).__dict__['verify_labels'].__code__) + _need(record['primary'] is caught and record['disarm_error'] is secondary and secondary is not caught, + 'Actual body primary lost to disarm secondary') + if kind=='body_disarm_retirement': + retirement=driver.data_adapters._V3_CLI_RETIRE_ERROR + _need(record['retirement_error'] is retirement and retirement is not caught and retirement is not secondary, + 'Actual third retirement error not retained separately') + _need(_has_frame(caught,driver._epoch_cli_boundary.__code__) and sys.argv is old_argv and + owner.cli_active is False and owner.current is None and owner.circuit is None and + owner.checks is None and owner.triples is None and record['uncertain'], + 'Actual argv/original disarm/custody boundary absent') + return {'variant':kind,'primary':caught,'disarm_error':record['disarm_error'], + 'retirement_error':record['retirement_error'],'uncertain':record['uncertain']} + + +def V3_CLI_DISARM_ONLY(c):return _v3_baseline_cli_case(c,'disarm_only') +def V3_CLI_BODY_DISARM(c):return _v3_baseline_cli_case(c,'body_disarm') +def V3_CLI_BODY_DISARM_RETIREMENT(c):return _v3_baseline_cli_case(c,'body_disarm_retirement') +CASES.update({name:globals()[name] for name in ('V3_CLI_DISARM_ONLY','V3_CLI_BODY_DISARM','V3_CLI_BODY_DISARM_RETIREMENT')}) + +NORMAL_CASE_SCRIPT_SHA256 = '4f99e7c79d3586f04d2f5f097bbb0011eb1eb899c4ad34f25e0e0ea7ffa3d006' + +# V4 automatic source boundary cases +V4_CLI_FAULT_SOURCE_PINS = {'restore_only': {'kind': 'restore_only', 'data_file': 'epoch_data_cli_restore_only_fault_v4.py', 'data_sha256': '18679fd1eb6ae99c4b375756511427c26718f77674c2d8fcc490e25ceb47cba5', 'cache_file': 'epoch_cache_cli_restore_only_fault_v4.py', 'cache_sha256': 'd317c9866566cd6147c96566879f26f364e7e6801ac3eed0800b6ed8eedd01a2', 'adapter_file': 'epoch_adapter_cli_restore_only_fault_v4.py', 'adapter_sha256': 'f7ca7f4f03ac63c1a95ba42f06149543211566de5e29f487a3dc4d08c5ee9b94', 'authority_file': 'epoch_authority_cli_restore_only_fault_v4.py', 'authority_sha256': 'f279ab86fc17c6a517b035f19d56863919cbd8304de4e7d5332457c6159aec10', 'driver_file': 'epoch_driver_cli_restore_only_fault_v4.py', 'driver_sha256': '56f5954e900d6bdcacfbf62354e7e9078d4b93df721d5c89321db0f7ff42635e', 'no_live_authority_created': True, 'ordinary_Python_source_port_only': True, 'native_argv_or_allocation_failure_qualification': False, 'production_source_map_accepts_image': False}, 'body_restore_disarm_retirement': {'kind': 'body_restore_disarm_retirement', 'data_file': 'epoch_data_cli_body_restore_disarm_retirement_fault_v4.py', 'data_sha256': '667ff800f023173af0cb07ef985d0aa7345d624ed4f904670622a7dc1ac08e5d', 'cache_file': 'epoch_cache_cli_body_restore_disarm_retirement_fault_v4.py', 'cache_sha256': 'd317c9866566cd6147c96566879f26f364e7e6801ac3eed0800b6ed8eedd01a2', 'adapter_file': 'epoch_adapter_cli_body_restore_disarm_retirement_fault_v4.py', 'adapter_sha256': '57bcea26dd7abff4ab68a662be1b3a0de101af162d9e3077b45e31eb5e6aff69', 'authority_file': 'epoch_authority_cli_body_restore_disarm_retirement_fault_v4.py', 'authority_sha256': '64556c881af5f1e4fee9628ea059bb80c65883ed14f8b4413f6452b10c448b83', 'driver_file': 'epoch_driver_cli_body_restore_disarm_retirement_fault_v4.py', 'driver_sha256': '55f67f1809373ccda6c93c92628848d2778a10174145f5869ebb4d1a676771ba', 'no_live_authority_created': True, 'ordinary_Python_source_port_only': True, 'native_argv_or_allocation_failure_qualification': False, 'production_source_map_accepts_image': False}, 'restore_disarm_retirement': {'kind': 'restore_disarm_retirement', 'data_file': 'epoch_data_cli_restore_disarm_retirement_fault_v4.py', 'data_sha256': '667ff800f023173af0cb07ef985d0aa7345d624ed4f904670622a7dc1ac08e5d', 'cache_file': 'epoch_cache_cli_restore_disarm_retirement_fault_v4.py', 'cache_sha256': 'd317c9866566cd6147c96566879f26f364e7e6801ac3eed0800b6ed8eedd01a2', 'adapter_file': 'epoch_adapter_cli_restore_disarm_retirement_fault_v4.py', 'adapter_sha256': '57bcea26dd7abff4ab68a662be1b3a0de101af162d9e3077b45e31eb5e6aff69', 'authority_file': 'epoch_authority_cli_restore_disarm_retirement_fault_v4.py', 'authority_sha256': '64556c881af5f1e4fee9628ea059bb80c65883ed14f8b4413f6452b10c448b83', 'driver_file': 'epoch_driver_cli_restore_disarm_retirement_fault_v4.py', 'driver_sha256': '55f67f1809373ccda6c93c92628848d2778a10174145f5869ebb4d1a676771ba', 'no_live_authority_created': True, 'ordinary_Python_source_port_only': True, 'native_argv_or_allocation_failure_qualification': False, 'production_source_map_accepts_image': False}, 'restore_before_disarm_retirement': {'kind': 'restore_before_disarm_retirement', 'data_file': 'epoch_data_cli_restore_before_disarm_retirement_fault_v4.py', 'data_sha256': '667ff800f023173af0cb07ef985d0aa7345d624ed4f904670622a7dc1ac08e5d', 'cache_file': 'epoch_cache_cli_restore_before_disarm_retirement_fault_v4.py', 'cache_sha256': 'd317c9866566cd6147c96566879f26f364e7e6801ac3eed0800b6ed8eedd01a2', 'adapter_file': 'epoch_adapter_cli_restore_before_disarm_retirement_fault_v4.py', 'adapter_sha256': '57bcea26dd7abff4ab68a662be1b3a0de101af162d9e3077b45e31eb5e6aff69', 'authority_file': 'epoch_authority_cli_restore_before_disarm_retirement_fault_v4.py', 'authority_sha256': '64556c881af5f1e4fee9628ea059bb80c65883ed14f8b4413f6452b10c448b83', 'driver_file': 'epoch_driver_cli_restore_before_disarm_retirement_fault_v4.py', 'driver_sha256': '5cdca051fe0aafcce4105354734515a8173f460ab12c2f48d6de47bb03ff0f1c', 'no_live_authority_created': True, 'ordinary_Python_source_port_only': True, 'native_argv_or_allocation_failure_qualification': False, 'production_source_map_accepts_image': False}, 'arm_raw_journal': {'kind': 'arm_raw_journal', 'data_file': 'epoch_data_cli_arm_raw_journal_fault_v4.py', 'data_sha256': 'd7743b4e865906801e02ee3665c7d65e9a8ca27af8cf168a563482551f09a952', 'cache_file': 'epoch_cache_cli_arm_raw_journal_fault_v4.py', 'cache_sha256': 'b11ca58a17382e162833ed3a1091e0f975ab595bfba860dc6eb42ea4931655f2', 'adapter_file': 'epoch_adapter_cli_arm_raw_journal_fault_v4.py', 'adapter_sha256': '57bcea26dd7abff4ab68a662be1b3a0de101af162d9e3077b45e31eb5e6aff69', 'authority_file': 'epoch_authority_cli_arm_raw_journal_fault_v4.py', 'authority_sha256': '553393031b6f561e81b72a6ce87f3947fd99e9e269f0945b9ff0850ef7a7c9da', 'driver_file': 'epoch_driver_cli_arm_raw_journal_fault_v4.py', 'driver_sha256': 'e920875eddf16cab3d61ce328ada701c19876307f0b20ad357425f2018af8274', 'no_live_authority_created': True, 'ordinary_Python_source_port_only': True, 'native_argv_or_allocation_failure_qualification': False, 'production_source_map_accepts_image': False}, 'role_raw_journal': {'kind': 'role_raw_journal', 'data_file': 'epoch_data_cli_role_raw_journal_fault_v4.py', 'data_sha256': '18679fd1eb6ae99c4b375756511427c26718f77674c2d8fcc490e25ceb47cba5', 'cache_file': 'epoch_cache_cli_role_raw_journal_fault_v4.py', 'cache_sha256': 'b11ca58a17382e162833ed3a1091e0f975ab595bfba860dc6eb42ea4931655f2', 'adapter_file': 'epoch_adapter_cli_role_raw_journal_fault_v4.py', 'adapter_sha256': 'f7ca7f4f03ac63c1a95ba42f06149543211566de5e29f487a3dc4d08c5ee9b94', 'authority_file': 'epoch_authority_cli_role_raw_journal_fault_v4.py', 'authority_sha256': '23177353bc42187c40ab50d1833e1ff014b1d464f109a44567f7005e332efc87', 'driver_file': 'epoch_driver_cli_role_raw_journal_fault_v4.py', 'driver_sha256': '2ef3260b695a61877bf64bde8520ac2dc03e854f0427a9ee3e3e18c8e323df78', 'no_live_authority_created': True, 'ordinary_Python_source_port_only': True, 'native_argv_or_allocation_failure_qualification': False, 'production_source_map_accepts_image': False}} +def _v4_images(c,kind): + pins=V4_CLI_FAULT_SOURCE_PINS[kind];driver=c['driver_module'] + for key,module in {'driver':driver,'data':driver.data_adapters,'adapter':driver.adapters, + 'authority':c['authority_module'],'cache':c['cache_module']}.items(): + _need(hashlib.sha256(Path(module.__file__).read_bytes()).hexdigest()==pins[key+'_sha256'], + 'V4 exact distinct source image required before adverse work') + return driver + + +def _v4_restore_case(c,kind): + driver=_v4_images(c,kind);data=driver.data_adapters;state=c['state'];extensions=c['extensions'] + _need(state['arm']=='baseline' and state['enabled'] is False and state.get('epoch_suite') is None and + driver._EXECUTION['state'] is state,'Actual baseline source context, never fabricated private authority') + body=kind=='body_restore_disarm_retirement';before=kind=='restore_before_disarm_retirement' + path=c['case_script_path'];expected=CASE_SCRIPT_SHA256 if body else NORMAL_CASE_SCRIPT_SHA256 + _need(hashlib.sha256(path.read_bytes()).hexdigest()==expected,'Exact actual script source') + name='_h25_epoch_case_inputs_v2';_need(name not in sys.modules,'Fresh owned input slot') + inputs=types.ModuleType(name);checks=c['checks'];inputs.checks=checks;old_c=checks.c + owner=extensions['set_binding']['owner'];old_argv=sys.argv;caught=None + _need(owner.cli_active is False and owner.circuit is None and owner.used is False,'Actual original untouched pre-arm owner') + if body:checks.c=None + sys.modules[name]=inputs + try: + try:driver._epoch_cli_boundary(c['phases'],state,extensions,path,io.StringIO(),None,old_argv) + except BaseException as error:caught=error + # Observe production outcome before restoring this source-case parent's + # own argv fixture. This is not a production recovery/retry assertion. + actual_argv=sys.argv + finally: + checks.c=old_c + if sys.modules.get(name) is inputs:del sys.modules[name] + sys.argv=old_argv + record=state['epoch_cli_cleanup'];argv_error=driver._V4_ARGV_ERROR + _intended_error(argv_error,RuntimeError,('V4 source-case argv restoration',),driver._epoch_cli_boundary.__code__) + if body: + _intended_error(caught,AttributeError,("'NoneType' object has no attribute 'active'",),type(checks).__dict__['verify_labels'].__code__) + else:_need(caught is argv_error,'Restoration A must be first actual primary without P') + _need(record['primary'] is caught and record['argv_error'] is argv_error and + _has_frame(caught,driver._epoch_cli_boundary.__code__),'Actual P/A object lost or earlier refusal masked boundary') + _need((actual_argv is old_argv) is (not before),'Declared before/after ordinary restoration port distinction') + if kind!='restore_only': + secondary=driver.adapters._V3_DISARM_ERROR;retirement=data._V4_CLI_RETIRE_ERROR + _intended_error(secondary,RuntimeError,('V3 source-case disarm secondary',),driver.adapters.disarm.__code__) + _intended_error(retirement,RuntimeError,('V4 source-case external retirement',),data.epoch_retire.__code__) + _need(record['disarm_error'] is secondary and record['retirement_error'] is retirement and + len({id(caught),id(secondary),id(retirement)})==3,'P/A/S/R fixed independent raw custody') + else:_need(record['disarm_error'] is None and record['retirement_error'] is None,'Unexpected later cleanup failure') + _need(owner.cli_active is False and owner.current is None and owner.circuit is None and + owner.checks is None and owner.triples is None and record['uncertain'], + 'Restoration error skipped actual original disarm or uncertainty') + return {'primary':caught,'argv_error':record['argv_error'],'disarm_error':record['disarm_error'], + 'retirement_error':record['retirement_error'],'argv_was_restored':actual_argv is old_argv, + 'native_restoration_failure_qualified':False,'uncertain':record['uncertain']} + + +def V4_ARGV_ONLY(c):return _v4_restore_case(c,'restore_only') +def V4_BODY_ARGV_DISARM_RETIREMENT(c):return _v4_restore_case(c,'body_restore_disarm_retirement') +def V4_ARGV_DISARM_RETIREMENT(c):return _v4_restore_case(c,'restore_disarm_retirement') +def V4_ARGV_BEFORE_DISARM_RETIREMENT(c):return _v4_restore_case(c,'restore_before_disarm_retirement') + + +def _v4_raw_channel_oracle(c,s,channel,primary,secondary,caller_slot,role_boundary=False): + retirement=channel['error'];journal=channel['journal_error'];cache=c['cache_module'] + _intended_error(retirement,RuntimeError,('V4 source-case raw retirement',),cache._v4_source_case_retire.__code__) + _intended_error(journal,LookupError,('V4 source-case optional journal publication',),cache._epoch_suite_retire_preserving.__code__) + _need(caller_slot is retirement and channel['acknowledged'] is True and + retirement is not primary and ((secondary is retirement) if role_boundary else (retirement is not secondary)) and journal is not retirement and + all(error is not retirement for error in s.secondary), + 'Actual callee R lost when optional journal publication failed') + _need(s.primary_error is primary and s.secondary_error is secondary and s.uncertain and + s.terminal and not s.active and s.pending is None and not s.registry, + 'Raw channel case lost actual terminal disposition or first error identity') + return {'primary':primary,'secondary':secondary,'retirement_error':retirement,'journal_error':journal, + 'acknowledged':channel['acknowledged'],'uncertain':s.uncertain} + + +def V4_ROLE_RAW_JOURNAL(c): + _v4_images(c,'role_raw_journal');s=_live(c);roles=s.products['roles'];caught=None + _need(s.active is False and s.terminal is False and s.primary_error is None and s.secondary_error is None, + 'Genuine untouched unarmed source role context') + try:roles(c['circuit'],c['checks'],{'_h25_missing_roles':1}) + except BaseException as error:caught=error + _intended_error(caught,KeyError,('roles',),roles.__code__) + return _v4_raw_channel_oracle(c,s,s.role_retirement_channel,caught,s.role_retirement_channel['error'],s.role_retirement_error,True) + + +def V4_CLI_RAW_JOURNAL(c): + driver=_v4_images(c,'arm_raw_journal');s=_live(c);state=c['state'];extensions=c['extensions'];old_argv=sys.argv;caught=None + _need(s.active is False and s.terminal is False and s.primary_error is None and s.secondary_error is None and + driver._EXECUTION['state'] is state and c['invocation_token'] is s.context['invocation_token'], + 'Genuine pre-arm source context and actual invocation identity') + before=_counts(c);owner=extensions['set_binding']['owner'] + _need(owner.cli_active is False and owner.circuit is None and owner.used is False,'Actual original pre-arm owner') + try:driver._epoch_cli_boundary(c['phases'],state,extensions,c['case_script_path'],io.StringIO(),c['invocation_token'],old_argv) + except BaseException as error:caught=error + _intended_error(caught,RuntimeError,('V4 source-case arm raw journal',),driver.data_adapters.arm.__code__) + _need(caught is driver.data_adapters._V4_ARM_ERROR and _counts(c)==before,'Earlier FULL/phase gate or native arithmetic masked case') + record=state['epoch_cli_cleanup'];secondary=driver.adapters._V3_DISARM_ERROR + _intended_error(secondary,RuntimeError,('V3 source-case disarm secondary',),driver.adapters.disarm.__code__) + _need(record['disarm_error'] is secondary and record['primary'] is caught and sys.argv is old_argv and + owner.cli_active is False and owner.current is None and owner.circuit is None,'Actual automatic cleanup path required') + return _v4_raw_channel_oracle(c,s,record['retirement_channel'],caught,secondary,record['retirement_error']) + + +CASES.update({name:globals()[name] for name in ('V4_ARGV_ONLY','V4_BODY_ARGV_DISARM_RETIREMENT', + 'V4_ARGV_DISARM_RETIREMENT','V4_ARGV_BEFORE_DISARM_RETIREMENT','V4_ROLE_RAW_JOURNAL','V4_CLI_RAW_JOURNAL')}) + +# V5 actual outer-main and absent-record cases +V5_OUTER_FAULT_SOURCE_PINS = {'main_primary_outer': {'kind': 'main_primary_outer', 'actual_entry': '_run_epoch_with_stop_evidence -> main_epoch (unaltered call edge)', 'requires_genuine_full_context': False, 'finite_only_baseline': True, 'source_context_or_authority_created': False, 'native_allocation_failure_qualification': False, 'production_driver_rejects_image': True, 'data_file': 'epoch_data_main_primary_outer_fault_v5.py', 'data_sha256': '3694f577651e8baaf4be1d07baff9ba7fa0f312a8d1620836c35988f03a43954', 'cache_file': 'epoch_cache_main_primary_outer_fault_v5.py', 'cache_sha256': 'd317c9866566cd6147c96566879f26f364e7e6801ac3eed0800b6ed8eedd01a2', 'adapter_file': 'epoch_adapter_main_primary_outer_fault_v5.py', 'adapter_sha256': 'f7ca7f4f03ac63c1a95ba42f06149543211566de5e29f487a3dc4d08c5ee9b94', 'authority_file': 'epoch_authority_main_primary_outer_fault_v5.py', 'authority_sha256': '091fcb583a160b72c95896380ade42f46873c97794d11fe88ab168fb00d099dd', 'driver_file': 'epoch_driver_main_primary_outer_fault_v5.py', 'driver_sha256': '96ba87197551d991606ddfdb6a86296a39edf2e1b63417a1767d59b357bacc3d'}, 'main_cleanup_only': {'kind': 'main_cleanup_only', 'actual_entry': '_run_epoch_with_stop_evidence -> main_epoch (unaltered call edge)', 'requires_genuine_full_context': False, 'finite_only_baseline': True, 'source_context_or_authority_created': False, 'native_allocation_failure_qualification': False, 'production_driver_rejects_image': True, 'data_file': 'epoch_data_main_cleanup_only_fault_v5.py', 'data_sha256': '3694f577651e8baaf4be1d07baff9ba7fa0f312a8d1620836c35988f03a43954', 'cache_file': 'epoch_cache_main_cleanup_only_fault_v5.py', 'cache_sha256': 'd317c9866566cd6147c96566879f26f364e7e6801ac3eed0800b6ed8eedd01a2', 'adapter_file': 'epoch_adapter_main_cleanup_only_fault_v5.py', 'adapter_sha256': 'f7ca7f4f03ac63c1a95ba42f06149543211566de5e29f487a3dc4d08c5ee9b94', 'authority_file': 'epoch_authority_main_cleanup_only_fault_v5.py', 'authority_sha256': '091fcb583a160b72c95896380ade42f46873c97794d11fe88ab168fb00d099dd', 'driver_file': 'epoch_driver_main_cleanup_only_fault_v5.py', 'driver_sha256': '070352ecdf1e226c9267ce822317452d3e64f74191abd468f970b241d6c7b074'}, 'main_absent_record': {'kind': 'main_absent_record', 'actual_entry': '_run_epoch_with_stop_evidence -> main_epoch (unaltered call edge)', 'requires_genuine_full_context': True, 'finite_only_baseline': False, 'source_context_or_authority_created': False, 'native_allocation_failure_qualification': False, 'production_driver_rejects_image': True, 'data_file': 'epoch_data_main_absent_record_fault_v5.py', 'data_sha256': '18679fd1eb6ae99c4b375756511427c26718f77674c2d8fcc490e25ceb47cba5', 'cache_file': 'epoch_cache_main_absent_record_fault_v5.py', 'cache_sha256': '25f3e43001a53cb2cadc926f4371e3c555056b735a5cd3151e01e5a166fb54c4', 'adapter_file': 'epoch_adapter_main_absent_record_fault_v5.py', 'adapter_sha256': 'f7ca7f4f03ac63c1a95ba42f06149543211566de5e29f487a3dc4d08c5ee9b94', 'authority_file': 'epoch_authority_main_absent_record_fault_v5.py', 'authority_sha256': '35d65a6e8c37b1021460a5da6bf1a141d41e4ac33ac5816cf2111ba16190d6ba', 'driver_file': 'epoch_driver_main_absent_record_fault_v5.py', 'driver_sha256': 'ec93ad847940da23b56e765e7d9fd6887ff6ca50c524c55feb3e395530552c87'}} +def _v5_images(c,kind): + pins=V5_OUTER_FAULT_SOURCE_PINS[kind];driver=c['driver_module'] + for key,module in {'driver':driver,'data':driver.data_adapters,'adapter':driver.adapters, + 'authority':c['authority_module'],'cache':c['cache_module']}.items(): + _need(hashlib.sha256(Path(module.__file__).read_bytes()).hexdigest()==pins[key+'_sha256'], + 'V5 exact declared source tuple, never mutable helper replacement') + _need(driver._EXECUTION['state'] is None and driver._EXECUTION['packet'] is None, + 'V5 needs actual untouched driver cold startup, not borrowed prepared state') + return driver + + +def _v5_main_stop(c,kind): + driver=_v5_images(c,kind);argv=c['argv'];cache=c['cache_module'];data=driver.data_adapters + _need(type(argv) is tuple and all(type(v) is str for v in argv) and len(argv)>1,'Exact original CLI argument tuple') + if kind=='main_absent_record': + # This full-source context is genuinely OPEN with current FULLNone. + # No None/phase refusal can satisfy the later intended source oracle. + _need(type(driver.native_packet.FULL_EXECUTION_CONTRACT) is dict and type(cache.EPOCH_FULL_EXECUTION_CONTRACT) is dict, + 'V5 absent-record full context OPEN; None is not intended error') + _need('--finite-only' not in argv and '--lanes' in argv and argv[argv.index('--lanes')+1]=='candidate', + 'Actual full candidate CLI required for genuine Suite creation') + else: + _need('--finite-only' in argv and '--lanes' in argv and argv[argv.index('--lanes')+1]=='baseline', + 'Actual original finite-only baseline CLI, no FULLNone substitute') + old_argv=sys.argv;caught=None + sys.argv=list(argv) + try: + try:driver._run_epoch_with_stop_evidence() + except BaseException as error:caught=error + finally:sys.argv=old_argv + state=driver._EXECUTION['state'];record=driver._EXECUTION['epoch_outer_cleanup'] + _need(type(state) is dict and record['attempted'] is True and record['primary'] is caught, + 'Actual main/outer cleanup not reached or first-primary identity lost') + _need(_has_frame(caught,driver.main_epoch.__code__) and _has_frame(caught,driver._run_epoch_with_stop_evidence.__code__), + 'Actual outer-main/STOP wrapper frames required') + stop=json.loads((driver._EXECUTION['output']/'STOP.json').read_text()) + expected='V5 source-case absent CLI record' if kind=='main_absent_record' else 'V5 source-case post-prepare primary' if kind=='main_primary_outer' else 'V5 source-case outer retirement' + _need(stop['status']=='STOP' and stop['primary_error']=={'type':'RuntimeError' if kind=='main_cleanup_only' else 'ValueError','message':expected}, + 'Actual STOP owner evidence must describe intended first primary') + for owned in state['owned_states']: + _need(owned['cache_binding'] is None or owned['cache_teardown_attempted'] is True, + 'Original known-owner teardown attempt missing after outer error') + if kind!='main_absent_record': + outer=record['retirement_error'] + _intended_error(outer,RuntimeError,('V5 source-case outer retirement',),data.epoch_retire.__code__) + _need(record['uncertain'] is True,'Outer raw error lost uncertainty') + if kind=='main_cleanup_only':_need(caught is outer,'Cleanup-only E must become outward primary') + else: + _intended_error(caught,ValueError,('V5 source-case post-prepare primary',),driver.main_epoch.__code__) + _need(caught is not outer,'Actual first P replaced by distinct outer E') + # Fixed raw E is also present in the actual retained main frame before + # evidence formatting. No ambient exception-state inference is used. + trace=caught.__traceback__;frame=None + while trace is not None: + if trace.tb_frame.f_code is driver.main_epoch.__code__:frame=trace.tb_frame + trace=trace.tb_next + _need(frame is not None and frame.f_locals['_epoch_outer_retirement_error'] is outer, + 'Actual main first-catch raw E owner missing') + return {'primary':caught,'outer_error':outer,'actual_stop':stop,'outer_record':record} + _intended_error(caught,ValueError,('V5 source-case absent CLI record',),driver._epoch_cli_boundary.__code__) + s=state['epoch_suite'];_need(state.get('epoch_cli_cleanup') is None,'No-record source port did not reach actual fallback') + inner=s.inner_retirement_channel;outer=s.outer_retirement_channel + r1,j1,r2,j2=inner['error'],inner['journal_error'],outer['error'],outer['journal_error'] + for error in (r1,r2):_intended_error(error,RuntimeError,('V5 source-case fallback retirement',),cache._v5_source_case_retire.__code__) + for error in (j1,j2):_intended_error(error,LookupError,('V5 source-case fallback journal',),cache._epoch_suite_retire_preserving.__code__) + _need(len({id(caught),id(r1),id(j1),id(r2),id(j2)})==5 and inner is not outer and + inner['started'] is True and outer['started'] is True and inner['acknowledged'] is True and outer['acknowledged'] is True, + 'Distinct attempt lifetime/actual P/R1/J1/R2/J2 raw custody required') + _need(s.inner_retirement_error is r1 and s.inner_journal_error is j1 and + s.outer_retirement_error is r2 and s.outer_journal_error is j2 and + s.primary_error is caught and s.secondary_error is r1 and s.uncertain and + not s.active and s.terminal and s.pending is None and not s.registry and cache._V5_RETIRE_CALLS[0]==2, + 'Fixed handoffs/terminal state or either original cleanup attempt missing') + replay=None + try:data.epoch_retire(state,'source-replay-negative',caught,None,None,None,'inner') + except BaseException as error:replay=error + _intended_error(replay,RuntimeError,('Epoch retirement channel already consumed',),cache._epoch_suite_retire_preserving.__code__) + _need(inner['error'] is r1 and inner['journal_error'] is j1 and outer['error'] is r2 and outer['journal_error'] is j2 and + s.inner_retirement_error is r1 and s.inner_journal_error is j1 and cache._V5_RETIRE_CALLS[0]==2, + 'ACKed replay overwrote raw custody or retried already completed attempt') + return {'primary':caught,'inner_R':r1,'inner_J':j1,'outer_R':r2,'outer_J':j2,'replay_error':replay, + 'actual_stop':stop,'both_cleanup_attempts':cache._V5_RETIRE_CALLS[0],'native_allocation_failure_qualified':False} + + +def V5_MAIN_PRIMARY_OUTER(c):return _v5_main_stop(c,'main_primary_outer') +def V5_MAIN_CLEANUP_ONLY(c):return _v5_main_stop(c,'main_cleanup_only') +def V5_MAIN_ABSENT_RECORD(c):return _v5_main_stop(c,'main_absent_record') +CASES.update({name:globals()[name] for name in ('V5_MAIN_PRIMARY_OUTER','V5_MAIN_CLEANUP_ONLY','V5_MAIN_ABSENT_RECORD')}) diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v1/contracts/CALLER-EQUALITY-DEFINITION-v1.json b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v1/contracts/CALLER-EQUALITY-DEFINITION-v1.json new file mode 100644 index 0000000000..3ad1c33d32 --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v1/contracts/CALLER-EQUALITY-DEFINITION-v1.json @@ -0,0 +1,131 @@ +{ + "expected_results_are_obligations_not_observations": true, + "native_expected_full_call_counts": { + "complement_fallback": 0, + "complement_native": 238685, + "gram_fallback": 0, + "gram_native": 59959 + }, + "new_control_ids": [], + "original_literal_expectations": { + "BASE": "19fdb086ea96af9a9f87936a2b888e10af4ed810", + "COMPLEMENT_EXPECTED": { + "calls": 238685, + "canonical_stream_bytes": 55839507, + "schema": "v2-jsonl:call,us,vs,result(type=list+values or type=None); ordered exact integer vectors", + "sha256": "7dec2bf33303c37e1c699609e83768d61df7e19104d34a26a148f66d5ccc4838" + }, + "ENGINE_PINS": { + "compare_side_verifier.py": "6e507bb0c7e00d090a60289fddb6c55e90c946d0850c42c3c5e3e15c27604a68", + "finite_controls.py": "df989a831aac43cc1af95169dad8c64a7548760e6e1f96976da996703f2c8f7a", + "native_backend.py": "e473c38245c3668715b5a78dfe980b2fe3ed0d0c9b8c97c666fbae6ecf1fffd5", + "native_gf2.c": "e9c3c9194a08718bd1575c1cf08c6c6772d3b644c2e274c25a84a1f9249d06cc", + "profile_side_verifier.py": "9c994378171c20a91539418d93cb8387e1daa93465d6862beefea90e12999c2a", + "source/complex_circuit.py": "d623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1", + "source/complex_network.py": "0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b" + }, + "EXPECTED_STDOUT": "PASS conditional 59/100000000000 > 2^-31; minimum margin 14779261/25000000000000000\nSide roles per invocation 108195 vs original 3693800\n", + "PIN_SHA": "88bba3caf5975f30fa7abceaea9454110cf3b069233e8241a2ca13d1dff171a7", + "REFERENCE_DRIVER_SHA": "0d976d2eb6b845f20d4a3396591a806f966688b88693cd6a5f8a0c9e48925e36", + "REFERENCE_SHA": "1f763d95c7ff163aa71d13cd82784f16665be8afb21f75e76941e2119562098f", + "UPSTREAM": "adc7f1241b42e322a6451854ab7e4b4c146bf78a" + }, + "original_phase_names_exactly_once": [ + "side_construction", + "checks_initialization", + "compile_roles", + "verify_map", + "verify_labels", + "verify_role_frames", + "original_upstream_verify_sources", + "full_log_integer_bounds", + "original_serializable", + "complete_original_cli" + ], + "predicates": [ + { + "id": "CP01", + "name": "source_and_owner_identity", + "require": "The actual original Root/capability/bootstrap API authenticates every installed selected source path, bytes, mode, module identity, globals, closure/defaults and typed owner. Full dictionary ownership is driver.native_packet.FULL_EXECUTION_CONTRACT; epoch ownership is the actual authenticated cache module EPOCH_FULL_EXECUTION_CONTRACT. No data-adapter alias is introduced. Every factory inventory, early driver pin, Root pin, authority graph and strict inverse uses that exact selected tuple." + }, + { + "id": "CP02", + "name": "fresh_complete_callers", + "require": "Baseline and candidate each start a separate fresh original main_epoch -> complete_original_cli -> original scripts/complex_network.py caller. Each invocation retains its own original tokens, circuit, Checks, cold authority, native bindings, source graph and set lease; candidate retains its own epoch. A separate unchanged original same-input baseline supplies independent expected observations through exact typed source-bound transfer. No stale historical result, finite result, P08 fixture or retired generation replaces that full oracle or supplies the candidate live context." + }, + { + "id": "CP03", + "name": "assertions_modes", + "require": "Every full baseline/candidate/P08/absent-record positive runs with original assertions and optimize==0. Existing full guards refuse optimized mode. Finite original semantics are preserved under normal and optimized modes separately; an expected optimized refusal is never a full positive or a body oracle." + }, + { + "id": "CP04", + "name": "original_arithmetic_oracle", + "require": "Expected arithmetic/results originate in the pinned uncached original functions and objects, with independently evaluated Fraction/kernel/collision/current-data checks. Never read expected outputs from candidate registry, private epoch, cached canonical/signature values or candidate-produced captured answers. Exact type, order, callbacks, exceptions and raw object identity are part of equality, not value-only equality." + }, + { + "id": "CP05", + "name": "original_output_equality", + "require": "Require exact original certificate bytes and stdout, typed lossless full return and side witness, full upstream/base/source identity, exact ordered complement transcript and every original rank/control observation against the immutable independent anchor. Preserve all original comparisons, even when another digest appears redundant. No newly generated candidate anchor may certify the candidate." + }, + { + "id": "CP06", + "name": "original_phase_and_import_equality", + "require": "All original complete caller phase names execute exactly once as required by the original driver. Actual imported source module paths/classes/functions must match original engine/scientific closure. Actual role result object is full_return[role_frames]. Preserve serializable, compile_roles, labels, roles, map and upstream-source checks and exact original callback order." + }, + { + "id": "CP07", + "name": "native_and_fallback_equality", + "require": "Retain actual current native guards, source/header/FFI/provider/loaded-image checks and exact full complement/Gram counts with zero fallback where the original full caller requires zero. Private epoch fallback paths must use the real public V8 validation/original Owner._data and counters; a cache hit cannot replace any current-source/native/kernel/Fraction obligation." + }, + { + "id": "CP08", + "name": "cache_enrollment_lifetime", + "require": "Enrollment follows exactly one authentic successful original Label construction/normalization and original store, with two literal basis/key loads, at most one pending record and one fixed seven-field committed record per eligible key. Private full controls construct genuine Checks after actual arm so C1 is registered; the P08 prearm fixture is ineligible. Stored Label/basis/key identities and original store ownership remain. Unsupported mappings/hooks, public escape/reentry, capacity/lifetime end, error or last-role completion retire metadata before public original continuation; no normalized-key duplication or owner rearming." + }, + { + "id": "CP09", + "name": "genuine_p08", + "require": "The source-owned prearm constructor uses genuine installed circuit/Checks/fixtures. Before original arms the suite remains inactive/nonterminal/no primary/unconsumed, original set owner unused and unarmed, and actual phase wrapper equals its authenticated observed slot while original equals suite.products[labels]. Only the actual returned original/observed pair and authority.wrap_proof authorize the wrapper. No unwrap, manufactured objects, flag reset or generic external callback is admitted." + }, + { + "id": "CP10", + "name": "p08_error_and_cleanup", + "require": "P08 reaches the original labels-body AttributeError for NoneType.active through the same original protected CLI/arms; preserve actual primary/disarm/retirement objects and labels frame. sys.argv pointer is restored by identity. Exact original outer cleanup and owner teardown execute. Terminal P08 context is discarded and normal positive CLI does not resume from it." + }, + { + "id": "CP11", + "name": "absent_record_cold_entry", + "require": "Absent-record retains actual cold _run_epoch_with_stop_evidence -> main_epoch with state=None and packet=None on entry, its exact five-image fault tuple, intended original fault boundary, raw P/R1/J1/R2/J2 identities, independent inner/outer channels, transfer-before-ACK and one-shot replay refusal. A prepared P08 state or finite baseline is not this entry." + }, + { + "id": "CP12", + "name": "raw_failure_evidence", + "require": "Preserve exact first primary, disarm, retirement, restoration and journal objects, actual frame/cause/traceback identities, one-shot begun/acknowledged channels, transfer-before-ACK and independently protected cleanup. Source accounting includes traceback-retained graphs. Earlier FULL/phase refusal, formatted error equality or an omitted secondary cannot substitute for original body/raw-channel oracle." + }, + { + "id": "CP13", + "name": "all_original_cache_bodies", + "require": "Retain all 52 original public helper bodies and required variant contexts; their original IDs/oracles are not renamed, removed or weakened. N24 receives an actually fresh unconsumed original None/refusal tuple; N18 receives an authentically retired generation. Do not install one global FULL dictionary into those diagnostic images. Context multiplicity is explicitly mapped separately from body count." + }, + { + "id": "CP14", + "name": "closed_alias_boundaries", + "require": "Review every new constructor, helper, class slot, raw error, retained Label, factory/source graph and post-seal edge against original T1-T4 closure. Existing closed-generation findings do not automatically transfer to exposed aliases. Exclude unrelated callbacks/finalizers, signals and ambient mutable substitutions only under the same original premises; preserve all current checks at each native/source boundary." + }, + { + "id": "CP15", + "name": "terminal_and_side_effect_equality", + "require": "Retain exact source inventories/modes before and after, original expected runtime file set plus certificate, raw output custody and current checks. Complete all original native cleanup before late-last; late-last is the final native/scientific call. Afterwards only permitted source custody/receipt work continues. No native guard, provider or Root call follows terminal late-last." + } + ], + "runtime_observations": 0, + "schema": "cache-s0308-caller-equality-source-definition-v1", + "source": { + "bytes": 89606, + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_scientific_driver_v1.py", + "sha256": "1e8202b7a4c17fc8dfb0a001085c26bf2ec26a69eb6c8501763773324c2bd9a1" + }, + "status": "CONCRETE_SOURCE_PREDICATES_PENDING_INDEPENDENT_ACCEPTANCE", + "whole_S0308_acceptance": false +} diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v1/contracts/COMPLETE-SYMBOLIC-COST-DEFINITION-v1.json b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v1/contracts/COMPLETE-SYMBOLIC-COST-DEFINITION-v1.json new file mode 100644 index 0000000000..929b3b0835 --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v1/contracts/COMPLETE-SYMBOLIC-COST-DEFINITION-v1.json @@ -0,0 +1,121 @@ +{ + "actual_aggregate_peak_bytes": null, + "actual_cpu_seconds": null, + "actual_wall_seconds": null, + "broader_control_union_rule": "Original155 cache/212 requirement/24 native/100 native-reference obligations are preserved in their original activities. This definition does not move all212 S05.03 or F4/M source bodies into S03.08 absent an actual named source dependency.", + "categories": [ + { + "id": "C01", + "includes": "Pristine Root startup, initial TCB authentication, early cold authority capture, queue admission, all process/group/child tracking and aggregate outer measurement; charge before driver START_WALL and after its final sample.", + "owner": "pristine_root_parent" + }, + { + "id": "C02", + "includes": "All original and new source/input inventory/hash/byte/mode checks, pinned closure copy, static packet assembly/inverses, retained source/proof copies, installation inventories and actual startup reads in each selected invocation.", + "owner": "source_custody_copy" + }, + { + "id": "C03", + "includes": "Each of three original metadata cold builds plus all original backend/trace/native builds and child CPU/wall/IO/logs/journals/dependency/header reads. Failed builds and no-retry termination remain charged; no reused binary or zero-cost compiler fixture.", + "owner": "cold_native_builds" + }, + { + "id": "C04", + "includes": "Current actual native/header/FFI/provider/loaded-image/stdlib/primitive profile, preflight, controls, source admission and every original direct/native/reference check. Source definition does not create observed receipts.", + "owner": "native_profile_and_controls" + }, + { + "id": "C05", + "includes": "OriginalGraph, typed factory/source/function/class/default/closure/global/lookup snapshots, twelve actual product roles, native bind clone, AST parse/deepcopy/compile and strict whole-source/code inverses; all concurrent old/new source, AST, code, result and proof graphs.", + "owner": "factory_graph_products" + }, + { + "id": "C06", + "includes": "Every genuine original circuit/Checks/fixture constructor including prearm P08 extra constructor, fallback, native, normalization, counters, source checks and bookkeeping; all fixture copies/temporaries/oracle preparation are charged without suppressed effects.", + "owner": "genuine_circuit_checks_fixtures" + }, + { + "id": "C07", + "includes": "K committed records: dict index capacity, native id integer and fixed seven-field record tuple; at most one pending record; original store/constructor work and actual metadata capacities. Labels/basis/keys are original pointers but retained capacity and transient ownership still charged.", + "owner": "registration_and_storage" + }, + { + "id": "C08", + "includes": "Q actual private role/label/residual requests, nonce and request dictionary, operand tuples, stage/view set, signatures, prepare/finish, literal key/member/store, exact identity comparisons, current source+native checks and original authority state. Do not infer Q from complement or Gram counts.", + "owner": "private_requests" + }, + { + "id": "C09", + "includes": "All unsupported mapping/hook/public escape/reentry/capacity/lifetime fallbacks: retirement, original Owner._data, public V8 canonicalization/collision/counters and full continuation. Charge private attempt plus fallback; no silent truncated case or fast-pass credit.", + "owner": "public_fallback_retirement" + }, + { + "id": "C10", + "includes": "All original arithmetic kernels, independent Fraction work, ordered rank/complement trace, full map/labels/roles/integer-bound/upstream verification and exact type/order witness collection. Baseline and candidate both retain complete obligations.", + "owner": "original_arithmetic_observations" + }, + { + "id": "C11", + "includes": "Every required original cache helper body with each distinct genuine context/source image/mode/lifecycle and all existing control unions in their original activities. Include source fault image preparation, fresh owner/bootstrap, construction, execution, oracles and cleanup for each invocation; body count is not funded command count.", + "owner": "control_case_contexts" + }, + { + "id": "C12", + "includes": "Every P/A/S/R/J and absent-record P/R1/J1/R2/J2 channel allocation, transfer, ACK and consumed-replay check, fixed records/dicts and append-only lists. Retain exact raw errors, causes and traceback/Label/Checks/native/source graph frames until proper parent disposal; finite pointer count does not bound retained graph bytes.", + "owner": "error_channel_custody" + }, + { + "id": "C13", + "includes": "Original lossless typed serialization, full stdout/certificate/side/complement outputs, witnesses, comparisons, source and result hashing, receipt writes, fs metadata/IO and diagnostics. Do not substitute a digest for the original observations or omit failed-attempt evidence.", + "owner": "serialization_outputs" + }, + { + "id": "C14", + "includes": "All normal/error disarm, retirement, metadata close, native owner disposal, source/stdlib/current checks, before-late and late-last, STOP evidence, final custody checks and process teardown. Include both failed cleanup attempts and secondary retention; no forbidden post-late native check.", + "owner": "terminal_cleanup" + }, + { + "id": "C15", + "includes": "Complete parent scheduling/monitoring/accounting, log/receipt/custody readback and retained FD/image/page/allocator/GC/RSS tail through last child/process exit. Charge all retries only if separately authorized; failed or rejected runs are not subtracted.", + "owner": "parent_accounting_resource_tail" + } + ], + "full_invoice": { + "cpu": "CPU_total is actual parent/driver and all compiler/control/helper child process CPU, including failed setup/cleanup and receipt tails, with each process lifetime counted once.", + "index": "For every separately selected actual invocation j and every unique exclusive work segment e, assign exactly one C01-C15 owner. Assign shared setup to the actual common parent or to each actual fresh invocation as incurred; never omit or fabricate amortization.", + "peak": "RSS_peak is actual aggregate concurrent high-water across parent/driver/children plus separately declared retained FD/image/page and allocator profile; a sum of individual maxima is not an observed aggregate peak.", + "setup_baseline": "Both original complete arms pay the complete actual common control union, Root/native/source setup and teardown. Any asymmetry must be explicit and reviewed; no free candidate-only qualification or baseline control elision.", + "unmeasured": "Every unevaluated time/CPU/byte value remains null/unknown. No unknown is treated as zero, no projected gain admitted and no price proof is inferred from symbolic completeness.", + "wall": "W_total is actual outer admission-to-final-teardown elapsed time. Per-phase nested samples are diagnostic and must not be summed as if exclusive. Exclusive segment partition plus idle/wait/parent tails must reconcile to W_total." + }, + "funding_and_fit_accepted": false, + "gain_claimed": false, + "new_cap_or_reservation": false, + "original_bill": { + "bytes": 11377, + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/BILL-AND-RESOURCE.json", + "sha256": "61109d429c4d78df3ec55e65a5c4879c58342c49a8ac4fe30f3892ecc117570d" + }, + "original_caps_unchanged": { + "RSS_bytes": 1073741824, + "Root_seconds": 180, + "global_seconds": 2400 + }, + "original_control_bill": { + "bytes": 336468, + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-full-contract-completion-v1/CONTROL-BILL.json", + "sha256": "33d3a55103c8c92e7f29220e1774544dba1cfd6a19d2cf1f3aa0a4589c5a4511" + }, + "schema": "cache-s0308-complete-symbolic-cost-definition-v1", + "source_definition_acceptance_implies_fit": false, + "source_quantities": { + "K": { + "condition": "Pinned exact original complete source and eligible closed lifetime; mismatch/capacity retires private metadata and continues original V8. Not an observed K.", + "upper_source_expectation": 85196 + }, + "Q": "Every actual original verify_labels and forward/reverse role-label/residual request, counted from actual loops and complete coverage; currently not measured.", + "metadata_byte_formula": "M_fixed + DictIndexCapacity(K) + K*(NativeIdInteger64 + Tuple7) + Pending1 + PeakConcurrentSourceCompilationCaptureTemporaries + ErrorRetainedGraphs + ActualAllocatorOverhead", + "original_retained_graph": "Original Label/basis/key objects are not duplicated by a record; their pre-existing and error-extended ownership and actual allocator footprint still enter aggregate RSS. No claim of zero extra error memory." + }, + "status": "COMPLETE_CATEGORY_DEFINITION_PROPOSED_NOT_NUMERIC_FIT" +} diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v1/coverage/COVERAGE-SPEC-v1.json b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v1/coverage/COVERAGE-SPEC-v1.json new file mode 100644 index 0000000000..4af4b782e8 --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v1/coverage/COVERAGE-SPEC-v1.json @@ -0,0 +1,2770 @@ +{ + "schema": "cache-s0308-52-body-coverage-source-spec-v1", + "status": "SOURCE_SPECIFICATION_DRAFT_FOR_PEER_REVIEW", + "created_utc": "2026-10-31T00:04:15.492508+00:00", + "scope": "Original52 cache helper bodies only, minimum63 explicit selections, grouped into13 reusable original checkpoints. No target execution, runtime admission or wider212 reallocation.", + "counts": { + "original_public_bodies": 52, + "minimum_explicit_invocation_selections": 63, + "checkpoint_groups": 13, + "existing_finite_factory_selected_bodies": 2, + "P08_body_derivative_pending_other_lane": 1, + "other_bodies_without_current_selected_entry": 49, + "runtime_results": 0 + }, + "count_limit": "63 is the minimum explicit variant expansion, not proof of exhaustive fixture/request-kind/mode coverage; N13 label/residual and each original fixture/oracle requirement remain visible.", + "source_references": [ + { + "id": "HELPER", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-full-contract-completion-v1/cache_epoch_source_controls.py", + "sha256": "fcffe77b6a84d5b422b03e3d068924a701c1594cdb9ec305115827e3fad7d4b6", + "bytes": 65591 + }, + { + "id": "CONTEXTS", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/SOURCE-CASE-CONTEXTS.json", + "sha256": "4eeb55857ff84aff47c17aaa3736bbeba2d525d1ed9ea129ffd35272669b00ff", + "bytes": 19587 + }, + { + "id": "CACHE", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_cache_products_v1.py", + "sha256": "d317c9866566cd6147c96566879f26f364e7e6801ac3eed0800b6ed8eedd01a2", + "bytes": 171075 + }, + { + "id": "DRIVER", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_scientific_driver_v1.py", + "sha256": "1e8202b7a4c17fc8dfb0a001085c26bf2ec26a69eb6c8501763773324c2bd9a1", + "bytes": 89606 + }, + { + "id": "DATA", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_data_products_v1.py", + "sha256": "18679fd1eb6ae99c4b375756511427c26718f77674c2d8fcc490e25ceb47cba5", + "bytes": 103903 + }, + { + "id": "AUTHORITY", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/epoch_authority_products_v1.py", + "sha256": "f279ab86fc17c6a517b035f19d56863919cbd8304de4e7d5332457c6159aec10", + "bytes": 137642 + }, + { + "id": "ORIGINAL_CIRCUIT", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/engine/source/complex_circuit.py", + "sha256": "d623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1", + "bytes": 19732 + }, + { + "id": "ORIGINAL_FULL_SCRIPT", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/baseline/engine/source/complex_network.py", + "sha256": "0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b", + "bytes": 6105 + }, + { + "id": "UNCACHED_CONTROLS", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/areas/cache-validity/cache_controls_v8.py", + "sha256": "8ac3ccf5a3923d46c3f470d2cb1d2d1440fb72ad4344f4c08501c12d7be6ad1d", + "bytes": 100708 + }, + { + "id": "LEGACY_CONTROL_CALLER", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/data_adapters.py", + "sha256": "c00c9c215d0b81a91dd5dffddacfd2225c4bc40fe3ba43c7b93677bb686591cc", + "bytes": 80465 + }, + { + "id": "FINITE_FACTORY", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-genuine-context-v1/cache_epoch_context_assembly_v1.py", + "sha256": "9c2c5ffdbfc692b48ddba780258df7694ba376ef43e7d5ab14e8760a041851ad", + "bytes": 81941 + }, + { + "id": "OWNER_FAULTS", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/CONTROL-FAULT-SOURCE-PINS.json", + "sha256": "acd47a2097495eb3f3455ec579fa408fc9126140ac3cb2e77ddc1804ad70491b", + "bytes": 3349 + }, + { + "id": "CLI_V3_FAULTS", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/CLI-FAULT-SOURCE-PINS-v3.json", + "sha256": "d3733658f54067edcc518c4222559b0f2bc040aab6e43b6facf30dc98a8798fb", + "bytes": 7020 + }, + { + "id": "CLI_V4_FAULTS", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/CLI-FAULT-SOURCE-PINS-v4.json", + "sha256": "7900cfc574374ffc21d9f8d512ccc20d7ed02980d138bf84e86b89756cbd883a", + "bytes": 6691 + }, + { + "id": "MAIN_V5_FAULTS", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-epoch-products-v5/OUTER-FAULT-SOURCE-PINS-v5.json", + "sha256": "c4d8d7daffa60f3ae0a97995829127d0fcf144a01a61b840ed9d3bbcc368ed4d", + "bytes": 3655 + }, + { + "id": "AUTHORIZATION", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v1/parent/AUTHORIZATION-v1.json", + "sha256": "6a1c639c18ceb486290a9d45290d0e1b189e85ace94c518021d8997054a5905f", + "bytes": 2433 + }, + { + "id": "SC5", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/strict-source-review-20261030T231709Z/parent/NEXT-SOURCE-CHECKLIST-v1.json", + "sha256": "0c0ed109bd6d1bdbfa457c2f25c437b5a97cad44fd590b989d0fb74cd20544ce", + "bytes": 8029 + } + ], + "checkpoint_groups": [ + { + "id": "G01", + "name": "Original cold load admission", + "cases": [ + "N01" + ], + "checkpoint": [ + { + "source": "DRIVER", + "lines": [ + [ + 1092, + 1095 + ] + ] + }, + { + "source": "AUTHORITY", + "lines": [ + [ + 1227, + 1238 + ] + ] + } + ], + "recipe": "Use genuine Root-created driver entry, descriptor and backend handle already owned by original prepare. At the fixed source selector immediately before original epoch_load, pass the original bundle to unchanged N01; its foreign object is deliberately rejected by actual load admission. Preserve real parent cleanup.", + "fields": "bundle; optional native binding only if one genuinely exists already", + "construction_class": "BOUNDED_FIXED_SELECTOR_MISSING", + "mode": "FINITE_SOURCE_BOTH_MODES_IF_ORIGINAL_FINITE_ENTRY_SEPARATELY_ADMITTED; full main remains normal-only", + "oracle": "Original dispatcher/handle rejection with no original arithmetic; no fabricated Root or handle." + }, + { + "id": "G02", + "name": "Real load ticket and acquired-owner factory boundary", + "cases": [ + "N02", + "V2_OWNER_FIRST_CAPTURE", + "V2_OWNER_LATE_GRAPH" + ], + "checkpoint": [ + { + "source": "DATA", + "lines": [ + [ + 1358, + 1372 + ] + ] + }, + { + "source": "AUTHORITY", + "lines": [ + [ + 1237, + 1239 + ], + [ + 1285, + 1307 + ] + ] + } + ], + "recipe": "Use actual load module/ticket and original factory arguments. N02 enters after real epoch_acquisition allocation1363-1365 and before factories1366, mutates only the owned echelon slot and calls the unchanged helper. The owner-fault cases enter original install_epoch_circuit with their separately pinned first/late authority+driver images, so real prepare publishes the parent-owned record before the declared fault. Never synthesize epoch_acquisition or prepared/owner records.", + "fields": "state,module,load_ticket,factory_arguments,extensions,comparison,factory_context,bundle,data_module,authority_module", + "construction_class": "EXISTING_FAULT_IMAGES_PLUS_BOUNDED_FIXED_SELECTORS", + "mode": "FINITE_SOURCE_BOTH_MODES_IF_EXACT_ENTRY_ADMITTED", + "oracle": "First fault keeps origin_handle None; late fault keeps actual returned origin handle; exact intended admit frame/error and original one-shot owner cleanup." + }, + { + "id": "G03", + "name": "Authentic unarmed Suite before native final binding", + "cases": [ + "N03", + "N04", + "N05", + "N06", + "N07", + "N08", + "N09", + "N18", + "N24", + "V2_ORIGIN_FIRST_ALL_ROUTES", + "V3_INSTANCE_KEY_DOMAIN", + "V3_FIXED_RECORD_BINDINGS", + "V3_INSTANCE_METHOD_SHADOW", + "V3_INSTANCE_STATE_SCHEMA" + ], + "checkpoint": [ + { + "source": "DATA", + "lines": [ + [ + 1372, + 1393 + ] + ] + }, + { + "source": "AUTHORITY", + "lines": [ + [ + 1309, + 1328 + ], + [ + 1413, + 1419 + ], + [ + 1490, + 1501 + ] + ] + }, + { + "source": "CACHE", + "lines": [ + [ + 1984, + 2011 + ], + [ + 2044, + 2070 + ] + ] + } + ], + "recipe": "Capture actual returned state.epoch_suite after original derive/install and before driver final_native_binding. N03/N07 require actual FACTORIES_ADMITTED or CALLERS_INSTALLED; do not advance or reset phase. Keep original FULLNone tuple for N24 and a distinct fresh generation for N18, which calls actual retire then arm. Each origin route and each instance variant uses a distinct source-selected cold generation; restore only the helper-owned fault binding and discard the failed generation.", + "fields": "state,bundle,authority_module,cache_module,module,foreign_function,foreign_class,invocation_token; route_index/fixed_record_field/state_schema_field as exact literal variant", + "construction_class": "BOUNDED_FIXED_SELECTORS_OVER_EXISTING_GENUINE_RETURN", + "mode": "FINITE_SOURCE_BOTH_MODES_IF_EXACT_ENTRY_ADMITTED; N18/N24 refuse before optimize guard", + "oracle": "Exact intended source guard/type/args/frame; foreign equality/origin callbacks remain uncalled. N18 retired/consumed refusal precedes FULL; N24 fresh FULLNone refusal is distinct." + }, + { + "id": "G04", + "name": "Authentic row-derived AST packet", + "cases": [ + "N11" + ], + "checkpoint": [ + { + "source": "CACHE", + "lines": [ + [ + 1734, + 1750 + ], + [ + 2531, + 2557 + ] + ] + } + ], + "recipe": "At original bind_epoch_cache_backend after actual row producer returned and its registered callable/AST inverse checks passed, retain the original row FunctionDef from that exact packet. Invoke unchanged N11 on a deep copied mutation; preserve actual original node and producer identity. Do not substitute an arbitrary AST having the right shape.", + "fields": "state,bundle,registered_row_bind_ast,cache_module", + "construction_class": "BOUNDED_FIXED_SELECTOR_AND_RETAINED_ORIGINAL_LOCAL", + "mode": "FINITE_SOURCE_BOTH_MODES_IF_EXACT_ENTRY_ADMITTED", + "oracle": "Exact production _epoch_locations structural mismatch; original registered row AST remains unchanged." + }, + { + "id": "G05", + "name": "Actual clone return before final binding capture", + "cases": [ + "N10" + ], + "checkpoint": [ + { + "source": "CACHE", + "lines": [ + [ + 2606, + 2609 + ], + [ + 2240, + 2247 + ] + ] + }, + { + "source": "AUTHORITY", + "lines": [ + [ + 1464, + 1483 + ] + ] + } + ], + "recipe": "Retain actual clone result at cache2606 after real raw RuntimeGuard initialization and before finish call2609. Require origin GLOBALS_COMMITTED, result.runtime_guard is origin.raw_guard and owner.runtime is same actual raw object. Pass that result as binding and call N10; no phase/runtime replacement.", + "fields": "state,bundle,module,binding", + "construction_class": "BOUNDED_FIXED_SELECTOR_AT_EXISTING_RETURN", + "mode": "FINITE_SOURCE_BOTH_MODES_IF_EXACT_ENTRY_ADMITTED", + "oracle": "Added source slot must fail exact Epoch source namespace owner/census at actual ledger.check, not an earlier phase/raw mismatch." + }, + { + "id": "G06", + "name": "Sealed but unarmed source objects and exact CLI fault tuples", + "cases": [ + "N23", + "V2_ROLE_CLEANUP_ONLY", + "P03", + "P08", + "V4_ROLE_RAW_JOURNAL", + "V4_CLI_RAW_JOURNAL" + ], + "checkpoint": [ + { + "source": "DRIVER", + "lines": [ + [ + 1108, + 1137 + ], + [ + 1160, + 1168 + ] + ] + }, + { + "source": "CACHE", + "lines": [ + [ + 2304, + 2316 + ] + ] + }, + { + "source": "ORIGINAL_CIRCUIT", + "lines": [ + [ + 26, + 42 + ], + [ + 267, + 269 + ] + ] + }, + { + "source": "HELPER", + "lines": [ + [ + 337, + 379 + ], + [ + 400, + 415 + ], + [ + 481, + 508 + ], + [ + 725, + 750 + ] + ] + } + ], + "recipe": "Use exact real load/install/bind/construction-set-epoch sealing. Construct ComplexSideCircuit(8) and Checks through installed authentic constructors while original set owner remains unused and Suite unarmed. No private C1 registry is created in this prearm path. P03 only needs genuine SEALED guard state, not fixtures. Role cases call actual role product while unarmed. P08 and V4 CLI variants use exact original protected boundary and pinned source tuple/script. P08 body requires the separately reviewed captured(original,observed) phase-wrapper repair, never W-is-L.", + "fields": "state,bundle,module,cache_module,authority_module,driver_module,data_module,extensions,phases,invocation_token,circuit,checks,case_kind,case_script_path", + "construction_class": "P08_BODY_DERIVATIVE_IN_OTHER_LANE_PENDING_REVIEW; OTHER_FIXED_SELECTORS_MISSING", + "mode": "P08_BODY_NORMAL_ONLY; early source faults and role/public modes require separately admitted exact finite or full caller", + "oracle": "P08 body actual labels AttributeError and distinct primary/disarm/retirement raw identities; unarmed role KeyError or cleanup-only primary; exact source tuple, argv pointer and terminal ownership preserved." + }, + { + "id": "G07", + "name": "Original baseline prearm CLI cleanup variants", + "cases": [ + "V3_CLI_DISARM_ONLY", + "V3_CLI_BODY_DISARM", + "V3_CLI_BODY_DISARM_RETIREMENT", + "V4_ARGV_ONLY", + "V4_BODY_ARGV_DISARM_RETIREMENT", + "V4_ARGV_DISARM_RETIREMENT", + "V4_ARGV_BEFORE_DISARM_RETIREMENT" + ], + "checkpoint": [ + { + "source": "HELPER", + "lines": [ + [ + 597, + 637 + ], + [ + 658, + 707 + ] + ] + }, + { + "source": "DRIVER", + "lines": [ + [ + 1094, + 1095 + ], + [ + 1102, + 1103 + ], + [ + 1160, + 1168 + ] + ] + } + ], + "recipe": "Select original baseline prepare/install/bind/seal path so state.arm is baseline, enabled False and epoch_suite absent by genuine source outcome. Use exact V3/V4 five-image tuple and normal or body-failure script; actual set arm and protected CLI/argv/disarm occur unchanged. Fresh owner per variant; no candidate state toggling.", + "fields": "driver_module,state,extensions,checks,phases,case_script_path,authority_module,cache_module", + "construction_class": "EXISTING_FAULT_IMAGES_PLUS_BOUNDED_FIXED_SELECTORS", + "mode": "NORMAL_OR_OPTIMIZED_ONLY_WHEN_GENUINE_BASELINE_ENTRY_ALLOWS; full main optimize refusal cannot count", + "oracle": "Exact body/argv/disarm/retirement error objects and frames; before-restore variant observes unrestored pointer before fixture parent restores its own argv." + }, + { + "id": "G08", + "name": "Genuine armed private/public caller fixtures", + "cases": [ + "N12", + "N16", + "N19", + "N21", + "P01", + "P02", + "P04", + "P05", + "P06" + ], + "checkpoint": [ + { + "source": "CACHE", + "lines": [ + [ + 2063, + 2070 + ], + [ + 2084, + 2121 + ], + [ + 2133, + 2159 + ] + ] + }, + { + "source": "ORIGINAL_CIRCUIT", + "lines": [ + [ + 267, + 311 + ], + [ + 335, + 348 + ] + ] + }, + { + "source": "ORIGINAL_FULL_SCRIPT", + "lines": [ + [ + 90, + 108 + ] + ] + } + ], + "recipe": "Use a fresh exact accepted normal full candidate tuple and original protected arm operations. Construct original circuit and Checks AFTER arm for private C1 registration; use actual constructors for C2/C3 via uncached valid active node and target tuple from that original circuit. Never reuse P08 prearm Checks. Public fallback controls begin with actual active metadata and then enter real public methods, proving retirement rather than starting retired. P02 uses complete original labels/roles in original order and independently owned original baseline oracle.", + "fields": "state,bundle,checks,circuit,code,binding,module,fresh_active_node,fresh_output_S,registered_label,replacement_basis,vectors,small,big,callback_small,callback_big,literal_expected,snapshots_before,rank_events,trace,actual_outputs and independently produced reference_*", + "construction_class": "FIXED_FULL_ENTRY_AND_FIXTURE_SELECTION_SOURCE_AUTHORABLE; FULL_CONTEXT_AND_REFERENCE_TRANSPORT_NOT_YET_BOUND", + "mode": "NORMAL_ONLY_FOR_GENUINE_ARMED_PRIVATE_BODY; optimized refusal is separate", + "oracle": "N12 must reach active wrong-site guard, P01 verifies actual C1/C2/C3 object pairing/counts, P02 exact typed/order/native/trace/output equality, public results use separate uncached original objects and retire private metadata." + }, + { + "id": "G09", + "name": "Unchanged independent legacy control invocation", + "cases": [ + "N20" + ], + "checkpoint": [ + { + "source": "LEGACY_CONTROL_CALLER", + "lines": [ + [ + 676, + 691 + ], + [ + 746, + 770 + ] + ] + }, + { + "source": "UNCACHED_CONTROLS", + "lines": [ + [ + 52, + 57 + ], + [ + 105, + 106 + ], + [ + 248, + 268 + ], + [ + 327, + 345 + ], + [ + 1822, + 1830 + ] + ] + } + ], + "recipe": "Invoke original source-owned data_controls route with exact original Root/capability/provider/native/environment handles and unchanged run_controls args/kwargs. This is its own real work, not a cached receipt. Use existing independent original reference loader and paired objects; do not repurpose its small SimpleNamespace fixture as a full P08 circuit.", + "fields": "legacy_controls,legacy_control_args,legacy_control_kwargs", + "construction_class": "EXISTING_AUTHENTIC_CALLER_REUSE_WITH_FIXED_SELECTION", + "mode": "EXISTING_FINITE_NORMAL_AND_OPTIMIZED_SEMANTICS", + "oracle": "Unchanged155 controls including exact canonical2 HIT/1 complement, wide1 fallback and12 caller/10 native consumer counts; does not migrate wider212 scope into S03.08." + }, + { + "id": "G10", + "name": "Actual live and consumed request checkpoints", + "cases": [ + "N13", + "N17" + ], + "checkpoint": [ + { + "source": "CACHE", + "lines": [ + [ + 2136, + 2193 + ] + ] + }, + { + "source": "HELPER", + "lines": [ + [ + 151, + 156 + ], + [ + 183, + 186 + ] + ] + } + ], + "recipe": "Run actual armed labels/roles caller with real registered operands and original caller capability. N13 needs the same actual req created2155, at entry-view stage1 before an entry view has been consumed; a fixed source-selected one-shot port must retain it without creating/resetting a dict. N17 retains that actual request across original finally2159 setting stage3, then calls unchanged N17. Both require exact derivative source/inverse and closed alias lifetime, not a generic callback.", + "fields": "state,bundle,live_request or consumed_request; actual checks/operands are members of original request", + "construction_class": "SOURCE_AUTHORABLE_FIXED_PORTS_REQUIRED; NO_CURRENT_GENUINE_RETAINED_REQUEST_SELECTOR", + "mode": "NORMAL_ONLY", + "oracle": "Equal-but-distinct registered key must fail exact request/key identity with no arithmetic; replay of actual consumed request refuses. Need label/residual fixture coverage adjudication beyond63 explicit variants." + }, + { + "id": "G11", + "name": "Actual pending constructor and original store failure", + "cases": [ + "N14", + "N15" + ], + "checkpoint": [ + { + "source": "CACHE", + "lines": [ + [ + 1770, + 1795 + ], + [ + 2084, + 2129 + ] + ] + }, + { + "source": "ORIGINAL_CIRCUIT", + "lines": [ + [ + 271, + 286 + ] + ] + }, + { + "source": "HELPER", + "lines": [ + [ + 159, + 172 + ] + ] + } + ], + "recipe": "N14 selects exact original active constructor interval after source has set pending2093 and before it clears; fixed one-shot source port invokes helper on actual pending object and permits original cleanup. N15 can use genuine postarm Checks and valid fresh node with a separately source-owned public cache mapping that raises at original Checks.label store285; original transformed C2 catches/cancels through unchanged inverse handler. Do not supply an invalid node that fails before intended constructor/store or fabricate pending/registry. Exact failure fixture and source-owner acceptance are still required.", + "fields": "state,bundle,checks,node,vectors; actual pending stays private and is never synthesized", + "construction_class": "N14_FIXED_SOURCE_PORT_MISSING; N15_BOUNDED_ORIGINAL_STORE_FAILURE_FIXTURE_SOURCE_AUTHORABLE", + "mode": "NORMAL_ONLY", + "oracle": "N14 nested constructor retires active metadata; N15 original caught constructor/store error is primary, pending/registry cleared, genuine secondary uncertainty preserved." + }, + { + "id": "G12", + "name": "Real metadata-capacity boundary and remaining original work", + "cases": [ + "N22", + "P07" + ], + "checkpoint": [ + { + "source": "CACHE", + "lines": [ + [ + 2106, + 2121 + ] + ] + }, + { + "source": "HELPER", + "lines": [ + [ + 227, + 233 + ], + [ + 330, + 334 + ] + ] + } + ], + "recipe": "Provide a fixed admissible original-input/constructor sequence that genuinely leaves85196 distinct retained original store-backed entries and a real pending next original store. All entries must arise from unchanged C1/C2/C3 constructors and original stores; no seeding/resizing/dummy tuples or lowered cap. N22 then calls original commit; P07 additionally needs exact remainder count/output from independent unchanged original caller under same input.", + "fields": "state,bundle,site,checks,registered_label,literal_expected,remaining_original_case_count,remaining_original_outputs,reference_remaining_case_count,reference_remaining_outputs", + "construction_class": "FIXTURE_REACHABILITY_AND_INDEPENDENT_REMAINDER_SOURCE_CONSTRUCTION_NOT_SUPPLIED", + "mode": "NORMAL_ONLY", + "oracle": "Actual threshold retirement and original fallback continuation; P07 proves no remaining original work skipped. Costliness alone is not a source impossibility, but a bare number85196 supplies neither fixture nor reachability." + }, + { + "id": "G13", + "name": "Cold original main/STOP entries", + "cases": [ + "V5_MAIN_PRIMARY_OUTER", + "V5_MAIN_CLEANUP_ONLY", + "V5_MAIN_ABSENT_RECORD" + ], + "checkpoint": [ + { + "source": "HELPER", + "lines": [ + [ + 758, + 839 + ] + ] + }, + { + "source": "FINITE_FACTORY", + "lines": [ + [ + 68, + 86 + ] + ] + }, + { + "source": "DRIVER", + "lines": [ + [ + 1246, + 1270 + ] + ] + } + ], + "recipe": "Each entry starts actual driver._EXECUTION state and packet None. Existing finite factory binds two baseline --finite-only entries and both optimize modes. Absent-record needs separate exact full candidate five-image tuple, normal mode, no --finite-only, actual _run_epoch_with_stop_evidence -> main_epoch and its fixed fault before CLI record allocation; never borrow P08 prepared state.", + "fields": "driver_module,authority_module,cache_module,argv", + "construction_class": "TWO_EXISTING_FINITE_SELECTIONS; ABSENT_RECORD_FULL_SELECTION_AND_CONTRACT_BINDING_MISSING", + "mode": "TWO_FINITE_CASES_BOTH_MODES; ABSENT_RECORD_NORMAL_ONLY", + "oracle": "Actual STOP primary frame and one-shot known-owner cleanup; absent-record distinct P/R1/J1/R2/J2 raw identities, independent inner/outer channels and transfer-before-ACK replay rejection." + } + ], + "case_matrix": [ + { + "id": "N01", + "checkpoint": "G01", + "helper_lines": [ + 70, + 72 + ], + "public_function_ast_sha256": "dcd3c198eaa59decfe295e1a11cfb907431f3270efaacd8801bb685299cf4685", + "literal_function_span_sha256": "7dabbdcc6a0ab4412d66105a214079cd5746af36631a600bdbdaa58e7abef5ec", + "context_keys_read_in_transitive_local_helpers": [ + "binding" + ], + "local_helper_dependencies": [ + "_counts", + "_need", + "_reject" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "N02", + "checkpoint": "G02", + "helper_lines": [ + 75, + 78 + ], + "public_function_ast_sha256": "0bb95ed937076eaa989a23653fe333ddd99b4a9e22825d51751866fad65ff985", + "literal_function_span_sha256": "7afb1f868a7e01a56810a70d517f35986635c8d9f7599191fb70442da0a92a23", + "context_keys_read_in_transitive_local_helpers": [ + "binding", + "factory_arguments", + "foreign_function", + "module" + ], + "local_helper_dependencies": [ + "_counts", + "_need", + "_reject" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "N03", + "checkpoint": "G03", + "helper_lines": [ + 81, + 86 + ], + "public_function_ast_sha256": "a3ee7a20fe51addfd2e8a8447a586ab0e834b0e0e052d642b4f95f50ffca860c", + "literal_function_span_sha256": "3c42897d173a7554ed9f2f0bee910c705a6a6d3050822e2349249374f248fbb6", + "context_keys_read_in_transitive_local_helpers": [ + "authority_module", + "binding", + "bundle", + "foreign_function", + "state" + ], + "local_helper_dependencies": [ + "_counts", + "_dispatch", + "_has_frame", + "_intended_error", + "_ledger", + "_live", + "_need", + "_reject" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "N04", + "checkpoint": "G03", + "helper_lines": [ + 90, + 94 + ], + "public_function_ast_sha256": "c0c7d74a27acf781624dd5815ad9f4436897810592e6c807708d0b81e45274c7", + "literal_function_span_sha256": "1d2d14c11b65eb50b7b078ed50da46b6e6e8ba4c752dbf237abce4607561db8b", + "context_keys_read_in_transitive_local_helpers": [ + "binding", + "bundle", + "state" + ], + "local_helper_dependencies": [ + "_counts", + "_dispatch", + "_live", + "_need", + "_reject" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "N05", + "checkpoint": "G03", + "helper_lines": [ + 97, + 99 + ], + "public_function_ast_sha256": "f00bc0244c84988f5d7cb7211ca9b38e7101e09eae801bd707787754975cb7c4", + "literal_function_span_sha256": "3c4b4275eeb182df5110489ac7cd7e61ad855ec57380a50f781ab57b8accf42c", + "context_keys_read_in_transitive_local_helpers": [ + "binding", + "bundle", + "foreign_class", + "module", + "state" + ], + "local_helper_dependencies": [ + "_counts", + "_dispatch", + "_live", + "_need", + "_reject" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "N06", + "checkpoint": "G03", + "helper_lines": [ + 102, + 104 + ], + "public_function_ast_sha256": "a4e9b5d5f01a7f86ec766f030e76e8eaf3c42cb4e3bbc6faa82b40360588531d", + "literal_function_span_sha256": "3db1e2ebe2e2031deeb168b60f9a8f93a53ebe0cfdcc5e5836d067914d6db47d", + "context_keys_read_in_transitive_local_helpers": [ + "binding", + "bundle", + "foreign_function", + "module", + "state" + ], + "local_helper_dependencies": [ + "_counts", + "_dispatch", + "_live", + "_need", + "_reject" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "N07", + "checkpoint": "G03", + "helper_lines": [ + 107, + 112 + ], + "public_function_ast_sha256": "718deafd1bb769b96469adff18376b3212b18a091de4e8df3f1b4152be9397bb", + "literal_function_span_sha256": "c3003a0250a0fed949387c2c6b4151805e14c431767491b5a7cf65916772345a", + "context_keys_read_in_transitive_local_helpers": [ + "authority_module", + "binding", + "bundle", + "foreign_function", + "state" + ], + "local_helper_dependencies": [ + "_counts", + "_dispatch", + "_has_frame", + "_intended_error", + "_ledger", + "_live", + "_need", + "_reject" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "N08", + "checkpoint": "G03", + "helper_lines": [ + 116, + 120 + ], + "public_function_ast_sha256": "bd34be4a35e6103591ff81af668160fdfee3e626317853dab730f95246697ae3", + "literal_function_span_sha256": "e82763569e80b4a5bfa1f4dd41b673865800c12bead8bb6aa89588f2724fe37c", + "context_keys_read_in_transitive_local_helpers": [ + "authority_module", + "binding", + "bundle", + "foreign_function", + "state" + ], + "local_helper_dependencies": [ + "_counts", + "_dispatch", + "_ledger", + "_live", + "_need", + "_reject" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "N09", + "checkpoint": "G03", + "helper_lines": [ + 123, + 125 + ], + "public_function_ast_sha256": "84faca00cf9310dcd2a84bca58517a4a80b1f59874418a2cc7e16bd3b2bcf9bb", + "literal_function_span_sha256": "37aa258fceeb6115da08967a7b9f52acc84f5bc792e7e780132a847ebc28c68f", + "context_keys_read_in_transitive_local_helpers": [ + "binding", + "bundle", + "module", + "state" + ], + "local_helper_dependencies": [ + "_counts", + "_dispatch", + "_live", + "_need", + "_reject" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "N10", + "checkpoint": "G05", + "helper_lines": [ + 128, + 135 + ], + "public_function_ast_sha256": "7eb1022be02c2635936afe60b421a60ddce16c5f6e9613bb2fac3836bcd665a3", + "literal_function_span_sha256": "021a18eaa404ef2d69a9ccceea6a1f28956b6be1cb7b44a2b5896eb62740cf94", + "context_keys_read_in_transitive_local_helpers": [ + "authority_module", + "binding", + "bundle", + "module", + "state" + ], + "local_helper_dependencies": [ + "_counts", + "_dispatch", + "_has_frame", + "_intended_error", + "_ledger", + "_live", + "_need", + "_reject" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "N11", + "checkpoint": "G04", + "helper_lines": [ + 139, + 143 + ], + "public_function_ast_sha256": "88eb15f63c62f3b2ee960fdfc74dae20537fdd69a5ac6ae9cf5faec74084fd0e", + "literal_function_span_sha256": "847566f6c9e856af7b8d44b345668cc5710f3c22eb8d838076f65709ee4fe61a", + "context_keys_read_in_transitive_local_helpers": [ + "binding", + "bundle", + "cache_module", + "registered_row_bind_ast", + "state" + ], + "local_helper_dependencies": [ + "_counts", + "_dispatch", + "_live", + "_need", + "_reject" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "N12", + "checkpoint": "G08", + "helper_lines": [ + 146, + 148 + ], + "public_function_ast_sha256": "aec33454fdfcf95671812886ed5132a4c5cc1d98fb69a0bc75fbf9051344d33f", + "literal_function_span_sha256": "aa7de83db487423a64a7b949a69af055dbc02aaf33d498c6ce7fa9741341294a", + "context_keys_read_in_transitive_local_helpers": [ + "binding", + "bundle", + "checks", + "state", + "vectors" + ], + "local_helper_dependencies": [ + "_counts", + "_dispatch", + "_live", + "_need", + "_reject" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "N13", + "checkpoint": "G10", + "helper_lines": [ + 151, + 156 + ], + "public_function_ast_sha256": "88595ad730b501c70f1745040e7a17767530cddef81bb53a25a82ed96bda9fbd", + "literal_function_span_sha256": "5d32113e89b541157ce5c55e7a39d32f5f246ed141f988b65c9d40a3e59c6842", + "context_keys_read_in_transitive_local_helpers": [ + "binding", + "bundle", + "live_request", + "state" + ], + "local_helper_dependencies": [ + "_counts", + "_dispatch", + "_live", + "_need", + "_reject" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "N14", + "checkpoint": "G11", + "helper_lines": [ + 159, + 163 + ], + "public_function_ast_sha256": "62e97f8e372eff0e07fbc9fe7d821ec147752bfefc9032c36aa284e016ab12c8", + "literal_function_span_sha256": "184b0d16dbff5912fb364eeb8a8306f7c378354a4da637afe1763a99255a791a", + "context_keys_read_in_transitive_local_helpers": [ + "binding", + "bundle", + "checks", + "node", + "state", + "vectors" + ], + "local_helper_dependencies": [ + "_counts", + "_dispatch", + "_live", + "_need", + "_reject" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "N15", + "checkpoint": "G11", + "helper_lines": [ + 166, + 172 + ], + "public_function_ast_sha256": "81e1e245066509a549b9e921b41e1a8f1c8daa4eef2fbcdcf78a40cf8583462b", + "literal_function_span_sha256": "68700079eed8575affd445390fba126ffeed9df44fc030d5d39f53a616e1f87f", + "context_keys_read_in_transitive_local_helpers": [ + "bundle", + "checks", + "node", + "state" + ], + "local_helper_dependencies": [ + "_dispatch", + "_live", + "_need" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "N16", + "checkpoint": "G08", + "helper_lines": [ + 175, + 180 + ], + "public_function_ast_sha256": "50059ab93e4944b460706dedd86ac6a5aeafc53480daad7b2e2b7847b70cfa39", + "literal_function_span_sha256": "0758ef00ca2b7bae5f8d1a986da5897ad8f6585f2b852b2ca48b46cb61853df8", + "context_keys_read_in_transitive_local_helpers": [ + "binding", + "bundle", + "checks", + "module", + "state", + "vectors" + ], + "local_helper_dependencies": [ + "_counts", + "_dispatch", + "_live", + "_need", + "_reject" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "N17", + "checkpoint": "G10", + "helper_lines": [ + 183, + 186 + ], + "public_function_ast_sha256": "f1fdf46b2ccca2be944afe2cf9c4713d987606b85a54c46fc3fcbbbfaeef5250", + "literal_function_span_sha256": "97f48a75976291483b6cb2bc9b2765791654dfffd16eea610775d61be5e0b8e8", + "context_keys_read_in_transitive_local_helpers": [ + "binding", + "bundle", + "consumed_request", + "state" + ], + "local_helper_dependencies": [ + "_counts", + "_dispatch", + "_live", + "_need", + "_reject" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "N18", + "checkpoint": "G03", + "helper_lines": [ + 189, + 193 + ], + "public_function_ast_sha256": "a758c42795d96d498be2fef04858e28d7f43a104f76f9a45987415a08a037501", + "literal_function_span_sha256": "ce89b46bf724849d761acd672a8f195ebc73edcd38420f1e7b5620bd696dabf8", + "context_keys_read_in_transitive_local_helpers": [ + "binding", + "bundle", + "invocation_token", + "state" + ], + "local_helper_dependencies": [ + "_counts", + "_dispatch", + "_has_frame", + "_intended_error", + "_live", + "_need", + "_reject" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "N19", + "checkpoint": "G08", + "helper_lines": [ + 197, + 203 + ], + "public_function_ast_sha256": "575c6ce65f322d116d7b7c1e0b69e1ce5ac4941330754254a2bbe40a1ef702b3", + "literal_function_span_sha256": "1c82c6921d94145239cbd5d7eb5055a8e8233b794f80e0014cba2ad69dd346e1", + "context_keys_read_in_transitive_local_helpers": [ + "bundle", + "checks", + "literal_expected", + "registered_label", + "replacement_basis", + "state" + ], + "local_helper_dependencies": [ + "_dispatch", + "_live", + "_need" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "N20", + "checkpoint": "G09", + "helper_lines": [ + 206, + 214 + ], + "public_function_ast_sha256": "1482427ed9a485b65d6b9297e450e115e22e4cfcd21efbf01bf901f929cf43b0", + "literal_function_span_sha256": "458a775cf2890e3640017a609f2886c62a37b57aae7821200d214fa94f9b3ddd", + "context_keys_read_in_transitive_local_helpers": [ + "legacy_control_args", + "legacy_control_kwargs", + "legacy_controls" + ], + "local_helper_dependencies": [ + "_need" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "N21", + "checkpoint": "G08", + "helper_lines": [ + 217, + 224 + ], + "public_function_ast_sha256": "243cb31009a3f7ecce11205990a45a1f29ab6ce4316bb78f3f67236cc3e26579", + "literal_function_span_sha256": "fc66965e8fad7fa5c8753615bd2dbfb9091be65b08d65f2af076e1356b70355c", + "context_keys_read_in_transitive_local_helpers": [ + "bundle", + "callback_big", + "callback_small", + "checks", + "literal_expected", + "state" + ], + "local_helper_dependencies": [ + "_dispatch", + "_live", + "_need" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "N22", + "checkpoint": "G12", + "helper_lines": [ + 227, + 233 + ], + "public_function_ast_sha256": "efb6c1aec28f37b1c85204f8ac9e00a5c7c6d77b8fb9cdfd980137a035ebfdb7", + "literal_function_span_sha256": "28ecf35b8063424cbe434988fdea2caa340da1d155e160192fc52bf29605c5df", + "context_keys_read_in_transitive_local_helpers": [ + "bundle", + "checks", + "literal_expected", + "registered_label", + "site", + "state" + ], + "local_helper_dependencies": [ + "_dispatch", + "_live", + "_need" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "N23", + "checkpoint": "G06", + "helper_lines": [ + 236, + 254 + ], + "public_function_ast_sha256": "0ea6165e00f2e3eed14329d8975a903ad2de94e9c853bb6851de70814b77f6a0", + "literal_function_span_sha256": "12a26f613f67250fb017f3d30e2805ebe112ae9a24b73751eb06f646d0a293e5", + "context_keys_read_in_transitive_local_helpers": [ + "bundle", + "checks", + "circuit", + "state" + ], + "local_helper_dependencies": [ + "_dispatch", + "_has_frame", + "_intended_error", + "_live", + "_need" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "N24", + "checkpoint": "G03", + "helper_lines": [ + 258, + 264 + ], + "public_function_ast_sha256": "80a775a9caee7df7c39158bf95bddcbe0a3a9fa7d8e697b37f422fb0a026ef49", + "literal_function_span_sha256": "7b643255a15e5122ee05e929d091d1286faac501a41d7823c9f079cddc896d7a", + "context_keys_read_in_transitive_local_helpers": [ + "binding", + "cache_module", + "invocation_token", + "state" + ], + "local_helper_dependencies": [ + "_counts", + "_has_frame", + "_intended_error", + "_need", + "_reject" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "P01", + "checkpoint": "G08", + "helper_lines": [ + 268, + 278 + ], + "public_function_ast_sha256": "7d7f4ec8824d4144ce234e12f8a81a52ad20cf901b87c8ccc6d3c1e66ff0f211", + "literal_function_span_sha256": "b26d017ed9346f296822ade55e72422d0495aa5fa39d0cfe84f883bff1ab4033", + "context_keys_read_in_transitive_local_helpers": [ + "bundle", + "checks", + "fresh_active_node", + "fresh_output_S", + "state" + ], + "local_helper_dependencies": [ + "_dispatch", + "_live", + "_need" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "P02", + "checkpoint": "G08", + "helper_lines": [ + 281, + 292 + ], + "public_function_ast_sha256": "6228f17f13accdec4eece1ca8a7cc3b010b6ecd6c638251670f257a235d73d05", + "literal_function_span_sha256": "6a1a9bcdca6ff559feae924316e38d3a60ea4c81c97808c92f377e084f8c2d19", + "context_keys_read_in_transitive_local_helpers": [ + "actual_outputs", + "binding", + "bundle", + "checks", + "circuit", + "code", + "module", + "rank_events", + "reference_native_counters", + "reference_outputs", + "reference_rank_events", + "reference_role_result", + "reference_trace", + "state", + "trace" + ], + "local_helper_dependencies": [ + "_dispatch", + "_live", + "_need" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "P03", + "checkpoint": "G06", + "helper_lines": [ + 295, + 301 + ], + "public_function_ast_sha256": "e495e6d7b82efe05d3eb5c38783f464867a15096f3309591d0a82f0a592326f0", + "literal_function_span_sha256": "b1be0adcd7cbb5f68dbfa0d033979eee68573f7ff1712efe7db8ee4c3d427c47", + "context_keys_read_in_transitive_local_helpers": [ + "authority_module", + "bundle", + "state" + ], + "local_helper_dependencies": [ + "_dispatch", + "_ledger", + "_live", + "_need" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "P04", + "checkpoint": "G08", + "helper_lines": [ + 304, + 309 + ], + "public_function_ast_sha256": "01846a9fd15c17c287083540df126c4a01a081b33ab7a0815247fdba1e2aca73", + "literal_function_span_sha256": "d6fb167724212cba1cac76d5cc86cc384c32efb84de8ff002e3ae3d207bccf0b", + "context_keys_read_in_transitive_local_helpers": [ + "bundle", + "checks", + "literal_expected", + "module", + "state", + "vectors" + ], + "local_helper_dependencies": [ + "_dispatch", + "_live", + "_need" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "P05", + "checkpoint": "G08", + "helper_lines": [ + 312, + 317 + ], + "public_function_ast_sha256": "bd029f2b2b0377c79a0a04e61d18889dc809c61d686937ea2086ccc79270bd7b", + "literal_function_span_sha256": "f026ac732f8fc6e5eb4fe8a5e2aeb95c78f3f4bc6cfc18c5d7c27ca1f71df291", + "context_keys_read_in_transitive_local_helpers": [ + "big", + "bundle", + "checks", + "literal_expected", + "small", + "snapshots_before", + "state" + ], + "local_helper_dependencies": [ + "_dispatch", + "_live", + "_need" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "P06", + "checkpoint": "G08", + "helper_lines": [ + 320, + 327 + ], + "public_function_ast_sha256": "786c44b4b26f5975e6af840921f19161c1efb50ff759f7db20db0b8489e90f4d", + "literal_function_span_sha256": "0d11d8b820aa4f05c52f6c3f0f4abf9b83d69d0bea21bd8d1367645f98da10de", + "context_keys_read_in_transitive_local_helpers": [ + "binding", + "bundle", + "state" + ], + "local_helper_dependencies": [ + "_counts", + "_dispatch", + "_live", + "_need" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "P07", + "checkpoint": "G12", + "helper_lines": [ + 330, + 334 + ], + "public_function_ast_sha256": "7d50646fc8c537a99ae72df7c27e7fa3b6b038ffbf9c6a2bc7b670ba068236f5", + "literal_function_span_sha256": "7d7534a534a7b0224eb733b1609868280878707bd5902dde41ae557d07edb30d", + "context_keys_read_in_transitive_local_helpers": [ + "bundle", + "checks", + "literal_expected", + "reference_remaining_case_count", + "reference_remaining_outputs", + "registered_label", + "remaining_original_case_count", + "remaining_original_outputs", + "site", + "state" + ], + "local_helper_dependencies": [ + "N22", + "_dispatch", + "_live", + "_need" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "P08", + "checkpoint": "G06", + "helper_lines": [ + 337, + 379 + ], + "public_function_ast_sha256": "f2cea31405a6d59129cbf9ebbdfc82761ca4882c5397f845e22440c565f8d271", + "literal_function_span_sha256": "027a3edc5ec688ce1f9cebe7e887d5eb93261de24a8a45016c844d6df58ba51c", + "context_keys_read_in_transitive_local_helpers": [ + "authority_module", + "binding", + "bundle", + "cache_module", + "case_kind", + "case_script_path", + "checks", + "data_module", + "driver_module", + "extensions", + "invocation_token", + "phases", + "state" + ], + "local_helper_dependencies": [ + "_counts", + "_dispatch", + "_has_frame", + "_intended_error", + "_live", + "_need", + "_p08_original_body" + ], + "explicit_variants": [ + { + "case_kind": "original_arm_entry" + }, + { + "case_kind": "original_arm_after_set" + }, + { + "case_kind": "epoch_arm_entry" + }, + { + "case_kind": "body" + } + ], + "selection_status": "P08_BODY_ONLY_IN_CONSTRUCTOR_LANE_PENDING_REVIEW", + "runtime_result": null + }, + { + "id": "V2_ROLE_CLEANUP_ONLY", + "checkpoint": "G06", + "helper_lines": [ + 400, + 415 + ], + "public_function_ast_sha256": "16ce83be0080bcec62d08ca50a4f2d097ed6f4e59d7b2d978ca6ef2e351b4056", + "literal_function_span_sha256": "2b1a9349998d2c8d641b1664dfb5e621af8a92c4ee99a1d2460ae4fc7b02aaa3", + "context_keys_read_in_transitive_local_helpers": [ + "bundle", + "checks", + "circuit", + "state" + ], + "local_helper_dependencies": [ + "_dispatch", + "_has_frame", + "_intended_error", + "_live", + "_need" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "V2_OWNER_FIRST_CAPTURE", + "checkpoint": "G02", + "helper_lines": [ + 447, + 448 + ], + "public_function_ast_sha256": "81b3bc1b9408767b648c6fad73fe0e21fdf5d57bd572a9c4a4e2eee4325a4e69", + "literal_function_span_sha256": "2163c6108a42497c523a4d7bccd57b668e592447904c94d7f2670e0930bfc383", + "context_keys_read_in_transitive_local_helpers": [ + "authority_module", + "binding", + "bundle", + "comparison", + "data_module", + "extensions", + "factory_context", + "load_ticket", + "module", + "state" + ], + "local_helper_dependencies": [ + "_counts", + "_has_frame", + "_intended_error", + "_need", + "_owner_failure_case" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "V2_OWNER_LATE_GRAPH", + "checkpoint": "G02", + "helper_lines": [ + 451, + 452 + ], + "public_function_ast_sha256": "7a6eebc50ca18afe5f13e7c0e8aa6a396a0c66e680bcde154da10ba60a3953d4", + "literal_function_span_sha256": "9326052567b4d4af70e1b60ef638abddc9660302d1218f710f8bf00749bfd018", + "context_keys_read_in_transitive_local_helpers": [ + "authority_module", + "binding", + "bundle", + "comparison", + "data_module", + "extensions", + "factory_context", + "load_ticket", + "module", + "state" + ], + "local_helper_dependencies": [ + "_counts", + "_has_frame", + "_intended_error", + "_need", + "_owner_failure_case" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "V2_ORIGIN_FIRST_ALL_ROUTES", + "checkpoint": "G03", + "helper_lines": [ + 455, + 475 + ], + "public_function_ast_sha256": "aaee460e87d8f504f8ef9f9931ff5bc8d54c62c75c104a4a13adffdea49f6c96", + "literal_function_span_sha256": "fcb9c7f970484f632a80044743b34c9d983ce5e40936aa2be699f91ec59a2349", + "context_keys_read_in_transitive_local_helpers": [ + "authority_module", + "binding", + "bundle", + "route_index", + "state" + ], + "local_helper_dependencies": [ + "_counts", + "_dispatch", + "_has_frame", + "_intended_error", + "_ledger", + "_live", + "_need" + ], + "explicit_variants": [ + { + "route_index": 1 + }, + { + "route_index": 2 + }, + { + "route_index": 3 + }, + { + "route_index": 4 + }, + { + "route_index": 5 + }, + { + "route_index": 6 + } + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "V3_INSTANCE_KEY_DOMAIN", + "checkpoint": "G03", + "helper_lines": [ + 511, + 531 + ], + "public_function_ast_sha256": "b4a9342e721766c6b453e17cd827bd46c5dd2582ba456f16672eed3186d5fa78", + "literal_function_span_sha256": "9e333aeef7b3fd90f565af51d65aff8dc53317fc913ac09353c721464223a087", + "context_keys_read_in_transitive_local_helpers": [ + "authority_module", + "bundle", + "state" + ], + "local_helper_dependencies": [ + "_dispatch", + "_has_frame", + "_intended_error", + "_ledger", + "_live", + "_need" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "V3_FIXED_RECORD_BINDINGS", + "checkpoint": "G03", + "helper_lines": [ + 534, + 547 + ], + "public_function_ast_sha256": "7729af17a66cf957dead40d805e9d21811ba461d6b66a45c676a461ba96670a9", + "literal_function_span_sha256": "f7c91c279d9be523477bba7243c2037bf2b21066ea3430d58f01992df798a495", + "context_keys_read_in_transitive_local_helpers": [ + "authority_module", + "bundle", + "fixed_record_field", + "state" + ], + "local_helper_dependencies": [ + "_dispatch", + "_has_frame", + "_intended_error", + "_ledger", + "_live", + "_need" + ], + "explicit_variants": [ + { + "fixed_record_field": "class_origin" + }, + { + "fixed_record_field": "method_origin" + } + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "V3_INSTANCE_METHOD_SHADOW", + "checkpoint": "G03", + "helper_lines": [ + 553, + 568 + ], + "public_function_ast_sha256": "fdfff329e0dd280806ba9d2af44a13a29882718ee8888f8d5e567a61517535f6", + "literal_function_span_sha256": "d43986e9ce008e98e2c0a13758522ee9b45318ad48d7baed842b82c6d38406d8", + "context_keys_read_in_transitive_local_helpers": [ + "authority_module", + "bundle", + "state" + ], + "local_helper_dependencies": [ + "_dispatch", + "_has_frame", + "_intended_error", + "_ledger", + "_live", + "_need" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "V3_INSTANCE_STATE_SCHEMA", + "checkpoint": "G03", + "helper_lines": [ + 571, + 591 + ], + "public_function_ast_sha256": "f200bb51c2803399225fa1dfac2e04ca2d48294c43d167da442e9c2ca89ad503", + "literal_function_span_sha256": "d62ec22965531f8e29af1c622e7da50049b0914820e5985d05387382d61f69f9", + "context_keys_read_in_transitive_local_helpers": [ + "authority_module", + "bundle", + "state", + "state_schema_field" + ], + "local_helper_dependencies": [ + "_dispatch", + "_has_frame", + "_intended_error", + "_ledger", + "_live", + "_need" + ], + "explicit_variants": [ + { + "state_schema_field": "phase" + }, + { + "state_schema_field": "serial" + }, + { + "state_schema_field": "failure" + } + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "V3_CLI_DISARM_ONLY", + "checkpoint": "G07", + "helper_lines": [ + 640, + 640 + ], + "public_function_ast_sha256": "0735aff85e14a2eec4c489169ffb5462ab8d9cfb6d11fb9a4ef653b941236e67", + "literal_function_span_sha256": "cfa63d5af26c7a752bcfed8c8e0740e320aac12d020dd2eaac9bea28b22e45b6", + "context_keys_read_in_transitive_local_helpers": [ + "authority_module", + "cache_module", + "case_script_path", + "checks", + "driver_module", + "extensions", + "phases", + "state" + ], + "local_helper_dependencies": [ + "_has_frame", + "_intended_error", + "_need", + "_v3_baseline_cli_case" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "V3_CLI_BODY_DISARM", + "checkpoint": "G07", + "helper_lines": [ + 641, + 641 + ], + "public_function_ast_sha256": "8ba3c40fe519bdb2e28b326af5d9b61b387b9ad9a77cbacabba3718adf46fa84", + "literal_function_span_sha256": "63d1ed6413137e9cfa2e39263945175f1301a54ac451f74a384fbe7e742d48d7", + "context_keys_read_in_transitive_local_helpers": [ + "authority_module", + "cache_module", + "case_script_path", + "checks", + "driver_module", + "extensions", + "phases", + "state" + ], + "local_helper_dependencies": [ + "_has_frame", + "_intended_error", + "_need", + "_v3_baseline_cli_case" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "V3_CLI_BODY_DISARM_RETIREMENT", + "checkpoint": "G07", + "helper_lines": [ + 642, + 642 + ], + "public_function_ast_sha256": "69a2509a94424a57b372edd6f94a05ea5a0a6e3c50e1e7eee818ce2b9109446a", + "literal_function_span_sha256": "384106a37f459f3ec937dee3f82c7fb78137eb679f0b3afdb3d84fcfe466ff04", + "context_keys_read_in_transitive_local_helpers": [ + "authority_module", + "cache_module", + "case_script_path", + "checks", + "driver_module", + "extensions", + "phases", + "state" + ], + "local_helper_dependencies": [ + "_has_frame", + "_intended_error", + "_need", + "_v3_baseline_cli_case" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "V4_ARGV_ONLY", + "checkpoint": "G07", + "helper_lines": [ + 704, + 704 + ], + "public_function_ast_sha256": "4f82c693ba7483d7f3a4c5ee6b67d023f3decbc9ac054f63c765eb487de111db", + "literal_function_span_sha256": "fb105b6fd39ade5ddc6c0d496bdc628247cd7d2efda7f3857ccbab848289c4dd", + "context_keys_read_in_transitive_local_helpers": [ + "authority_module", + "cache_module", + "case_script_path", + "checks", + "driver_module", + "extensions", + "phases", + "state" + ], + "local_helper_dependencies": [ + "_has_frame", + "_intended_error", + "_need", + "_v4_images", + "_v4_restore_case" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "V4_BODY_ARGV_DISARM_RETIREMENT", + "checkpoint": "G07", + "helper_lines": [ + 705, + 705 + ], + "public_function_ast_sha256": "ba8d369e1583979a1f7183f95a744bb71e71a876d40b3ea044790574e5a6d7d0", + "literal_function_span_sha256": "94bf8b30235e6371071e10523d65dbfa347da4cf3580e015cc68a9f29e77ba86", + "context_keys_read_in_transitive_local_helpers": [ + "authority_module", + "cache_module", + "case_script_path", + "checks", + "driver_module", + "extensions", + "phases", + "state" + ], + "local_helper_dependencies": [ + "_has_frame", + "_intended_error", + "_need", + "_v4_images", + "_v4_restore_case" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "V4_ARGV_DISARM_RETIREMENT", + "checkpoint": "G07", + "helper_lines": [ + 706, + 706 + ], + "public_function_ast_sha256": "e1811b3714c5b97f16b1d9c59a712a44d375ba708435bde5c385879ead2e336d", + "literal_function_span_sha256": "8db7463e84a7cbaf281c6b32ed8000d0a57fef7b12d23f8473b7efd92bbbb2a8", + "context_keys_read_in_transitive_local_helpers": [ + "authority_module", + "cache_module", + "case_script_path", + "checks", + "driver_module", + "extensions", + "phases", + "state" + ], + "local_helper_dependencies": [ + "_has_frame", + "_intended_error", + "_need", + "_v4_images", + "_v4_restore_case" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "V4_ARGV_BEFORE_DISARM_RETIREMENT", + "checkpoint": "G07", + "helper_lines": [ + 707, + 707 + ], + "public_function_ast_sha256": "dc86a26df5619f966d60823032183b48b5c017f3d5a2f41f2021e1c9e7e738cc", + "literal_function_span_sha256": "55b86cb8e42e484ec6730624cd3d0c787320bd90c0201f812299f6819a1beedd", + "context_keys_read_in_transitive_local_helpers": [ + "authority_module", + "cache_module", + "case_script_path", + "checks", + "driver_module", + "extensions", + "phases", + "state" + ], + "local_helper_dependencies": [ + "_has_frame", + "_intended_error", + "_need", + "_v4_images", + "_v4_restore_case" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "V4_ROLE_RAW_JOURNAL", + "checkpoint": "G06", + "helper_lines": [ + 725, + 732 + ], + "public_function_ast_sha256": "7f079e7491eb0ef771f810162ed685b9586de6bc8271841c96bb8a211b61df87", + "literal_function_span_sha256": "34678fcc51ad1f075d61a8372f2746099c756c8b7bd0b56a25ee1e0e2431ade6", + "context_keys_read_in_transitive_local_helpers": [ + "authority_module", + "bundle", + "cache_module", + "checks", + "circuit", + "driver_module", + "state" + ], + "local_helper_dependencies": [ + "_dispatch", + "_has_frame", + "_intended_error", + "_live", + "_need", + "_v4_images", + "_v4_raw_channel_oracle" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "V4_CLI_RAW_JOURNAL", + "checkpoint": "G06", + "helper_lines": [ + 735, + 750 + ], + "public_function_ast_sha256": "27674ae1876ac3d8ddc1f2f5860dc928892d6d7882e7846cd8d41637448cae19", + "literal_function_span_sha256": "fbb2c12fdaa741df7b1f64a008d948062932a4f9065dad089bd32625b7d7a6dd", + "context_keys_read_in_transitive_local_helpers": [ + "authority_module", + "binding", + "bundle", + "cache_module", + "case_script_path", + "driver_module", + "extensions", + "invocation_token", + "phases", + "state" + ], + "local_helper_dependencies": [ + "_counts", + "_dispatch", + "_has_frame", + "_intended_error", + "_live", + "_need", + "_v4_images", + "_v4_raw_channel_oracle" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + }, + { + "id": "V5_MAIN_PRIMARY_OUTER", + "checkpoint": "G13", + "helper_lines": [ + 842, + 842 + ], + "public_function_ast_sha256": "2678ead2e237095afcd98677eb36787ee73faa6ed645348c48ec6c9595a6e91b", + "literal_function_span_sha256": "5b68dcdb3b142ed87b7d6e43390349958aace9f2b74d101f03cbdfa8e0d6d265", + "context_keys_read_in_transitive_local_helpers": [ + "argv", + "authority_module", + "cache_module", + "driver_module" + ], + "local_helper_dependencies": [ + "_has_frame", + "_intended_error", + "_need", + "_v5_images", + "_v5_main_stop" + ], + "explicit_variants": [ + {} + ], + "selection_status": "EXISTING_FINITE_FACTORY_SOURCE", + "runtime_result": null + }, + { + "id": "V5_MAIN_CLEANUP_ONLY", + "checkpoint": "G13", + "helper_lines": [ + 843, + 843 + ], + "public_function_ast_sha256": "0695e3f010d12e74ed707faef2141968ac713ea645e71209ea59f84bef321709", + "literal_function_span_sha256": "99a7970022e6240519c3f2ba8d37f78ab77ed18b5f6c45ce8d20cbb7cf137ef1", + "context_keys_read_in_transitive_local_helpers": [ + "argv", + "authority_module", + "cache_module", + "driver_module" + ], + "local_helper_dependencies": [ + "_has_frame", + "_intended_error", + "_need", + "_v5_images", + "_v5_main_stop" + ], + "explicit_variants": [ + {} + ], + "selection_status": "EXISTING_FINITE_FACTORY_SOURCE", + "runtime_result": null + }, + { + "id": "V5_MAIN_ABSENT_RECORD", + "checkpoint": "G13", + "helper_lines": [ + 844, + 844 + ], + "public_function_ast_sha256": "1511fb1817b66da082c3896af9da64eb2ee87acfd028d7ee9c62a625aa129a87", + "literal_function_span_sha256": "3fffe19dd207cf205221e659139f9a3afdc59af6a5fc8e7396427368687e2331", + "context_keys_read_in_transitive_local_helpers": [ + "argv", + "authority_module", + "cache_module", + "driver_module" + ], + "local_helper_dependencies": [ + "_has_frame", + "_intended_error", + "_need", + "_v5_images", + "_v5_main_stop" + ], + "explicit_variants": [ + {} + ], + "selection_status": "SOURCE_RECIPE_ONLY_NO_CONSTRUCTED_SELECTOR", + "runtime_result": null + } + ], + "minimum_explicit_selection_inventory": [ + { + "case_id": "N01", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G01" + }, + { + "case_id": "N02", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G02" + }, + { + "case_id": "N03", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G03" + }, + { + "case_id": "N04", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G03" + }, + { + "case_id": "N05", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G03" + }, + { + "case_id": "N06", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G03" + }, + { + "case_id": "N07", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G03" + }, + { + "case_id": "N08", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G03" + }, + { + "case_id": "N09", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G03" + }, + { + "case_id": "N10", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G05" + }, + { + "case_id": "N11", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G04" + }, + { + "case_id": "N12", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G08" + }, + { + "case_id": "N13", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G10" + }, + { + "case_id": "N14", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G11" + }, + { + "case_id": "N15", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G11" + }, + { + "case_id": "N16", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G08" + }, + { + "case_id": "N17", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G10" + }, + { + "case_id": "N18", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G03" + }, + { + "case_id": "N19", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G08" + }, + { + "case_id": "N20", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G09" + }, + { + "case_id": "N21", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G08" + }, + { + "case_id": "N22", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G12" + }, + { + "case_id": "N23", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G06" + }, + { + "case_id": "N24", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G03" + }, + { + "case_id": "P01", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G08" + }, + { + "case_id": "P02", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G08" + }, + { + "case_id": "P03", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G06" + }, + { + "case_id": "P04", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G08" + }, + { + "case_id": "P05", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G08" + }, + { + "case_id": "P06", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G08" + }, + { + "case_id": "P07", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G12" + }, + { + "case_id": "P08", + "variant": { + "case_kind": "original_arm_entry" + }, + "fresh_genuine_generation": true, + "checkpoint": "G06" + }, + { + "case_id": "P08", + "variant": { + "case_kind": "original_arm_after_set" + }, + "fresh_genuine_generation": true, + "checkpoint": "G06" + }, + { + "case_id": "P08", + "variant": { + "case_kind": "epoch_arm_entry" + }, + "fresh_genuine_generation": true, + "checkpoint": "G06" + }, + { + "case_id": "P08", + "variant": { + "case_kind": "body" + }, + "fresh_genuine_generation": true, + "checkpoint": "G06" + }, + { + "case_id": "V2_ROLE_CLEANUP_ONLY", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G06" + }, + { + "case_id": "V2_OWNER_FIRST_CAPTURE", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G02" + }, + { + "case_id": "V2_OWNER_LATE_GRAPH", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G02" + }, + { + "case_id": "V2_ORIGIN_FIRST_ALL_ROUTES", + "variant": { + "route_index": 1 + }, + "fresh_genuine_generation": true, + "checkpoint": "G03" + }, + { + "case_id": "V2_ORIGIN_FIRST_ALL_ROUTES", + "variant": { + "route_index": 2 + }, + "fresh_genuine_generation": true, + "checkpoint": "G03" + }, + { + "case_id": "V2_ORIGIN_FIRST_ALL_ROUTES", + "variant": { + "route_index": 3 + }, + "fresh_genuine_generation": true, + "checkpoint": "G03" + }, + { + "case_id": "V2_ORIGIN_FIRST_ALL_ROUTES", + "variant": { + "route_index": 4 + }, + "fresh_genuine_generation": true, + "checkpoint": "G03" + }, + { + "case_id": "V2_ORIGIN_FIRST_ALL_ROUTES", + "variant": { + "route_index": 5 + }, + "fresh_genuine_generation": true, + "checkpoint": "G03" + }, + { + "case_id": "V2_ORIGIN_FIRST_ALL_ROUTES", + "variant": { + "route_index": 6 + }, + "fresh_genuine_generation": true, + "checkpoint": "G03" + }, + { + "case_id": "V3_INSTANCE_KEY_DOMAIN", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G03" + }, + { + "case_id": "V3_FIXED_RECORD_BINDINGS", + "variant": { + "fixed_record_field": "class_origin" + }, + "fresh_genuine_generation": true, + "checkpoint": "G03" + }, + { + "case_id": "V3_FIXED_RECORD_BINDINGS", + "variant": { + "fixed_record_field": "method_origin" + }, + "fresh_genuine_generation": true, + "checkpoint": "G03" + }, + { + "case_id": "V3_INSTANCE_METHOD_SHADOW", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G03" + }, + { + "case_id": "V3_INSTANCE_STATE_SCHEMA", + "variant": { + "state_schema_field": "phase" + }, + "fresh_genuine_generation": true, + "checkpoint": "G03" + }, + { + "case_id": "V3_INSTANCE_STATE_SCHEMA", + "variant": { + "state_schema_field": "serial" + }, + "fresh_genuine_generation": true, + "checkpoint": "G03" + }, + { + "case_id": "V3_INSTANCE_STATE_SCHEMA", + "variant": { + "state_schema_field": "failure" + }, + "fresh_genuine_generation": true, + "checkpoint": "G03" + }, + { + "case_id": "V3_CLI_DISARM_ONLY", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G07" + }, + { + "case_id": "V3_CLI_BODY_DISARM", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G07" + }, + { + "case_id": "V3_CLI_BODY_DISARM_RETIREMENT", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G07" + }, + { + "case_id": "V4_ARGV_ONLY", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G07" + }, + { + "case_id": "V4_BODY_ARGV_DISARM_RETIREMENT", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G07" + }, + { + "case_id": "V4_ARGV_DISARM_RETIREMENT", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G07" + }, + { + "case_id": "V4_ARGV_BEFORE_DISARM_RETIREMENT", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G07" + }, + { + "case_id": "V4_ROLE_RAW_JOURNAL", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G06" + }, + { + "case_id": "V4_CLI_RAW_JOURNAL", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G06" + }, + { + "case_id": "V5_MAIN_PRIMARY_OUTER", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G13" + }, + { + "case_id": "V5_MAIN_CLEANUP_ONLY", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G13" + }, + { + "case_id": "V5_MAIN_ABSENT_RECORD", + "variant": {}, + "fresh_genuine_generation": true, + "checkpoint": "G13" + } + ], + "critical_context_invariants": [ + "P01/private family requires Checks construction after genuine arm so C1 is registered; P08 prearm constructor leaves registry empty by source2085/2108 and is not reusable.", + "N12 requires genuine active arm before wrong-site test2087; unarmed construct2085 returns original Label and bypasses this intended predicate.", + "N18 executes actual retire then arm and must retain retired/consumed error. N24 retains actual fresh unconsumed FULLNone source and exact FULLNone error. No global FULL install.", + "Source guard/refusal body requires exact intended checkpoint, not an earlier FULL/phase failure that happens to raise.", + "Original phase wrapper installed on Checks.verify_labels must be authenticated through genuine returned(original,observed) pair and underlying labels product; pair repair remains conditional on independent derivative acceptance.", + "Mode claims are route-specific: actual armed private/full/P08body/absent-record require optimize0; full-O refusal is separate; finite/public/source guards need their own genuine admitted finite selection.", + "Reference values come from independent unchanged original sources and separate objects, no cache candidate state/receipts or approved boolean." + ], + "construction_decisions": { + "straightforward_fixed_source_selectors": [ + "G01", + "G02", + "G03", + "G04", + "G05", + "G06 except P08 derivative acceptance", + "G07", + "G09", + "G13 finite existing and full absent selector after contract binding" + ], + "source_authorable_but_needs_exact_new_capture_or_fixture": [ + "G08 fresh postarm genuine constructors plus independent oracle transport", + "G10 exact request-lifetime ports with no state reset", + "G11 pending port and fixed original store-failure fixture" + ], + "not_currently_supplied_genuine_prerequisite": [ + "G12 actual85196 constructor/store reachability fixture with admissible original input and independent remaining-work oracle" + ], + "not_impossibility_claim": "The G12 gap is an unprovided source construction, not proof that it is impossible or too expensive. No runtime experiment is needed or authorized to claim it source-complete.", + "earliest_missing_oracle_binding": "Public literal arithmetic is available in ORIGINAL_CIRCUIT296-311 and UNCACHED_CONTROLS105-106/248-268. The first full-caller oracle binding is P02 reference_role_result/rank_events/trace/native_counters/outputs from a fresh original baseline run; those producers exist, but exact same-input typed transport into the new selected candidate context is not yet source-bound. P07 additionally lacks the exact capacity-prefix/remainder selection." + }, + "oracle_recipe": { + "public": "Use original backend-owned load_source to create distinct original reference module and objects; construct reference ComplexSideCircuit/Checks and Label objects independently. For each ordinary comparison supply a fresh exact reference verdict dict and invoke unchanged original method. Candidate operands or snapshots never supply expected answers. Preserve independent callback classes/event logs and exact type/order.", + "full": "Use separate fresh original baseline complete caller with same exact input/argv/source pins; preserve original labels, roles, rank events, complement trace, native counters and outputs as typed observations. Bind corresponding candidate fields without copying candidate state. No observed values are invented in this source-only packet.", + "legacy": "N20 reuses unchanged original run_controls and its own authentic arguments and captures; no reimplementation or skip of its155 obligation." + }, + "other_lane_ownership": { + "contracts": "/root/strict60_astra_controls owns FULL/EPOCH native owner/caller/cost definitions and role IDs", + "constructor": "/root/strict60_astra_execution_cache owns actual P08 constructor/driver and phase-pair correction", + "independent": "/root/strict60_astra_independent owns source acceptance; this matrix does not approve itself" + }, + "preservation": { + "original52_bodies_edited": 0, + "target_imports": 0, + "target_executions": 0, + "native_compiler_decoder_scientific_work": 0, + "protected_bookkeeping_runs_read_or_enumerated": false, + "writes_only_coverage_directory": true, + "no_subagents": true, + "wider_crosswalk_used_for_case_expansion": false, + "new_progress_credit": 0 + } +} diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/FREEZE-v1.json b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/FREEZE-v1.json new file mode 100644 index 0000000000..b2f9027a0d --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/FREEZE-v1.json @@ -0,0 +1,60 @@ +{ + "execution_or_adoption": false, + "files": { + "SOURCE-BOUNDARY-v1.json": { + "bytes": 3781, + "mode": "0444", + "sha256": "dc68dbe9b72599f6fa7cb95a21ed8ef91037abfbf09dcabf5cea9c1136001495" + }, + "SOURCE-INVERSE-v1.json": { + "bytes": 8491, + "mode": "0444", + "sha256": "083d171828102a8c138810d05f9110fc6136c2017a09ab11d8d63c433afd387e" + }, + "g12_cache_selector_source_v1.py": { + "bytes": 1537, + "mode": "0444", + "sha256": "a9b4019ce368b6f89553ceb98c5451593d0d11ebda699dcb626cab323297375c" + }, + "g12_candidate_driver_N22_v1.py": { + "bytes": 126735, + "mode": "0444", + "sha256": "46f515efa7ebdc60e20b64ef2ebdfb542ecb8c90371d339a951ccabb2a205e09" + }, + "g12_candidate_driver_P07_v1.py": { + "bytes": 126735, + "mode": "0444", + "sha256": "e6f1038f5a75466d95fd3e8c3d44df483d76f97deff9f966bd6140b2d0bc28a7" + }, + "g12_candidate_driver_support_N22_v1.py": { + "bytes": 31921, + "mode": "0444", + "sha256": "b4a8ec11d4b390d8a8f7167d8149b067be0572f977a1f2286c1719052437fccb" + }, + "g12_candidate_driver_support_P07_v1.py": { + "bytes": 31921, + "mode": "0444", + "sha256": "a918ff01875267c4945a0dbc6d914a904c3eb38b9f5de8256bdc47394b19dcb7" + }, + "g12_common_source_v1.py": { + "bytes": 4517, + "mode": "0444", + "sha256": "8ac6902915ec8afb09914fc5f229e175d864e6aae9fe367f127e1bbd654ed42a" + }, + "g12_epoch_authority_selector_v1.py": { + "bytes": 137642, + "mode": "0444", + "sha256": "65b3d33068b0549ddb4a9e7e18a9912bebad69c309a8a29ae4fd532e9f428211" + }, + "g12_epoch_cache_selector_v1.py": { + "bytes": 172718, + "mode": "0444", + "sha256": "20a8a94e96bfa6213d4f04244dabecf059b4c8c7e8ffa7e9409a8b87cfeef494" + } + }, + "reference_handoff": null, + "schema": "g12-fixed-candidate-protocol-freeze-v1", + "status": "FROZEN_SOURCE_ONLY_TRANSPORT_CLOSED_PENDING_INDEPENDENT_REVIEW", + "target_operations": 0, + "transport_source_pin": null +} diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/g12_epoch_authority_selector_v1.py.txt b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/g12_epoch_authority_selector_v1.py.txt new file mode 100644 index 0000000000..6ff0f5a072 --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/g12_epoch_authority_selector_v1.py.txt @@ -0,0 +1,2431 @@ +"""Separate V7 cold authority; SOURCE ONLY until the parent's execution gate. + +Raw-load before any candidate exposure. All later checking routines are private +closures over the original primitive/stdlib token. They never dispatch through +a mutable public validator before authenticating it. No native code lives here. +""" +import _ast +import ast +import builtins +import copy +import copyreg +import genericpath +import hashlib +import io +import ntpath +import os +import pathlib +import posixpath +import sys +import types + +SOURCE_REVIEW_GATE = None +EXECUTION_GATE = None +NATIVE_GATE = None +FULL_FUNDING_GATE = None +ROOT_SHA256 = 'f5a2d33f2b4d3651f214156a0e7094c2bb516ce2d5ab7698d18c11f98f35dee0' +PROVIDER_SHA256 = '9cbb7368f89e71d1e6cc46db5dc77efed3e03ed2a801c98c88fe316e4d9f3ef2' +BACKEND_SHA256 = 'e473c38245c3668715b5a78dfe980b2fe3ed0d0c9b8c97c666fbae6ecf1fffd5' +CACHE_PRODUCER_SHA256 = '133c55e269b354542f86a2a1099f48cff052293d06da310f98b7cb33cb85258f' +_CAPTURE_ONCE = [] + + +def capture_authority(root, capability, api): + """Return load/invoke/check/runtime_guard/check_product/set_guard/source. + + The trusted parent calls this entry once immediately after raw source exec. + A later backend instance derives provenance from this original token; it + cannot substitute a newly captured stdlib or a self-reported class record. + """ + if _CAPTURE_ONCE: + raise RuntimeError('Cold authority can only be captured once before exposure') + _CAPTURE_ONCE.append(True) + type0, id0, len0, next0, tuple0, list0 = type, id, len, next, tuple, list + dict0, str0, bytes0, object0, int0 = dict, str, bytes, object, int + error0, base_error0, value_error0 = RuntimeError, BaseException, ValueError + function_type, module_type, code_type = types.FunctionType, types.ModuleType, types.CodeType + builtin_type, cell_type = types.BuiltinFunctionType, types.CellType + static_type, class_type, property_type = staticmethod, classmethod, property + dict_get, dict_items, dict_iter = dict.get, dict.items, dict.__iter__ + dict_len, dict_set, dict_del, dict_clear = dict.__len__, dict.__setitem__, dict.__delitem__, dict.clear + object_get = object.__getattribute__ + type_get = type.__getattribute__ + module_dict_get = module_type.__dict__['__dict__'].__get__ + class_dict_get = type.__dict__['__dict__'].__get__ + class_mro_get = type.__dict__['__mro__'].__get__ + cell_get = cell_type.__dict__['cell_contents'].__get__ + function_fields = tuple((name, function_type.__dict__[name].__get__) for name in + ('__code__', '__globals__', '__builtins__', '__defaults__', + '__kwdefaults__', '__closure__', '__dict__')) + proxy_type = type(type.__dict__) + proxy_get, proxy_iter, proxy_items, proxy_len = proxy_type.get, proxy_type.__iter__, proxy_type.items, proxy_type.__len__ + builtin_self_get = builtin_type.__dict__['__self__'].__get__ + builtin_namespace = builtins.__dict__ + missing = object0() + missing_id = id0(missing) + initial_sys_modules = sys.modules + initial_sys_flags = sys.flags + initial_optimize = sys.flags.optimize + sys_owner = sys + sys_namespace = module_dict_get(sys_owner, module_type) + authority_namespace = globals() + root_pin, provider_pin, backend_pin = ROOT_SHA256, PROVIDER_SHA256, BACKEND_SHA256 + cache_pin = CACHE_PRODUCER_SHA256 + max_source, max_functions, max_classes = 1048576, 8192, 2048 + registry, by_namespace, products, backend_guards = {}, {}, {}, {} + transitions = [] + initial_std_modules = (_ast, ast, copy, copyreg, genericpath, hashlib, io, + ntpath, os, pathlib, posixpath, types) + producer_rules = ( + ('320435ec4125544f2b2aedf74f21469b232d08683fe76f0913607516254bbd29', 'make_runtime_guard', 'backend_guard'), + ('f7ca7f4f03ac63c1a95ba42f06149543211566de5e29f487a3dc4d08c5ee9b94', 'extra_guard_type', 'extra_guard'), + ('4bdb401271ffd049c52eff0edc28d8d604a11faf66fec419555a82cbd3b32d60', 'make_trace_type', 'trace'), + ('364b45c100be73a7ace44ab664f3c792020dad6f33f7788b62aaeab67c0c5aa9', 'make_row_interner', 'row_function'), + ('364b45c100be73a7ace44ab664f3c792020dad6f33f7788b62aaeab67c0c5aa9', 'make_runtime_guard', 'row_guard'), + ('364b45c100be73a7ace44ab664f3c792020dad6f33f7788b62aaeab67c0c5aa9', 'make_cache_runtime_guard', 'row_guard'), + ('5aeee9364d29147ef4e1bfffba532f7392833a6158d73d1da50ed6c772f061af', 'derive_row_bind', 'row_bind'), + (cache_pin, 'compose_runtime_guard', 'cache_guard')) + + def need(ok, message): + if not ok: + raise error0(message) + + def string_domain(owner, domains): + key = iterator = kind = None + try: + identity = id0(owner) + prior = dict_get(domains, identity, missing) + if prior is not missing: + return prior + kind = type0(owner) + if kind is dict0: + iterator = dict_iter(owner) + elif kind is proxy_type: + iterator = proxy_iter(owner) + else: + return False + while True: + key = next0(iterator, missing) + if key is missing: + break + if type0(key) is not str0: + dict_set(domains, identity, False) + return False + key = None + dict_set(domains, identity, True) + return True + finally: + key = iterator = kind = owner = None + + def get_id(owner, name, domains): + try: + if type0(name) is not str0 or not string_domain(owner, domains): + return -1 + if type0(owner) is dict0: + return id0(dict_get(owner, name, missing)) + return id0(proxy_get(owner, name, missing)) + finally: + owner = None + + def identity_mapping(owner, expected): + """Non-string dispatch dictionaries: identity scan, never key equality.""" + iterator = pair = key = value = None + try: + if type0(owner) is not dict0 or dict_len(owner) != len0(expected): + return False + iterator = iter0(dict_items(owner)) + while True: + pair = next0(iterator, missing) + if pair is missing: + break + key, value = pair + found = False + for old_key, old_value in expected: + if key is old_key: + if value is not old_value: + return False + found = True + break + if not found: + return False + pair = key = value = None + return True + finally: + iterator = pair = key = value = owner = None + + iter0 = iter + + def code_names(code): + pending, result, seen = [code], [], {} + while pending: + current = pending.pop() + need(type0(current) is code_type, 'Cold authority code shape differs') + for name in current.co_names: + need(type0(name) is str0, 'Cold authority code name shape differs') + if dict_get(seen, name, missing) is missing: + dict_set(seen, name, True) + result.append(name) + for value in current.co_consts: + if type0(value) is code_type: + pending.append(value) + return tuple0(result) + + def raw_function_record(function): + need(type0(function) is function_type, 'Cold authority requires exact functions') + values = tuple0(getter(function, function_type) for _, getter in function_fields) + code, namespace, builtins_owner, defaults, keywords, closure, attributes = values + domains = {} + try: + need(type0(namespace) is dict0 and type0(builtins_owner) is dict0 and + string_domain(namespace, domains) and string_domain(builtins_owner, domains), + 'Cold authority initial function dictionary domain differs') + keyword_items = () + if keywords is not None: + need(type0(keywords) is dict0 and string_domain(keywords, domains), + 'Cold authority initial keyword defaults differ') + keyword_items = tuple0(dict_items(keywords)) + cells = () if closure is None else tuple0((cell, cell_get(cell, cell_type)) for cell in closure) + lookups = tuple0((name, dict_get(namespace, name, missing), dict_get(builtins_owner, name, missing)) + for name in code_names(code)) + need(type0(attributes) is dict0 and string_domain(attributes, domains), + 'Cold authority function attribute dictionary differs') + return (function, values, keyword_items, cells, lookups, tuple0(dict_items(attributes))) + finally: + dict_clear(domains) + + def capture_graph(initial_functions, initial_classes): + """Called only at initial source load or directly after an admitted producer.""" + functions, classes, seen_functions, seen_classes = [], [], {}, {} + pending_functions, pending_classes = list0(initial_functions), list0(initial_classes) + while pending_functions or pending_classes: + while pending_classes: + cls = pending_classes.pop() + need(type0(cls) is type0, 'Cold authority class metaclass differs') + if dict_get(seen_classes, id0(cls), missing) is not missing: + continue + need(len0(classes) < max_classes, 'Cold authority class census exceeds bound') + dict_set(seen_classes, id0(cls), cls) + mro = class_mro_get(cls, type0) + proxy = class_dict_get(cls, type0) + members = tuple0(proxy_items(proxy)) + classes.append((cls, mro, proxy, members)) + for base in mro[1:]: + if type0(base) is type0: + pending_classes.append(base) + for name, value in members: + need(type0(name) is str0, 'Cold authority class member name differs') + kind = type0(value) + if kind is function_type: + pending_functions.append(value) + elif kind is static_type or kind is class_type: + underlying = object_get(value, '__func__') + if type0(underlying) is function_type: + pending_functions.append(underlying) + elif kind is property_type: + for field in ('fget', 'fset', 'fdel'): + underlying = object_get(value, field) + if type0(underlying) is function_type: + pending_functions.append(underlying) + if pending_functions: + function = pending_functions.pop() + if dict_get(seen_functions, id0(function), missing) is not missing: + continue + need(len0(functions) < max_functions, 'Cold authority function census exceeds bound') + record = raw_function_record(function) + dict_set(seen_functions, id0(function), function) + functions.append(record) + for cell, value in record[3]: + if type0(value) is function_type: + pending_functions.append(value) + defaults = record[1][3] + if defaults is not None: + need(type0(defaults) is tuple0, 'Cold authority positional defaults shape differs') + for value in defaults: + if type0(value) is function_type: + pending_functions.append(value) + for name, value in record[2] + record[5]: + if type0(value) is function_type: + pending_functions.append(value) + # Source-owned function helpers reached through effective globals + # are authenticated transitively, including validator helpers. + for name, value, builtin_value in record[4]: + if type0(value) is function_type: + pending_functions.append(value) + return (tuple0(functions), tuple0(classes)) + + def expected_global(namespace, name, expected): + if name != 'RuntimeGuard': + return expected + record = dict_get(by_namespace, id0(namespace), missing) + if record is not missing and record[2] is namespace and record[12] == 'backend': + return dict_get(backend_guards, id0(record[0]), missing) + return expected + + def fresh_function(record, domains, builtin_values): + function, values, keyword_items, cells, lookups, attributes_items = record + if type0(function) is not function_type: + return False + field_key = ('function-fields', id0(function)) + observed_fields = dict_get(domains, field_key, missing) + if observed_fields is missing: + scalar_fields = [] + for (_, getter), expected in zip0(function_fields, values): + observed_id = id0(getter(function, function_type)) + if observed_id != id0(expected): + return False + scalar_fields.append(observed_id) + dict_set(domains, field_key, tuple0(scalar_fields)) + else: + if len0(observed_fields) != len0(values): + return False + for observed_id, expected in zip0(observed_fields, values): + if observed_id != id0(expected): + return False + code, namespace, builtins_owner, defaults, keywords, closure, attributes = values + if keywords is not None: + if type0(keywords) is not dict0 or dict_len(keywords) != len0(keyword_items): + return False + for name, expected in keyword_items: + if get_id(keywords, name, domains) != id0(expected): + return False + for cell, expected in cells: + try: + if id0(cell_get(cell, cell_type)) != id0(expected): + return False + except value_error0: + return False + if dict_len(attributes) != len0(attributes_items): + return False + for name, expected in attributes_items: + if get_id(attributes, name, domains) != id0(expected): + return False + lookup_key = ('function-lookups', id0(function), id0(code), + id0(namespace), id0(builtins_owner)) + observed_lookups = dict_get(domains, lookup_key, missing) + if observed_lookups is missing: + scalar_lookups = [] + for name, expected, expected_builtin in lookups: + observed_global = get_id(namespace, name, domains) + if observed_global != id0(expected_global(namespace, name, expected)): + return False + # A false builtin_values path must not observe builtin keys or + # values. The absent slot is completed only in a later true path. + if builtin_values: + observed_builtin = get_id(builtins_owner, name, domains) + if observed_builtin != id0(expected_builtin): + return False + scalar_lookups.append((name, observed_global, True, observed_builtin)) + else: + scalar_lookups.append((name, observed_global, False, 0)) + dict_set(domains, lookup_key, tuple0(scalar_lookups)) + else: + if len0(observed_lookups) != len0(lookups): + return False + completed_lookups = None + index = 0 + for (name, expected, expected_builtin), observed in zip0(lookups, observed_lookups): + if observed[0] != name: + return False + if observed[1] != id0(expected_global(namespace, name, expected)): + return False + if builtin_values: + if observed[2]: + observed_builtin = observed[3] + else: + observed_builtin = get_id(builtins_owner, name, domains) + if observed_builtin != id0(expected_builtin): + return False + if not observed[2]: + if completed_lookups is None: + completed_lookups = list0(observed_lookups) + completed_lookups[index] = (name, observed[1], True, observed_builtin) + index += 1 + if completed_lookups is not None: + dict_set(domains, lookup_key, tuple0(completed_lookups)) + return True + + zip0 = zip + + def fresh_graph(graph, domains, builtin_values, message): + functions, classes = graph + for cls, mro, proxy, members in classes: + if not (type0(cls) is type0 and class_mro_get(cls, type0) is mro and + proxy_len(proxy) == len0(members)): + need(False, message + ': class dispatch') + for name, expected in members: + if not (get_id(proxy, name, domains) == id0(expected)): + need(False, message + ': class member ' + name) + for record in functions: + if not (fresh_function(record, domains, builtin_values)): + need(False, message + ': function environment') + + def module_image(module, name, kind, path, digest, source_bytes, *, stdlib=False): + need(type0(module) is module_type, 'Cold authority module exact type differs') + namespace = module_dict_get(module, module_type) + domains = {} + try: + need(type0(namespace) is dict0 and string_domain(namespace, domains), + 'Cold authority module dictionary domain differs') + items = tuple0(dict_items(namespace)) + functions, classes = [], [] + for field, value in items: + if type0(value) is function_type: + if stdlib or value.__globals__ is namespace: + functions.append(value) + elif type0(value) is type0: + declared = type_get(value, '__module__') + if stdlib or (type0(declared) is str0 and declared == name): + classes.append(value) + graph = capture_graph(functions, classes) + mappings = [] + selected = ('_CANONICAL_BUILTINS', '_TYPE_BUILTINS') if kind == 'backend' else () + for field in selected: + mapping = dict_get(namespace, field, missing) + need(type0(mapping) is dict0, 'Cold authority backend dispatch dictionary differs') + mappings.append((field, mapping, tuple0(dict_items(mapping)))) + original_guard = dict_get(namespace, 'RuntimeGuard', missing) if kind == 'backend' else None + if kind == 'backend': + need(type0(original_guard) is type0, 'Cold authority original RuntimeGuard differs') + handle = object0() + return (handle, module, namespace, name, path, digest, source_bytes, + items, graph[0], graph[1], tuple0(mappings), original_guard, kind) + finally: + dict_clear(domains) + + def record_for(handle): + record = dict_get(registry, id0(handle), missing) + need(record is not missing and record[0] is handle, 'Cold authority handle is not registered') + return record + + def fresh_module(record, domains, builtin_values, *, registry_slot=True, exact_census=True, prefix='Cold authority'): + module, namespace = record[1], record[2] + if not (type0(module) is module_type and module_dict_get(module, module_type) is namespace): + need(False, prefix + ': module owner differs') + if registry_slot: + if not (get_id(initial_sys_modules, record[3], domains) == id0(module)): + need(False, prefix + ': registered module slot differs') + if exact_census: + if not (dict_len(namespace) == len0(record[7])): + need(False, prefix + ': namespace census differs') + for name, expected in record[7]: + if not (get_id(namespace, name, domains) == id0(expected_global(namespace, name, expected))): + need(False, prefix + ': namespace binding ' + name) + for name, mapping, expected in record[10]: + if not (identity_mapping(mapping, expected)): + need(False, prefix + ': dispatch dictionary ' + name) + fresh_graph((record[8], record[9]), domains, builtin_values, prefix) + + need(type0(root) is module_type and type0(api) is tuple0 and len0(api) == 4, + 'Cold authority requires the actual pristine root and sealed fourtuple') + root_namespace = module_dict_get(root, module_type) + root_api_graph = capture_graph(api, ()) + root_hash = dict_get(root_namespace, '_hash_regular', missing) + root_compile = dict_get(root_namespace, '_COMPILE', missing) + root_exec = dict_get(root_namespace, '_EXEC', missing) + root_identity = api[0] + initial_builtin_items = tuple0(dict_items(builtin_namespace)) + stdlib_records = tuple0(module_image(module, module.__name__, 'stdlib', None, None, None, stdlib=True) + for module in initial_std_modules) + stdlib_mappings = tuple0((mapping, tuple0(dict_items(mapping))) for mapping in + (copy._deepcopy_dispatch, copy.dispatch_table, copyreg.dispatch_table)) + self_graph = capture_graph((dict_get(authority_namespace, 'capture_authority'),), ()) + self_items = tuple0(dict_items(authority_namespace)) + + def root_and_stdlib(domains): + need(type0(sys_owner) is module_type and module_dict_get(sys_owner, module_type) is sys_namespace and + get_id(sys_namespace, 'modules', domains) == id0(initial_sys_modules) and + get_id(sys_namespace, 'flags', domains) == id0(initial_sys_flags), + 'Cold authority interpreter owner differs') + need(dict_len(builtin_namespace) == len0(initial_builtin_items), 'Cold authority builtin census differs') + for name, expected in initial_builtin_items: + need(get_id(builtin_namespace, name, domains) == id0(expected), 'Cold authority builtin binding ' + name) + for name, expected in self_items: + need(get_id(authority_namespace, name, domains) == id0(expected), 'Cold authority source binding ' + name) + fresh_graph(self_graph, domains, True, 'Cold authority source') + fresh_graph(root_api_graph, domains, True, 'Cold authority root entry') + dict_clear(domains) + need(root_identity() == root_pin, 'Cold authority actual root source identity differs') + dict_clear(domains) + for record in stdlib_records: + fresh_module(record, domains, True, registry_slot=True, exact_census=False, prefix='Cold authority initial stdlib') + for mapping, expected in stdlib_mappings: + need(identity_mapping(mapping, expected), 'Cold authority initial copy dispatch differs') + + def check_registered(domains): + for record in tuple0(registry.values()): + fresh_module(record, domains, True) + + def cold_check(handle=None): + domains = {} + try: + root_and_stdlib(domains) + check_registered(domains) + if handle is not None: + record = record_for(handle) + dict_clear(domains) + digest, size, raw = root_hash(record[4], max_source, False) + need(digest == record[5], 'Cold authority source file changed') + return record + return None + finally: + dict_clear(domains) + + def load(path, digest, name, kind='module'): + cold_check() + need(type0(path) is str0 and path.startswith('/') and type0(digest) is str0 and len0(digest) == 64 and + type0(name) is str0 and name and type0(kind) is str0 and kind in ('module', 'backend'), + 'Cold authority source-load argument shape differs') + for character in digest: + need(character in '0123456789abcdef', 'Cold authority source digest is not lowercase SHA256') + need((kind == 'backend') == (digest == backend_pin), 'Cold authority original backend classification differs') + domains = {} + try: + need(get_id(initial_sys_modules, name, domains) == missing_id, 'Cold authority module name already registered') + finally: + dict_clear(domains) + observed, size, source_bytes = root_hash(path, max_source, True) + need(observed == digest and type0(source_bytes) is bytes0, 'Cold authority source bytes differ') + module = module_type(name) + namespace = module_dict_get(module, module_type) + namespace.update({'__file__': path, '__builtins__': builtin_namespace}) + # Dataclass/import ownership sees the correct unique slot during exec. + dict_set(initial_sys_modules, name, module) + try: + code = root_compile(source_bytes, path, 'exec', dont_inherit=True, optimize=initial_optimize) + root_exec(code, namespace) + record = module_image(module, name, kind, path, digest, source_bytes) + dict_set(registry, id0(record[0]), record) + dict_set(by_namespace, id0(namespace), record) + if kind == 'backend': + dict_set(backend_guards, id0(record[0]), record[11]) + cold_check(record[0]) + except base_error0: + # A failed source is retained in the unique slot for evidence and + # cannot be retried/reclassified as an unobserved clean load. + raise + return (module, record[0]) + + def make_caller_descriptor(operations, label): + """Mint only at original capture or an authenticated entry-three return. + + The caller checks the dispatcher record INLINE before invoking it. This + is not a claim that the dispatcher can authenticate its own replacement + code. Its already-admitted active frame checks all target/helper objects. + """ + pending, seen, records = list0(operations), {}, [] + while pending: + function = pending.pop() + if dict_get(seen, id0(function), missing) is not missing: + continue + need(len0(records) < max_functions, 'Cold authority caller helper census exceeds bound') + raw = raw_function_record(function) + record = (function,) + raw[1][:6] + (raw[2], raw[3]) + dict_set(seen, id0(function), function) + records.append(record) + for cell, value in record[8]: + if type0(value) is function_type: + pending.append(value) + records = tuple0(records) + field_getters = function_fields[:6] + primitives = (type0, function_type, id0, len0, field_getters, cell_type, + cell_get, error0, value_error0, tuple0, dict0, str0, + dict_get, dict_len, dict_iter, next0, dict_clear, missing, zip0) + + def dispatch(index, *args, **kwargs): + # The active caller has already authenticated this actual function. + # This pretarget block uses captured C primitives only. In particular + # it does not call need(), fresh_function(), or any other validator. + if type0(index) is not int0 or index < 0 or index >= len0(operations): + raise error0(label + ': operation index differs') + for record in records: + function = record[0] + if type0(function) is not function_type: + raise error0(label + ': target exact function differs') + for (name, getter), expected in zip0(field_getters, record[1:7]): + if id0(getter(function, function_type)) != id0(expected): + raise error0(label + ': target function environment differs') + keywords = record[5] + if keywords is not None: + if type0(keywords) is not dict0 or dict_len(keywords) != len0(record[7]): + raise error0(label + ': target keyword census differs') + iterator = current = None + valid_domain = True + try: + iterator = dict_iter(keywords) + while True: + current = next0(iterator, missing) + if current is missing: + break + if type0(current) is not str0: + valid_domain = False + break + current = None + finally: + # Foreign current keys never survive a retained error. + iterator = current = None + if not valid_domain: + raise error0(label + ': target keyword key domain differs') + for name, expected in record[7]: + if id0(dict_get(keywords, name, missing)) != id0(expected): + raise error0(label + ': target keyword value differs') + for cell, expected in record[8]: + try: + observed_id = id0(cell_get(cell, cell_type)) + except value_error0: + raise error0(label + ': target closure became empty') from None + if observed_id != id0(expected): + raise error0(label + ': target closure value differs') + # The chosen function object comes from the original immutable + # operations tuple, not a mutable late attribute or caller registry. + return operations[index](*args, **kwargs) + + raw_dispatch = raw_function_record(dispatch) + dispatch_record = (dispatch,) + raw_dispatch[1][:6] + (raw_dispatch[2], raw_dispatch[3]) + need(dispatch_record[4] is None and dispatch_record[5] is None and not dispatch_record[7], + 'Cold authority dispatcher source defaults contract differs') + return ('h25-cold-authority-caller-v1', operations, dispatch, + dispatch_record, records, primitives) + + def runtime_guard(handle): + record = cold_check(handle) + def guarded_helpers(): + domains = {} + try: + fresh_module(record, domains, False, prefix='Runtime drift: cache collector') + finally: + dict_clear(domains) + child_descriptor = make_caller_descriptor((guarded_helpers,), 'Runtime drift: cache collector caller') + return (guarded_helpers, child_descriptor) + + def known_backend(module): + need(type0(module) is module_type, 'Cold authority producer backend type differs') + namespace = module_dict_get(module, module_type) + record = dict_get(by_namespace, id0(namespace), missing) + need(record is not missing and record[1] is module and record[12] == 'backend' and record[5] == backend_pin, + 'Cold authority producer backend provenance differs') + return record + + def known_guard(cls): + need(type0(cls) is type0, 'Cold authority exact guard class differs') + for record in tuple0(registry.values()): + if record[12] == 'backend' and cls is record[11]: + return None + product = dict_get(products, id0(cls), missing) + need(product is not missing and product[0] is cls and product[6] in + ('backend_guard', 'extra_guard', 'row_guard', 'cache_guard'), + 'Cold authority guard was not produced by an admitted source') + domains = {} + try: + fresh_graph(product[5], domains, True, 'Cold authority producer base product') + finally: + dict_clear(domains) + return product + + def classify(record, export): + for digest, name, role in producer_rules: + if digest is not None and record[5] == digest and export == name: + return role + return None + + def validate_producer_arguments(record, export, role, args, kwargs): + domains = {} + try: + need(type0(kwargs) is dict0 and string_domain(kwargs, domains) and not kwargs, + 'Cold authority reviewed producers require positional arguments') + if role == 'backend_guard': + need(len0(args) == 1, 'Cold authority backend guard arguments differ') + known_backend(args[0]) + elif role == 'extra_guard': + need(len0(args) == 3 and type0(args[2]) is tuple0, 'Cold authority trace guard arguments differ') + known_guard(args[0]); known_backend(args[1]) + for entry in args[2]: + need(type0(entry) is tuple0 and len0(entry) == 3, + 'Cold authority trace entry shape differs') + owner, name, function = entry + need(type0(owner) is module_type and type0(name) is str0 and + type0(function) is builtin_type and + builtin_self_get(function, builtin_type) is owner and + get_id(module_dict_get(owner, module_type), name, domains) == id0(function), + 'Cold authority trace entry owner differs') + elif role == 'trace': + need(len0(args) == 2 and type0(args[1]) is module_type, 'Cold authority trace producer arguments differ') + known_backend(args[0]) + elif role == 'row_function': + need(not args, 'Cold authority row interner arguments differ') + elif role == 'row_guard': + need(len0(args) == 2, 'Cold authority row guard arguments differ') + known_guard(args[0]) + product = dict_get(products, id0(args[1]), missing) + need(product is not missing and product[0] is args[1] and product[1] is record[0] and + product[2] == 'make_row_interner' and product[6] == 'row_function', + 'Cold authority row helper provenance differs') + fresh_graph(product[5], domains, True, 'Cold authority producer row helper') + elif role == 'cache_guard': + need(len0(args) == 2 and type0(args[1]) is dict0 and string_domain(args[1], domains), + 'Cold authority cache guard arguments differ') + known_guard(args[0]) + owner = dict_get(args[1], 'owner', missing) + need(type0(owner) is dict_get(record[2], '_Owner', missing), + 'Cold authority prepared cache owner class differs') + elif role == 'row_bind': + need(len0(args) == 2 and type0(args[0]) is function_type and type0(args[1]) is bytes0, + 'Cold authority row bind arguments differ') + found = False + for backend_record in tuple0(registry.values()): + if (backend_record[12] == 'backend' and args[0] is dict_get(backend_record[2], 'bind', missing) and + args[1] is backend_record[6]): + found = True + break + need(found, 'Cold authority row bind is not the original registered function/source') + finally: + dict_clear(domains) + + def invoke(handle, export, *args, **kwargs): + record = cold_check(handle) + need(type0(export) is str0, 'Cold authority export name must be exact str') + function = dict_get(record[2], export, missing) + need(type0(function) is function_type and function.__globals__ is record[2], + 'Cold authority export is not an owned source function') + role = classify(record, export) + if role is not None: + validate_producer_arguments(record, export, role, args, kwargs) + result = function(*args, **kwargs) + if role is not None: + # Do not retain a row producer's enclosing tuple or mutable AST. + product = result[0] if type0(result) is tuple0 and len0(result) and type0(result[0]) is function_type else result + expected_kind = function_type if role in ('row_function', 'row_bind') else type0 + need(type0(product) is expected_kind and dict_get(products, id0(product), missing) is missing, + 'Cold authority producer did not return a fresh exact product') + graph = capture_graph((product,) if expected_kind is function_type else (), + (product,) if expected_kind is type0 else ()) + product_record = (product, handle, export, args, tuple0(dict_items(kwargs)), graph, role) + dict_set(products, id0(product), product_record) + domains = {} + try: + fresh_graph(graph, domains, True, 'Cold authority new product') + finally: + dict_clear(domains) + return result + + def check_product(obj, producer_handle, export, args_tuple, kwargs_dict): + record_for(producer_handle) + cold_check(producer_handle) + need(type0(args_tuple) is tuple0 and type0(kwargs_dict) is dict0 and type0(export) is str0, + 'Cold authority product proof arguments differ') + product = dict_get(products, id0(obj), missing) + need(product is not missing and product[0] is obj and product[1] is producer_handle and product[2] == export, + 'Cold authority product provenance differs') + need(len0(args_tuple) == len0(product[3]), 'Cold authority product positional census differs') + for actual, expected in zip0(args_tuple, product[3]): + need(actual is expected, 'Cold authority product positional identity differs') + domains = {} + try: + need(dict_len(kwargs_dict) == len0(product[4]), 'Cold authority product keyword census differs') + for name, expected in product[4]: + need(get_id(kwargs_dict, name, domains) == id0(expected), 'Cold authority product keyword identity differs') + fresh_graph(product[5], domains, True, 'Cold authority registered product') + finally: + dict_clear(domains) + return None + + def set_backend_guard(handle, cls): + record = cold_check(handle) + need(record[12] == 'backend', 'Cold authority guard transition requires original backend') + product = known_guard(cls) + domains = {} + try: + if product is not None: + fresh_graph(product[5], domains, True, 'Cold authority guard transition product') + old = dict_get(backend_guards, id0(handle), missing) + need(dict_get(record[2], 'RuntimeGuard', missing) is old, + 'Cold authority backend guard changed outside the transition ledger') + dict_clear(domains) + dict_set(record[2], 'RuntimeGuard', cls) + dict_set(backend_guards, id0(handle), cls) + transitions.append((handle, old, cls, product)) + fresh_module(record, domains, True) + finally: + dict_clear(domains) + return None + + def source(handle): + record = cold_check(handle) + return (record[1], record[4], record[5], record[6]) + + # Final initial-root validation occurs before any source can receive a token. + cold_check() + need(api[1](capability, provider_pin) is not None, 'Cold authority root capability differs') + operations = (load, invoke, cold_check, runtime_guard, check_product, set_backend_guard, source) + descriptor = make_caller_descriptor(operations, 'Cold authority caller') + # Original raw loader only: capture this transport immediately and retain + # the immutable descriptor privately. No later attribute read is authority. + load.__dict__['_h25_caller_descriptor'] = descriptor + return operations + + +"""Concrete SOURCE ONLY epoch ledger. No execution/profile grant is embedded.""" +import ast +import builtins +import hashlib +import types + +SOURCE_EXECUTION_CONTRACT = None +FULL_EXECUTION_CONTRACT = None +_FUNCTION = types.FunctionType +_MODULE = types.ModuleType +_CODE = types.CodeType +_TYPE, _ID, _LEN = type, id, len +_DICT, _TUPLE, _STR, _INT, _BOOL = dict, tuple, str, int, bool +_GET, _ITEMS, _CLEAR = dict.get, dict.items, dict.clear +_CLASS_DICT = type.__dict__['__dict__'].__get__ +_CLASS_MRO = type.__dict__['__mro__'].__get__ +_CELL = types.CellType.__dict__['cell_contents'].__get__ +_FFIELDS = tuple((name, _FUNCTION.__dict__[name].__get__) for name in + ('__code__', '__globals__', '__builtins__', '__defaults__', + '__kwdefaults__', '__closure__', '__dict__')) +_MISSING = object() +SLOTS = ( + ('module', 'echelon'), ('module', 'rank'), ('module', 'compile_roles'), + ('module', 'verify_role_frames'), ('circuit', 'add'), ('circuit', '__init__'), + ('checks', 'verify_map'), ('checks', '__init__'), ('checks', 'label'), + ('checks', 'target_frame'), ('checks', 'verify_labels'), + ('checks', 'residual_ok'), ('checks', 'label_ok'), + ('label', 'complement_in'), ('label', 'nondegenerate')) +ROLE_FOR_SLOT = { + ('module', 'echelon'): ('canonical',), + ('module', 'rank'): ('rank_trace',), + ('module', 'compile_roles'): ('phase',), + ('module', 'verify_role_frames'): ('roles', 'roles_observer'), + ('circuit', 'add'): ('construction_add',), + ('circuit', '__init__'): ('construction_init', 'phase'), + ('checks', 'verify_map'): ('p1', 'phase'), + ('checks', '__init__'): ('C1', 'checks_capture', 'phase'), + ('checks', 'label'): ('C2',), ('checks', 'target_frame'): ('C3',), + ('checks', 'verify_labels'): ('labels', 'phase'), + ('checks', 'residual_ok'): ('public_residual',), + ('checks', 'label_ok'): ('public_label',), + ('label', 'complement_in'): ('native_complement',), + ('label', 'nondegenerate'): ('native_gram',)} + + +def need(condition, message): + if not condition: + raise RuntimeError(message) + + +def string_keys(mapping): + need(_TYPE(mapping) is _DICT, 'Epoch namespace is not exact dict') + for key in mapping: + need(_TYPE(key) is _STR, 'Epoch foreign namespace key') + + +def names(code): + pending, result = [code], [] + while pending: + value = pending.pop() + need(_TYPE(value) is _CODE, 'Epoch code type') + for name in value.co_names: + if name not in result: + result.append(name) + pending.extend(x for x in value.co_consts if _TYPE(x) is _CODE) + return tuple(result) + + +def function_record(function): + need(_TYPE(function) is _FUNCTION, 'Epoch exact function required') + fields = tuple(getter(function, _FUNCTION) for _, getter in _FFIELDS) + code, namespace, builtin_owner, defaults, keywords, closure, attrs = fields + string_keys(namespace); string_keys(builtin_owner); string_keys(attrs) + if defaults is not None: + need(_TYPE(defaults) is _TUPLE, 'Epoch defaults type') + if keywords is not None: + string_keys(keywords) + cells = () if closure is None else tuple((cell, _CELL(cell, types.CellType)) for cell in closure) + lookups = tuple((name, _GET(namespace, name, _MISSING), + _GET(builtin_owner, name, _MISSING)) for name in names(code)) + return (function, fields, () if keywords is None else tuple(keywords.items()), + cells, lookups, tuple(attrs.items())) + + +def check_fields(record): + function, fields, keywords, cells, lookups, attrs = record + need(_TYPE(function) is _FUNCTION, 'Epoch function replacement') + for (_, getter), expected in zip(_FFIELDS, fields): + need(getter(function, _FUNCTION) is expected, 'Epoch function field changed') + current_keywords = fields[4] + if current_keywords is not None: + string_keys(current_keywords) + need(len(current_keywords) == len(keywords), 'Epoch keyword census') + for name, expected in keywords: + need(_GET(current_keywords, name, _MISSING) is expected, 'Epoch keyword value') + for cell, expected in cells: + need(_CELL(cell, types.CellType) is expected, 'Epoch closure cell changed') + current_attrs = fields[6] + string_keys(current_attrs) + need(len(current_attrs) == len(attrs), 'Epoch function attributes census') + for name, expected in attrs: + need(_GET(current_attrs, name, _MISSING) is expected, 'Epoch function attribute') + + +def class_record(cls): + need(_TYPE(cls) is _TYPE, 'Epoch class metaclass') + proxy = _CLASS_DICT(cls, _TYPE) + members = tuple(proxy.items()) + need(all(_TYPE(k) is _STR for k, _ in members), 'Epoch class key domain') + return (cls, _CLASS_MRO(cls, _TYPE), members) + + +def graph(functions, classes, canonical_functions=None, canonical_classes=None): + """Explicit class roots; arbitrary state/tuple cells never imply provenance.""" + functions, classes = list(functions), list(classes) + seen_f, seen_c, records_f, records_c = {}, {}, [], [] + canonical_functions = {} if canonical_functions is None else canonical_functions + canonical_classes = {} if canonical_classes is None else canonical_classes + while functions or classes: + while classes: + cls = classes.pop() + if id(cls) in seen_c: + continue + need(len(seen_c) < 2048, 'Epoch class graph bound') + seen_c[id(cls)] = cls + rec = canonical_classes.get(id(cls)) + rec = class_record(cls) if rec is None else rec + need(rec[0] is cls, 'Epoch class canonical identity') + records_c.append(rec) + for base in rec[1][1:]: + if type(base) is type: + classes.append(base) + for _, value in rec[2]: + if type(value) is _FUNCTION: + functions.append(value) + elif type(value) in (staticmethod, classmethod): + functions.append(value.__func__) + elif type(value) is property: + functions.extend(x for x in (value.fget, value.fset, value.fdel) if x is not None) + if functions: + function = functions.pop() + if id(function) in seen_f: + continue + need(len(seen_f) < 8192, 'Epoch function graph bound') + seen_f[id(function)] = function + rec = canonical_functions.get(id(function)) + rec = function_record(function) if rec is None else rec + need(rec[0] is function, 'Epoch original function canonical identity') + records_f.append(rec) + for _, value in rec[3]: + if type(value) is _FUNCTION: + functions.append(value) + defaults = rec[1][3] + if defaults is not None: + functions.extend(x for x in defaults if type(x) is _FUNCTION) + functions.extend(x for _, x in rec[2] + rec[5] if type(x) is _FUNCTION) + functions.extend(x for _, x, _ in rec[4] if type(x) is _FUNCTION) + return tuple(records_f), tuple(records_c) + + +class EpochLedger: + """One original generation; no generic external record/admission operation.""" + def __init__(self): + self.origins = {} + self.phase = 'COLD' + self.serial = 0 + self.failure = None + self.class_origin = class_record(type(self)) + self.method_origin = tuple(function_record(v) for _, v in self.class_origin[2] + if type(v) is _FUNCTION) + + def guard_engine(self): + cls, mro, members = self.class_origin + need(type(self) is cls and _CLASS_MRO(cls, type) is mro, 'Epoch engine class drift') + current = _CLASS_DICT(cls, type) + need(len(current) == len(members), 'Epoch engine member census') + for name, value in members: + need(current.get(name, _MISSING) is value, 'Epoch engine member drift') + for rec in self.method_origin: + check_fields(rec) + + def capture(self, module, backend, source_bytes, factory_results, authority_graph, missing_token): + self.guard_engine() + need(self.phase == 'COLD', 'Epoch original capture is one shot') + need(type(module) is _MODULE and type(backend) is _MODULE and type(source_bytes) is bytes, + 'Epoch original inputs') + namespace = module.__dict__; string_keys(namespace) + need(hashlib.sha256(source_bytes).hexdigest() == + 'd623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1', 'Epoch original source hash') + # Caller authenticates backend + each pristine factory BEFORE this call. + label = backend.guard_module(module) + checks, circuit = namespace['Checks'], namespace['ComplexSideCircuit'] + need(label is namespace['Label'], 'Epoch original Label identity') + need(type(factory_results) is tuple and len(factory_results) == 3, 'Epoch actual factory outputs') + p1, construction, prepared = factory_results + need(type(prepared) is dict and prepared['owner'].module is module, 'Epoch actual prepared owner') + compiled = compile(source_bytes, namespace['__file__'], 'exec', dont_inherit=True) + source_codes = {x.co_name: x for x in compiled.co_consts if type(x) is _CODE} + for cls, name in ((label, 'Label'), (checks, 'Checks'), (circuit, 'ComplexSideCircuit')): + expected = {x.co_name: x for x in source_codes[name].co_consts if type(x) is _CODE} + attrs = _CLASS_DICT(cls, type) + need(set(attrs) == set(expected) | {'__module__','__doc__','__dict__','__weakref__'}, + 'Epoch original class census') + for field, code in expected.items(): + function = attrs[field] + need(type(function) is _FUNCTION and function.__globals__ is namespace and + function.__builtins__ is builtins.__dict__ and function.__defaults__ is None and + function.__kwdefaults__ is None and function.__closure__ is None and + backend._code_shape(function.__code__) == backend._code_shape(code), + 'Epoch original class source/calling contract') + need(type(authority_graph) is tuple and len(authority_graph)==2, 'Epoch original authority graph') + fg, original_classes = authority_graph + cg=tuple((row[0],row[1],row[3]) for row in original_classes) + need(all(type(row) is tuple and len(row)==6 for row in fg), 'Epoch original raw-record schema') + self.serial += 1; handle = object() + origin = {'handle':handle,'module':module,'namespace':namespace,'backend':backend, + 'label':label,'checks':checks,'circuit':circuit,'items':tuple(namespace.items()), + 'functions':fg,'classes':cg,'function_map':{id(x[0]):x for x in fg}, + 'class_map':{id(x[0]):x for x in cg},'slots':{},'visible':{},'edges':[], + 'products':[],'factory_results':factory_results,'generation':self.serial, + 'raw_guard':None,'suite':None,'phase':'ORIGINAL','missing':missing_token,'authority_classes':original_classes, + 'primary_error':None,'secondary_error':None,'uncertain':False} + owners = {'module':namespace,'label':label,'checks':checks,'circuit':circuit} + for kind, name in SLOTS: + owner = owners[kind] + value = owner[name] if type(owner) is dict else _CLASS_DICT(owner,type)[name] + origin['slots'][kind,name] = (owner,value,value,()) + origin['visible'][kind,name] = value + self.origins[id(handle)] = origin; self.phase = 'ORIGINAL' + return handle + + def origin(self, handle): + self.guard_engine() + origin = self.origins.get(id(handle)) + need(origin is not None and origin['handle'] is handle, 'Epoch origin handle') + need(origin['phase'] != 'FAILED', 'Epoch failed generation') + return origin + + def enroll_suite(self, handle, suite): + origin = self.origin(handle) + need(origin['phase'] == 'ORIGINAL' and origin['suite'] is None, 'Epoch suite one shot') + origin['suite'] = suite + origin['phase'] = 'FACTORIES_ADMITTED' + return origin['generation'] + + def authorize(self, handle, kind, name, old, new, role, product_graph): + origin = self.origin(handle) + need(origin['phase'] in ('FACTORIES_ADMITTED','CALLERS_INSTALLED','NATIVE_PRODUCTS_PREPARED'), + 'Epoch transition phase') + need(type(kind) is str and type(name) is str and type(role) is str and + (kind,name) in origin['slots'] and role in ROLE_FOR_SLOT[kind,name], 'Epoch finite slot/role') + owner, first, prior, chain = origin['slots'][kind,name] + need(old is prior and new is not prior, 'Epoch preceding endpoint identity') + current = owner[name] if type(owner) is dict else _CLASS_DICT(owner,type).get(name,_MISSING) + need(current is old, 'Epoch unauthorized prior change') + need(type(new) is _FUNCTION, 'Epoch callable product type') + # Product comes only from the authenticated suite builder; it supplies + # the complete graph after its strict source/code inverse validation. + need(type(product_graph) is tuple and len(product_graph)==2, 'Epoch product graph shape') + origin['products'].append(product_graph) + origin['slots'][kind,name] = (owner,first,new,chain+((old,new,role),)) + origin['edges'].append((kind,name,old,new,role,origin['generation'])) + return None + + def register_product(self,handle,suite,role,function,product_graph): + origin=self.origin(handle) + allowed=('C1','C2','C3','labels','roles','canonical','public_label', + 'public_residual','private_label','private_residual','prepare','finish') + need(type(role) is str and role in allowed and type(function) is _FUNCTION, + 'Epoch private product role/type') + if origin['suite'] is None: + need(origin.get('creating') is True,'Epoch factory not active') + origin['suite']=suite;origin['phase']='FACTORIES_ADMITTED' + need(origin['suite'] is suite,'Epoch source suite ownership') + proof=suite.proofs.get(id(function)) + need(proof is not None and proof[0] is function and proof[1]==role, + 'Epoch actual factory product proof') + origin['products'].append(product_graph) + origin.setdefault('private_products',{})[role]=function + return None + + def install(self, handle, kind, name, new): + origin = self.origin(handle) + owner, first, endpoint, chain = origin['slots'][kind,name] + need(endpoint is new and chain, 'Epoch install requires declared product') + prior = chain[-1][0] + if type(owner) is dict: + need(owner.get(name,_MISSING) is prior, 'Epoch global old identity') + owner[name] = new + else: + need(_CLASS_DICT(owner,type).get(name,_MISSING) is prior, 'Epoch class old identity') + type.__setattr__(owner,name,new) + origin['visible'][kind,name]=new + + def observed_transition(self, handle, kind, name, old, new, role, product_graph): + """Source-owned existing wrapper operation, verified with old retained ref.""" + origin=self.origin(handle) + owner, first, prior, chain=origin['slots'][kind,name] + need(old is prior, 'Epoch observed old identity') + current=owner[name] if type(owner) is dict else _CLASS_DICT(owner,type).get(name,_MISSING) + need(current is new and role in ROLE_FOR_SLOT[kind,name], 'Epoch observed source endpoint') + need(type(new) is _FUNCTION, 'Epoch observed function') + origin['products'].append(product_graph) + origin['slots'][kind,name]=(owner,first,new,chain+((old,new,role),)) + origin['visible'][kind,name]=new + origin['edges'].append((kind,name,old,new,role,origin['generation'])) + + def expected(self, owner, name, old): + for origin in self.origins.values(): + for (kind, field), (slot_owner, first, endpoint, chain) in origin['slots'].items(): + if slot_owner is owner and field == name and chain: + if old is first or any(old is item[0] for item in chain): + return origin['visible'][kind,field] + return old + + def expected_lookup(self, raw_record, namespace, name, expected): + # Exact ORIGINAL function-record identity/function + original namespace + # and lookup name/object. Products never become a replacement origin. + for origin in self.origins.values(): + canonical=origin['function_map'].get(id(raw_record[0])) + if canonical is raw_record and namespace is origin['namespace']: + for old_name, old_value, old_builtin in canonical[4]: + if old_name==name and old_value is expected: + return self.expected(namespace,name,expected) + return expected + + def original_record(self, function): + for origin in self.origins.values(): + record=origin['function_map'].get(id(function)) + if record is not None and record[0] is function:return record + return None + + def original_class(self, cls): + for origin in self.origins.values(): + for record in origin['authority_classes']: + if record[0] is cls:return record + return None + + def projected_member(self, cls, name, expected): + return self.expected(cls,name,expected) + + def check(self, handle): + origin=self.origin(handle); namespace=origin['namespace'];string_keys(namespace) + need(origin['module'].__dict__ is namespace and len(namespace)==len(origin['items']), + 'Epoch source namespace owner/census') + for name, value in origin['items']: + need(namespace.get(name,_MISSING) is self.expected(namespace,name,value), 'Epoch module current binding') + graphs=((origin['functions'],origin['classes']),)+tuple(origin['products']) + seen=set() + for functions, classes in graphs: + for cls,mro,members in classes: + need(type(cls) is type and _CLASS_MRO(cls,type) is mro, 'Epoch class dispatch') + proxy=_CLASS_DICT(cls,type);need(len(proxy)==len(members),'Epoch class census') + for name,value in members: + need(proxy.get(name,_MISSING) is self.expected(cls,name,value),'Epoch class current member') + for rec in functions: + if id(rec[0]) in seen:continue + seen.add(id(rec[0]));check_fields(rec) + fn, fields, keywords, cells, lookups,attrs=rec + ns,builtin_owner=fields[1:3];string_keys(ns);string_keys(builtin_owner) + for name,old,old_builtin in lookups: + need(ns.get(name,origin['missing']) is self.expected_lookup(rec,ns,name,old), 'Epoch current effective global') + need(builtin_owner.get(name,origin['missing']) is old_builtin,'Epoch current effective builtin') + return None + + def phase_to(self,handle,expected,new): + origin=self.origin(handle);need(origin['phase']==expected,'Epoch phase transition') + origin['phase']=new;return None + + def fix_raw_guard(self,handle,raw): + origin=self.origin(handle) + need(origin['phase']=='NATIVE_PRODUCTS_PREPARED' and origin['raw_guard'] is None,'Epoch raw guard phase') + origin['raw_guard']=raw;origin['phase']='GLOBALS_COMMITTED' + + def finish_bind(self,handle,result,owner): + origin=self.origin(handle) + need(origin['phase']=='GLOBALS_COMMITTED' and type(result) is dict and + result.get('runtime_guard') is origin['raw_guard'] and owner.runtime is origin['raw_guard'], + 'Epoch actual raw/final runtime guard') + self.check(handle) + result['runtime_guard'].check() + origin['phase']='FINAL_CAPTURED' + + def fail(self,handle,error): + origin=self.origins.get(id(handle)) + if origin is not None and origin['handle'] is handle: + origin['phase']='FAILED';origin['failure']=error + self.failure=error + + +# Source supplement to the versioned authority; initial source loading is parent-owned. + +def _epoch_closure(function): + need(type(function) is types.FunctionType, 'Epoch wrapper exact function') + return {} if function.__closure__ is None else dict(zip(function.__code__.co_freevars, + (cell.cell_contents for cell in function.__closure__))) + + +def _epoch_code_constant(code, name): + values=[x for x in code.co_consts if type(x) is types.CodeType and x.co_name==name] + need(len(values)==1, 'Epoch exact nested code '+name) + return values[0] + + +def _epoch_operations(ledger, legacy, capture_graph0, raw_function0, descriptor_factory, + record_for0, cold_check0, root, capability, api, missing, + engine_guard, bundle_cell): + pending={} + entries={} + def before(): + engine_guard();cold_check0() + + def owned(handle, digest=None): + before();record=cold_check0(handle) + if digest is not None:need(record[5]==digest,'Epoch selected source pin') + return record + + def suite_guard(handle,suite): + before() + origin=ledger.origin(handle) + record=owned(origin['cache_handle'],EPOCH_CACHE_SHA256) + cls=record[2].get('_EpochSuite') + need(type(suite) is cls and (origin['suite'] is suite or origin['suite'] is None and origin.get('creating') is True),'Epoch actual suite class/generation') + need(suite.handle is handle and suite.module is origin['module'] and + suite.namespace is origin['namespace'] and suite.label is origin['label'] and + suite.checks_class is origin['checks'] and suite.E0 is origin['slots']['module','echelon'][1] and + suite.owner is origin['factory_results'][2]['owner'],'Epoch fixed suite source bindings') + return origin,record + + def product_graph(origin,functions=(),classes=()): + fg,cg=capture_graph0(tuple(functions),tuple(classes)+(origin['label'],origin['checks'],origin['circuit'])) + return fg,tuple((x[0],x[1],x[3]) for x in cg) + + def graph_fields_only(value): + functions,classes=value + for rec in functions: + check_fields(rec) + namespace,builtin_owner=rec[1][1:3] + string_keys(namespace);string_keys(builtin_owner) + for name,expected,expected_builtin in rec[4]: + need(namespace.get(name,missing) is ledger.expected_lookup(rec,namespace,name,expected),'Epoch factory current effective global') + need(builtin_owner.get(name,missing) is expected_builtin,'Epoch factory current effective builtin') + for cls,mro,members in classes: + need(type(cls) is type and type.__dict__['__mro__'].__get__(cls,type) is mro,'Epoch factory class MRO') + proxy=type.__dict__['__dict__'].__get__(cls,type) + need(len(proxy)==len(members),'Epoch factory class census') + for name,expected in members:need(proxy.get(name,missing) is ledger.projected_member(cls,name,expected),'Epoch factory class source') + + def admit(stage,*args): + before();need(type(stage) is str,'Epoch admission stage type') + if stage=='driver_entry': + need(len(args)==3,'Epoch driver entry argument grammar') + function,phase_class,invocation_token=args + need(type(function) is types.FunctionType and function.__name__=='main_epoch' and + function.__globals__ is sys.modules['__main__'].__dict__ and type(phase_class) is type and + function.__globals__.get('Phases') is phase_class,'Epoch actual root-installed driver identity') + need(id(invocation_token) not in entries,'Epoch duplicate initial driver invocation') + fg,cg=capture_graph0((function,),(phase_class,)) + record=next(row for row in fg if row[0] is function) + entries[id(invocation_token)]=(invocation_token,record,(fg,tuple((x[0],x[1],x[3]) for x in cg)),phase_class) + return record + if stage=='load': + need(len(args)==1,'Epoch original loader arguments') + backend_handle=args[0];record=owned(backend_handle,BACKEND_SHA256) + need(record[12]=='backend' and record[3]=='native_backend','Epoch production backend owner') + need(sys.modules.get('complex_circuit') is None,'Epoch fresh production module required') + loader=record[2].get('load_source') + need(type(loader) is types.FunctionType and loader.__globals__ is record[2],'Epoch original loader binding') + module=legacy[1](backend_handle,'load_source','complex_circuit') + need(type(module) is types.ModuleType and module.__name__=='complex_circuit','Epoch actual loaded module') + raw=record[1].verify_sources() + ticket=object();pending[id(ticket)]=(ticket,module,backend_handle,record[1],raw) + return module,ticket + need(stage=='factories' and len(args)==7,'Epoch original factory arguments') + ticket,set_handle,construction_handle,cache_handle,cache_args,cache_kwargs,context=args + item=pending.pop(id(ticket),None) + need(item is not None and item[0] is ticket,'Epoch one-shot genuine load ticket') + module,backend_handle,backend,raw=item[1:] + owned(backend_handle,BACKEND_SHA256);owned(set_handle,EPOCH_SET_SHA256) + owned(construction_handle,EPOCH_CONSTRUCTION_SHA256);cache_record=owned(cache_handle,EPOCH_CACHE_SHA256) + need(type(cache_args) is tuple and len(cache_args)==2 and type(cache_kwargs) is dict and + all(type(k) is str for k in cache_kwargs),'Epoch cache factory transport') + need(set(cache_kwargs)=={'bootstrap_root','bootstrap_capability','bootstrap_api','factory_environment'} and + cache_kwargs['bootstrap_root'] is root and cache_kwargs['bootstrap_capability'] is capability and + cache_kwargs['bootstrap_api'] is api,'Epoch actual original bootstrap/factory context') + need(type(context) is dict and all(type(k) is str for k in context) and set(context)=={'data_handle','data_module','phase_function','phase_class','phase_owner','driver_function','driver_record','invocation_token','disposition_state'},'Epoch exact source context key domain') + data_record=owned(context['data_handle'],EPOCH_DATA_SHA256) + need(context['data_module'] is data_record[1],'Epoch current data adapter owner') + phase_fn=context['phase_function'];phase_owner=context['phase_owner'] + need(type(phase_fn) is types.FunctionType and type(phase_owner) is context['phase_class'] and + phase_fn is context['phase_class'].__dict__['wrap'] and + phase_fn.__globals__ is sys.modules['__main__'].__dict__,'Epoch genuine driver phase factory') + # Reference code is source authenticated DATA, compiled but never executed. + reference_path=pathlib.Path(__file__).with_name('reference_scientific_driver.py.txt') + reference=reference_path.read_bytes() + need(hashlib.sha256(reference).hexdigest()==EPOCH_REFERENCE_DRIVER_SHA256,'Epoch reference driver source') + original_code=compile(reference,phase_fn.__code__.co_filename,'exec',dont_inherit=True,optimize=sys.flags.optimize) + phase_code=_epoch_code_constant(_epoch_code_constant(original_code,'Phases'),'wrap') + need(backend._code_shape(phase_code)==backend._code_shape(phase_fn.__code__) and + phase_fn.__defaults__ is None and phase_fn.__kwdefaults__ is None and phase_fn.__closure__ is None, + 'Epoch original phase source/calling contract') + entry=entries.pop(id(context['invocation_token']),None) + need(entry is not None and entry[0] is context['invocation_token'] and entry[1] is context['driver_record'] and + entry[3] is context['phase_class'],'Epoch original consumed driver-entry authority') + graph_fields_only(entry[2]) + driver_record=context['driver_record'];check_fields(driver_record) + need(driver_record[0] is context['driver_function'] and driver_record[0].__globals__ is phase_fn.__globals__, + 'Epoch initial driver function record') + disposition_state=context['disposition_state'] + need(type(disposition_state) is dict and all(type(k) is str for k in disposition_state),'Epoch actual parent disposition state') + execution=driver_record[0].__globals__['_EXECUTION'] + need(type(execution) is dict and all(type(k) is str for k in execution) and execution.get('state') is disposition_state, + 'Epoch existing parent failure path must own acquisition state') + record=disposition_state.get('epoch_acquisition') + need(type(record) is dict and all(type(k) is str for k in record) and + disposition_state.get('cache_binding',missing) is None and disposition_state.get('authority') is legacy and + disposition_state.get('backend_handle') is backend_handle and disposition_state.get('enabled') is True and + type(disposition_state.get('owned_states')) is list and any(x is disposition_state for x in disposition_state['owned_states']) and + disposition_state.get('cache_teardown_attempted') is False,'Epoch continuously reachable disposition route') + # The pristine original functions/factories run before their mutations. + backend.guard_module(module) + p1=legacy[1](set_handle,'bind_verify_map',module) + construction=legacy[1](construction_handle,'bind_construction',module) + prepared=legacy[1](cache_handle,'prepare_epoch_cache_contract',module,*cache_args, + **cache_kwargs,disposition_state=disposition_state,disposition_record=record) + need(disposition_state['cache_binding'] is prepared and record['prepared'] is prepared and record['published'] is True, + 'Epoch acquisition handoff preceded graph/capture') + fg,cg=capture_graph0(tuple(v for v in module.__dict__.values() if type(v) is types.FunctionType), + (module.Label,module.Checks,module.ComplexSideCircuit)) + handle=ledger.capture(module,backend,raw,(p1,construction,prepared),(fg,cg),missing) + record['origin_handle']=handle + origin=ledger.origin(handle) + origin.update({'backend_handle':backend_handle,'cache_handle':cache_handle, + 'set_handle':set_handle,'construction_handle':construction_handle,'context':context, + 'data_record':data_record,'phase_record':raw_function0(phase_fn),'driver_record':driver_record, + 'creating':False,'native_pending':None,'driver_graph':entry[2]}) + roots=tuple(v for mapping in (p1,construction) for v in mapping.values() if type(v) is types.FunctionType) + ff,fc=capture_graph0(roots,(type(p1['owner']),type(construction['owner']),type(prepared['owner']))) + origin['factory_graph']=(ff,tuple((x[0],x[1],x[3]) for x in fc)) + origin['factory_items']=tuple((mapping,tuple(mapping.items())) for mapping in (p1,construction)) + record['phase']='ORIGIN_ACCEPTED_PARENT_OWNED' + return handle,p1,construction,prepared + + def derive(handle,context): + before() + origin=ledger.origin(handle);cache_record=owned(origin['cache_handle'],EPOCH_CACHE_SHA256) + need(origin['phase']=='ORIGINAL' and origin['context'] is context and not origin['creating'], + 'Epoch suite creation provenance') + creator=cache_record[2].get('create_epoch_suite') + need(type(creator) is types.FunctionType and creator.__globals__ is cache_record[2],'Epoch suite source creator') + origin['creating']=True + try: + p1,construction,prepared=origin['factory_results'] + prepared['owner']._epoch_creator_record=(bundle_cell[0][3],handle,context) + suite=creator(bundle_cell[0][3],handle,origin['module'],origin['backend'].verify_sources(), + prepared,p1,construction,context,origin['generation']) + need(origin['suite'] is suite,'Epoch multiproduct creator ownership') + origin['suite_snapshot']=(suite.registry,suite.products,suite.caller_caps,suite.descriptor, + suite.prepared,suite.p1,suite.construction) + return suite + except BaseException as error: + ledger.fail(handle,error);raise + finally:origin['creating']=False + + def check_factory(origin): + for mapping,items in origin['factory_items']: + need(type(mapping) is dict and len(mapping)==len(items),'Epoch original factory output census') + for key,value in items:need(mapping.get(key,missing) is value,'Epoch factory output binding') + graph_fields_only(origin['factory_graph']) + graph_fields_only(origin['driver_graph']) + + def wrap_proof(origin,suite,kind,name,role,function): + need(type(function) is types.FunctionType,'Epoch wrapper function type') + owner,first,old,chain=origin['slots'][kind,name] + p1,construction,prepared=origin['factory_results'];context=origin['context'] + if role=='construction_add':need(function is construction['add'],'Epoch original construction add product') + elif role=='p1':need(function is p1['verify_map'],'Epoch original P1 product') + elif role in ('public_label','public_residual'): + need(function is suite.products[role],'Epoch genuine public source product') + elif role=='checks_capture': + maker=origin['data_record'][2]['install_epoch_circuit'] + need(function.__code__ is _epoch_code_constant(maker.__code__,'captured_checks') and + function.__globals__ is origin['data_record'][2],'Epoch original checks observer source') + cells=_epoch_closure(function) + need(set(cells)=={'original_checks_init','capture_checks'} and cells['original_checks_init'] is old, + 'Epoch checks observer original constructor') + method=cells['capture_checks'] + need(type(method) is types.MethodType and method.__self__ is p1['owner'] and + method.__func__ is type(p1['owner']).__dict__['capture_checks'],'Epoch P1 capture method') + elif role=='phase': + check_fields(origin['phase_record']);phase=context['phase_function'];cells=_epoch_closure(function) + need(function.__code__ is _epoch_code_constant(phase.__code__,'observed') and + function.__globals__ is phase.__globals__ and set(cells)=={'self','name','original'} and + cells['self'] is context['phase_owner'] and cells['original'] is old and + type(cells['name']) is str,'Epoch genuine original phase product') + expected={('circuit','__init__'):'side_construction',('checks','__init__'):'checks_initialization', + ('module','compile_roles'):'compile_roles',('checks','verify_map'):'verify_map', + ('checks','verify_labels'):'verify_labels'} + need((kind,name) in expected and cells['name']==expected[kind,name],'Epoch phase identity') + elif role=='roles_observer': + check_fields(origin['driver_record']);maker=context['driver_function'];cells=_epoch_closure(function) + need(function.__code__ is _epoch_code_constant(maker.__code__,'observe_roles') and + function.__globals__ is maker.__globals__ and + set(cells)=={'captures','original_roles','phases'} and cells['original_roles'] is old and + cells['phases'] is context['phase_owner'] and type(cells['captures']) is dict, + 'Epoch actual role observation source') + else:need(False,'Epoch undeclared existing wrapper role') + defaults=function.__defaults__ + need(function.__kwdefaults__ is None and (type(defaults) is tuple and len(defaults)==1 and defaults[0] is None if role=='roles_observer' else defaults is None),'Epoch wrapper default contract') + return old + + def product(handle,suite,action,*args): + origin,record=suite_guard(handle,suite) + need(type(action) is str,'Epoch product action type') + if action=='product': + role,function=args + need(origin['creating'] is True or origin['suite'] is suite,'Epoch genuine source-product creator') + # Complete source factories already verified reconstructive inverses; + # both actual function and exact proof record must be in that suite. + if origin.get('suite_fields') is None:origin['suite_fields']=object.__getattribute__(suite,'__dict__') + proof=suite.proofs.get(id(function)) + need(proof is not None and proof[0] is function and suite.products[role] is function, + 'Epoch multiproduct proof member') + check_fields(raw_function0(function)) + return ledger.register_product(handle,suite,role,function, + product_graph(origin,(function,),(type(suite),))) + if action=='install': + kind,name,role,function=args + need(suite.products.get(role) is function,'Epoch registered callsite product') + old=origin['slots'][kind,name][2] + ledger.authorize(handle,kind,name,old,function,role,product_graph(origin,(function,),(type(suite),))) + ledger.install(handle,kind,name,function) + return None + if action=='existing': + kind,name,role,function=args;check_factory(origin) + old=wrap_proof(origin,suite,kind,name,role,function) + ledger.authorize(handle,kind,name,old,function,role,product_graph(origin,(function,),(type(suite),))) + ledger.install(handle,kind,name,function) + return None + need(action=='construction_init' and not args,'Epoch constructor wrapper action') + check_factory(origin);p1,construction,prepared=origin['factory_results'] + wrapper=construction['wrap_constructor'](construction['original_init'],p1['owner'].capture_c) + old=origin['slots']['circuit','__init__'][2] + ledger.authorize(handle,'circuit','__init__',old,wrapper,'construction_init',product_graph(origin,(wrapper,),(type(suite),))) + ledger.install(handle,'circuit','__init__',wrapper) + return wrapper + + def stages(handle,suite,stage,*args): + origin,record=suite_guard(handle,suite) + need(type(stage) is str,'Epoch bind stage type') + if stage=='reconcile': + need(origin['phase']=='FACTORIES_ADMITTED','Epoch prebind phase') + # Every nonnative slot was installed through the source-owned API. + ledger.check(handle);origin['phase']='CALLERS_INSTALLED';return None + if stage=='prepare': + need(origin['phase']=='CALLERS_INSTALLED' and len(args)==5,'Epoch native preparation stage') + module,label,original_functions,complement,gram=args + need(module is origin['module'] and label is origin['label'] and type(original_functions) is list, + 'Epoch actual original bind arguments') + rank_calls,trace,native,row,final_guard=suite.bind_inputs + owned(origin['backend_handle'],BACKEND_SHA256) + backend=origin['backend'];check_fields(origin['phase_record']);check_fields(origin['driver_record']) + # The original trace factory ran after original guard_module and + # before the original native closures were assigned. + oldrank=origin['slots']['module','rank'][2];traced=module.rank + cells=_epoch_closure(traced) + need(traced.__code__ is _epoch_code_constant(backend.attach_trace.__code__,'traced_rank') and + traced.__globals__ is backend.__dict__ and cells['original_rank'] is oldrank and + cells['rank_calls'] is rank_calls,'Epoch original rank trace source') + ledger.observed_transition(handle,'module','rank',oldrank,traced,'rank_trace',product_graph(origin,(traced,))) + expected_helpers=[dict(origin['items'])[name] for name in backend._HELPER_NAMES] + expected_helpers.extend(v for name,v in origin['class_map'][id(label)][2] if type(v) is types.FunctionType) + need(len(original_functions)==len(expected_helpers) and all(a is b for a,b in zip(original_functions,expected_helpers)), + 'Epoch retained original bind function list') + records=[] + for name,fn,role,native_name in (('complement_in',complement,'native_complement','complement'),('nondegenerate',gram,'native_gram','gram_rank')): + expected_code=_epoch_code_constant(suite.bind_expected_code,name) + need(backend._code_shape(fn.__code__)==backend._code_shape(expected_code) and + fn.__globals__ is backend.__dict__ and fn.__builtins__ is builtins.__dict__ and + fn.__defaults__ is None and fn.__kwdefaults__ is None,'Epoch native closure code/calling source') + values=_epoch_closure(fn);need(values.get('runtime',missing) is None,'Epoch native pending runtime') + need(values.get('label',label) is label,'Epoch native Label closure') + entry=native.__dict__[native_name] + need(type(entry) is types.BuiltinFunctionType and entry.__self__ is native and + values.get('native_complement' if name=='complement_in' else 'native_gram') is entry, + 'Epoch current native entry closure') + for field,value in values.items(): + if field=='runtime':continue + expected={'label':label,'complement_trace':trace,'rank_calls':rank_calls,'rank_row_intern':row, + 'original_complement':origin['slots']['label','complement_in'][1], + 'original_nondegenerate':origin['slots']['label','nondegenerate'][1], + 'original_dot':dict(origin['items'])['dot'],'original_rank':dict(origin['items'])['rank']}.get(field,missing) + if expected is not missing:need(value is expected,'Epoch native captured argument '+field) + elif field=='counters':need(type(value) is dict and set(value)=={'complement_native','complement_fallback','gram_native','gram_fallback'} and all(type(v) is int and v==0 for v in value.values()),'Epoch actual initial counters') + elif field not in ('native_complement','native_gram'):need(False,'Epoch unexpected native closure field '+field) + cell=dict(zip(fn.__code__.co_freevars,fn.__closure__))['runtime'] + records.append((name,fn,role,cell,raw_function0(fn))) + origin['native_pending']=tuple(records);origin['phase']='NATIVE_PRODUCTS_PREPARED';return None + if stage=='commit': + need(len(args)==1 and origin['phase']=='NATIVE_PRODUCTS_PREPARED','Epoch global commit stage') + raw=args[0];need(type(raw) is suite.bind_inputs[4],'Epoch exact actual raw guard allocation') + for name,fn,role,cell,initial in origin['native_pending']: + need(cell.cell_contents is raw,'Epoch exact fixed runtime-cell endpoint') + fields=raw_function0(fn) + need(len(fields[1])==len(initial[1]) and all(a is b for a,b in zip(fields[1],initial[1])) and len(fields[3])==len(initial[3]),'Epoch native closure fields changed') + for (oldcell,oldvalue),(newcell,newvalue) in zip(initial[3],fields[3]): + need(oldcell is newcell and (newvalue is raw if oldcell is cell else newvalue is oldvalue),'Epoch native cell transition') + old=origin['slots']['label',name][2] + ledger.observed_transition(handle,'label',name,old,fn,role,product_graph(origin,(fn,),(type(raw),))) + ledger.fix_raw_guard(handle,raw) + old=origin['slots']['module','echelon'][2];hook=suite.products['canonical'] + # Only initialization can observe GLOBALS_COMMITTED; no epoch is armed. + origin['phase']='NATIVE_PRODUCTS_PREPARED' + ledger.authorize(handle,'module','echelon',old,hook,'canonical',product_graph(origin,(hook,),(type(suite),))) + ledger.install(handle,'module','echelon',hook);origin['phase']='GLOBALS_COMMITTED' + ledger.check(handle);return None + need(stage=='finish' and len(args)==2,'Epoch final binding stage') + return ledger.finish_bind(handle,args[0],args[1]) + + def seal(handle,suite): + origin,record=suite_guard(handle,suite) + need(origin['phase']=='FINAL_CAPTURED','Epoch seal after actual final graph') + ledger.check(handle);origin['phase']='SEALED';return None + + def check(handle,suite): + origin,record=suite_guard(handle,suite) + need(origin['phase'] in ('FACTORIES_ADMITTED','CALLERS_INSTALLED','GLOBALS_COMMITTED','FINAL_CAPTURED','SEALED'), + 'Epoch current binding phase') + if 'suite_snapshot' in origin: + values=origin['suite_snapshot'] + need(all(a is b for a,b in zip(values,(suite.registry,suite.products,suite.caller_caps,suite.descriptor, + suite.prepared,suite.p1,suite.construction))),'Epoch fixed suite data binding') + for role,fn in origin.get('private_products',{}).items(): + need(suite.products.get(role) is fn,'Epoch actual product dispatch identity') + graph_fields_only(origin['driver_graph']) + ledger.check(handle);return None + + def manifest(handle): + before();origin=ledger.origin(handle) + return {'schema':'h25-epoch-source-manifest-v1','generation':origin['generation'], + 'phase':origin['phase'],'edge_count':len(origin['edges']), + 'source_sha256':'d623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1', + 'runtime_admission':False,'full_execution_contract':None} + + # This fence owns failed installations. It runs metadata disposal only; + # no failed source/native check is retried and no origin is recaptured. + engine_guard() + getattrs=object.__getattribute__;setattrs=object.__setattr__ + ledger_fields=getattrs(ledger,'__dict__');origins0=ledger_fields['origins'] + failure_box=[None] + clear0=dict.clear;get0=dict.get;type0=type;id0=id;dict0=dict;str0=str + def failed(handle,error): + origin=get0(origins0,id0(handle)) + if origin is None or get0(origin,'handle') is not handle:return None + origin['phase']='FAILED' + if origin['primary_error'] is None:origin['primary_error']=error + if failure_box[0] is None:failure_box[0]=error + # Do not write a rejected/current instance namespace here. The actual + # origin/Suite dictionaries and independent failure_box own P; Core.fail + # remains the legitimate source transition for its diagnostic scalar. + suite=get0(origin,'suite') + if suite is None:return None + fields=get0(origin,'suite_fields') + if fields is None:return None + if get0(fields,'primary_error') is None:fields['primary_error']=error + fields['active']=False;fields['terminal']=True;fields['pending']=None + fields['checks']=None;fields['checks_c']=None;fields['checks_h']=None + try: + registry=get0(fields,'registry') + if type0(registry) is not dict0:raise RuntimeError('Epoch failed registry is not exact metadata dict') + clear0(registry) + except BaseException as secondary: + origin['uncertain']=True;fields['uncertain']=True + if origin['secondary_error'] is None:origin['secondary_error']=secondary + if get0(fields,'secondary_error') is None:fields['secondary_error']=secondary + return None + + def plain0(value): + if type0(value) is not dict0:return False + for key in value: + if type0(key) is not str0:return False + return True + + def protect(function): + def operation(*args,**kwargs): + try: + engine_guard() + return function(*args,**kwargs) + except BaseException as primary: + if function is admit: + if len(args)==8 and type0(args[0]) is str and args[0]=='factories': + context=args[-1] + if plain0(context): + state=get0(context,'disposition_state') + record=get0(state,'epoch_acquisition') if plain0(state) else None + if plain0(record): + if get0(record,'primary') is None:record['primary']=primary + handle=get0(record,'origin_handle') + if handle is not None:failed(handle,primary) + elif args:failed(args[0],primary) + raise + return operation + + return tuple(protect(fn) for fn in (admit,derive,product,stages,seal,check,manifest)) + + +EPOCH_CACHE_SHA256 = '20a8a94e96bfa6213d4f04244dabecf059b4c8c7e8ffa7e9409a8b87cfeef494' +EPOCH_DATA_SHA256 = '18679fd1eb6ae99c4b375756511427c26718f77674c2d8fcc490e25ceb47cba5' +EPOCH_SET_SHA256 = 'eeeead34731e73f74dff250f354e57b72314c4e18670848bfa9f48c87de1305d' +EPOCH_CONSTRUCTION_SHA256 = 'ed7fd6c8a93c524c4d28245e48d75d6b949234a5a60f6affb8025f27ef9506b5' +EPOCH_REFERENCE_DRIVER_SHA256 = '8027a1b24d08a598c2aa9e91cfe791edd58d1b87b17ce5957cee2d5da49d5c2f' + +def capture_epoch_authority(root, capability, api): + """Return load/invoke/check/runtime_guard/check_product/set_guard/source. + + The trusted parent calls this entry once immediately after raw source exec. + A later backend instance derives provenance from this original token; it + cannot substitute a newly captured stdlib or a self-reported class record. + """ + if _CAPTURE_ONCE: + raise RuntimeError('Cold authority can only be captured once before exposure') + _CAPTURE_ONCE.append(True) + type0, id0, len0, next0, tuple0, list0 = type, id, len, next, tuple, list + dict0, str0, bytes0, object0, int0 = dict, str, bytes, object, int + error0, base_error0, value_error0 = RuntimeError, BaseException, ValueError + function_type, module_type, code_type = types.FunctionType, types.ModuleType, types.CodeType + builtin_type, cell_type = types.BuiltinFunctionType, types.CellType + static_type, class_type, property_type = staticmethod, classmethod, property + dict_get, dict_items, dict_iter = dict.get, dict.items, dict.__iter__ + dict_len, dict_set, dict_del, dict_clear = dict.__len__, dict.__setitem__, dict.__delitem__, dict.clear + object_get = object.__getattribute__ + type_get = type.__getattribute__ + module_dict_get = module_type.__dict__['__dict__'].__get__ + class_dict_get = type.__dict__['__dict__'].__get__ + class_mro_get = type.__dict__['__mro__'].__get__ + cell_get = cell_type.__dict__['cell_contents'].__get__ + function_fields = tuple((name, function_type.__dict__[name].__get__) for name in + ('__code__', '__globals__', '__builtins__', '__defaults__', + '__kwdefaults__', '__closure__', '__dict__')) + proxy_type = type(type.__dict__) + proxy_get, proxy_iter, proxy_items, proxy_len = proxy_type.get, proxy_type.__iter__, proxy_type.items, proxy_type.__len__ + builtin_self_get = builtin_type.__dict__['__self__'].__get__ + builtin_namespace = builtins.__dict__ + missing = object0() + missing_id = id0(missing) + initial_sys_modules = sys.modules + initial_sys_flags = sys.flags + initial_optimize = sys.flags.optimize + sys_owner = sys + sys_namespace = module_dict_get(sys_owner, module_type) + authority_namespace = globals() + root_pin, provider_pin, backend_pin = ROOT_SHA256, PROVIDER_SHA256, BACKEND_SHA256 + cache_pin = EPOCH_CACHE_SHA256 + max_source, max_functions, max_classes = 1048576, 8192, 2048 + registry, by_namespace, products, backend_guards = {}, {}, {}, {} + transitions = [] + ledger = EpochLedger() + bundle_cell = [] + descriptor_cell = [] + engine_class = EpochLedger + engine_mro = class_mro_get(engine_class, type0) + engine_members = tuple0(proxy_items(class_dict_get(engine_class,type0))) + engine_dict_get = proxy_get(class_dict_get(engine_class,type0),'__dict__').__get__ + engine_namespace = engine_dict_get(ledger,engine_class) + if type0(engine_namespace) is not dict0:raise error0('Epoch engine instance dictionary differs') + initial_iterator=initial_key=None + initial_valid=True + try: + initial_iterator=dict_iter(engine_namespace) + while True: + initial_key=next0(initial_iterator,missing) + if initial_key is missing:break + if type0(initial_key) is not str0:initial_valid=False;break + initial_key=None + finally:initial_iterator=initial_key=None + if not initial_valid:raise error0('Epoch engine instance key domain differs') + engine_namespace_names = tuple0(dict_iter(engine_namespace)) + engine_origins = dict_get(engine_namespace,'origins',missing) + engine_class_origin = dict_get(engine_namespace,'class_origin',missing) + engine_method_origin = dict_get(engine_namespace,'method_origin',missing) + engine_functions = tuple0((value,tuple0(getter(value,function_type) for _,getter in function_fields)) + for name,value in engine_members if type0(value) is function_type) + def engine_guard(): + if type0(ledger) is not engine_class or class_mro_get(engine_class,type0) is not engine_mro: + raise error0('Epoch engine class identity differs') + actual_namespace=engine_dict_get(ledger,engine_class) + if type0(actual_namespace) is not dict0 or actual_namespace is not engine_namespace: + raise error0('Epoch engine instance namespace differs') + iterator=current=None + valid_domain=True + try: + iterator=dict_iter(actual_namespace) + while True: + current=next0(iterator,missing) + if current is missing:break + if type0(current) is not str0:valid_domain=False;break + current=None + finally:iterator=current=None + if not valid_domain:raise error0('Epoch engine instance key domain differs') + if dict_len(actual_namespace)!=len0(engine_namespace_names): + raise error0('Epoch engine instance member census differs') + for field in engine_namespace_names: + if dict_get(actual_namespace,field,missing) is missing: + raise error0('Epoch engine instance member binding differs') + if dict_get(actual_namespace,'origins',missing) is not engine_origins: + raise error0('Epoch engine instance origins binding differs') + if dict_get(actual_namespace,'class_origin',missing) is not engine_class_origin or dict_get(actual_namespace,'method_origin',missing) is not engine_method_origin: + raise error0('Epoch engine fixed record binding differs') + current_phase=dict_get(actual_namespace,'phase',missing) + current_serial=dict_get(actual_namespace,'serial',missing) + current_failure=dict_get(actual_namespace,'failure',missing) + if type0(current_phase) is not str0 or current_phase not in ('COLD','ORIGINAL'): + raise error0('Epoch engine phase schema differs') + if type0(current_serial) is not int0 or current_serial<0 or current_serial>1 or (current_phase=='ORIGINAL' and current_serial!=1): + raise error0('Epoch engine serial schema differs') + # COLD/1 is a real in-progress or failed original capture interval. + # failure is None or an actual native BaseException subclass instance; + # the native type MRO avoids arbitrary __class__/isinstance callbacks. + if current_failure is not None: + failure_type=type0(current_failure) + failure_bases=class_mro_get(failure_type,type0) + valid_failure=False + for base in failure_bases: + if base is base_error0:valid_failure=True;break + if not valid_failure:raise error0('Epoch engine failure schema differs') + proxy=class_dict_get(engine_class,type0) + if proxy_len(proxy)!=len0(engine_members):raise error0('Epoch engine class census differs') + for name,value in engine_members: + if proxy_get(proxy,name,missing) is not value:raise error0('Epoch engine class binding differs') + for function,fields in engine_functions: + for (_,getter),expected in zip0(function_fields,fields): + if getter(function,function_type) is not expected:raise error0('Epoch engine method environment differs') + initial_std_modules = (_ast, ast, copy, copyreg, genericpath, hashlib, io, + ntpath, os, pathlib, posixpath, types) + producer_rules = ( + ('320435ec4125544f2b2aedf74f21469b232d08683fe76f0913607516254bbd29', 'make_runtime_guard', 'backend_guard'), + ('f7ca7f4f03ac63c1a95ba42f06149543211566de5e29f487a3dc4d08c5ee9b94', 'extra_guard_type', 'extra_guard'), + ('4bdb401271ffd049c52eff0edc28d8d604a11faf66fec419555a82cbd3b32d60', 'make_trace_type', 'trace'), + ('364b45c100be73a7ace44ab664f3c792020dad6f33f7788b62aaeab67c0c5aa9', 'make_row_interner', 'row_function'), + ('364b45c100be73a7ace44ab664f3c792020dad6f33f7788b62aaeab67c0c5aa9', 'make_runtime_guard', 'row_guard'), + ('364b45c100be73a7ace44ab664f3c792020dad6f33f7788b62aaeab67c0c5aa9', 'make_cache_runtime_guard', 'row_guard'), + ('5aeee9364d29147ef4e1bfffba532f7392833a6158d73d1da50ed6c772f061af', 'derive_row_bind', 'row_bind'), + (cache_pin, 'compose_runtime_guard', 'cache_guard'), + (cache_pin, 'compose_epoch_runtime_guard', 'epoch_guard')) + + def need(ok, message): + if not ok: + raise error0(message) + + def string_domain(owner, domains): + key = iterator = kind = None + try: + identity = id0(owner) + prior = dict_get(domains, identity, missing) + if prior is not missing: + return prior + kind = type0(owner) + if kind is dict0: + iterator = dict_iter(owner) + elif kind is proxy_type: + iterator = proxy_iter(owner) + else: + return False + while True: + key = next0(iterator, missing) + if key is missing: + break + if type0(key) is not str0: + dict_set(domains, identity, False) + return False + key = None + dict_set(domains, identity, True) + return True + finally: + key = iterator = kind = owner = None + + def get_id(owner, name, domains): + try: + if type0(name) is not str0 or not string_domain(owner, domains): + return -1 + if type0(owner) is dict0: + return id0(dict_get(owner, name, missing)) + return id0(proxy_get(owner, name, missing)) + finally: + owner = None + + def identity_mapping(owner, expected): + """Non-string dispatch dictionaries: identity scan, never key equality.""" + iterator = pair = key = value = None + try: + if type0(owner) is not dict0 or dict_len(owner) != len0(expected): + return False + iterator = iter0(dict_items(owner)) + while True: + pair = next0(iterator, missing) + if pair is missing: + break + key, value = pair + found = False + for old_key, old_value in expected: + if key is old_key: + if value is not old_value: + return False + found = True + break + if not found: + return False + pair = key = value = None + return True + finally: + iterator = pair = key = value = owner = None + + iter0 = iter + + def code_names(code): + pending, result, seen = [code], [], {} + while pending: + current = pending.pop() + need(type0(current) is code_type, 'Cold authority code shape differs') + for name in current.co_names: + need(type0(name) is str0, 'Cold authority code name shape differs') + if dict_get(seen, name, missing) is missing: + dict_set(seen, name, True) + result.append(name) + for value in current.co_consts: + if type0(value) is code_type: + pending.append(value) + return tuple0(result) + + def raw_function_record(function): + need(type0(function) is function_type, 'Cold authority requires exact functions') + values = tuple0(getter(function, function_type) for _, getter in function_fields) + code, namespace, builtins_owner, defaults, keywords, closure, attributes = values + domains = {} + try: + need(type0(namespace) is dict0 and type0(builtins_owner) is dict0 and + string_domain(namespace, domains) and string_domain(builtins_owner, domains), + 'Cold authority initial function dictionary domain differs') + keyword_items = () + if keywords is not None: + need(type0(keywords) is dict0 and string_domain(keywords, domains), + 'Cold authority initial keyword defaults differ') + keyword_items = tuple0(dict_items(keywords)) + cells = () if closure is None else tuple0((cell, cell_get(cell, cell_type)) for cell in closure) + lookups = tuple0((name, dict_get(namespace, name, missing), dict_get(builtins_owner, name, missing)) + for name in code_names(code)) + need(type0(attributes) is dict0 and string_domain(attributes, domains), + 'Cold authority function attribute dictionary differs') + return (function, values, keyword_items, cells, lookups, tuple0(dict_items(attributes))) + finally: + dict_clear(domains) + + def capture_graph(initial_functions, initial_classes): + """Called only at initial source load or directly after an admitted producer.""" + functions, classes, seen_functions, seen_classes = [], [], {}, {} + pending_functions, pending_classes = list0(initial_functions), list0(initial_classes) + while pending_functions or pending_classes: + while pending_classes: + cls = pending_classes.pop() + need(type0(cls) is type0, 'Cold authority class metaclass differs') + if dict_get(seen_classes, id0(cls), missing) is not missing: + continue + need(len0(classes) < max_classes, 'Cold authority class census exceeds bound') + dict_set(seen_classes, id0(cls), cls) + mro = class_mro_get(cls, type0) + proxy = class_dict_get(cls, type0) + engine_guard() + canonical_class = ledger.original_class(cls) + members = tuple0(proxy_items(proxy)) if canonical_class is None else canonical_class[3] + classes.append((cls, mro, proxy, members) if canonical_class is None else canonical_class) + for base in mro[1:]: + if type0(base) is type0: + pending_classes.append(base) + for name, value in members: + need(type0(name) is str0, 'Cold authority class member name differs') + kind = type0(value) + if kind is function_type: + pending_functions.append(value) + elif kind is static_type or kind is class_type: + underlying = object_get(value, '__func__') + if type0(underlying) is function_type: + pending_functions.append(underlying) + elif kind is property_type: + for field in ('fget', 'fset', 'fdel'): + underlying = object_get(value, field) + if type0(underlying) is function_type: + pending_functions.append(underlying) + if pending_functions: + function = pending_functions.pop() + if dict_get(seen_functions, id0(function), missing) is not missing: + continue + need(len0(functions) < max_functions, 'Cold authority function census exceeds bound') + engine_guard() + canonical_function = ledger.original_record(function) + record = raw_function_record(function) if canonical_function is None else canonical_function + dict_set(seen_functions, id0(function), function) + functions.append(record) + for cell, value in record[3]: + if type0(value) is function_type: + pending_functions.append(value) + defaults = record[1][3] + if defaults is not None: + need(type0(defaults) is tuple0, 'Cold authority positional defaults shape differs') + for value in defaults: + if type0(value) is function_type: + pending_functions.append(value) + for name, value in record[2] + record[5]: + if type0(value) is function_type: + pending_functions.append(value) + # Source-owned function helpers reached through effective globals + # are authenticated transitively, including validator helpers. + for name, value, builtin_value in record[4]: + if type0(value) is function_type: + pending_functions.append(value) + return (tuple0(functions), tuple0(classes)) + + def expected_global(namespace, name, expected, original_record=None): + engine_guard() + if original_record is not None: + projected = ledger.expected_lookup(original_record,namespace,name,expected) + else: + projected = ledger.expected(namespace,name,expected) + if projected is not expected:return projected + if name != 'RuntimeGuard': + return expected + record = dict_get(by_namespace, id0(namespace), missing) + if record is not missing and record[2] is namespace and record[12] == 'backend': + return dict_get(backend_guards, id0(record[0]), missing) + return expected + + def fresh_function(record, domains, builtin_values): + function, values, keyword_items, cells, lookups, attributes_items = record + if type0(function) is not function_type: + return False + field_key = ('function-fields', id0(function)) + observed_fields = dict_get(domains, field_key, missing) + if observed_fields is missing: + scalar_fields = [] + for (_, getter), expected in zip0(function_fields, values): + observed_id = id0(getter(function, function_type)) + if observed_id != id0(expected): + return False + scalar_fields.append(observed_id) + dict_set(domains, field_key, tuple0(scalar_fields)) + else: + if len0(observed_fields) != len0(values): + return False + for observed_id, expected in zip0(observed_fields, values): + if observed_id != id0(expected): + return False + code, namespace, builtins_owner, defaults, keywords, closure, attributes = values + if keywords is not None: + if type0(keywords) is not dict0 or dict_len(keywords) != len0(keyword_items): + return False + for name, expected in keyword_items: + if get_id(keywords, name, domains) != id0(expected): + return False + for cell, expected in cells: + try: + if id0(cell_get(cell, cell_type)) != id0(expected): + return False + except value_error0: + return False + if dict_len(attributes) != len0(attributes_items): + return False + for name, expected in attributes_items: + if get_id(attributes, name, domains) != id0(expected): + return False + lookup_key = ('function-lookups', id0(function), id0(code), + id0(namespace), id0(builtins_owner)) + observed_lookups = dict_get(domains, lookup_key, missing) + if observed_lookups is missing: + scalar_lookups = [] + for name, expected, expected_builtin in lookups: + observed_global = get_id(namespace, name, domains) + if observed_global != id0(expected_global(namespace, name, expected, record)): + return False + # A false builtin_values path must not observe builtin keys or + # values. The absent slot is completed only in a later true path. + if builtin_values: + observed_builtin = get_id(builtins_owner, name, domains) + if observed_builtin != id0(expected_builtin): + return False + scalar_lookups.append((name, observed_global, True, observed_builtin)) + else: + scalar_lookups.append((name, observed_global, False, 0)) + dict_set(domains, lookup_key, tuple0(scalar_lookups)) + else: + if len0(observed_lookups) != len0(lookups): + return False + completed_lookups = None + index = 0 + for (name, expected, expected_builtin), observed in zip0(lookups, observed_lookups): + if observed[0] != name: + return False + if observed[1] != id0(expected_global(namespace, name, expected, record)): + return False + if builtin_values: + if observed[2]: + observed_builtin = observed[3] + else: + observed_builtin = get_id(builtins_owner, name, domains) + if observed_builtin != id0(expected_builtin): + return False + if not observed[2]: + if completed_lookups is None: + completed_lookups = list0(observed_lookups) + completed_lookups[index] = (name, observed[1], True, observed_builtin) + index += 1 + if completed_lookups is not None: + dict_set(domains, lookup_key, tuple0(completed_lookups)) + return True + + zip0 = zip + + def fresh_graph(graph, domains, builtin_values, message): + functions, classes = graph + for cls, mro, proxy, members in classes: + if not (type0(cls) is type0 and class_mro_get(cls, type0) is mro and + proxy_len(proxy) == len0(members)): + need(False, message + ': class dispatch') + for name, expected in members: + if not (get_id(proxy, name, domains) == id0(ledger.projected_member(cls, name, expected))): + need(False, message + ': class member ' + name) + for record in functions: + if not (fresh_function(record, domains, builtin_values)): + need(False, message + ': function environment') + + def module_image(module, name, kind, path, digest, source_bytes, *, stdlib=False): + need(type0(module) is module_type, 'Cold authority module exact type differs') + namespace = module_dict_get(module, module_type) + domains = {} + try: + need(type0(namespace) is dict0 and string_domain(namespace, domains), + 'Cold authority module dictionary domain differs') + items = tuple0(dict_items(namespace)) + functions, classes = [], [] + for field, value in items: + if type0(value) is function_type: + if stdlib or value.__globals__ is namespace: + functions.append(value) + elif type0(value) is type0: + declared = type_get(value, '__module__') + if stdlib or (type0(declared) is str0 and declared == name): + classes.append(value) + graph = capture_graph(functions, classes) + mappings = [] + selected = ('_CANONICAL_BUILTINS', '_TYPE_BUILTINS') if kind == 'backend' else () + for field in selected: + mapping = dict_get(namespace, field, missing) + need(type0(mapping) is dict0, 'Cold authority backend dispatch dictionary differs') + mappings.append((field, mapping, tuple0(dict_items(mapping)))) + original_guard = dict_get(namespace, 'RuntimeGuard', missing) if kind == 'backend' else None + if kind == 'backend': + need(type0(original_guard) is type0, 'Cold authority original RuntimeGuard differs') + handle = object0() + return (handle, module, namespace, name, path, digest, source_bytes, + items, graph[0], graph[1], tuple0(mappings), original_guard, kind) + finally: + dict_clear(domains) + + def record_for(handle): + record = dict_get(registry, id0(handle), missing) + need(record is not missing and record[0] is handle, 'Cold authority handle is not registered') + return record + + def fresh_module(record, domains, builtin_values, *, registry_slot=True, exact_census=True, prefix='Cold authority'): + module, namespace = record[1], record[2] + if not (type0(module) is module_type and module_dict_get(module, module_type) is namespace): + need(False, prefix + ': module owner differs') + if registry_slot: + if not (get_id(initial_sys_modules, record[3], domains) == id0(module)): + need(False, prefix + ': registered module slot differs') + if exact_census: + if not (dict_len(namespace) == len0(record[7])): + need(False, prefix + ': namespace census differs') + for name, expected in record[7]: + if not (get_id(namespace, name, domains) == id0(expected_global(namespace, name, expected))): + need(False, prefix + ': namespace binding ' + name) + for name, mapping, expected in record[10]: + if not (identity_mapping(mapping, expected)): + need(False, prefix + ': dispatch dictionary ' + name) + fresh_graph((record[8], record[9]), domains, builtin_values, prefix) + + need(type0(root) is module_type and type0(api) is tuple0 and len0(api) == 4, + 'Cold authority requires the actual pristine root and sealed fourtuple') + root_namespace = module_dict_get(root, module_type) + root_api_graph = capture_graph(api, ()) + root_hash = dict_get(root_namespace, '_hash_regular', missing) + root_compile = dict_get(root_namespace, '_COMPILE', missing) + root_exec = dict_get(root_namespace, '_EXEC', missing) + root_identity = api[0] + initial_builtin_items = tuple0(dict_items(builtin_namespace)) + stdlib_records = tuple0(module_image(module, module.__name__, 'stdlib', None, None, None, stdlib=True) + for module in initial_std_modules) + stdlib_mappings = tuple0((mapping, tuple0(dict_items(mapping))) for mapping in + (copy._deepcopy_dispatch, copy.dispatch_table, copyreg.dispatch_table)) + self_graph = capture_graph((dict_get(authority_namespace, 'capture_epoch_authority'),), (EpochLedger,)) + self_items = tuple0(dict_items(authority_namespace)) + + def root_and_stdlib(domains): + need(type0(sys_owner) is module_type and module_dict_get(sys_owner, module_type) is sys_namespace and + get_id(sys_namespace, 'modules', domains) == id0(initial_sys_modules) and + get_id(sys_namespace, 'flags', domains) == id0(initial_sys_flags), + 'Cold authority interpreter owner differs') + need(dict_len(builtin_namespace) == len0(initial_builtin_items), 'Cold authority builtin census differs') + for name, expected in initial_builtin_items: + need(get_id(builtin_namespace, name, domains) == id0(expected), 'Cold authority builtin binding ' + name) + for name, expected in self_items: + need(get_id(authority_namespace, name, domains) == id0(expected), 'Cold authority source binding ' + name) + fresh_graph(self_graph, domains, True, 'Cold authority source') + fresh_graph(root_api_graph, domains, True, 'Cold authority root entry') + dict_clear(domains) + need(root_identity() == root_pin, 'Cold authority actual root source identity differs') + dict_clear(domains) + for record in stdlib_records: + fresh_module(record, domains, True, registry_slot=True, exact_census=False, prefix='Cold authority initial stdlib') + for mapping, expected in stdlib_mappings: + need(identity_mapping(mapping, expected), 'Cold authority initial copy dispatch differs') + + def check_registered(domains): + for record in tuple0(registry.values()): + fresh_module(record, domains, True) + for product_record in tuple0(products.values()): + fresh_graph(product_record[5], domains, True, 'Epoch current registered source product') + + def cold_check(handle=None): + domains = {} + try: + root_and_stdlib(domains) + check_registered(domains) + if handle is not None: + record = record_for(handle) + dict_clear(domains) + digest, size, raw = root_hash(record[4], max_source, False) + need(digest == record[5], 'Cold authority source file changed') + return record + return None + finally: + dict_clear(domains) + + def load(path, digest, name, kind='module'): + cold_check() + need(type0(path) is str0 and path.startswith('/') and type0(digest) is str0 and len0(digest) == 64 and + type0(name) is str0 and name and type0(kind) is str0 and kind in ('module', 'backend'), + 'Cold authority source-load argument shape differs') + for character in digest: + need(character in '0123456789abcdef', 'Cold authority source digest is not lowercase SHA256') + need((kind == 'backend') == (digest == backend_pin), 'Cold authority original backend classification differs') + domains = {} + try: + need(get_id(initial_sys_modules, name, domains) == missing_id, 'Cold authority module name already registered') + finally: + dict_clear(domains) + observed, size, source_bytes = root_hash(path, max_source, True) + need(observed == digest and type0(source_bytes) is bytes0, 'Cold authority source bytes differ') + module = module_type(name) + namespace = module_dict_get(module, module_type) + namespace.update({'__file__': path, '__builtins__': builtin_namespace}) + # Dataclass/import ownership sees the correct unique slot during exec. + dict_set(initial_sys_modules, name, module) + try: + code = root_compile(source_bytes, path, 'exec', dont_inherit=True, optimize=initial_optimize) + root_exec(code, namespace) + record = module_image(module, name, kind, path, digest, source_bytes) + dict_set(registry, id0(record[0]), record) + dict_set(by_namespace, id0(namespace), record) + if kind == 'backend': + dict_set(backend_guards, id0(record[0]), record[11]) + cold_check(record[0]) + except base_error0: + # A failed source is retained in the unique slot for evidence and + # cannot be retried/reclassified as an unobserved clean load. + raise + return (module, record[0]) + + def make_caller_descriptor(operations, label): + """Mint only at original capture or an authenticated entry-three return. + + The caller checks the dispatcher record INLINE before invoking it. This + is not a claim that the dispatcher can authenticate its own replacement + code. Its already-admitted active frame checks all target/helper objects. + """ + pending, seen, records = list0(operations), {}, [] + # Authenticate every borrowed ledger/support helper before invocation. + pending.extend(value for name,value in tuple0(dict_items(authority_namespace)) if type0(value) is function_type) + pending.extend(value for name,value in engine_members if type0(value) is function_type) + while pending: + function = pending.pop() + if dict_get(seen, id0(function), missing) is not missing: + continue + need(len0(records) < max_functions, 'Cold authority caller helper census exceeds bound') + raw = raw_function_record(function) + record = (function,) + raw[1][:6] + (raw[2], raw[3]) + dict_set(seen, id0(function), function) + records.append(record) + for cell, value in record[8]: + if type0(value) is function_type: + pending.append(value) + records = tuple0(records) + field_getters = function_fields[:6] + primitives = (type0, function_type, id0, len0, field_getters, cell_type, + cell_get, error0, value_error0, tuple0, dict0, str0, + dict_get, dict_len, dict_iter, next0, dict_clear, missing, zip0) + + def dispatch(index, *args, **kwargs): + # The active caller has already authenticated this actual function. + # This pretarget block uses captured C primitives only. In particular + # it does not call need(), fresh_function(), or any other validator. + if type0(index) is not int0 or index < 0 or index >= len0(operations): + raise error0(label + ': operation index differs') + for record in records: + function = record[0] + if type0(function) is not function_type: + raise error0(label + ': target exact function differs') + for (name, getter), expected in zip0(field_getters, record[1:7]): + if id0(getter(function, function_type)) != id0(expected): + raise error0(label + ': target function environment differs') + keywords = record[5] + if keywords is not None: + if type0(keywords) is not dict0 or dict_len(keywords) != len0(record[7]): + raise error0(label + ': target keyword census differs') + iterator = current = None + valid_domain = True + try: + iterator = dict_iter(keywords) + while True: + current = next0(iterator, missing) + if current is missing: + break + if type0(current) is not str0: + valid_domain = False + break + current = None + finally: + # Foreign current keys never survive a retained error. + iterator = current = None + if not valid_domain: + raise error0(label + ': target keyword key domain differs') + for name, expected in record[7]: + if id0(dict_get(keywords, name, missing)) != id0(expected): + raise error0(label + ': target keyword value differs') + for cell, expected in record[8]: + try: + observed_id = id0(cell_get(cell, cell_type)) + except value_error0: + raise error0(label + ': target closure became empty') from None + if observed_id != id0(expected): + raise error0(label + ': target closure value differs') + # The chosen function object comes from the original immutable + # operations tuple, not a mutable late attribute or caller registry. + if bundle_cell: + attrs = function_fields[6][1](bundle_cell[0][1][0], function_type) + iterator = current = None + valid = type0(attrs) is dict0 and dict_len(attrs)==2 + try: + if valid: + iterator=dict_iter(attrs) + while True: + current=next0(iterator,missing) + if current is missing:break + if type0(current) is not str0:valid=False;break + current=None + finally:iterator=current=None + if not valid or dict_get(attrs,'_h25_epoch_bundle',missing) is not bundle_cell[0]: + raise error0('Epoch immutable bootstrap bundle transport differs') + if dict_get(attrs,'_h25_caller_descriptor',missing) is not descriptor_cell[0]: + raise error0('Epoch original caller descriptor transport differs') + return operations[index](*args, **kwargs) + + raw_dispatch = raw_function_record(dispatch) + dispatch_record = (dispatch,) + raw_dispatch[1][:6] + (raw_dispatch[2], raw_dispatch[3]) + need(dispatch_record[4] is None and dispatch_record[5] is None and not dispatch_record[7], + 'Cold authority dispatcher source defaults contract differs') + return ('h25-cold-authority-caller-v1', operations, dispatch, + dispatch_record, records, primitives) + + def runtime_guard(handle): + record = cold_check(handle) + def guarded_helpers(): + domains = {} + try: + fresh_module(record, domains, False, prefix='Runtime drift: cache collector') + finally: + dict_clear(domains) + child_descriptor = make_caller_descriptor((guarded_helpers,), 'Runtime drift: cache collector caller') + return (guarded_helpers, child_descriptor) + + def known_backend(module): + need(type0(module) is module_type, 'Cold authority producer backend type differs') + namespace = module_dict_get(module, module_type) + record = dict_get(by_namespace, id0(namespace), missing) + need(record is not missing and record[1] is module and record[12] == 'backend' and record[5] == backend_pin, + 'Cold authority producer backend provenance differs') + return record + + def known_guard(cls): + need(type0(cls) is type0, 'Cold authority exact guard class differs') + for record in tuple0(registry.values()): + if record[12] == 'backend' and cls is record[11]: + return None + product = dict_get(products, id0(cls), missing) + need(product is not missing and product[0] is cls and product[6] in + ('backend_guard', 'extra_guard', 'row_guard', 'cache_guard', 'epoch_guard'), + 'Cold authority guard was not produced by an admitted source') + domains = {} + try: + fresh_graph(product[5], domains, True, 'Cold authority producer base product') + finally: + dict_clear(domains) + return product + + def classify(record, export): + for digest, name, role in producer_rules: + if digest is not None and record[5] == digest and export == name: + return role + return None + + def validate_producer_arguments(record, export, role, args, kwargs): + domains = {} + try: + need(type0(kwargs) is dict0 and string_domain(kwargs, domains) and not kwargs, + 'Cold authority reviewed producers require positional arguments') + if role == 'backend_guard': + need(len0(args) == 1, 'Cold authority backend guard arguments differ') + known_backend(args[0]) + elif role == 'extra_guard': + need(len0(args) == 3 and type0(args[2]) is tuple0, 'Cold authority trace guard arguments differ') + known_guard(args[0]); known_backend(args[1]) + for entry in args[2]: + need(type0(entry) is tuple0 and len0(entry) == 3, + 'Cold authority trace entry shape differs') + owner, name, function = entry + need(type0(owner) is module_type and type0(name) is str0 and + type0(function) is builtin_type and + builtin_self_get(function, builtin_type) is owner and + get_id(module_dict_get(owner, module_type), name, domains) == id0(function), + 'Cold authority trace entry owner differs') + elif role == 'trace': + need(len0(args) == 2 and type0(args[1]) is module_type, 'Cold authority trace producer arguments differ') + known_backend(args[0]) + elif role == 'row_function': + need(not args, 'Cold authority row interner arguments differ') + elif role == 'row_guard': + need(len0(args) == 2, 'Cold authority row guard arguments differ') + known_guard(args[0]) + product = dict_get(products, id0(args[1]), missing) + need(product is not missing and product[0] is args[1] and product[1] is record[0] and + product[2] == 'make_row_interner' and product[6] == 'row_function', + 'Cold authority row helper provenance differs') + fresh_graph(product[5], domains, True, 'Cold authority producer row helper') + elif role == 'cache_guard': + need(len0(args) == 2 and type0(args[1]) is dict0 and string_domain(args[1], domains), + 'Cold authority cache guard arguments differ') + known_guard(args[0]) + owner = dict_get(args[1], 'owner', missing) + need(type0(owner) is dict_get(record[2], '_Owner', missing), + 'Cold authority prepared cache owner class differs') + elif role == 'epoch_guard': + need(len0(args)==2, 'Epoch guard exact source arguments') + known_guard(args[0]) + suite=args[1] + need(type0(suite) is dict_get(record[2], '_EpochSuite', missing), 'Epoch guard source suite class') + origin=ledger.origin(suite.handle) + need(origin['suite'] is suite and origin['cache_handle'] is record[0], 'Epoch guard actual source generation') + elif role == 'row_bind': + need(len0(args) == 2 and type0(args[0]) is function_type and type0(args[1]) is bytes0, + 'Cold authority row bind arguments differ') + found = False + for backend_record in tuple0(registry.values()): + if (backend_record[12] == 'backend' and args[0] is dict_get(backend_record[2], 'bind', missing) and + args[1] is backend_record[6]): + found = True + break + need(found, 'Cold authority row bind is not the original registered function/source') + finally: + dict_clear(domains) + + def invoke(handle, export, *args, **kwargs): + record = cold_check(handle) + need(type0(export) is str0, 'Cold authority export name must be exact str') + function = dict_get(record[2], export, missing) + need(type0(function) is function_type and function.__globals__ is record[2], + 'Cold authority export is not an owned source function') + role = classify(record, export) + if role is not None: + validate_producer_arguments(record, export, role, args, kwargs) + result = function(*args, **kwargs) + if role is not None: + # Do not retain a row producer's enclosing tuple or mutable AST. + product = result[0] if type0(result) is tuple0 and len0(result) and type0(result[0]) is function_type else result + expected_kind = function_type if role in ('row_function', 'row_bind') else type0 + need(type0(product) is expected_kind and dict_get(products, id0(product), missing) is missing, + 'Cold authority producer did not return a fresh exact product') + graph = capture_graph((product,) if expected_kind is function_type else (), + (product,) if expected_kind is type0 else ()) + product_record = (product, handle, export, args, tuple0(dict_items(kwargs)), graph, role) + dict_set(products, id0(product), product_record) + domains = {} + try: + fresh_graph(graph, domains, True, 'Cold authority new product') + finally: + dict_clear(domains) + return result + + def check_product(obj, producer_handle, export, args_tuple, kwargs_dict): + record_for(producer_handle) + cold_check(producer_handle) + need(type0(args_tuple) is tuple0 and type0(kwargs_dict) is dict0 and type0(export) is str0, + 'Cold authority product proof arguments differ') + product = dict_get(products, id0(obj), missing) + need(product is not missing and product[0] is obj and product[1] is producer_handle and product[2] == export, + 'Cold authority product provenance differs') + need(len0(args_tuple) == len0(product[3]), 'Cold authority product positional census differs') + for actual, expected in zip0(args_tuple, product[3]): + need(actual is expected, 'Cold authority product positional identity differs') + domains = {} + try: + need(dict_len(kwargs_dict) == len0(product[4]), 'Cold authority product keyword census differs') + for name, expected in product[4]: + need(get_id(kwargs_dict, name, domains) == id0(expected), 'Cold authority product keyword identity differs') + fresh_graph(product[5], domains, True, 'Cold authority registered product') + finally: + dict_clear(domains) + return None + + def set_backend_guard(handle, cls): + record = cold_check(handle) + need(record[12] == 'backend', 'Cold authority guard transition requires original backend') + product = known_guard(cls) + domains = {} + try: + if product is not None: + fresh_graph(product[5], domains, True, 'Cold authority guard transition product') + old = dict_get(backend_guards, id0(handle), missing) + need(dict_get(record[2], 'RuntimeGuard', missing) is old, + 'Cold authority backend guard changed outside the transition ledger') + dict_clear(domains) + dict_set(record[2], 'RuntimeGuard', cls) + dict_set(backend_guards, id0(handle), cls) + transitions.append((handle, old, cls, product)) + fresh_module(record, domains, True) + finally: + dict_clear(domains) + return None + + def source(handle): + record = cold_check(handle) + return (record[1], record[4], record[5], record[6]) + + # Final initial-root validation occurs before any source can receive a token. + cold_check() + need(api[1](capability, provider_pin) is not None, 'Cold authority root capability differs') + operations = (load, invoke, cold_check, runtime_guard, check_product, set_backend_guard, source) + descriptor = make_caller_descriptor(operations, 'Cold authority caller') + # Original raw loader only: capture this transport immediately and retain + # the immutable descriptor privately. No later attribute read is authority. + load.__dict__['_h25_caller_descriptor'] = descriptor + descriptor_cell.append(descriptor) + epoch_operations = _epoch_operations(ledger, operations, capture_graph, raw_function_record, + make_caller_descriptor, record_for, cold_check, root, capability, api, missing, engine_guard, bundle_cell) + epoch_descriptor = make_caller_descriptor(epoch_operations, 'Epoch authority caller') + bundle = ('h25-cold-authority-epoch-bundle-v1', operations, epoch_operations, epoch_descriptor) + bundle_cell.append(bundle) + load.__dict__['_h25_epoch_bundle'] = bundle + return bundle diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/g12_epoch_cache_selector_v1.py.txt b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/g12_epoch_cache_selector_v1.py.txt new file mode 100644 index 0000000000..d4d0399740 --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/g12_epoch_cache_selector_v1.py.txt @@ -0,0 +1,2768 @@ +"""Source-derived verdict wrappers with current-data and live-runtime authority. + +Parent-owned installation only. No scientific module imports, arithmetic +replacement, immutable Label replacement or shared reference answers. Generic +Label data may use literal uncached expressions; custom Checks/verdict mappings +are rejected. Serial stability is the existing native backend contract. + +V7 preserves the V5 public-dictionary collision contract, the V6 backend/deep +guard split, and the real row interner at both full and light guard boundaries. +All cold entries are invoked through one source-closed early authority. Ordered +base/trace preflight retains the original existing-drift first error. Private +owner/guard state corruption remains excluded; no instance-key safety is claimed. +This source-only draft requires independent source and concrete stage admission. + +V5 replaces the all-public entry census with a fresh admitted native collision- +path inspector. The inspector returns True or NotImplemented metadata only; +entry and exit always inspect current state. All source arithmetic/public dict +operations, canonical scans and authority remain Python-owned and unchanged. +No path, version stamp, validation PASS or arithmetic answer is saved by the +inspector. Compile/runtime/full gates remain closed pending independent review. + +The concrete caller must exclude unrelated callbacks/finalizers, signals, +pending callbacks, concurrent mutation and private corruption for the whole +admitted request: initial guard through key/preparation/probes/original work, +exit guards and authority commit/return. GIL ownership and snapshots alone do +not establish that premise. Unsupported fallback retains separately scoped +literal callbacks and receives no authority. + +""" +from __future__ import annotations + +import _thread +import ast +import builtins +import copy +import gc +import hashlib +from pathlib import Path +import sys +from types import BuiltinFunctionType, CodeType, FunctionType, GetSetDescriptorType, ModuleType + +V8_SOURCE_DRAFT = False +V8_ROW_SOURCE_SHA256 = "364b45c100be73a7ace44ab664f3c792020dad6f33f7788b62aaeab67c0c5aa9" +V8_ROW_PRODUCER_SHA256 = "5aeee9364d29147ef4e1bfffba532f7392833a6158d73d1da50ed6c772f061af" +BACKEND_SOURCE_SHA256 = "e473c38245c3668715b5a78dfe980b2fe3ed0d0c9b8c97c666fbae6ecf1fffd5" +SOURCE_SHA256 = "d623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1" +# Exact provider bytes frozen by the disjoint native source author. +PROBE_PROVIDER_SHA256 = "9cbb7368f89e71d1e6cc46db5dc77efed3e03ed2a801c98c88fe316e4d9f3ef2" +# Correctness-only source pins. Actual parent/native admission and full funding +# remain separate gates; no runtime or performance permission follows here. +BOOTSTRAP_ROOT_SHA256 = "f5a2d33f2b4d3651f214156a0e7094c2bb516ce2d5ab7698d18c11f98f35dee0" +_NOT_IMPLEMENTED = NotImplemented +_TYPE, _OBJECT, _DICT, _TUPLE, _INT, _STR, _BOOL = type, object, dict, tuple, int, str, bool +_LEN, _SORTED, _ID, _COMPILE = len, sorted, id, compile +_GET, _ITEMS, _CLEAR = dict.get, dict.items, dict.clear +_OBJGET, _TYPEGET = object.__getattribute__, type.__getattribute__ +_ERROR, _BASE_ERROR, _VALUE_ERROR = RuntimeError, BaseException, ValueError +_BUILTINS = builtins.__dict__ +_ANY = _BUILTINS["any"] +_GETTRACE, _GETPROFILE, _THREADCOUNT = sys.gettrace, sys.getprofile, _thread._count +_MISSING = object() + + +def _need(condition, message): + if not condition: + raise _ERROR(message) + + +def _record(function): + _need(_TYPE(function) is FunctionType, "Cache contract requires ordinary functions") + closure = function.__closure__ + return (function, function.__code__, function.__globals__, function.__builtins__, + function.__defaults__, function.__kwdefaults__, closure, + () if closure is None else _TUPLE((cell, cell.cell_contents) for cell in closure)) + + +def _fresh(record): + function, code, namespace, builtins_owner, defaults, kwdefaults, closure, cells = record + if not (function.__code__ is code and function.__globals__ is namespace and + function.__builtins__ is builtins_owner and function.__defaults__ is defaults and + function.__kwdefaults__ is kwdefaults and function.__closure__ is closure): + return False + for cell, value in cells: + try: + if cell.cell_contents is not value: + return False + except _VALUE_ERROR: + return False + return True + + +def _string_key_domain(namespace): + """Return shape metadata only; release observed key/iterator before return. + + Exact dict does not by itself prevent equality callbacks on named lookup. + The closed guard interval excludes concurrent mutation and unrelated + allocation finalizers; this function does not disable garbage collection. + """ + if _TYPE(namespace) is not _DICT: + return False + current = iterator = None + try: + iterator = _DICT.__iter__(namespace) + for current in iterator: + if _TYPE(current) is not _STR: + return False + return True + finally: + current = None + iterator = None + namespace = None + + +def _observed_fresh(record, observations): + """Share scalar actual metadata, never a PASS or independently expected row. + + Function/cell objects below come from retained expected records. Current + defaults/code/globals/cell values are consumed only by captured id and are + never bound to local variables or retained in a traceback. Every expected + record still compares separately, in original field/cell order. + """ + current = key = None + try: + function, code, namespace, builtins_owner, defaults, kwdefaults, closure, cells = record + if _TYPE(function) is not FunctionType: + return False + key = (0, _ID(function)) + current = _GET(observations, key, _MISSING) + if current is _MISSING: + current = (_ID(function.__code__), _ID(function.__globals__), + _ID(function.__builtins__), _ID(function.__defaults__), + _ID(function.__kwdefaults__), _ID(function.__closure__)) + observations[key] = current + if not (current[0] == _ID(code) and current[1] == _ID(namespace) and + current[2] == _ID(builtins_owner) and current[3] == _ID(defaults) and + current[4] == _ID(kwdefaults) and current[5] == _ID(closure)): + return False + for cell, value in cells: + key = (1, _ID(cell)) + current = _GET(observations, key, _MISSING) + if current is _MISSING: + try: + current = (True, _ID(cell.cell_contents)) + except _VALUE_ERROR: + current = (False, 0) + observations[key] = current + if not current[0] or current[1] != _ID(value): + return False + return True + finally: + current = key = None + observations = None + + +def _ordinary(cls): + if _TYPE(cls) is not _TYPE or _TYPEGET(cls, "__mro__") != (cls, _OBJECT): + return False + members = _TYPEGET(cls, "__dict__") + if "__getattr__" in members or _TYPEGET(cls, "__getattribute__") is not _OBJECT.__getattribute__: + return False + if _TYPEGET(cls, "__new__") is not _OBJECT.__new__: + return False + for name in ("__dict__", "__weakref__"): + descriptor = members.get(name) + if _TYPE(descriptor) is not GetSetDescriptorType or descriptor.__objclass__ is not cls: + return False + return True + + +def _plain_fields(instance, cls): + if _TYPE(instance) is not cls: + return None + namespace = _OBJGET(instance, "__dict__") + if _TYPE(namespace) is not _DICT: + return None + # Validate before string-key lookup: injected custom keys could otherwise + # invoke equality against an ordinary field name. + for name in namespace: + if _TYPE(name) is not _STR: + return None + return namespace + + +def _canonical(instance, label): + """Current exact data, never Label.key alone; no custom operand dispatch.""" + namespace = _plain_fields(instance, label) + if namespace is None or _LEN(namespace) != 3: + return None + basis = _GET(namespace, "basis", _MISSING) + dim = _GET(namespace, "dim", _MISSING) + key = _GET(namespace, "key", _MISSING) + if _TYPE(basis) is not _DICT or _TYPE(dim) is not _INT or _TYPE(key) is not _TUPLE: + return None + if dim != _LEN(basis) or _LEN(key) != dim: + return None + for value in key: + if _TYPE(value) is not _INT: + return None + pivots = 0 + values = [] + for pivot, value in _ITEMS(basis): + if _TYPE(pivot) is not _INT or _TYPE(value) is not _INT: + return None + if pivot <= 0 or pivot & (pivot - 1) or value <= 0 or value & -value != pivot: + return None + pivots |= pivot + values.append(value) + for pivot, value in _ITEMS(basis): + if value & pivots != pivot: + return None + if _TUPLE(_SORTED(values)) != key: + return None + # key is now an exact immutable representation of the canonical mapping. + return key + + +def _hooks_clear(): + """Known hook exclusion, not a promise against signals/finalizers/threads.""" + if _GETTRACE() is not None or _GETPROFILE() is not None or _THREADCOUNT() != 0: + return False + callbacks = gc.callbacks + if _TYPE(callbacks) is not list or _LEN(callbacks): + return False + monitoring = getattr(sys, "monitoring", None) + if monitoring is not None: + for tool in range(6): + if monitoring.get_tool(tool) is not None: + return False + return True + + +class _State: + __slots__ = ("checks", "mapping", "authority") + + def __init__(self, checks, mapping): + self.checks, self.mapping, self.authority = checks, mapping, {} + + +class _Ticket: + __slots__ = ("state", "signature", "c", "h", "hit", "expected") + + def __init__(self, state, signature, circuit, height): + self.state, self.signature, self.c, self.h = state, signature, circuit, height + self.hit, self.expected = False, _MISSING + + +class _Owner: + def __init__(self, module, source_records, class_names, probe_provider, probe_binding, + bootstrap_root, bootstrap_capability, bootstrap_api, bootstrap_validate, bootstrap_load, + bootstrap_identity, collector_guard, collector_descriptor): + self.collector_guard = collector_guard + self.collector_descriptor = collector_descriptor + self.module, self.namespace = module, module.__dict__ + self.checks_class, self.label = self.namespace["Checks"], self.namespace["Label"] + self.source_records, self.class_names = source_records, class_names + self.odd = self.namespace["odd"] + self.probe_provider, self.probe_binding = probe_provider, probe_binding + self.probe_namespace = probe_provider.__dict__ + self.probe_class = _TYPE(probe_binding) + self.probe_validate = probe_provider.validate_binding + self.probe_inspect = probe_binding.inspect + self.probe_counters = probe_binding.counters + self.probe_close = probe_binding.close + self.probe_namespace_items = _TUPLE(self.probe_namespace.items()) + self.probe_class_mro = _TYPEGET(self.probe_class, "__mro__") + self.probe_class_items = _TUPLE(_TYPEGET(self.probe_class, "__dict__").items()) + probe_functions = [value for _, value in self.probe_namespace_items if _TYPE(value) is FunctionType] + probe_functions.extend(value for _, value in self.probe_class_items if _TYPE(value) is FunctionType) + self.probe_records = _TUPLE(_record(function) for function in probe_functions) + self.bootstrap_root, self.bootstrap_capability = bootstrap_root, bootstrap_capability + self.bootstrap_api = bootstrap_api + self.bootstrap_validate, self.bootstrap_load = bootstrap_validate, bootstrap_load + self.bootstrap_identity = bootstrap_identity + self.bootstrap_namespace = bootstrap_root.__dict__ + self.bootstrap_namespace_items = _TUPLE(self.bootstrap_namespace.items()) + self.bootstrap_class = _TYPE(bootstrap_capability) + self.bootstrap_class_mro = _TYPEGET(self.bootstrap_class, "__mro__") + self.bootstrap_class_items = _TUPLE(_TYPEGET(self.bootstrap_class, "__dict__").items()) + bootstrap_functions = [value for _, value in self.bootstrap_namespace_items + if _TYPE(value) is FunctionType] + bootstrap_functions.extend(value for _, value in self.bootstrap_class_items + if _TYPE(value) is FunctionType) + bootstrap_functions.extend(bootstrap_api) + self.bootstrap_records = _TUPLE(_record(function) for function in bootstrap_functions) + self.probe_closed = False + self.teardown_stop = None + self.teardown_primary_error = None + self.teardown_close_error = None + self.runtime = None + self.composed_guard = None + self.composed_guard_records = () + self.base_guard_records = () + self.base_guard_classes = () + self.binding_derivation = None + self.factory_environment = None + self.base_guard = None + self.methods = {} + self.method_records = () + self.states = {} + self.receipt = {"schema": "h25-cache-contract-v8", "source_sha256": SOURCE_SHA256, + "requests": 0, "entry_checks": 0, "exit_checks": 0, + "probe_entry_calls": 0, "probe_exit_calls": 0, + "probe_safe_observations": 0, "probe_unsupported_observations": 0, + "probe_exit_rejections": 0, + "snapshots": 0, "eligible_requests": 0, "uncached_requests": 0, + "authorized_hits": 0, "authorized_results": 0, + "invalidations": 0, "peak_authority_entries": 0, + "current_authority_entries": 0, "teardowns": 0} + + def _clear(self, state): + count = _LEN(state.authority) + if count: + _CLEAR(state.authority) + self.receipt["current_authority_entries"] -= count + self.receipt["invalidations"] += 1 + + def _lookup_state(self, checks): + state = _GET(self.states, _ID(checks)) + if state is not None and state.checks is checks: + return state + return None + + def enter(self, checks): + _need(self.runtime is not None, "Cache contract runtime is not attached") + self.runtime.check() + self.receipt["entry_checks"] += 1 + self.receipt["requests"] += 1 + # Do not read verdicts/everything/key here. Original key errors precede + # original verdict access errors; custom Checks itself is unsupported. + _need(_plain_fields(checks, self.checks_class) is not None, + "Unsupported cache contract Checks dispatch or fields") + return checks + + def _data(self, checks, key, operands, kind): + self.receipt["snapshots"] += 1 + namespace = _plain_fields(checks, self.checks_class) + if namespace is None: + return None + circuit, height = _GET(namespace, "c", _MISSING), _GET(namespace, "h", _MISSING) + if circuit is _MISSING or _TYPE(height) is not _INT: + return None + keys = [] + for operand in operands: + value = _canonical(operand, self.label) + if value is None: + return None + keys.append(value) + if kind == "label": + everything = _GET(namespace, "everything", _MISSING) + whole_key = _canonical(everything, self.label) + if whole_key is None or _TYPE(key) is not _TUPLE or key != ("label", keys[0]): + return None + signature = (kind, keys[0], whole_key) + else: + if _TYPE(key) is not _TUPLE or key != (keys[0], keys[1]): + return None + signature = (kind, keys[0], keys[1]) + return signature, circuit, height + + def _probe_safe(self, mapping, key, *, exit_boundary=False): + """Fresh metadata only. inspect itself checks admitted provider/native state.""" + self.check_bootstrap() + counter = "probe_exit_calls" if exit_boundary else "probe_entry_calls" + self.receipt[counter] += 1 + result = self.probe_inspect(mapping, key) + if result is True: + self.receipt["probe_safe_observations"] += 1 + return True + if result is _NOT_IMPLEMENTED: + self.receipt["probe_unsupported_observations"] += 1 + return False + raise _ERROR("Cache probe returned non-metadata result") + + def prepare(self, checks, key, operands, kind): + namespace = _plain_fields(checks, self.checks_class) + _need(namespace is not None, "Unsupported cache contract Checks fields") + mapping = _GET(namespace, "verdicts", _MISSING) + state = self._lookup_state(checks) + if mapping is _MISSING: + if state is not None: + self._clear(state) + self.receipt["uncached_requests"] += 1 + return None # original `self.verdicts` raises at its original site + _need(_TYPE(mapping) is _DICT, "Unsupported cache contract verdict mapping") + if state is None or state.mapping is not mapping: + if state is not None: + self._clear(state) + state = _State(checks, mapping) + self.states[_ID(checks)] = state + # Preserve original key construction and canonical/type admission before + # the native helper may hash an exact supported request key. + data = self._data(checks, key, operands, kind) if _hooks_clear() else None + public_safe = data is not None and self._probe_safe(mapping, key) + if not public_safe: + self._clear(state) # no hash/equality involving unsupported key + self.receipt["uncached_requests"] += 1 + return None + self.receipt["eligible_requests"] += 1 + signature, circuit, height = data + return _Ticket(state, signature, circuit, height) + + def reuse(self, ticket, key): + if ticket is None: + return False + record = _GET(ticket.state.authority, key) + if record is None: + return False + signature, circuit, height, result = record + if signature != ticket.signature or circuit is not ticket.c or height != ticket.h: + return False + ticket.hit, ticket.expected = True, result + return True + + def finish(self, checks, key, operands, kind, ticket, result): + self.runtime.check() + self.receipt["exit_checks"] += 1 + if ticket is None: + state = self._lookup_state(checks) + if state is not None: + self._clear(state) # callbacks may have made reentrant requests + return result + namespace = _plain_fields(checks, self.checks_class) + same_mapping = namespace is not None and _GET(namespace, "verdicts", _MISSING) is ticket.state.mapping + data = self._data(checks, key, operands, kind) if same_mapping and _hooks_clear() else None + if (not same_mapping or + data is None or data[0] != ticket.signature or + data[1] is not ticket.c or data[2] != ticket.h): + self._clear(ticket.state) + raise _ERROR("Cache data changed during request") + if not self._probe_safe(ticket.state.mapping, key, exit_boundary=True): + self._clear(ticket.state) + self.receipt["probe_exit_rejections"] += 1 + raise _ERROR("Cache probe unsupported at exit") + if ticket.hit and result is not ticket.expected: + self._clear(ticket.state) + raise _ERROR("Cache verdict authority changed") + if _TYPE(result) is not _BOOL: + self._clear(ticket.state) + return result + if ticket.hit: + self.receipt["authorized_hits"] += 1 + authority = ticket.state.authority + if key not in authority: + self.receipt["current_authority_entries"] += 1 + count = self.receipt["current_authority_entries"] + if count > self.receipt["peak_authority_entries"]: + self.receipt["peak_authority_entries"] = count + authority[key] = (ticket.signature, ticket.c, ticket.h, result) + self.receipt["authorized_results"] += 1 + return result + + def abort(self, checks): + state = self._lookup_state(checks) + if state is not None: + self._clear(state) + + def check_bootstrap(self): + """Freshness relative to the actual root authenticated by the parent. + + Exact types and snapshots enforce continuity; they do not independently + authenticate an arbitrary caller-supplied root. Parent bootstrap identity + is an explicit prerequisite, established before loading this adapter. + """ + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:16 + _ca_desc = self.collector_descriptor + _ca_runtime_operations = _ca_desc[1] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if _ca_type(_ca_runtime_operations) is not _ca_p[9] or _ca_p[3](_ca_runtime_operations) != 1 or _ca_runtime_operations[0] is not self.collector_guard: + raise _ca_error("Runtime drift: cache collector operation identity differs") + if _ca_runtime_operations is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Runtime drift: cache collector dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Runtime drift: cache collector dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Runtime drift: cache collector dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Runtime drift: cache collector dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Runtime drift: cache collector dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:16 + _ca_dispatch(0) + _need(_TYPE(self.bootstrap_root) is ModuleType and + _string_key_domain(self.bootstrap_root.__dict__), + "Unsupported cache bootstrap lookup key domain") + _need(_TYPE(self.bootstrap_root) is ModuleType and + self.bootstrap_root.__dict__ is self.bootstrap_namespace and + _LEN(self.bootstrap_namespace) == _LEN(self.bootstrap_namespace_items), + "Runtime drift: cache bootstrap root namespace") + for name, value in self.bootstrap_namespace_items: + _need(_GET(self.bootstrap_namespace, name, _MISSING) is value, + "Runtime drift: cache bootstrap root binding " + name) + _need(_TYPE(self.bootstrap_api) is _TUPLE and _LEN(self.bootstrap_api) == 4 and + self.bootstrap_api[0] is self.bootstrap_identity and + self.bootstrap_api[1] is self.bootstrap_validate and + self.bootstrap_api[2] is self.bootstrap_load, + "Runtime drift: cache captured bootstrap entry") + _need(_TYPE(self.bootstrap_capability) is self.bootstrap_class and + _TYPEGET(self.bootstrap_class, "__mro__") is self.bootstrap_class_mro, + "Runtime drift: cache bootstrap capability class") + members = _TYPEGET(self.bootstrap_class, "__dict__") + _need(_LEN(members) == _LEN(self.bootstrap_class_items), + "Runtime drift: cache bootstrap capability members") + for name, value in self.bootstrap_class_items: + _need(members.get(name) is value, + "Runtime drift: cache bootstrap capability member " + name) + for record in self.bootstrap_records: + _need(_fresh(record), "Runtime drift: cache bootstrap function calling environment") + root_digest = self.bootstrap_identity() + _need(_TYPE(root_digest) is _STR and root_digest == BOOTSTRAP_ROOT_SHA256, + "Cache bootstrap source identity differs") + _need(self.bootstrap_validate(self.bootstrap_capability, PROBE_PROVIDER_SHA256) is self.probe_provider, + "Cache bootstrap authenticated provider identity differs") + + def teardown(self): + for state in self.states.values(): + self._clear(state) + _CLEAR(self.states) + self.receipt["teardowns"] += 1 + _need(not self.probe_closed, "Cache probe was already closed") + expected_calls = self.receipt["probe_entry_calls"] + self.receipt["probe_exit_calls"] + native_counters = None + primary_error = close_error = None + stage = "validation" + try: + self.check_bootstrap() + self.probe_validate(self.probe_binding) + stage = "counters" + native_counters = self.probe_counters() + stage = "accounting" + _need(_TYPE(native_counters) is _DICT and + _TYPE(_GET(native_counters, "calls")) is _INT and + native_counters["calls"] == expected_calls and + _TYPE(_GET(native_counters, "counter_overflow")) is _INT and + native_counters["counter_overflow"] == 0, + "Cache native probe call accounting or saturation differs") + except _BASE_ERROR as error: + primary_error = error + finally: + try: + # Captured provider close attempts its captured native disarm and + # registry removal even when its own freshness/audit rejects. + self.probe_close() + except _BASE_ERROR as error: + close_error = error + finally: + self.probe_closed = True + if primary_error is not None or close_error is not None: + self.teardown_primary_error = primary_error + self.teardown_close_error = close_error + observed = (_GET(native_counters, "calls") + if _TYPE(native_counters) is _DICT else None) + self.teardown_stop = { + "status": "STOP", "stage": stage if primary_error is not None else "close", + "expected_probe_calls": expected_calls, + "observed_probe_calls": observed, + "attempted_minus_native": (expected_calls - observed + if _TYPE(observed) is _INT else None), + "native_probe": native_counters, + "native_counters_available": native_counters is not None, + "close_attempted": True, "owner_terminal": True, + "primary_error": (None if primary_error is None else + (_TYPE(primary_error).__name__, _STR(primary_error))), + "close_error": (None if close_error is None else + (_TYPE(close_error).__name__, _STR(close_error))), + } + # Preserve the actual primary exception object, including its + # traceback. A cleanup failure remains explicit as its cause. + if primary_error is not None: + if close_error is not None: + raise primary_error from close_error + raise primary_error + raise close_error + result = _DICT(self.receipt) + result["native_probe"] = native_counters + result["probe_closed"] = True + return result + + +def _code_named(code, name): + for item in code.co_consts: + if _TYPE(item) is CodeType and item.co_name == name: + return item + raise _ERROR("Cache contract expected source code was absent: " + name) + + +def _authenticate(function, expected, namespace): + _need(_TYPE(function) is FunctionType and function.__globals__ is namespace and + function.__builtins__ is _BUILTINS and function.__closure__ is None and + function.__defaults__ is None and function.__kwdefaults__ is None and + _code_equal(function.__code__, expected), "Cache contract original source authentication failed") + return _record(function) + + +def _generate(module, original_ast, owner, kind): + """Retain literal key/membership/body/store/return subtrees unchanged.""" + original = copy.deepcopy(original_ast) + body = original.body + _need(_LEN(body) == 4 and _TYPE(body[0]) is ast.Expr and + _TYPE(body[1]) is ast.Assign and _TYPE(body[2]) is ast.If and + _TYPE(body[3]) is ast.Return, "Cache contract original method AST shape changed") + original_dump = ast.dump(original, include_attributes=False) + operands = "(lab,)" if kind == "label" else "(small, big)" + template = ast.parse(''' +def _factory(_h25_cache_owner, _h25_cache_error): + def _method(self): + _h25_cache_checks = _h25_cache_owner.enter(self) + try: + _H25_KEY + _h25_cache_ticket = _h25_cache_owner.prepare(self, key, OPERANDS, KIND) + _H25_IF + _h25_cache_result = _H25_RETURN + return _h25_cache_owner.finish(self, key, OPERANDS, KIND, + _h25_cache_ticket, _h25_cache_result) + except _h25_cache_error: + _h25_cache_owner.abort(_h25_cache_checks) + raise + return _method +''') + factory = template.body[0] + method = factory.body[0] + method.name, method.args = original.name, original.args + method.body.insert(0, body[0]) + factory.body[1].value.id = original.name + guarded = method.body[2] + guarded.body[0] = body[1] + original_if = body[2] + original_if.test = ast.BoolOp(op=ast.Or(), values=[original_if.test, + ast.UnaryOp(op=ast.Not(), operand=ast.parse( + "_h25_cache_owner.reuse(_h25_cache_ticket, key)", mode="eval").body)]) + guarded.body[2] = original_if + guarded.body[3].value = body[3].value + + class Replace(ast.NodeTransformer): + def visit_Name(self, node): + if node.id == "OPERANDS": + return ast.copy_location(ast.parse(operands, mode="eval").body, node) + if node.id == "KIND": + return ast.copy_location(ast.Constant(value=kind), node) + return node + + Replace().visit(template) + ast.fix_missing_locations(template) + compiled = _COMPILE(template, "", "exec", dont_inherit=True, + optimize=sys.flags.optimize) + # FunctionType avoids adding even temporary globals to the scientific module. + make = FunctionType(_code_named(compiled, "_factory"), module.__dict__) + generated = make(owner, _BASE_ERROR) + _need(ast.dump(original_ast, include_attributes=False) == original_dump, + "Cache contract generator mutated the original AST") + return generated + + +def _bootstrap_api(bootstrap_root, bootstrap_capability, bootstrap_api): + """Use the independently authenticated actual parent root and capability. + + The parent establishes root identity before this adapter is loaded. This is + not admission of arbitrary duck-typed root callbacks. All provider source + reads, hashing, compile and execution belong exclusively to that root. + """ + _need(_TYPE(PROBE_PROVIDER_SHA256) is _STR and _LEN(PROBE_PROVIDER_SHA256) == 64, + "Cache probe provider source pin is not configured") + _need(_TYPE(BOOTSTRAP_ROOT_SHA256) is _STR and _LEN(BOOTSTRAP_ROOT_SHA256) == 64, + "Cache trusted bootstrap root pin is not configured") + _need(_TYPE(bootstrap_root) is ModuleType, "Cache requires the actual trusted parent bootstrap root") + namespace = bootstrap_root.__dict__ + _need(_TYPE(bootstrap_api) is _TUPLE and _LEN(bootstrap_api) == 4 and + not _ANY(_TYPE(function) is not FunctionType or function.__globals__ is not namespace + for function in bootstrap_api), + "Cache bootstrap entries are not the parent's sealed source-bound API") + # The parent sealed these closures before driver/scientific code. Their + # captured pristine guard runs before mutable root helper lookup; no late + # capture of public root validate/load attributes occurs here. + identity, validate, load, diagnostics = bootstrap_api + root_digest = identity() + _need(_TYPE(root_digest) is _STR and root_digest == BOOTSTRAP_ROOT_SHA256, + "Cache trusted bootstrap root source differs") + provider = validate(bootstrap_capability, PROBE_PROVIDER_SHA256) + _need(_TYPE(provider) is ModuleType, "Cache bootstrap provider type differs") + return provider, validate, load, identity + + +def _load_probe(extension_path, expected_extension_sha256, bootstrap_root, bootstrap_capability, + bootstrap_api): + """The trusted root owns cold native admission; every load is independent.""" + provider, validate, load, identity = _bootstrap_api(bootstrap_root, bootstrap_capability, bootstrap_api) + binding = load(bootstrap_capability, extension_path, expected_extension_sha256) + try: + _need(validate(bootstrap_capability, PROBE_PROVIDER_SHA256) is provider, + "Cache bootstrap provider changed during loading") + _need(_TYPE(binding) is provider.ProbeBinding, "Cache probe binding type differs") + provider.validate_binding(binding) + except _BASE_ERROR as primary_error: + try: + binding.close() + except _BASE_ERROR as close_error: + raise primary_error from close_error + raise + return provider, binding, validate, load, identity + + +def prepare_cache_contract(module, extension_path, expected_extension_sha256, + *, bootstrap_root, bootstrap_capability, bootstrap_api, factory_environment, + source_sha256=SOURCE_SHA256): + """Return methods/owner; parent installs only after original P1 admission.""" + _need(not V8_SOURCE_DRAFT, "V8 source draft is not executable") + # The early source-closed guard precedes every new helper. The parent-root + # identity still precedes all scientific-source reads and native operations. + _need(_TYPE(factory_environment) is _BackendFactoryEnvironment, + "Cache v7 requires the parent's early factory environment") + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:1 + _ca_desc = factory_environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if factory_environment.cold_authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:1 + _ca_dispatch(2, factory_environment.cache_handle) + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:2 + _ca_desc = factory_environment.collector_descriptor + _ca_runtime_operations = _ca_desc[1] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if _ca_type(_ca_runtime_operations) is not _ca_p[9] or _ca_p[3](_ca_runtime_operations) != 1 or _ca_runtime_operations[0] is not factory_environment.collector_guard: + raise _ca_error("Runtime drift: cache collector operation identity differs") + if _ca_runtime_operations is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Runtime drift: cache collector dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Runtime drift: cache collector dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Runtime drift: cache collector dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Runtime drift: cache collector dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Runtime drift: cache collector dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:2 + _ca_dispatch(0) + _bootstrap_api(bootstrap_root, bootstrap_capability, bootstrap_api) + _need(_TYPE(module) is ModuleType, "Cache contract requires an exact source module") + namespace = module.__dict__ + _need(_string_key_domain(namespace), "Unsupported cache contract source lookup key domain") + path = Path(namespace["__file__"]) + raw = path.read_bytes() + _need(source_sha256 == SOURCE_SHA256 and hashlib.sha256(raw).hexdigest() == SOURCE_SHA256, + "Cache contract scientific source differs") + _need(_GET(namespace, "__builtins__") is _BUILTINS and "any" not in namespace and + _GET(_BUILTINS, "any") is _ANY, "Cache contract odd calling environment differs") + compiled = _COMPILE(raw, str(path), "exec", dont_inherit=True, optimize=sys.flags.optimize) + records = [_authenticate(namespace["odd"], _code_named(compiled, "odd"), namespace)] + checks = namespace["Checks"] + _need(_ordinary(checks) and _ordinary(namespace["Label"]), "Cache contract original class dispatch differs") + members = _TYPEGET(checks, "__dict__") + expected_names = {"__module__", "__doc__", "__dict__", "__weakref__"} + for code in _code_named(compiled, "Checks").co_consts: + if _TYPE(code) is CodeType: + expected_names.add(code.co_name) + records.append(_authenticate(members.get(code.co_name), code, namespace)) + _need(set(members) == expected_names, "Cache contract original Checks members differ") + parsed = ast.parse(raw, filename=str(path)) + checks_ast = next(item for item in parsed.body if _TYPE(item) is ast.ClassDef and item.name == "Checks") + provider, probe_binding, bootstrap_validate, bootstrap_load, bootstrap_identity = _load_probe( + extension_path, expected_extension_sha256, bootstrap_root, bootstrap_capability, bootstrap_api) + try: + owner = _Owner(module, _TUPLE(records), frozenset(expected_names), provider, probe_binding, + bootstrap_root, bootstrap_capability, bootstrap_api, bootstrap_validate, bootstrap_load, + bootstrap_identity, factory_environment.collector_guard, + factory_environment.collector_descriptor) + owner.factory_environment = factory_environment + for name, kind in (("residual_ok", "residual"), ("label_ok", "label")): + method = next(item for item in checks_ast.body if _TYPE(item) is ast.FunctionDef and item.name == name) + owner.methods[name] = _generate(module, method, owner, kind) + owner.method_records = _TUPLE(_record(value) for value in owner.methods.values()) + except _BASE_ERROR as primary_error: + try: + probe_binding.close() + except _BASE_ERROR as close_error: + raise primary_error from close_error + raise + return {"residual_ok": owner.methods["residual_ok"], "label_ok": owner.methods["label_ok"], + "owner": owner, "receipt": owner.receipt} + + +def _constant_equal(actual, expected): + """No custom constant equality; clear actual roots on every error path.""" + try: + if _TYPE(actual) is not _TYPE(expected): + return False + kind = _TYPE(actual) + if actual is None or actual is Ellipsis: + return actual is expected + if kind is _INT or kind is _BOOL or kind is _STR or kind is bytes: + return actual == expected + if kind is _TUPLE: + if _LEN(actual) != _LEN(expected): + return False + for index in range(_LEN(actual)): + if not _constant_equal(actual[index], expected[index]): + return False + return True + if kind is CodeType: + return _code_equal(actual, expected) + return False + finally: + actual = expected = None + kind = None + + +def _code_equal(actual, expected): + """Compare every executable/code metadata field through exact primitives.""" + try: + if _TYPE(actual) is not CodeType or _TYPE(expected) is not CodeType: + return False + for field in ("co_argcount", "co_posonlyargcount", "co_kwonlyargcount", + "co_nlocals", "co_stacksize", "co_flags", "co_code", + "co_names", "co_varnames", "co_freevars", "co_cellvars", + "co_exceptiontable", "co_linetable", "co_firstlineno", + "co_filename", "co_name", "co_qualname", "co_consts"): + if not _constant_equal(_OBJGET(actual, field), _OBJGET(expected, field)): + return False + return True + finally: + actual = expected = None + + +class _BackendFactoryEnvironment: + """Private per-backend projection of the ONE initial authority token. + + Later source modules are authenticated by that token before this function + runs; this object never promotes late stdlib observations to initial trust. + Expected references remain until this private owner is released. Current + observations, scientific answers, native handles and validation PASS do not. + """ + __slots__ = ("backend", "namespace", "bind", "source_bytes", "bind_ast", "bind_record", + "cold_authority", "cold_caller_descriptor", "backend_handle", "cache_handle", + "collector_guard", "collector_descriptor", + "stdlib_method_owners", "receipt") + + def __setattr__(self, name, value): + raise _ERROR("Backend factory environment is immutable") + + +def capture_backend_factory_environment(backend, *, cold_authority, cold_caller_descriptor, backend_handle, cache_handle, + bootstrap_root, bootstrap_capability, bootstrap_api): + """Invoke through the source-closed authority before scientific exposure. + + The authority was captured before ANY candidate import. Its current check + proves continuity to that initial boundary before deriving this backend's + private expected projection. All mutable helpers here are authenticated by + the outer invoke entry before this function or its first _need is entered. + """ + _need(not V8_SOURCE_DRAFT, "V8 source draft is not executable") + _need(_TYPE(cold_authority) is _TUPLE and _LEN(cold_authority) == 7, + "Backend factory requires the initial seven-entry authority") + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:3 + _ca_desc = cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if cold_authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:3 + _ca_dispatch(2, cache_handle) + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:4 + _ca_desc = cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if cold_authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:4 + _ca_dispatch(2, backend_handle) + _bootstrap_api(bootstrap_root, bootstrap_capability, bootstrap_api) + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:5 + _ca_desc = cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if cold_authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:5 + source_module, filename, source_digest, raw = _ca_dispatch(6, backend_handle) + _need(source_module is backend and source_digest == BACKEND_SOURCE_SHA256 and + _TYPE(raw) is bytes and _TYPE(backend) is ModuleType and + _string_key_domain(backend.__dict__), "Backend factory original source differs") + namespace = backend.__dict__ + _need(_GET(namespace, "__builtins__") is _BUILTINS, + "Backend factory original builtin owner differs") + bind = _GET(namespace, "bind") + parsed = ast.parse(raw, filename=filename) + bind_ast = next(statement for statement in parsed.body + if _TYPE(statement) is ast.FunctionDef and statement.name == "bind") + compiled = _COMPILE(raw, filename, "exec", dont_inherit=True, optimize=sys.flags.optimize) + _need(_TYPE(bind) is FunctionType and bind.__globals__ is namespace and + bind.__builtins__ is _BUILTINS and bind.__closure__ is None and + bind.__kwdefaults__ is None and _TYPE(bind.__defaults__) is _TUPLE and + _LEN(bind.__defaults__) == 2 and bind.__defaults__[0] is None and + bind.__defaults__[1] is None and _code_equal(bind.__code__, _code_named(compiled, "bind")), + "Backend factory original bind calling code differs") + # These are references projected AFTER the early token checked its own + # initial records; they are only for the preserved descriptor control. + method_owners = [] + for name in ("read_bytes", "resolve", "open"): + for cls in _TYPEGET(Path, "__mro__"): + _need(_TYPE(cls) is _TYPE, "Backend factory pathlib metaclass differs") + members = _TYPEGET(cls, "__dict__") + if name in members: + function = members[name] + _need(_TYPE(function) is FunctionType, + "Backend factory pathlib method is not ordinary source") + method_owners.append((cls, _TYPEGET(cls, "__mro__"), name, function)) + break + else: + raise _ERROR("Backend factory pathlib method is absent") + environment = _OBJECT.__new__(_BackendFactoryEnvironment) + # V8 runtime operation has an explicit producer-owned pair result. + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:6 + _ca_desc = cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if cold_authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:6 + collector_guard, collector_descriptor = _ca_dispatch(3, cache_handle) + fields = { + "backend": backend, "namespace": namespace, "bind": bind, "source_bytes": raw, + "bind_ast": ast.dump(bind_ast, include_attributes=False), "bind_record": _record(bind), + "cold_authority": cold_authority, "cold_caller_descriptor": cold_caller_descriptor, + "backend_handle": backend_handle, "cache_handle": cache_handle, + "collector_guard": collector_guard, "collector_descriptor": collector_descriptor, + "stdlib_method_owners": _TUPLE(method_owners), + "receipt": ("same-initial-pre-candidate-authority-token", BACKEND_SOURCE_SHA256, + "initial-system-stdlib-provenance-is-parent-premise", + "each-complete-factory-bind-interval-no-mutation-or-untrusted-callbacks")} + for name, value in fields.items(): + _OBJECT.__setattr__(environment, name, value) + return environment + + +def _check_factory_environment(environment, backend, expected_guard): + """Outer authority.invoke authenticates this validator before entry.""" + _need(_TYPE(environment) is _BackendFactoryEnvironment, + "Backend factory requires the initial authority projection") + authority = environment.cold_authority + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:7 + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:7 + _ca_dispatch(2, environment.cache_handle) + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:8 + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:8 + _ca_dispatch(2, environment.backend_handle) + _need(environment.backend is backend and _TYPE(backend) is ModuleType and + backend.__dict__ is environment.namespace and + _string_key_domain(environment.namespace), + "Backend factory environment owner or lookup domain differs") + _need(_GET(environment.namespace, "RuntimeGuard") is expected_guard, + "Backend factory composed guard is not the intentionally installed guard") + _need(_GET(environment.namespace, "bind") is environment.bind and + _fresh(environment.bind_record), "Backend factory original public bind changed") + + +def bind_cache_backend(backend, module, native, prepared, environment, + *, row_producer_handle, row_handle, rank_row_intern, final_guard, + rank_calls=None, complement_trace=None): + """Keep the real row observer; derive exactly its two callback guard targets. + + The first producer reverses its row observer/parameter back to the original + backend. This second transform reverses its two check_backend attributes + back to THAT exact row-derived function. Public backend.bind stays original. + """ + _need(not V8_SOURCE_DRAFT, "V8 source draft is not executable") + owner = prepared["owner"] + _need(owner.factory_environment is environment and owner.composed_guard is not None and + owner.runtime is None, "Backend factory requires a fresh composed cache guard") + authority = environment.cold_authority + _check_factory_environment(environment, backend, final_guard) + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:9 + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:9 + _ca_dispatch(4, owner.composed_guard, environment.cache_handle, "compose_runtime_guard", + (owner.base_guard, prepared), {}) + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:10 + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:10 + _ca_dispatch(4, rank_row_intern, row_handle, "make_row_interner", (), {}) + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:11 + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:11 + _ca_dispatch(4, final_guard, row_handle, "make_cache_runtime_guard", + (owner.composed_guard, rank_row_intern), {}) + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:12 + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:12 + row_source = _ca_dispatch(6, row_handle) + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:13 + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:13 + producer_source = _ca_dispatch(6, row_producer_handle) + _need(row_source[2] == V8_ROW_SOURCE_SHA256 and + producer_source[2] == V8_ROW_PRODUCER_SHA256, + "Backend factory row source pin differs") + _need(_TYPE(final_guard) is _TYPE and _LEN(_TYPEGET(final_guard, "__mro__")) > 1 and + _TYPEGET(final_guard, "__mro__")[1] is owner.composed_guard, + "Backend factory requires the exact registered final row guard") + # Class constructors and both virtual methods were admitted by the product + # checker BEFORE original bind can enter the first self.check dispatch. + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:14 + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:14 + row_product = _ca_dispatch(1, row_producer_handle, "derive_row_bind", + environment.bind, environment.source_bytes) + row_reference = row_receipt = packet = original = future = parsed = None + derived = restored = restored_tree = tree = None + try: + _need(_TYPE(row_product) is _TUPLE and _LEN(row_product) == 3, + "Backend factory row producer transport differs") + row_reference, row_receipt, packet = row_product + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:17 + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:17 + _ca_dispatch(4, row_reference, row_producer_handle, "derive_row_bind", + (environment.bind, environment.source_bytes), {}) + _need(_TYPE(packet) is _TUPLE and _LEN(packet) == 2 and + _TYPE(packet[0]) is ast.FunctionDef and _TYPE(packet[1]) is list, + "Backend factory private row AST packet differs") + original, future = packet + # Check the producer's transported tree against its immediately sealed + # callable before modifying any AST. Only source-owned AST enters here. + original_tree = ast.Module(body=copy.deepcopy(future) + [copy.deepcopy(original)], type_ignores=[]) + ast.fix_missing_locations(original_tree) + original_code = _code_named(_COMPILE(original_tree, row_reference.__code__.co_filename, "exec", + dont_inherit=True, optimize=sys.flags.optimize), "bind") + _need(_code_equal(original_code, row_reference.__code__), + "Backend factory transported row AST differs from its registered callable") + derived = copy.deepcopy(original) + replacements = [] + for statement in derived.body: + if _TYPE(statement) is ast.FunctionDef and statement.name in ("complement_in", "nondegenerate"): + _need(_LEN(statement.body) > 0 and _TYPE(statement.body[0]) is ast.Expr, + "Backend factory expected callback guard expression is absent") + call = statement.body[0].value + _need(_TYPE(call) is ast.Call and not call.args and not call.keywords and + _TYPE(call.func) is ast.Attribute and call.func.attr == "check" and + _TYPE(call.func.value) is ast.Name and call.func.value.id == "runtime", + "Backend factory callback guard expression changed") + call.func.attr = "check_backend" + replacements.append(call.func) + _need(_LEN(replacements) == 2, + "Backend factory must replace exactly two row-reference callback guard calls") + restored = copy.deepcopy(derived) + restored_count = 0 + for statement in restored.body: + if _TYPE(statement) is ast.FunctionDef and statement.name in ("complement_in", "nondegenerate"): + statement.body[0].value.func.attr = "check" + restored_count += 1 + _need(restored_count == 2 and + ast.dump(restored, include_attributes=False) == ast.dump(original, include_attributes=False), + "Backend factory changed more than the two admitted row-reference guard calls") + restored_tree = ast.Module(body=copy.deepcopy(future) + [restored], type_ignores=[]) + ast.fix_missing_locations(restored_tree) + restored_code = _code_named(_COMPILE(restored_tree, row_reference.__code__.co_filename, "exec", + dont_inherit=True, optimize=sys.flags.optimize), "bind") + _need(_code_equal(restored_code, row_reference.__code__), + "Backend factory reversed calling code differs from the row reference") + tree = ast.Module(body=copy.deepcopy(future) + [derived], type_ignores=[]) + ast.fix_missing_locations(tree) + code = _code_named(_COMPILE(tree, row_reference.__code__.co_filename, "exec", + dont_inherit=True, optimize=sys.flags.optimize), "bind") + clone = FunctionType(code, row_reference.__globals__, row_reference.__name__, + row_reference.__defaults__, row_reference.__closure__) + clone.__kwdefaults__ = row_reference.__kwdefaults__ + _need(clone.__globals__ is row_reference.__globals__ and + clone.__builtins__ is row_reference.__builtins__ and + clone.__defaults__ is row_reference.__defaults__ and + clone.__kwdefaults__ is row_reference.__kwdefaults__ and + clone.__closure__ is row_reference.__closure__, + "Backend factory changed effective row-reference dispatch ownership") + # Pay fresh producer, row, cache and original backend checks again at + # the complete bind boundary. No earlier PASS is carried into this call. + _check_factory_environment(environment, backend, final_guard) + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:18 + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:18 + _ca_dispatch(4, row_reference, row_producer_handle, "derive_row_bind", + (environment.bind, environment.source_bytes), {}) + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:19 + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:19 + _ca_dispatch(4, final_guard, row_handle, "make_cache_runtime_guard", + (owner.composed_guard, rank_row_intern), {}) + _need(_TYPE(module) is ModuleType and _string_key_domain(module.__dict__), + "Backend factory scientific lookup domain changed") + result = clone(module, native, rank_calls, complement_trace, rank_row_intern) + _need(_GET(environment.namespace, "bind") is environment.bind, + "Backend factory replaced the original public bind") + owner.binding_derivation = { + "source_sha256": BACKEND_SOURCE_SHA256, + "row_source_sha256": V8_ROW_SOURCE_SHA256, + "row_producer_sha256": V8_ROW_PRODUCER_SHA256, + "row_derivation": _DICT(row_receipt), + "changed_callback_calls": 2, "restored_ast_identical": True, + "restored_code_identical": True, "transported_ast_matches_registered_row_callable": True, + "original_globals_builtins_defaults_closure": True, + "environment_reference": "exact private row-derived callable", + "exact_final_row_class_product_checked_before_bind": True, + "early_environment": environment.receipt} + return result + finally: + # Producer-owned expected callable records remain paid in the authority. + # The mutable AST transport is private temporary work, never retained. + row_product = row_reference = row_receipt = packet = original = future = parsed = None + original_tree = original_code = derived = restored = restored_tree = tree = None + replacements = statement = call = restored_code = code = clone = None + + +def compose_runtime_guard(base, prepared): + """Initialize cache owner before final native/Label guard capture. + + Install all Checks phase wrappers before backend.bind. Seal P1 afterward. + This is a factory for one isolated candidate module, not a global registry. + """ + _need(not V8_SOURCE_DRAFT, "V8 source draft is not executable") + owner = prepared["owner"] + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:15 + _ca_desc = owner.factory_environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if owner.factory_environment.cold_authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:15 + _ca_dispatch(2, owner.factory_environment.cache_handle) + _need(_TYPE(base) is _TYPE, "Cache composition requires an exact guard class") + base_records, base_classes = [], [] + for cls in _TYPEGET(base, "__mro__"): + if cls is _OBJECT: + continue + _need(_TYPE(cls) is _TYPE, "Cache base guard has custom metaclass dispatch") + entries = _TUPLE(_TYPEGET(cls, "__dict__").items()) + base_classes.append((cls, _TYPEGET(cls, "__mro__"), entries)) + base_records.extend(_record(value) for _, value in entries if _TYPE(value) is FunctionType) + owner.base_guard = base + owner.base_guard_records = _TUPLE(base_records) + owner.base_guard_classes = _TUPLE(base_classes) + + collector_guard = owner.collector_guard + collector_descriptor = owner.collector_descriptor + primitive_clear = _CLEAR + canonical_builtins = owner.factory_environment.backend._CANONICAL_BUILTINS + + class CacheRuntimeGuard(base): + def __init__(self, module, label, native, original_functions): + _need(module is owner.module and label is owner.label and owner.runtime is None, + "Cache guard owner differs or was already attached") + _need(_ordinary(owner.checks_class), "Cache guard Checks class dispatch differs") + members = _TYPEGET(owner.checks_class, "__dict__") + _need(frozenset(members) == owner.class_names, + "Cache guard Checks member names differ") + for name, method in owner.methods.items(): + _need(members.get(name) is method, "Cache guard prepared method was not installed") + for record in owner.source_records + owner.method_records + owner.probe_records + owner.bootstrap_records: + _need(_fresh(record), "Cache guard source changed before capture") + _need(_GET(owner.namespace, "odd") is owner.odd and "any" not in owner.namespace and + _GET(_BUILTINS, "any") is _ANY, "Cache guard odd environment changed before capture") + owner.check_bootstrap() + owner.probe_validate(owner.probe_binding) + self._cache_class_mro = _TYPEGET(owner.checks_class, "__mro__") + self._cache_class_items = _TUPLE(members.items()) + functions = [value for _, value in self._cache_class_items if _TYPE(value) is FunctionType] + self._cache_functions = owner.source_records + owner.method_records + _TUPLE(_record(f) for f in functions) + owner.runtime = self + # owner state and every wrapper closure now have final identities. + base.__init__(self, module, label, native, original_functions) + + def _ordered_base_preflight(self): + """Original raw/P2 then trace order, with key gates at first lookup. + + Every predicate is repeated by unchanged base.check afterwards and + is fully charged. The new scans add admission only immediately + before the relevant dictionary's first named lookup. Private guard + instance state remains excluded; there is no instance-key promise. + """ + if not (_TYPE(self.module) is ModuleType and self.module.__dict__ is self.namespace): + raise _ERROR("Runtime drift: source module dispatch") + if not (_TYPE(self.label) is _TYPE and self.label.__mro__ is self.mro): + raise _ERROR("Runtime drift: Label class dispatch") + if not _string_key_domain(self.namespace): + raise _ERROR("Unsupported cache guard scientific lookup key domain") + for name, value in self.global_items: + if not (_GET(self.namespace, name) is value): + raise _ERROR("Runtime drift: source helper " + name) + builtins_admitted = False + for name, expected in _ITEMS(canonical_builtins): + # Preserve the original 'name not in namespace and ...' + # short-circuit. A shadow error wins before builtin admission. + if name in self.namespace: + raise _ERROR("Runtime drift: builtin lookup " + name) + if not builtins_admitted: + if not _string_key_domain(_BUILTINS): + raise _ERROR("Unsupported cache guard builtin lookup key domain") + builtins_admitted = True + if not (_GET(_BUILTINS, name) is expected): + raise _ERROR("Runtime drift: builtin lookup " + name) + attributes = self.label.__dict__ + if not (_LEN(attributes) == _LEN(self.class_items)): + raise _ERROR("Runtime drift: Label descriptors") + for name, value in self.class_items: + if not (attributes.get(name) is value): + raise _ERROR("Runtime drift: Label member " + name) + for function, code, namespace, effective_builtins, defaults, kwdefaults, closure, cells in self.functions: + if not (function.__code__ is code and function.__globals__ is namespace and + function.__builtins__ is effective_builtins and function.__defaults__ is defaults and + function.__kwdefaults__ is kwdefaults and function.__closure__ is closure): + raise _ERROR("Runtime drift: function code or calling environment") + for cell, value in cells: + # Original empty-cell ValueError propagates at this point. + if not (cell.cell_contents is value): + raise _ERROR("Runtime drift: wrapper closure") + if not (_TYPE(self.native) is ModuleType): + raise _ERROR("Runtime drift: native module dispatch") + if not _string_key_domain(self.native.__dict__): + raise _ERROR("Unsupported cache guard native lookup key domain") + for name, function in self.native_items: + if not (_GET(self.native.__dict__, name) is function): + raise _ERROR("Runtime drift: native entry point " + name) + # Read only inherited private state, after the whole original base. + # Its arbitrary corruption is excluded by the pre-existing contract. + for trace_owner, name, function in _GET(_OBJGET(self, "__dict__"), "_h25_entries", ()): + if not (_TYPE(trace_owner) is ModuleType): + raise _ERROR("Runtime drift: trace encoder entry point " + name) + if not _string_key_domain(trace_owner.__dict__): + raise _ERROR("Unsupported cache guard trace lookup key domain") + if not (_GET(trace_owner.__dict__, name) is function): + raise _ERROR("Runtime drift: trace encoder entry point " + name) + + def _check_scientific(self, observations): + if not (_TYPE(owner.module) is ModuleType and owner.module.__dict__ is owner.namespace and + _GET(owner.namespace, "Checks") is owner.checks_class and + _GET(owner.namespace, "odd") is owner.odd and "any" not in owner.namespace and + _GET(_BUILTINS, "any") is _ANY): + raise _ERROR("Runtime drift: cache source or odd lookup") + if not (_TYPE(owner.checks_class) is _TYPE and + _TYPEGET(owner.checks_class, "__mro__") is self._cache_class_mro): + raise _ERROR("Runtime drift: cache Checks dispatch") + members = _TYPEGET(owner.checks_class, "__dict__") + if _LEN(members) != _LEN(self._cache_class_items): + raise _ERROR("Runtime drift: cache Checks members") + for name, value in self._cache_class_items: + if members.get(name) is not value: + raise _ERROR("Runtime drift: cache Checks member " + name) + for record in self._cache_functions: + if not _observed_fresh(record, observations): + raise _ERROR("Runtime drift: cache function calling environment") + + def _check_provider(self, observations): + if not (_TYPE(owner.probe_provider) is ModuleType and + _string_key_domain(owner.probe_provider.__dict__)): + raise _ERROR("Unsupported cache provider lookup key domain") + if not (_TYPE(owner.probe_provider) is ModuleType and + owner.probe_provider.__dict__ is owner.probe_namespace and + _LEN(owner.probe_namespace) == _LEN(owner.probe_namespace_items)): + raise _ERROR("Runtime drift: cache probe provider namespace") + for name, value in owner.probe_namespace_items: + if _GET(owner.probe_namespace, name, _MISSING) is not value: + raise _ERROR("Runtime drift: cache probe provider binding " + name) + if not (_TYPE(owner.probe_binding) is owner.probe_class and + _TYPEGET(owner.probe_class, "__mro__") is owner.probe_class_mro): + raise _ERROR("Runtime drift: cache probe binding class") + probe_members = _TYPEGET(owner.probe_class, "__dict__") + if _LEN(probe_members) != _LEN(owner.probe_class_items): + raise _ERROR("Runtime drift: cache probe class members") + for name, value in owner.probe_class_items: + if probe_members.get(name) is not value: + raise _ERROR("Runtime drift: cache probe class member " + name) + for record in owner.probe_records: + if not _observed_fresh(record, observations): + raise _ERROR("Runtime drift: cache probe function calling environment") + # The next public provider call owns a separate fresh context. No + # current scalar observation or PASS crosses that boundary. + primitive_clear(observations) + owner.probe_validate(owner.probe_binding) + + def check(self): + """Full direct/cache-boundary semantics; never the light shortcut.""" + observations = {} + try: + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:20 + _ca_desc = collector_descriptor + _ca_runtime_operations = _ca_desc[1] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if _ca_type(_ca_runtime_operations) is not _ca_p[9] or _ca_p[3](_ca_runtime_operations) != 1 or _ca_runtime_operations[0] is not collector_guard: + raise _ca_error("Runtime drift: cache collector operation identity differs") + if _ca_runtime_operations is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Runtime drift: cache collector dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Runtime drift: cache collector dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Runtime drift: cache collector dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Runtime drift: cache collector dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Runtime drift: cache collector dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:20 + _ca_dispatch(0) + self._ordered_base_preflight() + base.check(self) + owner.check_bootstrap() + self._check_scientific(observations) + self._check_provider(observations) + finally: + primitive_clear(observations) + observations = None + + def check_backend(self): + """Actual backend callbacks retain all base and scientific checks.""" + observations = {} + try: + # V8_CALLER_GATE_BEGIN cache_contract_v8.py:21 + _ca_desc = collector_descriptor + _ca_runtime_operations = _ca_desc[1] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if _ca_type(_ca_runtime_operations) is not _ca_p[9] or _ca_p[3](_ca_runtime_operations) != 1 or _ca_runtime_operations[0] is not collector_guard: + raise _ca_error("Runtime drift: cache collector operation identity differs") + if _ca_runtime_operations is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Runtime drift: cache collector dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Runtime drift: cache collector dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Runtime drift: cache collector dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Runtime drift: cache collector dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Runtime drift: cache collector dispatcher cell differs') + # V8_CALLER_GATE_END cache_contract_v8.py:21 + _ca_dispatch(0) + self._ordered_base_preflight() + base.check(self) + self._check_scientific(observations) + _need(not owner.probe_closed, "Cache probe owner is closed") + finally: + primitive_clear(observations) + observations = None + + _need(owner.composed_guard is None, "Cache owner guard was already composed") + owner.composed_guard = CacheRuntimeGuard + owner.composed_guard_records = _TUPLE(_record(value) for value in + _TYPEGET(CacheRuntimeGuard, "__dict__").values() if _TYPE(value) is FunctionType) + return CacheRuntimeGuard + + +# Appended, verbatim, to the independently pinned V8 cache source by the packet. +# This extension is not a standalone import target. +import ast as _epoch_ast +import copy as _epoch_copy +import types as _epoch_types +import sys as _epoch_sys + +EPOCH_FULL_EXECUTION_CONTRACT = None +_EPOCH_SUITES = {} +_EPOCH_BINDERS = {} +_EPOCH_ROLES = ('C1','C2','C3','labels','roles','canonical','public_label', + 'public_residual','private_label','private_residual','prepare','finish') + + +def _epoch_need(ok, message): + if not ok: + raise RuntimeError(message) + + +def _epoch_fn_record(fn): + _epoch_need(type(fn) is _epoch_types.FunctionType, 'Epoch exact callable') + attrs=fn.__dict__;keywords=fn.__kwdefaults__ + _epoch_need(type(attrs) is dict and all(type(k) is str for k in attrs),'Epoch callable attribute key domain') + _epoch_need(keywords is None or type(keywords) is dict and all(type(k) is str for k in keywords),'Epoch callable keyword key domain') + return (fn, fn.__code__, fn.__globals__, fn.__builtins__, fn.__defaults__, + keywords, fn.__closure__, + () if fn.__closure__ is None else tuple((c,c.cell_contents) for c in fn.__closure__), + attrs,tuple(attrs.items()),() if keywords is None else tuple(keywords.items())) + + +def _epoch_fn_fresh(rec): + fn,code,ns,bi,defaults,keywords,closure,cells,attrs,attribute_items,keyword_items=rec + _epoch_need(type(fn) is _epoch_types.FunctionType and fn.__code__ is code and + fn.__globals__ is ns and fn.__builtins__ is bi and fn.__defaults__ is defaults and + fn.__kwdefaults__ is keywords and fn.__closure__ is closure and fn.__dict__ is attrs,'Epoch callable fields drift') + _epoch_need(type(attrs) is dict and all(type(k) is str for k in attrs) and len(attrs)==len(attribute_items),'Epoch callable attribute census/domain') + for name,value in attribute_items:_epoch_need(attrs.get(name) is value,'Epoch callable attribute drift') + if keywords is not None: + _epoch_need(type(keywords) is dict and all(type(k) is str for k in keywords) and len(keywords)==len(keyword_items),'Epoch callable keyword census/domain') + for name,value in keyword_items:_epoch_need(keywords.get(name) is value,'Epoch callable keyword drift') + for cell,value in cells: + _epoch_need(cell.cell_contents is value,'Epoch callable cell drift') + + +def _epoch_checked(owner, assembler, index, *args): + record=_EPOCH_BINDERS.get(id(owner)) + _epoch_need(record is not None and record[0] is owner and record[1] is assembler, + 'Epoch assembler is not the genuine owned export argument') + _epoch_fn_fresh(record[2]) + _epoch_need(type(index) is int and 0<=index<4,'Epoch assembler operation') + return assembler(index,*args) + + +def _epoch_call(descriptor, index, *args, **kwargs): + """Actual caller-side primitive gate, before calling the epoch dispatcher.""" + _epoch_need(type(descriptor) is tuple and len(descriptor)==6,'Epoch caller descriptor shape') + p=descriptor[5]; dispatch=descriptor[2]; rec=descriptor[3] + _epoch_need(type(p) is tuple and len(p)==19 and p[0] is type and p[1] is _epoch_types.FunctionType and p[2] is id and p[18] is zip and type(rec) is tuple and len(rec)==9,'Epoch native caller primitives') + typ,ft,identity=p[0],p[1],p[2] + if dispatch is not rec[0] or typ(dispatch) is not ft: + raise RuntimeError('Epoch caller dispatcher identity') + for (name,getter),expected in p[18](p[4],rec[1:7]): + if identity(getter(dispatch,ft)) != identity(expected): + raise RuntimeError('Epoch caller dispatcher fields') + if rec[4] is not None or rec[5] is not None or rec[7]: + raise RuntimeError('Epoch dispatcher defaults') + for cell,expected in rec[8]: + if p[6](cell,p[5]) is not expected: + raise RuntimeError('Epoch dispatcher cell') + return dispatch(index,*args,**kwargs) + + +def _epoch_named(code,name): + _epoch_need(type(code) is _epoch_types.CodeType,'Epoch code object') + matches=[x for x in code.co_consts if type(x) is _epoch_types.CodeType and x.co_name==name] + _epoch_need(len(matches)==1,'Epoch unique code constant '+name) + return matches[0] + + +def _epoch_ast_function(source, path): + node=_epoch_ast.parse(source) + for name in path: + values=[x for x in node.body if isinstance(x,(_epoch_ast.ClassDef,_epoch_ast.FunctionDef)) and x.name==name] + _epoch_need(len(values)==1,'Epoch unique source function '+name) + node=values[0] + _epoch_need(type(node) is _epoch_ast.FunctionDef,'Epoch function source') + return _epoch_copy.deepcopy(node) + + +def _epoch_locations(actual, original): + _epoch_need(_epoch_ast.dump(actual,include_attributes=False)== + _epoch_ast.dump(original,include_attributes=False),'Epoch inverse unlisted AST change') + for left,right in zip(_epoch_ast.walk(actual),_epoch_ast.walk(original)): + for key in ('lineno','col_offset','end_lineno','end_col_offset'): + if hasattr(right,key):setattr(left,key,getattr(right,key)) + return actual + + +def _epoch_factory(node, namespace, captures, filename): + """Generate actual callable; explicit captures never become module globals.""" + params=list(captures) + factory=_epoch_ast.FunctionDef(name='_epoch_factory',args=_epoch_ast.arguments( + posonlyargs=[],args=[_epoch_ast.arg(arg=x) for x in params],vararg=None, + kwonlyargs=[],kw_defaults=[],kwarg=None,defaults=[]), + body=[node,_epoch_ast.Return(value=_epoch_ast.Name(id=node.name,ctx=_epoch_ast.Load()))], + decorator_list=[]) + tree=_epoch_ast.Module(body=[factory],type_ignores=[]);_epoch_ast.fix_missing_locations(tree) + code=compile(tree,filename,'exec',dont_inherit=True,optimize=_epoch_sys.flags.optimize) + make=_epoch_types.FunctionType(_epoch_named(code,'_epoch_factory'),namespace) + result=make(*(captures[x] for x in params)) + _epoch_need(result.__globals__ is namespace and result.__builtins__ is namespace['__builtins__'], + 'Epoch generated function owners') + return result,tree + + +def _epoch_inverse_ctor(actual,original,site): + node=_epoch_copy.deepcopy(actual) + doc=[] + if node.body and isinstance(node.body[0],_epoch_ast.Expr) and isinstance(node.body[0].value,_epoch_ast.Constant): + doc=[node.body.pop(0)] + _epoch_need(len(node.body)==1 and type(node.body[0]) is _epoch_ast.Try,'Epoch constructor inverse try') + trial=node.body[0] + _epoch_need(len(trial.handlers)==1 and not trial.orelse and not trial.finalbody,'Epoch constructor inverse handler') + expected_handler=_epoch_ast.parse('try:\n pass\nexcept _ep_error as _ep_primary:\n _ep_cancel(_ep_primary)\n raise').body[0].handlers[0] + _epoch_need(_epoch_ast.dump(trial.handlers[0],include_attributes=False)==_epoch_ast.dump(expected_handler,include_attributes=False),'Epoch constructor inverse error cleanup') + class Undo(_epoch_ast.NodeTransformer): + calls=0;commits=0 + def visit_Call(self,value): + if type(value.func) is _epoch_ast.Name and value.func.id=='_ep_ctor': + _epoch_need(len(value.args)==4 and type(value.args[0]) is _epoch_ast.Constant and value.args[0].value==site and not value.keywords and type(value.args[1]) is _epoch_ast.Name and value.args[1].id=='self' and _epoch_ast.dump(value.args[2],include_attributes=False)==_epoch_ast.dump(_epoch_ast.parse('None' if site=='C1' else 'node' if site=='C2' else 'key',mode='eval').body,include_attributes=False),'Epoch constructor inverse call') + self.calls+=1 + return _epoch_ast.copy_location(_epoch_ast.Call(func=_epoch_ast.Name(id='Label',ctx=_epoch_ast.Load()),args=[value.args[3]],keywords=[]),value) + return self.generic_visit(value) + def visit_Expr(self,value): + if type(value.value) is _epoch_ast.Call and type(value.value.func) is _epoch_ast.Name and value.value.func.id=='_ep_commit': + _epoch_need(len(value.value.args)==2 and not value.value.keywords and type(value.value.args[0]) is _epoch_ast.Constant and value.value.args[0].value==site and type(value.value.args[1]) is _epoch_ast.Name and value.value.args[1].id=='self','Epoch inverse store commit') + self.commits+=1;return None + return self.generic_visit(value) + undo=Undo();node.body=doc+trial.body;node=undo.visit(node) + _epoch_need(undo.calls==undo.commits==1,'Epoch exact one constructor/store') + return _epoch_locations(node,original) + + +def _epoch_verify_source_inverse(source,path,restored,function,filename): + tree=_epoch_ast.parse(source);owner=tree + for name in path[:-1]: + found=[x for x in owner.body if isinstance(x,(_epoch_ast.ClassDef,_epoch_ast.FunctionDef)) and x.name==name] + _epoch_need(len(found)==1,'Epoch inverse enclosing source');owner=found[0] + positions=[i for i,x in enumerate(owner.body) if type(x) is _epoch_ast.FunctionDef and x.name==path[-1]] + _epoch_need(len(positions)==1,'Epoch inverse target function') + owner.body[positions[0]]=_epoch_copy.deepcopy(restored) + _epoch_ast.fix_missing_locations(tree) + code=compile(tree,filename,'exec',dont_inherit=True,optimize=_epoch_sys.flags.optimize) + for name in path:code=_epoch_named(code,name) + _epoch_need(_code_equal(code,function.__code__),'Epoch complete source/code inverse') + return None + + +def _epoch_constructor_product(original,site,suite): + node=_epoch_copy.deepcopy(original) + class Edit(_epoch_ast.NodeTransformer): + count=0 + def visit_Assign(self,value): + call=value.value + if type(call) is _epoch_ast.Call and type(call.func) is _epoch_ast.Name and call.func.id=='Label': + _epoch_need(len(call.args)==1 and not call.keywords,'Epoch constructor old call shape') + key=_epoch_ast.Constant(value=None) if site=='C1' else _epoch_ast.Name(id='node' if site=='C2' else 'key',ctx=_epoch_ast.Load()) + value.value=_epoch_ast.copy_location(_epoch_ast.Call(func=_epoch_ast.Name(id='_ep_ctor',ctx=_epoch_ast.Load()),args=[_epoch_ast.Constant(value=site),_epoch_ast.Name(id='self',ctx=_epoch_ast.Load()),key,call.args[0]],keywords=[]),call) + self.count+=1 + # Store continuation is AFTER the exact original original assignment. + store=any(type(x) is _epoch_ast.Attribute and x.attr=='everything' or + type(x) is _epoch_ast.Subscript and type(x.value) is _epoch_ast.Attribute and x.value.attr=='cache' for x in value.targets) + if store: + commit=_epoch_ast.Expr(value=_epoch_ast.Call(func=_epoch_ast.Name(id='_ep_commit',ctx=_epoch_ast.Load()),args=[_epoch_ast.Constant(value=site),_epoch_ast.Name(id='self',ctx=_epoch_ast.Load())],keywords=[])) + return [value,_epoch_ast.copy_location(commit,value)] + return value + edit=Edit();node=edit.visit(node);_epoch_need(edit.count==1,'Epoch source exactly one Label call') + doc=[] + if node.body and isinstance(node.body[0],_epoch_ast.Expr) and isinstance(node.body[0].value,_epoch_ast.Constant):doc=[node.body.pop(0)] + handler=_epoch_ast.parse('try:\n pass\nexcept _ep_error as _ep_primary:\n _ep_cancel(_ep_primary)\n raise').body[0].handlers + node.body=doc+[_epoch_ast.Try(body=node.body,handlers=handler,orelse=[],finalbody=[])] + _epoch_ast.fix_missing_locations(node);restored=_epoch_inverse_ctor(node,original,site) + _epoch_verify_source_inverse(suite.source,('Checks',original.name),restored,getattr(suite.checks_class,original.name),suite.filename) + return _epoch_factory(node,suite.namespace,{'_ep_ctor':suite.construct,'_ep_commit':_g12_commit_selector(suite,site),'_ep_cancel':suite.cancel,'_ep_error':BaseException},suite.filename),node,restored + + +def _epoch_inverse_caller(actual,original,roles): + node=_epoch_copy.deepcopy(actual) + if roles: + doc=[] + if node.body and isinstance(node.body[0],_epoch_ast.Expr) and isinstance(node.body[0].value,_epoch_ast.Constant):doc=[node.body.pop(0)] + _epoch_need(len(node.body)==2 and type(node.body[1]) is _epoch_ast.Try,'Epoch role retirement inverse') + initial=_epoch_ast.parse('_ep_role_primary = None').body[0] + _epoch_need(_epoch_ast.dump(node.body[0],include_attributes=False)==_epoch_ast.dump(initial,include_attributes=False),'Epoch explicit role primary local') + trial=node.body[1] + expected=_epoch_ast.parse('_ep_retire(_ep_role_primary)').body[0] + handler=_epoch_ast.parse('try:\n pass\nexcept _ep_error as _ep_role_error:\n _ep_role_primary = _ep_role_error\n raise').body[0].handlers[0] + _epoch_need(len(trial.handlers)==1 and _epoch_ast.dump(trial.handlers[0],include_attributes=False)==_epoch_ast.dump(handler,include_attributes=False) and not trial.orelse and len(trial.finalbody)==1 and _epoch_ast.dump(trial.finalbody[0],include_attributes=False)==_epoch_ast.dump(expected,include_attributes=False),'Epoch exact preserving role finalizer') + node.body=doc+trial.body + class Undo(_epoch_ast.NodeTransformer): + count=0 + def visit_Call(self,value): + if type(value.func) is _epoch_ast.Name and value.func.id=='_ep_request': + _epoch_need(len(value.args)>=3 and not value.keywords and type(value.args[0]) is _epoch_ast.Name and value.args[0].id=='_ep_cap' and type(value.args[2]) is _epoch_ast.Attribute and value.args[2].attr in ('label_ok','residual_ok') and type(value.args[1]) is _epoch_ast.Constant and value.args[1].value==('label' if value.args[2].attr=='label_ok' else 'residual'),'Epoch caller inverse grammar') + self.count+=1 + return _epoch_ast.copy_location(_epoch_ast.Call(func=value.args[2],args=value.args[3:],keywords=[]),value) + return self.generic_visit(value) + undo=Undo();node=undo.visit(node);_epoch_need(undo.count==(4 if roles else 3),'Epoch all caller sites') + return _epoch_locations(node,original) + + +def _epoch_caller_product(original,suite,roles): + node=_epoch_copy.deepcopy(original);cap=object();suite.caller_caps[id(cap)]=(cap,'roles' if roles else 'labels') + class Edit(_epoch_ast.NodeTransformer): + count=0 + def visit_Call(self,value): + value=self.generic_visit(value) + if type(value.func) is _epoch_ast.Attribute and value.func.attr in ('label_ok','residual_ok'): + _epoch_need(not value.keywords,'Epoch caller keyword change') + kind='label' if value.func.attr=='label_ok' else 'residual' + self.count+=1 + return _epoch_ast.copy_location(_epoch_ast.Call(func=_epoch_ast.Name(id='_ep_request',ctx=_epoch_ast.Load()),args=[_epoch_ast.Name(id='_ep_cap',ctx=_epoch_ast.Load()),_epoch_ast.Constant(value=kind),value.func]+value.args,keywords=[]),value) + return value + edit=Edit();node=edit.visit(node);_epoch_need(edit.count==(4 if roles else 3),'Epoch exact caller count') + if roles: + doc=[] + if node.body and isinstance(node.body[0],_epoch_ast.Expr) and isinstance(node.body[0].value,_epoch_ast.Constant):doc=[node.body.pop(0)] + handler=_epoch_ast.parse('try:\n pass\nexcept _ep_error as _ep_role_error:\n _ep_role_primary = _ep_role_error\n raise').body[0].handlers + node.body=doc+_epoch_ast.parse('_ep_role_primary = None').body+[_epoch_ast.Try(body=node.body,handlers=handler,orelse=[],finalbody=_epoch_ast.parse('_ep_retire(_ep_role_primary)').body)] + _epoch_ast.fix_missing_locations(node);restored=_epoch_inverse_caller(node,original,roles) + _epoch_verify_source_inverse(suite.source,(original.name,) if roles else ('Checks',original.name),restored,suite.namespace[original.name] if roles else getattr(suite.checks_class,original.name),suite.filename) + return _epoch_factory(node,suite.namespace,{'_ep_request':suite.request,'_ep_cap':cap,'_ep_retire':suite.role_retire,'_ep_error':BaseException},suite.filename),node,restored + + +def _epoch_template(original,kind): + values=[x for x in _generate.__code__.co_consts if type(x) is str and 'def _factory(' in x and '_H25_KEY' in x] + _epoch_need(len(values)==1,'Epoch exact V8 template source') + template=_epoch_ast.parse(values[0]);factory=template.body[0];method=factory.body[0] + body=_epoch_copy.deepcopy(original.body);method.name=original.name;method.args=_epoch_copy.deepcopy(original.args) + method.body.insert(0,body[0]);factory.body[1].value.id=original.name + guarded=method.body[2];guarded.body[0]=body[1] + conditional=body[2];conditional.test=_epoch_ast.BoolOp(op=_epoch_ast.Or(),values=[conditional.test,_epoch_ast.UnaryOp(op=_epoch_ast.Not(),operand=_epoch_ast.parse('_h25_cache_owner.reuse(_h25_cache_ticket, key)',mode='eval').body)]) + guarded.body[2]=conditional;guarded.body[3].value=body[3].value + operands='(lab,)' if kind=='label' else '(small, big)' + class Replace(_epoch_ast.NodeTransformer): + def visit_Name(self,value): + if value.id=='OPERANDS':return _epoch_ast.copy_location(_epoch_ast.parse(operands,mode='eval').body,value) + if value.id=='KIND':return _epoch_ast.copy_location(_epoch_ast.Constant(value=kind),value) + return value + template=Replace().visit(template);_epoch_ast.fix_missing_locations(template) + return template + + +def _epoch_v8_product(original,kind,suite,private): + baseline=_epoch_template(original,kind) + base_code=_epoch_named(_epoch_named(compile(baseline,'','exec',dont_inherit=True,optimize=_epoch_sys.flags.optimize),'_factory'),original.name) + _epoch_need(_code_equal(base_code,suite.original_public[kind].__code__),'Epoch reconstruction differs from actual V8 method') + tree=_epoch_copy.deepcopy(baseline);factory=tree.body[0];method=factory.body[0] + if private: + method.args.kwonlyargs.append(_epoch_ast.arg(arg='_ep_request')) + method.args.kw_defaults.append(None) + factory.args.args.extend([_epoch_ast.arg(arg='_ep_prepare'),_epoch_ast.arg(arg='_ep_finish')]) + class Replace(_epoch_ast.NodeTransformer): + count=0 + def visit_Call(self,value): + value=self.generic_visit(value) + if type(value.func) is _epoch_ast.Attribute and type(value.func.value) is _epoch_ast.Name and value.func.value.id=='_h25_cache_owner' and value.func.attr in ('prepare','finish'): + name=value.func.attr;value.func=_epoch_ast.Name(id='_ep_'+name,ctx=_epoch_ast.Load()) + value.args.insert(0,_epoch_ast.Name(id='_h25_cache_owner',ctx=_epoch_ast.Load())) + value.keywords.append(_epoch_ast.keyword(arg='_ep_request',value=_epoch_ast.Name(id='_ep_request',ctx=_epoch_ast.Load()))) + self.count+=1 + return value + edit=Replace();tree=edit.visit(tree);_epoch_need(edit.count==2,'Epoch private method exact two targets') + captures=(suite.owner,BaseException,suite.prepare,suite.finish) + else: + factory.args.args.append(_epoch_ast.arg(arg='_ep_public')) + method.body.insert(2,_epoch_ast.Expr(value=_epoch_ast.Call(func=_epoch_ast.Name(id='_ep_public',ctx=_epoch_ast.Load()),args=[_epoch_ast.Name(id='self',ctx=_epoch_ast.Load())],keywords=[]))) + captures=(suite.owner,BaseException,suite.public_entry) + _epoch_ast.fix_missing_locations(tree) + restored=_epoch_copy.deepcopy(tree);rf=restored.body[0];rm=rf.body[0] + if private: + _epoch_need(rm.args.kwonlyargs[-1].arg=='_ep_request' and rm.args.kw_defaults[-1] is None,'Epoch request required keyword') + rm.args.kwonlyargs.pop();rm.args.kw_defaults.pop();_epoch_need([x.arg for x in rf.args.args[-2:]]==['_ep_prepare','_ep_finish'],'Epoch private capture grammar');rf.args.args=rf.args.args[:-2] + class Undo(_epoch_ast.NodeTransformer): + count=0 + def visit_Call(self,value): + if type(value.func) is _epoch_ast.Name and value.func.id in ('_ep_prepare','_ep_finish'): + _epoch_need(type(value.args[0]) is _epoch_ast.Name and value.args[0].id=='_h25_cache_owner' and len(value.keywords)==1 and value.keywords[0].arg=='_ep_request' and type(value.keywords[0].value) is _epoch_ast.Name and value.keywords[0].value.id=='_ep_request','Epoch private inverse call') + value.func=_epoch_ast.Attribute(value=value.args.pop(0),attr=value.func.id[4:],ctx=_epoch_ast.Load());value.keywords=[];self.count+=1 + return self.generic_visit(value) + undo=Undo();restored=undo.visit(restored);_epoch_need(undo.count==2,'Epoch private inverse count') + else: + expected=_epoch_ast.parse('_ep_public(self)').body[0] + _epoch_need(_epoch_ast.dump(rm.body[2],include_attributes=False)==_epoch_ast.dump(expected,include_attributes=False),'Epoch public observer inverse') + _epoch_need(rf.args.args[-1].arg=='_ep_public','Epoch public capture grammar');rm.body.pop(2);rf.args.args.pop() + _epoch_locations(restored,baseline) + restored_code=_epoch_named(_epoch_named(compile(restored,'','exec',dont_inherit=True,optimize=_epoch_sys.flags.optimize),'_factory'),original.name) + _epoch_need(_code_equal(restored_code,suite.original_public[kind].__code__),'Epoch whole V8 code inverse') + code=compile(tree,'','exec',dont_inherit=True,optimize=_epoch_sys.flags.optimize) + make=_epoch_types.FunctionType(_epoch_named(code,'_factory'),suite.namespace) + result=make(*captures) + return result,tree,restored + + +def _epoch_data_product(name,suite): + original=_epoch_ast_function(suite.cache_source,('_Owner',name));node=_epoch_copy.deepcopy(original) + node.args.kwonlyargs.append(_epoch_ast.arg(arg='_ep_request'));node.args.kw_defaults.append(None) + class Edit(_epoch_ast.NodeTransformer): + count=0 + def visit_Call(self,value): + value=self.generic_visit(value) + if type(value.func) is _epoch_ast.Attribute and type(value.func.value) is _epoch_ast.Name and value.func.value.id=='self' and value.func.attr=='_data': + value.func=_epoch_ast.Name(id='_ep_data',ctx=_epoch_ast.Load());value.args=[_epoch_ast.Name(id='_ep_request',ctx=_epoch_ast.Load()),_epoch_ast.Constant(value='entry' if name=='prepare' else 'finish')]+value.args;self.count+=1 + return value + edit=Edit();node=edit.visit(node);_epoch_need(edit.count==1,'Epoch exact private _data substitution') + restored=_epoch_copy.deepcopy(node);restored.args.kwonlyargs.pop();restored.args.kw_defaults.pop() + class Undo(_epoch_ast.NodeTransformer): + count=0 + def visit_Call(self,value): + if type(value.func) is _epoch_ast.Name and value.func.id=='_ep_data': + _epoch_need(len(value.args)==6 and not value.keywords and type(value.args[0]) is _epoch_ast.Name and value.args[0].id=='_ep_request' and type(value.args[1]) is _epoch_ast.Constant and value.args[1].value==('entry' if name=='prepare' else 'finish'),'Epoch data inverse grammar') + value.func=_epoch_ast.Attribute(value=_epoch_ast.Name(id='self',ctx=_epoch_ast.Load()),attr='_data',ctx=_epoch_ast.Load());value.args=value.args[2:];self.count+=1 + return self.generic_visit(value) + undo=Undo();restored=undo.visit(restored);_epoch_need(undo.count==1,'Epoch data inverse count');_epoch_locations(restored,original) + _epoch_verify_source_inverse(suite.cache_source,('_Owner',name),restored,getattr(_Owner,name),_Owner.prepare.__code__.co_filename) + fn,tree=_epoch_factory(node,globals(),{'_ep_data':suite.data},_Owner.prepare.__code__.co_filename) + return fn,tree,restored + + +class _EpochSuite: + def __init__(self,descriptor,handle,module,source,prepared,p1,construction,context,generation): + self.descriptor=descriptor;self.handle=handle;self.module=module;self.namespace=module.__dict__ + self.filename=self.namespace['__file__'];self.source=source;self.owner=prepared['owner'] + self.prepared=prepared;self.p1=p1;self.construction=construction;self.context=context + self.label=self.namespace['Label'];self.checks_class=self.namespace['Checks'];self.E0=self.namespace['echelon'] + self.generation=generation;self.invocation_consumed=False;self.active=False;self.terminal=False;self.pending=None;self.checks=None;self.checks_c=None;self.checks_h=None + self.registry={};self.request_live=None;self.caller_caps={};self.products={};self.proofs={} + self.role_retirement_channel={'started':False,'error':None,'journal_error':None,'acknowledged':False} + self.emergency_retirement_channel={'started':False,'error':None,'journal_error':None,'acknowledged':False} + self.inner_retirement_channel={'started':False,'error':None,'journal_error':None,'acknowledged':False} + self.outer_retirement_channel={'started':False,'error':None,'journal_error':None,'acknowledged':False} + self.role_retirement_error=None;self.emergency_retirement_error=None;self.emergency_journal_error=None + self.inner_retirement_error=None;self.inner_journal_error=None;self.outer_retirement_error=None;self.outer_journal_error=None + self.secondary=[];self.primary_error=None;self.secondary_error=None;self.uncertain=False;self.raw_guard=None;self.installed=False + self.receipt={'constructors':0,'basis_loads':0,'key_loads':0,'commits':0,'signature_views':0,'retirements':0,'capacity_retirements':0,'private_requests':0} + self.original_public={'label':prepared['label_ok'],'residual':prepared['residual_ok']} + self.original_source_cache=Path(__file__).read_bytes() + _epoch_need(self.original_source_cache[:94922] and hashlib.sha256(self.original_source_cache[:94922]).hexdigest()=='133c55e269b354542f86a2a1099f48cff052293d06da310f98b7cb33cb85258f','Epoch original V8 cache prefix') + self.cache_source=self.original_source_cache[:94922].decode('utf-8') + self._build() + suite=self + def assembler(index,*args): + _epoch_need(type(index) is int and 0<=index<4,'Epoch assembler exact operation') + _epoch_fn_fresh(suite.assembler_record) + return (suite.instrument_bind,suite.native_prepare,suite.native_commit,suite.finish_bind)[index](*args) + self.assembler=assembler;self.assembler_record=_epoch_fn_record(assembler) + _EPOCH_BINDERS[id(self.owner)]=(self.owner,assembler,self.assembler_record,self) + + def call(self,index,*args): + return _epoch_call(self.descriptor,index,*args) + + def _product(self,role,fn,tree,restored): + _epoch_need(role in _EPOCH_ROLES and role not in self.products,'Epoch unique product role') + self.products[role]=fn + self.proofs[id(fn)]=(fn,role,_epoch_ast.dump(tree,include_attributes=True),_epoch_ast.dump(restored,include_attributes=True),_epoch_fn_record(fn)) + self.call(2,self.handle,self,'product',role,fn) + return fn + + def _build(self): + for site,name in (('C1','__init__'),('C2','label'),('C3','target_frame')): + original=_epoch_ast_function(self.source,('Checks',name)) + (pair,node,restored)=_epoch_constructor_product(original,site,self) + fn,tree=pair;self._product(site,fn,tree,restored) + for role,name,isroles in (('labels','verify_labels',False),('roles','verify_role_frames',True)): + original=_epoch_ast_function(self.source,(name,) if isroles else ('Checks',name)) + pair,node,restored=_epoch_caller_product(original,self,isroles);fn,tree=pair;self._product(role,fn,tree,restored) + for name in ('prepare','finish'): + fn,tree,restored=_epoch_data_product(name,self);self._product(name,fn,tree,restored) + for kind,name in (('label','label_ok'),('residual','residual_ok')): + original=_epoch_ast_function(self.source,('Checks',name)) + for private in (False,True): + fn,tree,restored=_epoch_v8_product(original,kind,self,private) + self._product(('private_' if private else 'public_')+kind,fn,tree,restored) + suite=self;original=self.E0 + def canonical(vectors): + return suite.canonical(vectors) + # Exact original callable is retained, never looked up through new H. + self._product('canonical',canonical,_epoch_ast.parse('def canonical(vectors):\n return suite.canonical(vectors)'),_epoch_ast.parse('def canonical(vectors):\n return original(vectors)')) + + def install(self): + _epoch_need(not self.installed,'Epoch installation one shot') + for kind,name,role in (('checks','__init__','C1'),('checks','label','C2'),('checks','target_frame','C3'),('checks','verify_labels','labels'),('module','verify_role_frames','roles')): + self.call(2,self.handle,self,'install',kind,name,role,self.products[role]) + for kind,name in (('label','label_ok'),('residual','residual_ok')): + self.owner.methods[name]=self.products['public_'+kind] + self.prepared[name]=self.owner.methods[name] + self.owner.method_records=tuple(_record(v) for v in self.owner.methods.values()) + self.installed=True + return None + + def guard_bindings(self): + self.call(5,self.handle,self) + + def current(self): + self.guard_bindings() + _epoch_need(not self.owner.probe_closed,'Epoch native owner closed') + if self.owner.runtime is not None:self.owner.runtime.check() + + def arm(self,invocation_token): + _epoch_need(not self.terminal and not self.invocation_consumed,'Epoch retired/consumed generation cannot arm') + _epoch_need(type(EPOCH_FULL_EXECUTION_CONTRACT) is dict and EPOCH_FULL_EXECUTION_CONTRACT.get('status')=='INDEPENDENT_COMPLETE_COST_AND_CALLER_APPROVED','Epoch full context is not admitted') + _epoch_need(not self.active and not self.terminal and self.raw_guard is not None,'Epoch arm generation') + _epoch_need(_epoch_sys.flags.optimize==0,'Epoch requires original assertions') + _epoch_need(invocation_token is self.context['invocation_token'] and not self.invocation_consumed,'Epoch unique actual full CLI invocation') + _epoch_need(self.context['driver_function'].__globals__ is self.context['phase_function'].__globals__,'Epoch actual driver invocation owner') + self.current();self.invocation_consumed=True;self.active=True + + def canonical(self,vectors): + pending=self.pending + if pending is None or not self.active:return self.E0(vectors) + self.current() + if pending['basis'] is not None: + self.retire('normalizer-reentry');return self.E0(vectors) + result=self.E0(vectors) + if self.pending is pending and self.active: + _epoch_need(type(result) is dict,'Epoch actual normalizer dict') + pending['basis']=result + return result + + def construct(self,site,checks,key,vectors): + if not self.active:return self.label(vectors) + self.current() + _epoch_need(type(site) is str and site in ('C1','C2','C3') and type(checks) is self.checks_class,'Epoch constructor site/owner') + if self.pending is not None: + self.retire('nested-constructor');raise RuntimeError('Epoch nested private constructor') + if site!='C1' and self.checks is not checks: + self.retire('wrong-checks');return self.label(vectors) + pending={'site':site,'checks':checks,'key':key,'basis':None,'label':None,'tuple':None} + self.pending=pending + try: + value=self.label(vectors) + if self.pending is not pending or not self.active:return value + _epoch_need(type(value) is self.label and pending['basis'] is not None,'Epoch genuine constructor pairing') + basis=value.basis;self.receipt['basis_loads']+=1 + actual_key=value.key;self.receipt['key_loads']+=1 + _epoch_need(basis is pending['basis'] and type(actual_key) is tuple,'Epoch actual basis/key tuple') + pending['label']=value;pending['tuple']=actual_key;self.receipt['constructors']+=1 + return value + except BaseException as primary: + self.cancel(primary);raise + + def commit(self,site,checks): + pending=self.pending + if pending is None:return None + _epoch_need(pending['site']==site and pending['checks'] is checks and pending['label'] is not None,'Epoch store continuation') + value=pending['label'] + stored=checks.everything if site=='C1' else checks.cache[pending['key']] + _epoch_need(stored is value,'Epoch original successful store identity') + if site=='C1': + if self.checks is not None or type(checks.h) is not int: + self.retire('public-checks-generation-or-height');return None + self.checks=checks;self.checks_c=checks.c;self.checks_h=checks.h + _epoch_need(self.checks is checks,'Epoch committed Checks mismatch') + if len(self.registry)>=85196: + self.receipt['capacity_retirements']+=1;self.retire('metadata-capacity');return None + self.registry[id(value)]=(value,pending['basis'],pending['tuple'],len(pending['tuple']),checks,site,self.generation) + self.pending=None;self.receipt['commits']+=1 + + def cancel(self,primary): + if self.primary_error is None:self.primary_error=primary + try:self.retire('constructor-or-store') + except BaseException as secondary: + self.uncertain=True + if self.secondary_error is None:self.secondary_error=secondary + try:self.secondary.append(secondary) + except BaseException:pass + return None + + def public_entry(self,checks): + if self.active:self.retire('public-entry') + + def request(self,cap,kind,bound,*operands): + _epoch_need(type(kind) is str and kind in ('label','residual'),'Epoch request kind type') + record=self.caller_caps.get(id(cap)) + _epoch_need(record is not None and record[0] is cap,'Epoch caller capability') + if not self.active:return bound(*operands) + self.current() + _epoch_need(type(bound) is _epoch_types.MethodType and bound.__self__ is self.checks and + bound.__func__ is self.products['public_'+kind],'Epoch actual method/Checks binding') + if type(self.checks.h) is not int or self.checks.c is not self.checks_c or self.checks.h is not self.checks_h: + self.retire('changed-checks-context');return bound(*operands) + if self.request_live is not None: + self.retire('request-reentry');return bound(*operands) + _epoch_need(kind in ('label','residual') and len(operands)==(1 if kind=='label' else 2),'Epoch operand arity') + registered=[] + for value in operands: + item=self.registry.get(id(value)) + if item is None or item[0] is not value or item[4] is not self.checks or item[6]!=self.generation: + self.retire('unregistered-operand');return bound(*operands) + registered.append(item) + req={'nonce':object(),'checks':self.checks,'operands':operands,'registered':tuple(registered),'kind':kind,'generation':self.generation,'stage':0,'views':set()} + self.request_live=req;self.receipt['private_requests']+=1 + try:return self.products['private_'+kind](self.checks,*operands,_ep_request=req) + finally: + req['stage']=3;self.request_live=None + + def _request(self,req,stage): + _epoch_need(type(req) is dict and self.request_live is req and type(req['stage']) is int and req['stage']==stage and req['generation']==self.generation,'Epoch consumed invocation/stage') + + def prepare(self,owner,checks,key,operands,kind,*,_ep_request): + self._request(_ep_request,0);_ep_request['stage']=1 + ticket=self.products['prepare'](owner,checks,key,operands,kind,_ep_request=_ep_request) + if ticket is None:self.retire('unsupported-mapping-or-hooks') + return ticket + + def finish(self,owner,checks,key,operands,kind,ticket,result,*,_ep_request): + self._request(_ep_request,1);_ep_request['stage']=2 + return self.products['finish'](owner,checks,key,operands,kind,ticket,result,_ep_request=_ep_request) + + def data(self,req,stage,checks,key,operands,kind): + self._request(req,1 if stage=='entry' else 2) + _epoch_need(stage not in req['views'],'Epoch repeated signature view');req['views'].add(stage) + if not self.active:return self.owner._data(checks,key,operands,kind) + self.guard_bindings() + if type(checks.h) is not int or checks.c is not self.checks_c or checks.h is not self.checks_h: + self.retire('changed-checks-view');return self.owner._data(checks,key,operands,kind) + _epoch_need(checks is req['checks'] and kind==req['kind'] and len(operands)==len(req['operands']) and all(a is b for a,b in zip(operands,req['operands'])),'Epoch request operand identity') + values=req['registered'] + if kind=='label': + whole=self.registry.get(id(checks.everything)) + if whole is None or whole[0] is not checks.everything: + self.retire('unregistered-everything');return self.owner._data(checks,key,operands,kind) + _epoch_need(type(key) is tuple and len(key)==2 and type(key[0]) is str and key[0]=='label' and key[1] is values[0][2],'Epoch actual label key components') + signature=(kind,values[0][2],whole[2]) + else: + _epoch_need(type(key) is tuple and len(key)==2 and key[0] is values[0][2] and key[1] is values[1][2],'Epoch actual residual key tuple objects') + signature=(kind,values[0][2],values[1][2]) + self.receipt['signature_views']+=1 + return signature,checks.c,checks.h + + def retire(self,reason): + self.active=False;self.terminal=True;self.pending=None + self.registry.clear();self.checks=None;self.checks_c=None;self.checks_h=None + if not self.receipt['retirements']:self.receipt['retirements']=1 + return None + + def role_retire(self,primary=None): + channel=self.role_retirement_channel + try:return self.retire_preserving('last-role',primary,channel) + finally: + self.role_retirement_error=channel['error'] + channel['acknowledged']=True + + def instrument_bind(self,node,row_reference,future,rank_calls,complement_trace,native,rank_row_intern,final_guard): + _epoch_need(type(node) is _epoch_ast.FunctionDef,'Epoch bind AST') + self.bind_inputs=(rank_calls,complement_trace,native,rank_row_intern,final_guard) + self.call(3,self.handle,self,'reconcile') + original=_epoch_copy.deepcopy(node);result=_epoch_copy.deepcopy(node) + _epoch_need(not any(x.arg=='epoch_assembler' for x in result.args.kwonlyargs),'Epoch duplicate assembler argument') + result.args.kwonlyargs.append(_epoch_ast.arg(arg='epoch_assembler'));result.args.kw_defaults.append(None) + count_a=count_b=0;body=[] + for statement in result.body: + if type(statement) is _epoch_ast.Assign and len(statement.targets)==1 and type(statement.targets[0]) is _epoch_ast.Attribute and statement.targets[0].attr=='complement_in': + body.extend(_epoch_ast.parse('epoch_assembler(1,module,label,original_functions,complement_in,nondegenerate)').body);count_a+=1 + body.append(statement) + if type(statement) is _epoch_ast.Assign and len(statement.targets)==1 and type(statement.targets[0]) is _epoch_ast.Name and statement.targets[0].id=='runtime' and type(statement.value) is _epoch_ast.Call and type(statement.value.func) is _epoch_ast.Attribute and statement.value.func.attr=='__new__': + body.extend(_epoch_ast.parse('epoch_assembler(2,module,label,original_functions,runtime)').body);count_b+=1 + _epoch_need(count_a==count_b==1,'Epoch unique native install stages');result.body=body + restored=_epoch_copy.deepcopy(result);restored.args.kwonlyargs.pop();restored.args.kw_defaults.pop() + removed=[];kept=[] + for statement in restored.body: + if type(statement) is _epoch_ast.Expr and type(statement.value) is _epoch_ast.Call and type(statement.value.func) is _epoch_ast.Name and statement.value.func.id=='epoch_assembler': + removed.append(statement);continue + kept.append(statement) + _epoch_need(len(removed)==2 and [_epoch_ast.dump(x,include_attributes=False) for x in removed]==[_epoch_ast.dump(x,include_attributes=False) for x in _epoch_ast.parse('epoch_assembler(1,module,label,original_functions,complement_in,nondegenerate)\nepoch_assembler(2,module,label,original_functions,runtime)').body],'Epoch inverse stage grammar');restored.body=kept;_epoch_locations(restored,original) + self.bind_inverse={'original':_epoch_ast.dump(original,include_attributes=True),'derived':_epoch_ast.dump(result,include_attributes=True),'restored':_epoch_ast.dump(restored,include_attributes=True)} + expected_tree=_epoch_ast.Module(body=_epoch_copy.deepcopy(future)+[result],type_ignores=[]) + _epoch_ast.fix_missing_locations(expected_tree) + self.bind_expected_code=_epoch_named(compile(expected_tree,row_reference.__code__.co_filename,'exec',dont_inherit=True,optimize=_epoch_sys.flags.optimize),'bind') + return result + + def native_prepare(self,module,label,original_functions,complement,gram): + _epoch_need(module is self.module and label is self.label and type(original_functions) is list,'Epoch native original inputs') + self.call(3,self.handle,self,'prepare',module,label,original_functions,complement,gram) + + def native_commit(self,module,label,original_functions,raw): + _epoch_need(module is self.module and label is self.label,'Epoch native commit module') + self.raw_guard=raw + self.call(3,self.handle,self,'commit',raw) + + def finish_bind(self,result): + self.call(3,self.handle,self,'finish',result,self.owner) + return result + + +def create_epoch_suite(descriptor,handle,module,source,prepared,p1,construction,context,generation): + _epoch_need(type(descriptor) is tuple and type(context) is dict,'Epoch genuine factory inputs') + _epoch_need(type(prepared) is dict and all(type(k) is str for k in prepared),'Epoch prepared factory result') + owner=prepared['owner'];_epoch_need(type(owner) is _Owner and id(owner) not in _EPOCH_SUITES,'Epoch owner already registered') + creator=object.__getattribute__(owner,'__dict__').get('_epoch_creator_record') + _epoch_need(type(creator) is tuple and len(creator)==3 and creator[0] is descriptor and creator[1] is handle and creator[2] is context,'Epoch source-owned creation record') + suite=_EpochSuite(descriptor,handle,module,source,prepared,p1,construction,context,generation) + _EPOCH_SUITES[id(owner)]=(owner,suite) + return suite + + +def compose_epoch_runtime_guard(base,suite): + _epoch_need(type(base) is type and type(suite) is _EpochSuite and + id(suite.owner) in _EPOCH_SUITES and _EPOCH_SUITES[id(suite.owner)][0] is suite.owner and + _EPOCH_SUITES[id(suite.owner)][1] is suite,'Epoch owned guard source suite') + class EpochRuntimeGuard(base): + def check(self): + base.check(self) + suite.guard_bindings() + def check_backend(self): + base.check_backend(self) + suite.guard_bindings() + _epoch_need(getattr(suite,'epoch_guard',None) is None,'Epoch guard already composed') + suite.epoch_guard=EpochRuntimeGuard + return EpochRuntimeGuard + + +def _epoch_validate(prepared,assembler): + _epoch_need(type(prepared) is dict and all(type(k) is str for k in prepared),'Epoch prepared key domain') + owner=prepared.get('owner') + record=_EPOCH_BINDERS.get(id(owner)) + _epoch_need(record is not None and record[0] is owner and record[1] is assembler,'Epoch required genuine assembler') + _epoch_fn_fresh(record[2]) + return owner + + +def epoch_suite_call(suite,index,*args): + """Owned-source helper for adapters; not an implicit public epoch flag.""" + _epoch_need(type(suite) is _EpochSuite,'Epoch exact suite') + record=_EPOCH_SUITES.get(id(suite.owner)) + _epoch_need(record is not None and record[0] is suite.owner and record[1] is suite,'Epoch suite registry') + _epoch_need(type(index) is int and 0<=index<7,'Epoch suite operation') + return (suite.install,suite.apply_existing,suite.construction_init, + suite.phase_wrap,suite.arm,suite.seal,suite.retire_preserving)[index](*args) + + +def _epoch_suite_apply_existing(self,kind,name,role,function): + return self.call(2,self.handle,self,'existing',kind,name,role,function) + + +def _epoch_suite_construction_init(self): + return self.call(2,self.handle,self,'construction_init') + + +def _epoch_suite_phase_wrap(self,phases,kind,owner,attribute,name): + # Genuine original phase factory constructs its exact function on a private + # temporary module; the source ledger authorizes before the real store. + temporary=_epoch_types.ModuleType('_h25_epoch_phase_temporary') + original=getattr(owner,attribute);setattr(temporary,attribute,original) + actual_original,observed=phases.wrap(temporary,attribute,name) + _epoch_need(actual_original is original,'Epoch original phase factory result') + self.call(2,self.handle,self,'existing',kind,attribute,'phase',observed) + return original,observed + + +def _epoch_suite_seal(self): + self.call(4,self.handle,self) + + +def _epoch_suite_retire_preserving(self,reason,primary=None,error_channel=None): + channel=self.emergency_retirement_channel if error_channel is None else error_channel + _epoch_need(channel['started'] is False and channel['acknowledged'] is False,'Epoch retirement channel already consumed') + channel['started']=True + if primary is not None and self.primary_error is None:self.primary_error=primary + try:self.retire(reason) + except BaseException as cleanup_error: + channel['error']=cleanup_error # fixed raw owner before any optional growth + self.uncertain=True + if primary is None: + if self.primary_error is None:self.primary_error=cleanup_error + elif cleanup_error is not primary: + if self.secondary_error is None:self.secondary_error=cleanup_error + try:self.secondary.append(cleanup_error) + except BaseException as journal_error: + channel['journal_error']=journal_error + # A failed retirement cannot leave private invocation authority active. + # Only plain source-owned metadata is touched; no native guard/close is + # retried and no ambient exception state chooses the designated error. + self.active=False;self.terminal=True;self.pending=None + self.checks=None;self.checks_c=None;self.checks_h=None + try:dict.clear(self.registry) + except BaseException as metadata_error: + if self.secondary_error is None:self.secondary_error=metadata_error + try:self.secondary.append(metadata_error) + except BaseException:pass + if primary is None:raise cleanup_error + return None + + +# These exact class members are installed at source module initialization before +# cold authority capture of this module, never by a running target or caller. +_EpochSuite.apply_existing=_epoch_suite_apply_existing +_EpochSuite.construction_init=_epoch_suite_construction_init +_EpochSuite.phase_wrap=_epoch_suite_phase_wrap +_EpochSuite.seal=_epoch_suite_seal +_EpochSuite.retire_preserving=_epoch_suite_retire_preserving + + +def _epoch_guard_base(owner,assembler): + record=_EPOCH_BINDERS.get(id(owner)) + _epoch_need(record is not None and record[0] is owner and record[1] is assembler, + 'Epoch genuine guard-base assembler') + _epoch_fn_fresh(record[2]);suite=record[3] + result=getattr(suite,'epoch_guard',None) + _epoch_need(type(result) is type and result.__mro__[1] is owner.composed_guard, + 'Epoch exact additional guard base') + return result + + + +def bind_epoch_cache_backend(backend, module, native, prepared, environment, *, row_producer_handle, row_handle, rank_row_intern, final_guard, rank_calls=None, complement_trace=None, epoch_assembler): + """Keep the real row observer; derive exactly its two callback guard targets. + + The first producer reverses its row observer/parameter back to the original + backend. This second transform reverses its two check_backend attributes + back to THAT exact row-derived function. Public backend.bind stays original. + """ + _epoch_validate(prepared, epoch_assembler) + _need(not V8_SOURCE_DRAFT, 'V8 source draft is not executable') + owner = prepared['owner'] + _need(owner.factory_environment is environment and owner.composed_guard is not None and (owner.runtime is None), 'Backend factory requires a fresh composed cache guard') + authority = environment.cold_authority + _check_factory_environment(environment, backend, final_guard) + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + _ca_dispatch(4, owner.composed_guard, environment.cache_handle, 'compose_runtime_guard', (owner.base_guard, prepared), {}) + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + _ca_dispatch(4, rank_row_intern, row_handle, 'make_row_interner', (), {}) + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + _ca_dispatch(4, final_guard, row_handle, 'make_cache_runtime_guard', (_epoch_guard_base(owner, epoch_assembler), rank_row_intern), {}) + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + row_source = _ca_dispatch(6, row_handle) + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + producer_source = _ca_dispatch(6, row_producer_handle) + _need(row_source[2] == V8_ROW_SOURCE_SHA256 and producer_source[2] == V8_ROW_PRODUCER_SHA256, 'Backend factory row source pin differs') + _need(_TYPE(final_guard) is _TYPE and _LEN(_TYPEGET(final_guard, '__mro__')) > 1 and (_TYPEGET(final_guard, '__mro__')[1] is _epoch_guard_base(owner, epoch_assembler)), 'Backend factory requires the exact registered final row guard') + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + row_product = _ca_dispatch(1, row_producer_handle, 'derive_row_bind', environment.bind, environment.source_bytes) + row_reference = row_receipt = packet = original = future = parsed = None + derived = restored = restored_tree = tree = None + try: + _need(_TYPE(row_product) is _TUPLE and _LEN(row_product) == 3, 'Backend factory row producer transport differs') + row_reference, row_receipt, packet = row_product + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + _ca_dispatch(4, row_reference, row_producer_handle, 'derive_row_bind', (environment.bind, environment.source_bytes), {}) + _need(_TYPE(packet) is _TUPLE and _LEN(packet) == 2 and (_TYPE(packet[0]) is ast.FunctionDef) and (_TYPE(packet[1]) is list), 'Backend factory private row AST packet differs') + original, future = packet + original_tree = ast.Module(body=copy.deepcopy(future) + [copy.deepcopy(original)], type_ignores=[]) + ast.fix_missing_locations(original_tree) + original_code = _code_named(_COMPILE(original_tree, row_reference.__code__.co_filename, 'exec', dont_inherit=True, optimize=sys.flags.optimize), 'bind') + _need(_code_equal(original_code, row_reference.__code__), 'Backend factory transported row AST differs from its registered callable') + derived = copy.deepcopy(original) + replacements = [] + for statement in derived.body: + if _TYPE(statement) is ast.FunctionDef and statement.name in ('complement_in', 'nondegenerate'): + _need(_LEN(statement.body) > 0 and _TYPE(statement.body[0]) is ast.Expr, 'Backend factory expected callback guard expression is absent') + call = statement.body[0].value + _need(_TYPE(call) is ast.Call and (not call.args) and (not call.keywords) and (_TYPE(call.func) is ast.Attribute) and (call.func.attr == 'check') and (_TYPE(call.func.value) is ast.Name) and (call.func.value.id == 'runtime'), 'Backend factory callback guard expression changed') + call.func.attr = 'check_backend' + replacements.append(call.func) + _need(_LEN(replacements) == 2, 'Backend factory must replace exactly two row-reference callback guard calls') + restored = copy.deepcopy(derived) + restored_count = 0 + for statement in restored.body: + if _TYPE(statement) is ast.FunctionDef and statement.name in ('complement_in', 'nondegenerate'): + statement.body[0].value.func.attr = 'check' + restored_count += 1 + _need(restored_count == 2 and ast.dump(restored, include_attributes=False) == ast.dump(original, include_attributes=False), 'Backend factory changed more than the two admitted row-reference guard calls') + restored_tree = ast.Module(body=copy.deepcopy(future) + [restored], type_ignores=[]) + ast.fix_missing_locations(restored_tree) + restored_code = _code_named(_COMPILE(restored_tree, row_reference.__code__.co_filename, 'exec', dont_inherit=True, optimize=sys.flags.optimize), 'bind') + _need(_code_equal(restored_code, row_reference.__code__), 'Backend factory reversed calling code differs from the row reference') + derived = _epoch_checked(owner, epoch_assembler, 0, derived, row_reference, future, rank_calls, complement_trace, native, rank_row_intern, final_guard) + tree = ast.Module(body=copy.deepcopy(future) + [derived], type_ignores=[]) + ast.fix_missing_locations(tree) + code = _code_named(_COMPILE(tree, row_reference.__code__.co_filename, 'exec', dont_inherit=True, optimize=sys.flags.optimize), 'bind') + clone = FunctionType(code, row_reference.__globals__, row_reference.__name__, row_reference.__defaults__, row_reference.__closure__) + clone.__kwdefaults__ = row_reference.__kwdefaults__ + _need(clone.__globals__ is row_reference.__globals__ and clone.__builtins__ is row_reference.__builtins__ and (clone.__defaults__ is row_reference.__defaults__) and (clone.__kwdefaults__ is row_reference.__kwdefaults__) and (clone.__closure__ is row_reference.__closure__), 'Backend factory changed effective row-reference dispatch ownership') + _check_factory_environment(environment, backend, final_guard) + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + _ca_dispatch(4, row_reference, row_producer_handle, 'derive_row_bind', (environment.bind, environment.source_bytes), {}) + _ca_desc = environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + _ca_dispatch(4, final_guard, row_handle, 'make_cache_runtime_guard', (_epoch_guard_base(owner, epoch_assembler), rank_row_intern), {}) + _need(_TYPE(module) is ModuleType and _string_key_domain(module.__dict__), 'Backend factory scientific lookup domain changed') + result = clone(module, native, rank_calls, complement_trace, rank_row_intern, epoch_assembler=epoch_assembler) + _need(_GET(environment.namespace, 'bind') is environment.bind, 'Backend factory replaced the original public bind') + owner.binding_derivation = {'source_sha256': BACKEND_SOURCE_SHA256, 'row_source_sha256': V8_ROW_SOURCE_SHA256, 'row_producer_sha256': V8_ROW_PRODUCER_SHA256, 'row_derivation': _DICT(row_receipt), 'changed_callback_calls': 2, 'restored_ast_identical': True, 'restored_code_identical': True, 'transported_ast_matches_registered_row_callable': True, 'original_globals_builtins_defaults_closure': True, 'environment_reference': 'exact private row-derived callable', 'exact_final_row_class_product_checked_before_bind': True, 'early_environment': environment.receipt} + result = _epoch_checked(owner, epoch_assembler, 3, result) + return result + finally: + row_product = row_reference = row_receipt = packet = original = future = parsed = None + original_tree = original_code = derived = restored = restored_tree = tree = None + replacements = statement = call = restored_code = code = clone = None + + +# SOURCE supplement embedded after the unchanged legacy cache prefix. +def _epoch_require_disposition(state,record): + _need(_TYPE(state) is _DICT and _string_key_domain(state) and _TYPE(record) is _DICT and _string_key_domain(record),'Epoch exact acquisition disposition dictionaries') + _need(set(record)=={'phase','prepared','owner','probe_binding','close_attempted','close_result','primary','secondary','uncertain','published','origin_handle'} and + _GET(state,'epoch_acquisition') is record and _GET(state,'cache_binding',_MISSING) is None and + _TYPE(record['phase']) is _STR and record['phase']=='BEFORE_ACQUISITION' and record['prepared'] is None and record['owner'] is None and + record['probe_binding'] is None and record['close_attempted'] is False and record['published'] is False and + record['close_result'] is None and record['primary'] is None and record['secondary'] is None and + record['uncertain'] is False and record['origin_handle'] is None, + 'Epoch pending disposition identity and initial state') + + +def prepare_epoch_cache_contract(module, extension_path, expected_extension_sha256, *, bootstrap_root, bootstrap_capability, bootstrap_api, factory_environment, source_sha256=SOURCE_SHA256, disposition_state, disposition_record): + """Return methods/owner; parent installs only after original P1 admission.""" + _need(not V8_SOURCE_DRAFT, 'V8 source draft is not executable') + _need(_TYPE(factory_environment) is _BackendFactoryEnvironment, "Cache v7 requires the parent's early factory environment") + _ca_desc = factory_environment.cold_caller_descriptor + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if factory_environment.cold_authority is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + _ca_dispatch(2, factory_environment.cache_handle) + _ca_desc = factory_environment.collector_descriptor + _ca_runtime_operations = _ca_desc[1] + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if _ca_type(_ca_runtime_operations) is not _ca_p[9] or _ca_p[3](_ca_runtime_operations) != 1 or _ca_runtime_operations[0] is not factory_environment.collector_guard: + raise _ca_error('Runtime drift: cache collector operation identity differs') + if _ca_runtime_operations is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Runtime drift: cache collector dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Runtime drift: cache collector dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Runtime drift: cache collector dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Runtime drift: cache collector dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Runtime drift: cache collector dispatcher cell differs') + _ca_dispatch(0) + _bootstrap_api(bootstrap_root, bootstrap_capability, bootstrap_api) + _epoch_require_disposition(disposition_state, disposition_record) + _need(_TYPE(module) is ModuleType, 'Cache contract requires an exact source module') + namespace = module.__dict__ + _need(_string_key_domain(namespace), 'Unsupported cache contract source lookup key domain') + path = Path(namespace['__file__']) + raw = path.read_bytes() + _need(source_sha256 == SOURCE_SHA256 and hashlib.sha256(raw).hexdigest() == SOURCE_SHA256, 'Cache contract scientific source differs') + _need(_GET(namespace, '__builtins__') is _BUILTINS and 'any' not in namespace and (_GET(_BUILTINS, 'any') is _ANY), 'Cache contract odd calling environment differs') + compiled = _COMPILE(raw, str(path), 'exec', dont_inherit=True, optimize=sys.flags.optimize) + records = [_authenticate(namespace['odd'], _code_named(compiled, 'odd'), namespace)] + checks = namespace['Checks'] + _need(_ordinary(checks) and _ordinary(namespace['Label']), 'Cache contract original class dispatch differs') + members = _TYPEGET(checks, '__dict__') + expected_names = {'__module__', '__doc__', '__dict__', '__weakref__'} + for code in _code_named(compiled, 'Checks').co_consts: + if _TYPE(code) is CodeType: + expected_names.add(code.co_name) + records.append(_authenticate(members.get(code.co_name), code, namespace)) + _need(set(members) == expected_names, 'Cache contract original Checks members differ') + parsed = ast.parse(raw, filename=str(path)) + checks_ast = next((item for item in parsed.body if _TYPE(item) is ast.ClassDef and item.name == 'Checks')) + probe_binding = None + owner = None + prepared = None + try: + provider, probe_binding, bootstrap_validate, bootstrap_load, bootstrap_identity = _load_probe(extension_path, expected_extension_sha256, bootstrap_root, bootstrap_capability, bootstrap_api) + disposition_record['probe_binding'] = probe_binding + disposition_record['phase'] = 'NATIVE_LOCALLY_OWNED' + owner = _Owner(module, _TUPLE(records), frozenset(expected_names), provider, probe_binding, bootstrap_root, bootstrap_capability, bootstrap_api, bootstrap_validate, bootstrap_load, bootstrap_identity, factory_environment.collector_guard, factory_environment.collector_descriptor) + owner.factory_environment = factory_environment + for name, kind in (('residual_ok', 'residual'), ('label_ok', 'label')): + method = next((item for item in checks_ast.body if _TYPE(item) is ast.FunctionDef and item.name == name)) + owner.methods[name] = _generate(module, method, owner, kind) + owner.method_records = _TUPLE((_record(value) for value in owner.methods.values())) + disposition_record['owner'] = owner + prepared = {'residual_ok': owner.methods['residual_ok'], 'label_ok': owner.methods['label_ok'], 'owner': owner, 'receipt': owner.receipt} + disposition_record['prepared'] = prepared + disposition_state['cache_binding'] = prepared + disposition_record['published'] = True + disposition_record['phase'] = 'PARENT_OWNED' + return prepared + except _BASE_ERROR as primary_error: + if disposition_record['primary'] is None: + disposition_record['primary'] = primary_error + if prepared is not None and _GET(disposition_state, 'cache_binding') is prepared: + disposition_record['published'] = True + disposition_record['phase'] = 'PARENT_OWNED_FAILURE' + raise + if probe_binding is None: + disposition_record['phase'] = 'FAILURE_BEFORE_BINDING_RETURN' + disposition_record['uncertain'] = True + raise + disposition_record['close_attempted'] = True + disposition_record['phase'] = 'LOCAL_CLOSE_ATTEMPTING' + try: + disposition_record['close_result'] = probe_binding.close() + except _BASE_ERROR as close_error: + disposition_record['secondary'] = close_error + disposition_record['uncertain'] = True + disposition_record['phase'] = 'LOCAL_CLOSE_FAILED' + raise primary_error from close_error + disposition_record['phase'] = 'LOCAL_CLOSE_RETURNED' + raise + +# BEGIN G12 EXACT SOURCE-OWNED C3 SELECTOR +# Appended to the exact selected epoch cache source. The single constructor +# capture edit calls this factory instead of taking suite.commit directly. +# Original constructor body/inverse/store/error handler is unchanged. +def _g12_commit_selector(suite, site): + original_commit = suite.commit + if site != 'C3': + return original_commit + driver = suite.context['driver_function'] + namespace = driver.__globals__ + # Other original control contexts retain the original capture exactly. + # The G12 wrapper belongs only to this explicit selected main source. + selection = namespace.get('_G12_SELECTED_CASE') + if type(selection) is not str or selection not in ('N22', 'P07') or driver is not namespace.get('main_epoch'): + return original_commit + handler = namespace.get('_g12_selected_store') + _epoch_need(type(driver) is _epoch_types.FunctionType and driver.__name__ == 'main_epoch' and + namespace is _epoch_sys.modules['__main__'].__dict__ and + type(handler) is _epoch_types.FunctionType and handler.__globals__ is namespace, + 'G12 fixed Root-selected source store handler is absent') + # Original authority.driver_entry already captures this selected driver + # graph; the actual handler is also captured transitively in this product + # graph before publication, not installed as a late mutable callback. + def selected_commit(actual_site, checks): + return handler(suite, original_commit, actual_site, checks) + return selected_commit + +# END G12 EXACT SOURCE-OWNED C3 SELECTOR diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/continuation/reference-producer-v2/g12_reference_driver_v2.py.txt b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/continuation/reference-producer-v2/g12_reference_driver_v2.py.txt new file mode 100644 index 0000000000..ddff4223b0 --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/continuation/reference-producer-v2/g12_reference_driver_v2.py.txt @@ -0,0 +1,1226 @@ +#!/usr/bin/env python3 +"""One complete frozen complex-network CLI with retained exact observations. + +Parent-owned serial wall/RSS/aggregate guard is mandatory. Profile mode is one +literal baseline diagnostic/anchor, not a performance sample. Both benchmark +modes require its immutable anchor. No search, retry, orchestration or network. +""" +from __future__ import annotations + +import time +START_WALL = time.perf_counter() +import argparse +from contextlib import redirect_stdout +from fractions import Fraction +import hashlib +import importlib +import io +import json +import os +from pathlib import Path +import resource +import runpy +import shutil +import stat +import sys + +sys.dont_write_bytecode = True +HERE = Path(__file__).resolve().parent +BASE = "19fdb086ea96af9a9f87936a2b888e10af4ed810" +UPSTREAM = "adc7f1241b42e322a6451854ab7e4b4c146bf78a" +PIN_SHA = "88bba3caf5975f30fa7abceaea9454110cf3b069233e8241a2ca13d1dff171a7" +REFERENCE_SHA = "1f763d95c7ff163aa71d13cd82784f16665be8afb21f75e76941e2119562098f" +ENGINE_PINS = { + "native_gf2.c": "e9c3c9194a08718bd1575c1cf08c6c6772d3b644c2e274c25a84a1f9249d06cc", + "native_backend.py": "e473c38245c3668715b5a78dfe980b2fe3ed0d0c9b8c97c666fbae6ecf1fffd5", + "finite_controls.py": "df989a831aac43cc1af95169dad8c64a7548760e6e1f96976da996703f2c8f7a", + "compare_side_verifier.py": "6e507bb0c7e00d090a60289fddb6c55e90c946d0850c42c3c5e3e15c27604a68", + "profile_side_verifier.py": "9c994378171c20a91539418d93cb8387e1daa93465d6862beefea90e12999c2a", + "source/complex_circuit.py": "d623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1", + "source/complex_network.py": "0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b", +} +COMPLEMENT_EXPECTED = { + "calls": 238685, + "canonical_stream_bytes": 55839507, + "sha256": "7dec2bf33303c37e1c699609e83768d61df7e19104d34a26a148f66d5ccc4838", + "schema": "v2-jsonl:call,us,vs,result(type=list+values or type=None); ordered exact integer vectors", +} +EXPECTED_STDOUT = ( + "PASS conditional 59/100000000000 > 2^-31; minimum margin 14779261/25000000000000000\n" + "Side roles per invocation 108195 vs original 3693800\n" +) + + +def need(condition, message): + if not condition: + raise RuntimeError(message) + + +def sha(data): + return hashlib.sha256(data).hexdigest() + + +def canonical(value): + return json.dumps(value, sort_keys=True, separators=(",", ":"), ensure_ascii=True).encode("ascii") + + +def cpu(): + own = resource.getrusage(resource.RUSAGE_SELF) + children = resource.getrusage(resource.RUSAGE_CHILDREN) + return own.ru_utime + own.ru_stime + children.ru_utime + children.ru_stime + + +def inventory(root, pins, *, exact=True): + need(root.is_dir() and not root.is_symlink(), "Missing or symlinked input root") + files = {} + for path in sorted(root.rglob("*")): + need(not path.is_symlink(), "Symlink in frozen inputs: " + str(path)) + if path.is_file(): + relative = str(path.relative_to(root)) + if relative not in pins: + need(not exact, "Undeclared frozen input: " + relative) + continue + raw = path.read_bytes() + expected = pins[relative][0] if type(pins[relative]) is list else pins[relative] + need(sha(raw) == expected, "Frozen input digest changed: " + relative) + files[relative] = {"sha256": sha(raw), "mode": stat.S_IMODE(path.stat().st_mode), "bytes": len(raw)} + need(set(files) == set(pins), "Frozen input inventory incomplete") + return files + + +def typed(value): + """Lossless full return representation, including order and exact types.""" + kind = type(value) + if kind is Fraction: + return ["Fraction", value.numerator, value.denominator] + if value is None: + return ["None"] + if kind is bool: + return ["bool", value] + if kind is int: + return ["int", str(value)] + if kind is float: + return ["float", value.hex()] + if kind is str: + return ["str", value] + if kind is list or kind is tuple: + return [kind.__name__, [typed(item) for item in value]] + if kind is dict: + return ["dict", [[typed(key), typed(item)] for key, item in value.items()]] + raise TypeError("Unsupported exact full-certificate return type: " + kind.__name__) + + +class Phases: + """Observational wrappers delegate each call and preserve its return.""" + def __init__(self): + self.rows = {} + + def call(self, name, function, *args, **kwargs): + wall, used = time.perf_counter(), cpu() + try: + return _g12_reference_after_phase(self, name, function, args, kwargs, function(*args, **kwargs)) + finally: + row = self.rows.setdefault(name, {"calls": 0, "wall_seconds": 0.0, "cpu_seconds_with_children": 0.0}) + row["calls"] += 1 + row["wall_seconds"] += time.perf_counter() - wall + row["cpu_seconds_with_children"] += cpu() - used + + def wrap(self, owner, attribute, name): + original = getattr(owner, attribute) + def observed(*args, **kwargs): + return self.call(name, original, *args, **kwargs) + setattr(owner, attribute, observed) + return original, observed + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--frozen-root", type=Path, required=True) + parser.add_argument("--reference", type=Path, required=True, help="Pinned original complex-network.json file") + parser.add_argument("--mode", choices=("profile", "baseline", "candidate"), required=True) + parser.add_argument("--output", type=Path, required=True, help="New external directory; every write stays below it") + parser.add_argument("--anchor", type=Path, help="Frozen anchor.json emitted by the one profile run") + args = parser.parse_args() + need(sys.flags.optimize == 0, "Every full-caller mode requires original assertions") + need(sys.implementation.name == "cpython" and sys.version_info[:2] == (3, 12), "Frozen CPython 3.12 required") + need((args.mode == "profile") == (args.anchor is None), "Profile creates the anchor; both benchmark arms require --anchor"); _g12_reference_mode(args) + frozen, reference = args.frozen_root.resolve(), args.reference.resolve() + output = args.output.resolve() + need(not output.exists(), "Refusing to overwrite run evidence") + need(not output.is_relative_to(HERE) and not output.is_relative_to(frozen), "Output must be outside immutable sources") + need(reference.is_file() and not reference.is_symlink(), "Reference certificate missing or symlinked") + source_pin_bytes = (HERE / "SOURCE-PINS.json").read_bytes() + need(sha(source_pin_bytes) == PIN_SHA, "Source inventory pin changed") + pins = json.loads(source_pin_bytes) + need(len(pins) == 32, "Frozen closure must contain twelve scripts, manifest and nineteen payloads") + reference_bytes = reference.read_bytes() + need(sha(reference_bytes) == REFERENCE_SHA, "Original full certificate reference changed") + driver_before = Path(__file__).read_bytes() + anchor_bytes = None if args.anchor is None else args.anchor.read_bytes() + expected_anchor = None if anchor_bytes is None else json.loads(anchor_bytes) + if expected_anchor is not None: + need(expected_anchor.get("schema") == "gf2-full-network-anchor-v1" and + expected_anchor.get("base_commit") == BASE and expected_anchor.get("source_pin_sha256") == PIN_SHA and + expected_anchor.get("driver_sha256") == sha(driver_before) and + expected_anchor.get("engine_pins") == ENGINE_PINS, + "Anchor source/driver/engine identity differs; no benchmark permitted") + output.mkdir(parents=True) + compiler_tmp = output / "compiler-tmp" + compiler_tmp.mkdir() + os.environ["TMPDIR"] = str(compiler_tmp) + phases = Phases() + frozen_before = phases.call("input_custody", inventory, frozen, pins) + engine_before = phases.call("engine_custody", inventory, HERE / "engine", ENGINE_PINS) + manifest = json.loads((frozen / "upstream/manifest.json").read_bytes()) + need(manifest["commit"] == UPSTREAM and len(manifest["files"]) == 19, "Wrong pinned upstream manifest") + need({"upstream/" + name for name in manifest["files"]} == + {name for name in pins if name.startswith("upstream/") and name != "upstream/manifest.json"}, + "Source verifier payload closure changed") + for name, info in manifest["files"].items(): + need(info["sha256"] == pins["upstream/" + name][0], "Manifest payload hash differs from independent frozen pin") + + runtime, engine = output / "runtime-root", output / "engine" + phases.call("fresh_root_copy", shutil.copytree, frozen, runtime) + phases.call("fresh_engine_copy", shutil.copytree, HERE / "engine", engine) + # copytree retains readonly source directory permissions. Only this new + # private root is made writable for the original CLI certificate output. + runtime.chmod(0o755) + (runtime / "certificates").mkdir() + runtime_before = inventory(runtime, pins) + copied_engine_before = inventory(engine, ENGINE_PINS) + need(runtime_before == frozen_before and copied_engine_before == engine_before, "Copy changed input bytes or modes") + for name in ("complex_network.py", "complex_circuit.py"): + need((engine / "source" / name).read_bytes() == (runtime / "scripts" / name).read_bytes(), + "PR5929 engine/source differs from the full caller closure") + script_names = {Path(name).stem for name in pins if name.startswith("scripts/")} + engine_names = {"native_backend", "finite_controls", "compare_side_verifier", "profile_side_verifier"} + need(not (script_names | engine_names) & set(sys.modules), "Scientific module already loaded; fresh process required") + sys.path[:0] = [str(engine), str(runtime / "scripts")] + backend = phases.call("cold_engine_import", _g12_load_backend, engine) + comparison = importlib.import_module("compare_side_verifier") + native = None + finite = None + build = None + if args.mode == "candidate": + native, build = phases.call("cold_compile_link_load", backend.build_native, output / "cold-build") + finite = phases.call("all_native_finite_independent_controls", importlib.import_module("finite_controls").run_controls, native) + (output / "finite-controls.json").write_bytes(canonical(finite) + b"\n") + + circuit_module = phases.call("cold_complex_module_load", _g12_load_circuit, engine) + sys.modules["complex_circuit"] = circuit_module + rank_calls = [] + complement = backend.ComplementTrace(circuit_module.Label) + binding = None + if args.mode == "candidate": + binding = backend.bind(circuit_module, native, rank_calls, complement) + else: + backend.guard_module(circuit_module) + backend.attach_trace(circuit_module, rank_calls, complement); _g12_trace_installed(backend, circuit_module, rank_calls, complement) + captures = {} + _g12_wrap(phases, circuit_module.ComplexSideCircuit, "__init__", "side_construction") + _g12_wrap(phases, circuit_module.Checks, "__init__", "checks_initialization") + _g12_wrap(phases, circuit_module, "compile_roles", "compile_roles") + _g12_wrap(phases, circuit_module.Checks, "verify_map", "verify_map") + _g12_wrap(phases, circuit_module.Checks, "verify_labels", "verify_labels") + original_roles = circuit_module.verify_role_frames + def observe_roles(c, checks, code=None): + need("side" not in captures and code is not None, "Unexpected role-frame invocation") + result = phases.call("verify_role_frames", original_roles, c, checks, code) + captures["side"] = (c, checks, code, result) + return result + circuit_module.verify_role_frames = observe_roles; _g12_roles_installed(circuit_module, original_roles, observe_roles, phases, captures) + + certify = phases.call("cold_certify_import", importlib.import_module, "certify"); _g12_authenticate_certify(certify, runtime, pins) + _g12_wrap(phases, certify, "verify_sources", "original_upstream_verify_sources") + prepare = phases.call("cold_prepare_import", importlib.import_module, "prepare_layers"); _g12_authenticate_prepare(prepare, runtime, pins) + search = importlib.import_module("search_network"); _g12_authenticate_search(search, runtime, pins) + _g12_wrap(phases, search, "log_integer_bounds", "full_log_integer_bounds") + original_serializable = prepare.serializable + depth = 0 + def observe_serializable(value): + nonlocal depth + outer = depth == 0 + if outer: + need("full_return" not in captures and type(value) is dict, "Unexpected outer serialization") + captures["full_return"] = value + depth += 1 + try: + # Recursion still delegates the original serializable exactly once + # per value; only the outer call is captured/timed. + if outer: + return phases.call("original_serializable", original_serializable, value) + return original_serializable(value) + finally: + depth -= 1 + prepare.serializable = observe_serializable; _g12_serializable_installed(prepare, original_serializable, observe_serializable, phases, captures) + + caller = runtime / "scripts/complex_network.py" + old_argv = sys.argv + stdout = io.StringIO(); _g12_bind_main(phases, captures, frozen, runtime, engine, output, reference, reference_bytes, driver_before, pins, frozen_before, engine_before, runtime_before, copied_engine_before, script_names, old_argv, stdout) + try: + sys.argv = [str(caller)] + with redirect_stdout(stdout): + namespace = phases.call("complete_original_cli", runpy.run_path, str(caller), run_name="__main__") + finally: + sys.argv = old_argv + cli_stdout = stdout.getvalue() + need(cli_stdout == EXPECTED_STDOUT, "Original CLI stdout changed") + certificate_bytes = (runtime / "certificates/complex-network.json").read_bytes() + need(certificate_bytes == reference_bytes, "Original CLI certificate bytes differ from the pinned reference") + need(sys.modules["complex_circuit"] is circuit_module and + namespace["ComplexSideCircuit"] is circuit_module.ComplexSideCircuit and + namespace["Checks"] is circuit_module.Checks and namespace["compile_roles"] is circuit_module.compile_roles and + namespace["verify_role_frames"] is observe_roles and namespace["serializable"] is observe_serializable, + "Caller used a different scientific module or observation binding") + need(captures.keys() == {"side", "full_return"}, "Missing exact caller observations") + c, checks, code, role_result = captures["side"] + full_return = captures["full_return"] + need(full_return["role_frames"] is role_result and full_return["upstream_commit"] == UPSTREAM, + "Role return or actual source verification boundary changed") + for name in ("side_construction", "checks_initialization", "compile_roles", "verify_map", "verify_labels", + "verify_role_frames", "original_upstream_verify_sources", "full_log_integer_bounds", + "original_serializable", "complete_original_cli"): + need(phases.rows.get(name, {}).get("calls") == 1, "Original phase was omitted or repeated: " + name) + imports = {} + for name in script_names - {"complex_network"}: + module = sys.modules.get(name) + expected_path = engine / "source/complex_circuit.py" if name == "complex_circuit" else runtime / "scripts" / (name + ".py") + need(module is not None and Path(module.__file__).resolve() == expected_path.resolve(), "Unpinned scientific import: " + name) + imports[name] = str(module.__file__) + if binding is not None: + binding["runtime_guard"].check() + need(binding["counters"] == {"complement_native": 238685, "complement_fallback": 0, + "gram_native": 59959, "gram_fallback": 0}, "Native full-call coverage changed") + + side_result = {key: full_return[key] for key in ("circuit", "side_map", "labels", "role_frames")} + witness = { + "support": c.support, "args": c.args, "kind": c.kind, "active": sorted(c.active), + "pieces": [(target, node, (coefficient.numerator, coefficient.denominator)) for target, node, coefficient in c.pieces], + "labels": [(key, list(label.basis.items()), label.dim, label.key) for key, label in checks.cache.items()], + "code": {"roles": code["roles"], "gates": code["gates"], "sources": list(code["sources"].items()), + "outputs": list(code["outputs"].items())}, + } + side_output = output / "side-observations" + side_output.mkdir() + side_receipt = phases.call("identical_lossless_side_serialization", comparison.write_scientific, + side_output, side_result, witness, rank_calls) + complement_receipt = complement.receipt() + need(complement_receipt == COMPLEMENT_EXPECTED, "Every ordered complement observation must match PR5929") + full_typed_bytes = canonical(typed(full_return)) + (output / "full-return.lossless.json").write_bytes(full_typed_bytes) + (output / "original-stdout.txt").write_text(cli_stdout, encoding="utf-8") + (output / "complement-transcript.json").write_bytes(canonical(complement_receipt) + b"\n") + science = { + "full_cli_certificate_sha256": sha(certificate_bytes), "full_cli_stdout_sha256": sha(cli_stdout.encode("utf-8")), + "full_return_lossless_sha256": sha(full_typed_bytes), "side": side_receipt, + "ordered_complements": complement_receipt, "upstream_commit": UPSTREAM, + } + anchor = {"schema": "gf2-full-network-anchor-v1", "base_commit": BASE, "source_pin_sha256": PIN_SHA, + "driver_sha256": sha(driver_before), "engine_pins": ENGINE_PINS, "science": science} + if expected_anchor is not None: + need(anchor == expected_anchor, "Complete certificate/types/ordered observations differ from frozen anchor") + else: + (output / "anchor.json").write_bytes(canonical(anchor) + b"\n") + need(inventory(frozen, pins) == frozen_before and inventory(HERE / "engine", ENGINE_PINS) == engine_before, + "Immutable source bytes/modes changed") + need(inventory(runtime, pins, exact=False) == runtime_before and inventory(engine, ENGINE_PINS) == copied_engine_before, + "Runtime scientific source bytes/modes changed") + runtime_files = {str(path.relative_to(runtime)) for path in runtime.rglob("*") if path.is_file()} + need(runtime_files == set(pins) | {"certificates/complex-network.json"}, "Unexpected full-caller file side effect") + need(Path(__file__).read_bytes() == driver_before and reference.read_bytes() == reference_bytes and + (anchor_bytes is None or args.anchor.read_bytes() == anchor_bytes), "Driver/reference/anchor changed during run") + receipt = { + "status": "FULL_NETWORK_PROFILE_ANCHOR_PASS" if args.mode == "profile" else "FULL_NETWORK_COMPLETE_PASS", + "mode": args.mode, "science": science, "base_commit": BASE, "native_predecessor_pr": 5929, + "driver_sha256": sha(driver_before), "source_pin_sha256": PIN_SHA, + "frozen_custody": frozen_before, "engine_custody": engine_before, "scientific_imports": imports, + "build": build, "finite_controls": finite, + "private_root_permission": "runtime-root is0755; copied input file modes are retained and checked; immutable stages are never chmodded", + "compiler_tmpdir": str(compiler_tmp), + "native_calls": None if binding is None else dict(binding["counters"]), + "phases": phases.rows, "process_wall_seconds_before_receipt": time.perf_counter() - START_WALL, + "process_and_compiler_cpu_seconds_before_receipt": cpu(), + "environment": {"python": sys.version, "executable": sys.executable, "platform": sys.platform}, + "measurement": "Parent outer guard is authoritative. Phases are nested observations, not additive costs. Profile is excluded from performance selection. Every timed arm includes copies, source checks, original CLI and retained full witnesses/transcripts; candidate additionally pays cold build/load/all finite controls.", + "scope": "Complete frozen historical complex-network CLI with retained observations; conditional certificate only. No bare-CLI factor, selected-frontier, new kappa or PR5864 speed claim.", + } + (output / "receipt.json").write_text(json.dumps(receipt, indent=2, sort_keys=True) + "\n") + sys.stdout.write(cli_stdout) + print(json.dumps({"status": receipt["status"], "mode": args.mode, "science": science, + "wall_seconds": receipt["process_wall_seconds_before_receipt"], + "cpu_seconds_with_compiler": receipt["process_and_compiler_cpu_seconds_before_receipt"], + "phases": phases.rows}, sort_keys=True)) + + + +# BEGIN G12 EXACT COMMON SOURCE +# G12 common scientific projection. SOURCE ONLY; appended verbatim to each +# independently source-authenticated selected driver, before its entry point. +# Uses that driver's original Fraction and canonical functions. No data/payload +# is fabricated here and no backend/native counters are compared by P07. +_G12_COMMON_SCHEMA = 'g12-original-remainder-common-v1' +_G12_SUFFIX_PHASES = ('verify_role_frames', 'full_log_integer_bounds', + 'original_upstream_verify_sources', 'original_serializable', + 'complete_original_cli') +_G12_SCIENTIFIC_PINS = ( + 'd623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1', + '0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b', + '88bba3caf5975f30fa7abceaea9454110cf3b069233e8241a2ca13d1dff171a7', + 'adc7f1241b42e322a6451854ab7e4b4c146bf78a') + + +def _g12_primitive(value): + """Lossless tagged exact builtin structures; never invoke foreign equality.""" + kind = type(value) + if kind is Fraction: + return ['Fraction', str(value.numerator), str(value.denominator)] + if value is None: + return ['None'] + if kind is bool: + return ['bool', value] + if kind is int: + return ['int', str(value)] + if kind is str: + return ['str', value] + if kind is bytes: + return ['bytes', value.hex()] + if kind is float: + return ['float', value.hex()] + if kind is tuple or kind is list: + return [kind.__name__, [_g12_primitive(item) for item in value]] + if kind is dict: + return ['dict', [[_g12_primitive(key), _g12_primitive(item)] + for key, item in value.items()]] + raise TypeError('G12 common projection requires exact original primitive types') + + +def _g12_bytes(value): + return canonical(_g12_primitive(value)) + + +def _g12_code_snapshot(code): + # Reject custom key/equality domains before inspecting the finite code map. + need(type(code) is dict and all(type(key) is str for key in code), + 'G12 actual original code must be an exact string-keyed dict') + need(set(code) == {'roles', 'gates', 'sources', 'outputs'}, + 'G12 original code field set changed') + need(type(code['roles']) is int and code['roles'] > 0 and + type(code['gates']) is list and type(code['sources']) is dict and + type(code['outputs']) is dict, 'G12 original code containers changed') + for gate in code['gates']: + need(type(gate) is tuple and len(gate) == 3 and type(gate[0]) is int and + type(gate[1]) is tuple and type(gate[2]) is tuple and + all(type(slot) is int for slot in gate[1] + gate[2]), + 'G12 original gate primitive types changed') + for source, slot in code['sources'].items(): + need(type(source) is tuple and len(source) == 3 and + all(type(point) is int for point in source) and type(slot) is int, + 'G12 original source primitive types changed') + need(all(type(index) is int and type(slot) is int + for index, slot in code['outputs'].items()), + 'G12 original output primitive types changed') + return _g12_bytes(code) + + +def _g12_remaining_count(code): + # Source-derived count after successful unchanged optimize0 role function; + # this is not a per-assert execution trace. + _g12_code_snapshot(code) + return (2 * sum(len(set(ins + outs)) for _, ins, outs in code['gates']) + + len(code['outputs']) + code['roles'] + len(code['sources'])) + + +def _g12_common_outputs(code, code_before, role_result, full_return, + certificate_bytes, stdout_text, suffix_phases): + need(type(code_before) is bytes and _g12_code_snapshot(code) == code_before, + 'G12 original code changed within the same invocation') + need(type(full_return) is dict and + all(type(key) is str for key in full_return) and + full_return.get('role_frames') is role_result, + 'G12 original role/full-return identity relation changed') + need(type(certificate_bytes) is bytes and type(stdout_text) is str and + type(suffix_phases) is tuple and + all(type(name) is str for name in suffix_phases) and + suffix_phases == _G12_SUFFIX_PHASES, + 'G12 actual original suffix outputs/phase completions changed') + return _g12_bytes((_G12_COMMON_SCHEMA, _G12_SCIENTIFIC_PINS, 25, (0, 2, 1), + code_before, role_result, full_return, certificate_bytes, + stdout_text, suffix_phases)) + +# END G12 EXACT COMMON SOURCE +# BEGIN G12 EXACT REFERENCE SUPPORT +# Fixed independent-original G12 reference control. SOURCE ONLY. +# Appended before the selected baseline driver's entry point. Every original +# scientific source remains byte-identical. This source has no execution gate. +import traceback as _g12_traceback + +_G12_AUTHORITY_PIN = 'f279ab86fc17c6a517b035f19d56863919cbd8304de4e7d5332457c6159aec10' +_G12_ROOT_PIN = 'f5a2d33f2b4d3651f214156a0e7094c2bb516ce2d5ab7698d18c11f98f35dee0' +_G12_ORIGINAL_DRIVER_PIN = '0d976d2eb6b845f20d4a3396591a806f966688b88693cd6a5f8a0c9e48925e36' +_G12_ORIGINAL_PHASES = ('side_construction', 'checks_initialization', 'compile_roles', + 'verify_map', 'verify_labels', 'verify_role_frames', + 'original_upstream_verify_sources', 'full_log_integer_bounds', + 'original_serializable', 'complete_original_cli') +_G12_SLOT_ORDER = ('rank', 'complement', 'side_construction', 'checks_initialization', + 'compile_roles', 'verify_map', 'verify_labels', 'roles', + 'original_upstream_verify_sources', 'full_log_integer_bounds', + 'serializable') +_G12_MISSING = object() +_G12_STATE = {'slots': [], 'imports': {}, 'cold_records': [], + 'secondary_errors': [], 'suffix_phases': [], 'step': 'BOOT'} + + +class _G12ReferenceCompletion(BaseException): + """Only the exact retained instance denotes intentional control completion.""" + + +def _g12_source_code_shape(code): + need(type(code) is _G12_STATE['code_type'], + 'G12 source comparison requires exact CodeType') + def constant(value): + kind = type(value) + if value is None or value is Ellipsis: + return ('singleton', value is Ellipsis) + if kind is int or kind is bool or kind is str or kind is bytes: + return (kind.__name__, value) + if kind is float: + return ('float', value.hex()) + if kind is tuple: + return ('tuple', tuple(constant(item) for item in value)) + if kind is frozenset: + items = [constant(item) for item in value] + return ('frozenset', tuple(sorted(items))) + if kind is _G12_STATE['code_type']: + return ('code', _g12_source_code_shape(value)) + raise RuntimeError('G12 source code has an unsupported constant') + return tuple(constant(value) for value in ( + code.co_argcount, code.co_posonlyargcount, code.co_kwonlyargcount, + code.co_nlocals, code.co_stacksize, code.co_flags, code.co_code, + code.co_names, code.co_varnames, code.co_freevars, code.co_cellvars, + code.co_exceptiontable, code.co_linetable, code.co_firstlineno, + code.co_filename, code.co_name, code.co_qualname, code.co_consts)) + + +def _g12_nested(code, name): + found = [item for item in code.co_consts + if type(item) is _G12_STATE['code_type'] and item.co_name == name] + need(len(found) == 1, 'G12 fixed source code path is not unique: ' + name) + return found[0] + + +def _g12_names(code): + pending, names = [code], [] + while pending: + current = pending.pop() + for name in current.co_names: + if name not in names: + names.append(name) + pending.extend(item for item in current.co_consts + if type(item) is _G12_STATE['code_type']) + return tuple(names) + + +def _g12_function_record(function): + root = _G12_STATE['root'] + need(type(function) is root.FunctionType, 'G12 original callable exact type changed') + values = tuple(getter(function, root.FunctionType) + for _, getter in _G12_STATE['function_fields']) + code, namespace, builtins_owner, defaults, keywords, closure, attributes = values + need(type(namespace) is dict and type(builtins_owner) is dict and + all(type(name) is str for name in namespace) and + all(type(name) is str for name in builtins_owner) and + type(attributes) is dict and all(type(name) is str for name in attributes), + 'G12 original callable namespace domain changed') + keyword_items = () if keywords is None else tuple(keywords.items()) + cells = () if closure is None else tuple((cell, cell.cell_contents) for cell in closure) + lookups = tuple((name, namespace.get(name, _G12_MISSING), + builtins_owner.get(name, _G12_MISSING)) for name in _g12_names(code)) + return function, values, keyword_items, cells, lookups, tuple(attributes.items()) + + +def _g12_expected(owner, name, original): + # Only the eleven literal slots below can change. Records are produced only + # by their fixed installation edges and are never supplied by a context. + for slot in _G12_STATE['slots']: + if owner is slot['owner'] and name == slot['attribute']: + need(original is slot['original'], 'G12 allowed slot original differs') + return slot['original'] if slot['restored'] else slot['observed'] + return original + + +def _g12_current_function(record): + function, values, keyword_items, cells, lookups, attributes_items = record + root = _G12_STATE['root'] + need(type(function) is root.FunctionType, 'G12 recorded function type changed') + for (_, getter), expected in zip(_G12_STATE['function_fields'], values): + need(getter(function, root.FunctionType) is expected, + 'G12 recorded function field changed') + _, namespace, builtins_owner, _, keywords, _, attributes = values + need(type(namespace) is dict and type(builtins_owner) is dict and + all(type(key) is str for key in namespace) and all(type(key) is str for key in builtins_owner), + 'G12 recorded function lookup domain changed') + if keywords is not None: + need(type(keywords) is dict and len(keywords) == len(keyword_items) and + all(type(key) is str for key in keywords), 'G12 keyword defaults changed') + for name, expected in keyword_items: + need(keywords.get(name, _G12_MISSING) is expected, 'G12 keyword default changed') + for cell, expected in cells: + need(cell.cell_contents is expected, 'G12 recorded closure cell changed') + need(type(attributes) is dict and len(attributes) == len(attributes_items) and + all(type(key) is str for key in attributes), 'G12 function attributes changed') + for name, expected in attributes_items: + need(attributes.get(name, _G12_MISSING) is expected, 'G12 function attribute changed') + for name, original, builtin_original in lookups: + need(namespace.get(name, _G12_MISSING) is _g12_expected(namespace, name, original), + 'G12 function effective global changed: ' + name) + need(builtins_owner.get(name, _G12_MISSING) is builtin_original, + 'G12 function effective builtin changed: ' + name) + + +def _g12_current_builtins(): + owner = _G12_STATE['builtin_owner'] + expected = _G12_STATE['builtin_items'] + need(type(owner) is dict and len(owner) == len(expected) and + all(type(name) is str for name in owner), 'G12 original builtin census changed') + for name, value in expected: + need(owner.get(name, _G12_MISSING) is value, 'G12 original builtin binding changed: ' + name) + + +def _g12_cold_call(operation, *args, **kwargs): + # The original caller-admission sequence is performed before dispatch. + # Descriptor came only from the actual pre-exposure Root/cold bootstrap. + descriptor = _G12_STATE['descriptor'] + primitive = descriptor[5] + type0, function_type, id0 = primitive[0], primitive[1], primitive[2] + error0, value_error0, zip0 = primitive[7], primitive[8], primitive[18] + dispatch, record = descriptor[2], descriptor[3] + if (_G12_STATE['authority'] is not descriptor[1] or dispatch is not record[0] or + type0(dispatch) is not function_type): + raise error0('G12 cold caller dispatcher identity differs') + for (_, getter), expected in zip0(primitive[4], record[1:7]): + if id0(getter(dispatch, function_type)) != id0(expected): + raise error0('G12 cold caller dispatcher environment differs') + if record[4] is not None or record[5] is not None or record[7]: + raise error0('G12 cold caller dispatcher defaults contract differs') + for cell, expected in record[8]: + try: + observed_id = id0(primitive[6](cell, primitive[5])) + except value_error0: + raise error0('G12 cold caller dispatcher cell became empty') from None + if observed_id != id0(expected): + raise error0('G12 cold caller dispatcher cell differs') + return dispatch(operation, *args, **kwargs) + + +def _g12_capture_cold_record(record): + # Consume exactly a record just returned by original cold2. This only + # captures currentness evidence for the two already-authenticated sources. + return (record, tuple(_g12_function_record(item[0]) for item in record[8])) + + +def _g12_current_cold_record(captured): + record, functions = captured + root = _G12_STATE['root'] + module, namespace = record[1], record[2] + need(type(module) is root.ModuleType and module.__dict__ is namespace and + sys.modules.get(record[3]) is module and type(namespace) is dict and + len(namespace) == len(record[7]) and all(type(key) is str for key in namespace), + 'G12 original registered module owner/census changed') + for name, original in record[7]: + need(namespace.get(name, _G12_MISSING) is _g12_expected(namespace, name, original), + 'G12 original module member changed: ' + name) + for cls, mro, proxy, members in record[9]: + need(type(cls) is type and type.__getattribute__(cls, '__mro__') is mro and + len(proxy) == len(members) and all(type(name) is str for name in proxy), + 'G12 original class owner/census changed') + for name, original in members: + need(proxy.get(name, _G12_MISSING) is _g12_expected(cls, name, original), + 'G12 original class member changed: ' + name) + for name, mapping, expected in record[10]: + need(type(mapping) is dict and len(mapping) == len(expected) and + all(type(key) is str for key in mapping), 'G12 backend dispatch map changed') + for key, value in expected: + need(mapping.get(key, _G12_MISSING) is value, 'G12 backend dispatch binding changed') + for function in functions: + _g12_current_function(function) + + +def _g12_authenticate_function(function, source_code, namespace, defaults): + root = _G12_STATE['root'] + need(type(function) is root.FunctionType and function.__globals__ is namespace and + function.__builtins__ is _G12_STATE['builtin_owner'] and + function.__kwdefaults__ is None and function.__closure__ is None and + type(function.__dict__) is dict and not function.__dict__, + 'G12 source callable owner/default/closure shape changed') + if defaults is None: + need(function.__defaults__ is None, 'G12 source callable defaults changed') + else: + need(type(function.__defaults__) is tuple and len(function.__defaults__) == len(defaults), + 'G12 source callable default tuple changed') + for actual, expected in zip(function.__defaults__, defaults): + need(type(actual) is type(expected) and actual == expected, + 'G12 source callable literal default changed') + need(_g12_source_code_shape(function.__code__) == _g12_source_code_shape(source_code), + 'G12 actual callable code differs from pinned source') + return _g12_function_record(function) + + +def _g12_source_tree(path, pin): + root, api = _G12_STATE['root'], _G12_STATE['api'] + api[0]() + observed, _, source = root._hash_regular(str(path), 1048576, True) + need(observed == pin and type(source) is bytes, 'G12 literal source bytes changed') + api[0]() + code = root._COMPILE(source, str(path), 'exec', dont_inherit=True, optimize=0) + api[0]() + return code + + +def _g12_import_owner(module, name, runtime, pins): + root = _G12_STATE['root'] + path = runtime / 'scripts' / (name + '.py') + need(type(module) is root.ModuleType and sys.modules.get(name) is module and + type(module.__dict__) is dict and type(module.__dict__.get('__name__')) is str and + module.__name__ == name and type(module.__dict__.get('__file__')) is str and + module.__file__ == str(path), 'G12 original import owner/path differs') + pin = pins['scripts/' + name + '.py'][0] + return module.__dict__, _g12_source_tree(path, pin), path, pin + + +def _g12_no_builtin_shadows(namespace, names): + for name in names: + need(name not in namespace and + _G12_STATE['builtin_owner'].get(name) is _G12_STATE['builtin_values'][name], + 'G12 imported callable builtin is shadowed: ' + name) + + +def _g12_authenticate_certify(module, runtime, pins): + namespace, code, path, pin = _g12_import_owner(module, 'certify', runtime, pins) + verify = _g12_authenticate_function(module.verify_sources, _g12_nested(code, 'verify_sources'), namespace, None) + require = _g12_authenticate_function(module.require, _g12_nested(code, 'require'), namespace, None) + stdlib = _G12_STATE['stdlib'] + need(namespace.get('json') is stdlib['json'] and namespace.get('hashlib') is stdlib['hashlib'] and + namespace.get('Path') is stdlib['Path'] and + type(namespace.get('ROOT')) is stdlib['path_instance_type'] and + str(namespace['ROOT']) == str(runtime), 'G12 certify effective source globals changed') + _g12_no_builtin_shadows(namespace, ('ValueError',)) + _G12_STATE['imports']['certify'] = (module, path, pin, (verify, require)) + + +def _g12_authenticate_prepare(module, runtime, pins): + namespace, code, path, pin = _g12_import_owner(module, 'prepare_layers', runtime, pins) + serializable = _g12_authenticate_function(module.serializable, _g12_nested(code, 'serializable'), namespace, None) + need(namespace.get('Q') is _G12_STATE['stdlib']['Fraction'], 'G12 serialization Fraction owner changed') + _g12_no_builtin_shadows(namespace, ('isinstance', 'str', 'dict', 'list', 'tuple')) + _G12_STATE['imports']['prepare_layers'] = (module, path, pin, (serializable,)) + + +def _g12_authenticate_search(module, runtime, pins): + namespace, code, path, pin = _g12_import_owner(module, 'search_network', runtime, pins) + integer = _g12_authenticate_function(module.log_integer_bounds, _g12_nested(code, 'log_integer_bounds'), namespace, None) + ratio = _g12_authenticate_function(module.log_ratio_bounds, _g12_nested(code, 'log_ratio_bounds'), namespace, (24,)) + certify = _G12_STATE['imports']['certify'][0] + need(namespace.get('Q') is _G12_STATE['stdlib']['Fraction'] and + namespace.get('require') is certify.require, + 'G12 logarithm source helper/Fraction binding changed') + _g12_no_builtin_shadows(namespace, ('sum', 'range')) + _G12_STATE['imports']['search_network'] = (module, path, pin, (integer, ratio)) + + +def _g12_slot_owner_value(owner, attribute): + if type(owner) is _G12_STATE['root'].ModuleType: + return owner.__dict__.get(attribute, _G12_MISSING) + return type.__getattribute__(owner, '__dict__').get(attribute, _G12_MISSING) + + +def _g12_install_record(tag, owner, attribute, original, observed, code, namespace, + closure_values, defaults=None): + need(len(_G12_STATE['slots']) < len(_G12_SLOT_ORDER) and + tag == _G12_SLOT_ORDER[len(_G12_STATE['slots'])], 'G12 observer install order changed') + need(_g12_slot_owner_value(owner, attribute) is observed and + type(observed) is _G12_STATE['root'].FunctionType and + observed.__globals__ is namespace and observed.__builtins__ is _G12_STATE['builtin_owner'] and + observed.__kwdefaults__ is None and not observed.__dict__ and + _g12_source_code_shape(observed.__code__) == _g12_source_code_shape(code), + 'G12 actual observer provenance changed: ' + tag) + if defaults is None: + need(observed.__defaults__ is None, 'G12 observer defaults changed') + else: + need(type(observed.__defaults__) is tuple and len(observed.__defaults__) == len(defaults) and + all(actual is expected for actual, expected in zip(observed.__defaults__, defaults)), + 'G12 observer default identity changed') + names = observed.__code__.co_freevars + need(type(observed.__closure__) is tuple and len(observed.__closure__) == len(names) and + set(names) == set(closure_values), 'G12 observer freevar set changed') + for name, cell in zip(names, observed.__closure__): + need(cell.cell_contents is closure_values[name], 'G12 observer closure provenance changed: ' + name) + _G12_STATE['slots'].append({'tag': tag, 'owner': owner.__dict__ if type(owner) is _G12_STATE['root'].ModuleType else owner, + 'setter_owner': owner, 'attribute': attribute, 'original': original, + 'observed': observed, 'record': _g12_function_record(observed), 'restored': False}) + + +def _g12_load_backend(engine): + module, handle = _g12_cold_call(0, str(engine / 'native_backend.py'), ENGINE_PINS['native_backend.py'], + 'native_backend', kind='backend') + record = _g12_cold_call(2, handle) + _G12_STATE['backend'] = module + _G12_STATE['backend_handle'] = handle + _G12_STATE['cold_records'].append(_g12_capture_cold_record(record)) + return module + + +def _g12_load_circuit(engine): + module, handle = _g12_cold_call(0, str(engine / 'source/complex_circuit.py'), + ENGINE_PINS['source/complex_circuit.py'], 'complex_circuit') + record = _g12_cold_call(2, handle) + _G12_STATE['circuit'] = module + _G12_STATE['circuit_handle'] = handle + _G12_STATE['cold_records'].append(_g12_capture_cold_record(record)) + _G12_STATE['backend'].guard_module(module) + _G12_STATE['original_rank'] = module.rank + _G12_STATE['original_complement'] = module.Label.__dict__['complement_in'] + return module + + +def _g12_trace_installed(backend, module, rank_calls, complement): + need(backend is _G12_STATE['backend'] and module is _G12_STATE['circuit'] and + type(rank_calls) is list and not rank_calls and type(complement) is backend.ComplementTrace and + complement.label is module.Label, 'G12 actual original trace objects changed') + _G12_STATE['rank_calls'], _G12_STATE['complement'] = rank_calls, complement + parent = backend.attach_trace.__code__ + _g12_install_record('rank', module, 'rank', _G12_STATE['original_rank'], module.rank, + _g12_nested(parent, 'traced_rank'), backend.__dict__, + {'original_rank': _G12_STATE['original_rank'], 'rank_calls': rank_calls}) + _g12_install_record('complement', module.Label, 'complement_in', _G12_STATE['original_complement'], + module.Label.__dict__['complement_in'], _g12_nested(parent, 'traced_complement'), + backend.__dict__, {'original_complement': _G12_STATE['original_complement'], + 'complement_trace': complement}) + + +def _g12_wrap(phases, owner, attribute, name): + original, observed = phases.wrap(owner, attribute, name) + _g12_install_record(name, owner, attribute, original, observed, + _g12_nested(Phases.wrap.__code__, 'observed'), globals(), + {'name': name, 'original': original, 'self': phases}) + return original, observed + + +def _g12_roles_installed(module, original, observed, phases, captures): + _G12_STATE['captures'] = captures + _g12_install_record('roles', module, 'verify_role_frames', original, observed, + _g12_nested(main.__code__, 'observe_roles'), globals(), + {'captures': captures, 'original_roles': original, 'phases': phases}, (None,)) + + +def _g12_serializable_installed(module, original, observed, phases, captures): + _g12_install_record('serializable', module, 'serializable', original, observed, + _g12_nested(main.__code__, 'observe_serializable'), globals(), + {'captures': captures, 'depth': 0, 'original_serializable': original, 'phases': phases}) + + +def _g12_current(): + _g12_current_builtins() + _G12_STATE['api'][0]() + for record in _G12_STATE['driver_functions']: + _g12_current_function(record) + need(len(globals()) == len(_G12_STATE['driver_items']) and + all(type(name) is str for name in globals()), 'G12 selected driver namespace census changed') + for name, original in _G12_STATE['driver_items']: + need(globals().get(name, _G12_MISSING) is original, 'G12 selected driver global changed: ' + name) + need(Phases is _G12_STATE['phase_owner'] and type(Phases) is type and + type.__getattribute__(Phases, '__bases__') is _G12_STATE['phase_bases'] and + type.__getattribute__(Phases, '__mro__') is _G12_STATE['phase_mro'], + 'G12 original Phases owner/bases/MRO changed') + need(len(Phases.__dict__) == len(_G12_STATE['phase_members']), 'G12 original Phases census changed') + for name, original in _G12_STATE['phase_members']: + need(Phases.__dict__.get(name, _G12_MISSING) is original, 'G12 original Phases member changed') + for record in _G12_STATE['stdlib_functions']: + _g12_current_function(record) + stdlib = _G12_STATE['stdlib'] + need(json is stdlib['json'] and json.loads is stdlib['json_loads'] and + hashlib is stdlib['hashlib'] and hashlib.sha256 is stdlib['hashlib_sha256'] and + Path is stdlib['Path'] and Fraction is stdlib['Fraction'], 'G12 original standard operation changed') + for captured in _G12_STATE['cold_records']: + _g12_current_cold_record(captured) + for name, (module, path, pin, records) in _G12_STATE['imports'].items(): + need(sys.modules.get(name) is module and module.__file__ == str(path), 'G12 imported source owner changed') + for record in records: + _g12_current_function(record) + need(tuple(slot['tag'] for slot in _G12_STATE['slots']) == _G12_SLOT_ORDER, + 'G12 literal observer slot census changed') + for slot in _G12_STATE['slots']: + expected = slot['original'] if slot['restored'] else slot['observed'] + need(_g12_slot_owner_value(slot['setter_owner'], slot['attribute']) is expected, + 'G12 installed observer slot changed: ' + slot['tag']) + _g12_current_function(slot['record']) + + +def _g12_reference_mode(args): + need(args.mode == 'profile' and args.anchor is None, + 'G12 reference source control only permits original uncached profile/no-anchor lane') + + +def _g12_bind_main(phases, captures, frozen, runtime, engine, output, reference, reference_bytes, + driver_before, pins, frozen_before, engine_before, runtime_before, + copied_engine_before, script_names, old_argv, stdout): + need(_G12_STATE['step'] == 'BOOT' and type(phases) is Phases and + captures is _G12_STATE['captures'] and type(captures) is dict and not captures, + 'G12 reference invocation owner changed') + _G12_STATE.update({'phases': phases, 'frozen': frozen, 'runtime': runtime, 'engine': engine, + 'output': output, 'reference': reference, 'reference_bytes': reference_bytes, + 'driver_before': driver_before, 'pins': pins, 'frozen_before': frozen_before, + 'engine_before': engine_before, 'runtime_before': runtime_before, + 'copied_engine_before': copied_engine_before, 'script_names': script_names, + 'old_argv': old_argv, 'stdout': stdout, 'step': 'CLI_ENTER'}) + _g12_current() + + +def _g12_rank_snapshot(): + ranks = _G12_STATE['rank_calls'] + need(type(ranks) is list, 'G12 original rank event store changed') + for event in ranks: + need(type(event) is tuple and len(event) == 2 and type(event[0]) is tuple and + all(type(value) is int for value in event[0]) and type(event[1]) is int, + 'G12 original rank event primitive type changed') + return _g12_bytes(tuple(ranks)) + + +def _g12_diagnostic_snapshot(): + return {'rank_event_count': len(_G12_STATE['rank_calls']), + 'ordered_rank_events_hex': _g12_rank_snapshot().hex(), + 'complement_receipt': _G12_STATE['complement'].receipt(), + 'native_binding': None, 'cache_binding': None} + + +def _g12_original_prefix(checks): + module = _G12_STATE['circuit'] + c, code = _G12_STATE['c'], _G12_STATE['code'] + need(type(c) is module.ComplexSideCircuit and type(checks) is module.Checks and + checks.c is c and type(c.h) is int and c.h == 25 and type(checks.h) is int and checks.h == 25, + 'G12 reference requires the actual original h25 generation') + fields = object.__getattribute__(checks, '__dict__') + need(type(fields) is dict and all(type(key) is str for key in fields) and + set(fields) == {'c', 'h', 'cache', 'verdicts', 'everything'} and + type(checks.cache) is dict and type(checks.verdicts) is dict and + type(c.active) is set and all(type(node) is int for node in c.active) and + len(c.active) == 82895 and type(c.triples) is list and len(c.triples) == 2300, + 'G12 original prefix owner/container census changed') + for target in c.triples: + need(type(target) is tuple and len(target) == 3 and all(type(point) is int for point in target) and + 0 <= target[0] < target[1] < target[2] < 25, + 'G12 original canonical target tuple changed') + for key in checks.cache: + need(type(key) is int or + (type(key) is tuple and len(key) == 2 and type(key[0]) is str and key[0] == 'perp' and + type(key[1]) is tuple and len(key[1]) == 3 and all(type(point) is int for point in key[1])), + 'G12 original label-store key primitive type changed') + need(set(checks.cache) == c.active | {('perp', target) for target in c.triples} and + len(checks.cache) == 85195 and ('perp', (0, 2, 1)) not in checks.cache, + 'G12 original canonical label store or missing extra target changed') + for label in tuple(checks.cache.values()) + (checks.everything,): + need(type(label) is module.Label, 'G12 original exact Label type changed') + values = object.__getattribute__(label, '__dict__') + need(type(values) is dict and all(type(key) is str for key in values) and + set(values) == {'basis', 'dim', 'key'} and type(label.basis) is dict and + all(type(key) is int and type(value) is int for key, value in label.basis.items()) and + type(label.dim) is int and label.dim == len(label.basis) and type(label.key) is tuple and + all(type(value) is int for value in label.key) and + label.key == tuple(sorted(label.basis.values())), 'G12 original Label state changed') + need(_g12_code_snapshot(code) == _G12_STATE['code_before'], 'G12 original code changed before extra call') + + +def _g12_reference_after_phase(phases, name, function, args, kwargs, result): + if name not in ('compile_roles', 'verify_labels', 'complete_original_cli'): + if _G12_STATE['step'] == 'SUFFIX' and name in _G12_SUFFIX_PHASES: + _G12_STATE['suffix_phases'].append(name) + return result + need(phases is _G12_STATE['phases'], 'G12 fixed original phase owner changed') + _g12_current() + if name == 'compile_roles': + need(_G12_STATE['step'] == 'CLI_ENTER' and not kwargs and len(args) == 1 and + function is _G12_STATE['slots'][4]['original'], 'G12 original compile checkpoint changed') + _G12_STATE.update({'c': args[0], 'code': result, 'code_before': _g12_code_snapshot(result), + 'step': 'COMPILED'}) + return result + if name == 'verify_labels': + need(_G12_STATE['step'] == 'COMPILED' and not kwargs and len(args) == 1 and + function is _G12_STATE['slots'][6]['original'], 'G12 original label checkpoint changed') + checks = args[0] + _g12_original_prefix(checks) + _G12_STATE['checks'] = checks + _G12_STATE['prefix_end'] = _g12_diagnostic_snapshot() + extra = checks.target_frame((0, 2, 1)) + need(type(extra) is _G12_STATE['circuit'].Label and + checks.cache[('perp', (0, 2, 1))] is extra and len(checks.cache) == 85196, + 'G12 actual original extra store changed') + literal = checks.label_ok(checks.everything) + need(type(literal) is bool, 'G12 original literal result type changed') + _G12_STATE['literal'] = literal + _G12_STATE['suffix_start'] = _g12_diagnostic_snapshot() + _G12_STATE['suffix_rank_index'] = len(_G12_STATE['rank_calls']) + _G12_STATE['suffix_rank_prefix'] = _g12_rank_snapshot() + _G12_STATE['step'] = 'SUFFIX' + return result + need(_G12_STATE['step'] == 'SUFFIX' and len(args) == 1 and + type(kwargs) is dict and tuple(kwargs) == ('run_name',) and + type(kwargs['run_name']) is str and kwargs['run_name'] == '__main__' and + function is runpy.run_path, 'G12 original complete CLI checkpoint changed') + _G12_STATE['suffix_phases'].append(name) + _g12_capture_completed_cli(result) + _G12_STATE['step'] = 'MARKED' + marker = _G12ReferenceCompletion('G12 intentional independent original reference completion') + _G12_STATE['marker'] = marker + raise marker + + +def _g12_capture_completed_cli(namespace): + module = _G12_STATE['circuit'] + captures = _G12_STATE['captures'] + need(type(namespace) is dict and all(type(key) is str for key in namespace) and + sys.modules.get('complex_circuit') is module and + namespace.get('ComplexSideCircuit') is module.ComplexSideCircuit and + namespace.get('Checks') is module.Checks and namespace.get('compile_roles') is module.compile_roles and + namespace.get('verify_role_frames') is _G12_STATE['slots'][7]['observed'] and + namespace.get('serializable') is _G12_STATE['slots'][10]['observed'], + 'G12 original CLI namespace/observer provenance changed') + need(type(captures) is dict and all(type(key) is str for key in captures) and + set(captures) == {'side', 'full_return'} and type(captures['side']) is tuple and len(captures['side']) == 4, + 'G12 complete actual original capture set changed') + c, checks, code, roles = captures['side'] + full_return = captures['full_return'] + need(c is _G12_STATE['c'] and checks is _G12_STATE['checks'] and code is _G12_STATE['code'] and + type(full_return) is dict and all(type(key) is str for key in full_return) and + full_return.get('role_frames') is roles and type(full_return.get('upstream_commit')) is str and + full_return['upstream_commit'] == UPSTREAM, + 'G12 same original generation/role/full return binding changed') + stdout_text = _G12_STATE['stdout'].getvalue() + certificate = (_G12_STATE['runtime'] / 'certificates/complex-network.json').read_bytes() + need(stdout_text == EXPECTED_STDOUT and certificate == _G12_STATE['reference_bytes'], + 'G12 original fresh CLI stdout/certificate differs from original immutable reference') + for name in _G12_ORIGINAL_PHASES[:-1]: + need(_G12_STATE['phases'].rows.get(name, {}).get('calls') == 1, + 'G12 original phase omitted/repeated before marker: ' + name) + need('complete_original_cli' not in _G12_STATE['phases'].rows, + 'G12 original CLI phase finally ran before its actual return hook') + _g12_check_import_paths() + index = _G12_STATE['suffix_rank_index'] + ranks = _G12_STATE['rank_calls'] + need(_g12_bytes(tuple(ranks[:index])) == _G12_STATE['suffix_rank_prefix'], + 'G12 retained original rank prefix changed') + common = _g12_common_outputs(code, _G12_STATE['code_before'], roles, full_return, + certificate, stdout_text, tuple(_G12_STATE['suffix_phases'])) + _G12_STATE.update({'namespace': namespace, 'full_return': full_return, 'role_result': roles, + 'certificate_bytes': certificate, 'stdout_text': stdout_text, + 'case_count': _g12_remaining_count(code), 'common': common, + 'cli_end': _g12_diagnostic_snapshot(), + 'rank_suffix': _g12_bytes(tuple(ranks[index:]))}) + + +def _g12_check_import_paths(): + runtime, engine = _G12_STATE['runtime'], _G12_STATE['engine'] + for name in _G12_STATE['script_names'] - {'complex_network'}: + module = sys.modules.get(name) + expected = engine / 'source/complex_circuit.py' if name == 'complex_circuit' else runtime / 'scripts' / (name + '.py') + need(type(module) is _G12_STATE['root'].ModuleType and + type(module.__dict__.get('__file__')) is str and Path(module.__file__).resolve() == expected.resolve(), + 'G12 unpinned original scientific import: ' + name) + + +def _g12_source_output_custody(): + state = _G12_STATE + need(inventory(state['frozen'], state['pins']) == state['frozen_before'] and + inventory(HERE / 'engine', ENGINE_PINS) == state['engine_before'], + 'G12 immutable original source bytes/modes changed') + need(inventory(state['runtime'], state['pins'], exact=False) == state['runtime_before'] and + inventory(state['engine'], ENGINE_PINS) == state['copied_engine_before'], + 'G12 original runtime source bytes/modes changed') + files = {str(path.relative_to(state['runtime'])) for path in state['runtime'].rglob('*') if path.is_file()} + need(files == set(state['pins']) | {'certificates/complex-network.json'}, + 'G12 original runtime output file set changed') + need(Path(__file__).read_bytes() == state['driver_before'] and + state['reference'].read_bytes() == state['reference_bytes'], + 'G12 selected reference driver/immutable certificate changed') + _g12_check_import_paths() + + +def _g12_restore_and_check(success_marker): + errors = _G12_STATE['secondary_errors'] + try: + if _G12_STATE.get('phases') is not None: + _g12_current() + need(sys.argv is _G12_STATE['old_argv'], 'G12 original main did not restore sys.argv') + if success_marker: + for name in _G12_ORIGINAL_PHASES: + need(_G12_STATE['phases'].rows.get(name, {}).get('calls') == 1, + 'G12 original final phase omitted/repeated: ' + name) + except BaseException as error: + errors.append((error, error.__traceback__, 'pre-restoration-currentness')) + for slot in reversed(_G12_STATE['slots']): + try: + _g12_current_function(slot['record']) + need(not slot['restored'] and + _g12_slot_owner_value(slot['setter_owner'], slot['attribute']) is slot['observed'], + 'G12 refusing to overwrite changed/already-restored observer: ' + slot['tag']) + setattr(slot['setter_owner'], slot['attribute'], slot['original']) + slot['restored'] = True + except BaseException as error: + errors.append((error, error.__traceback__, 'restore-' + slot['tag'])) + # A missing early handle is not fabricated. Existing handles are checked + # once each even after a primary failure; any failure blocks reference export. + for name in ('backend_handle', 'circuit_handle'): + if name in _G12_STATE: + try: + _g12_cold_call(2, _G12_STATE[name]) + except BaseException as error: + errors.append((error, error.__traceback__, 'final-cold2-' + name)) + if success_marker: + try: + _g12_source_output_custody() + except BaseException as error: + errors.append((error, error.__traceback__, 'final-original-source-output-custody')) + + +def _g12_emit_secondary_errors(): + for error, traceback, phase in _G12_STATE['secondary_errors']: + try: + sys.stderr.write('G12 secondary reference failure: ' + phase + '\n') + _g12_traceback.print_exception(type(error), error, traceback, file=sys.stderr) + except BaseException: + # Raw exception/traceback objects remain retained in the exact + # source-owned secondary tuple. Never replace the first primary. + pass + + +def _g12_export_reference(): + state = _G12_STATE + need(state['step'] == 'MARKED' and not state['secondary_errors'] and + all(slot['restored'] for slot in state['slots']), + 'G12 reference export requires complete source-owned restoration') + common = state['common'] + envelope = {'schema': 'g12-independent-original-reference-envelope-v1', + 'producer_role': 'independent-original-uncached', + 'selected_driver_sha256': sha(state['driver_before']), + 'original_driver_sha256': _G12_ORIGINAL_DRIVER_PIN, + 'authority_source_sha256': _G12_AUTHORITY_PIN, + 'original_scientific_pins': list(_G12_SCIENTIFIC_PINS), + 'h': 25, 'extra_target': [0, 2, 1], + 'literal_original_type': 'bool', 'literal_original_value': state['literal'], + 'remaining_original_case_count': state['case_count'], + 'common_payload_sha256': sha(common), 'common_payload_hex': common.hex(), + 'scope': 'Actual original N22 literal and P07 common remainder observations only; no original PROFILE_ANCHOR_PASS, FULL_PASS, native qualification or G12 approval.'} + diagnostic = {'schema': 'g12-independent-original-reference-diagnostics-v1', + 'producer_role': envelope['producer_role'], + 'selected_driver_sha256': envelope['selected_driver_sha256'], + 'common_payload_sha256': envelope['common_payload_sha256'], + 'prefix_end': state['prefix_end'], 'suffix_start': state['suffix_start'], + 'cli_end': state['cli_end'], 'ordered_rank_suffix_hex': state['rank_suffix'].hex(), + 'complement_suffix_limit': 'Only cumulative original start/end receipts; no digest subtraction or suffix-stream claim.', + 'phases': state['phases'].rows, + 'completion': 'Exact source-owned intentional marker followed by original finally, exact observer restoration, both cold2 checks and original source/output custody.'} + # New immutable payloads are produced only after all qualification predicates + # above. Parent must separately retain/hash/admit these actual output bytes. + for filename, data in (('g12-reference.common.json', canonical(envelope) + b'\n'), + ('g12-reference.diagnostics.json', canonical(diagnostic) + b'\n')): + with (state['output'] / filename).open('xb') as stream: + stream.write(data) + state['step'] = 'EXPORTED' + + +def _g12_reference_entry(): + try: + main() + except BaseException as primary: + is_marker = primary is _G12_STATE.get('marker') and _G12_STATE['step'] == 'MARKED' + _G12_STATE['primary'] = (primary, primary.__traceback__, primary.__cause__) + try: + _g12_restore_and_check(is_marker) + except BaseException as secondary: + _G12_STATE['secondary_errors'].append((secondary, secondary.__traceback__, 'restoration-entry')) + try: + _g12_emit_secondary_errors() + except BaseException as secondary: + _G12_STATE['secondary_errors'].append((secondary, secondary.__traceback__, 'secondary-evidence-entry')) + if not is_marker: + raise + if _G12_STATE['secondary_errors']: + first, traceback, _ = _G12_STATE['secondary_errors'][0] + raise first.with_traceback(traceback) from None + _g12_export_reference() + return + raise RuntimeError('G12 reference reached original full-positive publication without its required marker') + + +def _g12_reference_bootstrap(): + root, capability, api = bootstrap_root, bootstrap_capability, bootstrap_api + need(type(api) is tuple and len(api) == 4 and type(root) is root.ModuleType and + all(type(entry) is root.FunctionType and entry.__globals__ is root.__dict__ for entry in api), + 'G12 reference requires actual parent Root bootstrap values') + need(api[0]() == _G12_ROOT_PIN and sys.flags.optimize == 0, + 'G12 reference actual Root or original assertions differ') + _G12_STATE.update({'root': root, 'api': api, 'capability': capability, + 'code_type': type(main.__code__), + 'builtin_owner': root.builtins.__dict__, + 'builtin_items': tuple(root.builtins.__dict__.items()), + 'builtin_values': dict(root.builtins.__dict__), + 'function_fields': tuple((name, root.FunctionType.__dict__[name].__get__) for name in + ('__code__', '__globals__', '__builtins__', '__defaults__', + '__kwdefaults__', '__closure__', '__dict__'))}) + authority_path = __file__.rsplit('/', 2)[0] + '/areas/cache-validity/cold_authority_v7.py' + api[0]() + digest, _, source = root._hash_regular(authority_path, 1048576, True) + need(digest == _G12_AUTHORITY_PIN, 'G12 selected cold source not mounted; historical stage is insufficient') + authority_module = root.ModuleType('_h25_g12_reference_cold_authority') + namespace = authority_module.__dict__ + namespace.update({'__file__': authority_path, '__builtins__': root.builtins.__dict__}) + api[0]() + compiled = root._COMPILE(source, authority_path, 'exec', dont_inherit=True, optimize=root._OPTIMIZE) + api[0]() + root._EXEC(compiled, namespace) + api[0]() + bundle = namespace['capture_epoch_authority'](root, capability, api) + authority = bundle[1] + need(type(authority) is tuple and len(authority) == 7 and + all(type(entry) is root.FunctionType for entry in authority), 'G12 original cold operations shape changed') + transport = root.FunctionType.__dict__['__dict__'].__get__(authority[0], root.FunctionType) + descriptor = transport['_h25_caller_descriptor'] + need(type(descriptor) is tuple and len(descriptor) == 6 and descriptor[1] is authority, + 'G12 initial original cold caller descriptor changed') + _G12_STATE.update({'authority': authority, 'descriptor': descriptor, 'bundle': bundle}) + api[0]() + driver_digest, _, driver_source = root._hash_regular(__file__, 1048576, True) + selected_code = root._COMPILE(driver_source, __file__, 'exec', dont_inherit=True, optimize=0) + api[0]() + _g12_authenticate_function(main, _g12_nested(selected_code, 'main'), globals(), None) + phases_code = _g12_nested(selected_code, 'Phases') + for name in ('__init__', 'call', 'wrap'): + _g12_authenticate_function(Phases.__dict__[name], _g12_nested(phases_code, name), globals(), None) + need(type(Phases) is type and Phases.__bases__ == (object,) and + Phases.__mro__ == (Phases, object), 'G12 source-declared Phases class bases/MRO differ') + _G12_STATE.update({'phase_owner': Phases, 'phase_bases': Phases.__bases__, + 'phase_mro': Phases.__mro__}) + stdlib = {'json': json, 'json_loads': json.loads, 'hashlib': hashlib, + 'hashlib_sha256': hashlib.sha256, 'Path': Path, 'Fraction': Fraction, + 'path_instance_type': type(Path(__file__))} + _G12_STATE['stdlib'] = stdlib + _G12_STATE['stdlib_functions'] = tuple(_g12_function_record(function) + for function in (json.loads, json.dumps) + if type(function) is root.FunctionType) + # The source executor, not a scientific import result, owns this initial + # selected namespace. The two named own-function/class code paths above + # additionally bind actual main/Phases to the exact selected source bytes. + _G12_STATE['driver_functions'] = tuple(_g12_function_record(value) + for value in tuple(globals().values()) + if type(value) is root.FunctionType and value.__globals__ is globals()) + _G12_STATE['driver_functions'] += tuple(_g12_function_record(Phases.__dict__[name]) + for name in ('__init__', 'call', 'wrap')) + _G12_STATE['phase_members'] = tuple(Phases.__dict__.items()) + _G12_STATE['driver_items'] = tuple(globals().items()) + _G12_STATE['selected_driver_digest'] = driver_digest + + +_g12_reference_bootstrap() + +# END G12 EXACT REFERENCE SUPPORT + +if __name__ == "__main__": + _g12_reference_entry() diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/COST-BILL-v1.json b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/COST-BILL-v1.json new file mode 100644 index 0000000000..405aa5e2f0 --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/COST-BILL-v1.json @@ -0,0 +1,130 @@ +{ + "all_current_actual_wall_cpu_peak_bytes": null, + "all_current_final_tail": null, + "funding_and_fit_accepted": false, + "g12_all_charged_categories": [ + "source/stage/plan/authentication and dependency preflight", + "parent invocation setup and known lease operations", + "adapter bootstrap source read/hash/compile/exec and argv/module alias custody/restoration", + "entire independent uncached reference including fresh copies/engine imports/original CLI/trace capture/original checks/finally/restoration/cold2", + "guard launch/time/monitoring/STOP/final original source inventory/usage/raw-log hashing/receipt", + "actual parent wait and known descendant/group/FD cleanup", + "canonical receipt and START joins plus all complete raw evidence retention", + "both exports full reads/hashes/JSON/schema/payload decode/crosslinks and repeated pair checks", + "new parent copies/write/fsync/chmod/close/directory sync/readback", + "manifest schema/write/hash/fsync/close/readback and source-selection publication tail", + "parent failure/secondary-error retention and necessary cleanup after deadline", + "cold consumer complete manifest/pair/publication read/hash/parse/decode/recheck and all retained alias lifetimes" + ], + "g12_work_assignment": { + "C01": "initial parent/Root/bootstrap/source-owned admission; actual process/generation/pidfd observations", + "C02": "all source/header/closure/input reads, hashes, complete copies, stage assembly and exact source/inverse review", + "C05": "full source and operation graph capture/validation plus overlapping parsed/code/source object lifetimes", + "C10": "entire unchanged original uncached producer and its complete independent observations", + "C12": "raw primary, cause, traceback and every secondary graph retained through final disposal; fixed slots do not imply fixed retained graph bytes", + "C13": "both complete exports, JSON/tag/hex checks, complete original logs/usage/START/receipt, copies/manifest/publication/readback", + "C14": "all normal and failed cleanup/restoration and known descriptor/process closes, source/namespace final checks", + "C15": "whole parent entry through all final closes/return/source adoption, failure retention and later cold quadruple rereads; no free last tail" + }, + "gain_claimed": false, + "memory": "All simultaneous raw/decoded/hex/tagged/schema/source/code/copy/error/traceback/FD ownership is billed. Finite size/depth ceilings reject; they grant no resources or proof of fit. Nested producer times remain diagnostic, not additive disjoint totals.", + "new_cap_or_reservation": false, + "original_caps": { + "RSS_bytes": 1073741824, + "Root_seconds": 180, + "global_seconds": 2400 + }, + "original_categories_unchanged": [ + { + "id": "C01", + "includes": "Pristine Root startup, initial TCB authentication, early cold authority capture, queue admission, all process/group/child tracking and aggregate outer measurement; charge before driver START_WALL and after its final sample.", + "owner": "pristine_root_parent" + }, + { + "id": "C02", + "includes": "All original and new source/input inventory/hash/byte/mode checks, pinned closure copy, static packet assembly/inverses, retained source/proof copies, installation inventories and actual startup reads in each selected invocation.", + "owner": "source_custody_copy" + }, + { + "id": "C03", + "includes": "Each of three original metadata cold builds plus all original backend/trace/native builds and child CPU/wall/IO/logs/journals/dependency/header reads. Failed builds and no-retry termination remain charged; no reused binary or zero-cost compiler fixture.", + "owner": "cold_native_builds" + }, + { + "id": "C04", + "includes": "Current actual native/header/FFI/provider/loaded-image/stdlib/primitive profile, preflight, controls, source admission and every original direct/native/reference check. Source definition does not create observed receipts.", + "owner": "native_profile_and_controls" + }, + { + "id": "C05", + "includes": "OriginalGraph, typed factory/source/function/class/default/closure/global/lookup snapshots, twelve actual product roles, native bind clone, AST parse/deepcopy/compile and strict whole-source/code inverses; all concurrent old/new source, AST, code, result and proof graphs.", + "owner": "factory_graph_products" + }, + { + "id": "C06", + "includes": "Every genuine original circuit/Checks/fixture constructor including prearm P08 extra constructor, fallback, native, normalization, counters, source checks and bookkeeping; all fixture copies/temporaries/oracle preparation are charged without suppressed effects.", + "owner": "genuine_circuit_checks_fixtures" + }, + { + "id": "C07", + "includes": "K committed records: dict index capacity, native id integer and fixed seven-field record tuple; at most one pending record; original store/constructor work and actual metadata capacities. Labels/basis/keys are original pointers but retained capacity and transient ownership still charged.", + "owner": "registration_and_storage" + }, + { + "id": "C08", + "includes": "Q actual private role/label/residual requests, nonce and request dictionary, operand tuples, stage/view set, signatures, prepare/finish, literal key/member/store, exact identity comparisons, current source+native checks and original authority state. Do not infer Q from complement or Gram counts.", + "owner": "private_requests" + }, + { + "id": "C09", + "includes": "All unsupported mapping/hook/public escape/reentry/capacity/lifetime fallbacks: retirement, original Owner._data, public V8 canonicalization/collision/counters and full continuation. Charge private attempt plus fallback; no silent truncated case or fast-pass credit.", + "owner": "public_fallback_retirement" + }, + { + "id": "C10", + "includes": "All original arithmetic kernels, independent Fraction work, ordered rank/complement trace, full map/labels/roles/integer-bound/upstream verification and exact type/order witness collection. Baseline and candidate both retain complete obligations.", + "owner": "original_arithmetic_observations" + }, + { + "id": "C11", + "includes": "Every required original cache helper body with each distinct genuine context/source image/mode/lifecycle and all existing control unions in their original activities. Include source fault image preparation, fresh owner/bootstrap, construction, execution, oracles and cleanup for each invocation; body count is not funded command count.", + "owner": "control_case_contexts" + }, + { + "id": "C12", + "includes": "Every P/A/S/R/J and absent-record P/R1/J1/R2/J2 channel allocation, transfer, ACK and consumed-replay check, fixed records/dicts and append-only lists. Retain exact raw errors, causes and traceback/Label/Checks/native/source graph frames until proper parent disposal; finite pointer count does not bound retained graph bytes.", + "owner": "error_channel_custody" + }, + { + "id": "C13", + "includes": "Original lossless typed serialization, full stdout/certificate/side/complement outputs, witnesses, comparisons, source and result hashing, receipt writes, fs metadata/IO and diagnostics. Do not substitute a digest for the original observations or omit failed-attempt evidence.", + "owner": "serialization_outputs" + }, + { + "id": "C14", + "includes": "All normal/error disarm, retirement, metadata close, native owner disposal, source/stdlib/current checks, before-late and late-last, STOP evidence, final custody checks and process teardown. Include both failed cleanup attempts and secondary retention; no forbidden post-late native check.", + "owner": "terminal_cleanup" + }, + { + "id": "C15", + "includes": "Complete parent scheduling/monitoring/accounting, log/receipt/custody readback and retained FD/image/page/allocator/GC/RSS tail through last child/process exit. Charge all retries only if separately authorized; failed or rejected runs are not subtracted.", + "owner": "parent_accounting_resource_tail" + } + ], + "original_contract": { + "bytes": 9184, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v1/contracts/COMPLETE-SYMBOLIC-COST-DEFINITION-v1.json", + "sha256": "6ab22ebb387f15f9a1fd91e257ecae649eb4b177af32d4652c2eaec061e3b48c" + }, + "original_full_invoice": { + "cpu": "CPU_total is actual parent/driver and all compiler/control/helper child process CPU, including failed setup/cleanup and receipt tails, with each process lifetime counted once.", + "index": "For every separately selected actual invocation j and every unique exclusive work segment e, assign exactly one C01-C15 owner. Assign shared setup to the actual common parent or to each actual fresh invocation as incurred; never omit or fabricate amortization.", + "peak": "RSS_peak is actual aggregate concurrent high-water across parent/driver/children plus separately declared retained FD/image/page and allocator profile; a sum of individual maxima is not an observed aggregate peak.", + "setup_baseline": "Both original complete arms pay the complete actual common control union, Root/native/source setup and teardown. Any asymmetry must be explicit and reviewed; no free candidate-only qualification or baseline control elision.", + "unmeasured": "Every unevaluated time/CPU/byte value remains null/unknown. No unknown is treated as zero, no projected gain admitted and no price proof is inferred from symbolic completeness.", + "wall": "W_total is actual outer admission-to-final-teardown elapsed time. Per-phase nested samples are diagnostic and must not be summed as if exclusive. Exclusive segment partition plus idle/wait/parent tails must reconcile to W_total." + }, + "schema": "g12-custody-original-complete-symbolic-invoice-v1", + "source_completeness_implies_fit": false +} diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/DESIGN-CORRECTION-v2.json b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/DESIGN-CORRECTION-v2.json new file mode 100644 index 0000000000..0d8dca0168 --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/DESIGN-CORRECTION-v2.json @@ -0,0 +1,70 @@ +{ + "accepted_design": { + "bytes": 60181, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody/DESIGN-v1.json", + "sha256": "1f88ec187415abfd058728b7bf37fb6d9550e8bb3a080da4841d32be4019fe72" + }, + "authorization": { + "bytes": 2545, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/parent/AUTHORIZATION-v2.json", + "sha256": "9e32514288fed2b1d2873387bf81861ffcd9e1b56d2ab4828be13a311e629106" + }, + "bounded_publication_purpose": "Only observed parent Popen/guard/pair/known-close custody and actual measured-through prewrite endpoints. Own record write/readback/close, remaining parent descriptors/return/adoption and later consumer work remain unknown current costs. No completed invoice/funding/fit claim.", + "explicit_changes": { + "enclosing_accounting_source_pin_replaced_by": "unmeasured_final_tail = None", + "enclosing_tail_join_required_replaced_by": "complete_cost_qualification = False", + "invented_financial_API_stub": "Removed under explicit parent instruction and pinned original-scope correction; no new accounting interface constructed.", + "manifest_schema": "g12-parent-two-export-custody-v2", + "publication_schema": "g12-parent-custody-publication-v2", + "source_pin_cycles": "Initial independent source identity comes from original trusted launcher/loader, never own-source SHA literal.", + "typed_cold_transport": "Exact three-argument call and original private-loader injection/identity checks; selected pins and handoff remain None." + }, + "history": { + "bytes": 699, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/FREEZE.json", + "sha256": "033cf284a1c011b861743efcee0281bea8859583e3fcad423cf80a1a80c24a92" + }, + "independent_original_scope_correction": { + "bytes": 10874, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-custody-independent/G12-CUSTODY-SOURCE-SCOPE-CLARIFICATION-v1.json", + "sha256": "a9261f686d4fbe6ca40258335231a730dc7e3319be7cedf7c39e189a57c7f367" + }, + "independent_produced_source_review": "Pending; no acceptance or body credit claimed.", + "preserved_scope": { + "accepted_producer_bytes_unchanged": "a346025d5b6e2b26246521c6af6292643a4c2c3286b33ff3996dcf051cd6be26", + "fixed_exports": [ + "g12-reference.common.json", + "g12-reference.diagnostics.json" + ], + "new_source_leaves_after_review": [ + "integration/g12_reference_adapter_v1.py", + "g12_reference_parent_v1.py", + "g12_reference_cold_consumer_v1.py" + ], + "no_new_authorization": "No new budget, reservation, native qualification, performance, science, PROFILE_ANCHOR_PASS, FULL_PASS, G12 approval or broader-goal status change.", + "no_reassignment": [ + "group01", + "failure_variants", + "all212", + "F4", + "M", + "P02" + ], + "one_fixed_role": "independent-original-uncached G12; h=25; extra_target=(0,2,1); normal optimize0; original profile/no-anchor invocation", + "preserve": "Every original failure, partial export, raw error, source pin and historical frozen file remains intact. No repair/reroll or reconstruction of absent canonical receipts.", + "separate_P02": "P02 retains its own standard-workload independent double-reference/rank/complement/native equality obligations. G12 diagnostics never satisfy them." + }, + "runtime": { + "handoff": null, + "launch": null, + "new_guard_budget": false, + "selected_transport": null, + "target_operations": 0 + }, + "schema": "g12-fixed-custody-source-boundary-correction-v2", + "source_and_runtime_separation": "Complete symbolic C01-C15 original invoice is required. Actual launch/adoption/phase/budget/resource fit/final-cost/scientific qualification remain separately closed; no new financial API is an original source-completion prerequisite." +} diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/FREEZE-v1.json b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/FREEZE-v1.json new file mode 100644 index 0000000000..7ee0493cd6 --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/FREEZE-v1.json @@ -0,0 +1,168 @@ +{ + "accepted_activity_credit_claimed": 0, + "author": "/root/cache_g12_custody_implementation", + "created_utc": "2026-10-31T02:23:52.065513+00:00", + "design": { + "bytes": 60181, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody/DESIGN-v1.json", + "sha256": "1f88ec187415abfd058728b7bf37fb6d9550e8bb3a080da4841d32be4019fe72" + }, + "files": { + "COST-BILL-v1.json": { + "bytes": 10141, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/COST-BILL-v1.json", + "sha256": "63abb4fb916b4b661dd47c0eadb62498c6adb96b2d6f0db338f1d89704e90f12" + }, + "DESIGN-CORRECTION-v2.json": { + "bytes": 4347, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/DESIGN-CORRECTION-v2.json", + "sha256": "f7a71e8cf29b002fc98fb9a4a847c2257e5f8daa366bef60339b4e321067f02f" + }, + "NEGATIVE-BRANCHES-v1.json": { + "bytes": 40911, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/NEGATIVE-BRANCHES-v1.json", + "sha256": "998972cf17cca61c10d17978e900390c6e22e8f48a2682de0fc591fba9d12ca2" + }, + "SOURCE-INVERSE-v1.json": { + "bytes": 9784, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-INVERSE-v1.json", + "sha256": "380416b2020654151afb95b716020ce5cdfaf68100e1841eb50a267d1af0b132" + }, + "SOURCE-MAP-v1.json": { + "bytes": 89494, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-MAP-v1.json", + "sha256": "71e6de8edd7c3ac2f6a2b4aa859373e48f1b7caeec3e515ae4ad53466df40228" + }, + "SOURCE-READY-PINS-v1.json": { + "bytes": 3767, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-READY-PINS-v1.json", + "sha256": "5080c15fc408ed0bae011c055920f410c57237150172c1d56da57f569caecd4c" + }, + "STAGE-DERIVATION-v1.json": { + "bytes": 5367, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/STAGE-DERIVATION-v1.json", + "sha256": "8bb604ba1b101ba228e9a3b26a24f4369bb9712cf4f0381d2b0f504bfd925441" + }, + "STATIC-VERIFICATION-v1.json": { + "bytes": 3143, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/STATIC-VERIFICATION-v1.json", + "sha256": "c5cc97adcc7648bb0a140253a78ef4433414dd9f8b079181c7ded42fc88b10f4" + }, + "candidate-integration/INTEGRATION-EDGES-v1.json": { + "bytes": 4392, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/INTEGRATION-EDGES-v1.json", + "sha256": "a998407a80692769a6ff4000a6af06a2a567b21f28677eb13075de6e7b27c392" + }, + "candidate-integration/g12_candidate_driver_N22_custody_v1.py": { + "bytes": 128363, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_N22_custody_v1.py", + "sha256": "c9d72a79ce3a828815d3d0370a1f95f210e1a41edeed767c55ff9d0614126fa4" + }, + "candidate-integration/g12_candidate_driver_P07_custody_v1.py": { + "bytes": 128363, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_P07_custody_v1.py", + "sha256": "2a5d202dabd78d5de54fac29db7fdfaf8836866425d93842f2b22d747fa52d0c" + }, + "candidate-integration/g12_candidate_driver_support_N22_custody_v1.py": { + "bytes": 33549, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_N22_custody_v1.py", + "sha256": "28c1a44750b9745a5ad6e930f9a83cf256b3a90905f5f30d08a89aca54c828da" + }, + "candidate-integration/g12_candidate_driver_support_P07_custody_v1.py": { + "bytes": 33549, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_P07_custody_v1.py", + "sha256": "cae88bf247ee775d6d7fc1264cb2af1d487e4c19168ca787c7c16aba16452220" + }, + "candidate-integration/g12_epoch_authority_custody_v1.py": { + "bytes": 139604, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_epoch_authority_custody_v1.py", + "sha256": "3079a096df1072a83056f3f8a8cbf9e766fdddb488e36dddb36544c7929f988a" + }, + "g12_reference_cold_consumer_v1.py": { + "bytes": 61159, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/g12_reference_cold_consumer_v1.py", + "sha256": "89ad17cfa90e895e2cb105e80cc57c82be4bf1a4a85a9d44322016c4344e3849" + }, + "g12_reference_parent_v1.py": { + "bytes": 94080, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/g12_reference_parent_v1.py", + "sha256": "160b8c5de808b9b31532608a89fa5e209110caea132145cd431ffade4403079e" + }, + "integration/g12_reference_adapter_v1.py": { + "bytes": 21740, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/integration/g12_reference_adapter_v1.py", + "sha256": "43aaabc69841b0a90fae599011de85f4736f42ced64344c49d6cd93f20297f9f" + }, + "pre-correction-source-v1/FREEZE.json": { + "bytes": 699, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/FREEZE.json", + "sha256": "033cf284a1c011b861743efcee0281bea8859583e3fcad423cf80a1a80c24a92" + }, + "pre-correction-source-v1/g12_reference_cold_consumer_v1.py": { + "bytes": 59367, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/g12_reference_cold_consumer_v1.py", + "sha256": "70f16a3c6e699f7dfbf66137af957323e244d039a647e75e8481855e6d61a610" + }, + "pre-correction-source-v1/g12_reference_parent_v1.py": { + "bytes": 92203, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/g12_reference_parent_v1.py", + "sha256": "5210fe391ef0361639676f6736cd6de1a6dfcb1f6bdaa58f2ced086e7cc35859" + }, + "pre-correction-source-v1/integration/g12_reference_adapter_v1.py": { + "bytes": 19770, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/integration/g12_reference_adapter_v1.py", + "sha256": "055e8192e28f2076c45ca22cf4dd1692e0a10e93eb9a2a1153d84229a72ef6fa" + } + }, + "handoff": null, + "launch": null, + "new_guard_budget": false, + "producer": { + "bytes": 70246, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/reference-producer-v2/g12_reference_driver_v2.py", + "sha256": "a346025d5b6e2b26246521c6af6292643a4c2c3286b33ff3996dcf051cd6be26" + }, + "remaining": "Independent produced-source review; all original actual runtime/source adoption/funding/fit/measurement/science gates remain closed.", + "review_focus": [ + "complete schema/file/raw-evidence joins", + "authentic cold-loader/capability and exact ABI inverse", + "source/operation/full function graph currentness", + "typed actual Popen/guard/known cleanup/private custody", + "primary and secondary errors under bookkeeping failures", + "corrected unknown final tail and complete original symbolic bill", + "resource/body/headroom constraints retain original actual gate; finite parser caps are not grants" + ], + "schema": "g12-custody-implementation-source-freeze-v1", + "scope_correction": { + "bytes": 10874, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/review/cache-s0308-source-completion-v2/g12-custody-independent/G12-CUSTODY-SOURCE-SCOPE-CLARIFICATION-v1.json", + "sha256": "a9261f686d4fbe6ca40258335231a730dc7e3319be7cedf7c39e189a57c7f367" + }, + "status": "FROZEN_FOR_INDEPENDENT_PRODUCED_SOURCE_REVIEW_RUNTIME_CLOSED", + "target_operations": 0, + "transport_selection": null +} diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/NEGATIVE-BRANCHES-v1.json b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/NEGATIVE-BRANCHES-v1.json new file mode 100644 index 0000000000..f7a5a1b678 --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/NEGATIVE-BRANCHES-v1.json @@ -0,0 +1,1598 @@ +{ + "N15_scope_correction": "Unknown final tail forbids completed-cost/adoption claims; source custody no longer requires inventing a new financial API. Actual authorization/accounting gates remain closed.", + "branches": [ + { + "id": "G12-N01", + "result": "Reject before dependent operation; no execution or expected reference.", + "source_locations": [ + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 966 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1256 + } + ], + "trigger": "launch or handoff source selection None/missing/foreign", + "verification": "STATIC_SOURCE_ONLY_NOT_EXECUTED" + }, + { + "id": "G12-N02", + "result": "Reject before scientific entry; unchanged accepted producer remains intact.", + "source_locations": [ + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 408 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 799 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 801 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 802 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 804 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 432 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 829 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 831 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 832 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 834 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1176 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1179 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1258 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1308 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1315 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1322 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1329 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1334 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1336 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1350 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1356 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1359 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1361 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1363 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1369 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1372 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1376 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1379 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1382 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1567 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1573 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 350 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 386 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 391 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 395 + } + ], + "trigger": "Root/provider/adapter/producer/authority/stage/source/reference pin or mode mismatch, historical 2a941 authority", + "verification": "STATIC_SOURCE_ONLY_NOT_EXECUTED" + }, + { + "id": "G12-N03", + "result": "Adapter refuses; never silently removes an unrecognized option.", + "source_locations": [ + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 824 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 854 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1312 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1355 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 357 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 360 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 363 + } + ], + "trigger": "wrong guard tail, --finite-only, -O, wrong lanes, supplied anchor or alternate producer CLI", + "verification": "STATIC_SOURCE_ONLY_NOT_EXECUTED" + }, + { + "id": "G12-N04", + "result": "Cold/adapter source entry refuses; shapes/status do not establish provenance.", + "source_locations": [ + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 221 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 227 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 492 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 495 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 497 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 501 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 503 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 505 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 507 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 509 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 925 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 940 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 950 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 957 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 958 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 970 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 971 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 977 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 1039 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 517 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 520 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 522 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 526 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 528 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 530 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 532 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 534 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 955 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 970 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1180 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1331 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 285 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 288 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 290 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 294 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 296 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 298 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 300 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 302 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 307 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 322 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 332 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 339 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 340 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 349 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 392 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 407 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 409 + } + ], + "trigger": "fake or restored Root/API/capability, copied function namespace, foreign initial source owner", + "verification": "STATIC_SOURCE_ONLY_NOT_EXECUTED" + }, + { + "id": "G12-N05", + "result": "No launch or no publication; preserve failed attempt; no retry.", + "source_locations": [ + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 432 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 434 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 456 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 458 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1318 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1342 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1345 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1394 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 372 + } + ], + "trigger": "budget/phase/lease contention, prior label output, orphan prior attempt, inadequate full tail", + "verification": "STATIC_SOURCE_ONLY_NOT_EXECUTED" + }, + { + "id": "G12-N06", + "result": "Bounded known cleanup and raw evidence; no canonical success receipt invented.", + "source_locations": [ + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 807 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 837 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1421 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1432 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1435 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1450 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1462 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1468 + } + ], + "trigger": "Popen raises or no retained Popen/generation, nonzero return, timeout/RSS/output cap, parent STOP", + "verification": "STATIC_SOURCE_ONLY_NOT_EXECUTED" + }, + { + "id": "G12-N07", + "result": "Reject pair sealing; outer status cannot override guard predicates.", + "source_locations": [ + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 416 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 418 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 420 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 427 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 430 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 442 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 446 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 451 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 453 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 854 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 1010 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 1015 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 1020 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 440 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 442 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 444 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 451 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 454 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 466 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 470 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 475 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 477 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 884 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1501 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1503 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1570 + } + ], + "trigger": "guard return0 but receipt absent/nonzero/termination/STOP/stderr/input drift/log drift/usage incomplete", + "verification": "STATIC_SOURCE_ONLY_NOT_EXECUTED" + }, + { + "id": "G12-N08", + "result": "Cleanup/custody UNKNOWN; no manifest selection or universal closure claim.", + "source_locations": [ + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 813 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 857 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 843 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 887 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1038 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1040 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1043 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1067 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1081 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1082 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1092 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1096 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1102 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1108 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1123 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1132 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1140 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1151 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1290 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1291 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1294 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1406 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1411 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1477 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1523 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1559 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1619 + } + ], + "trigger": "unknown/denied process observation, remaining descendant/group/child, unknown stream/FD close, namespace owner loss", + "verification": "STATIC_SOURCE_ONLY_NOT_EXECUTED" + }, + { + "id": "G12-N09", + "result": "Preserve first primary and ordered secondaries; reject successful completion even if files exist.", + "source_locations": [ + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 45 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 81 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 30 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 418 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 420 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 422 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 424 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 430 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 436 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 443 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 446 + } + ], + "trigger": "producer primary/secondary/restoration/cold2 failure, adapter ownership/restoration failure", + "verification": "STATIC_SOURCE_ONLY_NOT_EXECUTED" + }, + { + "id": "G12-N10", + "result": "Retain partial originals, no manifest or common-only fallback.", + "source_locations": [ + { + "file": "g12_reference_parent_v1.py", + "line": 1510 + } + ], + "trigger": "only common export, missing diagnostic, partial diagnostic, missing common", + "verification": "STATIC_SOURCE_ONLY_NOT_EXECUTED" + }, + { + "id": "G12-N11", + "result": "Reject complete-byte custody; no stable/read-only shortcut.", + "source_locations": [ + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 98 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 114 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 122 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 127 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 146 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 172 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 177 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 181 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 185 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 189 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 208 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 212 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 216 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 134 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 150 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 158 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 163 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 182 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 208 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 213 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 217 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 221 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 225 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 244 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 248 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 252 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1516 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1562 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 83 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 99 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 107 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 112 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 131 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 157 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 162 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 166 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 170 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 174 + } + ], + "trigger": "symlink/hardlink/foreign namespace, short read, changed size/mode/identity or incomplete hash", + "verification": "STATIC_SOURCE_ONLY_NOT_EXECUTED" + }, + { + "id": "G12-N12", + "result": "Reject without target science decoding or repair.", + "source_locations": [ + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 80 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 88 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 93 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 234 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 240 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 249 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 264 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 267 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 268 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 274 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 280 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 282 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 284 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 286 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 292 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 297 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 301 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 312 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 315 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 317 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 320 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 327 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 331 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 333 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 336 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 338 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 341 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 347 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 351 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 365 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 386 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 392 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 397 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 779 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 791 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 116 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 124 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 129 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 258 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 264 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 273 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 288 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 291 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 292 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 298 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 304 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 306 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 308 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 310 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 316 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 321 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 325 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 336 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 339 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 341 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 344 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 351 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 355 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 357 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 360 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 362 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 365 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 371 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 375 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 389 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 410 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 416 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 421 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 809 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 821 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 65 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 73 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 78 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 192 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 198 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 207 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 222 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 225 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 226 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 232 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 238 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 240 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 242 + }, + { + "file": "integration/g12_reference_adapter_v1.py", + "line": 244 + } + ], + "trigger": "duplicate JSON key, NaN/Infinity, bool-as-int, unknown schema/field/tag, bad hex, finite decoder limit exceeded", + "verification": "STATIC_SOURCE_ONLY_NOT_EXECUTED" + }, + { + "id": "G12-N13", + "result": "Reject; matching self-reported completion strings are irrelevant.", + "source_locations": [ + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 362 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 364 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 370 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 372 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 376 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 379 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 784 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 789 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 844 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 845 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 1026 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 386 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 388 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 394 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 396 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 400 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 403 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 814 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 819 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 874 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 875 + } + ], + "trigger": "producer/role/source/workload mismatch across pair/manifest, payload hash or inner-prefix mismatch", + "verification": "STATIC_SOURCE_ONLY_NOT_EXECUTED" + }, + { + "id": "G12-N14", + "result": "Preserve partial retained files with no seal; final manifest bytes alone do not qualify.", + "source_locations": [ + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 829 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 832 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 850 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 859 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 862 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 880 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1192 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1209 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1214 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1218 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1530 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1544 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1564 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1578 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1611 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1617 + } + ], + "trigger": "copy/fsync/chmod/close/readback/final alias check failure or unexpected child after first check", + "verification": "STATIC_SOURCE_ONLY_NOT_EXECUTED" + }, + { + "id": "G12-N15", + "result": "Manifest stays unselected; handoff None; no completed invoice or custody approval.", + "source_locations": [ + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 860 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 865 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 869 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 872 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 907 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 910 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 918 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 995 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 890 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 895 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 899 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 902 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 937 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 940 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 948 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1635 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1642 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1721 + } + ], + "trigger": "manifest written but enclosing final cost/close/publication tail fails or lacks actual authority", + "verification": "STATIC_SOURCE_ONLY_NOT_EXECUTED" + }, + { + "id": "G12-N16", + "result": "Reject; only later immutable source literal selects actual parent custody.", + "source_locations": [ + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 980 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 987 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 1288 + } + ], + "trigger": "candidate source supplies success bool, result registry or arbitrary manifest path at runtime", + "verification": "STATIC_SOURCE_ONLY_NOT_EXECUTED" + }, + { + "id": "G12-N17", + "result": "No expected literal/count/common is exposed.", + "source_locations": [ + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 226 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 992 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 1032 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 1035 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 1038 + }, + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 1042 + } + ], + "trigger": "cold recheck detects manifest/common/diagnostic/publication mutation or Root/reader ownership drift", + "verification": "STATIC_SOURCE_ONLY_NOT_EXECUTED" + }, + { + "id": "G12-N18", + "result": "Out of scope; original separate controls remain required.", + "source_locations": [ + { + "file": "g12_reference_cold_consumer_v1.py", + "line": 873 + }, + { + "file": "g12_reference_parent_v1.py", + "line": 903 + } + ], + "trigger": "attempt to use G12 diagnostics as P02 standard-workload/native/full-positive/performance approval", + "verification": "STATIC_SOURCE_ONLY_NOT_EXECUTED" + } + ], + "schema": "g12-custody-finite-negative-map-v1" +} diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-INVERSE-v1.json b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-INVERSE-v1.json new file mode 100644 index 0000000000..01aab65dee --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-INVERSE-v1.json @@ -0,0 +1,116 @@ +{ + "copies": [ + { + "derivative": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_epoch_authority_custody_v1.py", + "derivative_sha256": "3079a096df1072a83056f3f8a8cbf9e766fdddb488e36dddb36544c7929f988a", + "derived_bytes": 139604, + "exact_inverse_bytes_equal": true, + "kind": "authority fixed loader and invoke", + "original": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/g12_epoch_authority_selector_v1.py", + "original_bytes": 137642, + "original_sha256": "65b3d33068b0549ddb4a9e7e18a9912bebad69c309a8a29ae4fd532e9f428211", + "reverse_order_splices": [ + { + "after": "_G12_REFERENCE_TRANSPORT_SHA256 = None\n# Independently selected fixed custody consumer source; None remains closed.\n\n", + "before": "", + "unique_exact_after_anchor": true + }, + { + "after": " root_pin, provider_pin, backend_pin = ROOT_SHA256, PROVIDER_SHA256, BACKEND_SHA256\n g12_transport_pin = _G12_REFERENCE_TRANSPORT_SHA256", + "before": " root_pin, provider_pin, backend_pin = ROOT_SHA256, PROVIDER_SHA256, BACKEND_SHA256", + "unique_exact_after_anchor": true + }, + { + "after": " if name == '_h25_g12_reference_transport':\n need(type0(g12_transport_pin) is str0 and len0(g12_transport_pin) == 64 and\n digest == g12_transport_pin and kind == 'module' and\n path == authority_namespace['__file__'].rsplit('/', 1)[0] + '/g12_reference_transport.py',\n 'G12 fixed custody transport source/path has not been selected')\n # These are the original captured objects of this private loader,\n # inserted before selected source exec and before module_image.\n # No caller-owned setter or reconstructed capability participates.\n need(root_identity() == root_pin and api[1](capability, provider_pin) is not None,\n 'G12 initial actual Root/capability is no longer current')\n namespace.update({'bootstrap_root': root, 'bootstrap_capability': capability,\n 'bootstrap_api': api, 'bootstrap_g12_source_identity': (path, digest, size)})\n\n", + "before": "", + "unique_exact_after_anchor": true + }, + { + "after": " g12_reference = record[3] == '_h25_g12_reference_transport'\n if g12_reference:\n need(record[5] == g12_transport_pin and export == 'load_original_g12_reference' and\n len0(args) == 3 and args[0] is root and args[1] is capability and args[2] is api and\n type0(kwargs) is dict0 and not kwargs,\n 'G12 exact original cold Root/capability/API argument ownership differs')\n result = function(*args, **kwargs)\n if g12_reference:\n cold_check(handle)\n need(type0(result) is tuple0 and len0(result) == 4 and type0(result[0]) is bool and\n type0(result[1]) is int0 and result[1] > 0 and type0(result[2]) is bytes0 and\n type0(result[3]) is tuple0, 'G12 fixed independent transfer result shape differs')\n", + "before": " result = function(*args, **kwargs)\n", + "unique_exact_after_anchor": true + } + ] + }, + { + "derivative": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_N22_custody_v1.py", + "derivative_sha256": "c9d72a79ce3a828815d3d0370a1f95f210e1a41edeed767c55ff9d0614126fa4", + "derived_bytes": 128363, + "exact_inverse_bytes_equal": true, + "kind": "exact capability ABI and selected owned authority derivative", + "original": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_N22_v2.py", + "original_bytes": 128331, + "original_sha256": "a2d7fcaa1d3267bb43f14bfa1422759f77ede73641ed1f2a4fe55448792eec4a", + "reverse_order_splices": [ + { + "after": "reference = _g12_cold(1, transport_handle, 'load_original_g12_reference',\n _CAPTURED_BOOTSTRAP_ROOT, _CAPTURED_BOOTSTRAP_CAPABILITY, _CAPTURED_BOOTSTRAP_API)", + "before": "reference = _g12_cold(1, transport_handle, 'load_original_g12_reference',\n _CAPTURED_BOOTSTRAP_ROOT, _CAPTURED_BOOTSTRAP_API)", + "unique_exact_after_anchor": true + }, + { + "after": "COLD_AUTHORITY_SHA256 = '3079a096df1072a83056f3f8a8cbf9e766fdddb488e36dddb36544c7929f988a'", + "before": "COLD_AUTHORITY_SHA256 = '65b3d33068b0549ddb4a9e7e18a9912bebad69c309a8a29ae4fd532e9f428211'", + "unique_exact_after_anchor": true + } + ] + }, + { + "derivative": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_N22_custody_v1.py", + "derivative_sha256": "28c1a44750b9745a5ad6e930f9a83cf256b3a90905f5f30d08a89aca54c828da", + "derived_bytes": 33549, + "exact_inverse_bytes_equal": true, + "kind": "exact capability ABI", + "original": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_support_N22_v2.py", + "original_bytes": 33517, + "original_sha256": "5b7709012375e7e6600840c2c86bf90f44382499d1670b15ce325b30c14a2b48", + "reverse_order_splices": [ + { + "after": "reference = _g12_cold(1, transport_handle, 'load_original_g12_reference',\n _CAPTURED_BOOTSTRAP_ROOT, _CAPTURED_BOOTSTRAP_CAPABILITY, _CAPTURED_BOOTSTRAP_API)", + "before": "reference = _g12_cold(1, transport_handle, 'load_original_g12_reference',\n _CAPTURED_BOOTSTRAP_ROOT, _CAPTURED_BOOTSTRAP_API)", + "unique_exact_after_anchor": true + } + ] + }, + { + "derivative": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_P07_custody_v1.py", + "derivative_sha256": "2a5d202dabd78d5de54fac29db7fdfaf8836866425d93842f2b22d747fa52d0c", + "derived_bytes": 128363, + "exact_inverse_bytes_equal": true, + "kind": "exact capability ABI and selected owned authority derivative", + "original": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_P07_v2.py", + "original_bytes": 128331, + "original_sha256": "dc0e3c32a2412d8a872f8568ecbaff99a41785fadd79b0bbfc2341e0e51ede74", + "reverse_order_splices": [ + { + "after": "reference = _g12_cold(1, transport_handle, 'load_original_g12_reference',\n _CAPTURED_BOOTSTRAP_ROOT, _CAPTURED_BOOTSTRAP_CAPABILITY, _CAPTURED_BOOTSTRAP_API)", + "before": "reference = _g12_cold(1, transport_handle, 'load_original_g12_reference',\n _CAPTURED_BOOTSTRAP_ROOT, _CAPTURED_BOOTSTRAP_API)", + "unique_exact_after_anchor": true + }, + { + "after": "COLD_AUTHORITY_SHA256 = '3079a096df1072a83056f3f8a8cbf9e766fdddb488e36dddb36544c7929f988a'", + "before": "COLD_AUTHORITY_SHA256 = '65b3d33068b0549ddb4a9e7e18a9912bebad69c309a8a29ae4fd532e9f428211'", + "unique_exact_after_anchor": true + } + ] + }, + { + "derivative": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_P07_custody_v1.py", + "derivative_sha256": "cae88bf247ee775d6d7fc1264cb2af1d487e4c19168ca787c7c16aba16452220", + "derived_bytes": 33549, + "exact_inverse_bytes_equal": true, + "kind": "exact capability ABI", + "original": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_support_P07_v2.py", + "original_bytes": 33517, + "original_sha256": "7c41cb423b18df69de48573817f92fae1a21be2751af7ad97768480ffa0b4a19", + "reverse_order_splices": [ + { + "after": "reference = _g12_cold(1, transport_handle, 'load_original_g12_reference',\n _CAPTURED_BOOTSTRAP_ROOT, _CAPTURED_BOOTSTRAP_CAPABILITY, _CAPTURED_BOOTSTRAP_API)", + "before": "reference = _g12_cold(1, transport_handle, 'load_original_g12_reference',\n _CAPTURED_BOOTSTRAP_ROOT, _CAPTURED_BOOTSTRAP_API)", + "unique_exact_after_anchor": true + } + ] + } + ], + "method": "Deterministic exact bounded literal splice anchors; full reconstructed byte equality and SHA256 to each original. No difflib, target imports or execution.", + "schema": "g12-custody-exact-source-inverses-v1" +} diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-MAP-v1.json b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-MAP-v1.json new file mode 100644 index 0000000000..126e53d8d3 --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-MAP-v1.json @@ -0,0 +1,4045 @@ +{ + "cold_caller_loader_edges": { + "actual_reference_handoff": null, + "actual_transport_source_pin": null, + "authority_capture": "Original capture_epoch_authority(root, capability, api), actual bootstrap validated before operations return; private loader uses those exact closure cells before selected source exec/module_image; invoke validates identity before call and cold_check after return.", + "current_target_execution": 0, + "edits": [ + { + "derivative": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_epoch_authority_custody_v1.py", + "derivative_sha256": "3079a096df1072a83056f3f8a8cbf9e766fdddb488e36dddb36544c7929f988a", + "kind": "authority fixed loader and invoke", + "original": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/g12_epoch_authority_selector_v1.py", + "original_sha256": "65b3d33068b0549ddb4a9e7e18a9912bebad69c309a8a29ae4fd532e9f428211" + }, + { + "derivative": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_N22_custody_v1.py", + "derivative_sha256": "c9d72a79ce3a828815d3d0370a1f95f210e1a41edeed767c55ff9d0614126fa4", + "kind": "exact capability ABI and selected owned authority derivative", + "original": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_N22_v2.py", + "original_sha256": "a2d7fcaa1d3267bb43f14bfa1422759f77ede73641ed1f2a4fe55448792eec4a" + }, + { + "derivative": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_N22_custody_v1.py", + "derivative_sha256": "28c1a44750b9745a5ad6e930f9a83cf256b3a90905f5f30d08a89aca54c828da", + "kind": "exact capability ABI", + "original": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_support_N22_v2.py", + "original_sha256": "5b7709012375e7e6600840c2c86bf90f44382499d1670b15ce325b30c14a2b48" + }, + { + "derivative": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_P07_custody_v1.py", + "derivative_sha256": "2a5d202dabd78d5de54fac29db7fdfaf8836866425d93842f2b22d747fa52d0c", + "kind": "exact capability ABI and selected owned authority derivative", + "original": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_P07_v2.py", + "original_sha256": "dc0e3c32a2412d8a872f8568ecbaff99a41785fadd79b0bbfc2341e0e51ede74" + }, + { + "derivative": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_P07_custody_v1.py", + "derivative_sha256": "cae88bf247ee775d6d7fc1264cb2af1d487e4c19168ca787c7c16aba16452220", + "kind": "exact capability ABI", + "original": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_support_P07_v2.py", + "original_sha256": "7c41cb423b18df69de48573817f92fae1a21be2751af7ad97768480ffa0b4a19" + } + ], + "no_self_digest_cycle": "Consumer source identity is initial loader tuple(path,digest,size) from its original Root hash; own source does not embed its own hash.", + "schema": "g12-fixed-cold-custody-source-edges-v1" + }, + "cold_identity": "Private original loader injects captured actual Root/capability/API and (path,digest,size) from Root hash before exec/module_image only for fixed selected transport name/path/pin; invoke verifies exact argument identity and cold_check after return.", + "function_spans": { + "candidate-integration/g12_candidate_driver_N22_custody_v1.py": [ + { + "arguments": [], + "end": 114, + "name": "_initial_native_tcb", + "start": 54 + }, + { + "arguments": [], + "end": 156, + "name": "_initial_cold_authority", + "start": 127 + }, + { + "arguments": [ + "condition", + "message" + ], + "end": 261, + "name": "need", + "start": 259 + }, + { + "arguments": [ + "data" + ], + "end": 265, + "name": "sha", + "start": 264 + }, + { + "arguments": [ + "value" + ], + "end": 269, + "name": "canonical", + "start": 268 + }, + { + "arguments": [], + "end": 275, + "name": "cpu", + "start": 272 + }, + { + "arguments": [ + "root", + "pins" + ], + "end": 293, + "name": "inventory", + "start": 278 + }, + { + "arguments": [ + "root", + "pins" + ], + "end": 314, + "name": "candidate_inventory", + "start": 298 + }, + { + "arguments": [ + "value" + ], + "end": 336, + "name": "typed", + "start": 317 + }, + { + "arguments": [], + "end": 800, + "name": "main", + "start": 400 + }, + { + "arguments": [], + "end": 833, + "name": "_run_with_stop_evidence", + "start": 803 + }, + { + "arguments": [ + "phases", + "data_state", + "extensions", + "caller", + "stdout", + "invocation_token", + "old_argv" + ], + "end": 898, + "name": "_epoch_cli_boundary", + "start": 838 + }, + { + "arguments": [], + "end": 1244, + "name": "main_epoch", + "start": 900 + }, + { + "arguments": [], + "end": 1267, + "name": "_run_epoch_with_stop_evidence", + "start": 1246 + }, + { + "arguments": [ + "value" + ], + "end": 1308, + "name": "_g12_primitive", + "start": 1286 + }, + { + "arguments": [ + "value" + ], + "end": 1312, + "name": "_g12_bytes", + "start": 1311 + }, + { + "arguments": [ + "code" + ], + "end": 1336, + "name": "_g12_code_snapshot", + "start": 1315 + }, + { + "arguments": [ + "code" + ], + "end": 1344, + "name": "_g12_remaining_count", + "start": 1339 + }, + { + "arguments": [ + "code", + "code_before", + "role_result", + "full_return", + "certificate_bytes", + "stdout_text", + "suffix_phases" + ], + "end": 1362, + "name": "_g12_common_outputs", + "start": 1347 + }, + { + "arguments": [ + "index" + ], + "end": 1404, + "name": "_g12_cold", + "start": 1389 + }, + { + "arguments": [], + "end": 1431, + "name": "_g12_helper_current", + "start": 1407 + }, + { + "arguments": [ + "suspended" + ], + "end": 1448, + "name": "_g12_generator_shape", + "start": 1434 + }, + { + "arguments": [ + "suite", + "original_commit", + "site", + "checks" + ], + "end": 1508, + "name": "_g12_selected_store", + "start": 1451 + }, + { + "arguments": [ + "args" + ], + "end": 1514, + "name": "_g12_selected_args", + "start": 1512 + }, + { + "arguments": [ + "state", + "extensions", + "module", + "binding", + "phases", + "invocation_token", + "checks_pair", + "code_pair", + "label_pair", + "caller", + "rank_calls", + "trace", + "captures", + "stdout", + "frozen", + "runtime", + "engine", + "output", + "reference", + "reference_bytes", + "driver_before", + "pins", + "frozen_before", + "engine_before", + "runtime_before", + "copied_engine_before", + "script_names", + "new_custody_before", + "data_custody_before", + "anchor_path", + "anchor_bytes" + ], + "end": 1554, + "name": "_g12_bind_locals", + "start": 1516 + }, + { + "arguments": [], + "end": 1573, + "name": "_g12_diagnostics", + "start": 1557 + }, + { + "arguments": [ + "checks", + "circuit", + "suite" + ], + "end": 1606, + "name": "_g12_complete_capacity_store", + "start": 1577 + }, + { + "arguments": [ + "phases", + "name", + "function", + "args", + "kwargs", + "result" + ], + "end": 1676, + "name": "_g12_after_phase", + "start": 1608 + }, + { + "arguments": [ + "namespace" + ], + "end": 1737, + "name": "_g12_complete_original_cli", + "start": 1679 + }, + { + "arguments": [], + "end": 1746, + "name": "_g12_original_imports", + "start": 1740 + }, + { + "arguments": [], + "end": 1770, + "name": "_g12_original_terminal_custody", + "start": 1749 + }, + { + "arguments": [ + "primary" + ], + "end": 1829, + "name": "_g12_after_original_exit", + "start": 1773 + }, + { + "arguments": [], + "end": 1873, + "name": "_g12_continuation_entry", + "start": 1832 + }, + { + "arguments": [ + "self" + ], + "end": 346, + "name": "__init__", + "start": 345 + }, + { + "arguments": [], + "end": 362, + "name": "memory", + "start": 349 + }, + { + "arguments": [ + "self", + "name", + "function" + ], + "end": 390, + "name": "call", + "start": 364 + }, + { + "arguments": [ + "self", + "owner", + "attribute", + "name" + ], + "end": 397, + "name": "wrap", + "start": 392 + }, + { + "arguments": [ + "c", + "checks", + "code" + ], + "end": 649, + "name": "observe_roles", + "start": 645 + }, + { + "arguments": [ + "value" + ], + "end": 673, + "name": "observe_serializable", + "start": 659 + }, + { + "arguments": [], + "end": 395, + "name": "observed", + "start": 394 + }, + { + "arguments": [ + "c", + "checks", + "code" + ], + "end": 1133, + "name": "observe_roles", + "start": 1129 + }, + { + "arguments": [ + "value" + ], + "end": 1158, + "name": "observe_serializable", + "start": 1146 + } + ], + "candidate-integration/g12_candidate_driver_P07_custody_v1.py": [ + { + "arguments": [], + "end": 114, + "name": "_initial_native_tcb", + "start": 54 + }, + { + "arguments": [], + "end": 156, + "name": "_initial_cold_authority", + "start": 127 + }, + { + "arguments": [ + "condition", + "message" + ], + "end": 261, + "name": "need", + "start": 259 + }, + { + "arguments": [ + "data" + ], + "end": 265, + "name": "sha", + "start": 264 + }, + { + "arguments": [ + "value" + ], + "end": 269, + "name": "canonical", + "start": 268 + }, + { + "arguments": [], + "end": 275, + "name": "cpu", + "start": 272 + }, + { + "arguments": [ + "root", + "pins" + ], + "end": 293, + "name": "inventory", + "start": 278 + }, + { + "arguments": [ + "root", + "pins" + ], + "end": 314, + "name": "candidate_inventory", + "start": 298 + }, + { + "arguments": [ + "value" + ], + "end": 336, + "name": "typed", + "start": 317 + }, + { + "arguments": [], + "end": 800, + "name": "main", + "start": 400 + }, + { + "arguments": [], + "end": 833, + "name": "_run_with_stop_evidence", + "start": 803 + }, + { + "arguments": [ + "phases", + "data_state", + "extensions", + "caller", + "stdout", + "invocation_token", + "old_argv" + ], + "end": 898, + "name": "_epoch_cli_boundary", + "start": 838 + }, + { + "arguments": [], + "end": 1244, + "name": "main_epoch", + "start": 900 + }, + { + "arguments": [], + "end": 1267, + "name": "_run_epoch_with_stop_evidence", + "start": 1246 + }, + { + "arguments": [ + "value" + ], + "end": 1308, + "name": "_g12_primitive", + "start": 1286 + }, + { + "arguments": [ + "value" + ], + "end": 1312, + "name": "_g12_bytes", + "start": 1311 + }, + { + "arguments": [ + "code" + ], + "end": 1336, + "name": "_g12_code_snapshot", + "start": 1315 + }, + { + "arguments": [ + "code" + ], + "end": 1344, + "name": "_g12_remaining_count", + "start": 1339 + }, + { + "arguments": [ + "code", + "code_before", + "role_result", + "full_return", + "certificate_bytes", + "stdout_text", + "suffix_phases" + ], + "end": 1362, + "name": "_g12_common_outputs", + "start": 1347 + }, + { + "arguments": [ + "index" + ], + "end": 1404, + "name": "_g12_cold", + "start": 1389 + }, + { + "arguments": [], + "end": 1431, + "name": "_g12_helper_current", + "start": 1407 + }, + { + "arguments": [ + "suspended" + ], + "end": 1448, + "name": "_g12_generator_shape", + "start": 1434 + }, + { + "arguments": [ + "suite", + "original_commit", + "site", + "checks" + ], + "end": 1508, + "name": "_g12_selected_store", + "start": 1451 + }, + { + "arguments": [ + "args" + ], + "end": 1514, + "name": "_g12_selected_args", + "start": 1512 + }, + { + "arguments": [ + "state", + "extensions", + "module", + "binding", + "phases", + "invocation_token", + "checks_pair", + "code_pair", + "label_pair", + "caller", + "rank_calls", + "trace", + "captures", + "stdout", + "frozen", + "runtime", + "engine", + "output", + "reference", + "reference_bytes", + "driver_before", + "pins", + "frozen_before", + "engine_before", + "runtime_before", + "copied_engine_before", + "script_names", + "new_custody_before", + "data_custody_before", + "anchor_path", + "anchor_bytes" + ], + "end": 1554, + "name": "_g12_bind_locals", + "start": 1516 + }, + { + "arguments": [], + "end": 1573, + "name": "_g12_diagnostics", + "start": 1557 + }, + { + "arguments": [ + "checks", + "circuit", + "suite" + ], + "end": 1606, + "name": "_g12_complete_capacity_store", + "start": 1577 + }, + { + "arguments": [ + "phases", + "name", + "function", + "args", + "kwargs", + "result" + ], + "end": 1676, + "name": "_g12_after_phase", + "start": 1608 + }, + { + "arguments": [ + "namespace" + ], + "end": 1737, + "name": "_g12_complete_original_cli", + "start": 1679 + }, + { + "arguments": [], + "end": 1746, + "name": "_g12_original_imports", + "start": 1740 + }, + { + "arguments": [], + "end": 1770, + "name": "_g12_original_terminal_custody", + "start": 1749 + }, + { + "arguments": [ + "primary" + ], + "end": 1829, + "name": "_g12_after_original_exit", + "start": 1773 + }, + { + "arguments": [], + "end": 1873, + "name": "_g12_continuation_entry", + "start": 1832 + }, + { + "arguments": [ + "self" + ], + "end": 346, + "name": "__init__", + "start": 345 + }, + { + "arguments": [], + "end": 362, + "name": "memory", + "start": 349 + }, + { + "arguments": [ + "self", + "name", + "function" + ], + "end": 390, + "name": "call", + "start": 364 + }, + { + "arguments": [ + "self", + "owner", + "attribute", + "name" + ], + "end": 397, + "name": "wrap", + "start": 392 + }, + { + "arguments": [ + "c", + "checks", + "code" + ], + "end": 649, + "name": "observe_roles", + "start": 645 + }, + { + "arguments": [ + "value" + ], + "end": 673, + "name": "observe_serializable", + "start": 659 + }, + { + "arguments": [], + "end": 395, + "name": "observed", + "start": 394 + }, + { + "arguments": [ + "c", + "checks", + "code" + ], + "end": 1133, + "name": "observe_roles", + "start": 1129 + }, + { + "arguments": [ + "value" + ], + "end": 1158, + "name": "observe_serializable", + "start": 1146 + } + ], + "candidate-integration/g12_candidate_driver_support_N22_custody_v1.py": [ + { + "arguments": [ + "index" + ], + "end": 39, + "name": "_g12_cold", + "start": 24 + }, + { + "arguments": [], + "end": 66, + "name": "_g12_helper_current", + "start": 42 + }, + { + "arguments": [ + "suspended" + ], + "end": 83, + "name": "_g12_generator_shape", + "start": 69 + }, + { + "arguments": [ + "suite", + "original_commit", + "site", + "checks" + ], + "end": 143, + "name": "_g12_selected_store", + "start": 86 + }, + { + "arguments": [ + "args" + ], + "end": 149, + "name": "_g12_selected_args", + "start": 147 + }, + { + "arguments": [ + "state", + "extensions", + "module", + "binding", + "phases", + "invocation_token", + "checks_pair", + "code_pair", + "label_pair", + "caller", + "rank_calls", + "trace", + "captures", + "stdout", + "frozen", + "runtime", + "engine", + "output", + "reference", + "reference_bytes", + "driver_before", + "pins", + "frozen_before", + "engine_before", + "runtime_before", + "copied_engine_before", + "script_names", + "new_custody_before", + "data_custody_before", + "anchor_path", + "anchor_bytes" + ], + "end": 189, + "name": "_g12_bind_locals", + "start": 151 + }, + { + "arguments": [], + "end": 208, + "name": "_g12_diagnostics", + "start": 192 + }, + { + "arguments": [ + "checks", + "circuit", + "suite" + ], + "end": 241, + "name": "_g12_complete_capacity_store", + "start": 212 + }, + { + "arguments": [ + "phases", + "name", + "function", + "args", + "kwargs", + "result" + ], + "end": 311, + "name": "_g12_after_phase", + "start": 243 + }, + { + "arguments": [ + "namespace" + ], + "end": 372, + "name": "_g12_complete_original_cli", + "start": 314 + }, + { + "arguments": [], + "end": 381, + "name": "_g12_original_imports", + "start": 375 + }, + { + "arguments": [], + "end": 405, + "name": "_g12_original_terminal_custody", + "start": 384 + }, + { + "arguments": [ + "primary" + ], + "end": 464, + "name": "_g12_after_original_exit", + "start": 408 + }, + { + "arguments": [], + "end": 508, + "name": "_g12_continuation_entry", + "start": 467 + } + ], + "candidate-integration/g12_candidate_driver_support_P07_custody_v1.py": [ + { + "arguments": [ + "index" + ], + "end": 39, + "name": "_g12_cold", + "start": 24 + }, + { + "arguments": [], + "end": 66, + "name": "_g12_helper_current", + "start": 42 + }, + { + "arguments": [ + "suspended" + ], + "end": 83, + "name": "_g12_generator_shape", + "start": 69 + }, + { + "arguments": [ + "suite", + "original_commit", + "site", + "checks" + ], + "end": 143, + "name": "_g12_selected_store", + "start": 86 + }, + { + "arguments": [ + "args" + ], + "end": 149, + "name": "_g12_selected_args", + "start": 147 + }, + { + "arguments": [ + "state", + "extensions", + "module", + "binding", + "phases", + "invocation_token", + "checks_pair", + "code_pair", + "label_pair", + "caller", + "rank_calls", + "trace", + "captures", + "stdout", + "frozen", + "runtime", + "engine", + "output", + "reference", + "reference_bytes", + "driver_before", + "pins", + "frozen_before", + "engine_before", + "runtime_before", + "copied_engine_before", + "script_names", + "new_custody_before", + "data_custody_before", + "anchor_path", + "anchor_bytes" + ], + "end": 189, + "name": "_g12_bind_locals", + "start": 151 + }, + { + "arguments": [], + "end": 208, + "name": "_g12_diagnostics", + "start": 192 + }, + { + "arguments": [ + "checks", + "circuit", + "suite" + ], + "end": 241, + "name": "_g12_complete_capacity_store", + "start": 212 + }, + { + "arguments": [ + "phases", + "name", + "function", + "args", + "kwargs", + "result" + ], + "end": 311, + "name": "_g12_after_phase", + "start": 243 + }, + { + "arguments": [ + "namespace" + ], + "end": 372, + "name": "_g12_complete_original_cli", + "start": 314 + }, + { + "arguments": [], + "end": 381, + "name": "_g12_original_imports", + "start": 375 + }, + { + "arguments": [], + "end": 405, + "name": "_g12_original_terminal_custody", + "start": 384 + }, + { + "arguments": [ + "primary" + ], + "end": 464, + "name": "_g12_after_original_exit", + "start": 408 + }, + { + "arguments": [], + "end": 508, + "name": "_g12_continuation_entry", + "start": 467 + } + ], + "candidate-integration/g12_epoch_authority_custody_v1.py": [ + { + "arguments": [ + "root", + "capability", + "api" + ], + "end": 763, + "name": "capture_authority", + "start": 33 + }, + { + "arguments": [ + "condition", + "message" + ], + "end": 813, + "name": "need", + "start": 811 + }, + { + "arguments": [ + "mapping" + ], + "end": 819, + "name": "string_keys", + "start": 816 + }, + { + "arguments": [ + "code" + ], + "end": 831, + "name": "names", + "start": 822 + }, + { + "arguments": [ + "function" + ], + "end": 847, + "name": "function_record", + "start": 834 + }, + { + "arguments": [ + "record" + ], + "end": 867, + "name": "check_fields", + "start": 850 + }, + { + "arguments": [ + "cls" + ], + "end": 875, + "name": "class_record", + "start": 870 + }, + { + "arguments": [ + "functions", + "classes", + "canonical_functions", + "canonical_classes" + ], + "end": 923, + "name": "graph", + "start": 878 + }, + { + "arguments": [ + "function" + ], + "end": 1161, + "name": "_epoch_closure", + "start": 1158 + }, + { + "arguments": [ + "code", + "name" + ], + "end": 1167, + "name": "_epoch_code_constant", + "start": 1164 + }, + { + "arguments": [ + "ledger", + "legacy", + "capture_graph0", + "raw_function0", + "descriptor_factory", + "record_for0", + "cold_check0", + "root", + "capability", + "api", + "missing", + "engine_guard", + "bundle_cell" + ], + "end": 1569, + "name": "_epoch_operations", + "start": 1170 + }, + { + "arguments": [ + "root", + "capability", + "api" + ], + "end": 2459, + "name": "capture_epoch_authority", + "start": 1581 + }, + { + "arguments": [ + "ok", + "message" + ], + "end": 91, + "name": "need", + "start": 89 + }, + { + "arguments": [ + "owner", + "domains" + ], + "end": 118, + "name": "string_domain", + "start": 93 + }, + { + "arguments": [ + "owner", + "name", + "domains" + ], + "end": 128, + "name": "get_id", + "start": 120 + }, + { + "arguments": [ + "owner", + "expected" + ], + "end": 154, + "name": "identity_mapping", + "start": 130 + }, + { + "arguments": [ + "code" + ], + "end": 171, + "name": "code_names", + "start": 158 + }, + { + "arguments": [ + "function" + ], + "end": 194, + "name": "raw_function_record", + "start": 173 + }, + { + "arguments": [ + "initial_functions", + "initial_classes" + ], + "end": 254, + "name": "capture_graph", + "start": 196 + }, + { + "arguments": [ + "namespace", + "name", + "expected" + ], + "end": 262, + "name": "expected_global", + "start": 256 + }, + { + "arguments": [ + "record", + "domains", + "builtin_values" + ], + "end": 345, + "name": "fresh_function", + "start": 264 + }, + { + "arguments": [ + "graph", + "domains", + "builtin_values", + "message" + ], + "end": 360, + "name": "fresh_graph", + "start": 349 + }, + { + "arguments": [ + "module", + "name", + "kind", + "path", + "digest", + "source_bytes" + ], + "end": 393, + "name": "module_image", + "start": 362 + }, + { + "arguments": [ + "handle" + ], + "end": 398, + "name": "record_for", + "start": 395 + }, + { + "arguments": [ + "record", + "domains", + "builtin_values" + ], + "end": 416, + "name": "fresh_module", + "start": 400 + }, + { + "arguments": [ + "domains" + ], + "end": 452, + "name": "root_and_stdlib", + "start": 434 + }, + { + "arguments": [ + "domains" + ], + "end": 456, + "name": "check_registered", + "start": 454 + }, + { + "arguments": [ + "handle" + ], + "end": 471, + "name": "cold_check", + "start": 458 + }, + { + "arguments": [ + "path", + "digest", + "name", + "kind" + ], + "end": 506, + "name": "load", + "start": 473 + }, + { + "arguments": [ + "operations", + "label" + ], + "end": 587, + "name": "make_caller_descriptor", + "start": 508 + }, + { + "arguments": [ + "handle" + ], + "end": 598, + "name": "runtime_guard", + "start": 589 + }, + { + "arguments": [ + "module" + ], + "end": 606, + "name": "known_backend", + "start": 600 + }, + { + "arguments": [ + "cls" + ], + "end": 622, + "name": "known_guard", + "start": 608 + }, + { + "arguments": [ + "record", + "export" + ], + "end": 628, + "name": "classify", + "start": 624 + }, + { + "arguments": [ + "record", + "export", + "role", + "args", + "kwargs" + ], + "end": 681, + "name": "validate_producer_arguments", + "start": 630 + }, + { + "arguments": [ + "handle", + "export" + ], + "end": 708, + "name": "invoke", + "start": 683 + }, + { + "arguments": [ + "obj", + "producer_handle", + "export", + "args_tuple", + "kwargs_dict" + ], + "end": 729, + "name": "check_product", + "start": 710 + }, + { + "arguments": [ + "handle", + "cls" + ], + "end": 749, + "name": "set_backend_guard", + "start": 731 + }, + { + "arguments": [ + "handle" + ], + "end": 753, + "name": "source", + "start": 751 + }, + { + "arguments": [ + "self" + ], + "end": 935, + "name": "__init__", + "start": 928 + }, + { + "arguments": [ + "self" + ], + "end": 945, + "name": "guard_engine", + "start": 937 + }, + { + "arguments": [ + "self", + "module", + "backend", + "source_bytes", + "factory_results", + "authority_graph", + "missing_token" + ], + "end": 995, + "name": "capture", + "start": 947 + }, + { + "arguments": [ + "self", + "handle" + ], + "end": 1002, + "name": "origin", + "start": 997 + }, + { + "arguments": [ + "self", + "handle", + "suite" + ], + "end": 1009, + "name": "enroll_suite", + "start": 1004 + }, + { + "arguments": [ + "self", + "handle", + "kind", + "name", + "old", + "new", + "role", + "product_graph" + ], + "end": 1028, + "name": "authorize", + "start": 1011 + }, + { + "arguments": [ + "self", + "handle", + "suite", + "role", + "function", + "product_graph" + ], + "end": 1045, + "name": "register_product", + "start": 1030 + }, + { + "arguments": [ + "self", + "handle", + "kind", + "name", + "new" + ], + "end": 1058, + "name": "install", + "start": 1047 + }, + { + "arguments": [ + "self", + "handle", + "kind", + "name", + "old", + "new", + "role", + "product_graph" + ], + "end": 1071, + "name": "observed_transition", + "start": 1060 + }, + { + "arguments": [ + "self", + "owner", + "name", + "old" + ], + "end": 1079, + "name": "expected", + "start": 1073 + }, + { + "arguments": [ + "self", + "raw_record", + "namespace", + "name", + "expected" + ], + "end": 1090, + "name": "expected_lookup", + "start": 1081 + }, + { + "arguments": [ + "self", + "function" + ], + "end": 1096, + "name": "original_record", + "start": 1092 + }, + { + "arguments": [ + "self", + "cls" + ], + "end": 1102, + "name": "original_class", + "start": 1098 + }, + { + "arguments": [ + "self", + "cls", + "name", + "expected" + ], + "end": 1105, + "name": "projected_member", + "start": 1104 + }, + { + "arguments": [ + "self", + "handle" + ], + "end": 1129, + "name": "check", + "start": 1107 + }, + { + "arguments": [ + "self", + "handle", + "expected", + "new" + ], + "end": 1133, + "name": "phase_to", + "start": 1131 + }, + { + "arguments": [ + "self", + "handle", + "raw" + ], + "end": 1138, + "name": "fix_raw_guard", + "start": 1135 + }, + { + "arguments": [ + "self", + "handle", + "result", + "owner" + ], + "end": 1147, + "name": "finish_bind", + "start": 1140 + }, + { + "arguments": [ + "self", + "handle", + "error" + ], + "end": 1153, + "name": "fail", + "start": 1149 + }, + { + "arguments": [], + "end": 1176, + "name": "before", + "start": 1175 + }, + { + "arguments": [ + "handle", + "digest" + ], + "end": 1181, + "name": "owned", + "start": 1178 + }, + { + "arguments": [ + "handle", + "suite" + ], + "end": 1193, + "name": "suite_guard", + "start": 1183 + }, + { + "arguments": [ + "origin", + "functions", + "classes" + ], + "end": 1197, + "name": "product_graph", + "start": 1195 + }, + { + "arguments": [ + "value" + ], + "end": 1212, + "name": "graph_fields_only", + "start": 1199 + }, + { + "arguments": [ + "stage" + ], + "end": 1307, + "name": "admit", + "start": 1214 + }, + { + "arguments": [ + "handle", + "context" + ], + "end": 1328, + "name": "derive", + "start": 1309 + }, + { + "arguments": [ + "origin" + ], + "end": 1335, + "name": "check_factory", + "start": 1330 + }, + { + "arguments": [ + "origin", + "suite", + "kind", + "name", + "role", + "function" + ], + "end": 1375, + "name": "wrap_proof", + "start": 1337 + }, + { + "arguments": [ + "handle", + "suite", + "action" + ], + "end": 1411, + "name": "product", + "start": 1377 + }, + { + "arguments": [ + "handle", + "suite", + "stage" + ], + "end": 1483, + "name": "stages", + "start": 1413 + }, + { + "arguments": [ + "handle", + "suite" + ], + "end": 1488, + "name": "seal", + "start": 1485 + }, + { + "arguments": [ + "handle", + "suite" + ], + "end": 1501, + "name": "check", + "start": 1490 + }, + { + "arguments": [ + "handle" + ], + "end": 1508, + "name": "manifest", + "start": 1503 + }, + { + "arguments": [ + "handle", + "error" + ], + "end": 1541, + "name": "failed", + "start": 1517 + }, + { + "arguments": [ + "value" + ], + "end": 1547, + "name": "plain0", + "start": 1543 + }, + { + "arguments": [ + "function" + ], + "end": 1567, + "name": "protect", + "start": 1549 + }, + { + "arguments": [], + "end": 1701, + "name": "engine_guard", + "start": 1652 + }, + { + "arguments": [ + "ok", + "message" + ], + "end": 1717, + "name": "need", + "start": 1715 + }, + { + "arguments": [ + "owner", + "domains" + ], + "end": 1744, + "name": "string_domain", + "start": 1719 + }, + { + "arguments": [ + "owner", + "name", + "domains" + ], + "end": 1754, + "name": "get_id", + "start": 1746 + }, + { + "arguments": [ + "owner", + "expected" + ], + "end": 1780, + "name": "identity_mapping", + "start": 1756 + }, + { + "arguments": [ + "code" + ], + "end": 1797, + "name": "code_names", + "start": 1784 + }, + { + "arguments": [ + "function" + ], + "end": 1820, + "name": "raw_function_record", + "start": 1799 + }, + { + "arguments": [ + "initial_functions", + "initial_classes" + ], + "end": 1884, + "name": "capture_graph", + "start": 1822 + }, + { + "arguments": [ + "namespace", + "name", + "expected", + "original_record" + ], + "end": 1898, + "name": "expected_global", + "start": 1886 + }, + { + "arguments": [ + "record", + "domains", + "builtin_values" + ], + "end": 1981, + "name": "fresh_function", + "start": 1900 + }, + { + "arguments": [ + "graph", + "domains", + "builtin_values", + "message" + ], + "end": 1996, + "name": "fresh_graph", + "start": 1985 + }, + { + "arguments": [ + "module", + "name", + "kind", + "path", + "digest", + "source_bytes" + ], + "end": 2029, + "name": "module_image", + "start": 1998 + }, + { + "arguments": [ + "handle" + ], + "end": 2034, + "name": "record_for", + "start": 2031 + }, + { + "arguments": [ + "record", + "domains", + "builtin_values" + ], + "end": 2052, + "name": "fresh_module", + "start": 2036 + }, + { + "arguments": [ + "domains" + ], + "end": 2088, + "name": "root_and_stdlib", + "start": 2070 + }, + { + "arguments": [ + "domains" + ], + "end": 2094, + "name": "check_registered", + "start": 2090 + }, + { + "arguments": [ + "handle" + ], + "end": 2109, + "name": "cold_check", + "start": 2096 + }, + { + "arguments": [ + "path", + "digest", + "name", + "kind" + ], + "end": 2157, + "name": "load", + "start": 2111 + }, + { + "arguments": [ + "operations", + "label" + ], + "end": 2258, + "name": "make_caller_descriptor", + "start": 2159 + }, + { + "arguments": [ + "handle" + ], + "end": 2269, + "name": "runtime_guard", + "start": 2260 + }, + { + "arguments": [ + "module" + ], + "end": 2277, + "name": "known_backend", + "start": 2271 + }, + { + "arguments": [ + "cls" + ], + "end": 2293, + "name": "known_guard", + "start": 2279 + }, + { + "arguments": [ + "record", + "export" + ], + "end": 2299, + "name": "classify", + "start": 2295 + }, + { + "arguments": [ + "record", + "export", + "role", + "args", + "kwargs" + ], + "end": 2359, + "name": "validate_producer_arguments", + "start": 2301 + }, + { + "arguments": [ + "handle", + "export" + ], + "end": 2397, + "name": "invoke", + "start": 2361 + }, + { + "arguments": [ + "obj", + "producer_handle", + "export", + "args_tuple", + "kwargs_dict" + ], + "end": 2418, + "name": "check_product", + "start": 2399 + }, + { + "arguments": [ + "handle", + "cls" + ], + "end": 2438, + "name": "set_backend_guard", + "start": 2420 + }, + { + "arguments": [ + "handle" + ], + "end": 2442, + "name": "source", + "start": 2440 + }, + { + "arguments": [ + "index" + ], + "end": 580, + "name": "dispatch", + "start": 534 + }, + { + "arguments": [], + "end": 596, + "name": "guarded_helpers", + "start": 591 + }, + { + "arguments": [], + "end": 1566, + "name": "operation", + "start": 1550 + }, + { + "arguments": [ + "index" + ], + "end": 2251, + "name": "dispatch", + "start": 2188 + }, + { + "arguments": [], + "end": 2267, + "name": "guarded_helpers", + "start": 2262 + } + ], + "g12_reference_cold_consumer_v1.py": [ + { + "arguments": [ + "condition", + "message" + ], + "end": 65, + "name": "_need", + "start": 63 + }, + { + "arguments": [ + "value", + "expected" + ], + "end": 75, + "name": "_exact", + "start": 68 + }, + { + "arguments": [ + "value", + "fields" + ], + "end": 80, + "name": "_fields", + "start": 78 + }, + { + "arguments": [ + "value" + ], + "end": 84, + "name": "_digest", + "start": 83 + }, + { + "arguments": [ + "value", + "positive" + ], + "end": 88, + "name": "_uint", + "start": 87 + }, + { + "arguments": [ + "value" + ], + "end": 93, + "name": "_number", + "start": 91 + }, + { + "arguments": [ + "path" + ], + "end": 99, + "name": "_path", + "start": 96 + }, + { + "arguments": [ + "info" + ], + "end": 104, + "name": "_identity", + "start": 102 + }, + { + "arguments": [ + "info" + ], + "end": 108, + "name": "_directory_key", + "start": 107 + }, + { + "arguments": [ + "path" + ], + "end": 139, + "name": "_directory_chain", + "start": 111 + }, + { + "arguments": [ + "rows" + ], + "end": 146, + "name": "_check_chain", + "start": 142 + }, + { + "arguments": [ + "primary", + "secondaries" + ], + "end": 160, + "name": "_raise_preserved", + "start": 149 + }, + { + "arguments": [ + "path", + "cap", + "mode" + ], + "end": 201, + "name": "_read_file", + "start": 163 + }, + { + "arguments": [ + "value" + ], + "end": 216, + "name": "_file_record", + "start": 204 + }, + { + "arguments": [ + "root", + "api", + "record", + "cap" + ], + "end": 228, + "name": "_root_read", + "start": 219 + }, + { + "arguments": [ + "items" + ], + "end": 236, + "name": "_pairs", + "start": 231 + }, + { + "arguments": [ + "value" + ], + "end": 240, + "name": "_nonfinite", + "start": 239 + }, + { + "arguments": [ + "value" + ], + "end": 245, + "name": "_canonical", + "start": 243 + }, + { + "arguments": [ + "raw", + "cap", + "canonical", + "newline" + ], + "end": 287, + "name": "_json", + "start": 248 + }, + { + "arguments": [ + "value", + "cap" + ], + "end": 293, + "name": "_hex", + "start": 290 + }, + { + "arguments": [ + "value", + "positive" + ], + "end": 301, + "name": "_decimal", + "start": 296 + }, + { + "arguments": [ + "raw", + "cap" + ], + "end": 342, + "name": "_tagged", + "start": 304 + }, + { + "arguments": [ + "encoded" + ], + "end": 352, + "name": "_rank_events", + "start": 345 + }, + { + "arguments": [ + "common_raw", + "diagnostic_raw" + ], + "end": 400, + "name": "_validate_pair", + "start": 355 + }, + { + "arguments": [ + "value" + ], + "end": 408, + "name": "_source_pin", + "start": 403 + }, + { + "arguments": [ + "start", + "receipt", + "usage", + "stdout", + "stderr", + "root_argv", + "invocation", + "source_pins", + "phase_sha" + ], + "end": 453, + "name": "_validate_guard", + "start": 411 + }, + { + "arguments": [ + "namespace" + ], + "end": 483, + "name": "_capture_graph", + "start": 456 + }, + { + "arguments": [ + "graph" + ], + "end": 509, + "name": "_current_graph", + "start": 486 + }, + { + "arguments": [ + "manifest", + "parent_path", + "parent_sha" + ], + "end": 873, + "name": "_validate_manifest", + "start": 776 + }, + { + "arguments": [ + "label", + "sources" + ], + "end": 889, + "name": "_fixed_argv", + "start": 876 + }, + { + "arguments": [ + "publication", + "manifest", + "manifest_record" + ], + "end": 921, + "name": "_validate_publication", + "start": 892 + }, + { + "arguments": [ + "code" + ], + "end": 946, + "name": "_source_code_shape", + "start": 924 + }, + { + "arguments": [ + "root", + "api", + "source", + "path" + ], + "end": 958, + "name": "_authenticate_own_functions", + "start": 949 + }, + { + "arguments": [ + "root", + "capability", + "api" + ], + "end": 1058, + "name": "load_original_g12_reference", + "start": 961 + }, + { + "arguments": [ + "self" + ], + "end": 40, + "name": "__init__", + "start": 38 + }, + { + "arguments": [ + "self", + "value" + ], + "end": 47, + "name": "append", + "start": 41 + }, + { + "arguments": [ + "self" + ], + "end": 49, + "name": "__bool__", + "start": 48 + }, + { + "arguments": [ + "self" + ], + "end": 51, + "name": "__len__", + "start": 50 + }, + { + "arguments": [ + "self", + "index" + ], + "end": 55, + "name": "__getitem__", + "start": 52 + }, + { + "arguments": [ + "self" + ], + "end": 58, + "name": "__iter__", + "start": 56 + }, + { + "arguments": [ + "self" + ], + "end": 60, + "name": "__repr__", + "start": 59 + }, + { + "arguments": [ + "value" + ], + "end": 940, + "name": "constant", + "start": 926 + } + ], + "g12_reference_parent_v1.py": [ + { + "arguments": [ + "condition", + "message" + ], + "end": 101, + "name": "_need", + "start": 99 + }, + { + "arguments": [ + "value", + "expected" + ], + "end": 111, + "name": "_exact", + "start": 104 + }, + { + "arguments": [ + "value", + "fields" + ], + "end": 116, + "name": "_fields", + "start": 114 + }, + { + "arguments": [ + "value" + ], + "end": 120, + "name": "_digest", + "start": 119 + }, + { + "arguments": [ + "value", + "positive" + ], + "end": 124, + "name": "_uint", + "start": 123 + }, + { + "arguments": [ + "value" + ], + "end": 129, + "name": "_number", + "start": 127 + }, + { + "arguments": [ + "path" + ], + "end": 135, + "name": "_path", + "start": 132 + }, + { + "arguments": [ + "info" + ], + "end": 140, + "name": "_identity", + "start": 138 + }, + { + "arguments": [ + "info" + ], + "end": 144, + "name": "_directory_key", + "start": 143 + }, + { + "arguments": [ + "path" + ], + "end": 175, + "name": "_directory_chain", + "start": 147 + }, + { + "arguments": [ + "rows" + ], + "end": 182, + "name": "_check_chain", + "start": 178 + }, + { + "arguments": [ + "primary", + "secondaries" + ], + "end": 196, + "name": "_raise_preserved", + "start": 185 + }, + { + "arguments": [ + "path", + "cap", + "mode" + ], + "end": 237, + "name": "_read_file", + "start": 199 + }, + { + "arguments": [ + "value" + ], + "end": 252, + "name": "_file_record", + "start": 240 + }, + { + "arguments": [ + "items" + ], + "end": 260, + "name": "_pairs", + "start": 255 + }, + { + "arguments": [ + "value" + ], + "end": 264, + "name": "_nonfinite", + "start": 263 + }, + { + "arguments": [ + "value" + ], + "end": 269, + "name": "_canonical", + "start": 267 + }, + { + "arguments": [ + "raw", + "cap", + "canonical", + "newline" + ], + "end": 311, + "name": "_json", + "start": 272 + }, + { + "arguments": [ + "value", + "cap" + ], + "end": 317, + "name": "_hex", + "start": 314 + }, + { + "arguments": [ + "value", + "positive" + ], + "end": 325, + "name": "_decimal", + "start": 320 + }, + { + "arguments": [ + "raw", + "cap" + ], + "end": 366, + "name": "_tagged", + "start": 328 + }, + { + "arguments": [ + "encoded" + ], + "end": 376, + "name": "_rank_events", + "start": 369 + }, + { + "arguments": [ + "common_raw", + "diagnostic_raw" + ], + "end": 424, + "name": "_validate_pair", + "start": 379 + }, + { + "arguments": [ + "value" + ], + "end": 432, + "name": "_source_pin", + "start": 427 + }, + { + "arguments": [ + "start", + "receipt", + "usage", + "stdout", + "stderr", + "root_argv", + "invocation", + "source_pins", + "phase_sha" + ], + "end": 477, + "name": "_validate_guard", + "start": 435 + }, + { + "arguments": [ + "namespace" + ], + "end": 507, + "name": "_capture_graph", + "start": 480 + }, + { + "arguments": [ + "graph" + ], + "end": 534, + "name": "_current_graph", + "start": 511 + }, + { + "arguments": [ + "manifest", + "parent_path", + "parent_sha" + ], + "end": 903, + "name": "_validate_manifest", + "start": 806 + }, + { + "arguments": [ + "label", + "sources" + ], + "end": 919, + "name": "_fixed_argv", + "start": 906 + }, + { + "arguments": [ + "publication", + "manifest", + "manifest_record" + ], + "end": 951, + "name": "_validate_publication", + "start": 922 + }, + { + "arguments": [ + "code" + ], + "end": 976, + "name": "_source_code_shape", + "start": 954 + }, + { + "arguments": [ + "pid" + ], + "end": 1059, + "name": "_proc", + "start": 1032 + }, + { + "arguments": [], + "end": 1071, + "name": "_census", + "start": 1062 + }, + { + "arguments": [], + "end": 1075, + "name": "_children", + "start": 1074 + }, + { + "arguments": [], + "end": 1180, + "name": "_trusted_parent_launch", + "start": 1172 + }, + { + "arguments": [ + "path" + ], + "end": 1205, + "name": "_exclusive_directory", + "start": 1183 + }, + { + "arguments": [ + "descriptor", + "raw" + ], + "end": 1221, + "name": "_write_fd", + "start": 1208 + }, + { + "arguments": [ + "directory", + "name", + "raw" + ], + "end": 1239, + "name": "_copy_file", + "start": 1224 + }, + { + "arguments": [ + "entry_ns", + "own_start", + "children_start" + ], + "end": 1250, + "name": "_actual_costs", + "start": 1242 + }, + { + "arguments": [], + "end": 1722, + "name": "run_g12_reference", + "start": 1253 + }, + { + "arguments": [ + "self" + ], + "end": 76, + "name": "__init__", + "start": 74 + }, + { + "arguments": [ + "self", + "value" + ], + "end": 83, + "name": "append", + "start": 77 + }, + { + "arguments": [ + "self" + ], + "end": 85, + "name": "__bool__", + "start": 84 + }, + { + "arguments": [ + "self" + ], + "end": 87, + "name": "__len__", + "start": 86 + }, + { + "arguments": [ + "self", + "index" + ], + "end": 91, + "name": "__getitem__", + "start": 88 + }, + { + "arguments": [ + "self" + ], + "end": 94, + "name": "__iter__", + "start": 92 + }, + { + "arguments": [ + "self" + ], + "end": 96, + "name": "__repr__", + "start": 95 + }, + { + "arguments": [ + "value" + ], + "end": 970, + "name": "constant", + "start": 956 + }, + { + "arguments": [ + "self" + ], + "end": 1087, + "name": "__init__", + "start": 1080 + }, + { + "arguments": [ + "self", + "row" + ], + "end": 1105, + "name": "add", + "start": 1089 + }, + { + "arguments": [ + "self" + ], + "end": 1125, + "name": "observe", + "start": 1107 + }, + { + "arguments": [ + "self" + ], + "end": 1137, + "name": "stop_known", + "start": 1127 + }, + { + "arguments": [ + "self", + "process", + "deadline", + "failed" + ], + "end": 1169, + "name": "finish", + "start": 1139 + }, + { + "arguments": [], + "end": 1297, + "name": "current", + "start": 1285 + }, + { + "arguments": [], + "end": 1416, + "name": "_g12_preflight_and_claim", + "start": 1299 + }, + { + "arguments": [], + "end": 1445, + "name": "_g12_launch_once", + "start": 1418 + }, + { + "arguments": [], + "end": 1478, + "name": "_g12_observe_wait_and_close", + "start": 1447 + }, + { + "arguments": [], + "end": 1504, + "name": "_g12_join_original_guard_evidence", + "start": 1480 + }, + { + "arguments": [], + "end": 1517, + "name": "_g12_collect_complete_pair", + "start": 1506 + }, + { + "arguments": [], + "end": 1552, + "name": "_g12_retain_parent_pair_and_evidence", + "start": 1519 + }, + { + "arguments": [], + "end": 1648, + "name": "_g12_seal_once", + "start": 1554 + }, + { + "arguments": [], + "end": 1696, + "name": "_g12_finish_failure", + "start": 1650 + } + ], + "integration/g12_reference_adapter_v1.py": [ + { + "arguments": [ + "condition", + "message" + ], + "end": 50, + "name": "_need", + "start": 48 + }, + { + "arguments": [ + "value", + "expected" + ], + "end": 60, + "name": "_exact", + "start": 53 + }, + { + "arguments": [ + "value", + "fields" + ], + "end": 65, + "name": "_fields", + "start": 63 + }, + { + "arguments": [ + "value" + ], + "end": 69, + "name": "_digest", + "start": 68 + }, + { + "arguments": [ + "value", + "positive" + ], + "end": 73, + "name": "_uint", + "start": 72 + }, + { + "arguments": [ + "value" + ], + "end": 78, + "name": "_number", + "start": 76 + }, + { + "arguments": [ + "path" + ], + "end": 84, + "name": "_path", + "start": 81 + }, + { + "arguments": [ + "info" + ], + "end": 89, + "name": "_identity", + "start": 87 + }, + { + "arguments": [ + "info" + ], + "end": 93, + "name": "_directory_key", + "start": 92 + }, + { + "arguments": [ + "path" + ], + "end": 124, + "name": "_directory_chain", + "start": 96 + }, + { + "arguments": [ + "rows" + ], + "end": 131, + "name": "_check_chain", + "start": 127 + }, + { + "arguments": [ + "primary", + "secondaries" + ], + "end": 145, + "name": "_raise_preserved", + "start": 134 + }, + { + "arguments": [ + "path", + "cap", + "mode" + ], + "end": 186, + "name": "_read_file", + "start": 148 + }, + { + "arguments": [ + "items" + ], + "end": 194, + "name": "_pairs", + "start": 189 + }, + { + "arguments": [ + "value" + ], + "end": 198, + "name": "_nonfinite", + "start": 197 + }, + { + "arguments": [ + "value" + ], + "end": 203, + "name": "_canonical", + "start": 201 + }, + { + "arguments": [ + "raw", + "cap", + "canonical", + "newline" + ], + "end": 245, + "name": "_json", + "start": 206 + }, + { + "arguments": [ + "namespace" + ], + "end": 275, + "name": "_capture_graph", + "start": 248 + }, + { + "arguments": [ + "graph" + ], + "end": 302, + "name": "_current_graph", + "start": 279 + }, + { + "arguments": [ + "code" + ], + "end": 328, + "name": "_source_code_shape", + "start": 306 + }, + { + "arguments": [ + "root", + "api", + "source", + "path" + ], + "end": 340, + "name": "_authenticate_own_functions", + "start": 331 + }, + { + "arguments": [], + "end": 455, + "name": "_g12_adapter_entry", + "start": 344 + }, + { + "arguments": [ + "self" + ], + "end": 25, + "name": "__init__", + "start": 23 + }, + { + "arguments": [ + "self", + "value" + ], + "end": 32, + "name": "append", + "start": 26 + }, + { + "arguments": [ + "self" + ], + "end": 34, + "name": "__bool__", + "start": 33 + }, + { + "arguments": [ + "self" + ], + "end": 36, + "name": "__len__", + "start": 35 + }, + { + "arguments": [ + "self", + "index" + ], + "end": 40, + "name": "__getitem__", + "start": 37 + }, + { + "arguments": [ + "self" + ], + "end": 43, + "name": "__iter__", + "start": 41 + }, + { + "arguments": [ + "self" + ], + "end": 45, + "name": "__repr__", + "start": 44 + }, + { + "arguments": [ + "value" + ], + "end": 322, + "name": "constant", + "start": 308 + } + ] + }, + "original_source_anchors": [ + { + "functions": [ + "require_trusted_launch", + "main" + ], + "lines": [ + [ + 25, + 54 + ], + [ + 166, + 254 + ], + [ + 259, + 310 + ] + ], + "source": "original_guard", + "supports": "Exact guard contract, own locks/phase/original limits, START/wait/receipt join and fixed argv tail." + }, + { + "functions": [ + "_check_root", + "_hash_regular", + "admit_provider", + "capture_api", + "_entry" + ], + "lines": [ + [ + 447, + 506 + ], + [ + 577, + 624 + ], + [ + 772, + 833 + ] + ], + "source": "root", + "supports": "Actual Root source identity/capability/currentness and injected bootstrap execution; hashing limitation explicitly supplemented." + }, + { + "functions": [ + "_profile_files", + "_audit_files", + "preflight_runtime" + ], + "lines": [ + [ + 276, + 294 + ], + [ + 452, + 458 + ] + ], + "source": "provider", + "supports": "Unchanged exact runtime-profile and header/file audit before driver entry." + }, + { + "functions": [ + "main", + "_g12_common_outputs", + "_g12_diagnostic_snapshot", + "_g12_restore_and_check", + "_g12_export_reference", + "_g12_reference_entry", + "_g12_reference_bootstrap" + ], + "lines": [ + [ + 136, + 174 + ], + [ + 178, + 218 + ], + [ + 257, + 265 + ], + [ + 356, + 448 + ], + [ + 858, + 874 + ], + [ + 878, + 892 + ], + [ + 1046, + 1150 + ], + [ + 1153, + 1226 + ] + ], + "source": "reference_producer", + "supports": "Accepted original reference bytes, mode/layout, known profile call chain, exact schemas, joint export and actual initial bootstrap premise." + }, + { + "functions": [ + "ComplementTrace.receipt" + ], + "lines": [ + [ + 212, + 254 + ] + ], + "source": "native_backend_source", + "supports": "Exact diagnostic cumulative complement receipt schema only; no native body was run." + }, + { + "functions": [ + "stable_file", + "proc", + "census", + "generation", + "children_now", + "OwnedDomain", + "run_root" + ], + "lines": [ + [ + 63, + 91 + ], + [ + 114, + 146 + ], + [ + 205, + 309 + ], + [ + 688, + 792 + ] + ], + "source": "current_supervisor", + "supports": "Finite actual Popen/generation/known-cleanup/complete-byte custody pattern only, no current funded runner adoption." + }, + { + "functions": [ + "ActualRootResults", + "safe_custody_state" + ], + "lines": [ + [ + 731, + 759 + ], + [ + 875, + 898 + ] + ], + "source": "current_controller", + "supports": "Retain actual result/Popen-owner path; serialization never reconstructs live ownership." + } + ], + "parent_identity": "Original external initial trusted launcher supplies bootstrap_g12_parent_source_pin; future launch source literal parent slot must be None, effective selection joins external source identity. No caller completion data or source self-hash cycle.", + "schema": "g12-custody-fixed-source-map-v1", + "shared_helpers": { + "_authenticate_own_functions": [ + { + "end": 958, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "dc2297aaa593221c588730ecd40c0a7a9877996719cc7f5290269c327bcefbda", + "start": 949 + }, + { + "end": 340, + "file": "integration/g12_reference_adapter_v1.py", + "sha256": "dc2297aaa593221c588730ecd40c0a7a9877996719cc7f5290269c327bcefbda", + "start": 331 + } + ], + "_canonical": [ + { + "end": 245, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "7e0e9478b35d59301777b9dbf1503bbf073d3c3f386dbd689d6a4be07be30695", + "start": 243 + }, + { + "end": 269, + "file": "g12_reference_parent_v1.py", + "sha256": "7e0e9478b35d59301777b9dbf1503bbf073d3c3f386dbd689d6a4be07be30695", + "start": 267 + }, + { + "end": 203, + "file": "integration/g12_reference_adapter_v1.py", + "sha256": "7e0e9478b35d59301777b9dbf1503bbf073d3c3f386dbd689d6a4be07be30695", + "start": 201 + } + ], + "_capture_graph": [ + { + "end": 483, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "14c6657265ab2ae5b8a42e842ef1104a48397f16fb3cfa0d03b73470975fdfe5", + "start": 456 + }, + { + "end": 507, + "file": "g12_reference_parent_v1.py", + "sha256": "14c6657265ab2ae5b8a42e842ef1104a48397f16fb3cfa0d03b73470975fdfe5", + "start": 480 + }, + { + "end": 275, + "file": "integration/g12_reference_adapter_v1.py", + "sha256": "14c6657265ab2ae5b8a42e842ef1104a48397f16fb3cfa0d03b73470975fdfe5", + "start": 248 + } + ], + "_check_chain": [ + { + "end": 146, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "415449803e24666532d3c91659ea3eaee20d1828573700c9dc437762aab5b0d9", + "start": 142 + }, + { + "end": 182, + "file": "g12_reference_parent_v1.py", + "sha256": "415449803e24666532d3c91659ea3eaee20d1828573700c9dc437762aab5b0d9", + "start": 178 + }, + { + "end": 131, + "file": "integration/g12_reference_adapter_v1.py", + "sha256": "415449803e24666532d3c91659ea3eaee20d1828573700c9dc437762aab5b0d9", + "start": 127 + } + ], + "_current_graph": [ + { + "end": 509, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "60d1ed829a44dc5293578284b3038e8e50978c5e94cf7e2641e5d78b9d3e8d08", + "start": 486 + }, + { + "end": 534, + "file": "g12_reference_parent_v1.py", + "sha256": "60d1ed829a44dc5293578284b3038e8e50978c5e94cf7e2641e5d78b9d3e8d08", + "start": 511 + }, + { + "end": 302, + "file": "integration/g12_reference_adapter_v1.py", + "sha256": "60d1ed829a44dc5293578284b3038e8e50978c5e94cf7e2641e5d78b9d3e8d08", + "start": 279 + } + ], + "_decimal": [ + { + "end": 301, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "16640948a0adb7ca5a269692c206ca94a80e89b957ebbb367412e30664f5b0e4", + "start": 296 + }, + { + "end": 325, + "file": "g12_reference_parent_v1.py", + "sha256": "16640948a0adb7ca5a269692c206ca94a80e89b957ebbb367412e30664f5b0e4", + "start": 320 + } + ], + "_digest": [ + { + "end": 84, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "06b0ef7123fba28822f2f760003d2993f7e0fa55543eb2735ae96ea9022ab9f5", + "start": 83 + }, + { + "end": 120, + "file": "g12_reference_parent_v1.py", + "sha256": "06b0ef7123fba28822f2f760003d2993f7e0fa55543eb2735ae96ea9022ab9f5", + "start": 119 + }, + { + "end": 69, + "file": "integration/g12_reference_adapter_v1.py", + "sha256": "06b0ef7123fba28822f2f760003d2993f7e0fa55543eb2735ae96ea9022ab9f5", + "start": 68 + } + ], + "_directory_chain": [ + { + "end": 139, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "f7ec33765832d534e78a6f021f6ab358a05db55db6fb2880823faa6bc191b43c", + "start": 111 + }, + { + "end": 175, + "file": "g12_reference_parent_v1.py", + "sha256": "f7ec33765832d534e78a6f021f6ab358a05db55db6fb2880823faa6bc191b43c", + "start": 147 + }, + { + "end": 124, + "file": "integration/g12_reference_adapter_v1.py", + "sha256": "f7ec33765832d534e78a6f021f6ab358a05db55db6fb2880823faa6bc191b43c", + "start": 96 + } + ], + "_directory_key": [ + { + "end": 108, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "a770ea9d60f7984a6da81d9af9aa79bde251cba712beeec1066a6cfb04676504", + "start": 107 + }, + { + "end": 144, + "file": "g12_reference_parent_v1.py", + "sha256": "a770ea9d60f7984a6da81d9af9aa79bde251cba712beeec1066a6cfb04676504", + "start": 143 + }, + { + "end": 93, + "file": "integration/g12_reference_adapter_v1.py", + "sha256": "a770ea9d60f7984a6da81d9af9aa79bde251cba712beeec1066a6cfb04676504", + "start": 92 + } + ], + "_exact": [ + { + "end": 75, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "01d4dd247edcc06dec9eccc258c4b3924e5775c4c9a42494e43bf58117d90942", + "start": 68 + }, + { + "end": 111, + "file": "g12_reference_parent_v1.py", + "sha256": "01d4dd247edcc06dec9eccc258c4b3924e5775c4c9a42494e43bf58117d90942", + "start": 104 + }, + { + "end": 60, + "file": "integration/g12_reference_adapter_v1.py", + "sha256": "01d4dd247edcc06dec9eccc258c4b3924e5775c4c9a42494e43bf58117d90942", + "start": 53 + } + ], + "_fields": [ + { + "end": 80, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "ef75e9fe2185d965e3ce2d81a71598ff54819bdb599343b0b6068a305ccb5498", + "start": 78 + }, + { + "end": 116, + "file": "g12_reference_parent_v1.py", + "sha256": "ef75e9fe2185d965e3ce2d81a71598ff54819bdb599343b0b6068a305ccb5498", + "start": 114 + }, + { + "end": 65, + "file": "integration/g12_reference_adapter_v1.py", + "sha256": "ef75e9fe2185d965e3ce2d81a71598ff54819bdb599343b0b6068a305ccb5498", + "start": 63 + } + ], + "_file_record": [ + { + "end": 216, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "a702bd3285a2e2a95c96386f9183225743edb7af9e68ed316c8b71426f23402f", + "start": 204 + }, + { + "end": 252, + "file": "g12_reference_parent_v1.py", + "sha256": "a702bd3285a2e2a95c96386f9183225743edb7af9e68ed316c8b71426f23402f", + "start": 240 + } + ], + "_fixed_argv": [ + { + "end": 889, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "873bb9d49d16ad164c78504a190a1f8b32d5bb8c60465ced4a31542c89c070bd", + "start": 876 + }, + { + "end": 919, + "file": "g12_reference_parent_v1.py", + "sha256": "873bb9d49d16ad164c78504a190a1f8b32d5bb8c60465ced4a31542c89c070bd", + "start": 906 + } + ], + "_hex": [ + { + "end": 293, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "9c3f82c20caef2a3230c50e9da7d0811b335ba0ee20ae019d91dad487ca97865", + "start": 290 + }, + { + "end": 317, + "file": "g12_reference_parent_v1.py", + "sha256": "9c3f82c20caef2a3230c50e9da7d0811b335ba0ee20ae019d91dad487ca97865", + "start": 314 + } + ], + "_identity": [ + { + "end": 104, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "3b3ebde1076617647e5d494d90941845707678922ac82b0cc4ba1ef5c866c7dc", + "start": 102 + }, + { + "end": 140, + "file": "g12_reference_parent_v1.py", + "sha256": "3b3ebde1076617647e5d494d90941845707678922ac82b0cc4ba1ef5c866c7dc", + "start": 138 + }, + { + "end": 89, + "file": "integration/g12_reference_adapter_v1.py", + "sha256": "3b3ebde1076617647e5d494d90941845707678922ac82b0cc4ba1ef5c866c7dc", + "start": 87 + } + ], + "_json": [ + { + "end": 287, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "e8a6d40a4f2febbb08b6de804b91e8179ec2de20beda2022ef5495bcfafce979", + "start": 248 + }, + { + "end": 311, + "file": "g12_reference_parent_v1.py", + "sha256": "e8a6d40a4f2febbb08b6de804b91e8179ec2de20beda2022ef5495bcfafce979", + "start": 272 + }, + { + "end": 245, + "file": "integration/g12_reference_adapter_v1.py", + "sha256": "e8a6d40a4f2febbb08b6de804b91e8179ec2de20beda2022ef5495bcfafce979", + "start": 206 + } + ], + "_need": [ + { + "end": 65, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "894c50c732c10090c7a9c429309fe280b589ec0542afa9d3835e590b2ae9a4cd", + "start": 63 + }, + { + "end": 101, + "file": "g12_reference_parent_v1.py", + "sha256": "894c50c732c10090c7a9c429309fe280b589ec0542afa9d3835e590b2ae9a4cd", + "start": 99 + }, + { + "end": 50, + "file": "integration/g12_reference_adapter_v1.py", + "sha256": "894c50c732c10090c7a9c429309fe280b589ec0542afa9d3835e590b2ae9a4cd", + "start": 48 + } + ], + "_nonfinite": [ + { + "end": 240, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "244f707c8a2696174d54e44e3824a7c0322742c0fb804465e13564103ab39365", + "start": 239 + }, + { + "end": 264, + "file": "g12_reference_parent_v1.py", + "sha256": "244f707c8a2696174d54e44e3824a7c0322742c0fb804465e13564103ab39365", + "start": 263 + }, + { + "end": 198, + "file": "integration/g12_reference_adapter_v1.py", + "sha256": "244f707c8a2696174d54e44e3824a7c0322742c0fb804465e13564103ab39365", + "start": 197 + } + ], + "_number": [ + { + "end": 93, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "ce9e5a629f1a9312489b6806bce8b23d2ec738a4c6b732cb03ab80aa3b6e59c6", + "start": 91 + }, + { + "end": 129, + "file": "g12_reference_parent_v1.py", + "sha256": "ce9e5a629f1a9312489b6806bce8b23d2ec738a4c6b732cb03ab80aa3b6e59c6", + "start": 127 + }, + { + "end": 78, + "file": "integration/g12_reference_adapter_v1.py", + "sha256": "ce9e5a629f1a9312489b6806bce8b23d2ec738a4c6b732cb03ab80aa3b6e59c6", + "start": 76 + } + ], + "_pairs": [ + { + "end": 236, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "90dc6ee079b92f83e3ac116a1814a618dd42bf2c97093e0b5d0a33633c55df64", + "start": 231 + }, + { + "end": 260, + "file": "g12_reference_parent_v1.py", + "sha256": "90dc6ee079b92f83e3ac116a1814a618dd42bf2c97093e0b5d0a33633c55df64", + "start": 255 + }, + { + "end": 194, + "file": "integration/g12_reference_adapter_v1.py", + "sha256": "90dc6ee079b92f83e3ac116a1814a618dd42bf2c97093e0b5d0a33633c55df64", + "start": 189 + } + ], + "_path": [ + { + "end": 99, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "46e6a95a50d1433e354f9ccbd17961aa923756469e1c2a9196b013a24636a032", + "start": 96 + }, + { + "end": 135, + "file": "g12_reference_parent_v1.py", + "sha256": "46e6a95a50d1433e354f9ccbd17961aa923756469e1c2a9196b013a24636a032", + "start": 132 + }, + { + "end": 84, + "file": "integration/g12_reference_adapter_v1.py", + "sha256": "46e6a95a50d1433e354f9ccbd17961aa923756469e1c2a9196b013a24636a032", + "start": 81 + } + ], + "_raise_preserved": [ + { + "end": 160, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "183d23c4e56af814bfa689551ba5f3605c665daf4dd87686f72d060caf12665b", + "start": 149 + }, + { + "end": 196, + "file": "g12_reference_parent_v1.py", + "sha256": "183d23c4e56af814bfa689551ba5f3605c665daf4dd87686f72d060caf12665b", + "start": 185 + }, + { + "end": 145, + "file": "integration/g12_reference_adapter_v1.py", + "sha256": "183d23c4e56af814bfa689551ba5f3605c665daf4dd87686f72d060caf12665b", + "start": 134 + } + ], + "_rank_events": [ + { + "end": 352, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "e0134b65787051090fd9b77c09603fcc5f40d541a418e351e97b99637a8ce61e", + "start": 345 + }, + { + "end": 376, + "file": "g12_reference_parent_v1.py", + "sha256": "e0134b65787051090fd9b77c09603fcc5f40d541a418e351e97b99637a8ce61e", + "start": 369 + } + ], + "_read_file": [ + { + "end": 201, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "6fa40aa3a963ca6f6cc44092e4942e7c4f728eb72400e9af5292c5120e14e9bd", + "start": 163 + }, + { + "end": 237, + "file": "g12_reference_parent_v1.py", + "sha256": "6fa40aa3a963ca6f6cc44092e4942e7c4f728eb72400e9af5292c5120e14e9bd", + "start": 199 + }, + { + "end": 186, + "file": "integration/g12_reference_adapter_v1.py", + "sha256": "6fa40aa3a963ca6f6cc44092e4942e7c4f728eb72400e9af5292c5120e14e9bd", + "start": 148 + } + ], + "_source_code_shape": [ + { + "end": 946, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "43b18e4634d80127bcef2c4f38441007505c9ab179ff7c383e64a95a6b7fad7f", + "start": 924 + }, + { + "end": 976, + "file": "g12_reference_parent_v1.py", + "sha256": "43b18e4634d80127bcef2c4f38441007505c9ab179ff7c383e64a95a6b7fad7f", + "start": 954 + }, + { + "end": 328, + "file": "integration/g12_reference_adapter_v1.py", + "sha256": "43b18e4634d80127bcef2c4f38441007505c9ab179ff7c383e64a95a6b7fad7f", + "start": 306 + } + ], + "_source_pin": [ + { + "end": 408, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "9b56c55e466783d89a2a580993ae19f6833da76047b660d51c088b6697f2a242", + "start": 403 + }, + { + "end": 432, + "file": "g12_reference_parent_v1.py", + "sha256": "9b56c55e466783d89a2a580993ae19f6833da76047b660d51c088b6697f2a242", + "start": 427 + } + ], + "_tagged": [ + { + "end": 342, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "ebe7a709a788246d3a09dab91ad97cafb3ed645cea34293eb2b804c9ef1c261b", + "start": 304 + }, + { + "end": 366, + "file": "g12_reference_parent_v1.py", + "sha256": "ebe7a709a788246d3a09dab91ad97cafb3ed645cea34293eb2b804c9ef1c261b", + "start": 328 + } + ], + "_uint": [ + { + "end": 88, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "dd5a9496e01d4111210fbe8c8de36b824bc6d0a4919596b9ea02aae820665e41", + "start": 87 + }, + { + "end": 124, + "file": "g12_reference_parent_v1.py", + "sha256": "dd5a9496e01d4111210fbe8c8de36b824bc6d0a4919596b9ea02aae820665e41", + "start": 123 + }, + { + "end": 73, + "file": "integration/g12_reference_adapter_v1.py", + "sha256": "dd5a9496e01d4111210fbe8c8de36b824bc6d0a4919596b9ea02aae820665e41", + "start": 72 + } + ], + "_validate_guard": [ + { + "end": 453, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "18e731760b9db41d407e098e61c41498e40dded69d6d6dca2a058a4f2229c76b", + "start": 411 + }, + { + "end": 477, + "file": "g12_reference_parent_v1.py", + "sha256": "18e731760b9db41d407e098e61c41498e40dded69d6d6dca2a058a4f2229c76b", + "start": 435 + } + ], + "_validate_manifest": [ + { + "end": 873, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "905e2e71444989a15f01e3b4be0bed7874bc1180329692e4072c41c0fbb70feb", + "start": 776 + }, + { + "end": 903, + "file": "g12_reference_parent_v1.py", + "sha256": "905e2e71444989a15f01e3b4be0bed7874bc1180329692e4072c41c0fbb70feb", + "start": 806 + } + ], + "_validate_pair": [ + { + "end": 400, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "417a9fb35620481b7e7bf8de630595a472b4d2d4c5bdf884eb0afd50442068b1", + "start": 355 + }, + { + "end": 424, + "file": "g12_reference_parent_v1.py", + "sha256": "417a9fb35620481b7e7bf8de630595a472b4d2d4c5bdf884eb0afd50442068b1", + "start": 379 + } + ], + "_validate_publication": [ + { + "end": 921, + "file": "g12_reference_cold_consumer_v1.py", + "sha256": "a155ee516065e539bab5bacaa6a30c50c603995b8a5e6eb819126c6c5d815b11", + "start": 892 + }, + { + "end": 951, + "file": "g12_reference_parent_v1.py", + "sha256": "a155ee516065e539bab5bacaa6a30c50c603995b8a5e6eb819126c6c5d815b11", + "start": 922 + } + ] + }, + "source_files": { + "candidate-integration/g12_candidate_driver_N22_custody_v1.py": { + "bytes": 128363, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_N22_custody_v1.py", + "sha256": "c9d72a79ce3a828815d3d0370a1f95f210e1a41edeed767c55ff9d0614126fa4" + }, + "candidate-integration/g12_candidate_driver_P07_custody_v1.py": { + "bytes": 128363, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_P07_custody_v1.py", + "sha256": "2a5d202dabd78d5de54fac29db7fdfaf8836866425d93842f2b22d747fa52d0c" + }, + "candidate-integration/g12_candidate_driver_support_N22_custody_v1.py": { + "bytes": 33549, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_N22_custody_v1.py", + "sha256": "28c1a44750b9745a5ad6e930f9a83cf256b3a90905f5f30d08a89aca54c828da" + }, + "candidate-integration/g12_candidate_driver_support_P07_custody_v1.py": { + "bytes": 33549, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_P07_custody_v1.py", + "sha256": "cae88bf247ee775d6d7fc1264cb2af1d487e4c19168ca787c7c16aba16452220" + }, + "candidate-integration/g12_epoch_authority_custody_v1.py": { + "bytes": 139604, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_epoch_authority_custody_v1.py", + "sha256": "3079a096df1072a83056f3f8a8cbf9e766fdddb488e36dddb36544c7929f988a" + }, + "g12_reference_cold_consumer_v1.py": { + "bytes": 61159, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/g12_reference_cold_consumer_v1.py", + "sha256": "89ad17cfa90e895e2cb105e80cc57c82be4bf1a4a85a9d44322016c4344e3849" + }, + "g12_reference_parent_v1.py": { + "bytes": 94080, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/g12_reference_parent_v1.py", + "sha256": "160b8c5de808b9b31532608a89fa5e209110caea132145cd431ffade4403079e" + }, + "integration/g12_reference_adapter_v1.py": { + "bytes": 21740, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/integration/g12_reference_adapter_v1.py", + "sha256": "43aaabc69841b0a90fae599011de85f4736f42ced64344c49d6cd93f20297f9f" + } + } +} diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-READY-PINS-v1.json b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-READY-PINS-v1.json new file mode 100644 index 0000000000..2b4d53c4a8 --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/SOURCE-READY-PINS-v1.json @@ -0,0 +1,56 @@ +{ + "created_utc": "2026-10-31T02:22:25.534003+00:00", + "files": { + "candidate-integration/g12_candidate_driver_N22_custody_v1.py": { + "bytes": 128363, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_N22_custody_v1.py", + "sha256": "c9d72a79ce3a828815d3d0370a1f95f210e1a41edeed767c55ff9d0614126fa4" + }, + "candidate-integration/g12_candidate_driver_P07_custody_v1.py": { + "bytes": 128363, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_P07_custody_v1.py", + "sha256": "2a5d202dabd78d5de54fac29db7fdfaf8836866425d93842f2b22d747fa52d0c" + }, + "candidate-integration/g12_candidate_driver_support_N22_custody_v1.py": { + "bytes": 33549, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_N22_custody_v1.py", + "sha256": "28c1a44750b9745a5ad6e930f9a83cf256b3a90905f5f30d08a89aca54c828da" + }, + "candidate-integration/g12_candidate_driver_support_P07_custody_v1.py": { + "bytes": 33549, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_P07_custody_v1.py", + "sha256": "cae88bf247ee775d6d7fc1264cb2af1d487e4c19168ca787c7c16aba16452220" + }, + "candidate-integration/g12_epoch_authority_custody_v1.py": { + "bytes": 139604, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_epoch_authority_custody_v1.py", + "sha256": "3079a096df1072a83056f3f8a8cbf9e766fdddb488e36dddb36544c7929f988a" + }, + "g12_reference_cold_consumer_v1.py": { + "bytes": 61159, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/g12_reference_cold_consumer_v1.py", + "sha256": "89ad17cfa90e895e2cb105e80cc57c82be4bf1a4a85a9d44322016c4344e3849" + }, + "g12_reference_parent_v1.py": { + "bytes": 94080, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/g12_reference_parent_v1.py", + "sha256": "160b8c5de808b9b31532608a89fa5e209110caea132145cd431ffade4403079e" + }, + "integration/g12_reference_adapter_v1.py": { + "bytes": 21740, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/integration/g12_reference_adapter_v1.py", + "sha256": "43aaabc69841b0a90fae599011de85f4736f42ced64344c49d6cd93f20297f9f" + } + }, + "schema": "g12-custody-ready-source-pins-v1", + "status": "SOURCE_BYTES_FINAL_FOR_INDEPENDENT_REVIEW_FULL_METADATA_PENDING", + "target_operations": 0 +} diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/STAGE-DERIVATION-v1.json b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/STAGE-DERIVATION-v1.json new file mode 100644 index 0000000000..77125db563 --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/STAGE-DERIVATION-v1.json @@ -0,0 +1,95 @@ +{ + "actual_stage_created_or_mounted": false, + "new_source_selections": null, + "original_guard": { + "bytes": 15493, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/run_guarded_v3.py", + "sha256": "bd882e3dadb1b6aeaa63ee824f1a1c58f8ef2546b6840a2bffa46885a184d3eb" + }, + "original_producer": { + "bytes": 70246, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/reference-producer-v2/g12_reference_driver_v2.py", + "sha256": "a346025d5b6e2b26246521c6af6292643a4c2c3286b33ff3996dcf051cd6be26" + }, + "reviewed_new_adapter": { + "bytes": 21740, + "mode": "0444", + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/integration/g12_reference_adapter_v1.py", + "sha256": "43aaabc69841b0a90fae599011de85f4736f42ced64344c49d6cd93f20297f9f" + }, + "schema": "g12-fixed-stage-source-derivation-recipe-v1", + "scope": "Recipe only. No existing stage or accepted source changed. Full prospective stage/JOBS/source closure requires exact immutable source selection after independent produced-source review.", + "stage": { + "created_now": false, + "future_digest_rule": "New adapter/stage/parent source digests must be computed from independently reviewed bytes at source selection; they cannot be fake hashes or runtime setter inputs. No self-referential source/plan hash cycle.", + "job_name": "g12-reference", + "job_record": { + "bootstrap": { + "driver": "integration/g12_reference_adapter_v1.py", + "provider": "integration/probe_binding_v3.py" + }, + "lanes": "g12-reference", + "optimized": false + }, + "job_rejections": [ + "entry present", + "finite_only present or true", + "optimized other than exact False", + "additional jobs or bootstrap keys", + "different lanes", + "unknown argv tail" + ], + "manifest_rule": "New immutable STAGE.json and JOBS.json enumerate exactly the staged closure including adapter, Root, provider, baseline producer/source/reference and correct authority; runner_sha256 is unchanged original guard. No existing stage is edited. Root/provider runtime file pins remain unchanged.", + "mounts": { + "areas/cache-validity/cold_authority_v7.py": { + "historical_2a941_mount_rejected": true, + "mode": "0444", + "sha256": "f279ab86fc17c6a517b035f19d56863919cbd8304de4e7d5332457c6159aec10" + }, + "baseline/SOURCE-PINS.json": { + "mode": "0444", + "sha256": "88bba3caf5975f30fa7abceaea9454110cf3b069233e8241a2ca13d1dff171a7" + }, + "baseline/engine/": { + "constraint": "Exact original seven ENGINE_PINS entries at producer L33-41, original modes; no source modification." + }, + "baseline/frozen/": { + "constraint": "Exact 32-file SOURCE-PINS closure, original modes, no symlinks; original producer inventory remains authoritative." + }, + "baseline/full_driver.py": { + "bytes": 70246, + "mode": "0444", + "sha256": "a346025d5b6e2b26246521c6af6292643a4c2c3286b33ff3996dcf051cd6be26", + "source": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/reference-producer-v2/g12_reference_driver_v2.py" + }, + "baseline/reference/certificates/complex-network.json": { + "mode": "0444", + "sha256": "1f763d95c7ff163aa71d13cd82784f16665be8afb21f75e76941e2119562098f" + }, + "integration/RUNTIME-PROFILE.json": { + "mode": "0444", + "sha256": "ad0ec2aea01b83f97bdeafd9e9208360127fee870d024d353879b5ed99237109", + "source": "Exact file named by provider._profile_files at historical stage integration; preserve provider runtime/header preflight." + }, + "integration/full_driver.py": { + "mode": "0444", + "sha256": "f5a2d33f2b4d3651f214156a0e7094c2bb516ce2d5ab7698d18c11f98f35dee0", + "source": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/full_driver.py" + }, + "integration/g12_reference_adapter_v1.py": { + "mode": "0444", + "sha256": "FUTURE_REVIEWED_ADAPTER_SOURCE_DIGEST" + }, + "integration/probe_binding_v3.py": { + "mode": "0444", + "sha256": "9cbb7368f89e71d1e6cc46db5dc77efed3e03ed2a801c98c88fe316e4d9f3ef2", + "source": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/combined-finite-v8/integration/probe_binding_v3.py" + } + }, + "shape_reason": "Producer.__file__ at stage/baseline/full_driver.py makes HERE baseline and its rsplit(/,2)[0] authority reference resolve to stage/areas/cache-validity/cold_authority_v7.py exactly.", + "stage_name": "g12-reference-custody-v1", + "stage_root": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/stages/g12-reference-custody-v1" + } +} diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/STATIC-VERIFICATION-v1.json b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/STATIC-VERIFICATION-v1.json new file mode 100644 index 0000000000..47f369b665 --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/STATIC-VERIFICATION-v1.json @@ -0,0 +1,60 @@ +{ + "activity": { + "authored_source_imports_execution": 0, + "protected_runtime_reads": 0, + "target_process_lock_network_operations": 0, + "tests_helpers_compiler_native_science_decoders": 0 + }, + "all_listed_checks_pass": true, + "check_count": 45, + "checks": { + "G12_REFERENCE_HANDOFF:closed_None": true, + "G12_REFERENCE_LAUNCH_SELECTION:closed_None": true, + "_G12_REFERENCE_TRANSPORT_SHA256:closed_None": true, + "all_nine_private_parent_edges": true, + "candidate-integration/g12_candidate_driver_N22_custody_v1.py:AST_parse_without_import_execution": true, + "candidate-integration/g12_candidate_driver_P07_custody_v1.py:AST_parse_without_import_execution": true, + "candidate-integration/g12_candidate_driver_support_N22_custody_v1.py:AST_parse_without_import_execution": true, + "candidate-integration/g12_candidate_driver_support_P07_custody_v1.py:AST_parse_without_import_execution": true, + "candidate-integration/g12_epoch_authority_custody_v1.py:AST_parse_without_import_execution": true, + "cold_consumer_exact_three_argument_ABI": true, + "exactly_one_Popen_source_call": true, + "explicit_G12_N01": true, + "explicit_G12_N02": true, + "explicit_G12_N03": true, + "explicit_G12_N04": true, + "explicit_G12_N05": true, + "explicit_G12_N06": true, + "explicit_G12_N07": true, + "explicit_G12_N08": true, + "explicit_G12_N09": true, + "explicit_G12_N10": true, + "explicit_G12_N11": true, + "explicit_G12_N12": true, + "explicit_G12_N13": true, + "explicit_G12_N14": true, + "explicit_G12_N15": true, + "explicit_G12_N16": true, + "explicit_G12_N17": true, + "explicit_G12_N18": true, + "g12_candidate_driver_N22_custody_v1.py:exact_inverse": true, + "g12_candidate_driver_P07_custody_v1.py:exact_inverse": true, + "g12_candidate_driver_support_N22_custody_v1.py:exact_inverse": true, + "g12_candidate_driver_support_P07_custody_v1.py:exact_inverse": true, + "g12_epoch_authority_custody_v1.py:exact_inverse": true, + "g12_reference_cold_consumer_v1.py:AST_parse_without_import_execution": true, + "g12_reference_cold_consumer_v1.py:raw_secondary_fixed_slots": true, + "g12_reference_parent_v1.py:AST_parse_without_import_execution": true, + "g12_reference_parent_v1.py:raw_secondary_fixed_slots": true, + "integration/g12_reference_adapter_v1.py:AST_parse_without_import_execution": true, + "integration/g12_reference_adapter_v1.py:raw_secondary_fixed_slots": true, + "no_new_financial_API_stub": true, + "original_producer_hash_size_unchanged": true, + "private_parent_zero_arguments": true, + "source_identity_no_own_hash_cycle": true, + "unknown_tail_no_completed_cost_claim": true + }, + "limits": "Author AST/structure/hash/byte inverse checks only; not execution, semantic correctness or independent produced-source acceptance.", + "metadata_job_note": "Slow character diff metadata session85428 was stopped via its own known session with parent authorization; replaced by exact deterministic splice inverses. No target operation or source byte edit resulted.", + "schema": "g12-custody-author-static-verification-v1" +} diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/INTEGRATION-EDGES-v1.json b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/INTEGRATION-EDGES-v1.json new file mode 100644 index 0000000000..1b90cba3d9 --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/INTEGRATION-EDGES-v1.json @@ -0,0 +1,45 @@ +{ + "actual_reference_handoff": null, + "actual_transport_source_pin": null, + "authority_capture": "Original capture_epoch_authority(root, capability, api), actual bootstrap validated before operations return; private loader uses those exact closure cells before selected source exec/module_image; invoke validates identity before call and cold_check after return.", + "current_target_execution": 0, + "edits": [ + { + "derivative": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_epoch_authority_custody_v1.py", + "derivative_sha256": "3079a096df1072a83056f3f8a8cbf9e766fdddb488e36dddb36544c7929f988a", + "kind": "authority fixed loader and invoke", + "original": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/continuation/candidate-protocol-v1/g12_epoch_authority_selector_v1.py", + "original_sha256": "65b3d33068b0549ddb4a9e7e18a9912bebad69c309a8a29ae4fd532e9f428211" + }, + { + "derivative": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_N22_custody_v1.py", + "derivative_sha256": "c9d72a79ce3a828815d3d0370a1f95f210e1a41edeed767c55ff9d0614126fa4", + "kind": "exact capability ABI and selected owned authority derivative", + "original": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_N22_v2.py", + "original_sha256": "a2d7fcaa1d3267bb43f14bfa1422759f77ede73641ed1f2a4fe55448792eec4a" + }, + { + "derivative": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_N22_custody_v1.py", + "derivative_sha256": "28c1a44750b9745a5ad6e930f9a83cf256b3a90905f5f30d08a89aca54c828da", + "kind": "exact capability ABI", + "original": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_support_N22_v2.py", + "original_sha256": "5b7709012375e7e6600840c2c86bf90f44382499d1670b15ce325b30c14a2b48" + }, + { + "derivative": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_P07_custody_v1.py", + "derivative_sha256": "2a5d202dabd78d5de54fac29db7fdfaf8836866425d93842f2b22d747fa52d0c", + "kind": "exact capability ABI and selected owned authority derivative", + "original": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_P07_v2.py", + "original_sha256": "dc0e3c32a2412d8a872f8568ecbaff99a41785fadd79b0bbfc2341e0e51ede74" + }, + { + "derivative": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_P07_custody_v1.py", + "derivative_sha256": "cae88bf247ee775d6d7fc1264cb2af1d487e4c19168ca787c7c16aba16452220", + "kind": "exact capability ABI", + "original": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/g12-protocol-repair/g12_candidate_driver_support_P07_v2.py", + "original_sha256": "7c41cb423b18df69de48573817f92fae1a21be2751af7ad97768480ffa0b4a19" + } + ], + "no_self_digest_cycle": "Consumer source identity is initial loader tuple(path,digest,size) from its original Root hash; own source does not embed its own hash.", + "schema": "g12-fixed-cold-custody-source-edges-v1" +} diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_N22_custody_v1.py.txt b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_N22_custody_v1.py.txt new file mode 100644 index 0000000000..75735b75cd --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_N22_custody_v1.py.txt @@ -0,0 +1,1878 @@ +#!/usr/bin/env python3 +"""One complete frozen complex-network CLI with retained exact observations. + +Parent-owned serial wall/RSS/aggregate guard is mandatory. Profile mode is one +literal baseline diagnostic/anchor, not a performance sample. Both benchmark +modes require its immutable anchor. No search, retry, orchestration or network. +""" +from __future__ import annotations + +# Actual source-authenticated root injects these three values before driver exec. +# Capture them before importing any candidate, scientific, or orchestration code. +_CAPTURED_BOOTSTRAP_ROOT = bootstrap_root +_CAPTURED_BOOTSTRAP_CAPABILITY = bootstrap_capability +_CAPTURED_BOOTSTRAP_API = bootstrap_api +if type(_CAPTURED_BOOTSTRAP_API) is not tuple or len(_CAPTURED_BOOTSTRAP_API) != 4: + raise RuntimeError('Driver requires the parent-sealed exact four-entry bootstrap API') +_INITIAL_ROOT_IDENTITY = _CAPTURED_BOOTSTRAP_API[0]() +if (type(_CAPTURED_BOOTSTRAP_ROOT) is not _CAPTURED_BOOTSTRAP_ROOT.ModuleType or + any(type(entry) is not _CAPTURED_BOOTSTRAP_ROOT.FunctionType or + entry.__globals__ is not _CAPTURED_BOOTSTRAP_ROOT.__dict__ + for entry in _CAPTURED_BOOTSTRAP_API)): + raise RuntimeError('Driver bootstrap API is not bound to the actual root namespace') + +# Accepted helper/control sources and parent-inspected native dependency tuple. +# These are static expected pins; finite and full execution gates remain closed. +EXPECTED_BOOTSTRAP_ROOT_SHA256 = 'f5a2d33f2b4d3651f214156a0e7094c2bb516ce2d5ab7698d18c11f98f35dee0' +NATIVE_TCB_HELPER_SHA256 = '865943df5cfdbf9383362d7fb2b76c6d0fd895cf0a0e20d550a26b579606b5d7' +NATIVE_TCB_CONTROLS_SHA256 = '63b1804caa7f89915662a1424f788c3becad13520e1f63212a338fb45aaa2c5a' +NATIVE_TCB_EXPECTED_FILES = (('/usr/bin/python3.12', 'e50d468e8b0adfb05733f5b87b3cff34829c4a8c1aea50c865aa8bdfe4bb150f', 8020928), + ('/usr/lib/python3.12/lib-dynload/_hashlib.cpython-312-x86_64-linux-gnu.so', + '8dc6cda6dd9495b95a2bfb5b26e8cf06b72f36dc0213d958b9277a958287f0fe', + 64368), + ('/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2', + 'c20a2dc8917c755f02b94049356320fe1f62ac7d9f8994731f807d9df39302da', + 236616), + ('/usr/lib/x86_64-linux-gnu/libc.so.6', + '3a15d66867d83762c7f2f1e37359cb8f6c5743edb369c65285cb0b1c4f7498bf', + 2129424), + ('/usr/lib/x86_64-linux-gnu/libcrypto.so.3', + '6866ed711dab8927e1bf82bf1cd30e828bdfc34f3cc1e83b1c9eb01ce6c37d9a', + 5309400), + ('/usr/lib/x86_64-linux-gnu/libexpat.so.1.9.1', + '286682ecbc5e59a638963b1a4e6351e65eb32fcf4bdcb9cb7569b6a61fe06a8d', + 186624), + ('/usr/lib/x86_64-linux-gnu/libm.so.6', + 'fce00b6f25f459cf4ae0b7fae4257909a1a8a86f9149e7c029a5d617baf1ccd0', + 952616), + ('/usr/lib/x86_64-linux-gnu/libz.so.1.3', + 'f61677c7bdb7c2aa2a243ea781bfd16afcb361cede7b4ef76127a9d8eb9a5242', + 113000)) +NATIVE_TCB_EXPECTED_HASHLIB_ORIGIN = '/usr/lib/python3.12/lib-dynload/_hashlib.cpython-312-x86_64-linux-gnu.so' + + +def _initial_native_tcb(): + root, api = _CAPTURED_BOOTSTRAP_ROOT, _CAPTURED_BOOTSTRAP_API + if (type(EXPECTED_BOOTSTRAP_ROOT_SHA256) is not str or + _INITIAL_ROOT_IDENTITY != EXPECTED_BOOTSTRAP_ROOT_SHA256 or + type(NATIVE_TCB_HELPER_SHA256) is not str or len(NATIVE_TCB_HELPER_SHA256) != 64 or + type(NATIVE_TCB_EXPECTED_FILES) is not tuple or + type(NATIVE_TCB_EXPECTED_HASHLIB_ORIGIN) is not str): + raise RuntimeError('Initial native TCB source and expected dependency tuple are not configured') + helper_path = __file__.rsplit('/', 2)[0] + '/areas/cache-validity/probe-native/native_tcb_v1.py' + api[0]() + digest, _, source = root._hash_regular(helper_path, 262144, True) + if digest != NATIVE_TCB_HELPER_SHA256: + raise RuntimeError('Initial native TCB helper source differs') + helper = root.ModuleType('_h25_initial_native_tcb') + namespace = helper.__dict__ + namespace.update({'__file__': helper_path, '__builtins__': root.builtins.__dict__}) + api[0]() + code = root._COMPILE(source, helper_path, 'exec', dont_inherit=True, optimize=root._OPTIMIZE) + api[0]() + root._EXEC(code, namespace) + api[0]() + receipt = namespace['verify_native_tcb'](root, api, NATIVE_TCB_EXPECTED_FILES, + NATIVE_TCB_EXPECTED_HASHLIB_ORIGIN) + if type(NATIVE_TCB_CONTROLS_SHA256) is not str or len(NATIVE_TCB_CONTROLS_SHA256) != 64: + raise RuntimeError('Initial native TCB control source pin is not configured') + control_path = __file__.rsplit('/', 2)[0] + '/areas/cache-validity/probe-native/native_tcb_controls_v1.py' + api[0]() + digest, _, control_source = root._hash_regular(control_path, 262144, True) + if digest != NATIVE_TCB_CONTROLS_SHA256: + raise RuntimeError('Initial native TCB controls source differs') + control_namespace = {'__name__': '_h25_initial_native_tcb_controls', '__file__': control_path, + '__builtins__': root.builtins.__dict__} + api[0]() + control_code = root._COMPILE(control_source, control_path, 'exec', dont_inherit=True, optimize=root._OPTIMIZE) + api[0]() + root._EXEC(control_code, control_namespace) + argv = root.sys.argv + if (type(argv) is not list or any(type(arg) is not str for arg in argv) or + argv.count('--output') != 1 or argv.index('--output') + 1 >= len(argv)): + raise RuntimeError('Early TCB controls require the unique parent --output argument') + output = argv[argv.index('--output') + 1] + stage_root = __file__.rsplit('/', 2)[0] + if (not output.startswith('/') or output.endswith('/') or + any(part in ('', '.', '..') for part in output.split('/')[1:]) or + output == stage_root or output.startswith(stage_root + '/')): + raise RuntimeError('Early TCB controls require a canonical absolute output outside the stage') + # Parent owns an existing nonsymlink output parent. mkdir is exclusive: + # a preexisting output, file, or symlink is rejected before any fixture write. + api[0]() + root.posix.mkdir(output, 0o700) + control_directory = output + '/initial-tcb-controls' + root.posix.mkdir(control_directory, 0o700) + api[0]() + controls = control_namespace['run_controls']( + helper, root, api, NATIVE_TCB_EXPECTED_FILES, NATIVE_TCB_EXPECTED_HASHLIB_ORIGIN, control_directory) + if (controls.get('schema') != 'h25-native-tcb-controls-v1' or + controls.get('expected_records') != 5 or len(controls.get('records', [])) != 5 or + controls.get('scientific_calls') != 0 or controls.get('probe_native_imports') != 0): + raise RuntimeError('Initial native TCB control census differs') + controls['status'] = 'NATIVE_INITIAL_TCB_CONTROLS_PASS' + return receipt, controls, output + + +# Child outer wall/CPU/RSS includes this entire initial trust check. +# It assumes the declared trusted OS/native startup; it does not prove itself. +INITIAL_NATIVE_TCB_RECEIPT, INITIAL_NATIVE_TCB_CONTROLS, _INITIAL_OUTPUT = _initial_native_tcb() + +# This independent bootstrap support captures the initial system-stdlib +# continuity boundary before any adapter or scientific module is exposed. +# No late candidate-created snapshot is accepted as initial authentication. +COLD_AUTHORITY_SHA256 = '3079a096df1072a83056f3f8a8cbf9e766fdddb488e36dddb36544c7929f988a' + + +def _initial_cold_authority(): + root, cap, api = (_CAPTURED_BOOTSTRAP_ROOT, _CAPTURED_BOOTSTRAP_CAPABILITY, + _CAPTURED_BOOTSTRAP_API) + if type(COLD_AUTHORITY_SHA256) is not str or len(COLD_AUTHORITY_SHA256) != 64: + raise RuntimeError('Initial cold authority source pin is not configured') + source_path = __file__.rsplit('/', 2)[0] + '/areas/cache-validity/cold_authority_v7.py' + api[0]() + digest, _, source = root._hash_regular(source_path, 1048576, True) + if digest != COLD_AUTHORITY_SHA256: + raise RuntimeError('Initial cold authority source differs') + module = root.ModuleType('_h25_initial_cold_authority') + namespace = module.__dict__ + namespace.update({'__file__': source_path, '__builtins__': root.builtins.__dict__}) + api[0]() + code = root._COMPILE(source, source_path, 'exec', dont_inherit=True, optimize=root._OPTIMIZE) + api[0]() + root._EXEC(code, namespace) + # The actual source bytes have just executed under the admitted initial + # interpreter/system-stdlib premise. Capture precedes every candidate import. + api[0]() + bundle = namespace['capture_epoch_authority'](root, cap, api); authority = bundle[1] + if (type(authority) is not tuple or len(authority) != 7 or + any(type(entry) is not root.FunctionType for entry in authority)): + raise RuntimeError('Initial cold authority must expose the sealed seven-entry tuple') + # Read fresh transport exactly once, before any candidate exposure. + transport = root.FunctionType.__dict__['__dict__'].__get__(authority[0], root.FunctionType) + descriptor = transport['_h25_caller_descriptor'] + if type(descriptor) is not tuple or len(descriptor) != 6 or descriptor[1] is not authority: + raise RuntimeError('Initial cold authority caller descriptor differs') + return authority, descriptor, bundle + + +import importlib +import typing +_INITIAL_COLD_AUTHORITY, _INITIAL_COLD_CALLER_DESCRIPTOR, _INITIAL_EPOCH_BUNDLE = _initial_cold_authority() + +import time +START_WALL = time.perf_counter() +import argparse +from contextlib import redirect_stdout +from fractions import Fraction +import hashlib +import io +import json +import os +from pathlib import Path +import resource +import runpy +import shutil +import stat +import sys + +sys.dont_write_bytecode = True +# Independent source pins are literal final-stage configuration. These modules +# are admitted by the pre-exposure authority, including their live helper code. +# Driver/source identity does not depend on a hash of itself. +EARLY_INTEGRATION_SOURCE_PINS = ({'adapters': ('integration/adapters.py', 'f7ca7f4f03ac63c1a95ba42f06149543211566de5e29f487a3dc4d08c5ee9b94'), 'cold_build_evidence': ('integration/cold_build_evidence.py', 'aa0a315110e031e19291970c9611fe5e0f91465fa20eaec51e81186099563f78'), 'native_packet': ('integration/native_packet.py', '6adbcd1dfeb77fb6da7ee8f725796b1bfdbf0a4f397ef23f3a266a6b89d55892'), 'data_adapters': ('integration/data_adapters.py', '18679fd1eb6ae99c4b375756511427c26718f77674c2d8fcc490e25ceb47cba5'), 'guarded_adapters_v4': ('integration/guarded_adapters_v4.py', '5579fe0838d8c6acf63834990269479c6c32024a1662846ed0a075c25d13954c'), '_h25_data_cache': ('areas/cache-validity/cache_contract_v8.py', '20a8a94e96bfa6213d4f04244dabecf059b4c8c7e8ffa7e9409a8b87cfeef494')} + + + + + + +) +_INITIAL_INTEGRATION_MODULES = {} +_INITIAL_INTEGRATION_HANDLES = {} +for _entry_name, (_entry_relative, _entry_digest) in EARLY_INTEGRATION_SOURCE_PINS.items(): + if type(_entry_digest) is not str or len(_entry_digest) != 64: + raise RuntimeError('Early integration source pin is not configured: ' + _entry_name) + # BEGIN evaluated dispatch arguments scientific_driver:195 + _ca_args = (__file__.rsplit('/', 2)[0] + '/' + _entry_relative, _entry_digest, _entry_name) + _ca_kwargs = {} + # END evaluated dispatch arguments scientific_driver:195 + # BEGIN caller admission scientific_driver:195 + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission scientific_driver:195 + _entry_module, _entry_handle = _ca_dispatch(0, *_ca_args, **_ca_kwargs) + if type(_entry_module) is not _CAPTURED_BOOTSTRAP_ROOT.ModuleType or sys.modules.get(_entry_name) is not _entry_module: + raise RuntimeError('Early integration module registry identity differs: ' + _entry_name) + _INITIAL_INTEGRATION_MODULES[_entry_name] = _entry_module + _INITIAL_INTEGRATION_HANDLES[_entry_name] = _entry_handle +adapters = _INITIAL_INTEGRATION_MODULES['adapters'] +native_packet = _INITIAL_INTEGRATION_MODULES['native_packet'] +data_adapters = _INITIAL_INTEGRATION_MODULES['data_adapters'] +guarded_adapters_v4 = _INITIAL_INTEGRATION_MODULES['guarded_adapters_v4'] +_EXECUTION = {'output': Path(_INITIAL_OUTPUT), 'state': None, 'packet': None} +ROUND = Path(__file__).resolve().parent.parent +HERE = ROUND / "baseline" +REFERENCE_DRIVER_SHA = "0d976d2eb6b845f20d4a3396591a806f966688b88693cd6a5f8a0c9e48925e36" +BASE = "19fdb086ea96af9a9f87936a2b888e10af4ed810" +UPSTREAM = "adc7f1241b42e322a6451854ab7e4b4c146bf78a" +PIN_SHA = "88bba3caf5975f30fa7abceaea9454110cf3b069233e8241a2ca13d1dff171a7" +REFERENCE_SHA = "1f763d95c7ff163aa71d13cd82784f16665be8afb21f75e76941e2119562098f" +ENGINE_PINS = { + "native_gf2.c": "e9c3c9194a08718bd1575c1cf08c6c6772d3b644c2e274c25a84a1f9249d06cc", + "native_backend.py": "e473c38245c3668715b5a78dfe980b2fe3ed0d0c9b8c97c666fbae6ecf1fffd5", + "finite_controls.py": "df989a831aac43cc1af95169dad8c64a7548760e6e1f96976da996703f2c8f7a", + "compare_side_verifier.py": "6e507bb0c7e00d090a60289fddb6c55e90c946d0850c42c3c5e3e15c27604a68", + "profile_side_verifier.py": "9c994378171c20a91539418d93cb8387e1daa93465d6862beefea90e12999c2a", + "source/complex_circuit.py": "d623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1", + "source/complex_network.py": "0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b", +} +COMPLEMENT_EXPECTED = { + "calls": 238685, + "canonical_stream_bytes": 55839507, + "sha256": "7dec2bf33303c37e1c699609e83768d61df7e19104d34a26a148f66d5ccc4838", + "schema": "v2-jsonl:call,us,vs,result(type=list+values or type=None); ordered exact integer vectors", +} +EXPECTED_STDOUT = ( + "PASS conditional 59/100000000000 > 2^-31; minimum margin 14779261/25000000000000000\n" + "Side roles per invocation 108195 vs original 3693800\n" +) + + +def need(condition, message): + if not condition: + raise RuntimeError(message) + + +def sha(data): + return hashlib.sha256(data).hexdigest() + + +def canonical(value): + return json.dumps(value, sort_keys=True, separators=(",", ":"), ensure_ascii=True).encode("ascii") + + +def cpu(): + own = resource.getrusage(resource.RUSAGE_SELF) + children = resource.getrusage(resource.RUSAGE_CHILDREN) + return own.ru_utime + own.ru_stime + children.ru_utime + children.ru_stime + + +def inventory(root, pins, *, exact=True): + need(root.is_dir() and not root.is_symlink(), "Missing or symlinked input root") + files = {} + for path in sorted(root.rglob("*")): + need(not path.is_symlink(), "Symlink in frozen inputs: " + str(path)) + if path.is_file(): + relative = str(path.relative_to(root)) + if relative not in pins: + need(not exact, "Undeclared frozen input: " + relative) + continue + raw = path.read_bytes() + expected = pins[relative][0] if type(pins[relative]) is list else pins[relative] + need(sha(raw) == expected, "Frozen input digest changed: " + relative) + files[relative] = {"sha256": sha(raw), "mode": stat.S_IMODE(path.stat().st_mode), "bytes": len(raw)} + need(set(files) == set(pins), "Frozen input inventory incomplete") + return files + +# Preserve the literal baseline function; main selects a local arm function. +original_inventory = inventory + +def candidate_inventory(root, pins, *, exact=True): + need(root.is_dir() and not root.is_symlink(), "Missing or symlinked input root") + files = {} + for path in sorted(root.rglob("*")): + need(not path.is_symlink(), "Symlink in frozen inputs: " + str(path)) + if path.is_file(): + relative = str(path.relative_to(root)) + if relative not in pins: + need(not exact, "Undeclared frozen input: " + relative) + continue + raw = path.read_bytes() + expected = pins[relative][0] if type(pins[relative]) is list else pins[relative] + raw_digest = sha(raw) + need(raw_digest == expected, "Frozen input digest changed: " + relative) + files[relative] = {"sha256": raw_digest, "mode": stat.S_IMODE(path.stat().st_mode), "bytes": len(raw)} + need(set(files) == set(pins), "Frozen input inventory incomplete") + return files + + +def typed(value): + """Lossless full return representation, including order and exact types.""" + kind = type(value) + if kind is Fraction: + return ["Fraction", value.numerator, value.denominator] + if value is None: + return ["None"] + if kind is bool: + return ["bool", value] + if kind is int: + return ["int", str(value)] + if kind is float: + return ["float", value.hex()] + if kind is str: + return ["str", value] + if kind is list or kind is tuple: + return [kind.__name__, [typed(item) for item in value]] + if kind is dict: + return ["dict", [[typed(key), typed(item)] for key, item in value.items()]] + raise TypeError("Unsupported exact full-certificate return type: " + kind.__name__) + + +class Phases: + """Broad phase observations; no per-arithmetic resource sampling. + + Every call retains the old timing fields. Memory samples are paid by both + arms, including nested side_construction so snapshots/retirement are visible. + """ + def __init__(self): + self.rows = {} + + @staticmethod + def memory(): + with open("/proc/self/status", "rb") as stream: + raw = stream.read(65537) + need(len(raw) <= 65536, "Process status diagnostic exceeded its bound") + current = None + for line in raw.splitlines(): + if line.startswith(b"VmRSS:"): + fields = line.split() + need(len(fields) == 3 and fields[2] == b"kB", "Unexpected process RSS diagnostic units") + current = int(fields[1]) * 1024 + break + need(current is not None, "Current process RSS diagnostic unavailable") + highwater = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss * 1024 + return {"current_vmrss_bytes": current, "process_ru_maxrss_bytes": highwater} + + def call(self, name, function, *args, **kwargs): + wall, used = time.perf_counter(), cpu() + memory_before = self.memory() + primary_failure = False + try: + return _g12_after_phase(self, name, function, args, kwargs, function(*args, **kwargs)) + except BaseException: + primary_failure = True + raise + finally: + memory_after, memory_error = None, None + try: + memory_after = self.memory() + except BaseException as error: + # Do not replace an original failure with diagnostic failure. + memory_error = {"type": type(error).__name__} + if not primary_failure: + raise + row = self.rows.setdefault(name, {"calls": 0, "wall_seconds": 0.0, + "cpu_seconds_with_children": 0.0, + "memory_samples": [], + "memory_semantics": "VmRSS is current resident bytes; ru_maxrss is process high-water bytes; neither is an additive phase peak"}) + row["calls"] += 1 + row["memory_samples"].append({"before": memory_before, "after": memory_after, + "diagnostic_error": memory_error}) + row["wall_seconds"] += time.perf_counter() - wall + row["cpu_seconds_with_children"] += cpu() - used + + def wrap(self, owner, attribute, name): + original = getattr(owner, attribute) + def observed(*args, **kwargs): + return self.call(name, original, *args, **kwargs) + setattr(owner, attribute, observed) + return original, observed + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--frozen-root", type=Path, default=HERE / "frozen") + parser.add_argument("--reference", type=Path, default=HERE / "reference/certificates/complex-network.json") + parser.add_argument("--lanes", choices=("baseline", "candidate"), required=True) + parser.add_argument("--finite-only", action="store_true") + parser.add_argument("--output", type=Path, required=True, help="New external directory; every write stays below it") + parser.add_argument("--anchor", type=Path, default=HERE / "anchor.json") + args = parser.parse_args() + args.data_lanes = args.lanes + args.lanes = "all" # Both comparison arms retain the complete original native/bookkeeping baseline. + if args.data_lanes == "transport": + need(args.frozen_root == HERE / "frozen" and + args.reference == HERE / "reference/certificates/complex-network.json" and + args.anchor == HERE / "anchor.json", "Transport uses only the original fixed historical inputs") + data_adapters.transport(ROUND, HERE, args.output) + return + inventory = candidate_inventory if args.data_lanes == "candidate" else original_inventory + args.mode = "candidate" # Every new arm starts from the original native C configuration. + need(args.finite_only or sys.flags.optimize == 0, "Every full-caller mode requires original assertions") + need(sys.implementation.name == "cpython" and sys.version_info[:2] == (3, 12), "Frozen CPython 3.12 required") + data_adapters.require_execution_contract(args.data_lanes, args.finite_only) + need((args.mode == "profile") == (args.anchor is None), "Profile creates the anchor; both benchmark arms require --anchor") + frozen, reference = args.frozen_root.resolve(), args.reference.resolve() + output = args.output.resolve() + need(str(output) == _INITIAL_OUTPUT and output.is_dir() and not output.is_symlink() and + {path.name for path in output.iterdir()} == {'initial-tcb-controls'} and + (output / 'initial-tcb-controls').is_dir() and + not (output / 'initial-tcb-controls').is_symlink() and + not list((output / 'initial-tcb-controls').iterdir()), + "Early TCB output ownership or fresh control directory changed") + need(not output.is_relative_to(HERE) and not output.is_relative_to(frozen), "Output must be outside immutable sources") + need(reference.is_file() and not reference.is_symlink(), "Reference certificate missing or symlinked") + source_pin_bytes = (HERE / "SOURCE-PINS.json").read_bytes() + need(sha(source_pin_bytes) == PIN_SHA, "Source inventory pin changed") + pins = json.loads(source_pin_bytes) + need(len(pins) == 32, "Frozen closure must contain twelve scripts, manifest and nineteen payloads") + reference_bytes = reference.read_bytes() + need(sha(reference_bytes) == REFERENCE_SHA, "Original full certificate reference changed") + driver_before = Path(__file__).read_bytes() + new_custody_before = adapters.custody(ROUND, args.lanes) + data_custody_before = data_adapters.custody(ROUND) + reference_driver_before = (HERE / "full_driver.py").read_bytes() + need(sha(reference_driver_before) == REFERENCE_DRIVER_SHA, "Reference driver pin changed") + anchor_bytes = None if args.anchor is None else args.anchor.read_bytes() + expected_anchor = None if anchor_bytes is None else json.loads(anchor_bytes) + if expected_anchor is not None: + need(expected_anchor.get("schema") == "gf2-full-network-anchor-v1" and + expected_anchor.get("base_commit") == BASE and expected_anchor.get("source_pin_sha256") == PIN_SHA and + expected_anchor.get("driver_sha256") == REFERENCE_DRIVER_SHA and + expected_anchor.get("engine_pins") == ENGINE_PINS, + "Anchor source/driver/engine identity differs; no benchmark permitted") + _EXECUTION['output'] = output + compiler_tmp = output / "compiler-tmp" + compiler_tmp.mkdir() + os.environ["TMPDIR"] = str(compiler_tmp) + phases = Phases() + (output / 'initial-native-tcb.json').write_bytes(canonical(INITIAL_NATIVE_TCB_RECEIPT) + b'\n') + (output / 'initial-tcb-controls' / 'receipt.json').write_bytes(canonical(INITIAL_NATIVE_TCB_CONTROLS) + b'\n') + frozen_before = phases.call("input_custody", inventory, frozen, pins) + engine_before = phases.call("engine_custody", inventory, HERE / "engine", ENGINE_PINS) + manifest = json.loads((frozen / "upstream/manifest.json").read_bytes()) + need(manifest["commit"] == UPSTREAM and len(manifest["files"]) == 19, "Wrong pinned upstream manifest") + need({"upstream/" + name for name in manifest["files"]} == + {name for name in pins if name.startswith("upstream/") and name != "upstream/manifest.json"}, + "Source verifier payload closure changed") + for name, info in manifest["files"].items(): + need(info["sha256"] == pins["upstream/" + name][0], "Manifest payload hash differs from independent frozen pin") + + runtime, engine = output / "runtime-root", output / "engine" + phases.call("fresh_root_copy", shutil.copytree, frozen, runtime) + phases.call("fresh_engine_copy", shutil.copytree, HERE / "engine", engine) + # copytree retains readonly source directory permissions. Only this new + # private root is made writable for the original CLI certificate output. + runtime.chmod(0o755) + (runtime / "certificates").mkdir() + runtime_before = inventory(runtime, pins) + copied_engine_before = inventory(engine, ENGINE_PINS) + need(runtime_before == frozen_before and copied_engine_before == engine_before, "Copy changed input bytes or modes") + for name in ("complex_network.py", "complex_circuit.py"): + need((engine / "source" / name).read_bytes() == (runtime / "scripts" / name).read_bytes(), + "PR5929 engine/source differs from the full caller closure") + script_names = {Path(name).stem for name in pins if name.startswith("scripts/")} + engine_names = {"native_backend", "finite_controls", "compare_side_verifier", "profile_side_verifier"} + need(not (script_names | engine_names) & set(sys.modules), "Scientific module already loaded; fresh process required") + sys.path[:0] = [str(engine), str(runtime / "scripts")] + # BEGIN evaluated dispatch arguments scientific_driver:462 + _ca_args = (str(engine / 'native_backend.py'), ENGINE_PINS['native_backend.py'], 'native_backend') + _ca_kwargs = {'kind': 'backend'} + # END evaluated dispatch arguments scientific_driver:462 + # BEGIN caller admission scientific_driver:462 + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission scientific_driver:462 + backend, backend_handle = phases.call('cold_engine_import', _ca_dispatch, 0, *_ca_args, **_ca_kwargs) + # BEGIN evaluated dispatch arguments scientific_driver:465 + _ca_args = (_INITIAL_INTEGRATION_HANDLES['_h25_data_cache'], 'capture_backend_factory_environment', backend) + _ca_kwargs = {'cold_authority': _INITIAL_COLD_AUTHORITY, 'cold_caller_descriptor': _INITIAL_COLD_CALLER_DESCRIPTOR, 'backend_handle': backend_handle, 'cache_handle': _INITIAL_INTEGRATION_HANDLES['_h25_data_cache'], 'bootstrap_root': _CAPTURED_BOOTSTRAP_ROOT, 'bootstrap_capability': _CAPTURED_BOOTSTRAP_CAPABILITY, 'bootstrap_api': _CAPTURED_BOOTSTRAP_API} + # END evaluated dispatch arguments scientific_driver:465 + # BEGIN caller admission scientific_driver:465 + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission scientific_driver:465 + factory_environment = phases.call('cold_backend_factory_environment', _ca_dispatch, 1, *_ca_args, **_ca_kwargs) + comparison = importlib.import_module("compare_side_verifier") + native = None + finite = None + build = None + if args.mode == "candidate": + packet = phases.call("cold_native_metadata_build", native_packet.prepare, + ROUND, output, data_custody_before, _CAPTURED_BOOTSTRAP_ROOT, + _CAPTURED_BOOTSTRAP_CAPABILITY, _CAPTURED_BOOTSTRAP_API) + _EXECUTION['packet'] = packet + packet['controls']['native_initial_tcb'] = INITIAL_NATIVE_TCB_CONTROLS + native, build = phases.call("cold_compile_link_load", backend.build_native, output / "cold-build") + # BEGIN evaluated dispatch arguments scientific_driver:484 + _ca_args = (_INITIAL_INTEGRATION_HANDLES['guarded_adapters_v4'], 'prepare', ROUND, backend, backend_handle, native, output, args.lanes, phases, _INITIAL_COLD_AUTHORITY, _INITIAL_INTEGRATION_HANDLES['adapters'], new_custody_before) + _ca_kwargs = {'cold_caller_descriptor': _INITIAL_COLD_CALLER_DESCRIPTOR} + # END evaluated dispatch arguments scientific_driver:484 + # BEGIN caller admission scientific_driver:484 + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission scientific_driver:484 + extensions = phases.call('new_adapter_preparation', _ca_dispatch, 1, *_ca_args, **_ca_kwargs) + phases.call("all_native_metadata_and_preload_controls", native_packet.run_controls, packet, phases) + finite = phases.call("all_native_finite_independent_controls", importlib.import_module("finite_controls").run_controls, native) + phases.call("all_new_controls", adapters.run_controls, extensions, backend, native, phases) + # BEGIN evaluated dispatch arguments scientific_driver:492 + _ca_args = (_INITIAL_INTEGRATION_HANDLES['data_adapters'], 'prepare', ROUND, backend, comparison, extensions, args.data_lanes, data_custody_before, packet) + _ca_kwargs = {'authority': _INITIAL_COLD_AUTHORITY, 'cold_caller_descriptor': _INITIAL_COLD_CALLER_DESCRIPTOR, 'integration_handles': _INITIAL_INTEGRATION_HANDLES, 'backend_handle': backend_handle, 'adapters_handle': _INITIAL_INTEGRATION_HANDLES['adapters'], 'setup_handle': _INITIAL_INTEGRATION_HANDLES['guarded_adapters_v4'], 'factory_environment': factory_environment, 'preloaded_cache': (_INITIAL_INTEGRATION_MODULES['_h25_data_cache'], _INITIAL_INTEGRATION_HANDLES['_h25_data_cache'])} + # END evaluated dispatch arguments scientific_driver:492 + # BEGIN caller admission scientific_driver:492 + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission scientific_driver:492 + data_state = phases.call('data_adapter_preparation', _ca_dispatch, 1, *_ca_args, **_ca_kwargs) + _EXECUTION['state'] = data_state + phases.call("all_data_controls", data_adapters.run_controls, + data_state, native, output, phases, HERE / "full_driver.py", candidate_inventory, extensions) + (output / "finite-controls.json").write_bytes(canonical(finite) + b"\n") + + if args.finite_only: + phases.call('terminal_native_cleanup_and_checks', data_adapters.finish_before_late, data_state) + # LAST native/scientific call. Everything below is source or receipt work. + phases.call('bootstrap_late_last', data_adapters.finish_late_last, data_state) + need(inventory(frozen, pins) == frozen_before and inventory(HERE / "engine", ENGINE_PINS) == engine_before, "Finite immutable source custody changed") + need(inventory(runtime, pins) == runtime_before and inventory(engine, ENGINE_PINS) == copied_engine_before, "Finite copied source custody changed") + need(adapters.custody(ROUND, args.lanes) == new_custody_before, "Finite new source custody changed") + need(data_adapters.custody(ROUND) == data_custody_before, "Finite data source custody changed") + result = {"status": "H25_DATA_HANDLING_FINITE_PASS", "lanes": args.data_lanes, + "data_handling": data_adapters.finite_receipt(data_state), + "data_source_custody": data_custody_before, + "optimized": sys.flags.optimize, "original_controls": finite, + "new_controls": extensions["controls"], "new_source_custody": new_custody_before, + "driver_sha256": sha(driver_before), + "initial_native_tcb": INITIAL_NATIVE_TCB_RECEIPT, + "native_packet": native_packet.receipt(packet), + "reference_driver_sha256": REFERENCE_DRIVER_SHA, "phases": phases.rows} + (output / "receipt.json").write_text(json.dumps(result, indent=2, sort_keys=True) + "\n") + print(json.dumps(result, sort_keys=True)) + return + + circuit_module = phases.call("cold_complex_module_load", backend.load_source, "complex_circuit") + sys.modules["complex_circuit"] = circuit_module + rank_calls = [] + complement = extensions["trace_type"](circuit_module.Label) + phases.call("private_set_and_data_adapter_installation", data_adapters.install_circuit, + data_state, extensions, circuit_module, comparison) + side_writer = data_adapters.scientific_writer(data_state) + binding = None + captures = {} + phases.wrap(circuit_module.ComplexSideCircuit, "__init__", "side_construction") + phases.wrap(circuit_module.Checks, "__init__", "checks_initialization") + phases.wrap(circuit_module, "compile_roles", "compile_roles") + phases.wrap(circuit_module.Checks, "verify_map", "verify_map") + phases.wrap(circuit_module.Checks, "verify_labels", "verify_labels") + original_roles = circuit_module.verify_role_frames + def observe_roles(c, checks, code=None): + need("side" not in captures and code is not None, "Unexpected role-frame invocation") + result = phases.call("verify_role_frames", original_roles, c, checks, code) + captures["side"] = (c, checks, code, result) + return result + circuit_module.verify_role_frames = observe_roles + + certify = phases.call("cold_certify_import", importlib.import_module, "certify") + phases.wrap(certify, "verify_sources", "original_upstream_verify_sources") + prepare = phases.call("cold_prepare_import", importlib.import_module, "prepare_layers") + search = importlib.import_module("search_network") + phases.wrap(search, "log_integer_bounds", "full_log_integer_bounds") + original_serializable = prepare.serializable + depth = 0 + def observe_serializable(value): + nonlocal depth + outer = depth == 0 + if outer: + need("full_return" not in captures and type(value) is dict, "Unexpected outer serialization") + captures["full_return"] = value + depth += 1 + try: + # Recursion still delegates the original serializable exactly once + # per value; only the outer call is captured/timed. + if outer: + return phases.call("original_serializable", original_serializable, value) + return original_serializable(value) + finally: + depth -= 1 + prepare.serializable = observe_serializable + + # CS/Checks/phase/trace observers are final before either new guard captures them. + binding = phases.call("final_native_binding", data_adapters.bind_native, + data_state, backend, circuit_module, native, rank_calls, complement) + phases.call("construction_lease_sealing", data_adapters.seal, data_state) + phases.call("private_set_lease_sealing", adapters.seal, extensions) + caller = runtime / "scripts/complex_network.py" + old_argv = sys.argv + stdout = io.StringIO() + try: + phases.call("final_private_environment_and_arming", data_adapters.arm, data_state, extensions) + sys.argv = [str(caller)] + with redirect_stdout(stdout): + namespace = phases.call("complete_original_cli", runpy.run_path, str(caller), run_name="__main__") + finally: + sys.argv = old_argv + adapters.disarm(extensions) + cli_stdout = stdout.getvalue() + need(cli_stdout == EXPECTED_STDOUT, "Original CLI stdout changed") + certificate_bytes = (runtime / "certificates/complex-network.json").read_bytes() + need(certificate_bytes == reference_bytes, "Original CLI certificate bytes differ from the pinned reference") + need(sys.modules["complex_circuit"] is circuit_module and + namespace["ComplexSideCircuit"] is circuit_module.ComplexSideCircuit and + namespace["Checks"] is circuit_module.Checks and namespace["compile_roles"] is circuit_module.compile_roles and + namespace["verify_role_frames"] is observe_roles and namespace["serializable"] is observe_serializable, + "Caller used a different scientific module or observation binding") + need(captures.keys() == {"side", "full_return"}, "Missing exact caller observations") + c, checks, code, role_result = captures["side"] + full_return = captures["full_return"] + need(full_return["role_frames"] is role_result and full_return["upstream_commit"] == UPSTREAM, + "Role return or actual source verification boundary changed") + for name in ("side_construction", "checks_initialization", "compile_roles", "verify_map", "verify_labels", + "verify_role_frames", "original_upstream_verify_sources", "full_log_integer_bounds", + "original_serializable", "complete_original_cli"): + need(phases.rows.get(name, {}).get("calls") == 1, "Original phase was omitted or repeated: " + name) + imports = {} + for name in script_names - {"complex_network"}: + module = sys.modules.get(name) + expected_path = engine / "source/complex_circuit.py" if name == "complex_circuit" else runtime / "scripts" / (name + ".py") + need(module is not None and Path(module.__file__).resolve() == expected_path.resolve(), "Unpinned scientific import: " + name) + imports[name] = str(module.__file__) + if binding is not None: + binding["runtime_guard"].check() + need(binding["counters"] == {"complement_native": 238685, "complement_fallback": 0, + "gram_native": 59959, "gram_fallback": 0}, "Native full-call coverage changed") + + side_result = {key: full_return[key] for key in ("circuit", "side_map", "labels", "role_frames")} + witness = { + "support": c.support, "args": c.args, "kind": c.kind, "active": sorted(c.active), + "pieces": [(target, node, (coefficient.numerator, coefficient.denominator)) for target, node, coefficient in c.pieces], + "labels": [(key, list(label.basis.items()), label.dim, label.key) for key, label in checks.cache.items()], + "code": {"roles": code["roles"], "gates": code["gates"], "sources": list(code["sources"].items()), + "outputs": list(code["outputs"].items())}, + } + side_output = output / "side-observations" + side_output.mkdir() + side_receipt = phases.call("identical_lossless_side_serialization", side_writer, + side_output, side_result, witness, rank_calls) + complement_receipt = complement.receipt() + need(complement_receipt == COMPLEMENT_EXPECTED, "Every ordered complement observation must match PR5929") + full_typed_bytes = canonical(typed(full_return)) + (output / "full-return.lossless.json").write_bytes(full_typed_bytes) + (output / "original-stdout.txt").write_text(cli_stdout, encoding="utf-8") + (output / "complement-transcript.json").write_bytes(canonical(complement_receipt) + b"\n") + science = { + "full_cli_certificate_sha256": sha(certificate_bytes), "full_cli_stdout_sha256": sha(cli_stdout.encode("utf-8")), + "full_return_lossless_sha256": sha(full_typed_bytes), "side": side_receipt, + "ordered_complements": complement_receipt, "upstream_commit": UPSTREAM, + } + anchor = {"schema": "gf2-full-network-anchor-v1", "base_commit": BASE, "source_pin_sha256": PIN_SHA, + "driver_sha256": REFERENCE_DRIVER_SHA, "engine_pins": ENGINE_PINS, "science": science} + if expected_anchor is not None: + need(anchor == expected_anchor, "Complete certificate/types/ordered observations differ from frozen anchor") + else: + (output / "anchor.json").write_bytes(canonical(anchor) + b"\n") + need(inventory(frozen, pins) == frozen_before and inventory(HERE / "engine", ENGINE_PINS) == engine_before, + "Immutable source bytes/modes changed") + need(inventory(runtime, pins, exact=False) == runtime_before and inventory(engine, ENGINE_PINS) == copied_engine_before, + "Runtime scientific source bytes/modes changed") + runtime_files = {str(path.relative_to(runtime)) for path in runtime.rglob("*") if path.is_file()} + need(runtime_files == set(pins) | {"certificates/complex-network.json"}, "Unexpected full-caller file side effect") + need(Path(__file__).read_bytes() == driver_before and reference.read_bytes() == reference_bytes and + (anchor_bytes is None or args.anchor.read_bytes() == anchor_bytes), "Driver/reference/anchor changed during run") + need(adapters.custody(ROUND, args.lanes) == new_custody_before, "New source custody changed") + # Snapshot final scientific bookkeeping before the deliberately terminal late hook. + bookkeeping_receipt = adapters.receipt(extensions) + data_receipt = phases.call("data_finalization", data_adapters.finish, data_state, binding) + phases.call('terminal_native_cleanup_and_checks', data_adapters.finish_before_late, data_state) + # LAST native/scientific call. No owner, root API, provider, or native guard follows. + phases.call('bootstrap_late_last', data_adapters.finish_late_last, data_state) + # Honest source custody and receipt work continue after the terminal boundary. + need(data_adapters.custody(ROUND) == data_custody_before, "Data source custody changed") + need(adapters.custody(ROUND, args.lanes) == new_custody_before, "Post-late original source custody changed") + need(inventory(frozen, pins) == frozen_before and inventory(HERE / "engine", ENGINE_PINS) == engine_before, + "Post-late immutable source custody changed") + need(inventory(runtime, pins, exact=False) == runtime_before and inventory(engine, ENGINE_PINS) == copied_engine_before, + "Post-late copied source custody changed") + need(Path(__file__).read_bytes() == driver_before and reference.read_bytes() == reference_bytes and + (anchor_bytes is None or args.anchor.read_bytes() == anchor_bytes), "Post-late driver/reference/anchor changed") + receipt = { + "new_source_custody": new_custody_before, + "status": "FULL_NETWORK_PROFILE_ANCHOR_PASS" if args.mode == "profile" else "FULL_NETWORK_COMPLETE_PASS", + "mode": args.mode, "lanes": args.data_lanes, "bookkeeping": bookkeeping_receipt, + "data_handling": data_receipt, "data_source_custody": data_custody_before, + "reference_driver_sha256": REFERENCE_DRIVER_SHA, + "science": science, "base_commit": BASE, "native_predecessor_pr": 5995, + "driver_sha256": sha(driver_before), "source_pin_sha256": PIN_SHA, + "frozen_custody": frozen_before, "engine_custody": engine_before, "scientific_imports": imports, + "build": build, "finite_controls": finite, + "initial_native_tcb": INITIAL_NATIVE_TCB_RECEIPT, + "native_packet": native_packet.receipt(packet), + "private_root_permission": "runtime-root is0755; copied input file modes are retained and checked; immutable stages are never chmodded", + "compiler_tmpdir": str(compiler_tmp), + "native_calls": None if binding is None else dict(binding["counters"]), + "phases": phases.rows, "driver_wall_seconds_after_initial_tcb_before_receipt": time.perf_counter() - START_WALL, + "process_and_compiler_cpu_seconds_before_receipt": cpu(), + "environment": {"python": sys.version, "executable": sys.executable, "platform": sys.platform}, + "measurement": "Parent outer guard is authoritative and includes pristine root startup, initial native TCB authentication, early cold source authority capture and every factory dependency/product check, three cold metadata compilations plus original cold native/trace builds, every old and new control in BOTH arms, all candidate production admission/guards, IO and terminal cleanup. Baseline receives the complete same control union. Driver wall diagnostic starts after initial TCB and cold authority capture and is not total process wall. Broad phase samples are nested, not additive; VmRSS is current RSS and ru_maxrss is process high-water. Eager witnesses and original observations remain; full funding and equality gates are separate and currently closed.", + "scope": "Complete frozen historical complex-network CLI with retained observations; conditional certificate only. No bare-CLI factor, selected-frontier, new kappa or PR5864 speed claim.", + } + (output / "receipt.json").write_text(json.dumps(receipt, indent=2, sort_keys=True) + "\n") + sys.stdout.write(cli_stdout) + print(json.dumps({"status": receipt["status"], "mode": args.mode, "science": science, + "wall_seconds": receipt["driver_wall_seconds_after_initial_tcb_before_receipt"], + "cpu_seconds_with_compiler": receipt["process_and_compiler_cpu_seconds_before_receipt"], + "phases": phases.rows}, sort_keys=True)) + + +def _run_with_stop_evidence(): + try: + main() + except BaseException as primary_error: + # Nothing in cleanup or evidence assembly may replace this primary object. + try: + state = _EXECUTION['state'] + cleanup_errors = [] + try: + cleanup_errors = data_adapters.cleanup_owned(state) + except BaseException as cleanup_error: + cleanup_errors.append({'type': type(cleanup_error).__name__, 'message': str(cleanup_error)}) + stop = {'schema': 'h25-combined-v2-stop-v1', 'status': 'STOP', + 'primary_error': {'type': type(primary_error).__name__, 'message': str(primary_error)}, + 'primary_cause': None if primary_error.__cause__ is None else { + 'type': type(primary_error.__cause__).__name__, 'message': str(primary_error.__cause__)}, + 'cleanup_errors': cleanup_errors, + 'data': data_adapters.stop_diagnostics(state), + 'native_packet': None if _EXECUTION['packet'] is None else native_packet.receipt(_EXECUTION['packet']), + 'initial_native_tcb': INITIAL_NATIVE_TCB_RECEIPT} + output = _EXECUTION['output'] + if output is not None: + with (output / 'STOP.json').open('x', encoding='utf-8') as stream: + stream.write(json.dumps(stop, sort_keys=True, indent=2) + '\n') + except BaseException as evidence_error: + # Parent retains an independent process transcript even if this fails. + try: + sys.stderr.write('STOP evidence write failed: ' + type(evidence_error).__name__ + '\n') + except BaseException: + pass + raise + + + + +def _epoch_cli_boundary(phases, data_state, extensions, caller, stdout, invocation_token, old_argv): + _epoch_cli_primary = None + _epoch_cli_argv_error = None + _epoch_cli_disarm_error = None + _epoch_cli_retirement_error = None + _epoch_cli_record = None + try: + try: + _epoch_cli_record = {'primary': None, 'argv_error': None, 'disarm_error': None, 'retirement_error': None, 'outer_retirement_error': None, 'uncertain': False, 'argv_owner': old_argv, 'retirement_channel': {'started': False, 'error': None, 'journal_error': None, 'acknowledged': False}, 'outer_retirement_channel': {'started': False, 'error': None, 'journal_error': None, 'acknowledged': False}} + data_state['epoch_cli_cleanup'] = _epoch_cli_record + phases.call('final_private_environment_and_arming', data_adapters.arm, data_state, extensions) + if data_state['enabled']: + data_adapters.epoch_arm(data_state, invocation_token) + sys.argv = [str(caller)] + with redirect_stdout(stdout): + namespace = phases.call('complete_original_cli', runpy.run_path, str(caller), run_name='__main__') + return namespace + except BaseException as _epoch_cli_error: + _epoch_cli_primary = _epoch_cli_error + if _epoch_cli_record is not None: + _epoch_cli_record['primary'] = _epoch_cli_error + raise + finally: + try: + sys.argv = old_argv + except BaseException as _epoch_argv_error: + _epoch_cli_argv_error = _epoch_argv_error + if _epoch_cli_record is not None: + _epoch_cli_record['argv_error'] = _epoch_argv_error + _epoch_cli_record['uncertain'] = True + if _epoch_cli_primary is None: + _epoch_cli_primary = _epoch_argv_error + if _epoch_cli_record is not None: + _epoch_cli_record['primary'] = _epoch_argv_error + try: + adapters.disarm(extensions) + except BaseException as _epoch_disarm_error: + _epoch_cli_disarm_error = _epoch_disarm_error + if _epoch_cli_record is not None: + _epoch_cli_record['disarm_error'] = _epoch_disarm_error + _epoch_cli_record['uncertain'] = True + if _epoch_cli_primary is None: + _epoch_cli_primary = _epoch_disarm_error + if _epoch_cli_record is not None: + _epoch_cli_record['primary'] = _epoch_disarm_error + raise + if _epoch_cli_argv_error is not None: + raise _epoch_cli_primary + finally: + try: + data_adapters.epoch_retire(data_state, 'whole-cli-terminal', _epoch_cli_primary, _epoch_cli_disarm_error, _epoch_cli_argv_error, None if _epoch_cli_record is None else _epoch_cli_record['retirement_channel'], 'inner') + except BaseException as _epoch_retirement_error: + _epoch_cli_retirement_error = _epoch_retirement_error + if _epoch_cli_record is not None: + _epoch_cli_record['retirement_error'] = _epoch_retirement_error + _epoch_cli_record['uncertain'] = True + if _epoch_cli_primary is None: + _epoch_cli_primary = _epoch_retirement_error + if _epoch_cli_record is not None: + _epoch_cli_record['primary'] = _epoch_retirement_error + raise + +def main_epoch(): + _epoch_invocation = object() + _epoch_driver_origin = data_adapters.epoch_driver_entry(_INITIAL_COLD_AUTHORITY, _INITIAL_COLD_CALLER_DESCRIPTOR, _INITIAL_EPOCH_BUNDLE[3], main_epoch, Phases, _epoch_invocation) + data_state = None + _epoch_primary = None + _epoch_outer_retirement_error = None + _epoch_outer_cleanup = None + try: + _epoch_outer_cleanup = {'primary': None, 'retirement_error': None, 'uncertain': False, 'attempted': False} + _EXECUTION['epoch_outer_cleanup'] = _epoch_outer_cleanup + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--frozen-root', type=Path, default=HERE / 'frozen') + parser.add_argument('--reference', type=Path, default=HERE / 'reference/certificates/complex-network.json') + parser.add_argument('--lanes', choices=('baseline', 'candidate'), required=True) + parser.add_argument('--finite-only', action='store_true') + parser.add_argument('--output', type=Path, required=True, help='New external directory; every write stays below it') + parser.add_argument('--anchor', type=Path, default=HERE / 'anchor.json') + args = parser.parse_args() + args.data_lanes = args.lanes + args.lanes = 'all' + if args.data_lanes == 'transport': + need(args.frozen_root == HERE / 'frozen' and args.reference == HERE / 'reference/certificates/complex-network.json' and (args.anchor == HERE / 'anchor.json'), 'Transport uses only the original fixed historical inputs') + data_adapters.transport(ROUND, HERE, args.output) + return + inventory = candidate_inventory if args.data_lanes == 'candidate' else original_inventory + args.mode = 'candidate'; _g12_selected_args(args) + need(args.finite_only or sys.flags.optimize == 0, 'Every full-caller mode requires original assertions') + need(sys.implementation.name == 'cpython' and sys.version_info[:2] == (3, 12), 'Frozen CPython 3.12 required') + data_adapters.require_execution_contract(args.data_lanes, args.finite_only) + need((args.mode == 'profile') == (args.anchor is None), 'Profile creates the anchor; both benchmark arms require --anchor') + frozen, reference = (args.frozen_root.resolve(), args.reference.resolve()) + output = args.output.resolve() + need(str(output) == _INITIAL_OUTPUT and output.is_dir() and (not output.is_symlink()) and ({path.name for path in output.iterdir()} == {'initial-tcb-controls'}) and (output / 'initial-tcb-controls').is_dir() and (not (output / 'initial-tcb-controls').is_symlink()) and (not list((output / 'initial-tcb-controls').iterdir())), 'Early TCB output ownership or fresh control directory changed') + need(not output.is_relative_to(HERE) and (not output.is_relative_to(frozen)), 'Output must be outside immutable sources') + need(reference.is_file() and (not reference.is_symlink()), 'Reference certificate missing or symlinked') + source_pin_bytes = (HERE / 'SOURCE-PINS.json').read_bytes() + need(sha(source_pin_bytes) == PIN_SHA, 'Source inventory pin changed') + pins = json.loads(source_pin_bytes) + need(len(pins) == 32, 'Frozen closure must contain twelve scripts, manifest and nineteen payloads') + reference_bytes = reference.read_bytes() + need(sha(reference_bytes) == REFERENCE_SHA, 'Original full certificate reference changed') + driver_before = Path(__file__).read_bytes() + new_custody_before = adapters.custody(ROUND, args.lanes) + data_custody_before = data_adapters.custody(ROUND) + reference_driver_before = (HERE / 'full_driver.py').read_bytes() + need(sha(reference_driver_before) == REFERENCE_DRIVER_SHA, 'Reference driver pin changed') + anchor_bytes = None if args.anchor is None else args.anchor.read_bytes() + expected_anchor = None if anchor_bytes is None else json.loads(anchor_bytes) + if expected_anchor is not None: + need(expected_anchor.get('schema') == 'gf2-full-network-anchor-v1' and expected_anchor.get('base_commit') == BASE and (expected_anchor.get('source_pin_sha256') == PIN_SHA) and (expected_anchor.get('driver_sha256') == REFERENCE_DRIVER_SHA) and (expected_anchor.get('engine_pins') == ENGINE_PINS), 'Anchor source/driver/engine identity differs; no benchmark permitted') + _EXECUTION['output'] = output + compiler_tmp = output / 'compiler-tmp' + compiler_tmp.mkdir() + os.environ['TMPDIR'] = str(compiler_tmp) + phases = Phases() + (output / 'initial-native-tcb.json').write_bytes(canonical(INITIAL_NATIVE_TCB_RECEIPT) + b'\n') + (output / 'initial-tcb-controls' / 'receipt.json').write_bytes(canonical(INITIAL_NATIVE_TCB_CONTROLS) + b'\n') + frozen_before = phases.call('input_custody', inventory, frozen, pins) + engine_before = phases.call('engine_custody', inventory, HERE / 'engine', ENGINE_PINS) + manifest = json.loads((frozen / 'upstream/manifest.json').read_bytes()) + need(manifest['commit'] == UPSTREAM and len(manifest['files']) == 19, 'Wrong pinned upstream manifest') + need({'upstream/' + name for name in manifest['files']} == {name for name in pins if name.startswith('upstream/') and name != 'upstream/manifest.json'}, 'Source verifier payload closure changed') + for name, info in manifest['files'].items(): + need(info['sha256'] == pins['upstream/' + name][0], 'Manifest payload hash differs from independent frozen pin') + runtime, engine = (output / 'runtime-root', output / 'engine') + phases.call('fresh_root_copy', shutil.copytree, frozen, runtime) + phases.call('fresh_engine_copy', shutil.copytree, HERE / 'engine', engine) + runtime.chmod(493) + (runtime / 'certificates').mkdir() + runtime_before = inventory(runtime, pins) + copied_engine_before = inventory(engine, ENGINE_PINS) + need(runtime_before == frozen_before and copied_engine_before == engine_before, 'Copy changed input bytes or modes') + for name in ('complex_network.py', 'complex_circuit.py'): + need((engine / 'source' / name).read_bytes() == (runtime / 'scripts' / name).read_bytes(), 'PR5929 engine/source differs from the full caller closure') + script_names = {Path(name).stem for name in pins if name.startswith('scripts/')} + engine_names = {'native_backend', 'finite_controls', 'compare_side_verifier', 'profile_side_verifier'} + need(not (script_names | engine_names) & set(sys.modules), 'Scientific module already loaded; fresh process required') + sys.path[:0] = [str(engine), str(runtime / 'scripts')] + _ca_args = (str(engine / 'native_backend.py'), ENGINE_PINS['native_backend.py'], 'native_backend') + _ca_kwargs = {'kind': 'backend'} + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + backend, backend_handle = phases.call('cold_engine_import', _ca_dispatch, 0, *_ca_args, **_ca_kwargs) + _ca_args = (_INITIAL_INTEGRATION_HANDLES['_h25_data_cache'], 'capture_backend_factory_environment', backend) + _ca_kwargs = {'cold_authority': _INITIAL_COLD_AUTHORITY, 'cold_caller_descriptor': _INITIAL_COLD_CALLER_DESCRIPTOR, 'backend_handle': backend_handle, 'cache_handle': _INITIAL_INTEGRATION_HANDLES['_h25_data_cache'], 'bootstrap_root': _CAPTURED_BOOTSTRAP_ROOT, 'bootstrap_capability': _CAPTURED_BOOTSTRAP_CAPABILITY, 'bootstrap_api': _CAPTURED_BOOTSTRAP_API} + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + factory_environment = phases.call('cold_backend_factory_environment', _ca_dispatch, 1, *_ca_args, **_ca_kwargs) + comparison = importlib.import_module('compare_side_verifier') + native = None + finite = None + build = None + if args.mode == 'candidate': + packet = phases.call('cold_native_metadata_build', native_packet.prepare, ROUND, output, data_custody_before, _CAPTURED_BOOTSTRAP_ROOT, _CAPTURED_BOOTSTRAP_CAPABILITY, _CAPTURED_BOOTSTRAP_API) + _EXECUTION['packet'] = packet + packet['controls']['native_initial_tcb'] = INITIAL_NATIVE_TCB_CONTROLS + native, build = phases.call('cold_compile_link_load', backend.build_native, output / 'cold-build') + _ca_args = (_INITIAL_INTEGRATION_HANDLES['guarded_adapters_v4'], 'prepare', ROUND, backend, backend_handle, native, output, args.lanes, phases, _INITIAL_COLD_AUTHORITY, _INITIAL_INTEGRATION_HANDLES['adapters'], new_custody_before) + _ca_kwargs = {'cold_caller_descriptor': _INITIAL_COLD_CALLER_DESCRIPTOR} + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + extensions = phases.call('new_adapter_preparation', _ca_dispatch, 1, *_ca_args, **_ca_kwargs) + phases.call('all_native_metadata_and_preload_controls', native_packet.run_controls, packet, phases) + finite = phases.call('all_native_finite_independent_controls', importlib.import_module('finite_controls').run_controls, native) + phases.call('all_new_controls', adapters.run_controls, extensions, backend, native, phases) + _ca_args = (_INITIAL_INTEGRATION_HANDLES['data_adapters'], 'prepare', ROUND, backend, comparison, extensions, args.data_lanes, data_custody_before, packet) + _ca_kwargs = {'authority': _INITIAL_COLD_AUTHORITY, 'cold_caller_descriptor': _INITIAL_COLD_CALLER_DESCRIPTOR, 'integration_handles': _INITIAL_INTEGRATION_HANDLES, 'backend_handle': backend_handle, 'adapters_handle': _INITIAL_INTEGRATION_HANDLES['adapters'], 'setup_handle': _INITIAL_INTEGRATION_HANDLES['guarded_adapters_v4'], 'factory_environment': factory_environment, 'preloaded_cache': (_INITIAL_INTEGRATION_MODULES['_h25_data_cache'], _INITIAL_INTEGRATION_HANDLES['_h25_data_cache'])} + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + data_state = phases.call('data_adapter_preparation', _ca_dispatch, 1, *_ca_args, **_ca_kwargs) + _EXECUTION['state'] = data_state + phases.call('all_data_controls', data_adapters.run_controls, data_state, native, output, phases, HERE / 'full_driver.py', candidate_inventory, extensions) + (output / 'finite-controls.json').write_bytes(canonical(finite) + b'\n') + if args.finite_only: + phases.call('terminal_native_cleanup_and_checks', data_adapters.finish_before_late, data_state) + phases.call('bootstrap_late_last', data_adapters.finish_late_last, data_state) + need(inventory(frozen, pins) == frozen_before and inventory(HERE / 'engine', ENGINE_PINS) == engine_before, 'Finite immutable source custody changed') + need(inventory(runtime, pins) == runtime_before and inventory(engine, ENGINE_PINS) == copied_engine_before, 'Finite copied source custody changed') + need(adapters.custody(ROUND, args.lanes) == new_custody_before, 'Finite new source custody changed') + need(data_adapters.custody(ROUND) == data_custody_before, 'Finite data source custody changed') + result = {'status': 'H25_DATA_HANDLING_FINITE_PASS', 'lanes': args.data_lanes, 'data_handling': data_adapters.finite_receipt(data_state), 'data_source_custody': data_custody_before, 'optimized': sys.flags.optimize, 'original_controls': finite, 'new_controls': extensions['controls'], 'new_source_custody': new_custody_before, 'driver_sha256': sha(driver_before), 'initial_native_tcb': INITIAL_NATIVE_TCB_RECEIPT, 'native_packet': native_packet.receipt(packet), 'reference_driver_sha256': REFERENCE_DRIVER_SHA, 'phases': phases.rows} + (output / 'receipt.json').write_text(json.dumps(result, indent=2, sort_keys=True) + '\n') + print(json.dumps(result, sort_keys=True)) + return + if data_state['enabled']: + circuit_module, _epoch_load_ticket = phases.call('cold_complex_module_load', data_adapters.epoch_load, data_state, _INITIAL_EPOCH_BUNDLE[3]) + else: + circuit_module = phases.call('cold_complex_module_load', backend.load_source, 'complex_circuit') + sys.modules['complex_circuit'] = circuit_module + rank_calls = [] + complement = extensions['trace_type'](circuit_module.Label) + if data_state['enabled']: + _epoch_context = {'data_handle': _INITIAL_INTEGRATION_HANDLES['data_adapters'], 'data_module': data_adapters, 'phase_function': Phases.wrap, 'phase_class': Phases, 'phase_owner': phases, 'driver_function': main_epoch, 'driver_record': _epoch_driver_origin, 'invocation_token': _epoch_invocation, 'disposition_state': data_state} + phases.call('private_set_and_data_adapter_installation', data_adapters.install_epoch_circuit, data_state, extensions, circuit_module, comparison, _INITIAL_EPOCH_BUNDLE[3], _epoch_load_ticket, _epoch_context) + else: + phases.call('private_set_and_data_adapter_installation', data_adapters.install_circuit, data_state, extensions, circuit_module, comparison) + side_writer = data_adapters.scientific_writer(data_state) + binding = None + captures = {} + if data_state['enabled']: + data_adapters.epoch_phase_wrap(data_state, phases, 'circuit', circuit_module.ComplexSideCircuit, '__init__', 'side_construction') + else: + phases.wrap(circuit_module.ComplexSideCircuit, '__init__', 'side_construction') + if data_state['enabled']: + _g12_checks_pair = data_adapters.epoch_phase_wrap(data_state, phases, 'checks', circuit_module.Checks, '__init__', 'checks_initialization') + else: + phases.wrap(circuit_module.Checks, '__init__', 'checks_initialization') + if data_state['enabled']: + _g12_code_pair = data_adapters.epoch_phase_wrap(data_state, phases, 'module', circuit_module, 'compile_roles', 'compile_roles') + else: + phases.wrap(circuit_module, 'compile_roles', 'compile_roles') + if data_state['enabled']: + data_adapters.epoch_phase_wrap(data_state, phases, 'checks', circuit_module.Checks, 'verify_map', 'verify_map') + else: + phases.wrap(circuit_module.Checks, 'verify_map', 'verify_map') + if data_state['enabled']: + _g12_label_pair = data_adapters.epoch_phase_wrap(data_state, phases, 'checks', circuit_module.Checks, 'verify_labels', 'verify_labels') + else: + phases.wrap(circuit_module.Checks, 'verify_labels', 'verify_labels') + original_roles = circuit_module.verify_role_frames + + def observe_roles(c, checks, code=None): + need('side' not in captures and code is not None, 'Unexpected role-frame invocation') + result = phases.call('verify_role_frames', original_roles, c, checks, code) + captures['side'] = (c, checks, code, result) + return result + if data_state['enabled']: + data_adapters.epoch_role_observer(data_state, observe_roles) + else: + circuit_module.verify_role_frames = observe_roles + certify = phases.call('cold_certify_import', importlib.import_module, 'certify') + phases.wrap(certify, 'verify_sources', 'original_upstream_verify_sources') + prepare = phases.call('cold_prepare_import', importlib.import_module, 'prepare_layers') + search = importlib.import_module('search_network') + phases.wrap(search, 'log_integer_bounds', 'full_log_integer_bounds') + original_serializable = prepare.serializable + depth = 0 + + def observe_serializable(value): + nonlocal depth + outer = depth == 0 + if outer: + need('full_return' not in captures and type(value) is dict, 'Unexpected outer serialization') + captures['full_return'] = value + depth += 1 + try: + if outer: + return phases.call('original_serializable', original_serializable, value) + return original_serializable(value) + finally: + depth -= 1 + prepare.serializable = observe_serializable + binding = phases.call('final_native_binding', data_adapters.bind_epoch_native if data_state['enabled'] else data_adapters.bind_native, data_state, backend, circuit_module, native, rank_calls, complement) + phases.call('construction_lease_sealing', data_adapters.seal, data_state) + phases.call('private_set_lease_sealing', adapters.seal, extensions) + if data_state['enabled']: + data_adapters.epoch_seal(data_state) + caller = runtime / 'scripts/complex_network.py' + old_argv = sys.argv + stdout = io.StringIO(); _g12_bind_locals(data_state, extensions, circuit_module, binding, phases, _epoch_invocation, _g12_checks_pair, _g12_code_pair, _g12_label_pair, caller, rank_calls, complement, captures, stdout, frozen, runtime, engine, output, reference, reference_bytes, driver_before, pins, frozen_before, engine_before, runtime_before, copied_engine_before, script_names, new_custody_before, data_custody_before, args.anchor, anchor_bytes) + namespace = _epoch_cli_boundary(phases, data_state, extensions, caller, stdout, _epoch_invocation, old_argv) + cli_stdout = stdout.getvalue() + need(cli_stdout == EXPECTED_STDOUT, 'Original CLI stdout changed') + certificate_bytes = (runtime / 'certificates/complex-network.json').read_bytes() + need(certificate_bytes == reference_bytes, 'Original CLI certificate bytes differ from the pinned reference') + need(sys.modules['complex_circuit'] is circuit_module and namespace['ComplexSideCircuit'] is circuit_module.ComplexSideCircuit and (namespace['Checks'] is circuit_module.Checks) and (namespace['compile_roles'] is circuit_module.compile_roles) and (namespace['verify_role_frames'] is observe_roles) and (namespace['serializable'] is observe_serializable), 'Caller used a different scientific module or observation binding') + need(captures.keys() == {'side', 'full_return'}, 'Missing exact caller observations') + c, checks, code, role_result = captures['side'] + full_return = captures['full_return'] + need(full_return['role_frames'] is role_result and full_return['upstream_commit'] == UPSTREAM, 'Role return or actual source verification boundary changed') + for name in ('side_construction', 'checks_initialization', 'compile_roles', 'verify_map', 'verify_labels', 'verify_role_frames', 'original_upstream_verify_sources', 'full_log_integer_bounds', 'original_serializable', 'complete_original_cli'): + need(phases.rows.get(name, {}).get('calls') == 1, 'Original phase was omitted or repeated: ' + name) + imports = {} + for name in script_names - {'complex_network'}: + module = sys.modules.get(name) + expected_path = engine / 'source/complex_circuit.py' if name == 'complex_circuit' else runtime / 'scripts' / (name + '.py') + need(module is not None and Path(module.__file__).resolve() == expected_path.resolve(), 'Unpinned scientific import: ' + name) + imports[name] = str(module.__file__) + if binding is not None: + binding['runtime_guard'].check() + need(binding['counters'] == {'complement_native': 238685, 'complement_fallback': 0, 'gram_native': 59959, 'gram_fallback': 0}, 'Native full-call coverage changed') + side_result = {key: full_return[key] for key in ('circuit', 'side_map', 'labels', 'role_frames')} + witness = {'support': c.support, 'args': c.args, 'kind': c.kind, 'active': sorted(c.active), 'pieces': [(target, node, (coefficient.numerator, coefficient.denominator)) for target, node, coefficient in c.pieces], 'labels': [(key, list(label.basis.items()), label.dim, label.key) for key, label in checks.cache.items()], 'code': {'roles': code['roles'], 'gates': code['gates'], 'sources': list(code['sources'].items()), 'outputs': list(code['outputs'].items())}} + side_output = output / 'side-observations' + side_output.mkdir() + side_receipt = phases.call('identical_lossless_side_serialization', side_writer, side_output, side_result, witness, rank_calls) + complement_receipt = complement.receipt() + need(complement_receipt == COMPLEMENT_EXPECTED, 'Every ordered complement observation must match PR5929') + full_typed_bytes = canonical(typed(full_return)) + (output / 'full-return.lossless.json').write_bytes(full_typed_bytes) + (output / 'original-stdout.txt').write_text(cli_stdout, encoding='utf-8') + (output / 'complement-transcript.json').write_bytes(canonical(complement_receipt) + b'\n') + science = {'full_cli_certificate_sha256': sha(certificate_bytes), 'full_cli_stdout_sha256': sha(cli_stdout.encode('utf-8')), 'full_return_lossless_sha256': sha(full_typed_bytes), 'side': side_receipt, 'ordered_complements': complement_receipt, 'upstream_commit': UPSTREAM} + anchor = {'schema': 'gf2-full-network-anchor-v1', 'base_commit': BASE, 'source_pin_sha256': PIN_SHA, 'driver_sha256': REFERENCE_DRIVER_SHA, 'engine_pins': ENGINE_PINS, 'science': science} + if expected_anchor is not None: + need(anchor == expected_anchor, 'Complete certificate/types/ordered observations differ from frozen anchor') + else: + (output / 'anchor.json').write_bytes(canonical(anchor) + b'\n') + need(inventory(frozen, pins) == frozen_before and inventory(HERE / 'engine', ENGINE_PINS) == engine_before, 'Immutable source bytes/modes changed') + need(inventory(runtime, pins, exact=False) == runtime_before and inventory(engine, ENGINE_PINS) == copied_engine_before, 'Runtime scientific source bytes/modes changed') + runtime_files = {str(path.relative_to(runtime)) for path in runtime.rglob('*') if path.is_file()} + need(runtime_files == set(pins) | {'certificates/complex-network.json'}, 'Unexpected full-caller file side effect') + need(Path(__file__).read_bytes() == driver_before and reference.read_bytes() == reference_bytes and (anchor_bytes is None or args.anchor.read_bytes() == anchor_bytes), 'Driver/reference/anchor changed during run') + need(adapters.custody(ROUND, args.lanes) == new_custody_before, 'New source custody changed') + bookkeeping_receipt = adapters.receipt(extensions) + data_receipt = phases.call('data_finalization', data_adapters.finish, data_state, binding) + phases.call('terminal_native_cleanup_and_checks', data_adapters.finish_before_late, data_state) + phases.call('bootstrap_late_last', data_adapters.finish_late_last, data_state) + need(data_adapters.custody(ROUND) == data_custody_before, 'Data source custody changed') + need(adapters.custody(ROUND, args.lanes) == new_custody_before, 'Post-late original source custody changed') + need(inventory(frozen, pins) == frozen_before and inventory(HERE / 'engine', ENGINE_PINS) == engine_before, 'Post-late immutable source custody changed') + need(inventory(runtime, pins, exact=False) == runtime_before and inventory(engine, ENGINE_PINS) == copied_engine_before, 'Post-late copied source custody changed') + need(Path(__file__).read_bytes() == driver_before and reference.read_bytes() == reference_bytes and (anchor_bytes is None or args.anchor.read_bytes() == anchor_bytes), 'Post-late driver/reference/anchor changed') + receipt = {'new_source_custody': new_custody_before, 'status': 'FULL_NETWORK_PROFILE_ANCHOR_PASS' if args.mode == 'profile' else 'FULL_NETWORK_COMPLETE_PASS', 'mode': args.mode, 'lanes': args.data_lanes, 'bookkeeping': bookkeeping_receipt, 'data_handling': data_receipt, 'data_source_custody': data_custody_before, 'reference_driver_sha256': REFERENCE_DRIVER_SHA, 'science': science, 'base_commit': BASE, 'native_predecessor_pr': 5995, 'driver_sha256': sha(driver_before), 'source_pin_sha256': PIN_SHA, 'frozen_custody': frozen_before, 'engine_custody': engine_before, 'scientific_imports': imports, 'build': build, 'finite_controls': finite, 'initial_native_tcb': INITIAL_NATIVE_TCB_RECEIPT, 'native_packet': native_packet.receipt(packet), 'private_root_permission': 'runtime-root is0755; copied input file modes are retained and checked; immutable stages are never chmodded', 'compiler_tmpdir': str(compiler_tmp), 'native_calls': None if binding is None else dict(binding['counters']), 'phases': phases.rows, 'driver_wall_seconds_after_initial_tcb_before_receipt': time.perf_counter() - START_WALL, 'process_and_compiler_cpu_seconds_before_receipt': cpu(), 'environment': {'python': sys.version, 'executable': sys.executable, 'platform': sys.platform}, 'measurement': 'Parent outer guard is authoritative and includes pristine root startup, initial native TCB authentication, early cold source authority capture and every factory dependency/product check, three cold metadata compilations plus original cold native/trace builds, every old and new control in BOTH arms, all candidate production admission/guards, IO and terminal cleanup. Baseline receives the complete same control union. Driver wall diagnostic starts after initial TCB and cold authority capture and is not total process wall. Broad phase samples are nested, not additive; VmRSS is current RSS and ru_maxrss is process high-water. Eager witnesses and original observations remain; full funding and equality gates are separate and currently closed.', 'scope': 'Complete frozen historical complex-network CLI with retained observations; conditional certificate only. No bare-CLI factor, selected-frontier, new kappa or PR5864 speed claim.'} + (output / 'receipt.json').write_text(json.dumps(receipt, indent=2, sort_keys=True) + '\n') + sys.stdout.write(cli_stdout) + print(json.dumps({'status': receipt['status'], 'mode': args.mode, 'science': science, 'wall_seconds': receipt['driver_wall_seconds_after_initial_tcb_before_receipt'], 'cpu_seconds_with_compiler': receipt['process_and_compiler_cpu_seconds_before_receipt'], 'phases': phases.rows}, sort_keys=True)) + except BaseException as _epoch_error: + _epoch_primary = _epoch_error + if _epoch_outer_cleanup is not None: + _epoch_outer_cleanup['primary'] = _epoch_error + raise + finally: + try: + if _epoch_outer_cleanup is not None: + _epoch_outer_cleanup['attempted'] = True + data_adapters.epoch_retire(data_state, 'whole-cli-terminal', _epoch_primary, None, None, None, 'outer') + except BaseException as _epoch_outer_error: + _epoch_outer_retirement_error = _epoch_outer_error + if _epoch_outer_cleanup is not None: + _epoch_outer_cleanup['retirement_error'] = _epoch_outer_error + _epoch_outer_cleanup['uncertain'] = True + if _epoch_primary is None: + _epoch_primary = _epoch_outer_error + if _epoch_outer_cleanup is not None: + _epoch_outer_cleanup['primary'] = _epoch_outer_error + raise + +def _run_epoch_with_stop_evidence(): + try: + main_epoch() + except BaseException as primary_error: + try: + state = _EXECUTION['state'] + cleanup_errors = [] + try: + cleanup_errors = data_adapters.epoch_cleanup_owned(state) + except BaseException as cleanup_error: + cleanup_errors.append({'type': type(cleanup_error).__name__, 'message': str(cleanup_error)}) + stop = {'schema': 'h25-combined-v2-stop-v1', 'status': 'STOP', 'primary_error': {'type': type(primary_error).__name__, 'message': str(primary_error)}, 'primary_cause': None if primary_error.__cause__ is None else {'type': type(primary_error.__cause__).__name__, 'message': str(primary_error.__cause__)}, 'cleanup_errors': cleanup_errors, 'data': data_adapters.epoch_stop_diagnostics(state), 'native_packet': None if _EXECUTION['packet'] is None else native_packet.receipt(_EXECUTION['packet']), 'initial_native_tcb': INITIAL_NATIVE_TCB_RECEIPT} + output = _EXECUTION['output'] + if output is not None: + with (output / 'STOP.json').open('x', encoding='utf-8') as stream: + stream.write(json.dumps(stop, sort_keys=True, indent=2) + '\n') + except BaseException as evidence_error: + try: + sys.stderr.write('STOP evidence write failed: ' + type(evidence_error).__name__ + '\n') + except BaseException: + pass + raise + + +# BEGIN G12 EXACT COMMON SOURCE +# G12 common scientific projection. SOURCE ONLY; appended verbatim to each +# independently source-authenticated selected driver, before its entry point. +# Uses that driver's original Fraction and canonical functions. No data/payload +# is fabricated here and no backend/native counters are compared by P07. +_G12_COMMON_SCHEMA = 'g12-original-remainder-common-v1' +_G12_SUFFIX_PHASES = ('verify_role_frames', 'full_log_integer_bounds', + 'original_upstream_verify_sources', 'original_serializable', + 'complete_original_cli') +_G12_SCIENTIFIC_PINS = ( + 'd623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1', + '0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b', + '88bba3caf5975f30fa7abceaea9454110cf3b069233e8241a2ca13d1dff171a7', + 'adc7f1241b42e322a6451854ab7e4b4c146bf78a') + + +def _g12_primitive(value): + """Lossless tagged exact builtin structures; never invoke foreign equality.""" + kind = type(value) + if kind is Fraction: + return ['Fraction', str(value.numerator), str(value.denominator)] + if value is None: + return ['None'] + if kind is bool: + return ['bool', value] + if kind is int: + return ['int', str(value)] + if kind is str: + return ['str', value] + if kind is bytes: + return ['bytes', value.hex()] + if kind is float: + return ['float', value.hex()] + if kind is tuple or kind is list: + return [kind.__name__, [_g12_primitive(item) for item in value]] + if kind is dict: + return ['dict', [[_g12_primitive(key), _g12_primitive(item)] + for key, item in value.items()]] + raise TypeError('G12 common projection requires exact original primitive types') + + +def _g12_bytes(value): + return canonical(_g12_primitive(value)) + + +def _g12_code_snapshot(code): + # Reject custom key/equality domains before inspecting the finite code map. + need(type(code) is dict and all(type(key) is str for key in code), + 'G12 actual original code must be an exact string-keyed dict') + need(set(code) == {'roles', 'gates', 'sources', 'outputs'}, + 'G12 original code field set changed') + need(type(code['roles']) is int and code['roles'] > 0 and + type(code['gates']) is list and type(code['sources']) is dict and + type(code['outputs']) is dict, 'G12 original code containers changed') + for gate in code['gates']: + need(type(gate) is tuple and len(gate) == 3 and type(gate[0]) is int and + type(gate[1]) is tuple and type(gate[2]) is tuple and + all(type(slot) is int for slot in gate[1] + gate[2]), + 'G12 original gate primitive types changed') + for source, slot in code['sources'].items(): + need(type(source) is tuple and len(source) == 3 and + all(type(point) is int for point in source) and type(slot) is int, + 'G12 original source primitive types changed') + need(all(type(index) is int and type(slot) is int + for index, slot in code['outputs'].items()), + 'G12 original output primitive types changed') + return _g12_bytes(code) + + +def _g12_remaining_count(code): + # Source-derived count after successful unchanged optimize0 role function; + # this is not a per-assert execution trace. + _g12_code_snapshot(code) + return (2 * sum(len(set(ins + outs)) for _, ins, outs in code['gates']) + + len(code['outputs']) + code['roles'] + len(code['sources'])) + + +def _g12_common_outputs(code, code_before, role_result, full_return, + certificate_bytes, stdout_text, suffix_phases): + need(type(code_before) is bytes and _g12_code_snapshot(code) == code_before, + 'G12 original code changed within the same invocation') + need(type(full_return) is dict and + all(type(key) is str for key in full_return) and + full_return.get('role_frames') is role_result, + 'G12 original role/full-return identity relation changed') + need(type(certificate_bytes) is bytes and type(stdout_text) is str and + type(suffix_phases) is tuple and + all(type(name) is str for name in suffix_phases) and + suffix_phases == _G12_SUFFIX_PHASES, + 'G12 actual original suffix outputs/phase completions changed') + return _g12_bytes((_G12_COMMON_SCHEMA, _G12_SCIENTIFIC_PINS, 25, (0, 2, 1), + code_before, role_result, full_return, certificate_bytes, + stdout_text, suffix_phases)) + +# END G12 EXACT COMMON SOURCE +# BEGIN G12 EXACT CANDIDATE SUPPORT +# Fixed G12 source-control support, appended to the selected epoch driver. +# SOURCE ONLY. No source selection, FULL approval or execution is supplied here. +import types as _g12_types +import traceback as _g12_traceback + +_G12_SELECTED_CASE = 'N22' +_G12_SELECTED_HELPER_PIN = 'fcffe77b6a84d5b422b03e3d068924a701c1594cdb9ec305115827e3fad7d4b6' +_G12_TRANSPORT_SOURCE_PIN = None +_G12_CONTINUATION = {'started': False, 'step': 'EMPTY', 'ready': False, + 'helper_handle': None, 'helper_module': None, 'helper_function': None, + 'transport_handle': None, 'reference': None, 'suite': None, + 'generator': None, 'generator_frame': None, 'observed': None, + 'context': None, 'marker': None, 'primary': None, + 'secondary': [], 'secondary_clear': True, + 'frame_close_error': None, 'terminal_observation_error': None, + 'adapter_exit_error': None, 'suffix_phases': [], 'store_entries': 0, + 'first_advances': 0, 'second_advances': 0, 'close_attempts': 0} + + +class _G12ControlCompletion(RuntimeError): + """Only the exact recorded object is this selected control's completion.""" + + +def _g12_cold(index, *args): + descriptor = _INITIAL_COLD_CALLER_DESCRIPTOR + need(type(descriptor) is tuple and len(descriptor) == 6 and + descriptor[1] is _INITIAL_COLD_AUTHORITY and type(index) is int and index in (0, 1, 2), + 'G12 original cold operation/descriptor differs') + primitive, function, record = descriptor[5], descriptor[2], descriptor[3] + need(type(primitive) is tuple and len(primitive) == 19 and primitive[0] is type and + primitive[1] is _g12_types.FunctionType and primitive[2] is id and primitive[18] is zip and + type(function) is primitive[1] and function is record[0], + 'G12 original cold caller primitives differ') + for (_, getter), expected in primitive[18](primitive[4], record[1:7]): + need(getter(function, primitive[1]) is expected, 'G12 cold dispatcher field changed') + need(record[4] is None and record[5] is None and not record[7], 'G12 cold dispatcher defaults changed') + for cell, expected in record[8]: + need(primitive[6](cell, primitive[5]) is expected, 'G12 cold dispatcher closure changed') + return function(index, *args) + + +def _g12_helper_current(): + record = _G12_CONTINUATION + source = _g12_cold(2, record['helper_handle']) + module = record['helper_module'] + need(source[1] is module and source[2] is module.__dict__ and + source[5] == _G12_SELECTED_HELPER_PIN and + module.__dict__.get(_G12_SELECTED_CASE) is record['helper_function'] and + record['helper_function'].__code__ is record['helper_code'], + 'G12 selected actual helper source/callable changed') + suite = record['suite'] + need(record['state']['epoch_suite'] is suite and suite.context['driver_function'] is main_epoch and + suite.context['phase_owner'] is record['phases'] and + suite.context['invocation_token'] is record['invocation_token'] and + suite.generation is record['generation'] and suite.owner is record['native_owner'], + 'G12 selected suite/driver/phase/token changed') + # Direct source-owned names extend both captured driver and C3 handler graphs + # to the actual outer entry, exit controller and terminal custody predicate. + need(type(_g12_continuation_entry) is _g12_types.FunctionType and + _g12_continuation_entry.__globals__ is globals() and + type(_g12_after_original_exit) is _g12_types.FunctionType and + _g12_after_original_exit.__globals__ is globals() and + type(_g12_original_terminal_custody) is _g12_types.FunctionType and + _g12_original_terminal_custody.__globals__ is globals(), + 'G12 actual outer entry/exit/custody source owner changed') + suite.current() + + +def _g12_generator_shape(suspended): + record = _G12_CONTINUATION + generator, context = record['generator'], record['context'] + need(type(generator) is record['generator_type'] and generator.gi_code is record['helper_code'] and + generator.gi_running is False and generator.gi_yieldfrom is None and + generator.gi_suspended is suspended and generator.gi_frame is record['generator_frame'] and + generator.gi_frame is not None and generator.gi_frame.f_globals is record['helper_module'].__dict__, + 'G12 P07 exact generator/frame/source shape changed') + local = generator.gi_frame.f_locals + need(type(local) is dict and local.get('c') is context, + 'G12 P07 generator context identity changed') + if suspended: + need(local.get('observed') is record['observed'], 'G12 P07 suspended observation identity changed') + else: + need('observed' not in local, 'G12 P07 body already ran before selected first advance') + + +def _g12_selected_store(suite, original_commit, site, checks): + record = _G12_CONTINUATION + if record['step'] != 'EXPECT_STORE': + return original_commit(site, checks) + need(record['ready'] is True and suite is record['suite'] and site == 'C3' and + type(site) is str and checks is record['checks'] and + type(original_commit) is _g12_types.MethodType and original_commit.__self__ is suite and + original_commit.__func__ is type(suite).__dict__['commit'] and record['store_entries'] == 0, + 'G12 selected original C3 continuation owner changed') + _g12_helper_current() + pending = suite.pending + need(type(pending) is dict and pending.get('site') == 'C3' and pending.get('checks') is checks and + type(pending.get('key')) is tuple and pending['key'] == ('perp', (0, 2, 1)) and + type(pending.get('label')) is suite.label and + checks.cache.get(('perp', (0, 2, 1))) is pending['label'] and + suite.active is True and suite.terminal is False and suite.request_live is None and + type(suite.registry) is dict and len(suite.registry) == 85196, + 'G12 requires actual pending extra C3 store at original capacity') + record['store_entries'] = 1 + record['pending_store'] = pending + record['stored_label'] = pending['label'] + context = record['context'] + need('remaining_original_case_count' not in context and 'remaining_original_outputs' not in context, + 'G12 candidate remainder fields must be absent before actual original remainder') + try: + record['step'] = 'HELPER_ENTERED' + if _G12_SELECTED_CASE == 'P07': + generator = record['helper_function'](context) + need(type(generator) is record['generator_type'], 'G12 selected P07 did not return its genuine generator') + record['generator'], record['generator_frame'] = generator, generator.gi_frame + _g12_generator_shape(False) + _g12_helper_current() + need(record['first_advances'] == 0, 'G12 P07 first advance repeated') + record['first_advances'] = 1 + try: + observed = next(generator) + except StopIteration as early: + raise RuntimeError('G12 P07 completed before original CLI remainder') from early + record['observed'] = observed + _g12_generator_shape(True) + record['step'] = 'P07_SUSPENDED' + else: + need(_G12_SELECTED_CASE == 'N22', 'G12 source selected an undeclared helper') + _g12_helper_current() + record['observed'] = record['helper_function'](context) + record['step'] = 'N22_RETURNED' + need(type(record['observed']) is dict and + all(type(key) is str for key in record['observed']) and + set(record['observed']) == {'value', 'capacity_retirements', 'owner'} and + suite.terminal is True and suite.active is False and not suite.registry and + suite.pending is None and suite.request_live is None, + 'G12 original N22 did not return its exact terminal continuation observation') + # N22 performed the sole original commit. Never call it again here. + return None + except BaseException as primary: + if record['primary'] is None: + record['primary'] = primary + raise + + + +def _g12_selected_args(args): + need(args.data_lanes == 'candidate' and args.finite_only is False and sys.flags.optimize == 0, + 'G12 selected control requires the original full candidate/assertion scope') + +def _g12_bind_locals(state, extensions, module, binding, phases, invocation_token, + checks_pair, code_pair, label_pair, caller, rank_calls, trace, + captures, stdout, frozen, runtime, engine, output, reference, + reference_bytes, driver_before, pins, frozen_before, engine_before, + runtime_before, copied_engine_before, script_names, new_custody_before, + data_custody_before, anchor_path, anchor_bytes): + record = _G12_CONTINUATION + suite, set_owner = state['epoch_suite'], extensions['set_binding']['owner'] + need(record['started'] is True and record['ready'] is False and record['suite'] is None and + record['reference'] is not None and record['driver'] is sys.modules['__main__'] and + record['driver'].__dict__ is globals() and _EXECUTION['state'] is state and state['enabled'] is True and + suite.module is module and suite.context['driver_function'] is main_epoch and + suite.context['phase_owner'] is phases and suite.context['invocation_token'] is invocation_token and + suite.active is False and suite.terminal is False and suite.invocation_consumed is False and + suite.pending is None and suite.request_live is None and not suite.registry and + set_owner.sealed is True and set_owner.cli_active is False and set_owner.used is False and + set_owner.circuit is None and set_owner.checks is None, + 'G12 requires the original source-owned sealed, unconsumed main-local generation') + for pair in (checks_pair, code_pair, label_pair): + need(type(pair) is tuple and len(pair) == 2 and + all(type(function) is _g12_types.FunctionType for function in pair), + 'G12 original phase pair shape changed') + need(module.Checks.__dict__['__init__'] is checks_pair[1] and module.compile_roles is code_pair[1] and + module.Checks.__dict__['verify_labels'] is label_pair[1], 'G12 actual installed phase pairs changed') + # This fixed source name is also captured by the selected C3 product before + # product publication. It is not a callback parameter or a context entry. + need(_g12_selected_store.__globals__ is globals(), 'G12 fixed source store selector owner changed') + record.update({'suite': suite, 'generation': suite.generation, 'native_owner': suite.owner, 'state': state, 'extensions': extensions, 'module': module, + 'binding': binding, 'phases': phases, 'invocation_token': invocation_token, + 'checks_pair': checks_pair, 'code_pair': code_pair, 'label_pair': label_pair, + 'caller': str(caller), 'rank_calls': rank_calls, 'trace': trace, 'captures': captures, + 'stdout': stdout, 'frozen': frozen, 'runtime': runtime, 'engine': engine, 'output': output, + 'reference_file': reference, 'reference_bytes': reference_bytes, 'driver_before': driver_before, + 'pins': pins, 'frozen_before': frozen_before, 'engine_before': engine_before, + 'runtime_before': runtime_before, 'copied_engine_before': copied_engine_before, + 'script_names': script_names, 'new_custody_before': new_custody_before, + 'data_custody_before': data_custody_before, 'anchor_path': anchor_path, + 'anchor_bytes': anchor_bytes, 'ready': True, 'step': 'CLI_READY'}) + _g12_helper_current() + + +def _g12_diagnostics(): + record = _G12_CONTINUATION + ranks = record['rank_calls'] + need(type(ranks) is list, 'G12 actual original rank list changed') + for item in ranks: + need(type(item) is tuple and len(item) == 2 and type(item[0]) is tuple and + all(type(value) is int for value in item[0]) and type(item[1]) is int, + 'G12 actual original rank event type changed') + binding = record['binding'] + counters = binding['counters'] + need(type(counters) is dict and all(type(key) is str and type(value) is int + for key, value in counters.items()), + 'G12 original native counter primitive types changed') + return {'rank_event_count': len(ranks), 'ordered_rank_events_hex': _g12_bytes(tuple(ranks)).hex(), + 'complement_receipt': record['trace'].receipt(), 'native_counters': dict(counters), + 'cache_receipt': _g12_primitive(record['suite'].receipt), + 'owner_receipt': _g12_primitive(record['suite'].owner.receipt)} + + + +def _g12_complete_capacity_store(checks, circuit, suite): + need(type(circuit.active) is set and len(circuit.active) == 82895 and + all(type(node) is int for node in circuit.active) and + type(circuit.triples) is list and len(circuit.triples) == 2300, + 'G12 actual original h25 active/target census changed') + for target in circuit.triples: + need(type(target) is tuple and len(target) == 3 and all(type(point) is int for point in target) and + 0 <= target[0] < target[1] < target[2] < 25, + 'G12 actual original canonical target changed') + for key in checks.cache: + need(type(key) is int or (type(key) is tuple and len(key) == 2 and type(key[0]) is str and + key[0] == 'perp' and type(key[1]) is tuple and len(key[1]) == 3 and + all(type(point) is int for point in key[1])), 'G12 actual label store key type changed') + need(set(checks.cache) == circuit.active | {('perp', target) for target in circuit.triples}, + 'G12 requires the complete original canonical label store') + labels = tuple(checks.cache.values()) + (checks.everything,) + need(all(type(label) is suite.label for label in labels), 'G12 actual registered Label type changed') + identities = {id(label) for label in labels} + need(len(identities) == 85196 and all(type(key) is int for key in suite.registry) and + set(suite.registry) == identities, 'G12 actual registry includes missing/foreign original Labels') + for label in labels: + entry = suite.registry[id(label)] + need(type(entry) is tuple and len(entry) == 7 and entry[0] is label and entry[1] is label.basis and + entry[2] is label.key and entry[4] is checks and entry[6] is suite.generation, + 'G12 original registry Label/basis/key/generation custody changed') + need(type(label.basis) is dict and all(type(key) is int and type(value) is int + for key, value in label.basis.items()) and + type(label.key) is tuple and all(type(value) is int for value in label.key) and + type(label.dim) is int and label.dim == len(label.basis) and + label.key == tuple(sorted(label.basis.values())), 'G12 original Label primitive state changed') + +def _g12_after_phase(phases, name, function, args, kwargs, result): + record = _G12_CONTINUATION + if not record['ready']: + return result + if name not in ('compile_roles', 'verify_labels', 'complete_original_cli'): + if record['step'] == 'SUFFIX' and name in _G12_SUFFIX_PHASES: + record['suffix_phases'].append(name) + return result + need(phases is record['phases'], 'G12 fixed actual phase owner changed') + _g12_helper_current() + if name == 'compile_roles': + need(record['step'] == 'CLI_READY' and type(args) is tuple and len(args) == 1 and not kwargs and + function is record['code_pair'][0] and record['module'].compile_roles is record['code_pair'][1] and + type(args[0]) is record['module'].ComplexSideCircuit, + 'G12 actual original compile-role return checkpoint changed') + record.update({'circuit': args[0], 'code': result, 'code_before': _g12_code_snapshot(result), 'step': 'COMPILED'}) + return result + if name == 'verify_labels': + need(record['step'] == 'COMPILED' and type(args) is tuple and len(args) == 1 and not kwargs and + function is record['label_pair'][0] and record['module'].Checks.__dict__['verify_labels'] is record['label_pair'][1], + 'G12 actual original label-phase return checkpoint changed') + suite, checks, circuit = record['suite'], args[0], record['circuit'] + set_owner = record['extensions']['set_binding']['owner'] + need(type(checks) is suite.checks_class and checks.c is circuit and + type(checks.h) is int and type(circuit.h) is int and checks.h == circuit.h == 25 and + suite.active is True and suite.terminal is False and suite.invocation_consumed is True and + suite.primary_error is None and suite.pending is None and suite.request_live is None and + suite.checks is checks and suite.checks_c is circuit and + set_owner.cli_active is True and set_owner.used is False and set_owner.circuit is circuit and + set_owner.checks is checks and set_owner.triples is circuit.triples and + type(suite.registry) is dict and len(suite.registry) == 85196 and type(checks.cache) is dict and + len(checks.cache) == 85195 and ('perp', (0, 2, 1)) not in checks.cache, + 'G12 genuine post-label original capacity checkpoint changed') + _g12_complete_capacity_store(checks, circuit, suite) + cleanup = record['state']['epoch_cli_cleanup'] + need(type(cleanup) is dict and cleanup['primary'] is None and cleanup['argv_error'] is None and + cleanup['disarm_error'] is None and cleanup['retirement_error'] is None and + type(sys.argv) is list and sys.argv == [record['caller']] and sys.argv is not cleanup['argv_owner'], + 'G12 must be inside original protected CLI after actual arming') + c1 = suite.registry.get(id(checks.everything)) + need(type(c1) is tuple and len(c1) == 7 and c1[0] is checks.everything and c1[1] is checks.everything.basis and + c1[2] is checks.everything.key and c1[4] is checks and c1[5] == 'C1' and c1[6] == suite.generation, + 'G12 registered_label must be actual original C1 store') + need(_g12_code_snapshot(record['code']) == record['code_before'], 'G12 original code changed before control store') + literal, reference_count, reference_outputs, _ = record['reference'] + record['checks'] = checks + record['context'] = {'bundle': _INITIAL_EPOCH_BUNDLE, 'state': record['state'], 'site': 'C3', + 'checks': checks, 'registered_label': checks.everything, 'literal_expected': literal, + 'reference_remaining_case_count': reference_count, 'reference_remaining_outputs': reference_outputs} + record['prefix_end'] = _g12_diagnostics() + record['step'] = 'EXPECT_STORE' + actual_label = checks.target_frame((0, 2, 1)) + need(record['store_entries'] == 1 and actual_label is record['stored_label'] and + checks.cache[('perp', (0, 2, 1))] is actual_label and + record['step'] == ('P07_SUSPENDED' if _G12_SELECTED_CASE == 'P07' else 'N22_RETURNED'), + 'G12 actual selected store did not complete exactly once') + record['suffix_start'] = _g12_diagnostics() + record['rank_prefix'] = _g12_bytes(tuple(record['rank_calls'])) + record['rank_index'] = len(record['rank_calls']) + record['step'] = 'SUFFIX' + return result + need(record['step'] == 'SUFFIX' and function is runpy.run_path and type(args) is tuple and len(args) == 1 and + args[0] == record['caller'] and type(kwargs) is dict and tuple(kwargs) == ('run_name',) and kwargs['run_name'] == '__main__', + 'G12 actual same-invocation original CLI return changed') + record['suffix_phases'].append(name) + _g12_complete_original_cli(result) + marker = _G12ControlCompletion('G12 intentional ' + _G12_SELECTED_CASE + ' original-CLI control completion') + record['marker'], record['step'] = marker, 'MARKED' + raise marker + + +def _g12_complete_original_cli(namespace): + record = _G12_CONTINUATION + module, captures = record['module'], record['captures'] + need(type(namespace) is dict and all(type(key) is str for key in namespace) and + sys.modules.get('complex_circuit') is module and namespace.get('ComplexSideCircuit') is module.ComplexSideCircuit and + namespace.get('Checks') is module.Checks and namespace.get('compile_roles') is module.compile_roles and + namespace.get('verify_role_frames') is module.verify_role_frames and + namespace.get('serializable') is sys.modules['prepare_layers'].serializable, + 'G12 original completed CLI namespace/observer binding changed') + need(type(captures) is dict and all(type(key) is str for key in captures) and set(captures) == {'side', 'full_return'} and + type(captures['side']) is tuple and len(captures['side']) == 4, 'G12 actual original capture set changed') + circuit, checks, code, roles = captures['side'] + full_return = captures['full_return'] + need(circuit is record['circuit'] and checks is record['checks'] and code is record['code'] and + type(full_return) is dict and all(type(key) is str for key in full_return) and + full_return.get('role_frames') is roles and full_return.get('upstream_commit') == UPSTREAM, + 'G12 actual same original generation/full role result changed') + stdout_text = record['stdout'].getvalue() + certificate = (record['runtime'] / 'certificates/complex-network.json').read_bytes() + need(stdout_text == EXPECTED_STDOUT and certificate == record['reference_bytes'], + 'G12 original fresh certificate/stdout differs from original immutable pins') + for name in ('side_construction', 'checks_initialization', 'compile_roles', 'verify_map', 'verify_labels', + 'verify_role_frames', 'original_upstream_verify_sources', 'full_log_integer_bounds', 'original_serializable'): + need(record['phases'].rows.get(name, {}).get('calls') == 1, 'G12 original phase omitted/repeated: ' + name) + need('complete_original_cli' not in record['phases'].rows, 'G12 original complete-CLI finally already ran') + _g12_original_imports() + outputs = _g12_common_outputs(code, record['code_before'], roles, full_return, certificate, + stdout_text, tuple(record['suffix_phases'])) + count = _g12_remaining_count(code) + need(_g12_bytes(tuple(record['rank_calls'][:record['rank_index']])) == record['rank_prefix'], + 'G12 actual original rank prefix changed') + record.update({'common': outputs, 'case_count': count, 'cli_end': _g12_diagnostics(), + 'rank_suffix': _g12_bytes(tuple(record['rank_calls'][record['rank_index']:])), + 'namespace': namespace, 'full_return': full_return, 'roles': roles}) + native_start = record['suffix_start']['native_counters'] + native_end = record['cli_end']['native_counters'] + need(set(native_start) == set(native_end), 'G12 original native counter domain changed across suffix') + record['native_suffix_delta'] = {key: native_end[key] - value for key, value in native_start.items()} + if _G12_SELECTED_CASE == 'P07': + context = record['context'] + need('remaining_original_case_count' not in context and 'remaining_original_outputs' not in context and + record['second_advances'] == 0, 'G12 candidate actual remainder publication/advance repeated') + _g12_generator_shape(True) + context['remaining_original_case_count'] = count + context['remaining_original_outputs'] = outputs + _g12_helper_current() + _g12_generator_shape(True) + record['second_advances'] = 1 + try: + next(record['generator']) + except StopIteration as completed: + need(completed.value is record['observed'], 'G12 original P07 returned a different observation object') + else: + raise RuntimeError('G12 selected P07 yielded again instead of original comparisons/return') + need(record['generator'].gi_frame is None, 'G12 P07 frame remained live after original return') + record['p07_returned_original_observation'] = record['observed'] + else: + need(_G12_SELECTED_CASE == 'N22' and record['generator'] is None, + 'G12 original N22 selection acquired a P07 continuation') + + +def _g12_original_imports(): + record = _G12_CONTINUATION + for name in record['script_names'] - {'complex_network'}: + module = sys.modules.get(name) + expected = record['engine'] / 'source/complex_circuit.py' if name == 'complex_circuit' else record['runtime'] / 'scripts' / (name + '.py') + need(type(module) is _g12_types.ModuleType and Path(module.__file__).resolve() == expected.resolve(), + 'G12 actual original scientific import path changed: ' + name) + + +def _g12_original_terminal_custody(): + record = _G12_CONTINUATION + need(inventory(record['frozen'], record['pins']) == record['frozen_before'] and + inventory(HERE / 'engine', ENGINE_PINS) == record['engine_before'] and + inventory(record['runtime'], record['pins'], exact=False) == record['runtime_before'] and + inventory(record['engine'], ENGINE_PINS) == record['copied_engine_before'], + 'G12 original source/input inventory or modes changed') + files = {str(path.relative_to(record['runtime'])) for path in record['runtime'].rglob('*') if path.is_file()} + need(files == set(record['pins']) | {'certificates/complex-network.json'} and + Path(__file__).read_bytes() == record['driver_before'] and + record['reference_file'].read_bytes() == record['reference_bytes'], + 'G12 original output/selected source/reference custody changed') + need(adapters.custody(ROUND, 'all') == record['new_custody_before'] and + data_adapters.custody(ROUND) == record['data_custody_before'] and + (record['anchor_bytes'] is None or record['anchor_path'].read_bytes() == record['anchor_bytes']), + 'G12 original selected-source/anchor custody changed') + _g12_original_imports() + for name in ('side_construction', 'checks_initialization', 'compile_roles', 'verify_map', 'verify_labels', + 'verify_role_frames', 'original_upstream_verify_sources', 'full_log_integer_bounds', + 'original_serializable', 'complete_original_cli'): + need(record['phases'].rows.get(name, {}).get('calls') == 1, + 'G12 complete original phase finally/count changed: ' + name) + + +def _g12_after_original_exit(primary): + record = _G12_CONTINUATION + if record['primary'] is None: + record['primary'] = primary + generator = record['generator'] + if generator is not None and generator.gi_frame is not None: + try: + # No original CLI resume occurs on failure. Original P07 source has + # no finally clause; closing this exact suspended code only releases + # its retained frame after original CLI/main/STOP/owned cleanup. + _g12_generator_shape(True) + need(record['close_attempts'] == 0, 'G12 suspended P07 close repeated') + record['close_attempts'] = 1 + generator.close() + need(generator.gi_frame is None, 'G12 exact suspended P07 did not close') + except BaseException as secondary: + try: + record['secondary_clear'] = False + record['frame_close_error'] = secondary + record['secondary'].append((secondary, secondary.__traceback__, 'P07-frame-close')) + except BaseException: + pass + if primary is record['marker'] and record['step'] == 'MARKED': + try: + _g12_original_terminal_custody() + need(record['secondary_clear'] is True and + record['frame_close_error'] is None and record['terminal_observation_error'] is None and + record['adapter_exit_error'] is None and not record['secondary'], + 'G12 source-control secondary error or incomplete journal blocks observation export') + row = {'schema': 'g12-original-control-observation-v1', 'case': _G12_SELECTED_CASE, + 'selected_driver_sha256': sha(record['driver_before']), + 'reference_provenance': record['reference'][3], + 'original_helper_observation': _g12_primitive(record['observed']), + 'remaining_original_case_count': record['case_count'], + 'common_payload_sha256': sha(record['common']), 'common_payload_hex': record['common'].hex(), + 'prefix_end': record['prefix_end'], 'suffix_start': record['suffix_start'], 'cli_end': record['cli_end'], + 'ordered_rank_suffix_hex': record['rank_suffix'].hex(), 'native_suffix_delta': record['native_suffix_delta'], + 'phases': record['phases'].rows, + 'store_entries': record['store_entries'], 'first_advances': record['first_advances'], + 'second_advances': record['second_advances'], 'close_attempts': record['close_attempts'], + 'disposition_qualification': 'OPEN_REQUIRES_SEPARATE_ORIGINAL_STOP_AND_ALL_OWNED_CLEANUP_REVIEW', + 'scope': 'Original selected N22/P07 observation plus same-invocation original CLI remainder only. No original full-positive publication/native-count/P02/G12/FULL admission.'} + with (record['output'] / 'g12-control-observation.json').open('xb') as stream: + stream.write(canonical(row) + b'\n') + except BaseException as secondary: + try: + record['secondary_clear'] = False + record['terminal_observation_error'] = secondary + record['secondary'].append((secondary, secondary.__traceback__, 'terminal-source-observation')) + except BaseException: + pass + for secondary, traceback, phase in record['secondary']: + try: + sys.stderr.write('G12 secondary continuation error: ' + phase + '\n') + _g12_traceback.print_exception(type(secondary), secondary, traceback, file=sys.stderr) + except BaseException: + pass + + +def _g12_continuation_entry(): + record = _G12_CONTINUATION + need(record['started'] is False and _G12_SELECTED_CASE in ('N22', 'P07'), 'G12 source control entry is one-use') + record['started'] = True + record['driver'] = sys.modules['__main__'] + need(record['driver'].__dict__ is globals(), 'G12 source control requires actual Root-installed driver namespace') + need(type(_G12_TRANSPORT_SOURCE_PIN) is str and len(_G12_TRANSPORT_SOURCE_PIN) == 64, + 'G12 reference transport source has not been selected') + helper, helper_handle = _g12_cold(0, str(ROUND / 'areas/cache-validity/g12_source_controls.py'), + _G12_SELECTED_HELPER_PIN, '_h25_g12_source_controls') + transport, transport_handle = _g12_cold(0, str(ROUND / 'areas/cache-validity/g12_reference_transport.py'), + _G12_TRANSPORT_SOURCE_PIN, '_h25_g12_reference_transport') + reference = _g12_cold(1, transport_handle, 'load_original_g12_reference', + _CAPTURED_BOOTSTRAP_ROOT, _CAPTURED_BOOTSTRAP_CAPABILITY, _CAPTURED_BOOTSTRAP_API) + need(type(reference) is tuple and len(reference) == 4 and type(reference[0]) is bool and + type(reference[1]) is int and reference[1] > 0 and type(reference[2]) is bytes and type(reference[3]) is tuple, + 'G12 actual source-produced independent reference transport shape changed') + source = _g12_cold(2, helper_handle) + function = helper.__dict__[_G12_SELECTED_CASE] + need(source[1] is helper and source[5] == _G12_SELECTED_HELPER_PIN and + type(function) is _g12_types.FunctionType and function.__globals__ is helper.__dict__ and + bool(function.__code__.co_flags & 0x20) is (_G12_SELECTED_CASE == 'P07'), + 'G12 exact selected helper source/generator protocol changed') + record.update({'helper_handle': helper_handle, 'helper_module': helper, 'helper_function': function, + 'helper_code': function.__code__, 'transport_handle': transport_handle, + 'reference': reference, 'generator_type': _g12_types.GeneratorType, 'step': 'PREPARED'}) + try: + _run_epoch_with_stop_evidence() + except BaseException as primary: + # Original CLI/main/STOP/owned cleanup has already run. Preserve the + # identical primary and cause; every adapter cleanup error is secondary. + try: + _g12_after_original_exit(primary) + except BaseException as secondary: + try: + record['secondary_clear'] = False + record['adapter_exit_error'] = secondary + record['secondary'].append((secondary, secondary.__traceback__, 'adapter-exit-entry')) + except BaseException: + pass + raise + raise RuntimeError('G12 source control reached original full-positive return without its intentional marker') + +# END G12 EXACT CANDIDATE SUPPORT + +if __name__ == '__main__': + _g12_continuation_entry() diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_P07_custody_v1.py.txt b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_P07_custody_v1.py.txt new file mode 100644 index 0000000000..19f72875ca --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_P07_custody_v1.py.txt @@ -0,0 +1,1878 @@ +#!/usr/bin/env python3 +"""One complete frozen complex-network CLI with retained exact observations. + +Parent-owned serial wall/RSS/aggregate guard is mandatory. Profile mode is one +literal baseline diagnostic/anchor, not a performance sample. Both benchmark +modes require its immutable anchor. No search, retry, orchestration or network. +""" +from __future__ import annotations + +# Actual source-authenticated root injects these three values before driver exec. +# Capture them before importing any candidate, scientific, or orchestration code. +_CAPTURED_BOOTSTRAP_ROOT = bootstrap_root +_CAPTURED_BOOTSTRAP_CAPABILITY = bootstrap_capability +_CAPTURED_BOOTSTRAP_API = bootstrap_api +if type(_CAPTURED_BOOTSTRAP_API) is not tuple or len(_CAPTURED_BOOTSTRAP_API) != 4: + raise RuntimeError('Driver requires the parent-sealed exact four-entry bootstrap API') +_INITIAL_ROOT_IDENTITY = _CAPTURED_BOOTSTRAP_API[0]() +if (type(_CAPTURED_BOOTSTRAP_ROOT) is not _CAPTURED_BOOTSTRAP_ROOT.ModuleType or + any(type(entry) is not _CAPTURED_BOOTSTRAP_ROOT.FunctionType or + entry.__globals__ is not _CAPTURED_BOOTSTRAP_ROOT.__dict__ + for entry in _CAPTURED_BOOTSTRAP_API)): + raise RuntimeError('Driver bootstrap API is not bound to the actual root namespace') + +# Accepted helper/control sources and parent-inspected native dependency tuple. +# These are static expected pins; finite and full execution gates remain closed. +EXPECTED_BOOTSTRAP_ROOT_SHA256 = 'f5a2d33f2b4d3651f214156a0e7094c2bb516ce2d5ab7698d18c11f98f35dee0' +NATIVE_TCB_HELPER_SHA256 = '865943df5cfdbf9383362d7fb2b76c6d0fd895cf0a0e20d550a26b579606b5d7' +NATIVE_TCB_CONTROLS_SHA256 = '63b1804caa7f89915662a1424f788c3becad13520e1f63212a338fb45aaa2c5a' +NATIVE_TCB_EXPECTED_FILES = (('/usr/bin/python3.12', 'e50d468e8b0adfb05733f5b87b3cff34829c4a8c1aea50c865aa8bdfe4bb150f', 8020928), + ('/usr/lib/python3.12/lib-dynload/_hashlib.cpython-312-x86_64-linux-gnu.so', + '8dc6cda6dd9495b95a2bfb5b26e8cf06b72f36dc0213d958b9277a958287f0fe', + 64368), + ('/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2', + 'c20a2dc8917c755f02b94049356320fe1f62ac7d9f8994731f807d9df39302da', + 236616), + ('/usr/lib/x86_64-linux-gnu/libc.so.6', + '3a15d66867d83762c7f2f1e37359cb8f6c5743edb369c65285cb0b1c4f7498bf', + 2129424), + ('/usr/lib/x86_64-linux-gnu/libcrypto.so.3', + '6866ed711dab8927e1bf82bf1cd30e828bdfc34f3cc1e83b1c9eb01ce6c37d9a', + 5309400), + ('/usr/lib/x86_64-linux-gnu/libexpat.so.1.9.1', + '286682ecbc5e59a638963b1a4e6351e65eb32fcf4bdcb9cb7569b6a61fe06a8d', + 186624), + ('/usr/lib/x86_64-linux-gnu/libm.so.6', + 'fce00b6f25f459cf4ae0b7fae4257909a1a8a86f9149e7c029a5d617baf1ccd0', + 952616), + ('/usr/lib/x86_64-linux-gnu/libz.so.1.3', + 'f61677c7bdb7c2aa2a243ea781bfd16afcb361cede7b4ef76127a9d8eb9a5242', + 113000)) +NATIVE_TCB_EXPECTED_HASHLIB_ORIGIN = '/usr/lib/python3.12/lib-dynload/_hashlib.cpython-312-x86_64-linux-gnu.so' + + +def _initial_native_tcb(): + root, api = _CAPTURED_BOOTSTRAP_ROOT, _CAPTURED_BOOTSTRAP_API + if (type(EXPECTED_BOOTSTRAP_ROOT_SHA256) is not str or + _INITIAL_ROOT_IDENTITY != EXPECTED_BOOTSTRAP_ROOT_SHA256 or + type(NATIVE_TCB_HELPER_SHA256) is not str or len(NATIVE_TCB_HELPER_SHA256) != 64 or + type(NATIVE_TCB_EXPECTED_FILES) is not tuple or + type(NATIVE_TCB_EXPECTED_HASHLIB_ORIGIN) is not str): + raise RuntimeError('Initial native TCB source and expected dependency tuple are not configured') + helper_path = __file__.rsplit('/', 2)[0] + '/areas/cache-validity/probe-native/native_tcb_v1.py' + api[0]() + digest, _, source = root._hash_regular(helper_path, 262144, True) + if digest != NATIVE_TCB_HELPER_SHA256: + raise RuntimeError('Initial native TCB helper source differs') + helper = root.ModuleType('_h25_initial_native_tcb') + namespace = helper.__dict__ + namespace.update({'__file__': helper_path, '__builtins__': root.builtins.__dict__}) + api[0]() + code = root._COMPILE(source, helper_path, 'exec', dont_inherit=True, optimize=root._OPTIMIZE) + api[0]() + root._EXEC(code, namespace) + api[0]() + receipt = namespace['verify_native_tcb'](root, api, NATIVE_TCB_EXPECTED_FILES, + NATIVE_TCB_EXPECTED_HASHLIB_ORIGIN) + if type(NATIVE_TCB_CONTROLS_SHA256) is not str or len(NATIVE_TCB_CONTROLS_SHA256) != 64: + raise RuntimeError('Initial native TCB control source pin is not configured') + control_path = __file__.rsplit('/', 2)[0] + '/areas/cache-validity/probe-native/native_tcb_controls_v1.py' + api[0]() + digest, _, control_source = root._hash_regular(control_path, 262144, True) + if digest != NATIVE_TCB_CONTROLS_SHA256: + raise RuntimeError('Initial native TCB controls source differs') + control_namespace = {'__name__': '_h25_initial_native_tcb_controls', '__file__': control_path, + '__builtins__': root.builtins.__dict__} + api[0]() + control_code = root._COMPILE(control_source, control_path, 'exec', dont_inherit=True, optimize=root._OPTIMIZE) + api[0]() + root._EXEC(control_code, control_namespace) + argv = root.sys.argv + if (type(argv) is not list or any(type(arg) is not str for arg in argv) or + argv.count('--output') != 1 or argv.index('--output') + 1 >= len(argv)): + raise RuntimeError('Early TCB controls require the unique parent --output argument') + output = argv[argv.index('--output') + 1] + stage_root = __file__.rsplit('/', 2)[0] + if (not output.startswith('/') or output.endswith('/') or + any(part in ('', '.', '..') for part in output.split('/')[1:]) or + output == stage_root or output.startswith(stage_root + '/')): + raise RuntimeError('Early TCB controls require a canonical absolute output outside the stage') + # Parent owns an existing nonsymlink output parent. mkdir is exclusive: + # a preexisting output, file, or symlink is rejected before any fixture write. + api[0]() + root.posix.mkdir(output, 0o700) + control_directory = output + '/initial-tcb-controls' + root.posix.mkdir(control_directory, 0o700) + api[0]() + controls = control_namespace['run_controls']( + helper, root, api, NATIVE_TCB_EXPECTED_FILES, NATIVE_TCB_EXPECTED_HASHLIB_ORIGIN, control_directory) + if (controls.get('schema') != 'h25-native-tcb-controls-v1' or + controls.get('expected_records') != 5 or len(controls.get('records', [])) != 5 or + controls.get('scientific_calls') != 0 or controls.get('probe_native_imports') != 0): + raise RuntimeError('Initial native TCB control census differs') + controls['status'] = 'NATIVE_INITIAL_TCB_CONTROLS_PASS' + return receipt, controls, output + + +# Child outer wall/CPU/RSS includes this entire initial trust check. +# It assumes the declared trusted OS/native startup; it does not prove itself. +INITIAL_NATIVE_TCB_RECEIPT, INITIAL_NATIVE_TCB_CONTROLS, _INITIAL_OUTPUT = _initial_native_tcb() + +# This independent bootstrap support captures the initial system-stdlib +# continuity boundary before any adapter or scientific module is exposed. +# No late candidate-created snapshot is accepted as initial authentication. +COLD_AUTHORITY_SHA256 = '3079a096df1072a83056f3f8a8cbf9e766fdddb488e36dddb36544c7929f988a' + + +def _initial_cold_authority(): + root, cap, api = (_CAPTURED_BOOTSTRAP_ROOT, _CAPTURED_BOOTSTRAP_CAPABILITY, + _CAPTURED_BOOTSTRAP_API) + if type(COLD_AUTHORITY_SHA256) is not str or len(COLD_AUTHORITY_SHA256) != 64: + raise RuntimeError('Initial cold authority source pin is not configured') + source_path = __file__.rsplit('/', 2)[0] + '/areas/cache-validity/cold_authority_v7.py' + api[0]() + digest, _, source = root._hash_regular(source_path, 1048576, True) + if digest != COLD_AUTHORITY_SHA256: + raise RuntimeError('Initial cold authority source differs') + module = root.ModuleType('_h25_initial_cold_authority') + namespace = module.__dict__ + namespace.update({'__file__': source_path, '__builtins__': root.builtins.__dict__}) + api[0]() + code = root._COMPILE(source, source_path, 'exec', dont_inherit=True, optimize=root._OPTIMIZE) + api[0]() + root._EXEC(code, namespace) + # The actual source bytes have just executed under the admitted initial + # interpreter/system-stdlib premise. Capture precedes every candidate import. + api[0]() + bundle = namespace['capture_epoch_authority'](root, cap, api); authority = bundle[1] + if (type(authority) is not tuple or len(authority) != 7 or + any(type(entry) is not root.FunctionType for entry in authority)): + raise RuntimeError('Initial cold authority must expose the sealed seven-entry tuple') + # Read fresh transport exactly once, before any candidate exposure. + transport = root.FunctionType.__dict__['__dict__'].__get__(authority[0], root.FunctionType) + descriptor = transport['_h25_caller_descriptor'] + if type(descriptor) is not tuple or len(descriptor) != 6 or descriptor[1] is not authority: + raise RuntimeError('Initial cold authority caller descriptor differs') + return authority, descriptor, bundle + + +import importlib +import typing +_INITIAL_COLD_AUTHORITY, _INITIAL_COLD_CALLER_DESCRIPTOR, _INITIAL_EPOCH_BUNDLE = _initial_cold_authority() + +import time +START_WALL = time.perf_counter() +import argparse +from contextlib import redirect_stdout +from fractions import Fraction +import hashlib +import io +import json +import os +from pathlib import Path +import resource +import runpy +import shutil +import stat +import sys + +sys.dont_write_bytecode = True +# Independent source pins are literal final-stage configuration. These modules +# are admitted by the pre-exposure authority, including their live helper code. +# Driver/source identity does not depend on a hash of itself. +EARLY_INTEGRATION_SOURCE_PINS = ({'adapters': ('integration/adapters.py', 'f7ca7f4f03ac63c1a95ba42f06149543211566de5e29f487a3dc4d08c5ee9b94'), 'cold_build_evidence': ('integration/cold_build_evidence.py', 'aa0a315110e031e19291970c9611fe5e0f91465fa20eaec51e81186099563f78'), 'native_packet': ('integration/native_packet.py', '6adbcd1dfeb77fb6da7ee8f725796b1bfdbf0a4f397ef23f3a266a6b89d55892'), 'data_adapters': ('integration/data_adapters.py', '18679fd1eb6ae99c4b375756511427c26718f77674c2d8fcc490e25ceb47cba5'), 'guarded_adapters_v4': ('integration/guarded_adapters_v4.py', '5579fe0838d8c6acf63834990269479c6c32024a1662846ed0a075c25d13954c'), '_h25_data_cache': ('areas/cache-validity/cache_contract_v8.py', '20a8a94e96bfa6213d4f04244dabecf059b4c8c7e8ffa7e9409a8b87cfeef494')} + + + + + + +) +_INITIAL_INTEGRATION_MODULES = {} +_INITIAL_INTEGRATION_HANDLES = {} +for _entry_name, (_entry_relative, _entry_digest) in EARLY_INTEGRATION_SOURCE_PINS.items(): + if type(_entry_digest) is not str or len(_entry_digest) != 64: + raise RuntimeError('Early integration source pin is not configured: ' + _entry_name) + # BEGIN evaluated dispatch arguments scientific_driver:195 + _ca_args = (__file__.rsplit('/', 2)[0] + '/' + _entry_relative, _entry_digest, _entry_name) + _ca_kwargs = {} + # END evaluated dispatch arguments scientific_driver:195 + # BEGIN caller admission scientific_driver:195 + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission scientific_driver:195 + _entry_module, _entry_handle = _ca_dispatch(0, *_ca_args, **_ca_kwargs) + if type(_entry_module) is not _CAPTURED_BOOTSTRAP_ROOT.ModuleType or sys.modules.get(_entry_name) is not _entry_module: + raise RuntimeError('Early integration module registry identity differs: ' + _entry_name) + _INITIAL_INTEGRATION_MODULES[_entry_name] = _entry_module + _INITIAL_INTEGRATION_HANDLES[_entry_name] = _entry_handle +adapters = _INITIAL_INTEGRATION_MODULES['adapters'] +native_packet = _INITIAL_INTEGRATION_MODULES['native_packet'] +data_adapters = _INITIAL_INTEGRATION_MODULES['data_adapters'] +guarded_adapters_v4 = _INITIAL_INTEGRATION_MODULES['guarded_adapters_v4'] +_EXECUTION = {'output': Path(_INITIAL_OUTPUT), 'state': None, 'packet': None} +ROUND = Path(__file__).resolve().parent.parent +HERE = ROUND / "baseline" +REFERENCE_DRIVER_SHA = "0d976d2eb6b845f20d4a3396591a806f966688b88693cd6a5f8a0c9e48925e36" +BASE = "19fdb086ea96af9a9f87936a2b888e10af4ed810" +UPSTREAM = "adc7f1241b42e322a6451854ab7e4b4c146bf78a" +PIN_SHA = "88bba3caf5975f30fa7abceaea9454110cf3b069233e8241a2ca13d1dff171a7" +REFERENCE_SHA = "1f763d95c7ff163aa71d13cd82784f16665be8afb21f75e76941e2119562098f" +ENGINE_PINS = { + "native_gf2.c": "e9c3c9194a08718bd1575c1cf08c6c6772d3b644c2e274c25a84a1f9249d06cc", + "native_backend.py": "e473c38245c3668715b5a78dfe980b2fe3ed0d0c9b8c97c666fbae6ecf1fffd5", + "finite_controls.py": "df989a831aac43cc1af95169dad8c64a7548760e6e1f96976da996703f2c8f7a", + "compare_side_verifier.py": "6e507bb0c7e00d090a60289fddb6c55e90c946d0850c42c3c5e3e15c27604a68", + "profile_side_verifier.py": "9c994378171c20a91539418d93cb8387e1daa93465d6862beefea90e12999c2a", + "source/complex_circuit.py": "d623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1", + "source/complex_network.py": "0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b", +} +COMPLEMENT_EXPECTED = { + "calls": 238685, + "canonical_stream_bytes": 55839507, + "sha256": "7dec2bf33303c37e1c699609e83768d61df7e19104d34a26a148f66d5ccc4838", + "schema": "v2-jsonl:call,us,vs,result(type=list+values or type=None); ordered exact integer vectors", +} +EXPECTED_STDOUT = ( + "PASS conditional 59/100000000000 > 2^-31; minimum margin 14779261/25000000000000000\n" + "Side roles per invocation 108195 vs original 3693800\n" +) + + +def need(condition, message): + if not condition: + raise RuntimeError(message) + + +def sha(data): + return hashlib.sha256(data).hexdigest() + + +def canonical(value): + return json.dumps(value, sort_keys=True, separators=(",", ":"), ensure_ascii=True).encode("ascii") + + +def cpu(): + own = resource.getrusage(resource.RUSAGE_SELF) + children = resource.getrusage(resource.RUSAGE_CHILDREN) + return own.ru_utime + own.ru_stime + children.ru_utime + children.ru_stime + + +def inventory(root, pins, *, exact=True): + need(root.is_dir() and not root.is_symlink(), "Missing or symlinked input root") + files = {} + for path in sorted(root.rglob("*")): + need(not path.is_symlink(), "Symlink in frozen inputs: " + str(path)) + if path.is_file(): + relative = str(path.relative_to(root)) + if relative not in pins: + need(not exact, "Undeclared frozen input: " + relative) + continue + raw = path.read_bytes() + expected = pins[relative][0] if type(pins[relative]) is list else pins[relative] + need(sha(raw) == expected, "Frozen input digest changed: " + relative) + files[relative] = {"sha256": sha(raw), "mode": stat.S_IMODE(path.stat().st_mode), "bytes": len(raw)} + need(set(files) == set(pins), "Frozen input inventory incomplete") + return files + +# Preserve the literal baseline function; main selects a local arm function. +original_inventory = inventory + +def candidate_inventory(root, pins, *, exact=True): + need(root.is_dir() and not root.is_symlink(), "Missing or symlinked input root") + files = {} + for path in sorted(root.rglob("*")): + need(not path.is_symlink(), "Symlink in frozen inputs: " + str(path)) + if path.is_file(): + relative = str(path.relative_to(root)) + if relative not in pins: + need(not exact, "Undeclared frozen input: " + relative) + continue + raw = path.read_bytes() + expected = pins[relative][0] if type(pins[relative]) is list else pins[relative] + raw_digest = sha(raw) + need(raw_digest == expected, "Frozen input digest changed: " + relative) + files[relative] = {"sha256": raw_digest, "mode": stat.S_IMODE(path.stat().st_mode), "bytes": len(raw)} + need(set(files) == set(pins), "Frozen input inventory incomplete") + return files + + +def typed(value): + """Lossless full return representation, including order and exact types.""" + kind = type(value) + if kind is Fraction: + return ["Fraction", value.numerator, value.denominator] + if value is None: + return ["None"] + if kind is bool: + return ["bool", value] + if kind is int: + return ["int", str(value)] + if kind is float: + return ["float", value.hex()] + if kind is str: + return ["str", value] + if kind is list or kind is tuple: + return [kind.__name__, [typed(item) for item in value]] + if kind is dict: + return ["dict", [[typed(key), typed(item)] for key, item in value.items()]] + raise TypeError("Unsupported exact full-certificate return type: " + kind.__name__) + + +class Phases: + """Broad phase observations; no per-arithmetic resource sampling. + + Every call retains the old timing fields. Memory samples are paid by both + arms, including nested side_construction so snapshots/retirement are visible. + """ + def __init__(self): + self.rows = {} + + @staticmethod + def memory(): + with open("/proc/self/status", "rb") as stream: + raw = stream.read(65537) + need(len(raw) <= 65536, "Process status diagnostic exceeded its bound") + current = None + for line in raw.splitlines(): + if line.startswith(b"VmRSS:"): + fields = line.split() + need(len(fields) == 3 and fields[2] == b"kB", "Unexpected process RSS diagnostic units") + current = int(fields[1]) * 1024 + break + need(current is not None, "Current process RSS diagnostic unavailable") + highwater = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss * 1024 + return {"current_vmrss_bytes": current, "process_ru_maxrss_bytes": highwater} + + def call(self, name, function, *args, **kwargs): + wall, used = time.perf_counter(), cpu() + memory_before = self.memory() + primary_failure = False + try: + return _g12_after_phase(self, name, function, args, kwargs, function(*args, **kwargs)) + except BaseException: + primary_failure = True + raise + finally: + memory_after, memory_error = None, None + try: + memory_after = self.memory() + except BaseException as error: + # Do not replace an original failure with diagnostic failure. + memory_error = {"type": type(error).__name__} + if not primary_failure: + raise + row = self.rows.setdefault(name, {"calls": 0, "wall_seconds": 0.0, + "cpu_seconds_with_children": 0.0, + "memory_samples": [], + "memory_semantics": "VmRSS is current resident bytes; ru_maxrss is process high-water bytes; neither is an additive phase peak"}) + row["calls"] += 1 + row["memory_samples"].append({"before": memory_before, "after": memory_after, + "diagnostic_error": memory_error}) + row["wall_seconds"] += time.perf_counter() - wall + row["cpu_seconds_with_children"] += cpu() - used + + def wrap(self, owner, attribute, name): + original = getattr(owner, attribute) + def observed(*args, **kwargs): + return self.call(name, original, *args, **kwargs) + setattr(owner, attribute, observed) + return original, observed + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--frozen-root", type=Path, default=HERE / "frozen") + parser.add_argument("--reference", type=Path, default=HERE / "reference/certificates/complex-network.json") + parser.add_argument("--lanes", choices=("baseline", "candidate"), required=True) + parser.add_argument("--finite-only", action="store_true") + parser.add_argument("--output", type=Path, required=True, help="New external directory; every write stays below it") + parser.add_argument("--anchor", type=Path, default=HERE / "anchor.json") + args = parser.parse_args() + args.data_lanes = args.lanes + args.lanes = "all" # Both comparison arms retain the complete original native/bookkeeping baseline. + if args.data_lanes == "transport": + need(args.frozen_root == HERE / "frozen" and + args.reference == HERE / "reference/certificates/complex-network.json" and + args.anchor == HERE / "anchor.json", "Transport uses only the original fixed historical inputs") + data_adapters.transport(ROUND, HERE, args.output) + return + inventory = candidate_inventory if args.data_lanes == "candidate" else original_inventory + args.mode = "candidate" # Every new arm starts from the original native C configuration. + need(args.finite_only or sys.flags.optimize == 0, "Every full-caller mode requires original assertions") + need(sys.implementation.name == "cpython" and sys.version_info[:2] == (3, 12), "Frozen CPython 3.12 required") + data_adapters.require_execution_contract(args.data_lanes, args.finite_only) + need((args.mode == "profile") == (args.anchor is None), "Profile creates the anchor; both benchmark arms require --anchor") + frozen, reference = args.frozen_root.resolve(), args.reference.resolve() + output = args.output.resolve() + need(str(output) == _INITIAL_OUTPUT and output.is_dir() and not output.is_symlink() and + {path.name for path in output.iterdir()} == {'initial-tcb-controls'} and + (output / 'initial-tcb-controls').is_dir() and + not (output / 'initial-tcb-controls').is_symlink() and + not list((output / 'initial-tcb-controls').iterdir()), + "Early TCB output ownership or fresh control directory changed") + need(not output.is_relative_to(HERE) and not output.is_relative_to(frozen), "Output must be outside immutable sources") + need(reference.is_file() and not reference.is_symlink(), "Reference certificate missing or symlinked") + source_pin_bytes = (HERE / "SOURCE-PINS.json").read_bytes() + need(sha(source_pin_bytes) == PIN_SHA, "Source inventory pin changed") + pins = json.loads(source_pin_bytes) + need(len(pins) == 32, "Frozen closure must contain twelve scripts, manifest and nineteen payloads") + reference_bytes = reference.read_bytes() + need(sha(reference_bytes) == REFERENCE_SHA, "Original full certificate reference changed") + driver_before = Path(__file__).read_bytes() + new_custody_before = adapters.custody(ROUND, args.lanes) + data_custody_before = data_adapters.custody(ROUND) + reference_driver_before = (HERE / "full_driver.py").read_bytes() + need(sha(reference_driver_before) == REFERENCE_DRIVER_SHA, "Reference driver pin changed") + anchor_bytes = None if args.anchor is None else args.anchor.read_bytes() + expected_anchor = None if anchor_bytes is None else json.loads(anchor_bytes) + if expected_anchor is not None: + need(expected_anchor.get("schema") == "gf2-full-network-anchor-v1" and + expected_anchor.get("base_commit") == BASE and expected_anchor.get("source_pin_sha256") == PIN_SHA and + expected_anchor.get("driver_sha256") == REFERENCE_DRIVER_SHA and + expected_anchor.get("engine_pins") == ENGINE_PINS, + "Anchor source/driver/engine identity differs; no benchmark permitted") + _EXECUTION['output'] = output + compiler_tmp = output / "compiler-tmp" + compiler_tmp.mkdir() + os.environ["TMPDIR"] = str(compiler_tmp) + phases = Phases() + (output / 'initial-native-tcb.json').write_bytes(canonical(INITIAL_NATIVE_TCB_RECEIPT) + b'\n') + (output / 'initial-tcb-controls' / 'receipt.json').write_bytes(canonical(INITIAL_NATIVE_TCB_CONTROLS) + b'\n') + frozen_before = phases.call("input_custody", inventory, frozen, pins) + engine_before = phases.call("engine_custody", inventory, HERE / "engine", ENGINE_PINS) + manifest = json.loads((frozen / "upstream/manifest.json").read_bytes()) + need(manifest["commit"] == UPSTREAM and len(manifest["files"]) == 19, "Wrong pinned upstream manifest") + need({"upstream/" + name for name in manifest["files"]} == + {name for name in pins if name.startswith("upstream/") and name != "upstream/manifest.json"}, + "Source verifier payload closure changed") + for name, info in manifest["files"].items(): + need(info["sha256"] == pins["upstream/" + name][0], "Manifest payload hash differs from independent frozen pin") + + runtime, engine = output / "runtime-root", output / "engine" + phases.call("fresh_root_copy", shutil.copytree, frozen, runtime) + phases.call("fresh_engine_copy", shutil.copytree, HERE / "engine", engine) + # copytree retains readonly source directory permissions. Only this new + # private root is made writable for the original CLI certificate output. + runtime.chmod(0o755) + (runtime / "certificates").mkdir() + runtime_before = inventory(runtime, pins) + copied_engine_before = inventory(engine, ENGINE_PINS) + need(runtime_before == frozen_before and copied_engine_before == engine_before, "Copy changed input bytes or modes") + for name in ("complex_network.py", "complex_circuit.py"): + need((engine / "source" / name).read_bytes() == (runtime / "scripts" / name).read_bytes(), + "PR5929 engine/source differs from the full caller closure") + script_names = {Path(name).stem for name in pins if name.startswith("scripts/")} + engine_names = {"native_backend", "finite_controls", "compare_side_verifier", "profile_side_verifier"} + need(not (script_names | engine_names) & set(sys.modules), "Scientific module already loaded; fresh process required") + sys.path[:0] = [str(engine), str(runtime / "scripts")] + # BEGIN evaluated dispatch arguments scientific_driver:462 + _ca_args = (str(engine / 'native_backend.py'), ENGINE_PINS['native_backend.py'], 'native_backend') + _ca_kwargs = {'kind': 'backend'} + # END evaluated dispatch arguments scientific_driver:462 + # BEGIN caller admission scientific_driver:462 + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission scientific_driver:462 + backend, backend_handle = phases.call('cold_engine_import', _ca_dispatch, 0, *_ca_args, **_ca_kwargs) + # BEGIN evaluated dispatch arguments scientific_driver:465 + _ca_args = (_INITIAL_INTEGRATION_HANDLES['_h25_data_cache'], 'capture_backend_factory_environment', backend) + _ca_kwargs = {'cold_authority': _INITIAL_COLD_AUTHORITY, 'cold_caller_descriptor': _INITIAL_COLD_CALLER_DESCRIPTOR, 'backend_handle': backend_handle, 'cache_handle': _INITIAL_INTEGRATION_HANDLES['_h25_data_cache'], 'bootstrap_root': _CAPTURED_BOOTSTRAP_ROOT, 'bootstrap_capability': _CAPTURED_BOOTSTRAP_CAPABILITY, 'bootstrap_api': _CAPTURED_BOOTSTRAP_API} + # END evaluated dispatch arguments scientific_driver:465 + # BEGIN caller admission scientific_driver:465 + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission scientific_driver:465 + factory_environment = phases.call('cold_backend_factory_environment', _ca_dispatch, 1, *_ca_args, **_ca_kwargs) + comparison = importlib.import_module("compare_side_verifier") + native = None + finite = None + build = None + if args.mode == "candidate": + packet = phases.call("cold_native_metadata_build", native_packet.prepare, + ROUND, output, data_custody_before, _CAPTURED_BOOTSTRAP_ROOT, + _CAPTURED_BOOTSTRAP_CAPABILITY, _CAPTURED_BOOTSTRAP_API) + _EXECUTION['packet'] = packet + packet['controls']['native_initial_tcb'] = INITIAL_NATIVE_TCB_CONTROLS + native, build = phases.call("cold_compile_link_load", backend.build_native, output / "cold-build") + # BEGIN evaluated dispatch arguments scientific_driver:484 + _ca_args = (_INITIAL_INTEGRATION_HANDLES['guarded_adapters_v4'], 'prepare', ROUND, backend, backend_handle, native, output, args.lanes, phases, _INITIAL_COLD_AUTHORITY, _INITIAL_INTEGRATION_HANDLES['adapters'], new_custody_before) + _ca_kwargs = {'cold_caller_descriptor': _INITIAL_COLD_CALLER_DESCRIPTOR} + # END evaluated dispatch arguments scientific_driver:484 + # BEGIN caller admission scientific_driver:484 + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission scientific_driver:484 + extensions = phases.call('new_adapter_preparation', _ca_dispatch, 1, *_ca_args, **_ca_kwargs) + phases.call("all_native_metadata_and_preload_controls", native_packet.run_controls, packet, phases) + finite = phases.call("all_native_finite_independent_controls", importlib.import_module("finite_controls").run_controls, native) + phases.call("all_new_controls", adapters.run_controls, extensions, backend, native, phases) + # BEGIN evaluated dispatch arguments scientific_driver:492 + _ca_args = (_INITIAL_INTEGRATION_HANDLES['data_adapters'], 'prepare', ROUND, backend, comparison, extensions, args.data_lanes, data_custody_before, packet) + _ca_kwargs = {'authority': _INITIAL_COLD_AUTHORITY, 'cold_caller_descriptor': _INITIAL_COLD_CALLER_DESCRIPTOR, 'integration_handles': _INITIAL_INTEGRATION_HANDLES, 'backend_handle': backend_handle, 'adapters_handle': _INITIAL_INTEGRATION_HANDLES['adapters'], 'setup_handle': _INITIAL_INTEGRATION_HANDLES['guarded_adapters_v4'], 'factory_environment': factory_environment, 'preloaded_cache': (_INITIAL_INTEGRATION_MODULES['_h25_data_cache'], _INITIAL_INTEGRATION_HANDLES['_h25_data_cache'])} + # END evaluated dispatch arguments scientific_driver:492 + # BEGIN caller admission scientific_driver:492 + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = _ca_p[0], _ca_p[1], _ca_p[2] + _ca_error, _ca_value_error, _ca_zip = _ca_p[7], _ca_p[8], _ca_p[18] + _ca_dispatch, _ca_record = _ca_desc[2], _ca_desc[3] + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + # END caller admission scientific_driver:492 + data_state = phases.call('data_adapter_preparation', _ca_dispatch, 1, *_ca_args, **_ca_kwargs) + _EXECUTION['state'] = data_state + phases.call("all_data_controls", data_adapters.run_controls, + data_state, native, output, phases, HERE / "full_driver.py", candidate_inventory, extensions) + (output / "finite-controls.json").write_bytes(canonical(finite) + b"\n") + + if args.finite_only: + phases.call('terminal_native_cleanup_and_checks', data_adapters.finish_before_late, data_state) + # LAST native/scientific call. Everything below is source or receipt work. + phases.call('bootstrap_late_last', data_adapters.finish_late_last, data_state) + need(inventory(frozen, pins) == frozen_before and inventory(HERE / "engine", ENGINE_PINS) == engine_before, "Finite immutable source custody changed") + need(inventory(runtime, pins) == runtime_before and inventory(engine, ENGINE_PINS) == copied_engine_before, "Finite copied source custody changed") + need(adapters.custody(ROUND, args.lanes) == new_custody_before, "Finite new source custody changed") + need(data_adapters.custody(ROUND) == data_custody_before, "Finite data source custody changed") + result = {"status": "H25_DATA_HANDLING_FINITE_PASS", "lanes": args.data_lanes, + "data_handling": data_adapters.finite_receipt(data_state), + "data_source_custody": data_custody_before, + "optimized": sys.flags.optimize, "original_controls": finite, + "new_controls": extensions["controls"], "new_source_custody": new_custody_before, + "driver_sha256": sha(driver_before), + "initial_native_tcb": INITIAL_NATIVE_TCB_RECEIPT, + "native_packet": native_packet.receipt(packet), + "reference_driver_sha256": REFERENCE_DRIVER_SHA, "phases": phases.rows} + (output / "receipt.json").write_text(json.dumps(result, indent=2, sort_keys=True) + "\n") + print(json.dumps(result, sort_keys=True)) + return + + circuit_module = phases.call("cold_complex_module_load", backend.load_source, "complex_circuit") + sys.modules["complex_circuit"] = circuit_module + rank_calls = [] + complement = extensions["trace_type"](circuit_module.Label) + phases.call("private_set_and_data_adapter_installation", data_adapters.install_circuit, + data_state, extensions, circuit_module, comparison) + side_writer = data_adapters.scientific_writer(data_state) + binding = None + captures = {} + phases.wrap(circuit_module.ComplexSideCircuit, "__init__", "side_construction") + phases.wrap(circuit_module.Checks, "__init__", "checks_initialization") + phases.wrap(circuit_module, "compile_roles", "compile_roles") + phases.wrap(circuit_module.Checks, "verify_map", "verify_map") + phases.wrap(circuit_module.Checks, "verify_labels", "verify_labels") + original_roles = circuit_module.verify_role_frames + def observe_roles(c, checks, code=None): + need("side" not in captures and code is not None, "Unexpected role-frame invocation") + result = phases.call("verify_role_frames", original_roles, c, checks, code) + captures["side"] = (c, checks, code, result) + return result + circuit_module.verify_role_frames = observe_roles + + certify = phases.call("cold_certify_import", importlib.import_module, "certify") + phases.wrap(certify, "verify_sources", "original_upstream_verify_sources") + prepare = phases.call("cold_prepare_import", importlib.import_module, "prepare_layers") + search = importlib.import_module("search_network") + phases.wrap(search, "log_integer_bounds", "full_log_integer_bounds") + original_serializable = prepare.serializable + depth = 0 + def observe_serializable(value): + nonlocal depth + outer = depth == 0 + if outer: + need("full_return" not in captures and type(value) is dict, "Unexpected outer serialization") + captures["full_return"] = value + depth += 1 + try: + # Recursion still delegates the original serializable exactly once + # per value; only the outer call is captured/timed. + if outer: + return phases.call("original_serializable", original_serializable, value) + return original_serializable(value) + finally: + depth -= 1 + prepare.serializable = observe_serializable + + # CS/Checks/phase/trace observers are final before either new guard captures them. + binding = phases.call("final_native_binding", data_adapters.bind_native, + data_state, backend, circuit_module, native, rank_calls, complement) + phases.call("construction_lease_sealing", data_adapters.seal, data_state) + phases.call("private_set_lease_sealing", adapters.seal, extensions) + caller = runtime / "scripts/complex_network.py" + old_argv = sys.argv + stdout = io.StringIO() + try: + phases.call("final_private_environment_and_arming", data_adapters.arm, data_state, extensions) + sys.argv = [str(caller)] + with redirect_stdout(stdout): + namespace = phases.call("complete_original_cli", runpy.run_path, str(caller), run_name="__main__") + finally: + sys.argv = old_argv + adapters.disarm(extensions) + cli_stdout = stdout.getvalue() + need(cli_stdout == EXPECTED_STDOUT, "Original CLI stdout changed") + certificate_bytes = (runtime / "certificates/complex-network.json").read_bytes() + need(certificate_bytes == reference_bytes, "Original CLI certificate bytes differ from the pinned reference") + need(sys.modules["complex_circuit"] is circuit_module and + namespace["ComplexSideCircuit"] is circuit_module.ComplexSideCircuit and + namespace["Checks"] is circuit_module.Checks and namespace["compile_roles"] is circuit_module.compile_roles and + namespace["verify_role_frames"] is observe_roles and namespace["serializable"] is observe_serializable, + "Caller used a different scientific module or observation binding") + need(captures.keys() == {"side", "full_return"}, "Missing exact caller observations") + c, checks, code, role_result = captures["side"] + full_return = captures["full_return"] + need(full_return["role_frames"] is role_result and full_return["upstream_commit"] == UPSTREAM, + "Role return or actual source verification boundary changed") + for name in ("side_construction", "checks_initialization", "compile_roles", "verify_map", "verify_labels", + "verify_role_frames", "original_upstream_verify_sources", "full_log_integer_bounds", + "original_serializable", "complete_original_cli"): + need(phases.rows.get(name, {}).get("calls") == 1, "Original phase was omitted or repeated: " + name) + imports = {} + for name in script_names - {"complex_network"}: + module = sys.modules.get(name) + expected_path = engine / "source/complex_circuit.py" if name == "complex_circuit" else runtime / "scripts" / (name + ".py") + need(module is not None and Path(module.__file__).resolve() == expected_path.resolve(), "Unpinned scientific import: " + name) + imports[name] = str(module.__file__) + if binding is not None: + binding["runtime_guard"].check() + need(binding["counters"] == {"complement_native": 238685, "complement_fallback": 0, + "gram_native": 59959, "gram_fallback": 0}, "Native full-call coverage changed") + + side_result = {key: full_return[key] for key in ("circuit", "side_map", "labels", "role_frames")} + witness = { + "support": c.support, "args": c.args, "kind": c.kind, "active": sorted(c.active), + "pieces": [(target, node, (coefficient.numerator, coefficient.denominator)) for target, node, coefficient in c.pieces], + "labels": [(key, list(label.basis.items()), label.dim, label.key) for key, label in checks.cache.items()], + "code": {"roles": code["roles"], "gates": code["gates"], "sources": list(code["sources"].items()), + "outputs": list(code["outputs"].items())}, + } + side_output = output / "side-observations" + side_output.mkdir() + side_receipt = phases.call("identical_lossless_side_serialization", side_writer, + side_output, side_result, witness, rank_calls) + complement_receipt = complement.receipt() + need(complement_receipt == COMPLEMENT_EXPECTED, "Every ordered complement observation must match PR5929") + full_typed_bytes = canonical(typed(full_return)) + (output / "full-return.lossless.json").write_bytes(full_typed_bytes) + (output / "original-stdout.txt").write_text(cli_stdout, encoding="utf-8") + (output / "complement-transcript.json").write_bytes(canonical(complement_receipt) + b"\n") + science = { + "full_cli_certificate_sha256": sha(certificate_bytes), "full_cli_stdout_sha256": sha(cli_stdout.encode("utf-8")), + "full_return_lossless_sha256": sha(full_typed_bytes), "side": side_receipt, + "ordered_complements": complement_receipt, "upstream_commit": UPSTREAM, + } + anchor = {"schema": "gf2-full-network-anchor-v1", "base_commit": BASE, "source_pin_sha256": PIN_SHA, + "driver_sha256": REFERENCE_DRIVER_SHA, "engine_pins": ENGINE_PINS, "science": science} + if expected_anchor is not None: + need(anchor == expected_anchor, "Complete certificate/types/ordered observations differ from frozen anchor") + else: + (output / "anchor.json").write_bytes(canonical(anchor) + b"\n") + need(inventory(frozen, pins) == frozen_before and inventory(HERE / "engine", ENGINE_PINS) == engine_before, + "Immutable source bytes/modes changed") + need(inventory(runtime, pins, exact=False) == runtime_before and inventory(engine, ENGINE_PINS) == copied_engine_before, + "Runtime scientific source bytes/modes changed") + runtime_files = {str(path.relative_to(runtime)) for path in runtime.rglob("*") if path.is_file()} + need(runtime_files == set(pins) | {"certificates/complex-network.json"}, "Unexpected full-caller file side effect") + need(Path(__file__).read_bytes() == driver_before and reference.read_bytes() == reference_bytes and + (anchor_bytes is None or args.anchor.read_bytes() == anchor_bytes), "Driver/reference/anchor changed during run") + need(adapters.custody(ROUND, args.lanes) == new_custody_before, "New source custody changed") + # Snapshot final scientific bookkeeping before the deliberately terminal late hook. + bookkeeping_receipt = adapters.receipt(extensions) + data_receipt = phases.call("data_finalization", data_adapters.finish, data_state, binding) + phases.call('terminal_native_cleanup_and_checks', data_adapters.finish_before_late, data_state) + # LAST native/scientific call. No owner, root API, provider, or native guard follows. + phases.call('bootstrap_late_last', data_adapters.finish_late_last, data_state) + # Honest source custody and receipt work continue after the terminal boundary. + need(data_adapters.custody(ROUND) == data_custody_before, "Data source custody changed") + need(adapters.custody(ROUND, args.lanes) == new_custody_before, "Post-late original source custody changed") + need(inventory(frozen, pins) == frozen_before and inventory(HERE / "engine", ENGINE_PINS) == engine_before, + "Post-late immutable source custody changed") + need(inventory(runtime, pins, exact=False) == runtime_before and inventory(engine, ENGINE_PINS) == copied_engine_before, + "Post-late copied source custody changed") + need(Path(__file__).read_bytes() == driver_before and reference.read_bytes() == reference_bytes and + (anchor_bytes is None or args.anchor.read_bytes() == anchor_bytes), "Post-late driver/reference/anchor changed") + receipt = { + "new_source_custody": new_custody_before, + "status": "FULL_NETWORK_PROFILE_ANCHOR_PASS" if args.mode == "profile" else "FULL_NETWORK_COMPLETE_PASS", + "mode": args.mode, "lanes": args.data_lanes, "bookkeeping": bookkeeping_receipt, + "data_handling": data_receipt, "data_source_custody": data_custody_before, + "reference_driver_sha256": REFERENCE_DRIVER_SHA, + "science": science, "base_commit": BASE, "native_predecessor_pr": 5995, + "driver_sha256": sha(driver_before), "source_pin_sha256": PIN_SHA, + "frozen_custody": frozen_before, "engine_custody": engine_before, "scientific_imports": imports, + "build": build, "finite_controls": finite, + "initial_native_tcb": INITIAL_NATIVE_TCB_RECEIPT, + "native_packet": native_packet.receipt(packet), + "private_root_permission": "runtime-root is0755; copied input file modes are retained and checked; immutable stages are never chmodded", + "compiler_tmpdir": str(compiler_tmp), + "native_calls": None if binding is None else dict(binding["counters"]), + "phases": phases.rows, "driver_wall_seconds_after_initial_tcb_before_receipt": time.perf_counter() - START_WALL, + "process_and_compiler_cpu_seconds_before_receipt": cpu(), + "environment": {"python": sys.version, "executable": sys.executable, "platform": sys.platform}, + "measurement": "Parent outer guard is authoritative and includes pristine root startup, initial native TCB authentication, early cold source authority capture and every factory dependency/product check, three cold metadata compilations plus original cold native/trace builds, every old and new control in BOTH arms, all candidate production admission/guards, IO and terminal cleanup. Baseline receives the complete same control union. Driver wall diagnostic starts after initial TCB and cold authority capture and is not total process wall. Broad phase samples are nested, not additive; VmRSS is current RSS and ru_maxrss is process high-water. Eager witnesses and original observations remain; full funding and equality gates are separate and currently closed.", + "scope": "Complete frozen historical complex-network CLI with retained observations; conditional certificate only. No bare-CLI factor, selected-frontier, new kappa or PR5864 speed claim.", + } + (output / "receipt.json").write_text(json.dumps(receipt, indent=2, sort_keys=True) + "\n") + sys.stdout.write(cli_stdout) + print(json.dumps({"status": receipt["status"], "mode": args.mode, "science": science, + "wall_seconds": receipt["driver_wall_seconds_after_initial_tcb_before_receipt"], + "cpu_seconds_with_compiler": receipt["process_and_compiler_cpu_seconds_before_receipt"], + "phases": phases.rows}, sort_keys=True)) + + +def _run_with_stop_evidence(): + try: + main() + except BaseException as primary_error: + # Nothing in cleanup or evidence assembly may replace this primary object. + try: + state = _EXECUTION['state'] + cleanup_errors = [] + try: + cleanup_errors = data_adapters.cleanup_owned(state) + except BaseException as cleanup_error: + cleanup_errors.append({'type': type(cleanup_error).__name__, 'message': str(cleanup_error)}) + stop = {'schema': 'h25-combined-v2-stop-v1', 'status': 'STOP', + 'primary_error': {'type': type(primary_error).__name__, 'message': str(primary_error)}, + 'primary_cause': None if primary_error.__cause__ is None else { + 'type': type(primary_error.__cause__).__name__, 'message': str(primary_error.__cause__)}, + 'cleanup_errors': cleanup_errors, + 'data': data_adapters.stop_diagnostics(state), + 'native_packet': None if _EXECUTION['packet'] is None else native_packet.receipt(_EXECUTION['packet']), + 'initial_native_tcb': INITIAL_NATIVE_TCB_RECEIPT} + output = _EXECUTION['output'] + if output is not None: + with (output / 'STOP.json').open('x', encoding='utf-8') as stream: + stream.write(json.dumps(stop, sort_keys=True, indent=2) + '\n') + except BaseException as evidence_error: + # Parent retains an independent process transcript even if this fails. + try: + sys.stderr.write('STOP evidence write failed: ' + type(evidence_error).__name__ + '\n') + except BaseException: + pass + raise + + + + +def _epoch_cli_boundary(phases, data_state, extensions, caller, stdout, invocation_token, old_argv): + _epoch_cli_primary = None + _epoch_cli_argv_error = None + _epoch_cli_disarm_error = None + _epoch_cli_retirement_error = None + _epoch_cli_record = None + try: + try: + _epoch_cli_record = {'primary': None, 'argv_error': None, 'disarm_error': None, 'retirement_error': None, 'outer_retirement_error': None, 'uncertain': False, 'argv_owner': old_argv, 'retirement_channel': {'started': False, 'error': None, 'journal_error': None, 'acknowledged': False}, 'outer_retirement_channel': {'started': False, 'error': None, 'journal_error': None, 'acknowledged': False}} + data_state['epoch_cli_cleanup'] = _epoch_cli_record + phases.call('final_private_environment_and_arming', data_adapters.arm, data_state, extensions) + if data_state['enabled']: + data_adapters.epoch_arm(data_state, invocation_token) + sys.argv = [str(caller)] + with redirect_stdout(stdout): + namespace = phases.call('complete_original_cli', runpy.run_path, str(caller), run_name='__main__') + return namespace + except BaseException as _epoch_cli_error: + _epoch_cli_primary = _epoch_cli_error + if _epoch_cli_record is not None: + _epoch_cli_record['primary'] = _epoch_cli_error + raise + finally: + try: + sys.argv = old_argv + except BaseException as _epoch_argv_error: + _epoch_cli_argv_error = _epoch_argv_error + if _epoch_cli_record is not None: + _epoch_cli_record['argv_error'] = _epoch_argv_error + _epoch_cli_record['uncertain'] = True + if _epoch_cli_primary is None: + _epoch_cli_primary = _epoch_argv_error + if _epoch_cli_record is not None: + _epoch_cli_record['primary'] = _epoch_argv_error + try: + adapters.disarm(extensions) + except BaseException as _epoch_disarm_error: + _epoch_cli_disarm_error = _epoch_disarm_error + if _epoch_cli_record is not None: + _epoch_cli_record['disarm_error'] = _epoch_disarm_error + _epoch_cli_record['uncertain'] = True + if _epoch_cli_primary is None: + _epoch_cli_primary = _epoch_disarm_error + if _epoch_cli_record is not None: + _epoch_cli_record['primary'] = _epoch_disarm_error + raise + if _epoch_cli_argv_error is not None: + raise _epoch_cli_primary + finally: + try: + data_adapters.epoch_retire(data_state, 'whole-cli-terminal', _epoch_cli_primary, _epoch_cli_disarm_error, _epoch_cli_argv_error, None if _epoch_cli_record is None else _epoch_cli_record['retirement_channel'], 'inner') + except BaseException as _epoch_retirement_error: + _epoch_cli_retirement_error = _epoch_retirement_error + if _epoch_cli_record is not None: + _epoch_cli_record['retirement_error'] = _epoch_retirement_error + _epoch_cli_record['uncertain'] = True + if _epoch_cli_primary is None: + _epoch_cli_primary = _epoch_retirement_error + if _epoch_cli_record is not None: + _epoch_cli_record['primary'] = _epoch_retirement_error + raise + +def main_epoch(): + _epoch_invocation = object() + _epoch_driver_origin = data_adapters.epoch_driver_entry(_INITIAL_COLD_AUTHORITY, _INITIAL_COLD_CALLER_DESCRIPTOR, _INITIAL_EPOCH_BUNDLE[3], main_epoch, Phases, _epoch_invocation) + data_state = None + _epoch_primary = None + _epoch_outer_retirement_error = None + _epoch_outer_cleanup = None + try: + _epoch_outer_cleanup = {'primary': None, 'retirement_error': None, 'uncertain': False, 'attempted': False} + _EXECUTION['epoch_outer_cleanup'] = _epoch_outer_cleanup + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--frozen-root', type=Path, default=HERE / 'frozen') + parser.add_argument('--reference', type=Path, default=HERE / 'reference/certificates/complex-network.json') + parser.add_argument('--lanes', choices=('baseline', 'candidate'), required=True) + parser.add_argument('--finite-only', action='store_true') + parser.add_argument('--output', type=Path, required=True, help='New external directory; every write stays below it') + parser.add_argument('--anchor', type=Path, default=HERE / 'anchor.json') + args = parser.parse_args() + args.data_lanes = args.lanes + args.lanes = 'all' + if args.data_lanes == 'transport': + need(args.frozen_root == HERE / 'frozen' and args.reference == HERE / 'reference/certificates/complex-network.json' and (args.anchor == HERE / 'anchor.json'), 'Transport uses only the original fixed historical inputs') + data_adapters.transport(ROUND, HERE, args.output) + return + inventory = candidate_inventory if args.data_lanes == 'candidate' else original_inventory + args.mode = 'candidate'; _g12_selected_args(args) + need(args.finite_only or sys.flags.optimize == 0, 'Every full-caller mode requires original assertions') + need(sys.implementation.name == 'cpython' and sys.version_info[:2] == (3, 12), 'Frozen CPython 3.12 required') + data_adapters.require_execution_contract(args.data_lanes, args.finite_only) + need((args.mode == 'profile') == (args.anchor is None), 'Profile creates the anchor; both benchmark arms require --anchor') + frozen, reference = (args.frozen_root.resolve(), args.reference.resolve()) + output = args.output.resolve() + need(str(output) == _INITIAL_OUTPUT and output.is_dir() and (not output.is_symlink()) and ({path.name for path in output.iterdir()} == {'initial-tcb-controls'}) and (output / 'initial-tcb-controls').is_dir() and (not (output / 'initial-tcb-controls').is_symlink()) and (not list((output / 'initial-tcb-controls').iterdir())), 'Early TCB output ownership or fresh control directory changed') + need(not output.is_relative_to(HERE) and (not output.is_relative_to(frozen)), 'Output must be outside immutable sources') + need(reference.is_file() and (not reference.is_symlink()), 'Reference certificate missing or symlinked') + source_pin_bytes = (HERE / 'SOURCE-PINS.json').read_bytes() + need(sha(source_pin_bytes) == PIN_SHA, 'Source inventory pin changed') + pins = json.loads(source_pin_bytes) + need(len(pins) == 32, 'Frozen closure must contain twelve scripts, manifest and nineteen payloads') + reference_bytes = reference.read_bytes() + need(sha(reference_bytes) == REFERENCE_SHA, 'Original full certificate reference changed') + driver_before = Path(__file__).read_bytes() + new_custody_before = adapters.custody(ROUND, args.lanes) + data_custody_before = data_adapters.custody(ROUND) + reference_driver_before = (HERE / 'full_driver.py').read_bytes() + need(sha(reference_driver_before) == REFERENCE_DRIVER_SHA, 'Reference driver pin changed') + anchor_bytes = None if args.anchor is None else args.anchor.read_bytes() + expected_anchor = None if anchor_bytes is None else json.loads(anchor_bytes) + if expected_anchor is not None: + need(expected_anchor.get('schema') == 'gf2-full-network-anchor-v1' and expected_anchor.get('base_commit') == BASE and (expected_anchor.get('source_pin_sha256') == PIN_SHA) and (expected_anchor.get('driver_sha256') == REFERENCE_DRIVER_SHA) and (expected_anchor.get('engine_pins') == ENGINE_PINS), 'Anchor source/driver/engine identity differs; no benchmark permitted') + _EXECUTION['output'] = output + compiler_tmp = output / 'compiler-tmp' + compiler_tmp.mkdir() + os.environ['TMPDIR'] = str(compiler_tmp) + phases = Phases() + (output / 'initial-native-tcb.json').write_bytes(canonical(INITIAL_NATIVE_TCB_RECEIPT) + b'\n') + (output / 'initial-tcb-controls' / 'receipt.json').write_bytes(canonical(INITIAL_NATIVE_TCB_CONTROLS) + b'\n') + frozen_before = phases.call('input_custody', inventory, frozen, pins) + engine_before = phases.call('engine_custody', inventory, HERE / 'engine', ENGINE_PINS) + manifest = json.loads((frozen / 'upstream/manifest.json').read_bytes()) + need(manifest['commit'] == UPSTREAM and len(manifest['files']) == 19, 'Wrong pinned upstream manifest') + need({'upstream/' + name for name in manifest['files']} == {name for name in pins if name.startswith('upstream/') and name != 'upstream/manifest.json'}, 'Source verifier payload closure changed') + for name, info in manifest['files'].items(): + need(info['sha256'] == pins['upstream/' + name][0], 'Manifest payload hash differs from independent frozen pin') + runtime, engine = (output / 'runtime-root', output / 'engine') + phases.call('fresh_root_copy', shutil.copytree, frozen, runtime) + phases.call('fresh_engine_copy', shutil.copytree, HERE / 'engine', engine) + runtime.chmod(493) + (runtime / 'certificates').mkdir() + runtime_before = inventory(runtime, pins) + copied_engine_before = inventory(engine, ENGINE_PINS) + need(runtime_before == frozen_before and copied_engine_before == engine_before, 'Copy changed input bytes or modes') + for name in ('complex_network.py', 'complex_circuit.py'): + need((engine / 'source' / name).read_bytes() == (runtime / 'scripts' / name).read_bytes(), 'PR5929 engine/source differs from the full caller closure') + script_names = {Path(name).stem for name in pins if name.startswith('scripts/')} + engine_names = {'native_backend', 'finite_controls', 'compare_side_verifier', 'profile_side_verifier'} + need(not (script_names | engine_names) & set(sys.modules), 'Scientific module already loaded; fresh process required') + sys.path[:0] = [str(engine), str(runtime / 'scripts')] + _ca_args = (str(engine / 'native_backend.py'), ENGINE_PINS['native_backend.py'], 'native_backend') + _ca_kwargs = {'kind': 'backend'} + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + backend, backend_handle = phases.call('cold_engine_import', _ca_dispatch, 0, *_ca_args, **_ca_kwargs) + _ca_args = (_INITIAL_INTEGRATION_HANDLES['_h25_data_cache'], 'capture_backend_factory_environment', backend) + _ca_kwargs = {'cold_authority': _INITIAL_COLD_AUTHORITY, 'cold_caller_descriptor': _INITIAL_COLD_CALLER_DESCRIPTOR, 'backend_handle': backend_handle, 'cache_handle': _INITIAL_INTEGRATION_HANDLES['_h25_data_cache'], 'bootstrap_root': _CAPTURED_BOOTSTRAP_ROOT, 'bootstrap_capability': _CAPTURED_BOOTSTRAP_CAPABILITY, 'bootstrap_api': _CAPTURED_BOOTSTRAP_API} + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + factory_environment = phases.call('cold_backend_factory_environment', _ca_dispatch, 1, *_ca_args, **_ca_kwargs) + comparison = importlib.import_module('compare_side_verifier') + native = None + finite = None + build = None + if args.mode == 'candidate': + packet = phases.call('cold_native_metadata_build', native_packet.prepare, ROUND, output, data_custody_before, _CAPTURED_BOOTSTRAP_ROOT, _CAPTURED_BOOTSTRAP_CAPABILITY, _CAPTURED_BOOTSTRAP_API) + _EXECUTION['packet'] = packet + packet['controls']['native_initial_tcb'] = INITIAL_NATIVE_TCB_CONTROLS + native, build = phases.call('cold_compile_link_load', backend.build_native, output / 'cold-build') + _ca_args = (_INITIAL_INTEGRATION_HANDLES['guarded_adapters_v4'], 'prepare', ROUND, backend, backend_handle, native, output, args.lanes, phases, _INITIAL_COLD_AUTHORITY, _INITIAL_INTEGRATION_HANDLES['adapters'], new_custody_before) + _ca_kwargs = {'cold_caller_descriptor': _INITIAL_COLD_CALLER_DESCRIPTOR} + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + extensions = phases.call('new_adapter_preparation', _ca_dispatch, 1, *_ca_args, **_ca_kwargs) + phases.call('all_native_metadata_and_preload_controls', native_packet.run_controls, packet, phases) + finite = phases.call('all_native_finite_independent_controls', importlib.import_module('finite_controls').run_controls, native) + phases.call('all_new_controls', adapters.run_controls, extensions, backend, native, phases) + _ca_args = (_INITIAL_INTEGRATION_HANDLES['data_adapters'], 'prepare', ROUND, backend, comparison, extensions, args.data_lanes, data_custody_before, packet) + _ca_kwargs = {'authority': _INITIAL_COLD_AUTHORITY, 'cold_caller_descriptor': _INITIAL_COLD_CALLER_DESCRIPTOR, 'integration_handles': _INITIAL_INTEGRATION_HANDLES, 'backend_handle': backend_handle, 'adapters_handle': _INITIAL_INTEGRATION_HANDLES['adapters'], 'setup_handle': _INITIAL_INTEGRATION_HANDLES['guarded_adapters_v4'], 'factory_environment': factory_environment, 'preloaded_cache': (_INITIAL_INTEGRATION_MODULES['_h25_data_cache'], _INITIAL_INTEGRATION_HANDLES['_h25_data_cache'])} + _ca_desc = _INITIAL_COLD_CALLER_DESCRIPTOR + _ca_p = _ca_desc[5] + _ca_type, _ca_function, _ca_id = (_ca_p[0], _ca_p[1], _ca_p[2]) + _ca_error, _ca_value_error, _ca_zip = (_ca_p[7], _ca_p[8], _ca_p[18]) + _ca_dispatch, _ca_record = (_ca_desc[2], _ca_desc[3]) + if _INITIAL_COLD_AUTHORITY is not _ca_desc[1] or _ca_dispatch is not _ca_record[0] or _ca_type(_ca_dispatch) is not _ca_function: + raise _ca_error('Cold authority caller dispatcher identity differs') + for (_ca_name, _ca_getter), _ca_expected in _ca_zip(_ca_p[4], _ca_record[1:7]): + if _ca_id(_ca_getter(_ca_dispatch, _ca_function)) != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher environment differs') + if _ca_record[4] is not None or _ca_record[5] is not None or _ca_record[7]: + raise _ca_error('Cold authority caller dispatcher defaults contract differs') + for _ca_cell, _ca_expected in _ca_record[8]: + try: + _ca_observed_id = _ca_id(_ca_p[6](_ca_cell, _ca_p[5])) + except _ca_value_error: + raise _ca_error('Cold authority caller dispatcher cell became empty') from None + if _ca_observed_id != _ca_id(_ca_expected): + raise _ca_error('Cold authority caller dispatcher cell differs') + data_state = phases.call('data_adapter_preparation', _ca_dispatch, 1, *_ca_args, **_ca_kwargs) + _EXECUTION['state'] = data_state + phases.call('all_data_controls', data_adapters.run_controls, data_state, native, output, phases, HERE / 'full_driver.py', candidate_inventory, extensions) + (output / 'finite-controls.json').write_bytes(canonical(finite) + b'\n') + if args.finite_only: + phases.call('terminal_native_cleanup_and_checks', data_adapters.finish_before_late, data_state) + phases.call('bootstrap_late_last', data_adapters.finish_late_last, data_state) + need(inventory(frozen, pins) == frozen_before and inventory(HERE / 'engine', ENGINE_PINS) == engine_before, 'Finite immutable source custody changed') + need(inventory(runtime, pins) == runtime_before and inventory(engine, ENGINE_PINS) == copied_engine_before, 'Finite copied source custody changed') + need(adapters.custody(ROUND, args.lanes) == new_custody_before, 'Finite new source custody changed') + need(data_adapters.custody(ROUND) == data_custody_before, 'Finite data source custody changed') + result = {'status': 'H25_DATA_HANDLING_FINITE_PASS', 'lanes': args.data_lanes, 'data_handling': data_adapters.finite_receipt(data_state), 'data_source_custody': data_custody_before, 'optimized': sys.flags.optimize, 'original_controls': finite, 'new_controls': extensions['controls'], 'new_source_custody': new_custody_before, 'driver_sha256': sha(driver_before), 'initial_native_tcb': INITIAL_NATIVE_TCB_RECEIPT, 'native_packet': native_packet.receipt(packet), 'reference_driver_sha256': REFERENCE_DRIVER_SHA, 'phases': phases.rows} + (output / 'receipt.json').write_text(json.dumps(result, indent=2, sort_keys=True) + '\n') + print(json.dumps(result, sort_keys=True)) + return + if data_state['enabled']: + circuit_module, _epoch_load_ticket = phases.call('cold_complex_module_load', data_adapters.epoch_load, data_state, _INITIAL_EPOCH_BUNDLE[3]) + else: + circuit_module = phases.call('cold_complex_module_load', backend.load_source, 'complex_circuit') + sys.modules['complex_circuit'] = circuit_module + rank_calls = [] + complement = extensions['trace_type'](circuit_module.Label) + if data_state['enabled']: + _epoch_context = {'data_handle': _INITIAL_INTEGRATION_HANDLES['data_adapters'], 'data_module': data_adapters, 'phase_function': Phases.wrap, 'phase_class': Phases, 'phase_owner': phases, 'driver_function': main_epoch, 'driver_record': _epoch_driver_origin, 'invocation_token': _epoch_invocation, 'disposition_state': data_state} + phases.call('private_set_and_data_adapter_installation', data_adapters.install_epoch_circuit, data_state, extensions, circuit_module, comparison, _INITIAL_EPOCH_BUNDLE[3], _epoch_load_ticket, _epoch_context) + else: + phases.call('private_set_and_data_adapter_installation', data_adapters.install_circuit, data_state, extensions, circuit_module, comparison) + side_writer = data_adapters.scientific_writer(data_state) + binding = None + captures = {} + if data_state['enabled']: + data_adapters.epoch_phase_wrap(data_state, phases, 'circuit', circuit_module.ComplexSideCircuit, '__init__', 'side_construction') + else: + phases.wrap(circuit_module.ComplexSideCircuit, '__init__', 'side_construction') + if data_state['enabled']: + _g12_checks_pair = data_adapters.epoch_phase_wrap(data_state, phases, 'checks', circuit_module.Checks, '__init__', 'checks_initialization') + else: + phases.wrap(circuit_module.Checks, '__init__', 'checks_initialization') + if data_state['enabled']: + _g12_code_pair = data_adapters.epoch_phase_wrap(data_state, phases, 'module', circuit_module, 'compile_roles', 'compile_roles') + else: + phases.wrap(circuit_module, 'compile_roles', 'compile_roles') + if data_state['enabled']: + data_adapters.epoch_phase_wrap(data_state, phases, 'checks', circuit_module.Checks, 'verify_map', 'verify_map') + else: + phases.wrap(circuit_module.Checks, 'verify_map', 'verify_map') + if data_state['enabled']: + _g12_label_pair = data_adapters.epoch_phase_wrap(data_state, phases, 'checks', circuit_module.Checks, 'verify_labels', 'verify_labels') + else: + phases.wrap(circuit_module.Checks, 'verify_labels', 'verify_labels') + original_roles = circuit_module.verify_role_frames + + def observe_roles(c, checks, code=None): + need('side' not in captures and code is not None, 'Unexpected role-frame invocation') + result = phases.call('verify_role_frames', original_roles, c, checks, code) + captures['side'] = (c, checks, code, result) + return result + if data_state['enabled']: + data_adapters.epoch_role_observer(data_state, observe_roles) + else: + circuit_module.verify_role_frames = observe_roles + certify = phases.call('cold_certify_import', importlib.import_module, 'certify') + phases.wrap(certify, 'verify_sources', 'original_upstream_verify_sources') + prepare = phases.call('cold_prepare_import', importlib.import_module, 'prepare_layers') + search = importlib.import_module('search_network') + phases.wrap(search, 'log_integer_bounds', 'full_log_integer_bounds') + original_serializable = prepare.serializable + depth = 0 + + def observe_serializable(value): + nonlocal depth + outer = depth == 0 + if outer: + need('full_return' not in captures and type(value) is dict, 'Unexpected outer serialization') + captures['full_return'] = value + depth += 1 + try: + if outer: + return phases.call('original_serializable', original_serializable, value) + return original_serializable(value) + finally: + depth -= 1 + prepare.serializable = observe_serializable + binding = phases.call('final_native_binding', data_adapters.bind_epoch_native if data_state['enabled'] else data_adapters.bind_native, data_state, backend, circuit_module, native, rank_calls, complement) + phases.call('construction_lease_sealing', data_adapters.seal, data_state) + phases.call('private_set_lease_sealing', adapters.seal, extensions) + if data_state['enabled']: + data_adapters.epoch_seal(data_state) + caller = runtime / 'scripts/complex_network.py' + old_argv = sys.argv + stdout = io.StringIO(); _g12_bind_locals(data_state, extensions, circuit_module, binding, phases, _epoch_invocation, _g12_checks_pair, _g12_code_pair, _g12_label_pair, caller, rank_calls, complement, captures, stdout, frozen, runtime, engine, output, reference, reference_bytes, driver_before, pins, frozen_before, engine_before, runtime_before, copied_engine_before, script_names, new_custody_before, data_custody_before, args.anchor, anchor_bytes) + namespace = _epoch_cli_boundary(phases, data_state, extensions, caller, stdout, _epoch_invocation, old_argv) + cli_stdout = stdout.getvalue() + need(cli_stdout == EXPECTED_STDOUT, 'Original CLI stdout changed') + certificate_bytes = (runtime / 'certificates/complex-network.json').read_bytes() + need(certificate_bytes == reference_bytes, 'Original CLI certificate bytes differ from the pinned reference') + need(sys.modules['complex_circuit'] is circuit_module and namespace['ComplexSideCircuit'] is circuit_module.ComplexSideCircuit and (namespace['Checks'] is circuit_module.Checks) and (namespace['compile_roles'] is circuit_module.compile_roles) and (namespace['verify_role_frames'] is observe_roles) and (namespace['serializable'] is observe_serializable), 'Caller used a different scientific module or observation binding') + need(captures.keys() == {'side', 'full_return'}, 'Missing exact caller observations') + c, checks, code, role_result = captures['side'] + full_return = captures['full_return'] + need(full_return['role_frames'] is role_result and full_return['upstream_commit'] == UPSTREAM, 'Role return or actual source verification boundary changed') + for name in ('side_construction', 'checks_initialization', 'compile_roles', 'verify_map', 'verify_labels', 'verify_role_frames', 'original_upstream_verify_sources', 'full_log_integer_bounds', 'original_serializable', 'complete_original_cli'): + need(phases.rows.get(name, {}).get('calls') == 1, 'Original phase was omitted or repeated: ' + name) + imports = {} + for name in script_names - {'complex_network'}: + module = sys.modules.get(name) + expected_path = engine / 'source/complex_circuit.py' if name == 'complex_circuit' else runtime / 'scripts' / (name + '.py') + need(module is not None and Path(module.__file__).resolve() == expected_path.resolve(), 'Unpinned scientific import: ' + name) + imports[name] = str(module.__file__) + if binding is not None: + binding['runtime_guard'].check() + need(binding['counters'] == {'complement_native': 238685, 'complement_fallback': 0, 'gram_native': 59959, 'gram_fallback': 0}, 'Native full-call coverage changed') + side_result = {key: full_return[key] for key in ('circuit', 'side_map', 'labels', 'role_frames')} + witness = {'support': c.support, 'args': c.args, 'kind': c.kind, 'active': sorted(c.active), 'pieces': [(target, node, (coefficient.numerator, coefficient.denominator)) for target, node, coefficient in c.pieces], 'labels': [(key, list(label.basis.items()), label.dim, label.key) for key, label in checks.cache.items()], 'code': {'roles': code['roles'], 'gates': code['gates'], 'sources': list(code['sources'].items()), 'outputs': list(code['outputs'].items())}} + side_output = output / 'side-observations' + side_output.mkdir() + side_receipt = phases.call('identical_lossless_side_serialization', side_writer, side_output, side_result, witness, rank_calls) + complement_receipt = complement.receipt() + need(complement_receipt == COMPLEMENT_EXPECTED, 'Every ordered complement observation must match PR5929') + full_typed_bytes = canonical(typed(full_return)) + (output / 'full-return.lossless.json').write_bytes(full_typed_bytes) + (output / 'original-stdout.txt').write_text(cli_stdout, encoding='utf-8') + (output / 'complement-transcript.json').write_bytes(canonical(complement_receipt) + b'\n') + science = {'full_cli_certificate_sha256': sha(certificate_bytes), 'full_cli_stdout_sha256': sha(cli_stdout.encode('utf-8')), 'full_return_lossless_sha256': sha(full_typed_bytes), 'side': side_receipt, 'ordered_complements': complement_receipt, 'upstream_commit': UPSTREAM} + anchor = {'schema': 'gf2-full-network-anchor-v1', 'base_commit': BASE, 'source_pin_sha256': PIN_SHA, 'driver_sha256': REFERENCE_DRIVER_SHA, 'engine_pins': ENGINE_PINS, 'science': science} + if expected_anchor is not None: + need(anchor == expected_anchor, 'Complete certificate/types/ordered observations differ from frozen anchor') + else: + (output / 'anchor.json').write_bytes(canonical(anchor) + b'\n') + need(inventory(frozen, pins) == frozen_before and inventory(HERE / 'engine', ENGINE_PINS) == engine_before, 'Immutable source bytes/modes changed') + need(inventory(runtime, pins, exact=False) == runtime_before and inventory(engine, ENGINE_PINS) == copied_engine_before, 'Runtime scientific source bytes/modes changed') + runtime_files = {str(path.relative_to(runtime)) for path in runtime.rglob('*') if path.is_file()} + need(runtime_files == set(pins) | {'certificates/complex-network.json'}, 'Unexpected full-caller file side effect') + need(Path(__file__).read_bytes() == driver_before and reference.read_bytes() == reference_bytes and (anchor_bytes is None or args.anchor.read_bytes() == anchor_bytes), 'Driver/reference/anchor changed during run') + need(adapters.custody(ROUND, args.lanes) == new_custody_before, 'New source custody changed') + bookkeeping_receipt = adapters.receipt(extensions) + data_receipt = phases.call('data_finalization', data_adapters.finish, data_state, binding) + phases.call('terminal_native_cleanup_and_checks', data_adapters.finish_before_late, data_state) + phases.call('bootstrap_late_last', data_adapters.finish_late_last, data_state) + need(data_adapters.custody(ROUND) == data_custody_before, 'Data source custody changed') + need(adapters.custody(ROUND, args.lanes) == new_custody_before, 'Post-late original source custody changed') + need(inventory(frozen, pins) == frozen_before and inventory(HERE / 'engine', ENGINE_PINS) == engine_before, 'Post-late immutable source custody changed') + need(inventory(runtime, pins, exact=False) == runtime_before and inventory(engine, ENGINE_PINS) == copied_engine_before, 'Post-late copied source custody changed') + need(Path(__file__).read_bytes() == driver_before and reference.read_bytes() == reference_bytes and (anchor_bytes is None or args.anchor.read_bytes() == anchor_bytes), 'Post-late driver/reference/anchor changed') + receipt = {'new_source_custody': new_custody_before, 'status': 'FULL_NETWORK_PROFILE_ANCHOR_PASS' if args.mode == 'profile' else 'FULL_NETWORK_COMPLETE_PASS', 'mode': args.mode, 'lanes': args.data_lanes, 'bookkeeping': bookkeeping_receipt, 'data_handling': data_receipt, 'data_source_custody': data_custody_before, 'reference_driver_sha256': REFERENCE_DRIVER_SHA, 'science': science, 'base_commit': BASE, 'native_predecessor_pr': 5995, 'driver_sha256': sha(driver_before), 'source_pin_sha256': PIN_SHA, 'frozen_custody': frozen_before, 'engine_custody': engine_before, 'scientific_imports': imports, 'build': build, 'finite_controls': finite, 'initial_native_tcb': INITIAL_NATIVE_TCB_RECEIPT, 'native_packet': native_packet.receipt(packet), 'private_root_permission': 'runtime-root is0755; copied input file modes are retained and checked; immutable stages are never chmodded', 'compiler_tmpdir': str(compiler_tmp), 'native_calls': None if binding is None else dict(binding['counters']), 'phases': phases.rows, 'driver_wall_seconds_after_initial_tcb_before_receipt': time.perf_counter() - START_WALL, 'process_and_compiler_cpu_seconds_before_receipt': cpu(), 'environment': {'python': sys.version, 'executable': sys.executable, 'platform': sys.platform}, 'measurement': 'Parent outer guard is authoritative and includes pristine root startup, initial native TCB authentication, early cold source authority capture and every factory dependency/product check, three cold metadata compilations plus original cold native/trace builds, every old and new control in BOTH arms, all candidate production admission/guards, IO and terminal cleanup. Baseline receives the complete same control union. Driver wall diagnostic starts after initial TCB and cold authority capture and is not total process wall. Broad phase samples are nested, not additive; VmRSS is current RSS and ru_maxrss is process high-water. Eager witnesses and original observations remain; full funding and equality gates are separate and currently closed.', 'scope': 'Complete frozen historical complex-network CLI with retained observations; conditional certificate only. No bare-CLI factor, selected-frontier, new kappa or PR5864 speed claim.'} + (output / 'receipt.json').write_text(json.dumps(receipt, indent=2, sort_keys=True) + '\n') + sys.stdout.write(cli_stdout) + print(json.dumps({'status': receipt['status'], 'mode': args.mode, 'science': science, 'wall_seconds': receipt['driver_wall_seconds_after_initial_tcb_before_receipt'], 'cpu_seconds_with_compiler': receipt['process_and_compiler_cpu_seconds_before_receipt'], 'phases': phases.rows}, sort_keys=True)) + except BaseException as _epoch_error: + _epoch_primary = _epoch_error + if _epoch_outer_cleanup is not None: + _epoch_outer_cleanup['primary'] = _epoch_error + raise + finally: + try: + if _epoch_outer_cleanup is not None: + _epoch_outer_cleanup['attempted'] = True + data_adapters.epoch_retire(data_state, 'whole-cli-terminal', _epoch_primary, None, None, None, 'outer') + except BaseException as _epoch_outer_error: + _epoch_outer_retirement_error = _epoch_outer_error + if _epoch_outer_cleanup is not None: + _epoch_outer_cleanup['retirement_error'] = _epoch_outer_error + _epoch_outer_cleanup['uncertain'] = True + if _epoch_primary is None: + _epoch_primary = _epoch_outer_error + if _epoch_outer_cleanup is not None: + _epoch_outer_cleanup['primary'] = _epoch_outer_error + raise + +def _run_epoch_with_stop_evidence(): + try: + main_epoch() + except BaseException as primary_error: + try: + state = _EXECUTION['state'] + cleanup_errors = [] + try: + cleanup_errors = data_adapters.epoch_cleanup_owned(state) + except BaseException as cleanup_error: + cleanup_errors.append({'type': type(cleanup_error).__name__, 'message': str(cleanup_error)}) + stop = {'schema': 'h25-combined-v2-stop-v1', 'status': 'STOP', 'primary_error': {'type': type(primary_error).__name__, 'message': str(primary_error)}, 'primary_cause': None if primary_error.__cause__ is None else {'type': type(primary_error.__cause__).__name__, 'message': str(primary_error.__cause__)}, 'cleanup_errors': cleanup_errors, 'data': data_adapters.epoch_stop_diagnostics(state), 'native_packet': None if _EXECUTION['packet'] is None else native_packet.receipt(_EXECUTION['packet']), 'initial_native_tcb': INITIAL_NATIVE_TCB_RECEIPT} + output = _EXECUTION['output'] + if output is not None: + with (output / 'STOP.json').open('x', encoding='utf-8') as stream: + stream.write(json.dumps(stop, sort_keys=True, indent=2) + '\n') + except BaseException as evidence_error: + try: + sys.stderr.write('STOP evidence write failed: ' + type(evidence_error).__name__ + '\n') + except BaseException: + pass + raise + + +# BEGIN G12 EXACT COMMON SOURCE +# G12 common scientific projection. SOURCE ONLY; appended verbatim to each +# independently source-authenticated selected driver, before its entry point. +# Uses that driver's original Fraction and canonical functions. No data/payload +# is fabricated here and no backend/native counters are compared by P07. +_G12_COMMON_SCHEMA = 'g12-original-remainder-common-v1' +_G12_SUFFIX_PHASES = ('verify_role_frames', 'full_log_integer_bounds', + 'original_upstream_verify_sources', 'original_serializable', + 'complete_original_cli') +_G12_SCIENTIFIC_PINS = ( + 'd623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1', + '0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b', + '88bba3caf5975f30fa7abceaea9454110cf3b069233e8241a2ca13d1dff171a7', + 'adc7f1241b42e322a6451854ab7e4b4c146bf78a') + + +def _g12_primitive(value): + """Lossless tagged exact builtin structures; never invoke foreign equality.""" + kind = type(value) + if kind is Fraction: + return ['Fraction', str(value.numerator), str(value.denominator)] + if value is None: + return ['None'] + if kind is bool: + return ['bool', value] + if kind is int: + return ['int', str(value)] + if kind is str: + return ['str', value] + if kind is bytes: + return ['bytes', value.hex()] + if kind is float: + return ['float', value.hex()] + if kind is tuple or kind is list: + return [kind.__name__, [_g12_primitive(item) for item in value]] + if kind is dict: + return ['dict', [[_g12_primitive(key), _g12_primitive(item)] + for key, item in value.items()]] + raise TypeError('G12 common projection requires exact original primitive types') + + +def _g12_bytes(value): + return canonical(_g12_primitive(value)) + + +def _g12_code_snapshot(code): + # Reject custom key/equality domains before inspecting the finite code map. + need(type(code) is dict and all(type(key) is str for key in code), + 'G12 actual original code must be an exact string-keyed dict') + need(set(code) == {'roles', 'gates', 'sources', 'outputs'}, + 'G12 original code field set changed') + need(type(code['roles']) is int and code['roles'] > 0 and + type(code['gates']) is list and type(code['sources']) is dict and + type(code['outputs']) is dict, 'G12 original code containers changed') + for gate in code['gates']: + need(type(gate) is tuple and len(gate) == 3 and type(gate[0]) is int and + type(gate[1]) is tuple and type(gate[2]) is tuple and + all(type(slot) is int for slot in gate[1] + gate[2]), + 'G12 original gate primitive types changed') + for source, slot in code['sources'].items(): + need(type(source) is tuple and len(source) == 3 and + all(type(point) is int for point in source) and type(slot) is int, + 'G12 original source primitive types changed') + need(all(type(index) is int and type(slot) is int + for index, slot in code['outputs'].items()), + 'G12 original output primitive types changed') + return _g12_bytes(code) + + +def _g12_remaining_count(code): + # Source-derived count after successful unchanged optimize0 role function; + # this is not a per-assert execution trace. + _g12_code_snapshot(code) + return (2 * sum(len(set(ins + outs)) for _, ins, outs in code['gates']) + + len(code['outputs']) + code['roles'] + len(code['sources'])) + + +def _g12_common_outputs(code, code_before, role_result, full_return, + certificate_bytes, stdout_text, suffix_phases): + need(type(code_before) is bytes and _g12_code_snapshot(code) == code_before, + 'G12 original code changed within the same invocation') + need(type(full_return) is dict and + all(type(key) is str for key in full_return) and + full_return.get('role_frames') is role_result, + 'G12 original role/full-return identity relation changed') + need(type(certificate_bytes) is bytes and type(stdout_text) is str and + type(suffix_phases) is tuple and + all(type(name) is str for name in suffix_phases) and + suffix_phases == _G12_SUFFIX_PHASES, + 'G12 actual original suffix outputs/phase completions changed') + return _g12_bytes((_G12_COMMON_SCHEMA, _G12_SCIENTIFIC_PINS, 25, (0, 2, 1), + code_before, role_result, full_return, certificate_bytes, + stdout_text, suffix_phases)) + +# END G12 EXACT COMMON SOURCE +# BEGIN G12 EXACT CANDIDATE SUPPORT +# Fixed G12 source-control support, appended to the selected epoch driver. +# SOURCE ONLY. No source selection, FULL approval or execution is supplied here. +import types as _g12_types +import traceback as _g12_traceback + +_G12_SELECTED_CASE = 'P07' +_G12_SELECTED_HELPER_PIN = 'eae1fca1f951a572a3487e5136454d80f16124cc02fef296793830c50431b061' +_G12_TRANSPORT_SOURCE_PIN = None +_G12_CONTINUATION = {'started': False, 'step': 'EMPTY', 'ready': False, + 'helper_handle': None, 'helper_module': None, 'helper_function': None, + 'transport_handle': None, 'reference': None, 'suite': None, + 'generator': None, 'generator_frame': None, 'observed': None, + 'context': None, 'marker': None, 'primary': None, + 'secondary': [], 'secondary_clear': True, + 'frame_close_error': None, 'terminal_observation_error': None, + 'adapter_exit_error': None, 'suffix_phases': [], 'store_entries': 0, + 'first_advances': 0, 'second_advances': 0, 'close_attempts': 0} + + +class _G12ControlCompletion(RuntimeError): + """Only the exact recorded object is this selected control's completion.""" + + +def _g12_cold(index, *args): + descriptor = _INITIAL_COLD_CALLER_DESCRIPTOR + need(type(descriptor) is tuple and len(descriptor) == 6 and + descriptor[1] is _INITIAL_COLD_AUTHORITY and type(index) is int and index in (0, 1, 2), + 'G12 original cold operation/descriptor differs') + primitive, function, record = descriptor[5], descriptor[2], descriptor[3] + need(type(primitive) is tuple and len(primitive) == 19 and primitive[0] is type and + primitive[1] is _g12_types.FunctionType and primitive[2] is id and primitive[18] is zip and + type(function) is primitive[1] and function is record[0], + 'G12 original cold caller primitives differ') + for (_, getter), expected in primitive[18](primitive[4], record[1:7]): + need(getter(function, primitive[1]) is expected, 'G12 cold dispatcher field changed') + need(record[4] is None and record[5] is None and not record[7], 'G12 cold dispatcher defaults changed') + for cell, expected in record[8]: + need(primitive[6](cell, primitive[5]) is expected, 'G12 cold dispatcher closure changed') + return function(index, *args) + + +def _g12_helper_current(): + record = _G12_CONTINUATION + source = _g12_cold(2, record['helper_handle']) + module = record['helper_module'] + need(source[1] is module and source[2] is module.__dict__ and + source[5] == _G12_SELECTED_HELPER_PIN and + module.__dict__.get(_G12_SELECTED_CASE) is record['helper_function'] and + record['helper_function'].__code__ is record['helper_code'], + 'G12 selected actual helper source/callable changed') + suite = record['suite'] + need(record['state']['epoch_suite'] is suite and suite.context['driver_function'] is main_epoch and + suite.context['phase_owner'] is record['phases'] and + suite.context['invocation_token'] is record['invocation_token'] and + suite.generation is record['generation'] and suite.owner is record['native_owner'], + 'G12 selected suite/driver/phase/token changed') + # Direct source-owned names extend both captured driver and C3 handler graphs + # to the actual outer entry, exit controller and terminal custody predicate. + need(type(_g12_continuation_entry) is _g12_types.FunctionType and + _g12_continuation_entry.__globals__ is globals() and + type(_g12_after_original_exit) is _g12_types.FunctionType and + _g12_after_original_exit.__globals__ is globals() and + type(_g12_original_terminal_custody) is _g12_types.FunctionType and + _g12_original_terminal_custody.__globals__ is globals(), + 'G12 actual outer entry/exit/custody source owner changed') + suite.current() + + +def _g12_generator_shape(suspended): + record = _G12_CONTINUATION + generator, context = record['generator'], record['context'] + need(type(generator) is record['generator_type'] and generator.gi_code is record['helper_code'] and + generator.gi_running is False and generator.gi_yieldfrom is None and + generator.gi_suspended is suspended and generator.gi_frame is record['generator_frame'] and + generator.gi_frame is not None and generator.gi_frame.f_globals is record['helper_module'].__dict__, + 'G12 P07 exact generator/frame/source shape changed') + local = generator.gi_frame.f_locals + need(type(local) is dict and local.get('c') is context, + 'G12 P07 generator context identity changed') + if suspended: + need(local.get('observed') is record['observed'], 'G12 P07 suspended observation identity changed') + else: + need('observed' not in local, 'G12 P07 body already ran before selected first advance') + + +def _g12_selected_store(suite, original_commit, site, checks): + record = _G12_CONTINUATION + if record['step'] != 'EXPECT_STORE': + return original_commit(site, checks) + need(record['ready'] is True and suite is record['suite'] and site == 'C3' and + type(site) is str and checks is record['checks'] and + type(original_commit) is _g12_types.MethodType and original_commit.__self__ is suite and + original_commit.__func__ is type(suite).__dict__['commit'] and record['store_entries'] == 0, + 'G12 selected original C3 continuation owner changed') + _g12_helper_current() + pending = suite.pending + need(type(pending) is dict and pending.get('site') == 'C3' and pending.get('checks') is checks and + type(pending.get('key')) is tuple and pending['key'] == ('perp', (0, 2, 1)) and + type(pending.get('label')) is suite.label and + checks.cache.get(('perp', (0, 2, 1))) is pending['label'] and + suite.active is True and suite.terminal is False and suite.request_live is None and + type(suite.registry) is dict and len(suite.registry) == 85196, + 'G12 requires actual pending extra C3 store at original capacity') + record['store_entries'] = 1 + record['pending_store'] = pending + record['stored_label'] = pending['label'] + context = record['context'] + need('remaining_original_case_count' not in context and 'remaining_original_outputs' not in context, + 'G12 candidate remainder fields must be absent before actual original remainder') + try: + record['step'] = 'HELPER_ENTERED' + if _G12_SELECTED_CASE == 'P07': + generator = record['helper_function'](context) + need(type(generator) is record['generator_type'], 'G12 selected P07 did not return its genuine generator') + record['generator'], record['generator_frame'] = generator, generator.gi_frame + _g12_generator_shape(False) + _g12_helper_current() + need(record['first_advances'] == 0, 'G12 P07 first advance repeated') + record['first_advances'] = 1 + try: + observed = next(generator) + except StopIteration as early: + raise RuntimeError('G12 P07 completed before original CLI remainder') from early + record['observed'] = observed + _g12_generator_shape(True) + record['step'] = 'P07_SUSPENDED' + else: + need(_G12_SELECTED_CASE == 'N22', 'G12 source selected an undeclared helper') + _g12_helper_current() + record['observed'] = record['helper_function'](context) + record['step'] = 'N22_RETURNED' + need(type(record['observed']) is dict and + all(type(key) is str for key in record['observed']) and + set(record['observed']) == {'value', 'capacity_retirements', 'owner'} and + suite.terminal is True and suite.active is False and not suite.registry and + suite.pending is None and suite.request_live is None, + 'G12 original N22 did not return its exact terminal continuation observation') + # N22 performed the sole original commit. Never call it again here. + return None + except BaseException as primary: + if record['primary'] is None: + record['primary'] = primary + raise + + + +def _g12_selected_args(args): + need(args.data_lanes == 'candidate' and args.finite_only is False and sys.flags.optimize == 0, + 'G12 selected control requires the original full candidate/assertion scope') + +def _g12_bind_locals(state, extensions, module, binding, phases, invocation_token, + checks_pair, code_pair, label_pair, caller, rank_calls, trace, + captures, stdout, frozen, runtime, engine, output, reference, + reference_bytes, driver_before, pins, frozen_before, engine_before, + runtime_before, copied_engine_before, script_names, new_custody_before, + data_custody_before, anchor_path, anchor_bytes): + record = _G12_CONTINUATION + suite, set_owner = state['epoch_suite'], extensions['set_binding']['owner'] + need(record['started'] is True and record['ready'] is False and record['suite'] is None and + record['reference'] is not None and record['driver'] is sys.modules['__main__'] and + record['driver'].__dict__ is globals() and _EXECUTION['state'] is state and state['enabled'] is True and + suite.module is module and suite.context['driver_function'] is main_epoch and + suite.context['phase_owner'] is phases and suite.context['invocation_token'] is invocation_token and + suite.active is False and suite.terminal is False and suite.invocation_consumed is False and + suite.pending is None and suite.request_live is None and not suite.registry and + set_owner.sealed is True and set_owner.cli_active is False and set_owner.used is False and + set_owner.circuit is None and set_owner.checks is None, + 'G12 requires the original source-owned sealed, unconsumed main-local generation') + for pair in (checks_pair, code_pair, label_pair): + need(type(pair) is tuple and len(pair) == 2 and + all(type(function) is _g12_types.FunctionType for function in pair), + 'G12 original phase pair shape changed') + need(module.Checks.__dict__['__init__'] is checks_pair[1] and module.compile_roles is code_pair[1] and + module.Checks.__dict__['verify_labels'] is label_pair[1], 'G12 actual installed phase pairs changed') + # This fixed source name is also captured by the selected C3 product before + # product publication. It is not a callback parameter or a context entry. + need(_g12_selected_store.__globals__ is globals(), 'G12 fixed source store selector owner changed') + record.update({'suite': suite, 'generation': suite.generation, 'native_owner': suite.owner, 'state': state, 'extensions': extensions, 'module': module, + 'binding': binding, 'phases': phases, 'invocation_token': invocation_token, + 'checks_pair': checks_pair, 'code_pair': code_pair, 'label_pair': label_pair, + 'caller': str(caller), 'rank_calls': rank_calls, 'trace': trace, 'captures': captures, + 'stdout': stdout, 'frozen': frozen, 'runtime': runtime, 'engine': engine, 'output': output, + 'reference_file': reference, 'reference_bytes': reference_bytes, 'driver_before': driver_before, + 'pins': pins, 'frozen_before': frozen_before, 'engine_before': engine_before, + 'runtime_before': runtime_before, 'copied_engine_before': copied_engine_before, + 'script_names': script_names, 'new_custody_before': new_custody_before, + 'data_custody_before': data_custody_before, 'anchor_path': anchor_path, + 'anchor_bytes': anchor_bytes, 'ready': True, 'step': 'CLI_READY'}) + _g12_helper_current() + + +def _g12_diagnostics(): + record = _G12_CONTINUATION + ranks = record['rank_calls'] + need(type(ranks) is list, 'G12 actual original rank list changed') + for item in ranks: + need(type(item) is tuple and len(item) == 2 and type(item[0]) is tuple and + all(type(value) is int for value in item[0]) and type(item[1]) is int, + 'G12 actual original rank event type changed') + binding = record['binding'] + counters = binding['counters'] + need(type(counters) is dict and all(type(key) is str and type(value) is int + for key, value in counters.items()), + 'G12 original native counter primitive types changed') + return {'rank_event_count': len(ranks), 'ordered_rank_events_hex': _g12_bytes(tuple(ranks)).hex(), + 'complement_receipt': record['trace'].receipt(), 'native_counters': dict(counters), + 'cache_receipt': _g12_primitive(record['suite'].receipt), + 'owner_receipt': _g12_primitive(record['suite'].owner.receipt)} + + + +def _g12_complete_capacity_store(checks, circuit, suite): + need(type(circuit.active) is set and len(circuit.active) == 82895 and + all(type(node) is int for node in circuit.active) and + type(circuit.triples) is list and len(circuit.triples) == 2300, + 'G12 actual original h25 active/target census changed') + for target in circuit.triples: + need(type(target) is tuple and len(target) == 3 and all(type(point) is int for point in target) and + 0 <= target[0] < target[1] < target[2] < 25, + 'G12 actual original canonical target changed') + for key in checks.cache: + need(type(key) is int or (type(key) is tuple and len(key) == 2 and type(key[0]) is str and + key[0] == 'perp' and type(key[1]) is tuple and len(key[1]) == 3 and + all(type(point) is int for point in key[1])), 'G12 actual label store key type changed') + need(set(checks.cache) == circuit.active | {('perp', target) for target in circuit.triples}, + 'G12 requires the complete original canonical label store') + labels = tuple(checks.cache.values()) + (checks.everything,) + need(all(type(label) is suite.label for label in labels), 'G12 actual registered Label type changed') + identities = {id(label) for label in labels} + need(len(identities) == 85196 and all(type(key) is int for key in suite.registry) and + set(suite.registry) == identities, 'G12 actual registry includes missing/foreign original Labels') + for label in labels: + entry = suite.registry[id(label)] + need(type(entry) is tuple and len(entry) == 7 and entry[0] is label and entry[1] is label.basis and + entry[2] is label.key and entry[4] is checks and entry[6] is suite.generation, + 'G12 original registry Label/basis/key/generation custody changed') + need(type(label.basis) is dict and all(type(key) is int and type(value) is int + for key, value in label.basis.items()) and + type(label.key) is tuple and all(type(value) is int for value in label.key) and + type(label.dim) is int and label.dim == len(label.basis) and + label.key == tuple(sorted(label.basis.values())), 'G12 original Label primitive state changed') + +def _g12_after_phase(phases, name, function, args, kwargs, result): + record = _G12_CONTINUATION + if not record['ready']: + return result + if name not in ('compile_roles', 'verify_labels', 'complete_original_cli'): + if record['step'] == 'SUFFIX' and name in _G12_SUFFIX_PHASES: + record['suffix_phases'].append(name) + return result + need(phases is record['phases'], 'G12 fixed actual phase owner changed') + _g12_helper_current() + if name == 'compile_roles': + need(record['step'] == 'CLI_READY' and type(args) is tuple and len(args) == 1 and not kwargs and + function is record['code_pair'][0] and record['module'].compile_roles is record['code_pair'][1] and + type(args[0]) is record['module'].ComplexSideCircuit, + 'G12 actual original compile-role return checkpoint changed') + record.update({'circuit': args[0], 'code': result, 'code_before': _g12_code_snapshot(result), 'step': 'COMPILED'}) + return result + if name == 'verify_labels': + need(record['step'] == 'COMPILED' and type(args) is tuple and len(args) == 1 and not kwargs and + function is record['label_pair'][0] and record['module'].Checks.__dict__['verify_labels'] is record['label_pair'][1], + 'G12 actual original label-phase return checkpoint changed') + suite, checks, circuit = record['suite'], args[0], record['circuit'] + set_owner = record['extensions']['set_binding']['owner'] + need(type(checks) is suite.checks_class and checks.c is circuit and + type(checks.h) is int and type(circuit.h) is int and checks.h == circuit.h == 25 and + suite.active is True and suite.terminal is False and suite.invocation_consumed is True and + suite.primary_error is None and suite.pending is None and suite.request_live is None and + suite.checks is checks and suite.checks_c is circuit and + set_owner.cli_active is True and set_owner.used is False and set_owner.circuit is circuit and + set_owner.checks is checks and set_owner.triples is circuit.triples and + type(suite.registry) is dict and len(suite.registry) == 85196 and type(checks.cache) is dict and + len(checks.cache) == 85195 and ('perp', (0, 2, 1)) not in checks.cache, + 'G12 genuine post-label original capacity checkpoint changed') + _g12_complete_capacity_store(checks, circuit, suite) + cleanup = record['state']['epoch_cli_cleanup'] + need(type(cleanup) is dict and cleanup['primary'] is None and cleanup['argv_error'] is None and + cleanup['disarm_error'] is None and cleanup['retirement_error'] is None and + type(sys.argv) is list and sys.argv == [record['caller']] and sys.argv is not cleanup['argv_owner'], + 'G12 must be inside original protected CLI after actual arming') + c1 = suite.registry.get(id(checks.everything)) + need(type(c1) is tuple and len(c1) == 7 and c1[0] is checks.everything and c1[1] is checks.everything.basis and + c1[2] is checks.everything.key and c1[4] is checks and c1[5] == 'C1' and c1[6] == suite.generation, + 'G12 registered_label must be actual original C1 store') + need(_g12_code_snapshot(record['code']) == record['code_before'], 'G12 original code changed before control store') + literal, reference_count, reference_outputs, _ = record['reference'] + record['checks'] = checks + record['context'] = {'bundle': _INITIAL_EPOCH_BUNDLE, 'state': record['state'], 'site': 'C3', + 'checks': checks, 'registered_label': checks.everything, 'literal_expected': literal, + 'reference_remaining_case_count': reference_count, 'reference_remaining_outputs': reference_outputs} + record['prefix_end'] = _g12_diagnostics() + record['step'] = 'EXPECT_STORE' + actual_label = checks.target_frame((0, 2, 1)) + need(record['store_entries'] == 1 and actual_label is record['stored_label'] and + checks.cache[('perp', (0, 2, 1))] is actual_label and + record['step'] == ('P07_SUSPENDED' if _G12_SELECTED_CASE == 'P07' else 'N22_RETURNED'), + 'G12 actual selected store did not complete exactly once') + record['suffix_start'] = _g12_diagnostics() + record['rank_prefix'] = _g12_bytes(tuple(record['rank_calls'])) + record['rank_index'] = len(record['rank_calls']) + record['step'] = 'SUFFIX' + return result + need(record['step'] == 'SUFFIX' and function is runpy.run_path and type(args) is tuple and len(args) == 1 and + args[0] == record['caller'] and type(kwargs) is dict and tuple(kwargs) == ('run_name',) and kwargs['run_name'] == '__main__', + 'G12 actual same-invocation original CLI return changed') + record['suffix_phases'].append(name) + _g12_complete_original_cli(result) + marker = _G12ControlCompletion('G12 intentional ' + _G12_SELECTED_CASE + ' original-CLI control completion') + record['marker'], record['step'] = marker, 'MARKED' + raise marker + + +def _g12_complete_original_cli(namespace): + record = _G12_CONTINUATION + module, captures = record['module'], record['captures'] + need(type(namespace) is dict and all(type(key) is str for key in namespace) and + sys.modules.get('complex_circuit') is module and namespace.get('ComplexSideCircuit') is module.ComplexSideCircuit and + namespace.get('Checks') is module.Checks and namespace.get('compile_roles') is module.compile_roles and + namespace.get('verify_role_frames') is module.verify_role_frames and + namespace.get('serializable') is sys.modules['prepare_layers'].serializable, + 'G12 original completed CLI namespace/observer binding changed') + need(type(captures) is dict and all(type(key) is str for key in captures) and set(captures) == {'side', 'full_return'} and + type(captures['side']) is tuple and len(captures['side']) == 4, 'G12 actual original capture set changed') + circuit, checks, code, roles = captures['side'] + full_return = captures['full_return'] + need(circuit is record['circuit'] and checks is record['checks'] and code is record['code'] and + type(full_return) is dict and all(type(key) is str for key in full_return) and + full_return.get('role_frames') is roles and full_return.get('upstream_commit') == UPSTREAM, + 'G12 actual same original generation/full role result changed') + stdout_text = record['stdout'].getvalue() + certificate = (record['runtime'] / 'certificates/complex-network.json').read_bytes() + need(stdout_text == EXPECTED_STDOUT and certificate == record['reference_bytes'], + 'G12 original fresh certificate/stdout differs from original immutable pins') + for name in ('side_construction', 'checks_initialization', 'compile_roles', 'verify_map', 'verify_labels', + 'verify_role_frames', 'original_upstream_verify_sources', 'full_log_integer_bounds', 'original_serializable'): + need(record['phases'].rows.get(name, {}).get('calls') == 1, 'G12 original phase omitted/repeated: ' + name) + need('complete_original_cli' not in record['phases'].rows, 'G12 original complete-CLI finally already ran') + _g12_original_imports() + outputs = _g12_common_outputs(code, record['code_before'], roles, full_return, certificate, + stdout_text, tuple(record['suffix_phases'])) + count = _g12_remaining_count(code) + need(_g12_bytes(tuple(record['rank_calls'][:record['rank_index']])) == record['rank_prefix'], + 'G12 actual original rank prefix changed') + record.update({'common': outputs, 'case_count': count, 'cli_end': _g12_diagnostics(), + 'rank_suffix': _g12_bytes(tuple(record['rank_calls'][record['rank_index']:])), + 'namespace': namespace, 'full_return': full_return, 'roles': roles}) + native_start = record['suffix_start']['native_counters'] + native_end = record['cli_end']['native_counters'] + need(set(native_start) == set(native_end), 'G12 original native counter domain changed across suffix') + record['native_suffix_delta'] = {key: native_end[key] - value for key, value in native_start.items()} + if _G12_SELECTED_CASE == 'P07': + context = record['context'] + need('remaining_original_case_count' not in context and 'remaining_original_outputs' not in context and + record['second_advances'] == 0, 'G12 candidate actual remainder publication/advance repeated') + _g12_generator_shape(True) + context['remaining_original_case_count'] = count + context['remaining_original_outputs'] = outputs + _g12_helper_current() + _g12_generator_shape(True) + record['second_advances'] = 1 + try: + next(record['generator']) + except StopIteration as completed: + need(completed.value is record['observed'], 'G12 original P07 returned a different observation object') + else: + raise RuntimeError('G12 selected P07 yielded again instead of original comparisons/return') + need(record['generator'].gi_frame is None, 'G12 P07 frame remained live after original return') + record['p07_returned_original_observation'] = record['observed'] + else: + need(_G12_SELECTED_CASE == 'N22' and record['generator'] is None, + 'G12 original N22 selection acquired a P07 continuation') + + +def _g12_original_imports(): + record = _G12_CONTINUATION + for name in record['script_names'] - {'complex_network'}: + module = sys.modules.get(name) + expected = record['engine'] / 'source/complex_circuit.py' if name == 'complex_circuit' else record['runtime'] / 'scripts' / (name + '.py') + need(type(module) is _g12_types.ModuleType and Path(module.__file__).resolve() == expected.resolve(), + 'G12 actual original scientific import path changed: ' + name) + + +def _g12_original_terminal_custody(): + record = _G12_CONTINUATION + need(inventory(record['frozen'], record['pins']) == record['frozen_before'] and + inventory(HERE / 'engine', ENGINE_PINS) == record['engine_before'] and + inventory(record['runtime'], record['pins'], exact=False) == record['runtime_before'] and + inventory(record['engine'], ENGINE_PINS) == record['copied_engine_before'], + 'G12 original source/input inventory or modes changed') + files = {str(path.relative_to(record['runtime'])) for path in record['runtime'].rglob('*') if path.is_file()} + need(files == set(record['pins']) | {'certificates/complex-network.json'} and + Path(__file__).read_bytes() == record['driver_before'] and + record['reference_file'].read_bytes() == record['reference_bytes'], + 'G12 original output/selected source/reference custody changed') + need(adapters.custody(ROUND, 'all') == record['new_custody_before'] and + data_adapters.custody(ROUND) == record['data_custody_before'] and + (record['anchor_bytes'] is None or record['anchor_path'].read_bytes() == record['anchor_bytes']), + 'G12 original selected-source/anchor custody changed') + _g12_original_imports() + for name in ('side_construction', 'checks_initialization', 'compile_roles', 'verify_map', 'verify_labels', + 'verify_role_frames', 'original_upstream_verify_sources', 'full_log_integer_bounds', + 'original_serializable', 'complete_original_cli'): + need(record['phases'].rows.get(name, {}).get('calls') == 1, + 'G12 complete original phase finally/count changed: ' + name) + + +def _g12_after_original_exit(primary): + record = _G12_CONTINUATION + if record['primary'] is None: + record['primary'] = primary + generator = record['generator'] + if generator is not None and generator.gi_frame is not None: + try: + # No original CLI resume occurs on failure. Original P07 source has + # no finally clause; closing this exact suspended code only releases + # its retained frame after original CLI/main/STOP/owned cleanup. + _g12_generator_shape(True) + need(record['close_attempts'] == 0, 'G12 suspended P07 close repeated') + record['close_attempts'] = 1 + generator.close() + need(generator.gi_frame is None, 'G12 exact suspended P07 did not close') + except BaseException as secondary: + try: + record['secondary_clear'] = False + record['frame_close_error'] = secondary + record['secondary'].append((secondary, secondary.__traceback__, 'P07-frame-close')) + except BaseException: + pass + if primary is record['marker'] and record['step'] == 'MARKED': + try: + _g12_original_terminal_custody() + need(record['secondary_clear'] is True and + record['frame_close_error'] is None and record['terminal_observation_error'] is None and + record['adapter_exit_error'] is None and not record['secondary'], + 'G12 source-control secondary error or incomplete journal blocks observation export') + row = {'schema': 'g12-original-control-observation-v1', 'case': _G12_SELECTED_CASE, + 'selected_driver_sha256': sha(record['driver_before']), + 'reference_provenance': record['reference'][3], + 'original_helper_observation': _g12_primitive(record['observed']), + 'remaining_original_case_count': record['case_count'], + 'common_payload_sha256': sha(record['common']), 'common_payload_hex': record['common'].hex(), + 'prefix_end': record['prefix_end'], 'suffix_start': record['suffix_start'], 'cli_end': record['cli_end'], + 'ordered_rank_suffix_hex': record['rank_suffix'].hex(), 'native_suffix_delta': record['native_suffix_delta'], + 'phases': record['phases'].rows, + 'store_entries': record['store_entries'], 'first_advances': record['first_advances'], + 'second_advances': record['second_advances'], 'close_attempts': record['close_attempts'], + 'disposition_qualification': 'OPEN_REQUIRES_SEPARATE_ORIGINAL_STOP_AND_ALL_OWNED_CLEANUP_REVIEW', + 'scope': 'Original selected N22/P07 observation plus same-invocation original CLI remainder only. No original full-positive publication/native-count/P02/G12/FULL admission.'} + with (record['output'] / 'g12-control-observation.json').open('xb') as stream: + stream.write(canonical(row) + b'\n') + except BaseException as secondary: + try: + record['secondary_clear'] = False + record['terminal_observation_error'] = secondary + record['secondary'].append((secondary, secondary.__traceback__, 'terminal-source-observation')) + except BaseException: + pass + for secondary, traceback, phase in record['secondary']: + try: + sys.stderr.write('G12 secondary continuation error: ' + phase + '\n') + _g12_traceback.print_exception(type(secondary), secondary, traceback, file=sys.stderr) + except BaseException: + pass + + +def _g12_continuation_entry(): + record = _G12_CONTINUATION + need(record['started'] is False and _G12_SELECTED_CASE in ('N22', 'P07'), 'G12 source control entry is one-use') + record['started'] = True + record['driver'] = sys.modules['__main__'] + need(record['driver'].__dict__ is globals(), 'G12 source control requires actual Root-installed driver namespace') + need(type(_G12_TRANSPORT_SOURCE_PIN) is str and len(_G12_TRANSPORT_SOURCE_PIN) == 64, + 'G12 reference transport source has not been selected') + helper, helper_handle = _g12_cold(0, str(ROUND / 'areas/cache-validity/g12_source_controls.py'), + _G12_SELECTED_HELPER_PIN, '_h25_g12_source_controls') + transport, transport_handle = _g12_cold(0, str(ROUND / 'areas/cache-validity/g12_reference_transport.py'), + _G12_TRANSPORT_SOURCE_PIN, '_h25_g12_reference_transport') + reference = _g12_cold(1, transport_handle, 'load_original_g12_reference', + _CAPTURED_BOOTSTRAP_ROOT, _CAPTURED_BOOTSTRAP_CAPABILITY, _CAPTURED_BOOTSTRAP_API) + need(type(reference) is tuple and len(reference) == 4 and type(reference[0]) is bool and + type(reference[1]) is int and reference[1] > 0 and type(reference[2]) is bytes and type(reference[3]) is tuple, + 'G12 actual source-produced independent reference transport shape changed') + source = _g12_cold(2, helper_handle) + function = helper.__dict__[_G12_SELECTED_CASE] + need(source[1] is helper and source[5] == _G12_SELECTED_HELPER_PIN and + type(function) is _g12_types.FunctionType and function.__globals__ is helper.__dict__ and + bool(function.__code__.co_flags & 0x20) is (_G12_SELECTED_CASE == 'P07'), + 'G12 exact selected helper source/generator protocol changed') + record.update({'helper_handle': helper_handle, 'helper_module': helper, 'helper_function': function, + 'helper_code': function.__code__, 'transport_handle': transport_handle, + 'reference': reference, 'generator_type': _g12_types.GeneratorType, 'step': 'PREPARED'}) + try: + _run_epoch_with_stop_evidence() + except BaseException as primary: + # Original CLI/main/STOP/owned cleanup has already run. Preserve the + # identical primary and cause; every adapter cleanup error is secondary. + try: + _g12_after_original_exit(primary) + except BaseException as secondary: + try: + record['secondary_clear'] = False + record['adapter_exit_error'] = secondary + record['secondary'].append((secondary, secondary.__traceback__, 'adapter-exit-entry')) + except BaseException: + pass + raise + raise RuntimeError('G12 source control reached original full-positive return without its intentional marker') + +# END G12 EXACT CANDIDATE SUPPORT + +if __name__ == '__main__': + _g12_continuation_entry() diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_N22_custody_v1.py.txt b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_N22_custody_v1.py.txt new file mode 100644 index 0000000000..e41bd6362f --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_N22_custody_v1.py.txt @@ -0,0 +1,508 @@ +# Fixed G12 source-control support, appended to the selected epoch driver. +# SOURCE ONLY. No source selection, FULL approval or execution is supplied here. +import types as _g12_types +import traceback as _g12_traceback + +_G12_SELECTED_CASE = 'N22' +_G12_SELECTED_HELPER_PIN = 'fcffe77b6a84d5b422b03e3d068924a701c1594cdb9ec305115827e3fad7d4b6' +_G12_TRANSPORT_SOURCE_PIN = None +_G12_CONTINUATION = {'started': False, 'step': 'EMPTY', 'ready': False, + 'helper_handle': None, 'helper_module': None, 'helper_function': None, + 'transport_handle': None, 'reference': None, 'suite': None, + 'generator': None, 'generator_frame': None, 'observed': None, + 'context': None, 'marker': None, 'primary': None, + 'secondary': [], 'secondary_clear': True, + 'frame_close_error': None, 'terminal_observation_error': None, + 'adapter_exit_error': None, 'suffix_phases': [], 'store_entries': 0, + 'first_advances': 0, 'second_advances': 0, 'close_attempts': 0} + + +class _G12ControlCompletion(RuntimeError): + """Only the exact recorded object is this selected control's completion.""" + + +def _g12_cold(index, *args): + descriptor = _INITIAL_COLD_CALLER_DESCRIPTOR + need(type(descriptor) is tuple and len(descriptor) == 6 and + descriptor[1] is _INITIAL_COLD_AUTHORITY and type(index) is int and index in (0, 1, 2), + 'G12 original cold operation/descriptor differs') + primitive, function, record = descriptor[5], descriptor[2], descriptor[3] + need(type(primitive) is tuple and len(primitive) == 19 and primitive[0] is type and + primitive[1] is _g12_types.FunctionType and primitive[2] is id and primitive[18] is zip and + type(function) is primitive[1] and function is record[0], + 'G12 original cold caller primitives differ') + for (_, getter), expected in primitive[18](primitive[4], record[1:7]): + need(getter(function, primitive[1]) is expected, 'G12 cold dispatcher field changed') + need(record[4] is None and record[5] is None and not record[7], 'G12 cold dispatcher defaults changed') + for cell, expected in record[8]: + need(primitive[6](cell, primitive[5]) is expected, 'G12 cold dispatcher closure changed') + return function(index, *args) + + +def _g12_helper_current(): + record = _G12_CONTINUATION + source = _g12_cold(2, record['helper_handle']) + module = record['helper_module'] + need(source[1] is module and source[2] is module.__dict__ and + source[5] == _G12_SELECTED_HELPER_PIN and + module.__dict__.get(_G12_SELECTED_CASE) is record['helper_function'] and + record['helper_function'].__code__ is record['helper_code'], + 'G12 selected actual helper source/callable changed') + suite = record['suite'] + need(record['state']['epoch_suite'] is suite and suite.context['driver_function'] is main_epoch and + suite.context['phase_owner'] is record['phases'] and + suite.context['invocation_token'] is record['invocation_token'] and + suite.generation is record['generation'] and suite.owner is record['native_owner'], + 'G12 selected suite/driver/phase/token changed') + # Direct source-owned names extend both captured driver and C3 handler graphs + # to the actual outer entry, exit controller and terminal custody predicate. + need(type(_g12_continuation_entry) is _g12_types.FunctionType and + _g12_continuation_entry.__globals__ is globals() and + type(_g12_after_original_exit) is _g12_types.FunctionType and + _g12_after_original_exit.__globals__ is globals() and + type(_g12_original_terminal_custody) is _g12_types.FunctionType and + _g12_original_terminal_custody.__globals__ is globals(), + 'G12 actual outer entry/exit/custody source owner changed') + suite.current() + + +def _g12_generator_shape(suspended): + record = _G12_CONTINUATION + generator, context = record['generator'], record['context'] + need(type(generator) is record['generator_type'] and generator.gi_code is record['helper_code'] and + generator.gi_running is False and generator.gi_yieldfrom is None and + generator.gi_suspended is suspended and generator.gi_frame is record['generator_frame'] and + generator.gi_frame is not None and generator.gi_frame.f_globals is record['helper_module'].__dict__, + 'G12 P07 exact generator/frame/source shape changed') + local = generator.gi_frame.f_locals + need(type(local) is dict and local.get('c') is context, + 'G12 P07 generator context identity changed') + if suspended: + need(local.get('observed') is record['observed'], 'G12 P07 suspended observation identity changed') + else: + need('observed' not in local, 'G12 P07 body already ran before selected first advance') + + +def _g12_selected_store(suite, original_commit, site, checks): + record = _G12_CONTINUATION + if record['step'] != 'EXPECT_STORE': + return original_commit(site, checks) + need(record['ready'] is True and suite is record['suite'] and site == 'C3' and + type(site) is str and checks is record['checks'] and + type(original_commit) is _g12_types.MethodType and original_commit.__self__ is suite and + original_commit.__func__ is type(suite).__dict__['commit'] and record['store_entries'] == 0, + 'G12 selected original C3 continuation owner changed') + _g12_helper_current() + pending = suite.pending + need(type(pending) is dict and pending.get('site') == 'C3' and pending.get('checks') is checks and + type(pending.get('key')) is tuple and pending['key'] == ('perp', (0, 2, 1)) and + type(pending.get('label')) is suite.label and + checks.cache.get(('perp', (0, 2, 1))) is pending['label'] and + suite.active is True and suite.terminal is False and suite.request_live is None and + type(suite.registry) is dict and len(suite.registry) == 85196, + 'G12 requires actual pending extra C3 store at original capacity') + record['store_entries'] = 1 + record['pending_store'] = pending + record['stored_label'] = pending['label'] + context = record['context'] + need('remaining_original_case_count' not in context and 'remaining_original_outputs' not in context, + 'G12 candidate remainder fields must be absent before actual original remainder') + try: + record['step'] = 'HELPER_ENTERED' + if _G12_SELECTED_CASE == 'P07': + generator = record['helper_function'](context) + need(type(generator) is record['generator_type'], 'G12 selected P07 did not return its genuine generator') + record['generator'], record['generator_frame'] = generator, generator.gi_frame + _g12_generator_shape(False) + _g12_helper_current() + need(record['first_advances'] == 0, 'G12 P07 first advance repeated') + record['first_advances'] = 1 + try: + observed = next(generator) + except StopIteration as early: + raise RuntimeError('G12 P07 completed before original CLI remainder') from early + record['observed'] = observed + _g12_generator_shape(True) + record['step'] = 'P07_SUSPENDED' + else: + need(_G12_SELECTED_CASE == 'N22', 'G12 source selected an undeclared helper') + _g12_helper_current() + record['observed'] = record['helper_function'](context) + record['step'] = 'N22_RETURNED' + need(type(record['observed']) is dict and + all(type(key) is str for key in record['observed']) and + set(record['observed']) == {'value', 'capacity_retirements', 'owner'} and + suite.terminal is True and suite.active is False and not suite.registry and + suite.pending is None and suite.request_live is None, + 'G12 original N22 did not return its exact terminal continuation observation') + # N22 performed the sole original commit. Never call it again here. + return None + except BaseException as primary: + if record['primary'] is None: + record['primary'] = primary + raise + + + +def _g12_selected_args(args): + need(args.data_lanes == 'candidate' and args.finite_only is False and sys.flags.optimize == 0, + 'G12 selected control requires the original full candidate/assertion scope') + +def _g12_bind_locals(state, extensions, module, binding, phases, invocation_token, + checks_pair, code_pair, label_pair, caller, rank_calls, trace, + captures, stdout, frozen, runtime, engine, output, reference, + reference_bytes, driver_before, pins, frozen_before, engine_before, + runtime_before, copied_engine_before, script_names, new_custody_before, + data_custody_before, anchor_path, anchor_bytes): + record = _G12_CONTINUATION + suite, set_owner = state['epoch_suite'], extensions['set_binding']['owner'] + need(record['started'] is True and record['ready'] is False and record['suite'] is None and + record['reference'] is not None and record['driver'] is sys.modules['__main__'] and + record['driver'].__dict__ is globals() and _EXECUTION['state'] is state and state['enabled'] is True and + suite.module is module and suite.context['driver_function'] is main_epoch and + suite.context['phase_owner'] is phases and suite.context['invocation_token'] is invocation_token and + suite.active is False and suite.terminal is False and suite.invocation_consumed is False and + suite.pending is None and suite.request_live is None and not suite.registry and + set_owner.sealed is True and set_owner.cli_active is False and set_owner.used is False and + set_owner.circuit is None and set_owner.checks is None, + 'G12 requires the original source-owned sealed, unconsumed main-local generation') + for pair in (checks_pair, code_pair, label_pair): + need(type(pair) is tuple and len(pair) == 2 and + all(type(function) is _g12_types.FunctionType for function in pair), + 'G12 original phase pair shape changed') + need(module.Checks.__dict__['__init__'] is checks_pair[1] and module.compile_roles is code_pair[1] and + module.Checks.__dict__['verify_labels'] is label_pair[1], 'G12 actual installed phase pairs changed') + # This fixed source name is also captured by the selected C3 product before + # product publication. It is not a callback parameter or a context entry. + need(_g12_selected_store.__globals__ is globals(), 'G12 fixed source store selector owner changed') + record.update({'suite': suite, 'generation': suite.generation, 'native_owner': suite.owner, 'state': state, 'extensions': extensions, 'module': module, + 'binding': binding, 'phases': phases, 'invocation_token': invocation_token, + 'checks_pair': checks_pair, 'code_pair': code_pair, 'label_pair': label_pair, + 'caller': str(caller), 'rank_calls': rank_calls, 'trace': trace, 'captures': captures, + 'stdout': stdout, 'frozen': frozen, 'runtime': runtime, 'engine': engine, 'output': output, + 'reference_file': reference, 'reference_bytes': reference_bytes, 'driver_before': driver_before, + 'pins': pins, 'frozen_before': frozen_before, 'engine_before': engine_before, + 'runtime_before': runtime_before, 'copied_engine_before': copied_engine_before, + 'script_names': script_names, 'new_custody_before': new_custody_before, + 'data_custody_before': data_custody_before, 'anchor_path': anchor_path, + 'anchor_bytes': anchor_bytes, 'ready': True, 'step': 'CLI_READY'}) + _g12_helper_current() + + +def _g12_diagnostics(): + record = _G12_CONTINUATION + ranks = record['rank_calls'] + need(type(ranks) is list, 'G12 actual original rank list changed') + for item in ranks: + need(type(item) is tuple and len(item) == 2 and type(item[0]) is tuple and + all(type(value) is int for value in item[0]) and type(item[1]) is int, + 'G12 actual original rank event type changed') + binding = record['binding'] + counters = binding['counters'] + need(type(counters) is dict and all(type(key) is str and type(value) is int + for key, value in counters.items()), + 'G12 original native counter primitive types changed') + return {'rank_event_count': len(ranks), 'ordered_rank_events_hex': _g12_bytes(tuple(ranks)).hex(), + 'complement_receipt': record['trace'].receipt(), 'native_counters': dict(counters), + 'cache_receipt': _g12_primitive(record['suite'].receipt), + 'owner_receipt': _g12_primitive(record['suite'].owner.receipt)} + + + +def _g12_complete_capacity_store(checks, circuit, suite): + need(type(circuit.active) is set and len(circuit.active) == 82895 and + all(type(node) is int for node in circuit.active) and + type(circuit.triples) is list and len(circuit.triples) == 2300, + 'G12 actual original h25 active/target census changed') + for target in circuit.triples: + need(type(target) is tuple and len(target) == 3 and all(type(point) is int for point in target) and + 0 <= target[0] < target[1] < target[2] < 25, + 'G12 actual original canonical target changed') + for key in checks.cache: + need(type(key) is int or (type(key) is tuple and len(key) == 2 and type(key[0]) is str and + key[0] == 'perp' and type(key[1]) is tuple and len(key[1]) == 3 and + all(type(point) is int for point in key[1])), 'G12 actual label store key type changed') + need(set(checks.cache) == circuit.active | {('perp', target) for target in circuit.triples}, + 'G12 requires the complete original canonical label store') + labels = tuple(checks.cache.values()) + (checks.everything,) + need(all(type(label) is suite.label for label in labels), 'G12 actual registered Label type changed') + identities = {id(label) for label in labels} + need(len(identities) == 85196 and all(type(key) is int for key in suite.registry) and + set(suite.registry) == identities, 'G12 actual registry includes missing/foreign original Labels') + for label in labels: + entry = suite.registry[id(label)] + need(type(entry) is tuple and len(entry) == 7 and entry[0] is label and entry[1] is label.basis and + entry[2] is label.key and entry[4] is checks and entry[6] is suite.generation, + 'G12 original registry Label/basis/key/generation custody changed') + need(type(label.basis) is dict and all(type(key) is int and type(value) is int + for key, value in label.basis.items()) and + type(label.key) is tuple and all(type(value) is int for value in label.key) and + type(label.dim) is int and label.dim == len(label.basis) and + label.key == tuple(sorted(label.basis.values())), 'G12 original Label primitive state changed') + +def _g12_after_phase(phases, name, function, args, kwargs, result): + record = _G12_CONTINUATION + if not record['ready']: + return result + if name not in ('compile_roles', 'verify_labels', 'complete_original_cli'): + if record['step'] == 'SUFFIX' and name in _G12_SUFFIX_PHASES: + record['suffix_phases'].append(name) + return result + need(phases is record['phases'], 'G12 fixed actual phase owner changed') + _g12_helper_current() + if name == 'compile_roles': + need(record['step'] == 'CLI_READY' and type(args) is tuple and len(args) == 1 and not kwargs and + function is record['code_pair'][0] and record['module'].compile_roles is record['code_pair'][1] and + type(args[0]) is record['module'].ComplexSideCircuit, + 'G12 actual original compile-role return checkpoint changed') + record.update({'circuit': args[0], 'code': result, 'code_before': _g12_code_snapshot(result), 'step': 'COMPILED'}) + return result + if name == 'verify_labels': + need(record['step'] == 'COMPILED' and type(args) is tuple and len(args) == 1 and not kwargs and + function is record['label_pair'][0] and record['module'].Checks.__dict__['verify_labels'] is record['label_pair'][1], + 'G12 actual original label-phase return checkpoint changed') + suite, checks, circuit = record['suite'], args[0], record['circuit'] + set_owner = record['extensions']['set_binding']['owner'] + need(type(checks) is suite.checks_class and checks.c is circuit and + type(checks.h) is int and type(circuit.h) is int and checks.h == circuit.h == 25 and + suite.active is True and suite.terminal is False and suite.invocation_consumed is True and + suite.primary_error is None and suite.pending is None and suite.request_live is None and + suite.checks is checks and suite.checks_c is circuit and + set_owner.cli_active is True and set_owner.used is False and set_owner.circuit is circuit and + set_owner.checks is checks and set_owner.triples is circuit.triples and + type(suite.registry) is dict and len(suite.registry) == 85196 and type(checks.cache) is dict and + len(checks.cache) == 85195 and ('perp', (0, 2, 1)) not in checks.cache, + 'G12 genuine post-label original capacity checkpoint changed') + _g12_complete_capacity_store(checks, circuit, suite) + cleanup = record['state']['epoch_cli_cleanup'] + need(type(cleanup) is dict and cleanup['primary'] is None and cleanup['argv_error'] is None and + cleanup['disarm_error'] is None and cleanup['retirement_error'] is None and + type(sys.argv) is list and sys.argv == [record['caller']] and sys.argv is not cleanup['argv_owner'], + 'G12 must be inside original protected CLI after actual arming') + c1 = suite.registry.get(id(checks.everything)) + need(type(c1) is tuple and len(c1) == 7 and c1[0] is checks.everything and c1[1] is checks.everything.basis and + c1[2] is checks.everything.key and c1[4] is checks and c1[5] == 'C1' and c1[6] == suite.generation, + 'G12 registered_label must be actual original C1 store') + need(_g12_code_snapshot(record['code']) == record['code_before'], 'G12 original code changed before control store') + literal, reference_count, reference_outputs, _ = record['reference'] + record['checks'] = checks + record['context'] = {'bundle': _INITIAL_EPOCH_BUNDLE, 'state': record['state'], 'site': 'C3', + 'checks': checks, 'registered_label': checks.everything, 'literal_expected': literal, + 'reference_remaining_case_count': reference_count, 'reference_remaining_outputs': reference_outputs} + record['prefix_end'] = _g12_diagnostics() + record['step'] = 'EXPECT_STORE' + actual_label = checks.target_frame((0, 2, 1)) + need(record['store_entries'] == 1 and actual_label is record['stored_label'] and + checks.cache[('perp', (0, 2, 1))] is actual_label and + record['step'] == ('P07_SUSPENDED' if _G12_SELECTED_CASE == 'P07' else 'N22_RETURNED'), + 'G12 actual selected store did not complete exactly once') + record['suffix_start'] = _g12_diagnostics() + record['rank_prefix'] = _g12_bytes(tuple(record['rank_calls'])) + record['rank_index'] = len(record['rank_calls']) + record['step'] = 'SUFFIX' + return result + need(record['step'] == 'SUFFIX' and function is runpy.run_path and type(args) is tuple and len(args) == 1 and + args[0] == record['caller'] and type(kwargs) is dict and tuple(kwargs) == ('run_name',) and kwargs['run_name'] == '__main__', + 'G12 actual same-invocation original CLI return changed') + record['suffix_phases'].append(name) + _g12_complete_original_cli(result) + marker = _G12ControlCompletion('G12 intentional ' + _G12_SELECTED_CASE + ' original-CLI control completion') + record['marker'], record['step'] = marker, 'MARKED' + raise marker + + +def _g12_complete_original_cli(namespace): + record = _G12_CONTINUATION + module, captures = record['module'], record['captures'] + need(type(namespace) is dict and all(type(key) is str for key in namespace) and + sys.modules.get('complex_circuit') is module and namespace.get('ComplexSideCircuit') is module.ComplexSideCircuit and + namespace.get('Checks') is module.Checks and namespace.get('compile_roles') is module.compile_roles and + namespace.get('verify_role_frames') is module.verify_role_frames and + namespace.get('serializable') is sys.modules['prepare_layers'].serializable, + 'G12 original completed CLI namespace/observer binding changed') + need(type(captures) is dict and all(type(key) is str for key in captures) and set(captures) == {'side', 'full_return'} and + type(captures['side']) is tuple and len(captures['side']) == 4, 'G12 actual original capture set changed') + circuit, checks, code, roles = captures['side'] + full_return = captures['full_return'] + need(circuit is record['circuit'] and checks is record['checks'] and code is record['code'] and + type(full_return) is dict and all(type(key) is str for key in full_return) and + full_return.get('role_frames') is roles and full_return.get('upstream_commit') == UPSTREAM, + 'G12 actual same original generation/full role result changed') + stdout_text = record['stdout'].getvalue() + certificate = (record['runtime'] / 'certificates/complex-network.json').read_bytes() + need(stdout_text == EXPECTED_STDOUT and certificate == record['reference_bytes'], + 'G12 original fresh certificate/stdout differs from original immutable pins') + for name in ('side_construction', 'checks_initialization', 'compile_roles', 'verify_map', 'verify_labels', + 'verify_role_frames', 'original_upstream_verify_sources', 'full_log_integer_bounds', 'original_serializable'): + need(record['phases'].rows.get(name, {}).get('calls') == 1, 'G12 original phase omitted/repeated: ' + name) + need('complete_original_cli' not in record['phases'].rows, 'G12 original complete-CLI finally already ran') + _g12_original_imports() + outputs = _g12_common_outputs(code, record['code_before'], roles, full_return, certificate, + stdout_text, tuple(record['suffix_phases'])) + count = _g12_remaining_count(code) + need(_g12_bytes(tuple(record['rank_calls'][:record['rank_index']])) == record['rank_prefix'], + 'G12 actual original rank prefix changed') + record.update({'common': outputs, 'case_count': count, 'cli_end': _g12_diagnostics(), + 'rank_suffix': _g12_bytes(tuple(record['rank_calls'][record['rank_index']:])), + 'namespace': namespace, 'full_return': full_return, 'roles': roles}) + native_start = record['suffix_start']['native_counters'] + native_end = record['cli_end']['native_counters'] + need(set(native_start) == set(native_end), 'G12 original native counter domain changed across suffix') + record['native_suffix_delta'] = {key: native_end[key] - value for key, value in native_start.items()} + if _G12_SELECTED_CASE == 'P07': + context = record['context'] + need('remaining_original_case_count' not in context and 'remaining_original_outputs' not in context and + record['second_advances'] == 0, 'G12 candidate actual remainder publication/advance repeated') + _g12_generator_shape(True) + context['remaining_original_case_count'] = count + context['remaining_original_outputs'] = outputs + _g12_helper_current() + _g12_generator_shape(True) + record['second_advances'] = 1 + try: + next(record['generator']) + except StopIteration as completed: + need(completed.value is record['observed'], 'G12 original P07 returned a different observation object') + else: + raise RuntimeError('G12 selected P07 yielded again instead of original comparisons/return') + need(record['generator'].gi_frame is None, 'G12 P07 frame remained live after original return') + record['p07_returned_original_observation'] = record['observed'] + else: + need(_G12_SELECTED_CASE == 'N22' and record['generator'] is None, + 'G12 original N22 selection acquired a P07 continuation') + + +def _g12_original_imports(): + record = _G12_CONTINUATION + for name in record['script_names'] - {'complex_network'}: + module = sys.modules.get(name) + expected = record['engine'] / 'source/complex_circuit.py' if name == 'complex_circuit' else record['runtime'] / 'scripts' / (name + '.py') + need(type(module) is _g12_types.ModuleType and Path(module.__file__).resolve() == expected.resolve(), + 'G12 actual original scientific import path changed: ' + name) + + +def _g12_original_terminal_custody(): + record = _G12_CONTINUATION + need(inventory(record['frozen'], record['pins']) == record['frozen_before'] and + inventory(HERE / 'engine', ENGINE_PINS) == record['engine_before'] and + inventory(record['runtime'], record['pins'], exact=False) == record['runtime_before'] and + inventory(record['engine'], ENGINE_PINS) == record['copied_engine_before'], + 'G12 original source/input inventory or modes changed') + files = {str(path.relative_to(record['runtime'])) for path in record['runtime'].rglob('*') if path.is_file()} + need(files == set(record['pins']) | {'certificates/complex-network.json'} and + Path(__file__).read_bytes() == record['driver_before'] and + record['reference_file'].read_bytes() == record['reference_bytes'], + 'G12 original output/selected source/reference custody changed') + need(adapters.custody(ROUND, 'all') == record['new_custody_before'] and + data_adapters.custody(ROUND) == record['data_custody_before'] and + (record['anchor_bytes'] is None or record['anchor_path'].read_bytes() == record['anchor_bytes']), + 'G12 original selected-source/anchor custody changed') + _g12_original_imports() + for name in ('side_construction', 'checks_initialization', 'compile_roles', 'verify_map', 'verify_labels', + 'verify_role_frames', 'original_upstream_verify_sources', 'full_log_integer_bounds', + 'original_serializable', 'complete_original_cli'): + need(record['phases'].rows.get(name, {}).get('calls') == 1, + 'G12 complete original phase finally/count changed: ' + name) + + +def _g12_after_original_exit(primary): + record = _G12_CONTINUATION + if record['primary'] is None: + record['primary'] = primary + generator = record['generator'] + if generator is not None and generator.gi_frame is not None: + try: + # No original CLI resume occurs on failure. Original P07 source has + # no finally clause; closing this exact suspended code only releases + # its retained frame after original CLI/main/STOP/owned cleanup. + _g12_generator_shape(True) + need(record['close_attempts'] == 0, 'G12 suspended P07 close repeated') + record['close_attempts'] = 1 + generator.close() + need(generator.gi_frame is None, 'G12 exact suspended P07 did not close') + except BaseException as secondary: + try: + record['secondary_clear'] = False + record['frame_close_error'] = secondary + record['secondary'].append((secondary, secondary.__traceback__, 'P07-frame-close')) + except BaseException: + pass + if primary is record['marker'] and record['step'] == 'MARKED': + try: + _g12_original_terminal_custody() + need(record['secondary_clear'] is True and + record['frame_close_error'] is None and record['terminal_observation_error'] is None and + record['adapter_exit_error'] is None and not record['secondary'], + 'G12 source-control secondary error or incomplete journal blocks observation export') + row = {'schema': 'g12-original-control-observation-v1', 'case': _G12_SELECTED_CASE, + 'selected_driver_sha256': sha(record['driver_before']), + 'reference_provenance': record['reference'][3], + 'original_helper_observation': _g12_primitive(record['observed']), + 'remaining_original_case_count': record['case_count'], + 'common_payload_sha256': sha(record['common']), 'common_payload_hex': record['common'].hex(), + 'prefix_end': record['prefix_end'], 'suffix_start': record['suffix_start'], 'cli_end': record['cli_end'], + 'ordered_rank_suffix_hex': record['rank_suffix'].hex(), 'native_suffix_delta': record['native_suffix_delta'], + 'phases': record['phases'].rows, + 'store_entries': record['store_entries'], 'first_advances': record['first_advances'], + 'second_advances': record['second_advances'], 'close_attempts': record['close_attempts'], + 'disposition_qualification': 'OPEN_REQUIRES_SEPARATE_ORIGINAL_STOP_AND_ALL_OWNED_CLEANUP_REVIEW', + 'scope': 'Original selected N22/P07 observation plus same-invocation original CLI remainder only. No original full-positive publication/native-count/P02/G12/FULL admission.'} + with (record['output'] / 'g12-control-observation.json').open('xb') as stream: + stream.write(canonical(row) + b'\n') + except BaseException as secondary: + try: + record['secondary_clear'] = False + record['terminal_observation_error'] = secondary + record['secondary'].append((secondary, secondary.__traceback__, 'terminal-source-observation')) + except BaseException: + pass + for secondary, traceback, phase in record['secondary']: + try: + sys.stderr.write('G12 secondary continuation error: ' + phase + '\n') + _g12_traceback.print_exception(type(secondary), secondary, traceback, file=sys.stderr) + except BaseException: + pass + + +def _g12_continuation_entry(): + record = _G12_CONTINUATION + need(record['started'] is False and _G12_SELECTED_CASE in ('N22', 'P07'), 'G12 source control entry is one-use') + record['started'] = True + record['driver'] = sys.modules['__main__'] + need(record['driver'].__dict__ is globals(), 'G12 source control requires actual Root-installed driver namespace') + need(type(_G12_TRANSPORT_SOURCE_PIN) is str and len(_G12_TRANSPORT_SOURCE_PIN) == 64, + 'G12 reference transport source has not been selected') + helper, helper_handle = _g12_cold(0, str(ROUND / 'areas/cache-validity/g12_source_controls.py'), + _G12_SELECTED_HELPER_PIN, '_h25_g12_source_controls') + transport, transport_handle = _g12_cold(0, str(ROUND / 'areas/cache-validity/g12_reference_transport.py'), + _G12_TRANSPORT_SOURCE_PIN, '_h25_g12_reference_transport') + reference = _g12_cold(1, transport_handle, 'load_original_g12_reference', + _CAPTURED_BOOTSTRAP_ROOT, _CAPTURED_BOOTSTRAP_CAPABILITY, _CAPTURED_BOOTSTRAP_API) + need(type(reference) is tuple and len(reference) == 4 and type(reference[0]) is bool and + type(reference[1]) is int and reference[1] > 0 and type(reference[2]) is bytes and type(reference[3]) is tuple, + 'G12 actual source-produced independent reference transport shape changed') + source = _g12_cold(2, helper_handle) + function = helper.__dict__[_G12_SELECTED_CASE] + need(source[1] is helper and source[5] == _G12_SELECTED_HELPER_PIN and + type(function) is _g12_types.FunctionType and function.__globals__ is helper.__dict__ and + bool(function.__code__.co_flags & 0x20) is (_G12_SELECTED_CASE == 'P07'), + 'G12 exact selected helper source/generator protocol changed') + record.update({'helper_handle': helper_handle, 'helper_module': helper, 'helper_function': function, + 'helper_code': function.__code__, 'transport_handle': transport_handle, + 'reference': reference, 'generator_type': _g12_types.GeneratorType, 'step': 'PREPARED'}) + try: + _run_epoch_with_stop_evidence() + except BaseException as primary: + # Original CLI/main/STOP/owned cleanup has already run. Preserve the + # identical primary and cause; every adapter cleanup error is secondary. + try: + _g12_after_original_exit(primary) + except BaseException as secondary: + try: + record['secondary_clear'] = False + record['adapter_exit_error'] = secondary + record['secondary'].append((secondary, secondary.__traceback__, 'adapter-exit-entry')) + except BaseException: + pass + raise + raise RuntimeError('G12 source control reached original full-positive return without its intentional marker') diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_P07_custody_v1.py.txt b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_P07_custody_v1.py.txt new file mode 100644 index 0000000000..52c25fdbed --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_candidate_driver_support_P07_custody_v1.py.txt @@ -0,0 +1,508 @@ +# Fixed G12 source-control support, appended to the selected epoch driver. +# SOURCE ONLY. No source selection, FULL approval or execution is supplied here. +import types as _g12_types +import traceback as _g12_traceback + +_G12_SELECTED_CASE = 'P07' +_G12_SELECTED_HELPER_PIN = 'eae1fca1f951a572a3487e5136454d80f16124cc02fef296793830c50431b061' +_G12_TRANSPORT_SOURCE_PIN = None +_G12_CONTINUATION = {'started': False, 'step': 'EMPTY', 'ready': False, + 'helper_handle': None, 'helper_module': None, 'helper_function': None, + 'transport_handle': None, 'reference': None, 'suite': None, + 'generator': None, 'generator_frame': None, 'observed': None, + 'context': None, 'marker': None, 'primary': None, + 'secondary': [], 'secondary_clear': True, + 'frame_close_error': None, 'terminal_observation_error': None, + 'adapter_exit_error': None, 'suffix_phases': [], 'store_entries': 0, + 'first_advances': 0, 'second_advances': 0, 'close_attempts': 0} + + +class _G12ControlCompletion(RuntimeError): + """Only the exact recorded object is this selected control's completion.""" + + +def _g12_cold(index, *args): + descriptor = _INITIAL_COLD_CALLER_DESCRIPTOR + need(type(descriptor) is tuple and len(descriptor) == 6 and + descriptor[1] is _INITIAL_COLD_AUTHORITY and type(index) is int and index in (0, 1, 2), + 'G12 original cold operation/descriptor differs') + primitive, function, record = descriptor[5], descriptor[2], descriptor[3] + need(type(primitive) is tuple and len(primitive) == 19 and primitive[0] is type and + primitive[1] is _g12_types.FunctionType and primitive[2] is id and primitive[18] is zip and + type(function) is primitive[1] and function is record[0], + 'G12 original cold caller primitives differ') + for (_, getter), expected in primitive[18](primitive[4], record[1:7]): + need(getter(function, primitive[1]) is expected, 'G12 cold dispatcher field changed') + need(record[4] is None and record[5] is None and not record[7], 'G12 cold dispatcher defaults changed') + for cell, expected in record[8]: + need(primitive[6](cell, primitive[5]) is expected, 'G12 cold dispatcher closure changed') + return function(index, *args) + + +def _g12_helper_current(): + record = _G12_CONTINUATION + source = _g12_cold(2, record['helper_handle']) + module = record['helper_module'] + need(source[1] is module and source[2] is module.__dict__ and + source[5] == _G12_SELECTED_HELPER_PIN and + module.__dict__.get(_G12_SELECTED_CASE) is record['helper_function'] and + record['helper_function'].__code__ is record['helper_code'], + 'G12 selected actual helper source/callable changed') + suite = record['suite'] + need(record['state']['epoch_suite'] is suite and suite.context['driver_function'] is main_epoch and + suite.context['phase_owner'] is record['phases'] and + suite.context['invocation_token'] is record['invocation_token'] and + suite.generation is record['generation'] and suite.owner is record['native_owner'], + 'G12 selected suite/driver/phase/token changed') + # Direct source-owned names extend both captured driver and C3 handler graphs + # to the actual outer entry, exit controller and terminal custody predicate. + need(type(_g12_continuation_entry) is _g12_types.FunctionType and + _g12_continuation_entry.__globals__ is globals() and + type(_g12_after_original_exit) is _g12_types.FunctionType and + _g12_after_original_exit.__globals__ is globals() and + type(_g12_original_terminal_custody) is _g12_types.FunctionType and + _g12_original_terminal_custody.__globals__ is globals(), + 'G12 actual outer entry/exit/custody source owner changed') + suite.current() + + +def _g12_generator_shape(suspended): + record = _G12_CONTINUATION + generator, context = record['generator'], record['context'] + need(type(generator) is record['generator_type'] and generator.gi_code is record['helper_code'] and + generator.gi_running is False and generator.gi_yieldfrom is None and + generator.gi_suspended is suspended and generator.gi_frame is record['generator_frame'] and + generator.gi_frame is not None and generator.gi_frame.f_globals is record['helper_module'].__dict__, + 'G12 P07 exact generator/frame/source shape changed') + local = generator.gi_frame.f_locals + need(type(local) is dict and local.get('c') is context, + 'G12 P07 generator context identity changed') + if suspended: + need(local.get('observed') is record['observed'], 'G12 P07 suspended observation identity changed') + else: + need('observed' not in local, 'G12 P07 body already ran before selected first advance') + + +def _g12_selected_store(suite, original_commit, site, checks): + record = _G12_CONTINUATION + if record['step'] != 'EXPECT_STORE': + return original_commit(site, checks) + need(record['ready'] is True and suite is record['suite'] and site == 'C3' and + type(site) is str and checks is record['checks'] and + type(original_commit) is _g12_types.MethodType and original_commit.__self__ is suite and + original_commit.__func__ is type(suite).__dict__['commit'] and record['store_entries'] == 0, + 'G12 selected original C3 continuation owner changed') + _g12_helper_current() + pending = suite.pending + need(type(pending) is dict and pending.get('site') == 'C3' and pending.get('checks') is checks and + type(pending.get('key')) is tuple and pending['key'] == ('perp', (0, 2, 1)) and + type(pending.get('label')) is suite.label and + checks.cache.get(('perp', (0, 2, 1))) is pending['label'] and + suite.active is True and suite.terminal is False and suite.request_live is None and + type(suite.registry) is dict and len(suite.registry) == 85196, + 'G12 requires actual pending extra C3 store at original capacity') + record['store_entries'] = 1 + record['pending_store'] = pending + record['stored_label'] = pending['label'] + context = record['context'] + need('remaining_original_case_count' not in context and 'remaining_original_outputs' not in context, + 'G12 candidate remainder fields must be absent before actual original remainder') + try: + record['step'] = 'HELPER_ENTERED' + if _G12_SELECTED_CASE == 'P07': + generator = record['helper_function'](context) + need(type(generator) is record['generator_type'], 'G12 selected P07 did not return its genuine generator') + record['generator'], record['generator_frame'] = generator, generator.gi_frame + _g12_generator_shape(False) + _g12_helper_current() + need(record['first_advances'] == 0, 'G12 P07 first advance repeated') + record['first_advances'] = 1 + try: + observed = next(generator) + except StopIteration as early: + raise RuntimeError('G12 P07 completed before original CLI remainder') from early + record['observed'] = observed + _g12_generator_shape(True) + record['step'] = 'P07_SUSPENDED' + else: + need(_G12_SELECTED_CASE == 'N22', 'G12 source selected an undeclared helper') + _g12_helper_current() + record['observed'] = record['helper_function'](context) + record['step'] = 'N22_RETURNED' + need(type(record['observed']) is dict and + all(type(key) is str for key in record['observed']) and + set(record['observed']) == {'value', 'capacity_retirements', 'owner'} and + suite.terminal is True and suite.active is False and not suite.registry and + suite.pending is None and suite.request_live is None, + 'G12 original N22 did not return its exact terminal continuation observation') + # N22 performed the sole original commit. Never call it again here. + return None + except BaseException as primary: + if record['primary'] is None: + record['primary'] = primary + raise + + + +def _g12_selected_args(args): + need(args.data_lanes == 'candidate' and args.finite_only is False and sys.flags.optimize == 0, + 'G12 selected control requires the original full candidate/assertion scope') + +def _g12_bind_locals(state, extensions, module, binding, phases, invocation_token, + checks_pair, code_pair, label_pair, caller, rank_calls, trace, + captures, stdout, frozen, runtime, engine, output, reference, + reference_bytes, driver_before, pins, frozen_before, engine_before, + runtime_before, copied_engine_before, script_names, new_custody_before, + data_custody_before, anchor_path, anchor_bytes): + record = _G12_CONTINUATION + suite, set_owner = state['epoch_suite'], extensions['set_binding']['owner'] + need(record['started'] is True and record['ready'] is False and record['suite'] is None and + record['reference'] is not None and record['driver'] is sys.modules['__main__'] and + record['driver'].__dict__ is globals() and _EXECUTION['state'] is state and state['enabled'] is True and + suite.module is module and suite.context['driver_function'] is main_epoch and + suite.context['phase_owner'] is phases and suite.context['invocation_token'] is invocation_token and + suite.active is False and suite.terminal is False and suite.invocation_consumed is False and + suite.pending is None and suite.request_live is None and not suite.registry and + set_owner.sealed is True and set_owner.cli_active is False and set_owner.used is False and + set_owner.circuit is None and set_owner.checks is None, + 'G12 requires the original source-owned sealed, unconsumed main-local generation') + for pair in (checks_pair, code_pair, label_pair): + need(type(pair) is tuple and len(pair) == 2 and + all(type(function) is _g12_types.FunctionType for function in pair), + 'G12 original phase pair shape changed') + need(module.Checks.__dict__['__init__'] is checks_pair[1] and module.compile_roles is code_pair[1] and + module.Checks.__dict__['verify_labels'] is label_pair[1], 'G12 actual installed phase pairs changed') + # This fixed source name is also captured by the selected C3 product before + # product publication. It is not a callback parameter or a context entry. + need(_g12_selected_store.__globals__ is globals(), 'G12 fixed source store selector owner changed') + record.update({'suite': suite, 'generation': suite.generation, 'native_owner': suite.owner, 'state': state, 'extensions': extensions, 'module': module, + 'binding': binding, 'phases': phases, 'invocation_token': invocation_token, + 'checks_pair': checks_pair, 'code_pair': code_pair, 'label_pair': label_pair, + 'caller': str(caller), 'rank_calls': rank_calls, 'trace': trace, 'captures': captures, + 'stdout': stdout, 'frozen': frozen, 'runtime': runtime, 'engine': engine, 'output': output, + 'reference_file': reference, 'reference_bytes': reference_bytes, 'driver_before': driver_before, + 'pins': pins, 'frozen_before': frozen_before, 'engine_before': engine_before, + 'runtime_before': runtime_before, 'copied_engine_before': copied_engine_before, + 'script_names': script_names, 'new_custody_before': new_custody_before, + 'data_custody_before': data_custody_before, 'anchor_path': anchor_path, + 'anchor_bytes': anchor_bytes, 'ready': True, 'step': 'CLI_READY'}) + _g12_helper_current() + + +def _g12_diagnostics(): + record = _G12_CONTINUATION + ranks = record['rank_calls'] + need(type(ranks) is list, 'G12 actual original rank list changed') + for item in ranks: + need(type(item) is tuple and len(item) == 2 and type(item[0]) is tuple and + all(type(value) is int for value in item[0]) and type(item[1]) is int, + 'G12 actual original rank event type changed') + binding = record['binding'] + counters = binding['counters'] + need(type(counters) is dict and all(type(key) is str and type(value) is int + for key, value in counters.items()), + 'G12 original native counter primitive types changed') + return {'rank_event_count': len(ranks), 'ordered_rank_events_hex': _g12_bytes(tuple(ranks)).hex(), + 'complement_receipt': record['trace'].receipt(), 'native_counters': dict(counters), + 'cache_receipt': _g12_primitive(record['suite'].receipt), + 'owner_receipt': _g12_primitive(record['suite'].owner.receipt)} + + + +def _g12_complete_capacity_store(checks, circuit, suite): + need(type(circuit.active) is set and len(circuit.active) == 82895 and + all(type(node) is int for node in circuit.active) and + type(circuit.triples) is list and len(circuit.triples) == 2300, + 'G12 actual original h25 active/target census changed') + for target in circuit.triples: + need(type(target) is tuple and len(target) == 3 and all(type(point) is int for point in target) and + 0 <= target[0] < target[1] < target[2] < 25, + 'G12 actual original canonical target changed') + for key in checks.cache: + need(type(key) is int or (type(key) is tuple and len(key) == 2 and type(key[0]) is str and + key[0] == 'perp' and type(key[1]) is tuple and len(key[1]) == 3 and + all(type(point) is int for point in key[1])), 'G12 actual label store key type changed') + need(set(checks.cache) == circuit.active | {('perp', target) for target in circuit.triples}, + 'G12 requires the complete original canonical label store') + labels = tuple(checks.cache.values()) + (checks.everything,) + need(all(type(label) is suite.label for label in labels), 'G12 actual registered Label type changed') + identities = {id(label) for label in labels} + need(len(identities) == 85196 and all(type(key) is int for key in suite.registry) and + set(suite.registry) == identities, 'G12 actual registry includes missing/foreign original Labels') + for label in labels: + entry = suite.registry[id(label)] + need(type(entry) is tuple and len(entry) == 7 and entry[0] is label and entry[1] is label.basis and + entry[2] is label.key and entry[4] is checks and entry[6] is suite.generation, + 'G12 original registry Label/basis/key/generation custody changed') + need(type(label.basis) is dict and all(type(key) is int and type(value) is int + for key, value in label.basis.items()) and + type(label.key) is tuple and all(type(value) is int for value in label.key) and + type(label.dim) is int and label.dim == len(label.basis) and + label.key == tuple(sorted(label.basis.values())), 'G12 original Label primitive state changed') + +def _g12_after_phase(phases, name, function, args, kwargs, result): + record = _G12_CONTINUATION + if not record['ready']: + return result + if name not in ('compile_roles', 'verify_labels', 'complete_original_cli'): + if record['step'] == 'SUFFIX' and name in _G12_SUFFIX_PHASES: + record['suffix_phases'].append(name) + return result + need(phases is record['phases'], 'G12 fixed actual phase owner changed') + _g12_helper_current() + if name == 'compile_roles': + need(record['step'] == 'CLI_READY' and type(args) is tuple and len(args) == 1 and not kwargs and + function is record['code_pair'][0] and record['module'].compile_roles is record['code_pair'][1] and + type(args[0]) is record['module'].ComplexSideCircuit, + 'G12 actual original compile-role return checkpoint changed') + record.update({'circuit': args[0], 'code': result, 'code_before': _g12_code_snapshot(result), 'step': 'COMPILED'}) + return result + if name == 'verify_labels': + need(record['step'] == 'COMPILED' and type(args) is tuple and len(args) == 1 and not kwargs and + function is record['label_pair'][0] and record['module'].Checks.__dict__['verify_labels'] is record['label_pair'][1], + 'G12 actual original label-phase return checkpoint changed') + suite, checks, circuit = record['suite'], args[0], record['circuit'] + set_owner = record['extensions']['set_binding']['owner'] + need(type(checks) is suite.checks_class and checks.c is circuit and + type(checks.h) is int and type(circuit.h) is int and checks.h == circuit.h == 25 and + suite.active is True and suite.terminal is False and suite.invocation_consumed is True and + suite.primary_error is None and suite.pending is None and suite.request_live is None and + suite.checks is checks and suite.checks_c is circuit and + set_owner.cli_active is True and set_owner.used is False and set_owner.circuit is circuit and + set_owner.checks is checks and set_owner.triples is circuit.triples and + type(suite.registry) is dict and len(suite.registry) == 85196 and type(checks.cache) is dict and + len(checks.cache) == 85195 and ('perp', (0, 2, 1)) not in checks.cache, + 'G12 genuine post-label original capacity checkpoint changed') + _g12_complete_capacity_store(checks, circuit, suite) + cleanup = record['state']['epoch_cli_cleanup'] + need(type(cleanup) is dict and cleanup['primary'] is None and cleanup['argv_error'] is None and + cleanup['disarm_error'] is None and cleanup['retirement_error'] is None and + type(sys.argv) is list and sys.argv == [record['caller']] and sys.argv is not cleanup['argv_owner'], + 'G12 must be inside original protected CLI after actual arming') + c1 = suite.registry.get(id(checks.everything)) + need(type(c1) is tuple and len(c1) == 7 and c1[0] is checks.everything and c1[1] is checks.everything.basis and + c1[2] is checks.everything.key and c1[4] is checks and c1[5] == 'C1' and c1[6] == suite.generation, + 'G12 registered_label must be actual original C1 store') + need(_g12_code_snapshot(record['code']) == record['code_before'], 'G12 original code changed before control store') + literal, reference_count, reference_outputs, _ = record['reference'] + record['checks'] = checks + record['context'] = {'bundle': _INITIAL_EPOCH_BUNDLE, 'state': record['state'], 'site': 'C3', + 'checks': checks, 'registered_label': checks.everything, 'literal_expected': literal, + 'reference_remaining_case_count': reference_count, 'reference_remaining_outputs': reference_outputs} + record['prefix_end'] = _g12_diagnostics() + record['step'] = 'EXPECT_STORE' + actual_label = checks.target_frame((0, 2, 1)) + need(record['store_entries'] == 1 and actual_label is record['stored_label'] and + checks.cache[('perp', (0, 2, 1))] is actual_label and + record['step'] == ('P07_SUSPENDED' if _G12_SELECTED_CASE == 'P07' else 'N22_RETURNED'), + 'G12 actual selected store did not complete exactly once') + record['suffix_start'] = _g12_diagnostics() + record['rank_prefix'] = _g12_bytes(tuple(record['rank_calls'])) + record['rank_index'] = len(record['rank_calls']) + record['step'] = 'SUFFIX' + return result + need(record['step'] == 'SUFFIX' and function is runpy.run_path and type(args) is tuple and len(args) == 1 and + args[0] == record['caller'] and type(kwargs) is dict and tuple(kwargs) == ('run_name',) and kwargs['run_name'] == '__main__', + 'G12 actual same-invocation original CLI return changed') + record['suffix_phases'].append(name) + _g12_complete_original_cli(result) + marker = _G12ControlCompletion('G12 intentional ' + _G12_SELECTED_CASE + ' original-CLI control completion') + record['marker'], record['step'] = marker, 'MARKED' + raise marker + + +def _g12_complete_original_cli(namespace): + record = _G12_CONTINUATION + module, captures = record['module'], record['captures'] + need(type(namespace) is dict and all(type(key) is str for key in namespace) and + sys.modules.get('complex_circuit') is module and namespace.get('ComplexSideCircuit') is module.ComplexSideCircuit and + namespace.get('Checks') is module.Checks and namespace.get('compile_roles') is module.compile_roles and + namespace.get('verify_role_frames') is module.verify_role_frames and + namespace.get('serializable') is sys.modules['prepare_layers'].serializable, + 'G12 original completed CLI namespace/observer binding changed') + need(type(captures) is dict and all(type(key) is str for key in captures) and set(captures) == {'side', 'full_return'} and + type(captures['side']) is tuple and len(captures['side']) == 4, 'G12 actual original capture set changed') + circuit, checks, code, roles = captures['side'] + full_return = captures['full_return'] + need(circuit is record['circuit'] and checks is record['checks'] and code is record['code'] and + type(full_return) is dict and all(type(key) is str for key in full_return) and + full_return.get('role_frames') is roles and full_return.get('upstream_commit') == UPSTREAM, + 'G12 actual same original generation/full role result changed') + stdout_text = record['stdout'].getvalue() + certificate = (record['runtime'] / 'certificates/complex-network.json').read_bytes() + need(stdout_text == EXPECTED_STDOUT and certificate == record['reference_bytes'], + 'G12 original fresh certificate/stdout differs from original immutable pins') + for name in ('side_construction', 'checks_initialization', 'compile_roles', 'verify_map', 'verify_labels', + 'verify_role_frames', 'original_upstream_verify_sources', 'full_log_integer_bounds', 'original_serializable'): + need(record['phases'].rows.get(name, {}).get('calls') == 1, 'G12 original phase omitted/repeated: ' + name) + need('complete_original_cli' not in record['phases'].rows, 'G12 original complete-CLI finally already ran') + _g12_original_imports() + outputs = _g12_common_outputs(code, record['code_before'], roles, full_return, certificate, + stdout_text, tuple(record['suffix_phases'])) + count = _g12_remaining_count(code) + need(_g12_bytes(tuple(record['rank_calls'][:record['rank_index']])) == record['rank_prefix'], + 'G12 actual original rank prefix changed') + record.update({'common': outputs, 'case_count': count, 'cli_end': _g12_diagnostics(), + 'rank_suffix': _g12_bytes(tuple(record['rank_calls'][record['rank_index']:])), + 'namespace': namespace, 'full_return': full_return, 'roles': roles}) + native_start = record['suffix_start']['native_counters'] + native_end = record['cli_end']['native_counters'] + need(set(native_start) == set(native_end), 'G12 original native counter domain changed across suffix') + record['native_suffix_delta'] = {key: native_end[key] - value for key, value in native_start.items()} + if _G12_SELECTED_CASE == 'P07': + context = record['context'] + need('remaining_original_case_count' not in context and 'remaining_original_outputs' not in context and + record['second_advances'] == 0, 'G12 candidate actual remainder publication/advance repeated') + _g12_generator_shape(True) + context['remaining_original_case_count'] = count + context['remaining_original_outputs'] = outputs + _g12_helper_current() + _g12_generator_shape(True) + record['second_advances'] = 1 + try: + next(record['generator']) + except StopIteration as completed: + need(completed.value is record['observed'], 'G12 original P07 returned a different observation object') + else: + raise RuntimeError('G12 selected P07 yielded again instead of original comparisons/return') + need(record['generator'].gi_frame is None, 'G12 P07 frame remained live after original return') + record['p07_returned_original_observation'] = record['observed'] + else: + need(_G12_SELECTED_CASE == 'N22' and record['generator'] is None, + 'G12 original N22 selection acquired a P07 continuation') + + +def _g12_original_imports(): + record = _G12_CONTINUATION + for name in record['script_names'] - {'complex_network'}: + module = sys.modules.get(name) + expected = record['engine'] / 'source/complex_circuit.py' if name == 'complex_circuit' else record['runtime'] / 'scripts' / (name + '.py') + need(type(module) is _g12_types.ModuleType and Path(module.__file__).resolve() == expected.resolve(), + 'G12 actual original scientific import path changed: ' + name) + + +def _g12_original_terminal_custody(): + record = _G12_CONTINUATION + need(inventory(record['frozen'], record['pins']) == record['frozen_before'] and + inventory(HERE / 'engine', ENGINE_PINS) == record['engine_before'] and + inventory(record['runtime'], record['pins'], exact=False) == record['runtime_before'] and + inventory(record['engine'], ENGINE_PINS) == record['copied_engine_before'], + 'G12 original source/input inventory or modes changed') + files = {str(path.relative_to(record['runtime'])) for path in record['runtime'].rglob('*') if path.is_file()} + need(files == set(record['pins']) | {'certificates/complex-network.json'} and + Path(__file__).read_bytes() == record['driver_before'] and + record['reference_file'].read_bytes() == record['reference_bytes'], + 'G12 original output/selected source/reference custody changed') + need(adapters.custody(ROUND, 'all') == record['new_custody_before'] and + data_adapters.custody(ROUND) == record['data_custody_before'] and + (record['anchor_bytes'] is None or record['anchor_path'].read_bytes() == record['anchor_bytes']), + 'G12 original selected-source/anchor custody changed') + _g12_original_imports() + for name in ('side_construction', 'checks_initialization', 'compile_roles', 'verify_map', 'verify_labels', + 'verify_role_frames', 'original_upstream_verify_sources', 'full_log_integer_bounds', + 'original_serializable', 'complete_original_cli'): + need(record['phases'].rows.get(name, {}).get('calls') == 1, + 'G12 complete original phase finally/count changed: ' + name) + + +def _g12_after_original_exit(primary): + record = _G12_CONTINUATION + if record['primary'] is None: + record['primary'] = primary + generator = record['generator'] + if generator is not None and generator.gi_frame is not None: + try: + # No original CLI resume occurs on failure. Original P07 source has + # no finally clause; closing this exact suspended code only releases + # its retained frame after original CLI/main/STOP/owned cleanup. + _g12_generator_shape(True) + need(record['close_attempts'] == 0, 'G12 suspended P07 close repeated') + record['close_attempts'] = 1 + generator.close() + need(generator.gi_frame is None, 'G12 exact suspended P07 did not close') + except BaseException as secondary: + try: + record['secondary_clear'] = False + record['frame_close_error'] = secondary + record['secondary'].append((secondary, secondary.__traceback__, 'P07-frame-close')) + except BaseException: + pass + if primary is record['marker'] and record['step'] == 'MARKED': + try: + _g12_original_terminal_custody() + need(record['secondary_clear'] is True and + record['frame_close_error'] is None and record['terminal_observation_error'] is None and + record['adapter_exit_error'] is None and not record['secondary'], + 'G12 source-control secondary error or incomplete journal blocks observation export') + row = {'schema': 'g12-original-control-observation-v1', 'case': _G12_SELECTED_CASE, + 'selected_driver_sha256': sha(record['driver_before']), + 'reference_provenance': record['reference'][3], + 'original_helper_observation': _g12_primitive(record['observed']), + 'remaining_original_case_count': record['case_count'], + 'common_payload_sha256': sha(record['common']), 'common_payload_hex': record['common'].hex(), + 'prefix_end': record['prefix_end'], 'suffix_start': record['suffix_start'], 'cli_end': record['cli_end'], + 'ordered_rank_suffix_hex': record['rank_suffix'].hex(), 'native_suffix_delta': record['native_suffix_delta'], + 'phases': record['phases'].rows, + 'store_entries': record['store_entries'], 'first_advances': record['first_advances'], + 'second_advances': record['second_advances'], 'close_attempts': record['close_attempts'], + 'disposition_qualification': 'OPEN_REQUIRES_SEPARATE_ORIGINAL_STOP_AND_ALL_OWNED_CLEANUP_REVIEW', + 'scope': 'Original selected N22/P07 observation plus same-invocation original CLI remainder only. No original full-positive publication/native-count/P02/G12/FULL admission.'} + with (record['output'] / 'g12-control-observation.json').open('xb') as stream: + stream.write(canonical(row) + b'\n') + except BaseException as secondary: + try: + record['secondary_clear'] = False + record['terminal_observation_error'] = secondary + record['secondary'].append((secondary, secondary.__traceback__, 'terminal-source-observation')) + except BaseException: + pass + for secondary, traceback, phase in record['secondary']: + try: + sys.stderr.write('G12 secondary continuation error: ' + phase + '\n') + _g12_traceback.print_exception(type(secondary), secondary, traceback, file=sys.stderr) + except BaseException: + pass + + +def _g12_continuation_entry(): + record = _G12_CONTINUATION + need(record['started'] is False and _G12_SELECTED_CASE in ('N22', 'P07'), 'G12 source control entry is one-use') + record['started'] = True + record['driver'] = sys.modules['__main__'] + need(record['driver'].__dict__ is globals(), 'G12 source control requires actual Root-installed driver namespace') + need(type(_G12_TRANSPORT_SOURCE_PIN) is str and len(_G12_TRANSPORT_SOURCE_PIN) == 64, + 'G12 reference transport source has not been selected') + helper, helper_handle = _g12_cold(0, str(ROUND / 'areas/cache-validity/g12_source_controls.py'), + _G12_SELECTED_HELPER_PIN, '_h25_g12_source_controls') + transport, transport_handle = _g12_cold(0, str(ROUND / 'areas/cache-validity/g12_reference_transport.py'), + _G12_TRANSPORT_SOURCE_PIN, '_h25_g12_reference_transport') + reference = _g12_cold(1, transport_handle, 'load_original_g12_reference', + _CAPTURED_BOOTSTRAP_ROOT, _CAPTURED_BOOTSTRAP_CAPABILITY, _CAPTURED_BOOTSTRAP_API) + need(type(reference) is tuple and len(reference) == 4 and type(reference[0]) is bool and + type(reference[1]) is int and reference[1] > 0 and type(reference[2]) is bytes and type(reference[3]) is tuple, + 'G12 actual source-produced independent reference transport shape changed') + source = _g12_cold(2, helper_handle) + function = helper.__dict__[_G12_SELECTED_CASE] + need(source[1] is helper and source[5] == _G12_SELECTED_HELPER_PIN and + type(function) is _g12_types.FunctionType and function.__globals__ is helper.__dict__ and + bool(function.__code__.co_flags & 0x20) is (_G12_SELECTED_CASE == 'P07'), + 'G12 exact selected helper source/generator protocol changed') + record.update({'helper_handle': helper_handle, 'helper_module': helper, 'helper_function': function, + 'helper_code': function.__code__, 'transport_handle': transport_handle, + 'reference': reference, 'generator_type': _g12_types.GeneratorType, 'step': 'PREPARED'}) + try: + _run_epoch_with_stop_evidence() + except BaseException as primary: + # Original CLI/main/STOP/owned cleanup has already run. Preserve the + # identical primary and cause; every adapter cleanup error is secondary. + try: + _g12_after_original_exit(primary) + except BaseException as secondary: + try: + record['secondary_clear'] = False + record['adapter_exit_error'] = secondary + record['secondary'].append((secondary, secondary.__traceback__, 'adapter-exit-entry')) + except BaseException: + pass + raise + raise RuntimeError('G12 source control reached original full-positive return without its intentional marker') diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_epoch_authority_custody_v1.py.txt b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_epoch_authority_custody_v1.py.txt new file mode 100644 index 0000000000..fa8bda2f0c --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/candidate-integration/g12_epoch_authority_custody_v1.py.txt @@ -0,0 +1,2459 @@ +"""Separate V7 cold authority; SOURCE ONLY until the parent's execution gate. + +Raw-load before any candidate exposure. All later checking routines are private +closures over the original primitive/stdlib token. They never dispatch through +a mutable public validator before authenticating it. No native code lives here. +""" +import _ast +import ast +import builtins +import copy +import copyreg +import genericpath +import hashlib +import io +import ntpath +import os +import pathlib +import posixpath +import sys +import types + +SOURCE_REVIEW_GATE = None +EXECUTION_GATE = None +NATIVE_GATE = None +FULL_FUNDING_GATE = None +ROOT_SHA256 = 'f5a2d33f2b4d3651f214156a0e7094c2bb516ce2d5ab7698d18c11f98f35dee0' +PROVIDER_SHA256 = '9cbb7368f89e71d1e6cc46db5dc77efed3e03ed2a801c98c88fe316e4d9f3ef2' +BACKEND_SHA256 = 'e473c38245c3668715b5a78dfe980b2fe3ed0d0c9b8c97c666fbae6ecf1fffd5' +CACHE_PRODUCER_SHA256 = '133c55e269b354542f86a2a1099f48cff052293d06da310f98b7cb33cb85258f' +_CAPTURE_ONCE = [] + + +def capture_authority(root, capability, api): + """Return load/invoke/check/runtime_guard/check_product/set_guard/source. + + The trusted parent calls this entry once immediately after raw source exec. + A later backend instance derives provenance from this original token; it + cannot substitute a newly captured stdlib or a self-reported class record. + """ + if _CAPTURE_ONCE: + raise RuntimeError('Cold authority can only be captured once before exposure') + _CAPTURE_ONCE.append(True) + type0, id0, len0, next0, tuple0, list0 = type, id, len, next, tuple, list + dict0, str0, bytes0, object0, int0 = dict, str, bytes, object, int + error0, base_error0, value_error0 = RuntimeError, BaseException, ValueError + function_type, module_type, code_type = types.FunctionType, types.ModuleType, types.CodeType + builtin_type, cell_type = types.BuiltinFunctionType, types.CellType + static_type, class_type, property_type = staticmethod, classmethod, property + dict_get, dict_items, dict_iter = dict.get, dict.items, dict.__iter__ + dict_len, dict_set, dict_del, dict_clear = dict.__len__, dict.__setitem__, dict.__delitem__, dict.clear + object_get = object.__getattribute__ + type_get = type.__getattribute__ + module_dict_get = module_type.__dict__['__dict__'].__get__ + class_dict_get = type.__dict__['__dict__'].__get__ + class_mro_get = type.__dict__['__mro__'].__get__ + cell_get = cell_type.__dict__['cell_contents'].__get__ + function_fields = tuple((name, function_type.__dict__[name].__get__) for name in + ('__code__', '__globals__', '__builtins__', '__defaults__', + '__kwdefaults__', '__closure__', '__dict__')) + proxy_type = type(type.__dict__) + proxy_get, proxy_iter, proxy_items, proxy_len = proxy_type.get, proxy_type.__iter__, proxy_type.items, proxy_type.__len__ + builtin_self_get = builtin_type.__dict__['__self__'].__get__ + builtin_namespace = builtins.__dict__ + missing = object0() + missing_id = id0(missing) + initial_sys_modules = sys.modules + initial_sys_flags = sys.flags + initial_optimize = sys.flags.optimize + sys_owner = sys + sys_namespace = module_dict_get(sys_owner, module_type) + authority_namespace = globals() + root_pin, provider_pin, backend_pin = ROOT_SHA256, PROVIDER_SHA256, BACKEND_SHA256 + cache_pin = CACHE_PRODUCER_SHA256 + max_source, max_functions, max_classes = 1048576, 8192, 2048 + registry, by_namespace, products, backend_guards = {}, {}, {}, {} + transitions = [] + initial_std_modules = (_ast, ast, copy, copyreg, genericpath, hashlib, io, + ntpath, os, pathlib, posixpath, types) + producer_rules = ( + ('320435ec4125544f2b2aedf74f21469b232d08683fe76f0913607516254bbd29', 'make_runtime_guard', 'backend_guard'), + ('f7ca7f4f03ac63c1a95ba42f06149543211566de5e29f487a3dc4d08c5ee9b94', 'extra_guard_type', 'extra_guard'), + ('4bdb401271ffd049c52eff0edc28d8d604a11faf66fec419555a82cbd3b32d60', 'make_trace_type', 'trace'), + ('364b45c100be73a7ace44ab664f3c792020dad6f33f7788b62aaeab67c0c5aa9', 'make_row_interner', 'row_function'), + ('364b45c100be73a7ace44ab664f3c792020dad6f33f7788b62aaeab67c0c5aa9', 'make_runtime_guard', 'row_guard'), + ('364b45c100be73a7ace44ab664f3c792020dad6f33f7788b62aaeab67c0c5aa9', 'make_cache_runtime_guard', 'row_guard'), + ('5aeee9364d29147ef4e1bfffba532f7392833a6158d73d1da50ed6c772f061af', 'derive_row_bind', 'row_bind'), + (cache_pin, 'compose_runtime_guard', 'cache_guard')) + + def need(ok, message): + if not ok: + raise error0(message) + + def string_domain(owner, domains): + key = iterator = kind = None + try: + identity = id0(owner) + prior = dict_get(domains, identity, missing) + if prior is not missing: + return prior + kind = type0(owner) + if kind is dict0: + iterator = dict_iter(owner) + elif kind is proxy_type: + iterator = proxy_iter(owner) + else: + return False + while True: + key = next0(iterator, missing) + if key is missing: + break + if type0(key) is not str0: + dict_set(domains, identity, False) + return False + key = None + dict_set(domains, identity, True) + return True + finally: + key = iterator = kind = owner = None + + def get_id(owner, name, domains): + try: + if type0(name) is not str0 or not string_domain(owner, domains): + return -1 + if type0(owner) is dict0: + return id0(dict_get(owner, name, missing)) + return id0(proxy_get(owner, name, missing)) + finally: + owner = None + + def identity_mapping(owner, expected): + """Non-string dispatch dictionaries: identity scan, never key equality.""" + iterator = pair = key = value = None + try: + if type0(owner) is not dict0 or dict_len(owner) != len0(expected): + return False + iterator = iter0(dict_items(owner)) + while True: + pair = next0(iterator, missing) + if pair is missing: + break + key, value = pair + found = False + for old_key, old_value in expected: + if key is old_key: + if value is not old_value: + return False + found = True + break + if not found: + return False + pair = key = value = None + return True + finally: + iterator = pair = key = value = owner = None + + iter0 = iter + + def code_names(code): + pending, result, seen = [code], [], {} + while pending: + current = pending.pop() + need(type0(current) is code_type, 'Cold authority code shape differs') + for name in current.co_names: + need(type0(name) is str0, 'Cold authority code name shape differs') + if dict_get(seen, name, missing) is missing: + dict_set(seen, name, True) + result.append(name) + for value in current.co_consts: + if type0(value) is code_type: + pending.append(value) + return tuple0(result) + + def raw_function_record(function): + need(type0(function) is function_type, 'Cold authority requires exact functions') + values = tuple0(getter(function, function_type) for _, getter in function_fields) + code, namespace, builtins_owner, defaults, keywords, closure, attributes = values + domains = {} + try: + need(type0(namespace) is dict0 and type0(builtins_owner) is dict0 and + string_domain(namespace, domains) and string_domain(builtins_owner, domains), + 'Cold authority initial function dictionary domain differs') + keyword_items = () + if keywords is not None: + need(type0(keywords) is dict0 and string_domain(keywords, domains), + 'Cold authority initial keyword defaults differ') + keyword_items = tuple0(dict_items(keywords)) + cells = () if closure is None else tuple0((cell, cell_get(cell, cell_type)) for cell in closure) + lookups = tuple0((name, dict_get(namespace, name, missing), dict_get(builtins_owner, name, missing)) + for name in code_names(code)) + need(type0(attributes) is dict0 and string_domain(attributes, domains), + 'Cold authority function attribute dictionary differs') + return (function, values, keyword_items, cells, lookups, tuple0(dict_items(attributes))) + finally: + dict_clear(domains) + + def capture_graph(initial_functions, initial_classes): + """Called only at initial source load or directly after an admitted producer.""" + functions, classes, seen_functions, seen_classes = [], [], {}, {} + pending_functions, pending_classes = list0(initial_functions), list0(initial_classes) + while pending_functions or pending_classes: + while pending_classes: + cls = pending_classes.pop() + need(type0(cls) is type0, 'Cold authority class metaclass differs') + if dict_get(seen_classes, id0(cls), missing) is not missing: + continue + need(len0(classes) < max_classes, 'Cold authority class census exceeds bound') + dict_set(seen_classes, id0(cls), cls) + mro = class_mro_get(cls, type0) + proxy = class_dict_get(cls, type0) + members = tuple0(proxy_items(proxy)) + classes.append((cls, mro, proxy, members)) + for base in mro[1:]: + if type0(base) is type0: + pending_classes.append(base) + for name, value in members: + need(type0(name) is str0, 'Cold authority class member name differs') + kind = type0(value) + if kind is function_type: + pending_functions.append(value) + elif kind is static_type or kind is class_type: + underlying = object_get(value, '__func__') + if type0(underlying) is function_type: + pending_functions.append(underlying) + elif kind is property_type: + for field in ('fget', 'fset', 'fdel'): + underlying = object_get(value, field) + if type0(underlying) is function_type: + pending_functions.append(underlying) + if pending_functions: + function = pending_functions.pop() + if dict_get(seen_functions, id0(function), missing) is not missing: + continue + need(len0(functions) < max_functions, 'Cold authority function census exceeds bound') + record = raw_function_record(function) + dict_set(seen_functions, id0(function), function) + functions.append(record) + for cell, value in record[3]: + if type0(value) is function_type: + pending_functions.append(value) + defaults = record[1][3] + if defaults is not None: + need(type0(defaults) is tuple0, 'Cold authority positional defaults shape differs') + for value in defaults: + if type0(value) is function_type: + pending_functions.append(value) + for name, value in record[2] + record[5]: + if type0(value) is function_type: + pending_functions.append(value) + # Source-owned function helpers reached through effective globals + # are authenticated transitively, including validator helpers. + for name, value, builtin_value in record[4]: + if type0(value) is function_type: + pending_functions.append(value) + return (tuple0(functions), tuple0(classes)) + + def expected_global(namespace, name, expected): + if name != 'RuntimeGuard': + return expected + record = dict_get(by_namespace, id0(namespace), missing) + if record is not missing and record[2] is namespace and record[12] == 'backend': + return dict_get(backend_guards, id0(record[0]), missing) + return expected + + def fresh_function(record, domains, builtin_values): + function, values, keyword_items, cells, lookups, attributes_items = record + if type0(function) is not function_type: + return False + field_key = ('function-fields', id0(function)) + observed_fields = dict_get(domains, field_key, missing) + if observed_fields is missing: + scalar_fields = [] + for (_, getter), expected in zip0(function_fields, values): + observed_id = id0(getter(function, function_type)) + if observed_id != id0(expected): + return False + scalar_fields.append(observed_id) + dict_set(domains, field_key, tuple0(scalar_fields)) + else: + if len0(observed_fields) != len0(values): + return False + for observed_id, expected in zip0(observed_fields, values): + if observed_id != id0(expected): + return False + code, namespace, builtins_owner, defaults, keywords, closure, attributes = values + if keywords is not None: + if type0(keywords) is not dict0 or dict_len(keywords) != len0(keyword_items): + return False + for name, expected in keyword_items: + if get_id(keywords, name, domains) != id0(expected): + return False + for cell, expected in cells: + try: + if id0(cell_get(cell, cell_type)) != id0(expected): + return False + except value_error0: + return False + if dict_len(attributes) != len0(attributes_items): + return False + for name, expected in attributes_items: + if get_id(attributes, name, domains) != id0(expected): + return False + lookup_key = ('function-lookups', id0(function), id0(code), + id0(namespace), id0(builtins_owner)) + observed_lookups = dict_get(domains, lookup_key, missing) + if observed_lookups is missing: + scalar_lookups = [] + for name, expected, expected_builtin in lookups: + observed_global = get_id(namespace, name, domains) + if observed_global != id0(expected_global(namespace, name, expected)): + return False + # A false builtin_values path must not observe builtin keys or + # values. The absent slot is completed only in a later true path. + if builtin_values: + observed_builtin = get_id(builtins_owner, name, domains) + if observed_builtin != id0(expected_builtin): + return False + scalar_lookups.append((name, observed_global, True, observed_builtin)) + else: + scalar_lookups.append((name, observed_global, False, 0)) + dict_set(domains, lookup_key, tuple0(scalar_lookups)) + else: + if len0(observed_lookups) != len0(lookups): + return False + completed_lookups = None + index = 0 + for (name, expected, expected_builtin), observed in zip0(lookups, observed_lookups): + if observed[0] != name: + return False + if observed[1] != id0(expected_global(namespace, name, expected)): + return False + if builtin_values: + if observed[2]: + observed_builtin = observed[3] + else: + observed_builtin = get_id(builtins_owner, name, domains) + if observed_builtin != id0(expected_builtin): + return False + if not observed[2]: + if completed_lookups is None: + completed_lookups = list0(observed_lookups) + completed_lookups[index] = (name, observed[1], True, observed_builtin) + index += 1 + if completed_lookups is not None: + dict_set(domains, lookup_key, tuple0(completed_lookups)) + return True + + zip0 = zip + + def fresh_graph(graph, domains, builtin_values, message): + functions, classes = graph + for cls, mro, proxy, members in classes: + if not (type0(cls) is type0 and class_mro_get(cls, type0) is mro and + proxy_len(proxy) == len0(members)): + need(False, message + ': class dispatch') + for name, expected in members: + if not (get_id(proxy, name, domains) == id0(expected)): + need(False, message + ': class member ' + name) + for record in functions: + if not (fresh_function(record, domains, builtin_values)): + need(False, message + ': function environment') + + def module_image(module, name, kind, path, digest, source_bytes, *, stdlib=False): + need(type0(module) is module_type, 'Cold authority module exact type differs') + namespace = module_dict_get(module, module_type) + domains = {} + try: + need(type0(namespace) is dict0 and string_domain(namespace, domains), + 'Cold authority module dictionary domain differs') + items = tuple0(dict_items(namespace)) + functions, classes = [], [] + for field, value in items: + if type0(value) is function_type: + if stdlib or value.__globals__ is namespace: + functions.append(value) + elif type0(value) is type0: + declared = type_get(value, '__module__') + if stdlib or (type0(declared) is str0 and declared == name): + classes.append(value) + graph = capture_graph(functions, classes) + mappings = [] + selected = ('_CANONICAL_BUILTINS', '_TYPE_BUILTINS') if kind == 'backend' else () + for field in selected: + mapping = dict_get(namespace, field, missing) + need(type0(mapping) is dict0, 'Cold authority backend dispatch dictionary differs') + mappings.append((field, mapping, tuple0(dict_items(mapping)))) + original_guard = dict_get(namespace, 'RuntimeGuard', missing) if kind == 'backend' else None + if kind == 'backend': + need(type0(original_guard) is type0, 'Cold authority original RuntimeGuard differs') + handle = object0() + return (handle, module, namespace, name, path, digest, source_bytes, + items, graph[0], graph[1], tuple0(mappings), original_guard, kind) + finally: + dict_clear(domains) + + def record_for(handle): + record = dict_get(registry, id0(handle), missing) + need(record is not missing and record[0] is handle, 'Cold authority handle is not registered') + return record + + def fresh_module(record, domains, builtin_values, *, registry_slot=True, exact_census=True, prefix='Cold authority'): + module, namespace = record[1], record[2] + if not (type0(module) is module_type and module_dict_get(module, module_type) is namespace): + need(False, prefix + ': module owner differs') + if registry_slot: + if not (get_id(initial_sys_modules, record[3], domains) == id0(module)): + need(False, prefix + ': registered module slot differs') + if exact_census: + if not (dict_len(namespace) == len0(record[7])): + need(False, prefix + ': namespace census differs') + for name, expected in record[7]: + if not (get_id(namespace, name, domains) == id0(expected_global(namespace, name, expected))): + need(False, prefix + ': namespace binding ' + name) + for name, mapping, expected in record[10]: + if not (identity_mapping(mapping, expected)): + need(False, prefix + ': dispatch dictionary ' + name) + fresh_graph((record[8], record[9]), domains, builtin_values, prefix) + + need(type0(root) is module_type and type0(api) is tuple0 and len0(api) == 4, + 'Cold authority requires the actual pristine root and sealed fourtuple') + root_namespace = module_dict_get(root, module_type) + root_api_graph = capture_graph(api, ()) + root_hash = dict_get(root_namespace, '_hash_regular', missing) + root_compile = dict_get(root_namespace, '_COMPILE', missing) + root_exec = dict_get(root_namespace, '_EXEC', missing) + root_identity = api[0] + initial_builtin_items = tuple0(dict_items(builtin_namespace)) + stdlib_records = tuple0(module_image(module, module.__name__, 'stdlib', None, None, None, stdlib=True) + for module in initial_std_modules) + stdlib_mappings = tuple0((mapping, tuple0(dict_items(mapping))) for mapping in + (copy._deepcopy_dispatch, copy.dispatch_table, copyreg.dispatch_table)) + self_graph = capture_graph((dict_get(authority_namespace, 'capture_authority'),), ()) + self_items = tuple0(dict_items(authority_namespace)) + + def root_and_stdlib(domains): + need(type0(sys_owner) is module_type and module_dict_get(sys_owner, module_type) is sys_namespace and + get_id(sys_namespace, 'modules', domains) == id0(initial_sys_modules) and + get_id(sys_namespace, 'flags', domains) == id0(initial_sys_flags), + 'Cold authority interpreter owner differs') + need(dict_len(builtin_namespace) == len0(initial_builtin_items), 'Cold authority builtin census differs') + for name, expected in initial_builtin_items: + need(get_id(builtin_namespace, name, domains) == id0(expected), 'Cold authority builtin binding ' + name) + for name, expected in self_items: + need(get_id(authority_namespace, name, domains) == id0(expected), 'Cold authority source binding ' + name) + fresh_graph(self_graph, domains, True, 'Cold authority source') + fresh_graph(root_api_graph, domains, True, 'Cold authority root entry') + dict_clear(domains) + need(root_identity() == root_pin, 'Cold authority actual root source identity differs') + dict_clear(domains) + for record in stdlib_records: + fresh_module(record, domains, True, registry_slot=True, exact_census=False, prefix='Cold authority initial stdlib') + for mapping, expected in stdlib_mappings: + need(identity_mapping(mapping, expected), 'Cold authority initial copy dispatch differs') + + def check_registered(domains): + for record in tuple0(registry.values()): + fresh_module(record, domains, True) + + def cold_check(handle=None): + domains = {} + try: + root_and_stdlib(domains) + check_registered(domains) + if handle is not None: + record = record_for(handle) + dict_clear(domains) + digest, size, raw = root_hash(record[4], max_source, False) + need(digest == record[5], 'Cold authority source file changed') + return record + return None + finally: + dict_clear(domains) + + def load(path, digest, name, kind='module'): + cold_check() + need(type0(path) is str0 and path.startswith('/') and type0(digest) is str0 and len0(digest) == 64 and + type0(name) is str0 and name and type0(kind) is str0 and kind in ('module', 'backend'), + 'Cold authority source-load argument shape differs') + for character in digest: + need(character in '0123456789abcdef', 'Cold authority source digest is not lowercase SHA256') + need((kind == 'backend') == (digest == backend_pin), 'Cold authority original backend classification differs') + domains = {} + try: + need(get_id(initial_sys_modules, name, domains) == missing_id, 'Cold authority module name already registered') + finally: + dict_clear(domains) + observed, size, source_bytes = root_hash(path, max_source, True) + need(observed == digest and type0(source_bytes) is bytes0, 'Cold authority source bytes differ') + module = module_type(name) + namespace = module_dict_get(module, module_type) + namespace.update({'__file__': path, '__builtins__': builtin_namespace}) + # Dataclass/import ownership sees the correct unique slot during exec. + dict_set(initial_sys_modules, name, module) + try: + code = root_compile(source_bytes, path, 'exec', dont_inherit=True, optimize=initial_optimize) + root_exec(code, namespace) + record = module_image(module, name, kind, path, digest, source_bytes) + dict_set(registry, id0(record[0]), record) + dict_set(by_namespace, id0(namespace), record) + if kind == 'backend': + dict_set(backend_guards, id0(record[0]), record[11]) + cold_check(record[0]) + except base_error0: + # A failed source is retained in the unique slot for evidence and + # cannot be retried/reclassified as an unobserved clean load. + raise + return (module, record[0]) + + def make_caller_descriptor(operations, label): + """Mint only at original capture or an authenticated entry-three return. + + The caller checks the dispatcher record INLINE before invoking it. This + is not a claim that the dispatcher can authenticate its own replacement + code. Its already-admitted active frame checks all target/helper objects. + """ + pending, seen, records = list0(operations), {}, [] + while pending: + function = pending.pop() + if dict_get(seen, id0(function), missing) is not missing: + continue + need(len0(records) < max_functions, 'Cold authority caller helper census exceeds bound') + raw = raw_function_record(function) + record = (function,) + raw[1][:6] + (raw[2], raw[3]) + dict_set(seen, id0(function), function) + records.append(record) + for cell, value in record[8]: + if type0(value) is function_type: + pending.append(value) + records = tuple0(records) + field_getters = function_fields[:6] + primitives = (type0, function_type, id0, len0, field_getters, cell_type, + cell_get, error0, value_error0, tuple0, dict0, str0, + dict_get, dict_len, dict_iter, next0, dict_clear, missing, zip0) + + def dispatch(index, *args, **kwargs): + # The active caller has already authenticated this actual function. + # This pretarget block uses captured C primitives only. In particular + # it does not call need(), fresh_function(), or any other validator. + if type0(index) is not int0 or index < 0 or index >= len0(operations): + raise error0(label + ': operation index differs') + for record in records: + function = record[0] + if type0(function) is not function_type: + raise error0(label + ': target exact function differs') + for (name, getter), expected in zip0(field_getters, record[1:7]): + if id0(getter(function, function_type)) != id0(expected): + raise error0(label + ': target function environment differs') + keywords = record[5] + if keywords is not None: + if type0(keywords) is not dict0 or dict_len(keywords) != len0(record[7]): + raise error0(label + ': target keyword census differs') + iterator = current = None + valid_domain = True + try: + iterator = dict_iter(keywords) + while True: + current = next0(iterator, missing) + if current is missing: + break + if type0(current) is not str0: + valid_domain = False + break + current = None + finally: + # Foreign current keys never survive a retained error. + iterator = current = None + if not valid_domain: + raise error0(label + ': target keyword key domain differs') + for name, expected in record[7]: + if id0(dict_get(keywords, name, missing)) != id0(expected): + raise error0(label + ': target keyword value differs') + for cell, expected in record[8]: + try: + observed_id = id0(cell_get(cell, cell_type)) + except value_error0: + raise error0(label + ': target closure became empty') from None + if observed_id != id0(expected): + raise error0(label + ': target closure value differs') + # The chosen function object comes from the original immutable + # operations tuple, not a mutable late attribute or caller registry. + return operations[index](*args, **kwargs) + + raw_dispatch = raw_function_record(dispatch) + dispatch_record = (dispatch,) + raw_dispatch[1][:6] + (raw_dispatch[2], raw_dispatch[3]) + need(dispatch_record[4] is None and dispatch_record[5] is None and not dispatch_record[7], + 'Cold authority dispatcher source defaults contract differs') + return ('h25-cold-authority-caller-v1', operations, dispatch, + dispatch_record, records, primitives) + + def runtime_guard(handle): + record = cold_check(handle) + def guarded_helpers(): + domains = {} + try: + fresh_module(record, domains, False, prefix='Runtime drift: cache collector') + finally: + dict_clear(domains) + child_descriptor = make_caller_descriptor((guarded_helpers,), 'Runtime drift: cache collector caller') + return (guarded_helpers, child_descriptor) + + def known_backend(module): + need(type0(module) is module_type, 'Cold authority producer backend type differs') + namespace = module_dict_get(module, module_type) + record = dict_get(by_namespace, id0(namespace), missing) + need(record is not missing and record[1] is module and record[12] == 'backend' and record[5] == backend_pin, + 'Cold authority producer backend provenance differs') + return record + + def known_guard(cls): + need(type0(cls) is type0, 'Cold authority exact guard class differs') + for record in tuple0(registry.values()): + if record[12] == 'backend' and cls is record[11]: + return None + product = dict_get(products, id0(cls), missing) + need(product is not missing and product[0] is cls and product[6] in + ('backend_guard', 'extra_guard', 'row_guard', 'cache_guard'), + 'Cold authority guard was not produced by an admitted source') + domains = {} + try: + fresh_graph(product[5], domains, True, 'Cold authority producer base product') + finally: + dict_clear(domains) + return product + + def classify(record, export): + for digest, name, role in producer_rules: + if digest is not None and record[5] == digest and export == name: + return role + return None + + def validate_producer_arguments(record, export, role, args, kwargs): + domains = {} + try: + need(type0(kwargs) is dict0 and string_domain(kwargs, domains) and not kwargs, + 'Cold authority reviewed producers require positional arguments') + if role == 'backend_guard': + need(len0(args) == 1, 'Cold authority backend guard arguments differ') + known_backend(args[0]) + elif role == 'extra_guard': + need(len0(args) == 3 and type0(args[2]) is tuple0, 'Cold authority trace guard arguments differ') + known_guard(args[0]); known_backend(args[1]) + for entry in args[2]: + need(type0(entry) is tuple0 and len0(entry) == 3, + 'Cold authority trace entry shape differs') + owner, name, function = entry + need(type0(owner) is module_type and type0(name) is str0 and + type0(function) is builtin_type and + builtin_self_get(function, builtin_type) is owner and + get_id(module_dict_get(owner, module_type), name, domains) == id0(function), + 'Cold authority trace entry owner differs') + elif role == 'trace': + need(len0(args) == 2 and type0(args[1]) is module_type, 'Cold authority trace producer arguments differ') + known_backend(args[0]) + elif role == 'row_function': + need(not args, 'Cold authority row interner arguments differ') + elif role == 'row_guard': + need(len0(args) == 2, 'Cold authority row guard arguments differ') + known_guard(args[0]) + product = dict_get(products, id0(args[1]), missing) + need(product is not missing and product[0] is args[1] and product[1] is record[0] and + product[2] == 'make_row_interner' and product[6] == 'row_function', + 'Cold authority row helper provenance differs') + fresh_graph(product[5], domains, True, 'Cold authority producer row helper') + elif role == 'cache_guard': + need(len0(args) == 2 and type0(args[1]) is dict0 and string_domain(args[1], domains), + 'Cold authority cache guard arguments differ') + known_guard(args[0]) + owner = dict_get(args[1], 'owner', missing) + need(type0(owner) is dict_get(record[2], '_Owner', missing), + 'Cold authority prepared cache owner class differs') + elif role == 'row_bind': + need(len0(args) == 2 and type0(args[0]) is function_type and type0(args[1]) is bytes0, + 'Cold authority row bind arguments differ') + found = False + for backend_record in tuple0(registry.values()): + if (backend_record[12] == 'backend' and args[0] is dict_get(backend_record[2], 'bind', missing) and + args[1] is backend_record[6]): + found = True + break + need(found, 'Cold authority row bind is not the original registered function/source') + finally: + dict_clear(domains) + + def invoke(handle, export, *args, **kwargs): + record = cold_check(handle) + need(type0(export) is str0, 'Cold authority export name must be exact str') + function = dict_get(record[2], export, missing) + need(type0(function) is function_type and function.__globals__ is record[2], + 'Cold authority export is not an owned source function') + role = classify(record, export) + if role is not None: + validate_producer_arguments(record, export, role, args, kwargs) + result = function(*args, **kwargs) + if role is not None: + # Do not retain a row producer's enclosing tuple or mutable AST. + product = result[0] if type0(result) is tuple0 and len0(result) and type0(result[0]) is function_type else result + expected_kind = function_type if role in ('row_function', 'row_bind') else type0 + need(type0(product) is expected_kind and dict_get(products, id0(product), missing) is missing, + 'Cold authority producer did not return a fresh exact product') + graph = capture_graph((product,) if expected_kind is function_type else (), + (product,) if expected_kind is type0 else ()) + product_record = (product, handle, export, args, tuple0(dict_items(kwargs)), graph, role) + dict_set(products, id0(product), product_record) + domains = {} + try: + fresh_graph(graph, domains, True, 'Cold authority new product') + finally: + dict_clear(domains) + return result + + def check_product(obj, producer_handle, export, args_tuple, kwargs_dict): + record_for(producer_handle) + cold_check(producer_handle) + need(type0(args_tuple) is tuple0 and type0(kwargs_dict) is dict0 and type0(export) is str0, + 'Cold authority product proof arguments differ') + product = dict_get(products, id0(obj), missing) + need(product is not missing and product[0] is obj and product[1] is producer_handle and product[2] == export, + 'Cold authority product provenance differs') + need(len0(args_tuple) == len0(product[3]), 'Cold authority product positional census differs') + for actual, expected in zip0(args_tuple, product[3]): + need(actual is expected, 'Cold authority product positional identity differs') + domains = {} + try: + need(dict_len(kwargs_dict) == len0(product[4]), 'Cold authority product keyword census differs') + for name, expected in product[4]: + need(get_id(kwargs_dict, name, domains) == id0(expected), 'Cold authority product keyword identity differs') + fresh_graph(product[5], domains, True, 'Cold authority registered product') + finally: + dict_clear(domains) + return None + + def set_backend_guard(handle, cls): + record = cold_check(handle) + need(record[12] == 'backend', 'Cold authority guard transition requires original backend') + product = known_guard(cls) + domains = {} + try: + if product is not None: + fresh_graph(product[5], domains, True, 'Cold authority guard transition product') + old = dict_get(backend_guards, id0(handle), missing) + need(dict_get(record[2], 'RuntimeGuard', missing) is old, + 'Cold authority backend guard changed outside the transition ledger') + dict_clear(domains) + dict_set(record[2], 'RuntimeGuard', cls) + dict_set(backend_guards, id0(handle), cls) + transitions.append((handle, old, cls, product)) + fresh_module(record, domains, True) + finally: + dict_clear(domains) + return None + + def source(handle): + record = cold_check(handle) + return (record[1], record[4], record[5], record[6]) + + # Final initial-root validation occurs before any source can receive a token. + cold_check() + need(api[1](capability, provider_pin) is not None, 'Cold authority root capability differs') + operations = (load, invoke, cold_check, runtime_guard, check_product, set_backend_guard, source) + descriptor = make_caller_descriptor(operations, 'Cold authority caller') + # Original raw loader only: capture this transport immediately and retain + # the immutable descriptor privately. No later attribute read is authority. + load.__dict__['_h25_caller_descriptor'] = descriptor + return operations + + +"""Concrete SOURCE ONLY epoch ledger. No execution/profile grant is embedded.""" +import ast +import builtins +import hashlib +import types + +SOURCE_EXECUTION_CONTRACT = None +FULL_EXECUTION_CONTRACT = None +_FUNCTION = types.FunctionType +_MODULE = types.ModuleType +_CODE = types.CodeType +_TYPE, _ID, _LEN = type, id, len +_DICT, _TUPLE, _STR, _INT, _BOOL = dict, tuple, str, int, bool +_GET, _ITEMS, _CLEAR = dict.get, dict.items, dict.clear +_CLASS_DICT = type.__dict__['__dict__'].__get__ +_CLASS_MRO = type.__dict__['__mro__'].__get__ +_CELL = types.CellType.__dict__['cell_contents'].__get__ +_FFIELDS = tuple((name, _FUNCTION.__dict__[name].__get__) for name in + ('__code__', '__globals__', '__builtins__', '__defaults__', + '__kwdefaults__', '__closure__', '__dict__')) +_MISSING = object() +SLOTS = ( + ('module', 'echelon'), ('module', 'rank'), ('module', 'compile_roles'), + ('module', 'verify_role_frames'), ('circuit', 'add'), ('circuit', '__init__'), + ('checks', 'verify_map'), ('checks', '__init__'), ('checks', 'label'), + ('checks', 'target_frame'), ('checks', 'verify_labels'), + ('checks', 'residual_ok'), ('checks', 'label_ok'), + ('label', 'complement_in'), ('label', 'nondegenerate')) +ROLE_FOR_SLOT = { + ('module', 'echelon'): ('canonical',), + ('module', 'rank'): ('rank_trace',), + ('module', 'compile_roles'): ('phase',), + ('module', 'verify_role_frames'): ('roles', 'roles_observer'), + ('circuit', 'add'): ('construction_add',), + ('circuit', '__init__'): ('construction_init', 'phase'), + ('checks', 'verify_map'): ('p1', 'phase'), + ('checks', '__init__'): ('C1', 'checks_capture', 'phase'), + ('checks', 'label'): ('C2',), ('checks', 'target_frame'): ('C3',), + ('checks', 'verify_labels'): ('labels', 'phase'), + ('checks', 'residual_ok'): ('public_residual',), + ('checks', 'label_ok'): ('public_label',), + ('label', 'complement_in'): ('native_complement',), + ('label', 'nondegenerate'): ('native_gram',)} + + +def need(condition, message): + if not condition: + raise RuntimeError(message) + + +def string_keys(mapping): + need(_TYPE(mapping) is _DICT, 'Epoch namespace is not exact dict') + for key in mapping: + need(_TYPE(key) is _STR, 'Epoch foreign namespace key') + + +def names(code): + pending, result = [code], [] + while pending: + value = pending.pop() + need(_TYPE(value) is _CODE, 'Epoch code type') + for name in value.co_names: + if name not in result: + result.append(name) + pending.extend(x for x in value.co_consts if _TYPE(x) is _CODE) + return tuple(result) + + +def function_record(function): + need(_TYPE(function) is _FUNCTION, 'Epoch exact function required') + fields = tuple(getter(function, _FUNCTION) for _, getter in _FFIELDS) + code, namespace, builtin_owner, defaults, keywords, closure, attrs = fields + string_keys(namespace); string_keys(builtin_owner); string_keys(attrs) + if defaults is not None: + need(_TYPE(defaults) is _TUPLE, 'Epoch defaults type') + if keywords is not None: + string_keys(keywords) + cells = () if closure is None else tuple((cell, _CELL(cell, types.CellType)) for cell in closure) + lookups = tuple((name, _GET(namespace, name, _MISSING), + _GET(builtin_owner, name, _MISSING)) for name in names(code)) + return (function, fields, () if keywords is None else tuple(keywords.items()), + cells, lookups, tuple(attrs.items())) + + +def check_fields(record): + function, fields, keywords, cells, lookups, attrs = record + need(_TYPE(function) is _FUNCTION, 'Epoch function replacement') + for (_, getter), expected in zip(_FFIELDS, fields): + need(getter(function, _FUNCTION) is expected, 'Epoch function field changed') + current_keywords = fields[4] + if current_keywords is not None: + string_keys(current_keywords) + need(len(current_keywords) == len(keywords), 'Epoch keyword census') + for name, expected in keywords: + need(_GET(current_keywords, name, _MISSING) is expected, 'Epoch keyword value') + for cell, expected in cells: + need(_CELL(cell, types.CellType) is expected, 'Epoch closure cell changed') + current_attrs = fields[6] + string_keys(current_attrs) + need(len(current_attrs) == len(attrs), 'Epoch function attributes census') + for name, expected in attrs: + need(_GET(current_attrs, name, _MISSING) is expected, 'Epoch function attribute') + + +def class_record(cls): + need(_TYPE(cls) is _TYPE, 'Epoch class metaclass') + proxy = _CLASS_DICT(cls, _TYPE) + members = tuple(proxy.items()) + need(all(_TYPE(k) is _STR for k, _ in members), 'Epoch class key domain') + return (cls, _CLASS_MRO(cls, _TYPE), members) + + +def graph(functions, classes, canonical_functions=None, canonical_classes=None): + """Explicit class roots; arbitrary state/tuple cells never imply provenance.""" + functions, classes = list(functions), list(classes) + seen_f, seen_c, records_f, records_c = {}, {}, [], [] + canonical_functions = {} if canonical_functions is None else canonical_functions + canonical_classes = {} if canonical_classes is None else canonical_classes + while functions or classes: + while classes: + cls = classes.pop() + if id(cls) in seen_c: + continue + need(len(seen_c) < 2048, 'Epoch class graph bound') + seen_c[id(cls)] = cls + rec = canonical_classes.get(id(cls)) + rec = class_record(cls) if rec is None else rec + need(rec[0] is cls, 'Epoch class canonical identity') + records_c.append(rec) + for base in rec[1][1:]: + if type(base) is type: + classes.append(base) + for _, value in rec[2]: + if type(value) is _FUNCTION: + functions.append(value) + elif type(value) in (staticmethod, classmethod): + functions.append(value.__func__) + elif type(value) is property: + functions.extend(x for x in (value.fget, value.fset, value.fdel) if x is not None) + if functions: + function = functions.pop() + if id(function) in seen_f: + continue + need(len(seen_f) < 8192, 'Epoch function graph bound') + seen_f[id(function)] = function + rec = canonical_functions.get(id(function)) + rec = function_record(function) if rec is None else rec + need(rec[0] is function, 'Epoch original function canonical identity') + records_f.append(rec) + for _, value in rec[3]: + if type(value) is _FUNCTION: + functions.append(value) + defaults = rec[1][3] + if defaults is not None: + functions.extend(x for x in defaults if type(x) is _FUNCTION) + functions.extend(x for _, x in rec[2] + rec[5] if type(x) is _FUNCTION) + functions.extend(x for _, x, _ in rec[4] if type(x) is _FUNCTION) + return tuple(records_f), tuple(records_c) + + +class EpochLedger: + """One original generation; no generic external record/admission operation.""" + def __init__(self): + self.origins = {} + self.phase = 'COLD' + self.serial = 0 + self.failure = None + self.class_origin = class_record(type(self)) + self.method_origin = tuple(function_record(v) for _, v in self.class_origin[2] + if type(v) is _FUNCTION) + + def guard_engine(self): + cls, mro, members = self.class_origin + need(type(self) is cls and _CLASS_MRO(cls, type) is mro, 'Epoch engine class drift') + current = _CLASS_DICT(cls, type) + need(len(current) == len(members), 'Epoch engine member census') + for name, value in members: + need(current.get(name, _MISSING) is value, 'Epoch engine member drift') + for rec in self.method_origin: + check_fields(rec) + + def capture(self, module, backend, source_bytes, factory_results, authority_graph, missing_token): + self.guard_engine() + need(self.phase == 'COLD', 'Epoch original capture is one shot') + need(type(module) is _MODULE and type(backend) is _MODULE and type(source_bytes) is bytes, + 'Epoch original inputs') + namespace = module.__dict__; string_keys(namespace) + need(hashlib.sha256(source_bytes).hexdigest() == + 'd623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1', 'Epoch original source hash') + # Caller authenticates backend + each pristine factory BEFORE this call. + label = backend.guard_module(module) + checks, circuit = namespace['Checks'], namespace['ComplexSideCircuit'] + need(label is namespace['Label'], 'Epoch original Label identity') + need(type(factory_results) is tuple and len(factory_results) == 3, 'Epoch actual factory outputs') + p1, construction, prepared = factory_results + need(type(prepared) is dict and prepared['owner'].module is module, 'Epoch actual prepared owner') + compiled = compile(source_bytes, namespace['__file__'], 'exec', dont_inherit=True) + source_codes = {x.co_name: x for x in compiled.co_consts if type(x) is _CODE} + for cls, name in ((label, 'Label'), (checks, 'Checks'), (circuit, 'ComplexSideCircuit')): + expected = {x.co_name: x for x in source_codes[name].co_consts if type(x) is _CODE} + attrs = _CLASS_DICT(cls, type) + need(set(attrs) == set(expected) | {'__module__','__doc__','__dict__','__weakref__'}, + 'Epoch original class census') + for field, code in expected.items(): + function = attrs[field] + need(type(function) is _FUNCTION and function.__globals__ is namespace and + function.__builtins__ is builtins.__dict__ and function.__defaults__ is None and + function.__kwdefaults__ is None and function.__closure__ is None and + backend._code_shape(function.__code__) == backend._code_shape(code), + 'Epoch original class source/calling contract') + need(type(authority_graph) is tuple and len(authority_graph)==2, 'Epoch original authority graph') + fg, original_classes = authority_graph + cg=tuple((row[0],row[1],row[3]) for row in original_classes) + need(all(type(row) is tuple and len(row)==6 for row in fg), 'Epoch original raw-record schema') + self.serial += 1; handle = object() + origin = {'handle':handle,'module':module,'namespace':namespace,'backend':backend, + 'label':label,'checks':checks,'circuit':circuit,'items':tuple(namespace.items()), + 'functions':fg,'classes':cg,'function_map':{id(x[0]):x for x in fg}, + 'class_map':{id(x[0]):x for x in cg},'slots':{},'visible':{},'edges':[], + 'products':[],'factory_results':factory_results,'generation':self.serial, + 'raw_guard':None,'suite':None,'phase':'ORIGINAL','missing':missing_token,'authority_classes':original_classes, + 'primary_error':None,'secondary_error':None,'uncertain':False} + owners = {'module':namespace,'label':label,'checks':checks,'circuit':circuit} + for kind, name in SLOTS: + owner = owners[kind] + value = owner[name] if type(owner) is dict else _CLASS_DICT(owner,type)[name] + origin['slots'][kind,name] = (owner,value,value,()) + origin['visible'][kind,name] = value + self.origins[id(handle)] = origin; self.phase = 'ORIGINAL' + return handle + + def origin(self, handle): + self.guard_engine() + origin = self.origins.get(id(handle)) + need(origin is not None and origin['handle'] is handle, 'Epoch origin handle') + need(origin['phase'] != 'FAILED', 'Epoch failed generation') + return origin + + def enroll_suite(self, handle, suite): + origin = self.origin(handle) + need(origin['phase'] == 'ORIGINAL' and origin['suite'] is None, 'Epoch suite one shot') + origin['suite'] = suite + origin['phase'] = 'FACTORIES_ADMITTED' + return origin['generation'] + + def authorize(self, handle, kind, name, old, new, role, product_graph): + origin = self.origin(handle) + need(origin['phase'] in ('FACTORIES_ADMITTED','CALLERS_INSTALLED','NATIVE_PRODUCTS_PREPARED'), + 'Epoch transition phase') + need(type(kind) is str and type(name) is str and type(role) is str and + (kind,name) in origin['slots'] and role in ROLE_FOR_SLOT[kind,name], 'Epoch finite slot/role') + owner, first, prior, chain = origin['slots'][kind,name] + need(old is prior and new is not prior, 'Epoch preceding endpoint identity') + current = owner[name] if type(owner) is dict else _CLASS_DICT(owner,type).get(name,_MISSING) + need(current is old, 'Epoch unauthorized prior change') + need(type(new) is _FUNCTION, 'Epoch callable product type') + # Product comes only from the authenticated suite builder; it supplies + # the complete graph after its strict source/code inverse validation. + need(type(product_graph) is tuple and len(product_graph)==2, 'Epoch product graph shape') + origin['products'].append(product_graph) + origin['slots'][kind,name] = (owner,first,new,chain+((old,new,role),)) + origin['edges'].append((kind,name,old,new,role,origin['generation'])) + return None + + def register_product(self,handle,suite,role,function,product_graph): + origin=self.origin(handle) + allowed=('C1','C2','C3','labels','roles','canonical','public_label', + 'public_residual','private_label','private_residual','prepare','finish') + need(type(role) is str and role in allowed and type(function) is _FUNCTION, + 'Epoch private product role/type') + if origin['suite'] is None: + need(origin.get('creating') is True,'Epoch factory not active') + origin['suite']=suite;origin['phase']='FACTORIES_ADMITTED' + need(origin['suite'] is suite,'Epoch source suite ownership') + proof=suite.proofs.get(id(function)) + need(proof is not None and proof[0] is function and proof[1]==role, + 'Epoch actual factory product proof') + origin['products'].append(product_graph) + origin.setdefault('private_products',{})[role]=function + return None + + def install(self, handle, kind, name, new): + origin = self.origin(handle) + owner, first, endpoint, chain = origin['slots'][kind,name] + need(endpoint is new and chain, 'Epoch install requires declared product') + prior = chain[-1][0] + if type(owner) is dict: + need(owner.get(name,_MISSING) is prior, 'Epoch global old identity') + owner[name] = new + else: + need(_CLASS_DICT(owner,type).get(name,_MISSING) is prior, 'Epoch class old identity') + type.__setattr__(owner,name,new) + origin['visible'][kind,name]=new + + def observed_transition(self, handle, kind, name, old, new, role, product_graph): + """Source-owned existing wrapper operation, verified with old retained ref.""" + origin=self.origin(handle) + owner, first, prior, chain=origin['slots'][kind,name] + need(old is prior, 'Epoch observed old identity') + current=owner[name] if type(owner) is dict else _CLASS_DICT(owner,type).get(name,_MISSING) + need(current is new and role in ROLE_FOR_SLOT[kind,name], 'Epoch observed source endpoint') + need(type(new) is _FUNCTION, 'Epoch observed function') + origin['products'].append(product_graph) + origin['slots'][kind,name]=(owner,first,new,chain+((old,new,role),)) + origin['visible'][kind,name]=new + origin['edges'].append((kind,name,old,new,role,origin['generation'])) + + def expected(self, owner, name, old): + for origin in self.origins.values(): + for (kind, field), (slot_owner, first, endpoint, chain) in origin['slots'].items(): + if slot_owner is owner and field == name and chain: + if old is first or any(old is item[0] for item in chain): + return origin['visible'][kind,field] + return old + + def expected_lookup(self, raw_record, namespace, name, expected): + # Exact ORIGINAL function-record identity/function + original namespace + # and lookup name/object. Products never become a replacement origin. + for origin in self.origins.values(): + canonical=origin['function_map'].get(id(raw_record[0])) + if canonical is raw_record and namespace is origin['namespace']: + for old_name, old_value, old_builtin in canonical[4]: + if old_name==name and old_value is expected: + return self.expected(namespace,name,expected) + return expected + + def original_record(self, function): + for origin in self.origins.values(): + record=origin['function_map'].get(id(function)) + if record is not None and record[0] is function:return record + return None + + def original_class(self, cls): + for origin in self.origins.values(): + for record in origin['authority_classes']: + if record[0] is cls:return record + return None + + def projected_member(self, cls, name, expected): + return self.expected(cls,name,expected) + + def check(self, handle): + origin=self.origin(handle); namespace=origin['namespace'];string_keys(namespace) + need(origin['module'].__dict__ is namespace and len(namespace)==len(origin['items']), + 'Epoch source namespace owner/census') + for name, value in origin['items']: + need(namespace.get(name,_MISSING) is self.expected(namespace,name,value), 'Epoch module current binding') + graphs=((origin['functions'],origin['classes']),)+tuple(origin['products']) + seen=set() + for functions, classes in graphs: + for cls,mro,members in classes: + need(type(cls) is type and _CLASS_MRO(cls,type) is mro, 'Epoch class dispatch') + proxy=_CLASS_DICT(cls,type);need(len(proxy)==len(members),'Epoch class census') + for name,value in members: + need(proxy.get(name,_MISSING) is self.expected(cls,name,value),'Epoch class current member') + for rec in functions: + if id(rec[0]) in seen:continue + seen.add(id(rec[0]));check_fields(rec) + fn, fields, keywords, cells, lookups,attrs=rec + ns,builtin_owner=fields[1:3];string_keys(ns);string_keys(builtin_owner) + for name,old,old_builtin in lookups: + need(ns.get(name,origin['missing']) is self.expected_lookup(rec,ns,name,old), 'Epoch current effective global') + need(builtin_owner.get(name,origin['missing']) is old_builtin,'Epoch current effective builtin') + return None + + def phase_to(self,handle,expected,new): + origin=self.origin(handle);need(origin['phase']==expected,'Epoch phase transition') + origin['phase']=new;return None + + def fix_raw_guard(self,handle,raw): + origin=self.origin(handle) + need(origin['phase']=='NATIVE_PRODUCTS_PREPARED' and origin['raw_guard'] is None,'Epoch raw guard phase') + origin['raw_guard']=raw;origin['phase']='GLOBALS_COMMITTED' + + def finish_bind(self,handle,result,owner): + origin=self.origin(handle) + need(origin['phase']=='GLOBALS_COMMITTED' and type(result) is dict and + result.get('runtime_guard') is origin['raw_guard'] and owner.runtime is origin['raw_guard'], + 'Epoch actual raw/final runtime guard') + self.check(handle) + result['runtime_guard'].check() + origin['phase']='FINAL_CAPTURED' + + def fail(self,handle,error): + origin=self.origins.get(id(handle)) + if origin is not None and origin['handle'] is handle: + origin['phase']='FAILED';origin['failure']=error + self.failure=error + + +# Source supplement to the versioned authority; initial source loading is parent-owned. + +def _epoch_closure(function): + need(type(function) is types.FunctionType, 'Epoch wrapper exact function') + return {} if function.__closure__ is None else dict(zip(function.__code__.co_freevars, + (cell.cell_contents for cell in function.__closure__))) + + +def _epoch_code_constant(code, name): + values=[x for x in code.co_consts if type(x) is types.CodeType and x.co_name==name] + need(len(values)==1, 'Epoch exact nested code '+name) + return values[0] + + +def _epoch_operations(ledger, legacy, capture_graph0, raw_function0, descriptor_factory, + record_for0, cold_check0, root, capability, api, missing, + engine_guard, bundle_cell): + pending={} + entries={} + def before(): + engine_guard();cold_check0() + + def owned(handle, digest=None): + before();record=cold_check0(handle) + if digest is not None:need(record[5]==digest,'Epoch selected source pin') + return record + + def suite_guard(handle,suite): + before() + origin=ledger.origin(handle) + record=owned(origin['cache_handle'],EPOCH_CACHE_SHA256) + cls=record[2].get('_EpochSuite') + need(type(suite) is cls and (origin['suite'] is suite or origin['suite'] is None and origin.get('creating') is True),'Epoch actual suite class/generation') + need(suite.handle is handle and suite.module is origin['module'] and + suite.namespace is origin['namespace'] and suite.label is origin['label'] and + suite.checks_class is origin['checks'] and suite.E0 is origin['slots']['module','echelon'][1] and + suite.owner is origin['factory_results'][2]['owner'],'Epoch fixed suite source bindings') + return origin,record + + def product_graph(origin,functions=(),classes=()): + fg,cg=capture_graph0(tuple(functions),tuple(classes)+(origin['label'],origin['checks'],origin['circuit'])) + return fg,tuple((x[0],x[1],x[3]) for x in cg) + + def graph_fields_only(value): + functions,classes=value + for rec in functions: + check_fields(rec) + namespace,builtin_owner=rec[1][1:3] + string_keys(namespace);string_keys(builtin_owner) + for name,expected,expected_builtin in rec[4]: + need(namespace.get(name,missing) is ledger.expected_lookup(rec,namespace,name,expected),'Epoch factory current effective global') + need(builtin_owner.get(name,missing) is expected_builtin,'Epoch factory current effective builtin') + for cls,mro,members in classes: + need(type(cls) is type and type.__dict__['__mro__'].__get__(cls,type) is mro,'Epoch factory class MRO') + proxy=type.__dict__['__dict__'].__get__(cls,type) + need(len(proxy)==len(members),'Epoch factory class census') + for name,expected in members:need(proxy.get(name,missing) is ledger.projected_member(cls,name,expected),'Epoch factory class source') + + def admit(stage,*args): + before();need(type(stage) is str,'Epoch admission stage type') + if stage=='driver_entry': + need(len(args)==3,'Epoch driver entry argument grammar') + function,phase_class,invocation_token=args + need(type(function) is types.FunctionType and function.__name__=='main_epoch' and + function.__globals__ is sys.modules['__main__'].__dict__ and type(phase_class) is type and + function.__globals__.get('Phases') is phase_class,'Epoch actual root-installed driver identity') + need(id(invocation_token) not in entries,'Epoch duplicate initial driver invocation') + fg,cg=capture_graph0((function,),(phase_class,)) + record=next(row for row in fg if row[0] is function) + entries[id(invocation_token)]=(invocation_token,record,(fg,tuple((x[0],x[1],x[3]) for x in cg)),phase_class) + return record + if stage=='load': + need(len(args)==1,'Epoch original loader arguments') + backend_handle=args[0];record=owned(backend_handle,BACKEND_SHA256) + need(record[12]=='backend' and record[3]=='native_backend','Epoch production backend owner') + need(sys.modules.get('complex_circuit') is None,'Epoch fresh production module required') + loader=record[2].get('load_source') + need(type(loader) is types.FunctionType and loader.__globals__ is record[2],'Epoch original loader binding') + module=legacy[1](backend_handle,'load_source','complex_circuit') + need(type(module) is types.ModuleType and module.__name__=='complex_circuit','Epoch actual loaded module') + raw=record[1].verify_sources() + ticket=object();pending[id(ticket)]=(ticket,module,backend_handle,record[1],raw) + return module,ticket + need(stage=='factories' and len(args)==7,'Epoch original factory arguments') + ticket,set_handle,construction_handle,cache_handle,cache_args,cache_kwargs,context=args + item=pending.pop(id(ticket),None) + need(item is not None and item[0] is ticket,'Epoch one-shot genuine load ticket') + module,backend_handle,backend,raw=item[1:] + owned(backend_handle,BACKEND_SHA256);owned(set_handle,EPOCH_SET_SHA256) + owned(construction_handle,EPOCH_CONSTRUCTION_SHA256);cache_record=owned(cache_handle,EPOCH_CACHE_SHA256) + need(type(cache_args) is tuple and len(cache_args)==2 and type(cache_kwargs) is dict and + all(type(k) is str for k in cache_kwargs),'Epoch cache factory transport') + need(set(cache_kwargs)=={'bootstrap_root','bootstrap_capability','bootstrap_api','factory_environment'} and + cache_kwargs['bootstrap_root'] is root and cache_kwargs['bootstrap_capability'] is capability and + cache_kwargs['bootstrap_api'] is api,'Epoch actual original bootstrap/factory context') + need(type(context) is dict and all(type(k) is str for k in context) and set(context)=={'data_handle','data_module','phase_function','phase_class','phase_owner','driver_function','driver_record','invocation_token','disposition_state'},'Epoch exact source context key domain') + data_record=owned(context['data_handle'],EPOCH_DATA_SHA256) + need(context['data_module'] is data_record[1],'Epoch current data adapter owner') + phase_fn=context['phase_function'];phase_owner=context['phase_owner'] + need(type(phase_fn) is types.FunctionType and type(phase_owner) is context['phase_class'] and + phase_fn is context['phase_class'].__dict__['wrap'] and + phase_fn.__globals__ is sys.modules['__main__'].__dict__,'Epoch genuine driver phase factory') + # Reference code is source authenticated DATA, compiled but never executed. + reference_path=pathlib.Path(__file__).with_name('reference_scientific_driver.py.txt') + reference=reference_path.read_bytes() + need(hashlib.sha256(reference).hexdigest()==EPOCH_REFERENCE_DRIVER_SHA256,'Epoch reference driver source') + original_code=compile(reference,phase_fn.__code__.co_filename,'exec',dont_inherit=True,optimize=sys.flags.optimize) + phase_code=_epoch_code_constant(_epoch_code_constant(original_code,'Phases'),'wrap') + need(backend._code_shape(phase_code)==backend._code_shape(phase_fn.__code__) and + phase_fn.__defaults__ is None and phase_fn.__kwdefaults__ is None and phase_fn.__closure__ is None, + 'Epoch original phase source/calling contract') + entry=entries.pop(id(context['invocation_token']),None) + need(entry is not None and entry[0] is context['invocation_token'] and entry[1] is context['driver_record'] and + entry[3] is context['phase_class'],'Epoch original consumed driver-entry authority') + graph_fields_only(entry[2]) + driver_record=context['driver_record'];check_fields(driver_record) + need(driver_record[0] is context['driver_function'] and driver_record[0].__globals__ is phase_fn.__globals__, + 'Epoch initial driver function record') + disposition_state=context['disposition_state'] + need(type(disposition_state) is dict and all(type(k) is str for k in disposition_state),'Epoch actual parent disposition state') + execution=driver_record[0].__globals__['_EXECUTION'] + need(type(execution) is dict and all(type(k) is str for k in execution) and execution.get('state') is disposition_state, + 'Epoch existing parent failure path must own acquisition state') + record=disposition_state.get('epoch_acquisition') + need(type(record) is dict and all(type(k) is str for k in record) and + disposition_state.get('cache_binding',missing) is None and disposition_state.get('authority') is legacy and + disposition_state.get('backend_handle') is backend_handle and disposition_state.get('enabled') is True and + type(disposition_state.get('owned_states')) is list and any(x is disposition_state for x in disposition_state['owned_states']) and + disposition_state.get('cache_teardown_attempted') is False,'Epoch continuously reachable disposition route') + # The pristine original functions/factories run before their mutations. + backend.guard_module(module) + p1=legacy[1](set_handle,'bind_verify_map',module) + construction=legacy[1](construction_handle,'bind_construction',module) + prepared=legacy[1](cache_handle,'prepare_epoch_cache_contract',module,*cache_args, + **cache_kwargs,disposition_state=disposition_state,disposition_record=record) + need(disposition_state['cache_binding'] is prepared and record['prepared'] is prepared and record['published'] is True, + 'Epoch acquisition handoff preceded graph/capture') + fg,cg=capture_graph0(tuple(v for v in module.__dict__.values() if type(v) is types.FunctionType), + (module.Label,module.Checks,module.ComplexSideCircuit)) + handle=ledger.capture(module,backend,raw,(p1,construction,prepared),(fg,cg),missing) + record['origin_handle']=handle + origin=ledger.origin(handle) + origin.update({'backend_handle':backend_handle,'cache_handle':cache_handle, + 'set_handle':set_handle,'construction_handle':construction_handle,'context':context, + 'data_record':data_record,'phase_record':raw_function0(phase_fn),'driver_record':driver_record, + 'creating':False,'native_pending':None,'driver_graph':entry[2]}) + roots=tuple(v for mapping in (p1,construction) for v in mapping.values() if type(v) is types.FunctionType) + ff,fc=capture_graph0(roots,(type(p1['owner']),type(construction['owner']),type(prepared['owner']))) + origin['factory_graph']=(ff,tuple((x[0],x[1],x[3]) for x in fc)) + origin['factory_items']=tuple((mapping,tuple(mapping.items())) for mapping in (p1,construction)) + record['phase']='ORIGIN_ACCEPTED_PARENT_OWNED' + return handle,p1,construction,prepared + + def derive(handle,context): + before() + origin=ledger.origin(handle);cache_record=owned(origin['cache_handle'],EPOCH_CACHE_SHA256) + need(origin['phase']=='ORIGINAL' and origin['context'] is context and not origin['creating'], + 'Epoch suite creation provenance') + creator=cache_record[2].get('create_epoch_suite') + need(type(creator) is types.FunctionType and creator.__globals__ is cache_record[2],'Epoch suite source creator') + origin['creating']=True + try: + p1,construction,prepared=origin['factory_results'] + prepared['owner']._epoch_creator_record=(bundle_cell[0][3],handle,context) + suite=creator(bundle_cell[0][3],handle,origin['module'],origin['backend'].verify_sources(), + prepared,p1,construction,context,origin['generation']) + need(origin['suite'] is suite,'Epoch multiproduct creator ownership') + origin['suite_snapshot']=(suite.registry,suite.products,suite.caller_caps,suite.descriptor, + suite.prepared,suite.p1,suite.construction) + return suite + except BaseException as error: + ledger.fail(handle,error);raise + finally:origin['creating']=False + + def check_factory(origin): + for mapping,items in origin['factory_items']: + need(type(mapping) is dict and len(mapping)==len(items),'Epoch original factory output census') + for key,value in items:need(mapping.get(key,missing) is value,'Epoch factory output binding') + graph_fields_only(origin['factory_graph']) + graph_fields_only(origin['driver_graph']) + + def wrap_proof(origin,suite,kind,name,role,function): + need(type(function) is types.FunctionType,'Epoch wrapper function type') + owner,first,old,chain=origin['slots'][kind,name] + p1,construction,prepared=origin['factory_results'];context=origin['context'] + if role=='construction_add':need(function is construction['add'],'Epoch original construction add product') + elif role=='p1':need(function is p1['verify_map'],'Epoch original P1 product') + elif role in ('public_label','public_residual'): + need(function is suite.products[role],'Epoch genuine public source product') + elif role=='checks_capture': + maker=origin['data_record'][2]['install_epoch_circuit'] + need(function.__code__ is _epoch_code_constant(maker.__code__,'captured_checks') and + function.__globals__ is origin['data_record'][2],'Epoch original checks observer source') + cells=_epoch_closure(function) + need(set(cells)=={'original_checks_init','capture_checks'} and cells['original_checks_init'] is old, + 'Epoch checks observer original constructor') + method=cells['capture_checks'] + need(type(method) is types.MethodType and method.__self__ is p1['owner'] and + method.__func__ is type(p1['owner']).__dict__['capture_checks'],'Epoch P1 capture method') + elif role=='phase': + check_fields(origin['phase_record']);phase=context['phase_function'];cells=_epoch_closure(function) + need(function.__code__ is _epoch_code_constant(phase.__code__,'observed') and + function.__globals__ is phase.__globals__ and set(cells)=={'self','name','original'} and + cells['self'] is context['phase_owner'] and cells['original'] is old and + type(cells['name']) is str,'Epoch genuine original phase product') + expected={('circuit','__init__'):'side_construction',('checks','__init__'):'checks_initialization', + ('module','compile_roles'):'compile_roles',('checks','verify_map'):'verify_map', + ('checks','verify_labels'):'verify_labels'} + need((kind,name) in expected and cells['name']==expected[kind,name],'Epoch phase identity') + elif role=='roles_observer': + check_fields(origin['driver_record']);maker=context['driver_function'];cells=_epoch_closure(function) + need(function.__code__ is _epoch_code_constant(maker.__code__,'observe_roles') and + function.__globals__ is maker.__globals__ and + set(cells)=={'captures','original_roles','phases'} and cells['original_roles'] is old and + cells['phases'] is context['phase_owner'] and type(cells['captures']) is dict, + 'Epoch actual role observation source') + else:need(False,'Epoch undeclared existing wrapper role') + defaults=function.__defaults__ + need(function.__kwdefaults__ is None and (type(defaults) is tuple and len(defaults)==1 and defaults[0] is None if role=='roles_observer' else defaults is None),'Epoch wrapper default contract') + return old + + def product(handle,suite,action,*args): + origin,record=suite_guard(handle,suite) + need(type(action) is str,'Epoch product action type') + if action=='product': + role,function=args + need(origin['creating'] is True or origin['suite'] is suite,'Epoch genuine source-product creator') + # Complete source factories already verified reconstructive inverses; + # both actual function and exact proof record must be in that suite. + if origin.get('suite_fields') is None:origin['suite_fields']=object.__getattribute__(suite,'__dict__') + proof=suite.proofs.get(id(function)) + need(proof is not None and proof[0] is function and suite.products[role] is function, + 'Epoch multiproduct proof member') + check_fields(raw_function0(function)) + return ledger.register_product(handle,suite,role,function, + product_graph(origin,(function,),(type(suite),))) + if action=='install': + kind,name,role,function=args + need(suite.products.get(role) is function,'Epoch registered callsite product') + old=origin['slots'][kind,name][2] + ledger.authorize(handle,kind,name,old,function,role,product_graph(origin,(function,),(type(suite),))) + ledger.install(handle,kind,name,function) + return None + if action=='existing': + kind,name,role,function=args;check_factory(origin) + old=wrap_proof(origin,suite,kind,name,role,function) + ledger.authorize(handle,kind,name,old,function,role,product_graph(origin,(function,),(type(suite),))) + ledger.install(handle,kind,name,function) + return None + need(action=='construction_init' and not args,'Epoch constructor wrapper action') + check_factory(origin);p1,construction,prepared=origin['factory_results'] + wrapper=construction['wrap_constructor'](construction['original_init'],p1['owner'].capture_c) + old=origin['slots']['circuit','__init__'][2] + ledger.authorize(handle,'circuit','__init__',old,wrapper,'construction_init',product_graph(origin,(wrapper,),(type(suite),))) + ledger.install(handle,'circuit','__init__',wrapper) + return wrapper + + def stages(handle,suite,stage,*args): + origin,record=suite_guard(handle,suite) + need(type(stage) is str,'Epoch bind stage type') + if stage=='reconcile': + need(origin['phase']=='FACTORIES_ADMITTED','Epoch prebind phase') + # Every nonnative slot was installed through the source-owned API. + ledger.check(handle);origin['phase']='CALLERS_INSTALLED';return None + if stage=='prepare': + need(origin['phase']=='CALLERS_INSTALLED' and len(args)==5,'Epoch native preparation stage') + module,label,original_functions,complement,gram=args + need(module is origin['module'] and label is origin['label'] and type(original_functions) is list, + 'Epoch actual original bind arguments') + rank_calls,trace,native,row,final_guard=suite.bind_inputs + owned(origin['backend_handle'],BACKEND_SHA256) + backend=origin['backend'];check_fields(origin['phase_record']);check_fields(origin['driver_record']) + # The original trace factory ran after original guard_module and + # before the original native closures were assigned. + oldrank=origin['slots']['module','rank'][2];traced=module.rank + cells=_epoch_closure(traced) + need(traced.__code__ is _epoch_code_constant(backend.attach_trace.__code__,'traced_rank') and + traced.__globals__ is backend.__dict__ and cells['original_rank'] is oldrank and + cells['rank_calls'] is rank_calls,'Epoch original rank trace source') + ledger.observed_transition(handle,'module','rank',oldrank,traced,'rank_trace',product_graph(origin,(traced,))) + expected_helpers=[dict(origin['items'])[name] for name in backend._HELPER_NAMES] + expected_helpers.extend(v for name,v in origin['class_map'][id(label)][2] if type(v) is types.FunctionType) + need(len(original_functions)==len(expected_helpers) and all(a is b for a,b in zip(original_functions,expected_helpers)), + 'Epoch retained original bind function list') + records=[] + for name,fn,role,native_name in (('complement_in',complement,'native_complement','complement'),('nondegenerate',gram,'native_gram','gram_rank')): + expected_code=_epoch_code_constant(suite.bind_expected_code,name) + need(backend._code_shape(fn.__code__)==backend._code_shape(expected_code) and + fn.__globals__ is backend.__dict__ and fn.__builtins__ is builtins.__dict__ and + fn.__defaults__ is None and fn.__kwdefaults__ is None,'Epoch native closure code/calling source') + values=_epoch_closure(fn);need(values.get('runtime',missing) is None,'Epoch native pending runtime') + need(values.get('label',label) is label,'Epoch native Label closure') + entry=native.__dict__[native_name] + need(type(entry) is types.BuiltinFunctionType and entry.__self__ is native and + values.get('native_complement' if name=='complement_in' else 'native_gram') is entry, + 'Epoch current native entry closure') + for field,value in values.items(): + if field=='runtime':continue + expected={'label':label,'complement_trace':trace,'rank_calls':rank_calls,'rank_row_intern':row, + 'original_complement':origin['slots']['label','complement_in'][1], + 'original_nondegenerate':origin['slots']['label','nondegenerate'][1], + 'original_dot':dict(origin['items'])['dot'],'original_rank':dict(origin['items'])['rank']}.get(field,missing) + if expected is not missing:need(value is expected,'Epoch native captured argument '+field) + elif field=='counters':need(type(value) is dict and set(value)=={'complement_native','complement_fallback','gram_native','gram_fallback'} and all(type(v) is int and v==0 for v in value.values()),'Epoch actual initial counters') + elif field not in ('native_complement','native_gram'):need(False,'Epoch unexpected native closure field '+field) + cell=dict(zip(fn.__code__.co_freevars,fn.__closure__))['runtime'] + records.append((name,fn,role,cell,raw_function0(fn))) + origin['native_pending']=tuple(records);origin['phase']='NATIVE_PRODUCTS_PREPARED';return None + if stage=='commit': + need(len(args)==1 and origin['phase']=='NATIVE_PRODUCTS_PREPARED','Epoch global commit stage') + raw=args[0];need(type(raw) is suite.bind_inputs[4],'Epoch exact actual raw guard allocation') + for name,fn,role,cell,initial in origin['native_pending']: + need(cell.cell_contents is raw,'Epoch exact fixed runtime-cell endpoint') + fields=raw_function0(fn) + need(len(fields[1])==len(initial[1]) and all(a is b for a,b in zip(fields[1],initial[1])) and len(fields[3])==len(initial[3]),'Epoch native closure fields changed') + for (oldcell,oldvalue),(newcell,newvalue) in zip(initial[3],fields[3]): + need(oldcell is newcell and (newvalue is raw if oldcell is cell else newvalue is oldvalue),'Epoch native cell transition') + old=origin['slots']['label',name][2] + ledger.observed_transition(handle,'label',name,old,fn,role,product_graph(origin,(fn,),(type(raw),))) + ledger.fix_raw_guard(handle,raw) + old=origin['slots']['module','echelon'][2];hook=suite.products['canonical'] + # Only initialization can observe GLOBALS_COMMITTED; no epoch is armed. + origin['phase']='NATIVE_PRODUCTS_PREPARED' + ledger.authorize(handle,'module','echelon',old,hook,'canonical',product_graph(origin,(hook,),(type(suite),))) + ledger.install(handle,'module','echelon',hook);origin['phase']='GLOBALS_COMMITTED' + ledger.check(handle);return None + need(stage=='finish' and len(args)==2,'Epoch final binding stage') + return ledger.finish_bind(handle,args[0],args[1]) + + def seal(handle,suite): + origin,record=suite_guard(handle,suite) + need(origin['phase']=='FINAL_CAPTURED','Epoch seal after actual final graph') + ledger.check(handle);origin['phase']='SEALED';return None + + def check(handle,suite): + origin,record=suite_guard(handle,suite) + need(origin['phase'] in ('FACTORIES_ADMITTED','CALLERS_INSTALLED','GLOBALS_COMMITTED','FINAL_CAPTURED','SEALED'), + 'Epoch current binding phase') + if 'suite_snapshot' in origin: + values=origin['suite_snapshot'] + need(all(a is b for a,b in zip(values,(suite.registry,suite.products,suite.caller_caps,suite.descriptor, + suite.prepared,suite.p1,suite.construction))),'Epoch fixed suite data binding') + for role,fn in origin.get('private_products',{}).items(): + need(suite.products.get(role) is fn,'Epoch actual product dispatch identity') + graph_fields_only(origin['driver_graph']) + ledger.check(handle);return None + + def manifest(handle): + before();origin=ledger.origin(handle) + return {'schema':'h25-epoch-source-manifest-v1','generation':origin['generation'], + 'phase':origin['phase'],'edge_count':len(origin['edges']), + 'source_sha256':'d623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1', + 'runtime_admission':False,'full_execution_contract':None} + + # This fence owns failed installations. It runs metadata disposal only; + # no failed source/native check is retried and no origin is recaptured. + engine_guard() + getattrs=object.__getattribute__;setattrs=object.__setattr__ + ledger_fields=getattrs(ledger,'__dict__');origins0=ledger_fields['origins'] + failure_box=[None] + clear0=dict.clear;get0=dict.get;type0=type;id0=id;dict0=dict;str0=str + def failed(handle,error): + origin=get0(origins0,id0(handle)) + if origin is None or get0(origin,'handle') is not handle:return None + origin['phase']='FAILED' + if origin['primary_error'] is None:origin['primary_error']=error + if failure_box[0] is None:failure_box[0]=error + # Do not write a rejected/current instance namespace here. The actual + # origin/Suite dictionaries and independent failure_box own P; Core.fail + # remains the legitimate source transition for its diagnostic scalar. + suite=get0(origin,'suite') + if suite is None:return None + fields=get0(origin,'suite_fields') + if fields is None:return None + if get0(fields,'primary_error') is None:fields['primary_error']=error + fields['active']=False;fields['terminal']=True;fields['pending']=None + fields['checks']=None;fields['checks_c']=None;fields['checks_h']=None + try: + registry=get0(fields,'registry') + if type0(registry) is not dict0:raise RuntimeError('Epoch failed registry is not exact metadata dict') + clear0(registry) + except BaseException as secondary: + origin['uncertain']=True;fields['uncertain']=True + if origin['secondary_error'] is None:origin['secondary_error']=secondary + if get0(fields,'secondary_error') is None:fields['secondary_error']=secondary + return None + + def plain0(value): + if type0(value) is not dict0:return False + for key in value: + if type0(key) is not str0:return False + return True + + def protect(function): + def operation(*args,**kwargs): + try: + engine_guard() + return function(*args,**kwargs) + except BaseException as primary: + if function is admit: + if len(args)==8 and type0(args[0]) is str and args[0]=='factories': + context=args[-1] + if plain0(context): + state=get0(context,'disposition_state') + record=get0(state,'epoch_acquisition') if plain0(state) else None + if plain0(record): + if get0(record,'primary') is None:record['primary']=primary + handle=get0(record,'origin_handle') + if handle is not None:failed(handle,primary) + elif args:failed(args[0],primary) + raise + return operation + + return tuple(protect(fn) for fn in (admit,derive,product,stages,seal,check,manifest)) + + +EPOCH_CACHE_SHA256 = '20a8a94e96bfa6213d4f04244dabecf059b4c8c7e8ffa7e9409a8b87cfeef494' +EPOCH_DATA_SHA256 = '18679fd1eb6ae99c4b375756511427c26718f77674c2d8fcc490e25ceb47cba5' +EPOCH_SET_SHA256 = 'eeeead34731e73f74dff250f354e57b72314c4e18670848bfa9f48c87de1305d' +EPOCH_CONSTRUCTION_SHA256 = 'ed7fd6c8a93c524c4d28245e48d75d6b949234a5a60f6affb8025f27ef9506b5' +EPOCH_REFERENCE_DRIVER_SHA256 = '8027a1b24d08a598c2aa9e91cfe791edd58d1b87b17ce5957cee2d5da49d5c2f' + +_G12_REFERENCE_TRANSPORT_SHA256 = None +# Independently selected fixed custody consumer source; None remains closed. + +def capture_epoch_authority(root, capability, api): + """Return load/invoke/check/runtime_guard/check_product/set_guard/source. + + The trusted parent calls this entry once immediately after raw source exec. + A later backend instance derives provenance from this original token; it + cannot substitute a newly captured stdlib or a self-reported class record. + """ + if _CAPTURE_ONCE: + raise RuntimeError('Cold authority can only be captured once before exposure') + _CAPTURE_ONCE.append(True) + type0, id0, len0, next0, tuple0, list0 = type, id, len, next, tuple, list + dict0, str0, bytes0, object0, int0 = dict, str, bytes, object, int + error0, base_error0, value_error0 = RuntimeError, BaseException, ValueError + function_type, module_type, code_type = types.FunctionType, types.ModuleType, types.CodeType + builtin_type, cell_type = types.BuiltinFunctionType, types.CellType + static_type, class_type, property_type = staticmethod, classmethod, property + dict_get, dict_items, dict_iter = dict.get, dict.items, dict.__iter__ + dict_len, dict_set, dict_del, dict_clear = dict.__len__, dict.__setitem__, dict.__delitem__, dict.clear + object_get = object.__getattribute__ + type_get = type.__getattribute__ + module_dict_get = module_type.__dict__['__dict__'].__get__ + class_dict_get = type.__dict__['__dict__'].__get__ + class_mro_get = type.__dict__['__mro__'].__get__ + cell_get = cell_type.__dict__['cell_contents'].__get__ + function_fields = tuple((name, function_type.__dict__[name].__get__) for name in + ('__code__', '__globals__', '__builtins__', '__defaults__', + '__kwdefaults__', '__closure__', '__dict__')) + proxy_type = type(type.__dict__) + proxy_get, proxy_iter, proxy_items, proxy_len = proxy_type.get, proxy_type.__iter__, proxy_type.items, proxy_type.__len__ + builtin_self_get = builtin_type.__dict__['__self__'].__get__ + builtin_namespace = builtins.__dict__ + missing = object0() + missing_id = id0(missing) + initial_sys_modules = sys.modules + initial_sys_flags = sys.flags + initial_optimize = sys.flags.optimize + sys_owner = sys + sys_namespace = module_dict_get(sys_owner, module_type) + authority_namespace = globals() + root_pin, provider_pin, backend_pin = ROOT_SHA256, PROVIDER_SHA256, BACKEND_SHA256 + g12_transport_pin = _G12_REFERENCE_TRANSPORT_SHA256 + cache_pin = EPOCH_CACHE_SHA256 + max_source, max_functions, max_classes = 1048576, 8192, 2048 + registry, by_namespace, products, backend_guards = {}, {}, {}, {} + transitions = [] + ledger = EpochLedger() + bundle_cell = [] + descriptor_cell = [] + engine_class = EpochLedger + engine_mro = class_mro_get(engine_class, type0) + engine_members = tuple0(proxy_items(class_dict_get(engine_class,type0))) + engine_dict_get = proxy_get(class_dict_get(engine_class,type0),'__dict__').__get__ + engine_namespace = engine_dict_get(ledger,engine_class) + if type0(engine_namespace) is not dict0:raise error0('Epoch engine instance dictionary differs') + initial_iterator=initial_key=None + initial_valid=True + try: + initial_iterator=dict_iter(engine_namespace) + while True: + initial_key=next0(initial_iterator,missing) + if initial_key is missing:break + if type0(initial_key) is not str0:initial_valid=False;break + initial_key=None + finally:initial_iterator=initial_key=None + if not initial_valid:raise error0('Epoch engine instance key domain differs') + engine_namespace_names = tuple0(dict_iter(engine_namespace)) + engine_origins = dict_get(engine_namespace,'origins',missing) + engine_class_origin = dict_get(engine_namespace,'class_origin',missing) + engine_method_origin = dict_get(engine_namespace,'method_origin',missing) + engine_functions = tuple0((value,tuple0(getter(value,function_type) for _,getter in function_fields)) + for name,value in engine_members if type0(value) is function_type) + def engine_guard(): + if type0(ledger) is not engine_class or class_mro_get(engine_class,type0) is not engine_mro: + raise error0('Epoch engine class identity differs') + actual_namespace=engine_dict_get(ledger,engine_class) + if type0(actual_namespace) is not dict0 or actual_namespace is not engine_namespace: + raise error0('Epoch engine instance namespace differs') + iterator=current=None + valid_domain=True + try: + iterator=dict_iter(actual_namespace) + while True: + current=next0(iterator,missing) + if current is missing:break + if type0(current) is not str0:valid_domain=False;break + current=None + finally:iterator=current=None + if not valid_domain:raise error0('Epoch engine instance key domain differs') + if dict_len(actual_namespace)!=len0(engine_namespace_names): + raise error0('Epoch engine instance member census differs') + for field in engine_namespace_names: + if dict_get(actual_namespace,field,missing) is missing: + raise error0('Epoch engine instance member binding differs') + if dict_get(actual_namespace,'origins',missing) is not engine_origins: + raise error0('Epoch engine instance origins binding differs') + if dict_get(actual_namespace,'class_origin',missing) is not engine_class_origin or dict_get(actual_namespace,'method_origin',missing) is not engine_method_origin: + raise error0('Epoch engine fixed record binding differs') + current_phase=dict_get(actual_namespace,'phase',missing) + current_serial=dict_get(actual_namespace,'serial',missing) + current_failure=dict_get(actual_namespace,'failure',missing) + if type0(current_phase) is not str0 or current_phase not in ('COLD','ORIGINAL'): + raise error0('Epoch engine phase schema differs') + if type0(current_serial) is not int0 or current_serial<0 or current_serial>1 or (current_phase=='ORIGINAL' and current_serial!=1): + raise error0('Epoch engine serial schema differs') + # COLD/1 is a real in-progress or failed original capture interval. + # failure is None or an actual native BaseException subclass instance; + # the native type MRO avoids arbitrary __class__/isinstance callbacks. + if current_failure is not None: + failure_type=type0(current_failure) + failure_bases=class_mro_get(failure_type,type0) + valid_failure=False + for base in failure_bases: + if base is base_error0:valid_failure=True;break + if not valid_failure:raise error0('Epoch engine failure schema differs') + proxy=class_dict_get(engine_class,type0) + if proxy_len(proxy)!=len0(engine_members):raise error0('Epoch engine class census differs') + for name,value in engine_members: + if proxy_get(proxy,name,missing) is not value:raise error0('Epoch engine class binding differs') + for function,fields in engine_functions: + for (_,getter),expected in zip0(function_fields,fields): + if getter(function,function_type) is not expected:raise error0('Epoch engine method environment differs') + initial_std_modules = (_ast, ast, copy, copyreg, genericpath, hashlib, io, + ntpath, os, pathlib, posixpath, types) + producer_rules = ( + ('320435ec4125544f2b2aedf74f21469b232d08683fe76f0913607516254bbd29', 'make_runtime_guard', 'backend_guard'), + ('f7ca7f4f03ac63c1a95ba42f06149543211566de5e29f487a3dc4d08c5ee9b94', 'extra_guard_type', 'extra_guard'), + ('4bdb401271ffd049c52eff0edc28d8d604a11faf66fec419555a82cbd3b32d60', 'make_trace_type', 'trace'), + ('364b45c100be73a7ace44ab664f3c792020dad6f33f7788b62aaeab67c0c5aa9', 'make_row_interner', 'row_function'), + ('364b45c100be73a7ace44ab664f3c792020dad6f33f7788b62aaeab67c0c5aa9', 'make_runtime_guard', 'row_guard'), + ('364b45c100be73a7ace44ab664f3c792020dad6f33f7788b62aaeab67c0c5aa9', 'make_cache_runtime_guard', 'row_guard'), + ('5aeee9364d29147ef4e1bfffba532f7392833a6158d73d1da50ed6c772f061af', 'derive_row_bind', 'row_bind'), + (cache_pin, 'compose_runtime_guard', 'cache_guard'), + (cache_pin, 'compose_epoch_runtime_guard', 'epoch_guard')) + + def need(ok, message): + if not ok: + raise error0(message) + + def string_domain(owner, domains): + key = iterator = kind = None + try: + identity = id0(owner) + prior = dict_get(domains, identity, missing) + if prior is not missing: + return prior + kind = type0(owner) + if kind is dict0: + iterator = dict_iter(owner) + elif kind is proxy_type: + iterator = proxy_iter(owner) + else: + return False + while True: + key = next0(iterator, missing) + if key is missing: + break + if type0(key) is not str0: + dict_set(domains, identity, False) + return False + key = None + dict_set(domains, identity, True) + return True + finally: + key = iterator = kind = owner = None + + def get_id(owner, name, domains): + try: + if type0(name) is not str0 or not string_domain(owner, domains): + return -1 + if type0(owner) is dict0: + return id0(dict_get(owner, name, missing)) + return id0(proxy_get(owner, name, missing)) + finally: + owner = None + + def identity_mapping(owner, expected): + """Non-string dispatch dictionaries: identity scan, never key equality.""" + iterator = pair = key = value = None + try: + if type0(owner) is not dict0 or dict_len(owner) != len0(expected): + return False + iterator = iter0(dict_items(owner)) + while True: + pair = next0(iterator, missing) + if pair is missing: + break + key, value = pair + found = False + for old_key, old_value in expected: + if key is old_key: + if value is not old_value: + return False + found = True + break + if not found: + return False + pair = key = value = None + return True + finally: + iterator = pair = key = value = owner = None + + iter0 = iter + + def code_names(code): + pending, result, seen = [code], [], {} + while pending: + current = pending.pop() + need(type0(current) is code_type, 'Cold authority code shape differs') + for name in current.co_names: + need(type0(name) is str0, 'Cold authority code name shape differs') + if dict_get(seen, name, missing) is missing: + dict_set(seen, name, True) + result.append(name) + for value in current.co_consts: + if type0(value) is code_type: + pending.append(value) + return tuple0(result) + + def raw_function_record(function): + need(type0(function) is function_type, 'Cold authority requires exact functions') + values = tuple0(getter(function, function_type) for _, getter in function_fields) + code, namespace, builtins_owner, defaults, keywords, closure, attributes = values + domains = {} + try: + need(type0(namespace) is dict0 and type0(builtins_owner) is dict0 and + string_domain(namespace, domains) and string_domain(builtins_owner, domains), + 'Cold authority initial function dictionary domain differs') + keyword_items = () + if keywords is not None: + need(type0(keywords) is dict0 and string_domain(keywords, domains), + 'Cold authority initial keyword defaults differ') + keyword_items = tuple0(dict_items(keywords)) + cells = () if closure is None else tuple0((cell, cell_get(cell, cell_type)) for cell in closure) + lookups = tuple0((name, dict_get(namespace, name, missing), dict_get(builtins_owner, name, missing)) + for name in code_names(code)) + need(type0(attributes) is dict0 and string_domain(attributes, domains), + 'Cold authority function attribute dictionary differs') + return (function, values, keyword_items, cells, lookups, tuple0(dict_items(attributes))) + finally: + dict_clear(domains) + + def capture_graph(initial_functions, initial_classes): + """Called only at initial source load or directly after an admitted producer.""" + functions, classes, seen_functions, seen_classes = [], [], {}, {} + pending_functions, pending_classes = list0(initial_functions), list0(initial_classes) + while pending_functions or pending_classes: + while pending_classes: + cls = pending_classes.pop() + need(type0(cls) is type0, 'Cold authority class metaclass differs') + if dict_get(seen_classes, id0(cls), missing) is not missing: + continue + need(len0(classes) < max_classes, 'Cold authority class census exceeds bound') + dict_set(seen_classes, id0(cls), cls) + mro = class_mro_get(cls, type0) + proxy = class_dict_get(cls, type0) + engine_guard() + canonical_class = ledger.original_class(cls) + members = tuple0(proxy_items(proxy)) if canonical_class is None else canonical_class[3] + classes.append((cls, mro, proxy, members) if canonical_class is None else canonical_class) + for base in mro[1:]: + if type0(base) is type0: + pending_classes.append(base) + for name, value in members: + need(type0(name) is str0, 'Cold authority class member name differs') + kind = type0(value) + if kind is function_type: + pending_functions.append(value) + elif kind is static_type or kind is class_type: + underlying = object_get(value, '__func__') + if type0(underlying) is function_type: + pending_functions.append(underlying) + elif kind is property_type: + for field in ('fget', 'fset', 'fdel'): + underlying = object_get(value, field) + if type0(underlying) is function_type: + pending_functions.append(underlying) + if pending_functions: + function = pending_functions.pop() + if dict_get(seen_functions, id0(function), missing) is not missing: + continue + need(len0(functions) < max_functions, 'Cold authority function census exceeds bound') + engine_guard() + canonical_function = ledger.original_record(function) + record = raw_function_record(function) if canonical_function is None else canonical_function + dict_set(seen_functions, id0(function), function) + functions.append(record) + for cell, value in record[3]: + if type0(value) is function_type: + pending_functions.append(value) + defaults = record[1][3] + if defaults is not None: + need(type0(defaults) is tuple0, 'Cold authority positional defaults shape differs') + for value in defaults: + if type0(value) is function_type: + pending_functions.append(value) + for name, value in record[2] + record[5]: + if type0(value) is function_type: + pending_functions.append(value) + # Source-owned function helpers reached through effective globals + # are authenticated transitively, including validator helpers. + for name, value, builtin_value in record[4]: + if type0(value) is function_type: + pending_functions.append(value) + return (tuple0(functions), tuple0(classes)) + + def expected_global(namespace, name, expected, original_record=None): + engine_guard() + if original_record is not None: + projected = ledger.expected_lookup(original_record,namespace,name,expected) + else: + projected = ledger.expected(namespace,name,expected) + if projected is not expected:return projected + if name != 'RuntimeGuard': + return expected + record = dict_get(by_namespace, id0(namespace), missing) + if record is not missing and record[2] is namespace and record[12] == 'backend': + return dict_get(backend_guards, id0(record[0]), missing) + return expected + + def fresh_function(record, domains, builtin_values): + function, values, keyword_items, cells, lookups, attributes_items = record + if type0(function) is not function_type: + return False + field_key = ('function-fields', id0(function)) + observed_fields = dict_get(domains, field_key, missing) + if observed_fields is missing: + scalar_fields = [] + for (_, getter), expected in zip0(function_fields, values): + observed_id = id0(getter(function, function_type)) + if observed_id != id0(expected): + return False + scalar_fields.append(observed_id) + dict_set(domains, field_key, tuple0(scalar_fields)) + else: + if len0(observed_fields) != len0(values): + return False + for observed_id, expected in zip0(observed_fields, values): + if observed_id != id0(expected): + return False + code, namespace, builtins_owner, defaults, keywords, closure, attributes = values + if keywords is not None: + if type0(keywords) is not dict0 or dict_len(keywords) != len0(keyword_items): + return False + for name, expected in keyword_items: + if get_id(keywords, name, domains) != id0(expected): + return False + for cell, expected in cells: + try: + if id0(cell_get(cell, cell_type)) != id0(expected): + return False + except value_error0: + return False + if dict_len(attributes) != len0(attributes_items): + return False + for name, expected in attributes_items: + if get_id(attributes, name, domains) != id0(expected): + return False + lookup_key = ('function-lookups', id0(function), id0(code), + id0(namespace), id0(builtins_owner)) + observed_lookups = dict_get(domains, lookup_key, missing) + if observed_lookups is missing: + scalar_lookups = [] + for name, expected, expected_builtin in lookups: + observed_global = get_id(namespace, name, domains) + if observed_global != id0(expected_global(namespace, name, expected, record)): + return False + # A false builtin_values path must not observe builtin keys or + # values. The absent slot is completed only in a later true path. + if builtin_values: + observed_builtin = get_id(builtins_owner, name, domains) + if observed_builtin != id0(expected_builtin): + return False + scalar_lookups.append((name, observed_global, True, observed_builtin)) + else: + scalar_lookups.append((name, observed_global, False, 0)) + dict_set(domains, lookup_key, tuple0(scalar_lookups)) + else: + if len0(observed_lookups) != len0(lookups): + return False + completed_lookups = None + index = 0 + for (name, expected, expected_builtin), observed in zip0(lookups, observed_lookups): + if observed[0] != name: + return False + if observed[1] != id0(expected_global(namespace, name, expected, record)): + return False + if builtin_values: + if observed[2]: + observed_builtin = observed[3] + else: + observed_builtin = get_id(builtins_owner, name, domains) + if observed_builtin != id0(expected_builtin): + return False + if not observed[2]: + if completed_lookups is None: + completed_lookups = list0(observed_lookups) + completed_lookups[index] = (name, observed[1], True, observed_builtin) + index += 1 + if completed_lookups is not None: + dict_set(domains, lookup_key, tuple0(completed_lookups)) + return True + + zip0 = zip + + def fresh_graph(graph, domains, builtin_values, message): + functions, classes = graph + for cls, mro, proxy, members in classes: + if not (type0(cls) is type0 and class_mro_get(cls, type0) is mro and + proxy_len(proxy) == len0(members)): + need(False, message + ': class dispatch') + for name, expected in members: + if not (get_id(proxy, name, domains) == id0(ledger.projected_member(cls, name, expected))): + need(False, message + ': class member ' + name) + for record in functions: + if not (fresh_function(record, domains, builtin_values)): + need(False, message + ': function environment') + + def module_image(module, name, kind, path, digest, source_bytes, *, stdlib=False): + need(type0(module) is module_type, 'Cold authority module exact type differs') + namespace = module_dict_get(module, module_type) + domains = {} + try: + need(type0(namespace) is dict0 and string_domain(namespace, domains), + 'Cold authority module dictionary domain differs') + items = tuple0(dict_items(namespace)) + functions, classes = [], [] + for field, value in items: + if type0(value) is function_type: + if stdlib or value.__globals__ is namespace: + functions.append(value) + elif type0(value) is type0: + declared = type_get(value, '__module__') + if stdlib or (type0(declared) is str0 and declared == name): + classes.append(value) + graph = capture_graph(functions, classes) + mappings = [] + selected = ('_CANONICAL_BUILTINS', '_TYPE_BUILTINS') if kind == 'backend' else () + for field in selected: + mapping = dict_get(namespace, field, missing) + need(type0(mapping) is dict0, 'Cold authority backend dispatch dictionary differs') + mappings.append((field, mapping, tuple0(dict_items(mapping)))) + original_guard = dict_get(namespace, 'RuntimeGuard', missing) if kind == 'backend' else None + if kind == 'backend': + need(type0(original_guard) is type0, 'Cold authority original RuntimeGuard differs') + handle = object0() + return (handle, module, namespace, name, path, digest, source_bytes, + items, graph[0], graph[1], tuple0(mappings), original_guard, kind) + finally: + dict_clear(domains) + + def record_for(handle): + record = dict_get(registry, id0(handle), missing) + need(record is not missing and record[0] is handle, 'Cold authority handle is not registered') + return record + + def fresh_module(record, domains, builtin_values, *, registry_slot=True, exact_census=True, prefix='Cold authority'): + module, namespace = record[1], record[2] + if not (type0(module) is module_type and module_dict_get(module, module_type) is namespace): + need(False, prefix + ': module owner differs') + if registry_slot: + if not (get_id(initial_sys_modules, record[3], domains) == id0(module)): + need(False, prefix + ': registered module slot differs') + if exact_census: + if not (dict_len(namespace) == len0(record[7])): + need(False, prefix + ': namespace census differs') + for name, expected in record[7]: + if not (get_id(namespace, name, domains) == id0(expected_global(namespace, name, expected))): + need(False, prefix + ': namespace binding ' + name) + for name, mapping, expected in record[10]: + if not (identity_mapping(mapping, expected)): + need(False, prefix + ': dispatch dictionary ' + name) + fresh_graph((record[8], record[9]), domains, builtin_values, prefix) + + need(type0(root) is module_type and type0(api) is tuple0 and len0(api) == 4, + 'Cold authority requires the actual pristine root and sealed fourtuple') + root_namespace = module_dict_get(root, module_type) + root_api_graph = capture_graph(api, ()) + root_hash = dict_get(root_namespace, '_hash_regular', missing) + root_compile = dict_get(root_namespace, '_COMPILE', missing) + root_exec = dict_get(root_namespace, '_EXEC', missing) + root_identity = api[0] + initial_builtin_items = tuple0(dict_items(builtin_namespace)) + stdlib_records = tuple0(module_image(module, module.__name__, 'stdlib', None, None, None, stdlib=True) + for module in initial_std_modules) + stdlib_mappings = tuple0((mapping, tuple0(dict_items(mapping))) for mapping in + (copy._deepcopy_dispatch, copy.dispatch_table, copyreg.dispatch_table)) + self_graph = capture_graph((dict_get(authority_namespace, 'capture_epoch_authority'),), (EpochLedger,)) + self_items = tuple0(dict_items(authority_namespace)) + + def root_and_stdlib(domains): + need(type0(sys_owner) is module_type and module_dict_get(sys_owner, module_type) is sys_namespace and + get_id(sys_namespace, 'modules', domains) == id0(initial_sys_modules) and + get_id(sys_namespace, 'flags', domains) == id0(initial_sys_flags), + 'Cold authority interpreter owner differs') + need(dict_len(builtin_namespace) == len0(initial_builtin_items), 'Cold authority builtin census differs') + for name, expected in initial_builtin_items: + need(get_id(builtin_namespace, name, domains) == id0(expected), 'Cold authority builtin binding ' + name) + for name, expected in self_items: + need(get_id(authority_namespace, name, domains) == id0(expected), 'Cold authority source binding ' + name) + fresh_graph(self_graph, domains, True, 'Cold authority source') + fresh_graph(root_api_graph, domains, True, 'Cold authority root entry') + dict_clear(domains) + need(root_identity() == root_pin, 'Cold authority actual root source identity differs') + dict_clear(domains) + for record in stdlib_records: + fresh_module(record, domains, True, registry_slot=True, exact_census=False, prefix='Cold authority initial stdlib') + for mapping, expected in stdlib_mappings: + need(identity_mapping(mapping, expected), 'Cold authority initial copy dispatch differs') + + def check_registered(domains): + for record in tuple0(registry.values()): + fresh_module(record, domains, True) + for product_record in tuple0(products.values()): + fresh_graph(product_record[5], domains, True, 'Epoch current registered source product') + + def cold_check(handle=None): + domains = {} + try: + root_and_stdlib(domains) + check_registered(domains) + if handle is not None: + record = record_for(handle) + dict_clear(domains) + digest, size, raw = root_hash(record[4], max_source, False) + need(digest == record[5], 'Cold authority source file changed') + return record + return None + finally: + dict_clear(domains) + + def load(path, digest, name, kind='module'): + cold_check() + need(type0(path) is str0 and path.startswith('/') and type0(digest) is str0 and len0(digest) == 64 and + type0(name) is str0 and name and type0(kind) is str0 and kind in ('module', 'backend'), + 'Cold authority source-load argument shape differs') + for character in digest: + need(character in '0123456789abcdef', 'Cold authority source digest is not lowercase SHA256') + need((kind == 'backend') == (digest == backend_pin), 'Cold authority original backend classification differs') + domains = {} + try: + need(get_id(initial_sys_modules, name, domains) == missing_id, 'Cold authority module name already registered') + finally: + dict_clear(domains) + observed, size, source_bytes = root_hash(path, max_source, True) + need(observed == digest and type0(source_bytes) is bytes0, 'Cold authority source bytes differ') + module = module_type(name) + namespace = module_dict_get(module, module_type) + namespace.update({'__file__': path, '__builtins__': builtin_namespace}) + if name == '_h25_g12_reference_transport': + need(type0(g12_transport_pin) is str0 and len0(g12_transport_pin) == 64 and + digest == g12_transport_pin and kind == 'module' and + path == authority_namespace['__file__'].rsplit('/', 1)[0] + '/g12_reference_transport.py', + 'G12 fixed custody transport source/path has not been selected') + # These are the original captured objects of this private loader, + # inserted before selected source exec and before module_image. + # No caller-owned setter or reconstructed capability participates. + need(root_identity() == root_pin and api[1](capability, provider_pin) is not None, + 'G12 initial actual Root/capability is no longer current') + namespace.update({'bootstrap_root': root, 'bootstrap_capability': capability, + 'bootstrap_api': api, 'bootstrap_g12_source_identity': (path, digest, size)}) + + # Dataclass/import ownership sees the correct unique slot during exec. + dict_set(initial_sys_modules, name, module) + try: + code = root_compile(source_bytes, path, 'exec', dont_inherit=True, optimize=initial_optimize) + root_exec(code, namespace) + record = module_image(module, name, kind, path, digest, source_bytes) + dict_set(registry, id0(record[0]), record) + dict_set(by_namespace, id0(namespace), record) + if kind == 'backend': + dict_set(backend_guards, id0(record[0]), record[11]) + cold_check(record[0]) + except base_error0: + # A failed source is retained in the unique slot for evidence and + # cannot be retried/reclassified as an unobserved clean load. + raise + return (module, record[0]) + + def make_caller_descriptor(operations, label): + """Mint only at original capture or an authenticated entry-three return. + + The caller checks the dispatcher record INLINE before invoking it. This + is not a claim that the dispatcher can authenticate its own replacement + code. Its already-admitted active frame checks all target/helper objects. + """ + pending, seen, records = list0(operations), {}, [] + # Authenticate every borrowed ledger/support helper before invocation. + pending.extend(value for name,value in tuple0(dict_items(authority_namespace)) if type0(value) is function_type) + pending.extend(value for name,value in engine_members if type0(value) is function_type) + while pending: + function = pending.pop() + if dict_get(seen, id0(function), missing) is not missing: + continue + need(len0(records) < max_functions, 'Cold authority caller helper census exceeds bound') + raw = raw_function_record(function) + record = (function,) + raw[1][:6] + (raw[2], raw[3]) + dict_set(seen, id0(function), function) + records.append(record) + for cell, value in record[8]: + if type0(value) is function_type: + pending.append(value) + records = tuple0(records) + field_getters = function_fields[:6] + primitives = (type0, function_type, id0, len0, field_getters, cell_type, + cell_get, error0, value_error0, tuple0, dict0, str0, + dict_get, dict_len, dict_iter, next0, dict_clear, missing, zip0) + + def dispatch(index, *args, **kwargs): + # The active caller has already authenticated this actual function. + # This pretarget block uses captured C primitives only. In particular + # it does not call need(), fresh_function(), or any other validator. + if type0(index) is not int0 or index < 0 or index >= len0(operations): + raise error0(label + ': operation index differs') + for record in records: + function = record[0] + if type0(function) is not function_type: + raise error0(label + ': target exact function differs') + for (name, getter), expected in zip0(field_getters, record[1:7]): + if id0(getter(function, function_type)) != id0(expected): + raise error0(label + ': target function environment differs') + keywords = record[5] + if keywords is not None: + if type0(keywords) is not dict0 or dict_len(keywords) != len0(record[7]): + raise error0(label + ': target keyword census differs') + iterator = current = None + valid_domain = True + try: + iterator = dict_iter(keywords) + while True: + current = next0(iterator, missing) + if current is missing: + break + if type0(current) is not str0: + valid_domain = False + break + current = None + finally: + # Foreign current keys never survive a retained error. + iterator = current = None + if not valid_domain: + raise error0(label + ': target keyword key domain differs') + for name, expected in record[7]: + if id0(dict_get(keywords, name, missing)) != id0(expected): + raise error0(label + ': target keyword value differs') + for cell, expected in record[8]: + try: + observed_id = id0(cell_get(cell, cell_type)) + except value_error0: + raise error0(label + ': target closure became empty') from None + if observed_id != id0(expected): + raise error0(label + ': target closure value differs') + # The chosen function object comes from the original immutable + # operations tuple, not a mutable late attribute or caller registry. + if bundle_cell: + attrs = function_fields[6][1](bundle_cell[0][1][0], function_type) + iterator = current = None + valid = type0(attrs) is dict0 and dict_len(attrs)==2 + try: + if valid: + iterator=dict_iter(attrs) + while True: + current=next0(iterator,missing) + if current is missing:break + if type0(current) is not str0:valid=False;break + current=None + finally:iterator=current=None + if not valid or dict_get(attrs,'_h25_epoch_bundle',missing) is not bundle_cell[0]: + raise error0('Epoch immutable bootstrap bundle transport differs') + if dict_get(attrs,'_h25_caller_descriptor',missing) is not descriptor_cell[0]: + raise error0('Epoch original caller descriptor transport differs') + return operations[index](*args, **kwargs) + + raw_dispatch = raw_function_record(dispatch) + dispatch_record = (dispatch,) + raw_dispatch[1][:6] + (raw_dispatch[2], raw_dispatch[3]) + need(dispatch_record[4] is None and dispatch_record[5] is None and not dispatch_record[7], + 'Cold authority dispatcher source defaults contract differs') + return ('h25-cold-authority-caller-v1', operations, dispatch, + dispatch_record, records, primitives) + + def runtime_guard(handle): + record = cold_check(handle) + def guarded_helpers(): + domains = {} + try: + fresh_module(record, domains, False, prefix='Runtime drift: cache collector') + finally: + dict_clear(domains) + child_descriptor = make_caller_descriptor((guarded_helpers,), 'Runtime drift: cache collector caller') + return (guarded_helpers, child_descriptor) + + def known_backend(module): + need(type0(module) is module_type, 'Cold authority producer backend type differs') + namespace = module_dict_get(module, module_type) + record = dict_get(by_namespace, id0(namespace), missing) + need(record is not missing and record[1] is module and record[12] == 'backend' and record[5] == backend_pin, + 'Cold authority producer backend provenance differs') + return record + + def known_guard(cls): + need(type0(cls) is type0, 'Cold authority exact guard class differs') + for record in tuple0(registry.values()): + if record[12] == 'backend' and cls is record[11]: + return None + product = dict_get(products, id0(cls), missing) + need(product is not missing and product[0] is cls and product[6] in + ('backend_guard', 'extra_guard', 'row_guard', 'cache_guard', 'epoch_guard'), + 'Cold authority guard was not produced by an admitted source') + domains = {} + try: + fresh_graph(product[5], domains, True, 'Cold authority producer base product') + finally: + dict_clear(domains) + return product + + def classify(record, export): + for digest, name, role in producer_rules: + if digest is not None and record[5] == digest and export == name: + return role + return None + + def validate_producer_arguments(record, export, role, args, kwargs): + domains = {} + try: + need(type0(kwargs) is dict0 and string_domain(kwargs, domains) and not kwargs, + 'Cold authority reviewed producers require positional arguments') + if role == 'backend_guard': + need(len0(args) == 1, 'Cold authority backend guard arguments differ') + known_backend(args[0]) + elif role == 'extra_guard': + need(len0(args) == 3 and type0(args[2]) is tuple0, 'Cold authority trace guard arguments differ') + known_guard(args[0]); known_backend(args[1]) + for entry in args[2]: + need(type0(entry) is tuple0 and len0(entry) == 3, + 'Cold authority trace entry shape differs') + owner, name, function = entry + need(type0(owner) is module_type and type0(name) is str0 and + type0(function) is builtin_type and + builtin_self_get(function, builtin_type) is owner and + get_id(module_dict_get(owner, module_type), name, domains) == id0(function), + 'Cold authority trace entry owner differs') + elif role == 'trace': + need(len0(args) == 2 and type0(args[1]) is module_type, 'Cold authority trace producer arguments differ') + known_backend(args[0]) + elif role == 'row_function': + need(not args, 'Cold authority row interner arguments differ') + elif role == 'row_guard': + need(len0(args) == 2, 'Cold authority row guard arguments differ') + known_guard(args[0]) + product = dict_get(products, id0(args[1]), missing) + need(product is not missing and product[0] is args[1] and product[1] is record[0] and + product[2] == 'make_row_interner' and product[6] == 'row_function', + 'Cold authority row helper provenance differs') + fresh_graph(product[5], domains, True, 'Cold authority producer row helper') + elif role == 'cache_guard': + need(len0(args) == 2 and type0(args[1]) is dict0 and string_domain(args[1], domains), + 'Cold authority cache guard arguments differ') + known_guard(args[0]) + owner = dict_get(args[1], 'owner', missing) + need(type0(owner) is dict_get(record[2], '_Owner', missing), + 'Cold authority prepared cache owner class differs') + elif role == 'epoch_guard': + need(len0(args)==2, 'Epoch guard exact source arguments') + known_guard(args[0]) + suite=args[1] + need(type0(suite) is dict_get(record[2], '_EpochSuite', missing), 'Epoch guard source suite class') + origin=ledger.origin(suite.handle) + need(origin['suite'] is suite and origin['cache_handle'] is record[0], 'Epoch guard actual source generation') + elif role == 'row_bind': + need(len0(args) == 2 and type0(args[0]) is function_type and type0(args[1]) is bytes0, + 'Cold authority row bind arguments differ') + found = False + for backend_record in tuple0(registry.values()): + if (backend_record[12] == 'backend' and args[0] is dict_get(backend_record[2], 'bind', missing) and + args[1] is backend_record[6]): + found = True + break + need(found, 'Cold authority row bind is not the original registered function/source') + finally: + dict_clear(domains) + + def invoke(handle, export, *args, **kwargs): + record = cold_check(handle) + need(type0(export) is str0, 'Cold authority export name must be exact str') + function = dict_get(record[2], export, missing) + need(type0(function) is function_type and function.__globals__ is record[2], + 'Cold authority export is not an owned source function') + role = classify(record, export) + if role is not None: + validate_producer_arguments(record, export, role, args, kwargs) + g12_reference = record[3] == '_h25_g12_reference_transport' + if g12_reference: + need(record[5] == g12_transport_pin and export == 'load_original_g12_reference' and + len0(args) == 3 and args[0] is root and args[1] is capability and args[2] is api and + type0(kwargs) is dict0 and not kwargs, + 'G12 exact original cold Root/capability/API argument ownership differs') + result = function(*args, **kwargs) + if g12_reference: + cold_check(handle) + need(type0(result) is tuple0 and len0(result) == 4 and type0(result[0]) is bool and + type0(result[1]) is int0 and result[1] > 0 and type0(result[2]) is bytes0 and + type0(result[3]) is tuple0, 'G12 fixed independent transfer result shape differs') + if role is not None: + # Do not retain a row producer's enclosing tuple or mutable AST. + product = result[0] if type0(result) is tuple0 and len0(result) and type0(result[0]) is function_type else result + expected_kind = function_type if role in ('row_function', 'row_bind') else type0 + need(type0(product) is expected_kind and dict_get(products, id0(product), missing) is missing, + 'Cold authority producer did not return a fresh exact product') + graph = capture_graph((product,) if expected_kind is function_type else (), + (product,) if expected_kind is type0 else ()) + product_record = (product, handle, export, args, tuple0(dict_items(kwargs)), graph, role) + dict_set(products, id0(product), product_record) + domains = {} + try: + fresh_graph(graph, domains, True, 'Cold authority new product') + finally: + dict_clear(domains) + return result + + def check_product(obj, producer_handle, export, args_tuple, kwargs_dict): + record_for(producer_handle) + cold_check(producer_handle) + need(type0(args_tuple) is tuple0 and type0(kwargs_dict) is dict0 and type0(export) is str0, + 'Cold authority product proof arguments differ') + product = dict_get(products, id0(obj), missing) + need(product is not missing and product[0] is obj and product[1] is producer_handle and product[2] == export, + 'Cold authority product provenance differs') + need(len0(args_tuple) == len0(product[3]), 'Cold authority product positional census differs') + for actual, expected in zip0(args_tuple, product[3]): + need(actual is expected, 'Cold authority product positional identity differs') + domains = {} + try: + need(dict_len(kwargs_dict) == len0(product[4]), 'Cold authority product keyword census differs') + for name, expected in product[4]: + need(get_id(kwargs_dict, name, domains) == id0(expected), 'Cold authority product keyword identity differs') + fresh_graph(product[5], domains, True, 'Cold authority registered product') + finally: + dict_clear(domains) + return None + + def set_backend_guard(handle, cls): + record = cold_check(handle) + need(record[12] == 'backend', 'Cold authority guard transition requires original backend') + product = known_guard(cls) + domains = {} + try: + if product is not None: + fresh_graph(product[5], domains, True, 'Cold authority guard transition product') + old = dict_get(backend_guards, id0(handle), missing) + need(dict_get(record[2], 'RuntimeGuard', missing) is old, + 'Cold authority backend guard changed outside the transition ledger') + dict_clear(domains) + dict_set(record[2], 'RuntimeGuard', cls) + dict_set(backend_guards, id0(handle), cls) + transitions.append((handle, old, cls, product)) + fresh_module(record, domains, True) + finally: + dict_clear(domains) + return None + + def source(handle): + record = cold_check(handle) + return (record[1], record[4], record[5], record[6]) + + # Final initial-root validation occurs before any source can receive a token. + cold_check() + need(api[1](capability, provider_pin) is not None, 'Cold authority root capability differs') + operations = (load, invoke, cold_check, runtime_guard, check_product, set_backend_guard, source) + descriptor = make_caller_descriptor(operations, 'Cold authority caller') + # Original raw loader only: capture this transport immediately and retain + # the immutable descriptor privately. No later attribute read is authority. + load.__dict__['_h25_caller_descriptor'] = descriptor + descriptor_cell.append(descriptor) + epoch_operations = _epoch_operations(ledger, operations, capture_graph, raw_function_record, + make_caller_descriptor, record_for, cold_check, root, capability, api, missing, engine_guard, bundle_cell) + epoch_descriptor = make_caller_descriptor(epoch_operations, 'Epoch authority caller') + bundle = ('h25-cold-authority-epoch-bundle-v1', operations, epoch_operations, epoch_descriptor) + bundle_cell.append(bundle) + load.__dict__['_h25_epoch_bundle'] = bundle + return bundle diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/g12_reference_cold_consumer_v1.py.txt b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/g12_reference_cold_consumer_v1.py.txt new file mode 100644 index 0000000000..19cb9376c2 --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/g12_reference_cold_consumer_v1.py.txt @@ -0,0 +1,1104 @@ +"""Fixed G12 two-export consumer. SOURCE ONLY; all selections stay closed. + +The selected cold registered-source executor must inject the actual initial +Root/capability/API before candidate exposure, authenticate these exact source +bytes and this entry, and pass those same objects. Python shapes do not prove +that premise. No result registry, setter, caller success flag or new oracle. +""" +import os +import sys +import stat +import json +import hashlib +import math +from types import FunctionType, CodeType, ModuleType + +G12_REFERENCE_HANDOFF = None +# Future immutable nine-tuple exactly as accepted DESIGN-v1; never a setter. +# Independent selected consumer identity is injected by the fixed original +# cold loader BEFORE exec. It is not stored inside its own source (no hash cycle). +_BOOTSTRAP = (globals().get('bootstrap_root'), globals().get('bootstrap_capability'), + globals().get('bootstrap_api'), globals().get('bootstrap_g12_source_identity')) +_ROOT_PIN = 'f5a2d33f2b4d3651f214156a0e7094c2bb516ce2d5ab7698d18c11f98f35dee0' +_PROVIDER_PIN = '9cbb7368f89e71d1e6cc46db5dc77efed3e03ed2a801c98c88fe316e4d9f3ef2' +_PRODUCER_PIN = 'a346025d5b6e2b26246521c6af6292643a4c2c3286b33ff3996dcf051cd6be26' +_GUARD_PIN = 'bd882e3dadb1b6aeaa63ee824f1a1c58f8ef2546b6840a2bffa46885a184d3eb' +_AUTHORITY_PIN = 'f279ab86fc17c6a517b035f19d56863919cbd8304de4e7d5332457c6159aec10' +_META_CAP = 262144 +_PAIR_CAP = 268435456 +_CHUNK = 65536 +_LOG_CAP = 2097152 +_MISSING = object() +_ID_NAMES = ('dev', 'ino', 'full_st_mode', 'size', 'mtime_ns', 'ctime_ns') +# BEGIN FIXED G12 FILE AND PAIR LEAF + +class _RawG12Errors: + """Fixed error-retention slots; storing raw failures precedes formatting/IO.""" + __slots__ = ('slots', 'count') + def __init__(self): + self.slots = [None] * 4096 + self.count = 0 + def append(self, value): + # All fixed directory/process/stream paths together have fewer than 4096 + # close sites under the 256-component/128-generation source ceilings. + if self.count >= len(self.slots): + raise RuntimeError('G12-N09: fixed raw secondary retention exhausted') + self.slots[self.count] = value + self.count += 1 + def __bool__(self): + return self.count != 0 + def __len__(self): + return self.count + def __getitem__(self, index): + if type(index) is not int or not 0 <= index < self.count: + raise IndexError(index) + return self.slots[index] + def __iter__(self): + for index in range(self.count): + yield self.slots[index] + def __repr__(self): + return repr(tuple(self)) + + +def _need(condition, message): + if not condition: + raise RuntimeError(message) + + +def _exact(value, expected): + if type(value) is not type(expected): + return False + if type(value) in (list, tuple): + return len(value) == len(expected) and all(_exact(a, b) for a, b in zip(value, expected)) + if type(value) is dict: + return set(value) == set(expected) and all(_exact(value[k], expected[k]) for k in expected) + return value == expected + + +def _fields(value, fields): + _need(type(value) is dict and all(type(k) is str for k in value) and + set(value) == set(fields), 'G12-N12: exact field domain differs') + + +def _digest(value): + return type(value) is str and len(value) == 64 and all(c in '0123456789abcdef' for c in value) + + +def _uint(value, positive=False): + _need(type(value) is int and value >= (1 if positive else 0), 'G12-N12: exact integer domain') + + +def _number(value): + _need(type(value) in (int, float) and math.isfinite(value) and value >= 0, + 'G12-N12: finite nonnegative exact number required') + + +def _path(path): + _need(type(path) is str and path.startswith('/') and + all(p not in ('', '.', '..') for p in path.split('/')[1:]), 'G12-N11: absolute canonical path') + return path + + +def _identity(info): + return dict(zip(_ID_NAMES, (info.st_dev, info.st_ino, info.st_mode, info.st_size, + info.st_mtime_ns, info.st_ctime_ns))) + + +def _directory_key(info): + return info.st_dev, info.st_ino, info.st_mode + + +def _directory_chain(path): + """Held no-follow chain; no later absolute path silently changes its owner.""" + _path(path) + _need(len(path.split('/')) <= 257, 'G12-N11: finite directory-component bound') + fds, rows = [], [] + primary = None + try: + fd = os.open('/', os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC) + fds.append(fd) + for part in path.split('/')[1:]: + before = os.stat(part, dir_fd=fd, follow_symlinks=False) + _need(stat.S_ISDIR(before.st_mode), 'G12-N11: directory component type') + child = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW | os.O_CLOEXEC, + dir_fd=fd) + fds.append(child) + opened = os.fstat(child) + _need(_directory_key(before) == _directory_key(opened), 'G12-N11: directory replaced') + rows.append((fd, part, child, _directory_key(opened))) + fd = child + return fds, rows + except BaseException as error: + primary = (error, error.__traceback__) + secondary = _RawG12Errors() + for descriptor in reversed(fds): + try: + os.close(descriptor) + except BaseException as error: + secondary.append((error, error.__traceback__)) + _raise_preserved(primary, secondary) + + +def _check_chain(rows): + for parent, name, descriptor, key in rows: + _need(_directory_key(os.fstat(descriptor)) == key == + _directory_key(os.stat(name, dir_fd=parent, follow_symlinks=False)), + 'G12-N11: directory binding changed') + + +def _raise_preserved(primary, secondaries): + """Never replace first raw failure if evidence formatting or retention fails.""" + if primary is not None: + error, traceback = primary + try: + error.add_note('G12 ordered secondary failures: ' + repr(secondaries)) + except BaseException: + pass + raise error.with_traceback(traceback) + if secondaries: + error, traceback = secondaries[0][:2] + raise error.with_traceback(traceback) + + +def _read_file(path, cap, mode=None): + _path(path) + parent, name = path.rsplit('/', 1) + fds, rows = _directory_chain(parent) + descriptor, primary, secondary, result = None, None, _RawG12Errors(), None + try: + before = os.stat(name, dir_fd=fds[-1], follow_symlinks=False) + _need(stat.S_ISREG(before.st_mode) and before.st_nlink == 1 and + 0 <= before.st_size <= cap and (mode is None or before.st_mode == stat.S_IFREG | mode), + 'G12-N11: regular-file size/mode/link domain') + descriptor = os.open(name, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK | os.O_CLOEXEC, + dir_fd=fds[-1]) + opened = os.fstat(descriptor) + _need(_identity(before) == _identity(opened) and opened.st_nlink == 1, + 'G12-N11: file changed on open') + count, blocks, hasher = 0, [], hashlib.sha256() + while count < opened.st_size: + block = os.read(descriptor, min(_CHUNK, opened.st_size - count)) + _need(bool(block), 'G12-N11: short file read') + count += len(block) + hasher.update(block) + blocks.append(block) + _need(os.read(descriptor, 1) == b'', 'G12-N11: file grew') + after = os.fstat(descriptor) + ending = os.stat(name, dir_fd=fds[-1], follow_symlinks=False) + _need(_identity(before) == _identity(after) == _identity(ending) and + after.st_nlink == ending.st_nlink == 1, 'G12-N11: full file identity changed') + _check_chain(rows) + result = ({'path': path, 'sha256': hasher.hexdigest(), 'bytes': count, + 'identity': _identity(after), 'nlink': 1}, b''.join(blocks)) + except BaseException as error: + primary = (error, error.__traceback__) + for fd in ([descriptor] if descriptor is not None else []) + list(reversed(fds)): + try: + os.close(fd) + except BaseException as error: + secondary.append((error, error.__traceback__)) + _raise_preserved(primary, secondary) + return result + + +def _file_record(value): + _fields(value, ('path', 'sha256', 'bytes', 'identity', 'nlink')) + _path(value['path']) + _need(_digest(value['sha256']) and type(value['nlink']) is int and value['nlink'] == 1, + 'G12-N11: file digest/link record') + _uint(value['bytes']) + _fields(value['identity'], _ID_NAMES) + for key in _ID_NAMES: + _need(type(value['identity'][key]) is int, 'G12-N11: exact stat value') + _uint(value['identity']['dev']) + _uint(value['identity']['ino'], True) + _need(stat.S_ISREG(value['identity']['full_st_mode']) and + value['identity']['size'] == value['bytes'], 'G12-N11: file identity size/type') + + +def _root_read(root, api, record, cap): + _file_record(record) + _need(api[0]() == _ROOT_PIN, 'G12-N04: actual Root currentness') + before = root._hash_regular(record['path'], cap, False) + observed, raw = _read_file(record['path'], cap, 0o444) + after = root._hash_regular(record['path'], cap, False) + _need(_exact(observed, record) and before[:2] == after[:2] == + (record['sha256'], record['bytes']), 'G12-N17: Root/read/full-identity join') + _need(api[0]() == _ROOT_PIN, 'G12-N04: actual Root changed after file read') + return raw + + +def _pairs(items): + result = {} + for key, value in items: + _need(type(key) is str and key not in result, 'G12-N12: duplicate JSON key') + result[key] = value + return result + + +def _nonfinite(value): + raise ValueError('G12-N12: nonfinite JSON token: ' + value) + + +def _canonical(value): + return json.dumps(value, sort_keys=True, separators=(',', ':'), ensure_ascii=True, + allow_nan=False).encode('ascii') + + +def _json(raw, cap, canonical=False, newline=False): + _need(type(raw) is bytes and len(raw) <= cap, 'G12-N12: raw JSON bound') + # Scan lexical nesting before json.loads recursion or object materialization. + depth, quoted, escaped = 0, False, False + for char in raw: + if quoted: + if escaped: + escaped = False + elif char == 92: + escaped = True + elif char == 34: + quoted = False + elif char == 34: + quoted = True + elif char in (91, 123): + depth += 1 + _need(depth <= 256, 'G12-N12: JSON depth limit') + elif char in (93, 125): + depth -= 1 + _need(depth >= 0, 'G12-N12: JSON nesting') + _need(depth == 0 and not quoted, 'G12-N12: incomplete JSON') + value = json.loads(raw.decode('utf-8'), object_pairs_hook=_pairs, parse_constant=_nonfinite) + pending, count = [(value, 0)], 0 + while pending: + item, depth = pending.pop() + count += 1 + _need(count <= cap and depth <= 256, 'G12-N12: JSON node/depth limit') + if type(item) is dict: + pending.extend((x, depth + 1) for pair in item.items() for x in pair) + elif type(item) is list: + pending.extend((x, depth + 1) for x in item) + elif type(item) is str: + _need(len(item) <= cap, 'G12-N12: JSON string limit') + elif type(item) is float: + _need(math.isfinite(item), 'G12-N12: overflowed JSON number') + else: + _need(item is None or type(item) in (bool, int), 'G12-N12: JSON primitive') + if canonical: + _need(raw == _canonical(value) + (b'\n' if newline else b''), 'G12-N12: canonical JSON bytes') + return value + + +def _hex(value, cap): + _need(type(value) is str and len(value) <= cap and len(value) % 2 == 0 and + all(c in '0123456789abcdef' for c in value), 'G12-N12: complete lowercase hex') + return bytes.fromhex(value) + + +def _decimal(value, positive=False): + _need(type(value) is str and bool(value), 'G12-N12: integer tag text') + digits = value[1:] if value.startswith('-') else value + _need(bool(digits) and all(c in '0123456789' for c in digits) and + (digits == '0' or digits[0] != '0') and value != '-0' and + (not positive or (not value.startswith('-') and value != '0')), 'G12-N12: canonical integer') + + +def _tagged(raw, cap): + value = _json(raw, cap, True) + pending = [(value, 0)] + count = 0 + while pending: + node, depth = pending.pop() + count += 1 + _need(count <= cap and depth <= 256 and type(node) is list and len(node) >= 1 and + type(node[0]) is str, 'G12-N12: tagged primitive bound/shape') + tag = node[0] + if tag == 'None': + _need(len(node) == 1, 'G12-N12: None arity') + continue + _need(len(node) == (3 if tag == 'Fraction' else 2), 'G12-N12: primitive arity') + arg = node[1] + if tag == 'bool': + _need(type(arg) is bool, 'G12-N12: bool tag') + elif tag == 'int': + _decimal(arg) + elif tag == 'Fraction': + _decimal(arg) + _decimal(node[2], True) + elif tag == 'str': + _need(type(arg) is str, 'G12-N12: string tag') + elif tag == 'bytes': + _hex(arg, cap) + elif tag == 'float': + _need(type(arg) is str and float.fromhex(arg).hex() == arg, 'G12-N12: float.hex domain') + elif tag in ('tuple', 'list'): + _need(type(arg) is list, 'G12-N12: sequence tag') + pending.extend((item, depth + 1) for item in arg) + elif tag == 'dict': + _need(type(arg) is list, 'G12-N12: ordered dict tag') + for pair in arg: + _need(type(pair) is list and len(pair) == 2, 'G12-N12: dict pair') + pending.extend((item, depth + 1) for item in pair) + else: + raise ValueError('G12-N12: unknown primitive tag') + return value + + +def _rank_events(encoded): + value = _tagged(_hex(encoded, _PAIR_CAP), _PAIR_CAP) + _need(value[0] == 'tuple', 'G12-N12: rank tuple') + for event in value[1]: + _need(event[0] == 'tuple' and len(event[1]) == 2 and event[1][0][0] == 'tuple' and + all(x[0] == 'int' for x in event[1][0][1]) and event[1][1][0] == 'int', + 'G12-N12: rank-event grammar') + return len(value[1]) + + +def _validate_pair(common_raw, diagnostic_raw): + common = _json(common_raw, _PAIR_CAP, True, True) + diagnostic = _json(diagnostic_raw, _PAIR_CAP, True, True) + spec = _PAIR_SCHEMA + _fields(common, spec['common_exact_fields']) + _fields(diagnostic, spec['diagnostic_exact_fields']) + for key, expected in spec['common_constants'].items(): + _need(_exact(common[key], expected), 'G12-N13: original common source/workload binding') + for key, expected in spec['diagnostic_constants'].items(): + _need(_exact(diagnostic[key], expected), 'G12-N13: diagnostic source/role binding') + _need(type(common['literal_original_value']) is bool, 'G12-N12: observed literal exact bool') + _uint(common['remaining_original_case_count'], True) + payload = _hex(common['common_payload_hex'], _PAIR_CAP) + _need(_digest(common['common_payload_sha256']) and + hashlib.sha256(payload).hexdigest() == common['common_payload_sha256'] == + diagnostic['common_payload_sha256'], 'G12-N13: complete common digest join') + tagged = _tagged(payload, _PAIR_CAP) + _need(tagged[0] == 'tuple' and len(tagged[1]) == 10, 'G12-N13: common tuple arity') + prefix = [['str', 'g12-original-remainder-common-v1'], + ['tuple', [['str', p] for p in spec['common_constants']['original_scientific_pins']]], + ['int', '25'], ['tuple', [['int', '0'], ['int', '2'], ['int', '1']]]] + _need(_exact(tagged[1][:4], prefix), 'G12-N13: common inner source/workload prefix') + suffix = ['tuple', [['str', name] for name in ('verify_role_frames', 'full_log_integer_bounds', + 'original_upstream_verify_sources', 'original_serializable', 'complete_original_cli')]] + _need(_exact(tagged[1][-1], suffix), 'G12-N13: original suffix phase order') + for key in ('prefix_end', 'suffix_start', 'cli_end'): + row = diagnostic[key] + _fields(row, spec['diagnostic_snapshot_exact_fields']) + _uint(row['rank_event_count']) + _need(_rank_events(row['ordered_rank_events_hex']) == row['rank_event_count'] and + row['native_binding'] is None and row['cache_binding'] is None, + 'G12-N12: original diagnostic rank/binding domain') + receipt = row['complement_receipt'] + _fields(receipt, spec['complement_receipt_exact_fields']) + _uint(receipt['calls']) + _uint(receipt['canonical_stream_bytes']) + _need(_digest(receipt['sha256']) and receipt['schema'] == + 'v2-jsonl:call,us,vs,result(type=list+values or type=None); ordered exact integer vectors', 'G12-N12: complement receipt') + _rank_events(diagnostic['ordered_rank_suffix_hex']) + _fields(diagnostic['phases'], spec['phase_exact_names']) + for row in diagnostic['phases'].values(): + _fields(row, ('calls', 'wall_seconds', 'cpu_seconds_with_children')) + _need(type(row['calls']) is int and row['calls'] == 1, 'G12-N12: phase calls') + _number(row['wall_seconds']) + _number(row['cpu_seconds_with_children']) + return common, diagnostic, payload + + +def _source_pin(value): + _fields(value, ('path', 'sha256', 'bytes', 'mode')) + _path(value['path']) + _uint(value['bytes']) + _need(_digest(value['sha256']) and type(value['mode']) is str and len(value['mode']) == 4 and + all(c in '01234567' for c in value['mode']), 'G12-N02: exact source pin') + + +def _validate_guard(start, receipt, usage, stdout, stderr, root_argv, invocation, source_pins, phase_sha): + _fields(start, _GUARD_SCHEMA['START_exact_fields']) + _fields(receipt, _GUARD_SCHEMA['receipt_exact_fields']) + _fields(usage, ('user_seconds', 'system_seconds', 'kernel_max_rss_kib', 'exit')) + for key in start: + _need(_exact(start[key], receipt[key]), 'G12-N07: original START/receipt field join') + for key, expected in _GUARD_SCHEMA['required_values'].items(): + _need(_exact(receipt[key], expected), 'G12-N07: original guard success predicate') + for key in ('job', 'label', 'stage_sha256'): + _need(_exact(start[key], invocation[key]), 'G12-N07: selected invocation mismatch') + expected_launch = {'contract': 'trusted-clean-nosite-safe-path-fixedseed-v1', + 'no_site': 1, 'no_user_site': 1, 'safe_path': True, 'ignore_environment': 0, + 'isolated': 0, 'hash_seed_environment': '0', 'hash_randomization': 0, + 'initial_sys_path': ['/usr/lib/python312.zip', '/usr/lib/python3.12', '/usr/lib/python3.12/lib-dynload'], + 'environment': dict(_ENV), + 'trust_boundary': 'Authenticated parent launcher, OS, interpreter and system stdlib before this module; no Python self-authentication claim'} + _need(_exact(start['parent_launch'], expected_launch), 'G12-N07: exact original clean parent launch') + _need(_exact(start['command'], root_argv) and start['runner_sha256'] == _GUARD_PIN and + start['budget_phase_sha256'] == phase_sha and _digest(start['fractions_sha256']), + 'G12-N07: selected command/source/phase binding') + _need(type(start['phase_cap_seconds']) is int and start['phase_cap_seconds'] in (600, 2400), + 'G12-N05: original aggregate cap') + _number(start['spent_before_seconds']) + _need(start['spent_before_seconds'] < start['phase_cap_seconds'], 'G12-N05: consumed budget') + for key in ('wall_seconds', 'runner_wall_seconds', 'runner_user_seconds', 'runner_system_seconds', + 'runner_lifetime_max_rss_kib', 'sampled_process_group_rss_bytes'): + _number(receipt[key]) + limit = min(180, start['phase_cap_seconds'] - start['spent_before_seconds']) + _need(receipt['wall_seconds'] <= limit and receipt['runner_wall_seconds'] <= limit and + receipt['runner_lifetime_max_rss_kib'] * 1024 <= 1073741824 and + receipt['sampled_process_group_rss_bytes'] <= 1073741824, + 'G12-N07: original guard resource caps') + for key in ('user_seconds', 'system_seconds', 'kernel_max_rss_kib'): + _number(usage[key]) + _need(type(usage['exit']) is int and usage['exit'] == 0 and _exact(usage, receipt['usage']), + 'G12-N07: complete original usage join') + for name, raw in (('stdout', stdout), ('stderr', stderr)): + _need(len(raw) <= _LOG_CAP and receipt[name + '_bytes'] == len(raw) and + type(receipt[name + '_bytes']) is int and receipt[name + '_final_bytes'] == len(raw) and + type(receipt[name + '_final_bytes']) is int and + receipt[name + '_sha256'] == hashlib.sha256(raw).hexdigest(), 'G12-N07: complete raw log join') + _need(stderr == b'' and type(receipt['python']) is str and type(receipt['platform']) is str, + 'G12-N07: original stderr/platform fields') + + +def _capture_graph(namespace): + """Capture the fixed own/JSON function graph before candidate exposure.""" + modules = (json, json.decoder, json.encoder, json.scanner, hashlib, os, stat, math) + tuple( + namespace[name] for name in ('subprocess', 'fcntl', 'signal', 'resource', 'time') if name in namespace) + namespaces = [namespace] + [module.__dict__ for module in modules] + namespaces.extend((json._default_decoder.__dict__, json._default_encoder.__dict__)) + records, members, seen = [], [], set() + for mapping in namespaces: + members.append((mapping, tuple(mapping.items()))) + for value in mapping.values(): + candidates = [value] + if type(value) is type: + candidates.extend(value.__dict__.values()) + if value.__module__ in (__name__, 'json.decoder', 'json.encoder', 'subprocess'): + members.append((value.__dict__, tuple(value.__dict__.items()))) + for function in candidates: + if type(function) is not FunctionType or id(function) in seen: + continue + seen.add(id(function)) + records.append((function, function.__code__, function.__globals__, function.__builtins__, + function.__defaults__, function.__kwdefaults__, function.__closure__, + tuple(function.__dict__.items()), + () if function.__kwdefaults__ is None else tuple(function.__kwdefaults__.items()), + () if function.__closure__ is None else tuple((c, c.cell_contents) for c in function.__closure__))) + data = tuple((name, _canonical(namespace[name])) for name in + ('_PAIR_SCHEMA', '_MANIFEST_SCHEMA', '_GUARD_SCHEMA', '_PUBLICATION_SCHEMA', + '_ENGINE_PINS', '_OTHER_SOURCE_PINS', '_ENV', '_EVIDENCE_NAMES') if name in namespace) + return tuple(records), tuple(members), data + + +def _current_graph(graph): + records, members, data = graph + for mapping, rows in members: + # The capture itself is assigned once after this snapshot. + expected = dict(rows) + for name, value in rows: + _need(mapping.get(name, _MISSING) is value, 'G12-N04: captured namespace member changed: ' + name) + extra = set(mapping) - set(expected) + _need(not extra or mapping is globals() and extra == {'_INITIAL_GRAPH'}, + 'G12-N04: captured namespace census changed') + for name, expected in data: + _need(_canonical(globals()[name]) == expected, 'G12-N04: source-owned schema constant changed') + for f, code, namespace, builtin, defaults, kw, cells, attrs, kws, contents in records: + _need(f.__code__ is code and f.__globals__ is namespace and f.__builtins__ is builtin and + f.__defaults__ is defaults and f.__kwdefaults__ is kw and f.__closure__ is cells and + len(f.__dict__) == len(attrs), 'G12-N04: captured function graph changed') + for name, value in attrs: + _need(f.__dict__.get(name, _MISSING) is value, 'G12-N04: function attributes changed') + if kw is not None: + _need(len(kw) == len(kws), 'G12-N04: keyword-default census changed') + for name, value in kws: + _need(kw.get(name, _MISSING) is value, 'G12-N04: keyword defaults changed') + for cell, value in contents: + _need(cell.cell_contents is value, 'G12-N04: captured closure changed') +# END FIXED G12 FILE AND PAIR LEAF + +_PAIR_SCHEMA = {'common_constants': {'authority_source_sha256': 'f279ab86fc17c6a517b035f19d56863919cbd8304de4e7d5332457c6159aec10', + 'extra_target': [0, 2, 1], + 'h': 25, + 'literal_original_type': 'bool', + 'original_driver_sha256': '0d976d2eb6b845f20d4a3396591a806f966688b88693cd6a5f8a0c9e48925e36', + 'original_scientific_pins': ['d623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1', + '0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b', + '88bba3caf5975f30fa7abceaea9454110cf3b069233e8241a2ca13d1dff171a7', + 'adc7f1241b42e322a6451854ab7e4b4c146bf78a'], + 'producer_role': 'independent-original-uncached', + 'schema': 'g12-independent-original-reference-envelope-v1', + 'scope': 'Actual original N22 literal and P07 common remainder observations only; ' + 'no original PROFILE_ANCHOR_PASS, FULL_PASS, native qualification or G12 ' + 'approval.', + 'selected_driver_sha256': 'a346025d5b6e2b26246521c6af6292643a4c2c3286b33ff3996dcf051cd6be26'}, + 'common_exact_fields': ['schema', + 'producer_role', + 'selected_driver_sha256', + 'original_driver_sha256', + 'authority_source_sha256', + 'original_scientific_pins', + 'h', + 'extra_target', + 'literal_original_type', + 'literal_original_value', + 'remaining_original_case_count', + 'common_payload_sha256', + 'common_payload_hex', + 'scope'], + 'complement_receipt_exact_fields': ['calls', 'canonical_stream_bytes', 'sha256', 'schema'], + 'diagnostic_constants': {'complement_suffix_limit': 'Only cumulative original start/end receipts; no ' + 'digest subtraction or suffix-stream claim.', + 'completion': 'Exact source-owned intentional marker followed by original ' + 'finally, exact observer restoration, both cold2 checks and ' + 'original source/output custody.', + 'producer_role': 'independent-original-uncached', + 'schema': 'g12-independent-original-reference-diagnostics-v1', + 'selected_driver_sha256': 'a346025d5b6e2b26246521c6af6292643a4c2c3286b33ff3996dcf051cd6be26'}, + 'diagnostic_exact_fields': ['schema', + 'producer_role', + 'selected_driver_sha256', + 'common_payload_sha256', + 'prefix_end', + 'suffix_start', + 'cli_end', + 'ordered_rank_suffix_hex', + 'complement_suffix_limit', + 'phases', + 'completion'], + 'diagnostic_snapshot_exact_fields': ['rank_event_count', + 'ordered_rank_events_hex', + 'complement_receipt', + 'native_binding', + 'cache_binding'], + 'phase_exact_names': ['input_custody', + 'engine_custody', + 'fresh_root_copy', + 'fresh_engine_copy', + 'cold_engine_import', + 'cold_complex_module_load', + 'cold_certify_import', + 'cold_prepare_import', + 'side_construction', + 'checks_initialization', + 'compile_roles', + 'verify_map', + 'verify_labels', + 'verify_role_frames', + 'original_upstream_verify_sources', + 'full_log_integer_bounds', + 'original_serializable', + 'complete_original_cli']} + +_MANIFEST_SCHEMA = {'accounting_exact_fields': ['clock', + 'parent_entry_ns', + 'preseal_end_ns', + 'parent_preseal_wall_ns', + 'parent_self_user_seconds', + 'parent_self_system_seconds', + 'parent_children_user_seconds', + 'parent_children_system_seconds', + 'parent_lifetime_max_rss_kib', + 'guard_usage', + 'guard_runner_wall_seconds', + 'categories', + 'complete_tail_accounting_required', + 'unmeasured_final_tail'], + 'cleanup_exact_fields': ['operating_premises', + 'owned_generations', + 'observed_groups', + 'remaining', + 'current_children', + 'known_streams_closed', + 'known_pidfds_closed', + 'io_unknown', + 'lease_identity', + 'science_directory_identity', + 'observations_record'], + 'custody_exact_fields': ['retained_directory', + 'retained_directory_identity', + 'retained_file_mode', + 'created_after_known_cleanup', + 'source_selection_required', + 'known_close_policy'], + 'exact_top_level_fields': ['schema', + 'invocation', + 'selected_sources', + 'workload', + 'launch', + 'terminal', + 'guard', + 'cleanup', + 'pair', + 'retained_evidence', + 'custody', + 'accounting', + 'scope'], + 'guard_exact_fields': ['start', + 'receipt', + 'start_fields', + 'receipt_fields', + 'stdout', + 'stderr', + 'usage'], + 'invocation_exact_fields': ['stage', + 'job', + 'label', + 'stage_sha256', + 'jobs_sha256', + 'launch_selection_sha256'], + 'launch_exact_fields': ['parent_pid', + 'parent_start_ticks', + 'guard_pid', + 'guard_start_ticks', + 'guard_pgid', + 'guard_sid', + 'parent_guard_argv', + 'guard_root_argv', + 'adapter_producer_argv', + 'cwd', + 'environment', + 'flags', + 'launch_record'], + 'pair_exact_fields': ['common', 'diagnostics', 'common_payload_sha256'], + 'retained_evidence_exact_keys': ['guard_START', + 'guard_receipt', + 'guard_stdout', + 'guard_stderr', + 'guard_usage', + 'parent_launch', + 'parent_outer_stdout', + 'parent_outer_stderr', + 'parent_owned_observations', + 'parent_preseal_accounting'], + 'schema_literal': 'g12-parent-two-export-custody-v2', + 'selected_sources_exact_fields': ['parent', + 'guard', + 'root', + 'provider', + 'adapter', + 'producer', + 'authority', + 'source_pins', + 'reference', + 'engine', + 'runtime_profile', + 'cleanup_leaf_origin'], + 'terminal_exact_fields': ['actual_popen_returncode', + 'wait_completed', + 'parent_stop', + 'primary_error', + 'secondary_errors', + 'guard_receipt_missing'], + 'workload_exact_fields': ['role', + 'h', + 'extra_target', + 'mode', + 'anchor', + 'optimize', + 'original_scientific_pins'], + 'workload_values': {'anchor': None, + 'extra_target': [0, 2, 1], + 'h': 25, + 'mode': 'profile', + 'optimize': 0, + 'original_scientific_pins': ['d623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1', + '0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b', + '88bba3caf5975f30fa7abceaea9454110cf3b069233e8241a2ca13d1dff171a7', + 'adc7f1241b42e322a6451854ab7e4b4c146bf78a'], + 'role': 'independent-original-uncached'}} + +_GUARD_SCHEMA = {'START_exact_fields': ['command', + 'parent_launch', + 'stage_sha256', + 'runner_sha256', + 'fractions_sha256', + 'budget_phase_sha256', + 'spent_before_seconds', + 'phase_cap_seconds', + 'job', + 'label'], + 'receipt_exact_fields': ['command', + 'parent_launch', + 'stage_sha256', + 'runner_sha256', + 'fractions_sha256', + 'budget_phase_sha256', + 'spent_before_seconds', + 'phase_cap_seconds', + 'job', + 'label', + 'exit', + 'wall_seconds', + 'usage', + 'termination', + 'sampled_process_group_rss_bytes', + 'source_bytes_and_modes_unchanged', + 'stdout_sha256', + 'stdout_bytes', + 'stderr_sha256', + 'stderr_bytes', + 'stdout_final_bytes', + 'stderr_final_bytes', + 'retained_log_bytes_stable', + 'output_cap_observed_at', + 'log_read_chunk_bytes', + 'runner_wall_seconds', + 'runner_user_seconds', + 'runner_system_seconds', + 'runner_lifetime_max_rss_kib', + 'python', + 'platform', + 'status'], + 'required_values': {'exit': 0, + 'log_read_chunk_bytes': 65536, + 'output_cap_observed_at': None, + 'retained_log_bytes_stable': True, + 'source_bytes_and_modes_unchanged': True, + 'status': 'PASS', + 'stderr_bytes': 0, + 'stderr_final_bytes': 0, + 'termination': None}} + +_PUBLICATION_SCHEMA = {'exact_fields': ['schema', + 'parent_source_sha256', + 'launch_selection_sha256', + 'manifest_path', + 'manifest_sha256', + 'manifest_bytes', + 'manifest_identity', + 'retained_pair_sha256', + 'final_pair_recheck_complete', + 'known_lease_close_completed', + 'primary_error', + 'secondary_errors', + 'measured_through_ns', + 'actual_costs_through_ns', + 'unmeasured_final_tail', + 'complete_cost_qualification'], + 'schema_literal': 'g12-parent-custody-publication-v2'} + +_COST_CATEGORIES = ('source/stage/plan/authentication and dependency preflight', 'parent invocation setup and known lease operations', 'adapter bootstrap source read/hash/compile/exec and argv/module alias custody/restoration', 'entire independent uncached reference including fresh copies/engine imports/original CLI/trace capture/original checks/finally/restoration/cold2', 'guard launch/time/monitoring/STOP/final original source inventory/usage/raw-log hashing/receipt', 'actual parent wait and known descendant/group/FD cleanup', 'canonical receipt and START joins plus all complete raw evidence retention', 'both exports full reads/hashes/JSON/schema/payload decode/crosslinks and repeated pair checks', 'new parent copies/write/fsync/chmod/close/directory sync/readback', 'manifest schema/write/hash/fsync/close/readback and source-selection publication tail', 'parent failure/secondary-error retention and necessary cleanup after deadline', 'cold consumer complete manifest/pair/publication read/hash/parse/decode/recheck and all retained alias lifetimes') + + +def _validate_manifest(manifest, parent_path, parent_sha): + spec = _MANIFEST_SCHEMA + _fields(manifest, spec['exact_top_level_fields']) + _need(manifest['schema'] == spec['schema_literal'], 'G12-N12: custody schema') + for name in ('invocation', 'selected_sources', 'workload', 'launch', 'terminal', 'guard', + 'cleanup', 'pair', 'custody', 'accounting'): + _fields(manifest[name], spec[name + '_exact_fields']) + _fields(manifest['retained_evidence'], spec['retained_evidence_exact_keys']) + _need(_exact(manifest['workload'], spec['workload_values']), 'G12-N13: fixed workload') + invocation = manifest['invocation'] + _need(invocation['stage'] == 'g12-reference-custody-v1' and invocation['job'] == 'g12-reference' and + type(invocation['label']) is str and bool(invocation['label']) and + all(c in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_' for c in invocation['label']), + 'G12-N13: fixed invocation role') + for name in ('stage_sha256', 'jobs_sha256', 'launch_selection_sha256'): + _need(_digest(invocation[name]), 'G12-N12: invocation digest') + sources = manifest['selected_sources'] + for name, pin in sources.items(): + if name != 'engine': + _source_pin(pin) + for name, expected in (('guard', _GUARD_PIN), ('root', _ROOT_PIN), ('provider', _PROVIDER_PIN), + ('producer', _PRODUCER_PIN), ('authority', _AUTHORITY_PIN)): + _need(sources[name]['sha256'] == expected and sources[name]['mode'] == '0444', + 'G12-N02: selected original source mismatch') + _need(sources['producer']['bytes'] == 70246 and sources['parent']['path'] == parent_path and + sources['parent']['sha256'] == parent_sha, 'G12-N02: selected producer/parent identity') + _need(_exact(sources['engine'], _ENGINE_PINS), 'G12-N02: exact original engine source pins') + for name, expected in _OTHER_SOURCE_PINS.items(): + _need(sources[name]['sha256'] == expected, 'G12-N02: selected original dependency mismatch') + terminal = {'actual_popen_returncode': 0, 'wait_completed': True, 'parent_stop': None, + 'primary_error': None, 'secondary_errors': [], 'guard_receipt_missing': False} + _need(_exact(manifest['terminal'], terminal), 'G12-N06: authenticated terminal data rejects') + cleanup = manifest['cleanup'] + _need(_exact(cleanup['remaining'], []) and _exact(cleanup['current_children'], []) and + cleanup['known_streams_closed'] is True and cleanup['known_pidfds_closed'] is True and + cleanup['io_unknown'] is False and type(cleanup['owned_generations']) is list and + bool(cleanup['owned_generations']) and _exact(cleanup['operating_premises'], _OPERATING_PREMISES), + 'G12-N08: known selected chain custody rejects') + for name in ('parent_pid', 'parent_start_ticks', 'guard_pid', 'guard_start_ticks', 'guard_pgid', 'guard_sid'): + _uint(manifest['launch'][name], True) + label = invocation['label'] + stage = _R + '/stages/g12-reference-custody-v1' + science = _R + '/runtime/runs/' + label + '/science' + parent_argv, root_argv, producer_argv = _fixed_argv(label, sources) + launch = manifest['launch'] + _need(_exact(launch['parent_guard_argv'], parent_argv) and _exact(launch['guard_root_argv'], root_argv) and + _exact(launch['adapter_producer_argv'], producer_argv) and launch['cwd'] == _R and + _exact(launch['environment'], _ENV) and _exact(launch['flags'], list(_FLAGS)), + 'G12-N03: exact fixed launch/adapter argv') + retained = _R + '/runtime/g12-reference-parent-custody-v1/' + label + custody = manifest['custody'] + _need(custody['retained_directory'] == retained and custody['retained_file_mode'] == '0444' and + custody['created_after_known_cleanup'] is True and custody['source_selection_required'] is True and + custody['known_close_policy'] == 'Any unknown close rejects publication', 'G12-N14: custody ownership') + _fields(custody['retained_directory_identity'], _ID_NAMES) + _need(custody['retained_directory_identity']['full_st_mode'] == stat.S_IFDIR | 0o500, + 'G12-N14: final retained directory mode') + for name in ('common', 'diagnostics'): + pair = manifest['pair'][name] + _fields(pair, ('original', 'retained')) + _file_record(pair['original']) + _file_record(pair['retained']) + filename = 'g12-reference.' + name + '.json' + _need(pair['original']['path'] == science + '/' + filename and + pair['retained']['path'] == retained + '/' + filename and + pair['original']['sha256'] == pair['retained']['sha256'] and + pair['original']['bytes'] == pair['retained']['bytes'] and + pair['retained']['identity']['full_st_mode'] == stat.S_IFREG | 0o444, + 'G12-N13: original/retained complete pair join') + _need(_digest(manifest['pair']['common_payload_sha256']), 'G12-N13: payload pin') + for name, record in manifest['retained_evidence'].items(): + _file_record(record) + _need(record['path'] == retained + '/' + _EVIDENCE_NAMES[name] and + record['identity']['full_st_mode'] == stat.S_IFREG | 0o444, + 'G12-N14: retained raw evidence path/mode') + for name, evidence_name in (('start', 'guard_START'), ('receipt', 'guard_receipt'), + ('stdout', 'guard_stdout'), ('stderr', 'guard_stderr'), ('usage', 'guard_usage')): + _need(_exact(manifest['guard'][name], manifest['retained_evidence'][evidence_name]), + 'G12-N07: guard retained record join') + _need(_exact(launch['launch_record'], manifest['retained_evidence']['parent_launch']) and + _exact(cleanup['observations_record'], manifest['retained_evidence']['parent_owned_observations']), + 'G12-N08: parent observation record join') + account = manifest['accounting'] + _need(account['clock'] == 'monotonic_ns' and account['complete_tail_accounting_required'] is True and + _exact(account['categories'], list(_COST_CATEGORIES)), 'G12-N15: full cost categories/tail') + for name in ('parent_entry_ns', 'preseal_end_ns', 'parent_preseal_wall_ns'): + _uint(account[name]) + _need(account['preseal_end_ns'] >= account['parent_entry_ns'] and + account['parent_preseal_wall_ns'] == account['preseal_end_ns'] - account['parent_entry_ns'], + 'G12-N15: actual parent clock endpoints') + for name in ('parent_self_user_seconds', 'parent_self_system_seconds', 'parent_children_user_seconds', + 'parent_children_system_seconds', 'parent_lifetime_max_rss_kib', 'guard_runner_wall_seconds'): + _number(account[name]) + _need(account['unmeasured_final_tail'] is None, 'G12-N15: unmeasured tail must stay explicitly unknown') + _need(_exact(account['guard_usage'], manifest['guard']['receipt_fields']['usage']) and + _exact(account['guard_runner_wall_seconds'], manifest['guard']['receipt_fields']['runner_wall_seconds']), + 'G12-N15: actual guard cost join') + _need(manifest['scope'] == _SCOPE, 'G12-N18: custody scope cannot become scientific approval') + + +def _fixed_argv(label, sources): + stage = _R + '/stages/g12-reference-custody-v1' + science = _R + '/runtime/runs/' + label + '/science' + parent = ['/usr/bin/python3.12', *_FLAGS, _R + '/run_guarded_v3.py', + 'g12-reference-custody-v1', 'g12-reference', label] + root = ['/usr/bin/python3.12', *_FLAGS, stage + '/integration/full_driver.py', + '--root-sha256', _ROOT_PIN, '--provider', stage + '/integration/probe_binding_v3.py', + _PROVIDER_PIN, '--driver', stage + '/integration/g12_reference_adapter_v1.py', + sources['adapter']['sha256'], '--integration', stage + '/integration', '--', + '--output', science, '--lanes', 'g12-reference'] + producer = [stage + '/baseline/full_driver.py', '--frozen-root', stage + '/baseline/frozen', + '--reference', stage + '/baseline/reference/certificates/complex-network.json', + '--mode', 'profile', '--output', science] + return parent, root, producer + + +def _validate_publication(publication, manifest, manifest_record): + _fields(publication, _PUBLICATION_SCHEMA['exact_fields']) + _need(publication['schema'] == _PUBLICATION_SCHEMA['schema_literal'] and + publication['parent_source_sha256'] == manifest['selected_sources']['parent']['sha256'] and + publication['launch_selection_sha256'] == manifest['invocation']['launch_selection_sha256'] and + publication['manifest_path'] == manifest_record['path'] and + publication['manifest_sha256'] == manifest_record['sha256'] and + publication['manifest_bytes'] == manifest_record['bytes'] and + _exact(publication['manifest_identity'], manifest_record['identity']) and + _exact(publication['retained_pair_sha256'], {name: manifest['pair'][name]['retained']['sha256'] + for name in ('common', 'diagnostics')}) and + publication['final_pair_recheck_complete'] is True and publication['known_lease_close_completed'] is True and + publication['primary_error'] is None and _exact(publication['secondary_errors'], []) and + publication['complete_cost_qualification'] is False and + _exact(publication['unmeasured_final_tail'], manifest['accounting']['unmeasured_final_tail']), + 'G12-N15: exact publication/manifest/final-tail join') + _uint(publication['measured_through_ns']) + _need(publication['measured_through_ns'] >= manifest['accounting']['preseal_end_ns'], + 'G12-N15: publication clock precedes preseal') + costs = publication['actual_costs_through_ns'] + _fields(costs, ('entry_ns', 'through_ns', 'wall_ns', 'self_user_seconds', 'self_system_seconds', + 'children_user_seconds', 'children_system_seconds', 'lifetime_max_rss_kib')) + for name in ('entry_ns', 'through_ns', 'wall_ns'): + _uint(costs[name]) + _need(costs['entry_ns'] == manifest['accounting']['parent_entry_ns'] and + costs['through_ns'] == publication['measured_through_ns'] and + costs['wall_ns'] == costs['through_ns'] - costs['entry_ns'], 'G12-N15: publication actual clock join') + for name in ('self_user_seconds', 'self_system_seconds', 'children_user_seconds', + 'children_system_seconds', 'lifetime_max_rss_kib'): + _number(costs[name]) + + +def _source_code_shape(code): + _need(type(code) is CodeType, 'G12-N04: exact code type') + def constant(value): + kind = type(value) + if value is None or value is Ellipsis: + return ('singleton', value is Ellipsis) + if kind in (int, bool, str, bytes): + return (kind.__name__, value) + if kind is float: + return ('float', value.hex()) + if kind is tuple: + return ('tuple', tuple(constant(item) for item in value)) + if kind is frozenset: + return ('frozenset', tuple(sorted(constant(item) for item in value))) + if kind is CodeType: + return ('code', _source_code_shape(value)) + raise RuntimeError('G12-N04: unsupported source code constant') + return tuple(constant(value) for value in ( + code.co_argcount, code.co_posonlyargcount, code.co_kwonlyargcount, + code.co_nlocals, code.co_stacksize, code.co_flags, code.co_code, + code.co_names, code.co_varnames, code.co_freevars, code.co_cellvars, + code.co_exceptiontable, code.co_linetable, code.co_firstlineno, + code.co_filename, code.co_name, code.co_qualname, code.co_consts)) + + +def _authenticate_own_functions(root, api, source, path): + _need(api[0]() == _ROOT_PIN, 'G12-N04: Root before selected-source compilation') + code = root._COMPILE(source, path, 'exec', dont_inherit=True, optimize=0) + declared = {item.co_name: item for item in code.co_consts if type(item) is CodeType} + for name, function in tuple(globals().items()): + if type(function) is FunctionType and function.__globals__ is globals(): + _need(name in declared and function.__builtins__ is root.builtins.__dict__ and + _source_code_shape(function.__code__) == _source_code_shape(declared[name]), + 'G12-N04: actual entire own callable differs from selected source: ' + name) + _need(api[0]() == _ROOT_PIN, 'G12-N04: Root after selected-source compilation') + + +def load_original_g12_reference(root, capability, api): + """Return only original literal/count/opaque common/provenance, after joint custody.""" + config = G12_REFERENCE_HANDOFF + selected = _BOOTSTRAP[3] + _need(type(config) is tuple and len(config) == 9 and type(selected) is tuple and len(selected) == 3, + 'G12-N01: actual parent handoff and cold source remain unselected') + _need(root is _BOOTSTRAP[0] and capability is _BOOTSTRAP[1] and api is _BOOTSTRAP[2] and + type(root) is ModuleType and type(api) is tuple and len(api) == 4 and + all(type(f) is FunctionType and f.__globals__ is root.__dict__ for f in api), + 'G12-N04: initial actual cold Root/capability/API identities differ') + _need(api[0]() == _ROOT_PIN and sys.flags.optimize == 0, 'G12-N04: authentic Root/assertions') + api[1](capability, _PROVIDER_PIN) + _current_graph(_INITIAL_GRAPH) + source_path, source_sha, source_size = selected + source_record, source_raw = _read_file(source_path, 1048576, 0o444) + _need(source_path == __file__ and source_record['sha256'] == source_sha and + source_record['bytes'] == source_size, 'G12-N04: exact independently selected consumer source') + _authenticate_own_functions(root, api, source_raw, source_path) + path, sha, size, identity, parent_path, parent_sha, publication_path, publication_sha, publication_size = config + _need(_digest(sha) and _digest(parent_sha) and _digest(publication_sha), 'G12-N16: source selection digest domain') + manifest_record = {'path': path, 'sha256': sha, 'bytes': size, 'identity': identity, 'nlink': 1} + manifest_raw = _root_read(root, api, manifest_record, _META_CAP) + manifest = _json(manifest_raw, _META_CAP, True, True) + _validate_manifest(manifest, parent_path, parent_sha) + retained = manifest['custody']['retained_directory'] + _need(path == retained + '/manifest.json' and publication_path == retained + '/publication.json', + 'G12-N16: exact fixed publication/manifest paths') + dirs, rows = _directory_chain(retained) + primary, secondaries, result = None, _RawG12Errors(), None + try: + _need(_exact(_identity(os.fstat(dirs[-1])), manifest['custody']['retained_directory_identity']), + 'G12-N17: final retained directory identity') + publication_record, _ = _read_file(publication_path, _META_CAP, 0o444) + _need(publication_record['sha256'] == publication_sha and publication_record['bytes'] == publication_size, + 'G12-N15: source-selected final publication bytes') + publication_raw = _root_read(root, api, publication_record, _META_CAP) + publication = _json(publication_raw, _META_CAP, True, True) + _validate_publication(publication, manifest, manifest_record) + evidence = {} + for name, record in manifest['retained_evidence'].items(): + cap = _LOG_CAP if name in ('guard_stdout', 'guard_stderr', 'parent_outer_stdout', 'parent_outer_stderr') else _META_CAP + evidence[name] = _root_read(root, api, record, cap) + launch_data = _json(evidence['parent_launch'], _META_CAP, True, True) + _fields(launch_data, ('schema', 'selection_sha256', 'source_selection', 'launch')) + _need(launch_data['schema'] == 'g12-parent-actual-launch-v1' and + launch_data['selection_sha256'] == manifest['invocation']['launch_selection_sha256'] == + hashlib.sha256(_canonical(launch_data['source_selection'])).hexdigest() and + _exact(launch_data['source_selection']['source_pins'], manifest['selected_sources']) and + _exact(launch_data['launch'], {k: v for k, v in manifest['launch'].items() if k != 'launch_record'}), + 'G12-N07: actual source-selected launch/raw evidence binding') + start = _json(evidence['guard_START'], _META_CAP) + receipt = _json(evidence['guard_receipt'], _META_CAP) + usage = _json(evidence['guard_usage'], 16384) + _need(_exact(start, manifest['guard']['start_fields']) and + _exact(receipt, manifest['guard']['receipt_fields']), 'G12-N07: original raw evidence joins') + _validate_guard(start, receipt, usage, evidence['guard_stdout'], evidence['guard_stderr'], + manifest['launch']['guard_root_argv'], manifest['invocation'], manifest['selected_sources'], + launch_data['source_selection']['phase_pin']['sha256']) + _need(_exact(_json(evidence['parent_outer_stdout'], _LOG_CAP), receipt) and + evidence['parent_outer_stderr'] == b'', 'G12-N07: actual outer raw log join') + common_record = manifest['pair']['common']['retained'] + diagnostic_record = manifest['pair']['diagnostics']['retained'] + common_raw = _root_read(root, api, common_record, _PAIR_CAP) + diagnostic_raw = _root_read(root, api, diagnostic_record, _PAIR_CAP) + common, diagnostics, payload = _validate_pair(common_raw, diagnostic_raw) + _need(common['common_payload_sha256'] == manifest['pair']['common_payload_sha256'], 'G12-N13: pair/manifest payload') + # Joint final reread includes diagnostics even after common decoding. + for record, raw, cap in ((manifest_record, manifest_raw, _META_CAP), + (common_record, common_raw, _PAIR_CAP), + (diagnostic_record, diagnostic_raw, _PAIR_CAP), + (publication_record, publication_raw, _META_CAP)): + _need(_root_read(root, api, record, cap) == raw, 'G12-N17: final full custody set changed') + for name, record in manifest['retained_evidence'].items(): + cap = _LOG_CAP if name in ('guard_stdout', 'guard_stderr', 'parent_outer_stdout', 'parent_outer_stderr') else _META_CAP + _need(_root_read(root, api, record, cap) == evidence[name], 'G12-N17: raw retained evidence drift') + _check_chain(rows) + _need(_exact(_identity(os.fstat(dirs[-1])), manifest['custody']['retained_directory_identity']), + 'G12-N17: final namespace changed after decode') + _need(_read_file(source_path, 1048576, 0o444) == (source_record, source_raw), 'G12-N04: consumer source drift') + _current_graph(_INITIAL_GRAPH) + api[1](capability, _PROVIDER_PIN) + _need(api[0]() == _ROOT_PIN, 'G12-N17: final actual Root currentness') + # Full diagnostic raw bytes stay retained; their hash is part of immutable + # provenance, and no diagnostic counter becomes an equality oracle. + provenance = (path, sha, size, tuple(identity[k] for k in _ID_NAMES), parent_path, parent_sha, + publication_path, publication_sha, publication_size, common_record['sha256'], + diagnostic_record['sha256'], common['common_payload_sha256'], + tuple(common['original_scientific_pins']), _PRODUCER_PIN, _AUTHORITY_PIN) + result = common['literal_original_value'], common['remaining_original_case_count'], payload, provenance + except BaseException as error: + primary = error, error.__traceback__ + for descriptor in reversed(dirs): + try: + os.close(descriptor) + except BaseException as error: + secondaries.append((error, error.__traceback__)) + _raise_preserved(primary, secondaries) + return result + +_R = '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028' + +_ENGINE_PINS = {'compare_side_verifier.py': '6e507bb0c7e00d090a60289fddb6c55e90c946d0850c42c3c5e3e15c27604a68', + 'finite_controls.py': 'df989a831aac43cc1af95169dad8c64a7548760e6e1f96976da996703f2c8f7a', + 'native_backend.py': 'e473c38245c3668715b5a78dfe980b2fe3ed0d0c9b8c97c666fbae6ecf1fffd5', + 'native_gf2.c': 'e9c3c9194a08718bd1575c1cf08c6c6772d3b644c2e274c25a84a1f9249d06cc', + 'profile_side_verifier.py': '9c994378171c20a91539418d93cb8387e1daa93465d6862beefea90e12999c2a', + 'source/complex_circuit.py': 'd623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1', + 'source/complex_network.py': '0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b'} + +_OTHER_SOURCE_PINS = {'cleanup_leaf_origin': '7b3304eaf4884e3029df5095e2b0950c18d1544ad21431a07c033b85e53bd4f7', + 'reference': '1f763d95c7ff163aa71d13cd82784f16665be8afb21f75e76941e2119562098f', + 'runtime_profile': 'ad0ec2aea01b83f97bdeafd9e9208360127fee870d024d353879b5ed99237109', + 'source_pins': '88bba3caf5975f30fa7abceaea9454110cf3b069233e8241a2ca13d1dff171a7'} + +_OPERATING_PREMISES = ('Selected fixed scientific sources, adapter and ordinary profile branch do not fork/spawn threads, ' + 'daemonize, pass writable descriptors to outsiders, or enlist external writers. Trusted ' + 'OS/loader/interpreter/stdlib and cooperating same-user parent launch domain exclude unrelated writer ' + 'interference. This is an explicit finite source/operating premise, not established merely by a clean /proc ' + 'snapshot.') + +_SCOPE = ('Fixed source-data custody only. No G12/P02/full-positive/native/performance/scientific admission; no ' + 'universal writers theorem.') + +_FLAGS = ('-S', '-s', '-P', '-B') + +_ENV = {'LANG': 'C.UTF-8', + 'LC_ALL': 'C.UTF-8', + 'PATH': '/usr/bin:/bin', + 'PYTHONDONTWRITEBYTECODE': '1', + 'PYTHONHASHSEED': '0', + 'TZ': 'UTC'} + +_EVIDENCE_NAMES = {'guard_START': 'guard-START.json', + 'guard_receipt': 'guard-receipt.json', + 'guard_stderr': 'guard-stderr.txt', + 'guard_stdout': 'guard-stdout.txt', + 'guard_usage': 'guard-usage.json', + 'parent_launch': 'parent-LAUNCH.json', + 'parent_outer_stderr': 'parent-outer-stderr.txt', + 'parent_outer_stdout': 'parent-outer-stdout.txt', + 'parent_owned_observations': 'parent-owned-observations.json', + 'parent_preseal_accounting': 'parent-preseal-accounting.json'} + +_INITIAL_GRAPH = _capture_graph(globals()) diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/g12_reference_parent_v1.py.txt b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/g12_reference_parent_v1.py.txt new file mode 100644 index 0000000000..80482f9a9a --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/g12_reference_parent_v1.py.txt @@ -0,0 +1,1722 @@ +"""Fixed G12 parent custody source. No execution or publication authority. + +Only a later independently reviewed literal may select the launch. All actual +authorization, phase, resource-fit, custody and final-cost gates remain closed. +Unknown final tails remain unknown in the complete original symbolic invoice. +No manifest, receipt dictionary or success flag is accepted from a caller. +""" +import time +import resource +import signal +import subprocess +import fcntl +G12_REFERENCE_LAUNCH_SELECTION = None +_INITIAL_PARENT_SOURCE_PIN = globals().get('bootstrap_g12_parent_source_pin') +# Actual initial parent source identity comes only from the trusted external +# selected launcher; its future literal parent slot is None (no own-hash cycle). +import os + + +import sys + + +import stat + + +import json + + +import hashlib + + +import math + + +from types import FunctionType, CodeType, ModuleType + + +_ROOT_PIN = 'f5a2d33f2b4d3651f214156a0e7094c2bb516ce2d5ab7698d18c11f98f35dee0' + + +_PROVIDER_PIN = '9cbb7368f89e71d1e6cc46db5dc77efed3e03ed2a801c98c88fe316e4d9f3ef2' + + +_PRODUCER_PIN = 'a346025d5b6e2b26246521c6af6292643a4c2c3286b33ff3996dcf051cd6be26' + + +_GUARD_PIN = 'bd882e3dadb1b6aeaa63ee824f1a1c58f8ef2546b6840a2bffa46885a184d3eb' + + +_AUTHORITY_PIN = 'f279ab86fc17c6a517b035f19d56863919cbd8304de4e7d5332457c6159aec10' + + +_META_CAP = 262144 + + +_PAIR_CAP = 268435456 + + +_CHUNK = 65536 + + +_LOG_CAP = 2097152 + + +_MISSING = object() + + +_ID_NAMES = ('dev', 'ino', 'full_st_mode', 'size', 'mtime_ns', 'ctime_ns') + + +class _RawG12Errors: + """Fixed error-retention slots; storing raw failures precedes formatting/IO.""" + __slots__ = ('slots', 'count') + def __init__(self): + self.slots = [None] * 4096 + self.count = 0 + def append(self, value): + # All fixed directory/process/stream paths together have fewer than 4096 + # close sites under the 256-component/128-generation source ceilings. + if self.count >= len(self.slots): + raise RuntimeError('G12-N09: fixed raw secondary retention exhausted') + self.slots[self.count] = value + self.count += 1 + def __bool__(self): + return self.count != 0 + def __len__(self): + return self.count + def __getitem__(self, index): + if type(index) is not int or not 0 <= index < self.count: + raise IndexError(index) + return self.slots[index] + def __iter__(self): + for index in range(self.count): + yield self.slots[index] + def __repr__(self): + return repr(tuple(self)) + + +def _need(condition, message): + if not condition: + raise RuntimeError(message) + + +def _exact(value, expected): + if type(value) is not type(expected): + return False + if type(value) in (list, tuple): + return len(value) == len(expected) and all(_exact(a, b) for a, b in zip(value, expected)) + if type(value) is dict: + return set(value) == set(expected) and all(_exact(value[k], expected[k]) for k in expected) + return value == expected + + +def _fields(value, fields): + _need(type(value) is dict and all(type(k) is str for k in value) and + set(value) == set(fields), 'G12-N12: exact field domain differs') + + +def _digest(value): + return type(value) is str and len(value) == 64 and all(c in '0123456789abcdef' for c in value) + + +def _uint(value, positive=False): + _need(type(value) is int and value >= (1 if positive else 0), 'G12-N12: exact integer domain') + + +def _number(value): + _need(type(value) in (int, float) and math.isfinite(value) and value >= 0, + 'G12-N12: finite nonnegative exact number required') + + +def _path(path): + _need(type(path) is str and path.startswith('/') and + all(p not in ('', '.', '..') for p in path.split('/')[1:]), 'G12-N11: absolute canonical path') + return path + + +def _identity(info): + return dict(zip(_ID_NAMES, (info.st_dev, info.st_ino, info.st_mode, info.st_size, + info.st_mtime_ns, info.st_ctime_ns))) + + +def _directory_key(info): + return info.st_dev, info.st_ino, info.st_mode + + +def _directory_chain(path): + """Held no-follow chain; no later absolute path silently changes its owner.""" + _path(path) + _need(len(path.split('/')) <= 257, 'G12-N11: finite directory-component bound') + fds, rows = [], [] + primary = None + try: + fd = os.open('/', os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC) + fds.append(fd) + for part in path.split('/')[1:]: + before = os.stat(part, dir_fd=fd, follow_symlinks=False) + _need(stat.S_ISDIR(before.st_mode), 'G12-N11: directory component type') + child = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW | os.O_CLOEXEC, + dir_fd=fd) + fds.append(child) + opened = os.fstat(child) + _need(_directory_key(before) == _directory_key(opened), 'G12-N11: directory replaced') + rows.append((fd, part, child, _directory_key(opened))) + fd = child + return fds, rows + except BaseException as error: + primary = (error, error.__traceback__) + secondary = _RawG12Errors() + for descriptor in reversed(fds): + try: + os.close(descriptor) + except BaseException as error: + secondary.append((error, error.__traceback__)) + _raise_preserved(primary, secondary) + + +def _check_chain(rows): + for parent, name, descriptor, key in rows: + _need(_directory_key(os.fstat(descriptor)) == key == + _directory_key(os.stat(name, dir_fd=parent, follow_symlinks=False)), + 'G12-N11: directory binding changed') + + +def _raise_preserved(primary, secondaries): + """Never replace first raw failure if evidence formatting or retention fails.""" + if primary is not None: + error, traceback = primary + try: + error.add_note('G12 ordered secondary failures: ' + repr(secondaries)) + except BaseException: + pass + raise error.with_traceback(traceback) + if secondaries: + error, traceback = secondaries[0][:2] + raise error.with_traceback(traceback) + + +def _read_file(path, cap, mode=None): + _path(path) + parent, name = path.rsplit('/', 1) + fds, rows = _directory_chain(parent) + descriptor, primary, secondary, result = None, None, _RawG12Errors(), None + try: + before = os.stat(name, dir_fd=fds[-1], follow_symlinks=False) + _need(stat.S_ISREG(before.st_mode) and before.st_nlink == 1 and + 0 <= before.st_size <= cap and (mode is None or before.st_mode == stat.S_IFREG | mode), + 'G12-N11: regular-file size/mode/link domain') + descriptor = os.open(name, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK | os.O_CLOEXEC, + dir_fd=fds[-1]) + opened = os.fstat(descriptor) + _need(_identity(before) == _identity(opened) and opened.st_nlink == 1, + 'G12-N11: file changed on open') + count, blocks, hasher = 0, [], hashlib.sha256() + while count < opened.st_size: + block = os.read(descriptor, min(_CHUNK, opened.st_size - count)) + _need(bool(block), 'G12-N11: short file read') + count += len(block) + hasher.update(block) + blocks.append(block) + _need(os.read(descriptor, 1) == b'', 'G12-N11: file grew') + after = os.fstat(descriptor) + ending = os.stat(name, dir_fd=fds[-1], follow_symlinks=False) + _need(_identity(before) == _identity(after) == _identity(ending) and + after.st_nlink == ending.st_nlink == 1, 'G12-N11: full file identity changed') + _check_chain(rows) + result = ({'path': path, 'sha256': hasher.hexdigest(), 'bytes': count, + 'identity': _identity(after), 'nlink': 1}, b''.join(blocks)) + except BaseException as error: + primary = (error, error.__traceback__) + for fd in ([descriptor] if descriptor is not None else []) + list(reversed(fds)): + try: + os.close(fd) + except BaseException as error: + secondary.append((error, error.__traceback__)) + _raise_preserved(primary, secondary) + return result + + +def _file_record(value): + _fields(value, ('path', 'sha256', 'bytes', 'identity', 'nlink')) + _path(value['path']) + _need(_digest(value['sha256']) and type(value['nlink']) is int and value['nlink'] == 1, + 'G12-N11: file digest/link record') + _uint(value['bytes']) + _fields(value['identity'], _ID_NAMES) + for key in _ID_NAMES: + _need(type(value['identity'][key]) is int, 'G12-N11: exact stat value') + _uint(value['identity']['dev']) + _uint(value['identity']['ino'], True) + _need(stat.S_ISREG(value['identity']['full_st_mode']) and + value['identity']['size'] == value['bytes'], 'G12-N11: file identity size/type') + + +def _pairs(items): + result = {} + for key, value in items: + _need(type(key) is str and key not in result, 'G12-N12: duplicate JSON key') + result[key] = value + return result + + +def _nonfinite(value): + raise ValueError('G12-N12: nonfinite JSON token: ' + value) + + +def _canonical(value): + return json.dumps(value, sort_keys=True, separators=(',', ':'), ensure_ascii=True, + allow_nan=False).encode('ascii') + + +def _json(raw, cap, canonical=False, newline=False): + _need(type(raw) is bytes and len(raw) <= cap, 'G12-N12: raw JSON bound') + # Scan lexical nesting before json.loads recursion or object materialization. + depth, quoted, escaped = 0, False, False + for char in raw: + if quoted: + if escaped: + escaped = False + elif char == 92: + escaped = True + elif char == 34: + quoted = False + elif char == 34: + quoted = True + elif char in (91, 123): + depth += 1 + _need(depth <= 256, 'G12-N12: JSON depth limit') + elif char in (93, 125): + depth -= 1 + _need(depth >= 0, 'G12-N12: JSON nesting') + _need(depth == 0 and not quoted, 'G12-N12: incomplete JSON') + value = json.loads(raw.decode('utf-8'), object_pairs_hook=_pairs, parse_constant=_nonfinite) + pending, count = [(value, 0)], 0 + while pending: + item, depth = pending.pop() + count += 1 + _need(count <= cap and depth <= 256, 'G12-N12: JSON node/depth limit') + if type(item) is dict: + pending.extend((x, depth + 1) for pair in item.items() for x in pair) + elif type(item) is list: + pending.extend((x, depth + 1) for x in item) + elif type(item) is str: + _need(len(item) <= cap, 'G12-N12: JSON string limit') + elif type(item) is float: + _need(math.isfinite(item), 'G12-N12: overflowed JSON number') + else: + _need(item is None or type(item) in (bool, int), 'G12-N12: JSON primitive') + if canonical: + _need(raw == _canonical(value) + (b'\n' if newline else b''), 'G12-N12: canonical JSON bytes') + return value + + +def _hex(value, cap): + _need(type(value) is str and len(value) <= cap and len(value) % 2 == 0 and + all(c in '0123456789abcdef' for c in value), 'G12-N12: complete lowercase hex') + return bytes.fromhex(value) + + +def _decimal(value, positive=False): + _need(type(value) is str and bool(value), 'G12-N12: integer tag text') + digits = value[1:] if value.startswith('-') else value + _need(bool(digits) and all(c in '0123456789' for c in digits) and + (digits == '0' or digits[0] != '0') and value != '-0' and + (not positive or (not value.startswith('-') and value != '0')), 'G12-N12: canonical integer') + + +def _tagged(raw, cap): + value = _json(raw, cap, True) + pending = [(value, 0)] + count = 0 + while pending: + node, depth = pending.pop() + count += 1 + _need(count <= cap and depth <= 256 and type(node) is list and len(node) >= 1 and + type(node[0]) is str, 'G12-N12: tagged primitive bound/shape') + tag = node[0] + if tag == 'None': + _need(len(node) == 1, 'G12-N12: None arity') + continue + _need(len(node) == (3 if tag == 'Fraction' else 2), 'G12-N12: primitive arity') + arg = node[1] + if tag == 'bool': + _need(type(arg) is bool, 'G12-N12: bool tag') + elif tag == 'int': + _decimal(arg) + elif tag == 'Fraction': + _decimal(arg) + _decimal(node[2], True) + elif tag == 'str': + _need(type(arg) is str, 'G12-N12: string tag') + elif tag == 'bytes': + _hex(arg, cap) + elif tag == 'float': + _need(type(arg) is str and float.fromhex(arg).hex() == arg, 'G12-N12: float.hex domain') + elif tag in ('tuple', 'list'): + _need(type(arg) is list, 'G12-N12: sequence tag') + pending.extend((item, depth + 1) for item in arg) + elif tag == 'dict': + _need(type(arg) is list, 'G12-N12: ordered dict tag') + for pair in arg: + _need(type(pair) is list and len(pair) == 2, 'G12-N12: dict pair') + pending.extend((item, depth + 1) for item in pair) + else: + raise ValueError('G12-N12: unknown primitive tag') + return value + + +def _rank_events(encoded): + value = _tagged(_hex(encoded, _PAIR_CAP), _PAIR_CAP) + _need(value[0] == 'tuple', 'G12-N12: rank tuple') + for event in value[1]: + _need(event[0] == 'tuple' and len(event[1]) == 2 and event[1][0][0] == 'tuple' and + all(x[0] == 'int' for x in event[1][0][1]) and event[1][1][0] == 'int', + 'G12-N12: rank-event grammar') + return len(value[1]) + + +def _validate_pair(common_raw, diagnostic_raw): + common = _json(common_raw, _PAIR_CAP, True, True) + diagnostic = _json(diagnostic_raw, _PAIR_CAP, True, True) + spec = _PAIR_SCHEMA + _fields(common, spec['common_exact_fields']) + _fields(diagnostic, spec['diagnostic_exact_fields']) + for key, expected in spec['common_constants'].items(): + _need(_exact(common[key], expected), 'G12-N13: original common source/workload binding') + for key, expected in spec['diagnostic_constants'].items(): + _need(_exact(diagnostic[key], expected), 'G12-N13: diagnostic source/role binding') + _need(type(common['literal_original_value']) is bool, 'G12-N12: observed literal exact bool') + _uint(common['remaining_original_case_count'], True) + payload = _hex(common['common_payload_hex'], _PAIR_CAP) + _need(_digest(common['common_payload_sha256']) and + hashlib.sha256(payload).hexdigest() == common['common_payload_sha256'] == + diagnostic['common_payload_sha256'], 'G12-N13: complete common digest join') + tagged = _tagged(payload, _PAIR_CAP) + _need(tagged[0] == 'tuple' and len(tagged[1]) == 10, 'G12-N13: common tuple arity') + prefix = [['str', 'g12-original-remainder-common-v1'], + ['tuple', [['str', p] for p in spec['common_constants']['original_scientific_pins']]], + ['int', '25'], ['tuple', [['int', '0'], ['int', '2'], ['int', '1']]]] + _need(_exact(tagged[1][:4], prefix), 'G12-N13: common inner source/workload prefix') + suffix = ['tuple', [['str', name] for name in ('verify_role_frames', 'full_log_integer_bounds', + 'original_upstream_verify_sources', 'original_serializable', 'complete_original_cli')]] + _need(_exact(tagged[1][-1], suffix), 'G12-N13: original suffix phase order') + for key in ('prefix_end', 'suffix_start', 'cli_end'): + row = diagnostic[key] + _fields(row, spec['diagnostic_snapshot_exact_fields']) + _uint(row['rank_event_count']) + _need(_rank_events(row['ordered_rank_events_hex']) == row['rank_event_count'] and + row['native_binding'] is None and row['cache_binding'] is None, + 'G12-N12: original diagnostic rank/binding domain') + receipt = row['complement_receipt'] + _fields(receipt, spec['complement_receipt_exact_fields']) + _uint(receipt['calls']) + _uint(receipt['canonical_stream_bytes']) + _need(_digest(receipt['sha256']) and receipt['schema'] == + 'v2-jsonl:call,us,vs,result(type=list+values or type=None); ordered exact integer vectors', 'G12-N12: complement receipt') + _rank_events(diagnostic['ordered_rank_suffix_hex']) + _fields(diagnostic['phases'], spec['phase_exact_names']) + for row in diagnostic['phases'].values(): + _fields(row, ('calls', 'wall_seconds', 'cpu_seconds_with_children')) + _need(type(row['calls']) is int and row['calls'] == 1, 'G12-N12: phase calls') + _number(row['wall_seconds']) + _number(row['cpu_seconds_with_children']) + return common, diagnostic, payload + + +def _source_pin(value): + _fields(value, ('path', 'sha256', 'bytes', 'mode')) + _path(value['path']) + _uint(value['bytes']) + _need(_digest(value['sha256']) and type(value['mode']) is str and len(value['mode']) == 4 and + all(c in '01234567' for c in value['mode']), 'G12-N02: exact source pin') + + +def _validate_guard(start, receipt, usage, stdout, stderr, root_argv, invocation, source_pins, phase_sha): + _fields(start, _GUARD_SCHEMA['START_exact_fields']) + _fields(receipt, _GUARD_SCHEMA['receipt_exact_fields']) + _fields(usage, ('user_seconds', 'system_seconds', 'kernel_max_rss_kib', 'exit')) + for key in start: + _need(_exact(start[key], receipt[key]), 'G12-N07: original START/receipt field join') + for key, expected in _GUARD_SCHEMA['required_values'].items(): + _need(_exact(receipt[key], expected), 'G12-N07: original guard success predicate') + for key in ('job', 'label', 'stage_sha256'): + _need(_exact(start[key], invocation[key]), 'G12-N07: selected invocation mismatch') + expected_launch = {'contract': 'trusted-clean-nosite-safe-path-fixedseed-v1', + 'no_site': 1, 'no_user_site': 1, 'safe_path': True, 'ignore_environment': 0, + 'isolated': 0, 'hash_seed_environment': '0', 'hash_randomization': 0, + 'initial_sys_path': ['/usr/lib/python312.zip', '/usr/lib/python3.12', '/usr/lib/python3.12/lib-dynload'], + 'environment': dict(_ENV), + 'trust_boundary': 'Authenticated parent launcher, OS, interpreter and system stdlib before this module; no Python self-authentication claim'} + _need(_exact(start['parent_launch'], expected_launch), 'G12-N07: exact original clean parent launch') + _need(_exact(start['command'], root_argv) and start['runner_sha256'] == _GUARD_PIN and + start['budget_phase_sha256'] == phase_sha and _digest(start['fractions_sha256']), + 'G12-N07: selected command/source/phase binding') + _need(type(start['phase_cap_seconds']) is int and start['phase_cap_seconds'] in (600, 2400), + 'G12-N05: original aggregate cap') + _number(start['spent_before_seconds']) + _need(start['spent_before_seconds'] < start['phase_cap_seconds'], 'G12-N05: consumed budget') + for key in ('wall_seconds', 'runner_wall_seconds', 'runner_user_seconds', 'runner_system_seconds', + 'runner_lifetime_max_rss_kib', 'sampled_process_group_rss_bytes'): + _number(receipt[key]) + limit = min(180, start['phase_cap_seconds'] - start['spent_before_seconds']) + _need(receipt['wall_seconds'] <= limit and receipt['runner_wall_seconds'] <= limit and + receipt['runner_lifetime_max_rss_kib'] * 1024 <= 1073741824 and + receipt['sampled_process_group_rss_bytes'] <= 1073741824, + 'G12-N07: original guard resource caps') + for key in ('user_seconds', 'system_seconds', 'kernel_max_rss_kib'): + _number(usage[key]) + _need(type(usage['exit']) is int and usage['exit'] == 0 and _exact(usage, receipt['usage']), + 'G12-N07: complete original usage join') + for name, raw in (('stdout', stdout), ('stderr', stderr)): + _need(len(raw) <= _LOG_CAP and receipt[name + '_bytes'] == len(raw) and + type(receipt[name + '_bytes']) is int and receipt[name + '_final_bytes'] == len(raw) and + type(receipt[name + '_final_bytes']) is int and + receipt[name + '_sha256'] == hashlib.sha256(raw).hexdigest(), 'G12-N07: complete raw log join') + _need(stderr == b'' and type(receipt['python']) is str and type(receipt['platform']) is str, + 'G12-N07: original stderr/platform fields') + + +def _capture_graph(namespace): + """Capture the fixed own/JSON function graph before candidate exposure.""" + modules = (json, json.decoder, json.encoder, json.scanner, hashlib, os, stat, math) + tuple( + namespace[name] for name in ('subprocess', 'fcntl', 'signal', 'resource', 'time') if name in namespace) + namespaces = [namespace] + [module.__dict__ for module in modules] + namespaces.extend((json._default_decoder.__dict__, json._default_encoder.__dict__)) + records, members, seen = [], [], set() + for mapping in namespaces: + members.append((mapping, tuple(mapping.items()))) + for value in mapping.values(): + candidates = [value] + if type(value) is type: + candidates.extend(value.__dict__.values()) + if value.__module__ in (__name__, 'json.decoder', 'json.encoder', 'subprocess'): + members.append((value.__dict__, tuple(value.__dict__.items()))) + for function in candidates: + if type(function) is not FunctionType or id(function) in seen: + continue + seen.add(id(function)) + records.append((function, function.__code__, function.__globals__, function.__builtins__, + function.__defaults__, function.__kwdefaults__, function.__closure__, + tuple(function.__dict__.items()), + () if function.__kwdefaults__ is None else tuple(function.__kwdefaults__.items()), + () if function.__closure__ is None else tuple((c, c.cell_contents) for c in function.__closure__))) + data = tuple((name, _canonical(namespace[name])) for name in + ('_PAIR_SCHEMA', '_MANIFEST_SCHEMA', '_GUARD_SCHEMA', '_PUBLICATION_SCHEMA', + '_ENGINE_PINS', '_OTHER_SOURCE_PINS', '_ENV', '_EVIDENCE_NAMES') if name in namespace) + return tuple(records), tuple(members), data + + + +def _current_graph(graph): + records, members, data = graph + for mapping, rows in members: + # The capture itself is assigned once after this snapshot. + expected = dict(rows) + for name, value in rows: + _need(mapping.get(name, _MISSING) is value, 'G12-N04: captured namespace member changed: ' + name) + extra = set(mapping) - set(expected) + _need(not extra or mapping is globals() and extra == {'_INITIAL_GRAPH'}, + 'G12-N04: captured namespace census changed') + for name, expected in data: + _need(_canonical(globals()[name]) == expected, 'G12-N04: source-owned schema constant changed') + for f, code, namespace, builtin, defaults, kw, cells, attrs, kws, contents in records: + _need(f.__code__ is code and f.__globals__ is namespace and f.__builtins__ is builtin and + f.__defaults__ is defaults and f.__kwdefaults__ is kw and f.__closure__ is cells and + len(f.__dict__) == len(attrs), 'G12-N04: captured function graph changed') + for name, value in attrs: + _need(f.__dict__.get(name, _MISSING) is value, 'G12-N04: function attributes changed') + if kw is not None: + _need(len(kw) == len(kws), 'G12-N04: keyword-default census changed') + for name, value in kws: + _need(kw.get(name, _MISSING) is value, 'G12-N04: keyword defaults changed') + for cell, value in contents: + _need(cell.cell_contents is value, 'G12-N04: captured closure changed') + + + +_PAIR_SCHEMA = {'common_constants': {'authority_source_sha256': 'f279ab86fc17c6a517b035f19d56863919cbd8304de4e7d5332457c6159aec10', + 'extra_target': [0, 2, 1], + 'h': 25, + 'literal_original_type': 'bool', + 'original_driver_sha256': '0d976d2eb6b845f20d4a3396591a806f966688b88693cd6a5f8a0c9e48925e36', + 'original_scientific_pins': ['d623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1', + '0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b', + '88bba3caf5975f30fa7abceaea9454110cf3b069233e8241a2ca13d1dff171a7', + 'adc7f1241b42e322a6451854ab7e4b4c146bf78a'], + 'producer_role': 'independent-original-uncached', + 'schema': 'g12-independent-original-reference-envelope-v1', + 'scope': 'Actual original N22 literal and P07 common remainder observations only; ' + 'no original PROFILE_ANCHOR_PASS, FULL_PASS, native qualification or G12 ' + 'approval.', + 'selected_driver_sha256': 'a346025d5b6e2b26246521c6af6292643a4c2c3286b33ff3996dcf051cd6be26'}, + 'common_exact_fields': ['schema', + 'producer_role', + 'selected_driver_sha256', + 'original_driver_sha256', + 'authority_source_sha256', + 'original_scientific_pins', + 'h', + 'extra_target', + 'literal_original_type', + 'literal_original_value', + 'remaining_original_case_count', + 'common_payload_sha256', + 'common_payload_hex', + 'scope'], + 'complement_receipt_exact_fields': ['calls', 'canonical_stream_bytes', 'sha256', 'schema'], + 'diagnostic_constants': {'complement_suffix_limit': 'Only cumulative original start/end receipts; no ' + 'digest subtraction or suffix-stream claim.', + 'completion': 'Exact source-owned intentional marker followed by original ' + 'finally, exact observer restoration, both cold2 checks and ' + 'original source/output custody.', + 'producer_role': 'independent-original-uncached', + 'schema': 'g12-independent-original-reference-diagnostics-v1', + 'selected_driver_sha256': 'a346025d5b6e2b26246521c6af6292643a4c2c3286b33ff3996dcf051cd6be26'}, + 'diagnostic_exact_fields': ['schema', + 'producer_role', + 'selected_driver_sha256', + 'common_payload_sha256', + 'prefix_end', + 'suffix_start', + 'cli_end', + 'ordered_rank_suffix_hex', + 'complement_suffix_limit', + 'phases', + 'completion'], + 'diagnostic_snapshot_exact_fields': ['rank_event_count', + 'ordered_rank_events_hex', + 'complement_receipt', + 'native_binding', + 'cache_binding'], + 'phase_exact_names': ['input_custody', + 'engine_custody', + 'fresh_root_copy', + 'fresh_engine_copy', + 'cold_engine_import', + 'cold_complex_module_load', + 'cold_certify_import', + 'cold_prepare_import', + 'side_construction', + 'checks_initialization', + 'compile_roles', + 'verify_map', + 'verify_labels', + 'verify_role_frames', + 'original_upstream_verify_sources', + 'full_log_integer_bounds', + 'original_serializable', + 'complete_original_cli']} + + +_MANIFEST_SCHEMA = {'accounting_exact_fields': ['clock', + 'parent_entry_ns', + 'preseal_end_ns', + 'parent_preseal_wall_ns', + 'parent_self_user_seconds', + 'parent_self_system_seconds', + 'parent_children_user_seconds', + 'parent_children_system_seconds', + 'parent_lifetime_max_rss_kib', + 'guard_usage', + 'guard_runner_wall_seconds', + 'categories', + 'complete_tail_accounting_required', + 'unmeasured_final_tail'], + 'cleanup_exact_fields': ['operating_premises', + 'owned_generations', + 'observed_groups', + 'remaining', + 'current_children', + 'known_streams_closed', + 'known_pidfds_closed', + 'io_unknown', + 'lease_identity', + 'science_directory_identity', + 'observations_record'], + 'custody_exact_fields': ['retained_directory', + 'retained_directory_identity', + 'retained_file_mode', + 'created_after_known_cleanup', + 'source_selection_required', + 'known_close_policy'], + 'exact_top_level_fields': ['schema', + 'invocation', + 'selected_sources', + 'workload', + 'launch', + 'terminal', + 'guard', + 'cleanup', + 'pair', + 'retained_evidence', + 'custody', + 'accounting', + 'scope'], + 'guard_exact_fields': ['start', + 'receipt', + 'start_fields', + 'receipt_fields', + 'stdout', + 'stderr', + 'usage'], + 'invocation_exact_fields': ['stage', + 'job', + 'label', + 'stage_sha256', + 'jobs_sha256', + 'launch_selection_sha256'], + 'launch_exact_fields': ['parent_pid', + 'parent_start_ticks', + 'guard_pid', + 'guard_start_ticks', + 'guard_pgid', + 'guard_sid', + 'parent_guard_argv', + 'guard_root_argv', + 'adapter_producer_argv', + 'cwd', + 'environment', + 'flags', + 'launch_record'], + 'pair_exact_fields': ['common', 'diagnostics', 'common_payload_sha256'], + 'retained_evidence_exact_keys': ['guard_START', + 'guard_receipt', + 'guard_stdout', + 'guard_stderr', + 'guard_usage', + 'parent_launch', + 'parent_outer_stdout', + 'parent_outer_stderr', + 'parent_owned_observations', + 'parent_preseal_accounting'], + 'schema_literal': 'g12-parent-two-export-custody-v2', + 'selected_sources_exact_fields': ['parent', + 'guard', + 'root', + 'provider', + 'adapter', + 'producer', + 'authority', + 'source_pins', + 'reference', + 'engine', + 'runtime_profile', + 'cleanup_leaf_origin'], + 'terminal_exact_fields': ['actual_popen_returncode', + 'wait_completed', + 'parent_stop', + 'primary_error', + 'secondary_errors', + 'guard_receipt_missing'], + 'workload_exact_fields': ['role', + 'h', + 'extra_target', + 'mode', + 'anchor', + 'optimize', + 'original_scientific_pins'], + 'workload_values': {'anchor': None, + 'extra_target': [0, 2, 1], + 'h': 25, + 'mode': 'profile', + 'optimize': 0, + 'original_scientific_pins': ['d623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1', + '0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b', + '88bba3caf5975f30fa7abceaea9454110cf3b069233e8241a2ca13d1dff171a7', + 'adc7f1241b42e322a6451854ab7e4b4c146bf78a'], + 'role': 'independent-original-uncached'}} + + +_GUARD_SCHEMA = {'START_exact_fields': ['command', + 'parent_launch', + 'stage_sha256', + 'runner_sha256', + 'fractions_sha256', + 'budget_phase_sha256', + 'spent_before_seconds', + 'phase_cap_seconds', + 'job', + 'label'], + 'receipt_exact_fields': ['command', + 'parent_launch', + 'stage_sha256', + 'runner_sha256', + 'fractions_sha256', + 'budget_phase_sha256', + 'spent_before_seconds', + 'phase_cap_seconds', + 'job', + 'label', + 'exit', + 'wall_seconds', + 'usage', + 'termination', + 'sampled_process_group_rss_bytes', + 'source_bytes_and_modes_unchanged', + 'stdout_sha256', + 'stdout_bytes', + 'stderr_sha256', + 'stderr_bytes', + 'stdout_final_bytes', + 'stderr_final_bytes', + 'retained_log_bytes_stable', + 'output_cap_observed_at', + 'log_read_chunk_bytes', + 'runner_wall_seconds', + 'runner_user_seconds', + 'runner_system_seconds', + 'runner_lifetime_max_rss_kib', + 'python', + 'platform', + 'status'], + 'required_values': {'exit': 0, + 'log_read_chunk_bytes': 65536, + 'output_cap_observed_at': None, + 'retained_log_bytes_stable': True, + 'source_bytes_and_modes_unchanged': True, + 'status': 'PASS', + 'stderr_bytes': 0, + 'stderr_final_bytes': 0, + 'termination': None}} + + +_PUBLICATION_SCHEMA = {'exact_fields': ['schema', + 'parent_source_sha256', + 'launch_selection_sha256', + 'manifest_path', + 'manifest_sha256', + 'manifest_bytes', + 'manifest_identity', + 'retained_pair_sha256', + 'final_pair_recheck_complete', + 'known_lease_close_completed', + 'primary_error', + 'secondary_errors', + 'measured_through_ns', + 'actual_costs_through_ns', + 'unmeasured_final_tail', + 'complete_cost_qualification'], + 'schema_literal': 'g12-parent-custody-publication-v2'} + + +_COST_CATEGORIES = ('source/stage/plan/authentication and dependency preflight', 'parent invocation setup and known lease operations', 'adapter bootstrap source read/hash/compile/exec and argv/module alias custody/restoration', 'entire independent uncached reference including fresh copies/engine imports/original CLI/trace capture/original checks/finally/restoration/cold2', 'guard launch/time/monitoring/STOP/final original source inventory/usage/raw-log hashing/receipt', 'actual parent wait and known descendant/group/FD cleanup', 'canonical receipt and START joins plus all complete raw evidence retention', 'both exports full reads/hashes/JSON/schema/payload decode/crosslinks and repeated pair checks', 'new parent copies/write/fsync/chmod/close/directory sync/readback', 'manifest schema/write/hash/fsync/close/readback and source-selection publication tail', 'parent failure/secondary-error retention and necessary cleanup after deadline', 'cold consumer complete manifest/pair/publication read/hash/parse/decode/recheck and all retained alias lifetimes') + + +def _validate_manifest(manifest, parent_path, parent_sha): + spec = _MANIFEST_SCHEMA + _fields(manifest, spec['exact_top_level_fields']) + _need(manifest['schema'] == spec['schema_literal'], 'G12-N12: custody schema') + for name in ('invocation', 'selected_sources', 'workload', 'launch', 'terminal', 'guard', + 'cleanup', 'pair', 'custody', 'accounting'): + _fields(manifest[name], spec[name + '_exact_fields']) + _fields(manifest['retained_evidence'], spec['retained_evidence_exact_keys']) + _need(_exact(manifest['workload'], spec['workload_values']), 'G12-N13: fixed workload') + invocation = manifest['invocation'] + _need(invocation['stage'] == 'g12-reference-custody-v1' and invocation['job'] == 'g12-reference' and + type(invocation['label']) is str and bool(invocation['label']) and + all(c in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_' for c in invocation['label']), + 'G12-N13: fixed invocation role') + for name in ('stage_sha256', 'jobs_sha256', 'launch_selection_sha256'): + _need(_digest(invocation[name]), 'G12-N12: invocation digest') + sources = manifest['selected_sources'] + for name, pin in sources.items(): + if name != 'engine': + _source_pin(pin) + for name, expected in (('guard', _GUARD_PIN), ('root', _ROOT_PIN), ('provider', _PROVIDER_PIN), + ('producer', _PRODUCER_PIN), ('authority', _AUTHORITY_PIN)): + _need(sources[name]['sha256'] == expected and sources[name]['mode'] == '0444', + 'G12-N02: selected original source mismatch') + _need(sources['producer']['bytes'] == 70246 and sources['parent']['path'] == parent_path and + sources['parent']['sha256'] == parent_sha, 'G12-N02: selected producer/parent identity') + _need(_exact(sources['engine'], _ENGINE_PINS), 'G12-N02: exact original engine source pins') + for name, expected in _OTHER_SOURCE_PINS.items(): + _need(sources[name]['sha256'] == expected, 'G12-N02: selected original dependency mismatch') + terminal = {'actual_popen_returncode': 0, 'wait_completed': True, 'parent_stop': None, + 'primary_error': None, 'secondary_errors': [], 'guard_receipt_missing': False} + _need(_exact(manifest['terminal'], terminal), 'G12-N06: authenticated terminal data rejects') + cleanup = manifest['cleanup'] + _need(_exact(cleanup['remaining'], []) and _exact(cleanup['current_children'], []) and + cleanup['known_streams_closed'] is True and cleanup['known_pidfds_closed'] is True and + cleanup['io_unknown'] is False and type(cleanup['owned_generations']) is list and + bool(cleanup['owned_generations']) and _exact(cleanup['operating_premises'], _OPERATING_PREMISES), + 'G12-N08: known selected chain custody rejects') + for name in ('parent_pid', 'parent_start_ticks', 'guard_pid', 'guard_start_ticks', 'guard_pgid', 'guard_sid'): + _uint(manifest['launch'][name], True) + label = invocation['label'] + stage = _R + '/stages/g12-reference-custody-v1' + science = _R + '/runtime/runs/' + label + '/science' + parent_argv, root_argv, producer_argv = _fixed_argv(label, sources) + launch = manifest['launch'] + _need(_exact(launch['parent_guard_argv'], parent_argv) and _exact(launch['guard_root_argv'], root_argv) and + _exact(launch['adapter_producer_argv'], producer_argv) and launch['cwd'] == _R and + _exact(launch['environment'], _ENV) and _exact(launch['flags'], list(_FLAGS)), + 'G12-N03: exact fixed launch/adapter argv') + retained = _R + '/runtime/g12-reference-parent-custody-v1/' + label + custody = manifest['custody'] + _need(custody['retained_directory'] == retained and custody['retained_file_mode'] == '0444' and + custody['created_after_known_cleanup'] is True and custody['source_selection_required'] is True and + custody['known_close_policy'] == 'Any unknown close rejects publication', 'G12-N14: custody ownership') + _fields(custody['retained_directory_identity'], _ID_NAMES) + _need(custody['retained_directory_identity']['full_st_mode'] == stat.S_IFDIR | 0o500, + 'G12-N14: final retained directory mode') + for name in ('common', 'diagnostics'): + pair = manifest['pair'][name] + _fields(pair, ('original', 'retained')) + _file_record(pair['original']) + _file_record(pair['retained']) + filename = 'g12-reference.' + name + '.json' + _need(pair['original']['path'] == science + '/' + filename and + pair['retained']['path'] == retained + '/' + filename and + pair['original']['sha256'] == pair['retained']['sha256'] and + pair['original']['bytes'] == pair['retained']['bytes'] and + pair['retained']['identity']['full_st_mode'] == stat.S_IFREG | 0o444, + 'G12-N13: original/retained complete pair join') + _need(_digest(manifest['pair']['common_payload_sha256']), 'G12-N13: payload pin') + for name, record in manifest['retained_evidence'].items(): + _file_record(record) + _need(record['path'] == retained + '/' + _EVIDENCE_NAMES[name] and + record['identity']['full_st_mode'] == stat.S_IFREG | 0o444, + 'G12-N14: retained raw evidence path/mode') + for name, evidence_name in (('start', 'guard_START'), ('receipt', 'guard_receipt'), + ('stdout', 'guard_stdout'), ('stderr', 'guard_stderr'), ('usage', 'guard_usage')): + _need(_exact(manifest['guard'][name], manifest['retained_evidence'][evidence_name]), + 'G12-N07: guard retained record join') + _need(_exact(launch['launch_record'], manifest['retained_evidence']['parent_launch']) and + _exact(cleanup['observations_record'], manifest['retained_evidence']['parent_owned_observations']), + 'G12-N08: parent observation record join') + account = manifest['accounting'] + _need(account['clock'] == 'monotonic_ns' and account['complete_tail_accounting_required'] is True and + _exact(account['categories'], list(_COST_CATEGORIES)), 'G12-N15: full cost categories/tail') + for name in ('parent_entry_ns', 'preseal_end_ns', 'parent_preseal_wall_ns'): + _uint(account[name]) + _need(account['preseal_end_ns'] >= account['parent_entry_ns'] and + account['parent_preseal_wall_ns'] == account['preseal_end_ns'] - account['parent_entry_ns'], + 'G12-N15: actual parent clock endpoints') + for name in ('parent_self_user_seconds', 'parent_self_system_seconds', 'parent_children_user_seconds', + 'parent_children_system_seconds', 'parent_lifetime_max_rss_kib', 'guard_runner_wall_seconds'): + _number(account[name]) + _need(account['unmeasured_final_tail'] is None, 'G12-N15: unmeasured tail must stay explicitly unknown') + _need(_exact(account['guard_usage'], manifest['guard']['receipt_fields']['usage']) and + _exact(account['guard_runner_wall_seconds'], manifest['guard']['receipt_fields']['runner_wall_seconds']), + 'G12-N15: actual guard cost join') + _need(manifest['scope'] == _SCOPE, 'G12-N18: custody scope cannot become scientific approval') + + +def _fixed_argv(label, sources): + stage = _R + '/stages/g12-reference-custody-v1' + science = _R + '/runtime/runs/' + label + '/science' + parent = ['/usr/bin/python3.12', *_FLAGS, _R + '/run_guarded_v3.py', + 'g12-reference-custody-v1', 'g12-reference', label] + root = ['/usr/bin/python3.12', *_FLAGS, stage + '/integration/full_driver.py', + '--root-sha256', _ROOT_PIN, '--provider', stage + '/integration/probe_binding_v3.py', + _PROVIDER_PIN, '--driver', stage + '/integration/g12_reference_adapter_v1.py', + sources['adapter']['sha256'], '--integration', stage + '/integration', '--', + '--output', science, '--lanes', 'g12-reference'] + producer = [stage + '/baseline/full_driver.py', '--frozen-root', stage + '/baseline/frozen', + '--reference', stage + '/baseline/reference/certificates/complex-network.json', + '--mode', 'profile', '--output', science] + return parent, root, producer + + +def _validate_publication(publication, manifest, manifest_record): + _fields(publication, _PUBLICATION_SCHEMA['exact_fields']) + _need(publication['schema'] == _PUBLICATION_SCHEMA['schema_literal'] and + publication['parent_source_sha256'] == manifest['selected_sources']['parent']['sha256'] and + publication['launch_selection_sha256'] == manifest['invocation']['launch_selection_sha256'] and + publication['manifest_path'] == manifest_record['path'] and + publication['manifest_sha256'] == manifest_record['sha256'] and + publication['manifest_bytes'] == manifest_record['bytes'] and + _exact(publication['manifest_identity'], manifest_record['identity']) and + _exact(publication['retained_pair_sha256'], {name: manifest['pair'][name]['retained']['sha256'] + for name in ('common', 'diagnostics')}) and + publication['final_pair_recheck_complete'] is True and publication['known_lease_close_completed'] is True and + publication['primary_error'] is None and _exact(publication['secondary_errors'], []) and + publication['complete_cost_qualification'] is False and + _exact(publication['unmeasured_final_tail'], manifest['accounting']['unmeasured_final_tail']), + 'G12-N15: exact publication/manifest/final-tail join') + _uint(publication['measured_through_ns']) + _need(publication['measured_through_ns'] >= manifest['accounting']['preseal_end_ns'], + 'G12-N15: publication clock precedes preseal') + costs = publication['actual_costs_through_ns'] + _fields(costs, ('entry_ns', 'through_ns', 'wall_ns', 'self_user_seconds', 'self_system_seconds', + 'children_user_seconds', 'children_system_seconds', 'lifetime_max_rss_kib')) + for name in ('entry_ns', 'through_ns', 'wall_ns'): + _uint(costs[name]) + _need(costs['entry_ns'] == manifest['accounting']['parent_entry_ns'] and + costs['through_ns'] == publication['measured_through_ns'] and + costs['wall_ns'] == costs['through_ns'] - costs['entry_ns'], 'G12-N15: publication actual clock join') + for name in ('self_user_seconds', 'self_system_seconds', 'children_user_seconds', + 'children_system_seconds', 'lifetime_max_rss_kib'): + _number(costs[name]) + + +def _source_code_shape(code): + _need(type(code) is CodeType, 'G12-N04: exact code type') + def constant(value): + kind = type(value) + if value is None or value is Ellipsis: + return ('singleton', value is Ellipsis) + if kind in (int, bool, str, bytes): + return (kind.__name__, value) + if kind is float: + return ('float', value.hex()) + if kind is tuple: + return ('tuple', tuple(constant(item) for item in value)) + if kind is frozenset: + return ('frozenset', tuple(sorted(constant(item) for item in value))) + if kind is CodeType: + return ('code', _source_code_shape(value)) + raise RuntimeError('G12-N04: unsupported source code constant') + return tuple(constant(value) for value in ( + code.co_argcount, code.co_posonlyargcount, code.co_kwonlyargcount, + code.co_nlocals, code.co_stacksize, code.co_flags, code.co_code, + code.co_names, code.co_varnames, code.co_freevars, code.co_cellvars, + code.co_exceptiontable, code.co_linetable, code.co_firstlineno, + code.co_filename, code.co_name, code.co_qualname, code.co_consts)) + + +_R = '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028' + + +_ENGINE_PINS = {'compare_side_verifier.py': '6e507bb0c7e00d090a60289fddb6c55e90c946d0850c42c3c5e3e15c27604a68', + 'finite_controls.py': 'df989a831aac43cc1af95169dad8c64a7548760e6e1f96976da996703f2c8f7a', + 'native_backend.py': 'e473c38245c3668715b5a78dfe980b2fe3ed0d0c9b8c97c666fbae6ecf1fffd5', + 'native_gf2.c': 'e9c3c9194a08718bd1575c1cf08c6c6772d3b644c2e274c25a84a1f9249d06cc', + 'profile_side_verifier.py': '9c994378171c20a91539418d93cb8387e1daa93465d6862beefea90e12999c2a', + 'source/complex_circuit.py': 'd623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1', + 'source/complex_network.py': '0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b'} + + +_OTHER_SOURCE_PINS = {'cleanup_leaf_origin': '7b3304eaf4884e3029df5095e2b0950c18d1544ad21431a07c033b85e53bd4f7', + 'reference': '1f763d95c7ff163aa71d13cd82784f16665be8afb21f75e76941e2119562098f', + 'runtime_profile': 'ad0ec2aea01b83f97bdeafd9e9208360127fee870d024d353879b5ed99237109', + 'source_pins': '88bba3caf5975f30fa7abceaea9454110cf3b069233e8241a2ca13d1dff171a7'} + + +_OPERATING_PREMISES = ('Selected fixed scientific sources, adapter and ordinary profile branch do not fork/spawn threads, ' + 'daemonize, pass writable descriptors to outsiders, or enlist external writers. Trusted ' + 'OS/loader/interpreter/stdlib and cooperating same-user parent launch domain exclude unrelated writer ' + 'interference. This is an explicit finite source/operating premise, not established merely by a clean /proc ' + 'snapshot.') + + +_SCOPE = ('Fixed source-data custody only. No G12/P02/full-positive/native/performance/scientific admission; no ' + 'universal writers theorem.') + + +_FLAGS = ('-S', '-s', '-P', '-B') + + +_ENV = {'LANG': 'C.UTF-8', + 'LC_ALL': 'C.UTF-8', + 'PATH': '/usr/bin:/bin', + 'PYTHONDONTWRITEBYTECODE': '1', + 'PYTHONHASHSEED': '0', + 'TZ': 'UTC'} + + +_EVIDENCE_NAMES = {'guard_START': 'guard-START.json', + 'guard_receipt': 'guard-receipt.json', + 'guard_stderr': 'guard-stderr.txt', + 'guard_stdout': 'guard-stdout.txt', + 'guard_usage': 'guard-usage.json', + 'parent_launch': 'parent-LAUNCH.json', + 'parent_outer_stderr': 'parent-outer-stderr.txt', + 'parent_outer_stdout': 'parent-outer-stdout.txt', + 'parent_owned_observations': 'parent-owned-observations.json', + 'parent_preseal_accounting': 'parent-preseal-accounting.json'} + + + +def _proc(pid): + # Derived from original supervisor proc; PermissionError is never absence. + descriptor, primary, secondaries, result = None, None, _RawG12Errors(), None + try: + descriptor = os.open('/proc/' + str(pid) + '/stat', os.O_RDONLY | os.O_NOFOLLOW | os.O_CLOEXEC) + raw = os.read(descriptor, 8193) + _need(len(raw) <= 8192 and os.read(descriptor, 1) == b'', 'G12-N08: process-stat finite bound') + end = raw.rfind(b') ') + _need(end >= 0 and raw.split(b' ', 1)[0] == str(pid).encode('ascii'), 'G12-N08: process-stat PID') + fields = raw[end + 2:].split() + _need(len(fields) >= 22 and fields[0] in (b'R', b'S', b'D', b'Z', b'T', b't', b'X', b'x', b'I', b'K', b'W', b'P'), + 'G12-N08: process-stat shape/state') + result = {'pid': pid, 'ppid': int(fields[1]), 'pgid': int(fields[2]), 'sid': int(fields[3]), + 'start_ticks': int(fields[19]), 'state': fields[0].decode('ascii'), + 'rss_bytes': int(fields[21]) * os.sysconf('SC_PAGE_SIZE')} + for key in ('pid', 'ppid', 'pgid', 'sid', 'start_ticks', 'rss_bytes'): + _uint(result[key], key in ('pid', 'start_ticks')) + except (FileNotFoundError, ProcessLookupError): + result = None + except BaseException as error: + primary = error, error.__traceback__ + if descriptor is not None: + try: + os.close(descriptor) + except BaseException as error: + secondaries.append((error, error.__traceback__)) + _raise_preserved(primary, secondaries) + return result + + +def _census(): + rows = {} + with os.scandir('/proc') as entries: + for entry in entries: + if entry.name.isdecimal(): + _need(len(rows) < 65536, 'G12-N08: finite process census bound') + row = _proc(int(entry.name)) + if row is not None: + rows[row['pid']] = row + return rows + + +def _children(): + return [row for row in _census().values() if row['ppid'] == os.getpid()] + + +class _KnownG12Chain: + """Scoped generation/pidfd observation only; never universal writer proof.""" + def __init__(self): + _need(not _children(), 'G12-N08: initial parent child domain must be empty') + _need(os.listdir('/proc/self/task') == [str(os.getpid())], 'G12-N08: single initial parent task') + self.rows, self.fds, self.groups, self.observations = {}, {}, set(), [] + self.parent_pid = os.getpid() + self.parent_group = os.getpgrp() + self.closed = False + self.unknown = False + + def add(self, row): + key = row['pid'], row['start_ticks'] + if key in self.rows: + _need(self.rows[key]['pid'] == row['pid'], 'G12-N08: owned generation identity') + if row['pgid'] != self.parent_group: + self.groups.add((row['pgid'], row['sid'])) + return + _need(row['pid'] != self.parent_pid and len(self.rows) < 128, 'G12-N08: fixed owned process bound') + descriptor = os.pidfd_open(row['pid'], 0) + # A failed/ambiguous adoption rejects; never treat it as known closure. + self.fds[key] = descriptor + current = _proc(row['pid']) + _need(current is not None and (current['pid'], current['start_ticks']) == key, + 'G12-N08: process generation changed during pidfd adoption') + self.rows[key] = dict(current) + if current['pgid'] != self.parent_group: + self.groups.add((current['pgid'], current['sid'])) + + def observe(self): + _need(not self.closed, 'G12-N08: closed observation domain') + rows = _census() + known = {pid for pid, start in self.rows if pid in rows and rows[pid]['start_ticks'] == start} + for pid in known: + self.add(rows[pid]) + changed = True + while changed: + changed = False + for pid, row in rows.items(): + if pid not in known and (row['ppid'] == self.parent_pid or row['ppid'] in known): + self.add(row) + known.add(pid) + changed = True + occupied = [row for row in rows.values() if (row['pgid'], row['sid']) in self.groups] + current = [rows[pid] for pid in known] + _need(len(self.observations) < 4096, 'G12-N08: finite observation retention') + self.observations.append({'monotonic_ns': time.monotonic_ns(), 'current': current, 'occupied_groups': occupied}) + return rows, current, occupied + + def stop_known(self): + self.observe() + for key, descriptor in self.fds.items(): + current = _proc(key[0]) + if current is not None: + _need((current['pid'], current['start_ticks']) == key, 'G12-N08: generation ambiguity before signal') + if current['state'] != 'Z': + try: + signal.pidfd_send_signal(descriptor, signal.SIGKILL, None, 0) + except ProcessLookupError: + pass + + def finish(self, process, deadline, failed): + _need(type(deadline) is int, 'G12-N08: selected paid cleanup deadline') + current, occupied = [], [] + while True: + if failed: + self.stop_known() + if process is not None: + process.poll() + _, current, occupied = self.observe() + if not current and not occupied and not _children(): + break + if not failed or time.monotonic_ns() >= deadline: + raise RuntimeError('G12-N08: selected-chain cleanup UNKNOWN') + time.sleep(0.01) + primary, secondaries = None, _RawG12Errors() + for key, descriptor in tuple(self.fds.items()): + try: + os.close(descriptor) + del self.fds[key] + except BaseException as error: + self.unknown = True + secondaries.append((error, error.__traceback__)) + self.closed = not self.fds and not self.unknown + _raise_preserved(primary, secondaries) + return {'operating_premises': _OPERATING_PREMISES, + 'owned_generations': list(self.rows.values()), + 'observed_groups': [{'pgid': g, 'sid': s} for g, s in sorted(self.groups)], + 'remaining': [], 'current_children': [], 'known_streams_closed': False, + 'known_pidfds_closed': self.closed, 'io_unknown': self.unknown, + 'lease_identity': None, 'science_directory_identity': None, + 'observations_record': None} + + +def _trusted_parent_launch(): + _need(sys.executable == '/usr/bin/python3.12' and sys.flags.optimize == 0 and + sys.flags.no_site == sys.flags.no_user_site == sys.flags.dont_write_bytecode == 1 and + sys.flags.safe_path and sys.flags.ignore_environment == sys.flags.isolated == sys.flags.hash_randomization == 0, + 'G12-N02: original clean parent interpreter flags') + _need(dict(os.environ) == _ENV and tuple(sys.path) == + ('/usr/lib/python312.zip', '/usr/lib/python3.12', '/usr/lib/python3.12/lib-dynload'), + 'G12-N02: original clean environment/search path') + _need(sys.gettrace() is None and sys.getprofile() is None, 'G12-N04: no parent tracing callbacks') + + +def _exclusive_directory(path): + parent, name = _path(path).rsplit('/', 1) + fds, rows = _directory_chain(parent) + primary, secondaries, result = None, _RawG12Errors(), None + try: + os.mkdir(name, 0o700, dir_fd=fds[-1]) + descriptor = os.open(name, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW | os.O_CLOEXEC, dir_fd=fds[-1]) + fds.append(descriptor) + current = os.fstat(descriptor) + _need(current.st_mode == stat.S_IFDIR | 0o700, 'G12-N14: new parent directory mode') + rows.append((fds[-2], name, descriptor, _directory_key(current))) + _check_chain(rows) + result = fds, rows + except BaseException as error: + primary = error, error.__traceback__ + if primary is not None: + for descriptor in reversed(fds): + try: + os.close(descriptor) + except BaseException as error: + secondaries.append((error, error.__traceback__)) + _raise_preserved(primary, secondaries) + return result + + +def _write_fd(descriptor, raw): + _need(type(raw) is bytes, 'G12-N14: exact retained byte copy') + offset, hasher = 0, hashlib.sha256() + while offset < len(raw): + block = raw[offset:offset + _CHUNK] + written = os.write(descriptor, block) + _need(type(written) is int and 0 < written <= len(block), 'G12-N14: complete copy write progress') + hasher.update(block[:written]) + offset += written + _need(offset == len(raw) and hasher.hexdigest() == hashlib.sha256(raw).hexdigest(), + 'G12-N14: complete copied byte digest') + os.fsync(descriptor) + os.fchmod(descriptor, 0o444) + os.fsync(descriptor) + + +def _copy_file(directory, name, raw): + fds, rows = directory + descriptor = os.open(name, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW | os.O_CLOEXEC, + 0o600, dir_fd=fds[-1]) + primary, secondaries = None, _RawG12Errors() + try: + _write_fd(descriptor, raw) + _check_chain(rows) + except BaseException as error: + primary = error, error.__traceback__ + try: + os.close(descriptor) + except BaseException as error: + secondaries.append((error, error.__traceback__)) + _raise_preserved(primary, secondaries) + os.fsync(fds[-1]) + + +def _actual_costs(entry_ns, own_start, children_start): + through = time.monotonic_ns() + own, children = resource.getrusage(resource.RUSAGE_SELF), resource.getrusage(resource.RUSAGE_CHILDREN) + return {'entry_ns': entry_ns, 'through_ns': through, 'wall_ns': through - entry_ns, + 'self_user_seconds': own.ru_utime - own_start.ru_utime, + 'self_system_seconds': own.ru_stime - own_start.ru_stime, + 'children_user_seconds': children.ru_utime - children_start.ru_utime, + 'children_system_seconds': children.ru_stime - children_start.ru_stime, + 'lifetime_max_rss_kib': own.ru_maxrss} + + +def run_g12_reference(): + """P01: one source-private invocation; accepts no caller completion data.""" + configured = G12_REFERENCE_LAUNCH_SELECTION + _need(type(configured) is dict, 'G12-N01: exact immutable launch source literal remains None') + _need(type(_INITIAL_PARENT_SOURCE_PIN) is dict and configured['source_pins']['parent'] is None, + 'G12-N02: independent initial external parent source pin; no self-hash literal') + _source_pin(_INITIAL_PARENT_SOURCE_PIN) + configured_bytes = _canonical(configured) + selection = dict(configured) + selection['source_pins'] = dict(configured['source_pins']) + selection['source_pins']['parent'] = dict(_INITIAL_PARENT_SOURCE_PIN) + # Actual launch remains closed. The independently reviewed source scope + # correction requires the complete symbolic bill, not a new financial API. + entry_ns = time.monotonic_ns() + own_start, children_start = resource.getrusage(resource.RUSAGE_SELF), resource.getrusage(resource.RUSAGE_CHILDREN) + selection_bytes = _canonical(selection) + selection_sha = hashlib.sha256(selection_bytes).hexdigest() + parent_graph = _capture_graph(globals()) + phase, stage_data, stage_record, jobs_record, phase_record = None, None, None, None, None + source_records, originals, evidence, retained_records = {}, {}, {}, {} + parent_identity = _proc(os.getpid()) + process, chain, lease, lease_identity = None, None, None, None + lease_closed, attempted, wait_completed = False, False, False + outer = {} + observation, retained, science_directory, run_directory = None, None, None, None + primary, secondaries, parent_stop = None, _RawG12Errors(), None + cleanup, common, diagnostic, common_payload = None, None, None, None + start, receipt, usage, launch = None, None, None, None + manifest, manifest_record, publication_record = None, None, None + reserved = {} + candidate_pin = None + + def current(): + _need(G12_REFERENCE_LAUNCH_SELECTION is configured and _canonical(configured) == configured_bytes and + _canonical(selection) == selection_bytes and _exact(selection['source_pins']['parent'], _INITIAL_PARENT_SOURCE_PIN), + 'G12-N16: selected launch source changed') + _current_graph(parent_graph) + _need(_proc(os.getpid())['start_ticks'] == parent_identity['start_ticks'], 'G12-N08: parent generation') + _need(os.listdir('/proc/self/task') == [str(os.getpid())], 'G12-N08: parent thread domain changed') + if lease is not None and not lease_closed: + _need(_identity(os.fstat(lease)) == lease_identity and os.fstat(lease).st_nlink == 1, + 'G12-N08: actual parent lease identity changed') + for domain in (observation, retained, science_directory, run_directory): + if domain is not None: + _check_chain(domain[1]) + + def _g12_preflight_and_claim(): + """P02: exact source/phase/namespace gate; separate parent-queue lease.""" + nonlocal phase, stage_data, stage_record, jobs_record, phase_record, chain + nonlocal lease, lease_identity, observation + _fields(selection, ('schema', 'stage', 'job', 'label', 'stage_sha256', 'jobs_sha256', 'source_pins', + 'phase_pin', 'body_deadline_ns', 'retention_tail_allowance_ns', + 'parent_observation_directory', 'parent_retained_directory')) + _need(selection['schema'] == 'g12-one-reference-launch-selection-v1' and + selection['stage'] == 'g12-reference-custody-v1' and selection['job'] == 'g12-reference', + 'G12-N02: fixed G12 launch role') + label = selection['label'] + _need(type(label) is str and bool(label) and + all(c in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_' for c in label), + 'G12-N03: fixed selected guard label') + _need(selection['parent_observation_directory'] == _R + '/runtime/g12-reference-parent-observation-v1/' + label and + selection['parent_retained_directory'] == _R + '/runtime/g12-reference-parent-custody-v1/' + label, + 'G12-N02: fixed parent namespace') + _uint(selection['body_deadline_ns'], True) + _uint(selection['retention_tail_allowance_ns'], True) + _need(selection['body_deadline_ns'] > entry_ns, 'G12-N05: no remaining complete body allowance') + _trusted_parent_launch() + sources = selection['source_pins'] + _fields(sources, _MANIFEST_SCHEMA['selected_sources_exact_fields']) + _need(_exact(sources['engine'], _ENGINE_PINS), 'G12-N02: exact seven original engine pins') + for name, pin in sources.items(): + if name == 'engine': + continue + _source_pin(pin) + observed, raw = _read_file(pin['path'], max(pin['bytes'], 1), int(pin['mode'], 8)) + _need(observed['sha256'] == pin['sha256'] and observed['bytes'] == pin['bytes'], + 'G12-N02: selected source bytes/modes') + source_records[name] = observed, raw + _need(sources['parent']['path'] == __file__, 'G12-N04: external parent source selection') + for name, expected in (('guard', _GUARD_PIN), ('root', _ROOT_PIN), ('provider', _PROVIDER_PIN), + ('producer', _PRODUCER_PIN), ('authority', _AUTHORITY_PIN)): + _need(sources[name]['sha256'] == expected and sources[name]['mode'] == '0444', 'G12-N02: original source pin') + for name, expected in _OTHER_SOURCE_PINS.items(): + _need(sources[name]['sha256'] == expected, 'G12-N02: original dependency pin') + _source_pin(selection['phase_pin']) + phase_record, phase_raw = _read_file(selection['phase_pin']['path'], _META_CAP, + int(selection['phase_pin']['mode'], 8)) + _need(selection['phase_pin']['path'] == _R + '/control/EXECUTION-PHASE.json' and + phase_record['sha256'] == selection['phase_pin']['sha256'] and + phase_record['bytes'] == selection['phase_pin']['bytes'], 'G12-N05: original phase identity') + phase = _json(phase_raw, _META_CAP) + _need(type(phase['aggregate_cap_seconds']) is int and phase['aggregate_cap_seconds'] in (600, 2400), + 'G12-N05: original unchanged aggregate cap') + stage = _R + '/stages/g12-reference-custody-v1' + stage_record, stage_raw = _read_file(stage + '/STAGE.json', _META_CAP, 0o444) + jobs_record, jobs_raw = _read_file(stage + '/JOBS.json', _META_CAP, 0o444) + _need(stage_record['sha256'] == selection['stage_sha256'] and + jobs_record['sha256'] == selection['jobs_sha256'], 'G12-N02: independently selected stage/jobs') + stage_data = _json(stage_raw, _META_CAP) + jobs = _json(jobs_raw, _META_CAP) + _need(_exact(jobs, {'g12-reference': {'bootstrap': {'driver': 'integration/g12_reference_adapter_v1.py', + 'provider': 'integration/probe_binding_v3.py'}, 'lanes': 'g12-reference', 'optimized': False}}), + 'G12-N03: exact only-job bootstrap/lanes/no-finite/no-optimization') + _need(stage_data['runner_sha256'] == _GUARD_PIN, 'G12-N02: original runner source') + for relative, row in stage_data['files'].items(): + _need(type(relative) is str and all(x not in ('', '.', '..') for x in relative.split('/')) and + not relative.startswith('/'), 'G12-N02: stage closure relative path') + _fields(row, ('sha256', 'mode')) + _need(type(row['mode']) is int, 'G12-N02: original source mode') + observed, _ = _read_file(stage + '/' + relative, 16777216, row['mode']) + _need(observed['sha256'] == row['sha256'], 'G12-N02: complete staged source closure') + # Exact census rejects undeclared files/directories/symlinks, including an + # alternate staged authority. Walk source paths only; no runtime payloads. + actual = set() + for path, dirs, files in os.walk(stage, followlinks=False): + for name in dirs: + _need(stat.S_ISDIR(os.lstat(path + '/' + name).st_mode), 'G12-N02: stage directory symlink') + for name in files: + full = path + '/' + name + _need(stat.S_ISREG(os.lstat(full).st_mode), 'G12-N02: stage nonregular source') + relative = full[len(stage) + 1:] + if relative != 'STAGE.json': + actual.add(relative) + _need(actual == set(stage_data['files']), 'G12-N02: exact staged closure census') + for name, pin in sources.items(): + if name not in ('engine', 'parent', 'guard', 'cleanup_leaf_origin'): + _need(pin['path'].startswith(stage + '/'), 'G12-N02: selected source outside new stage') + relative = pin['path'][len(stage) + 1:] + _need(stage_data['files'][relative] == {'sha256': pin['sha256'], 'mode': int(pin['mode'], 8)}, + 'G12-N02: selected source/stage binding') + chain = _KnownG12Chain() + for path in (_R + '/runtime/runs/' + label, selection['parent_observation_directory'], + selection['parent_retained_directory']): + parent, name = path.rsplit('/', 1) + fds, rows = _directory_chain(parent) + try: + try: + os.stat(name, dir_fd=fds[-1], follow_symlinks=False) + except FileNotFoundError: + pass + else: + raise RuntimeError('G12-N05: prior output/evidence/custody path exists') + _check_chain(rows) + finally: + for descriptor in reversed(fds): + os.close(descriptor) + # Separate from the original guard's science.lock. No contention wait. + lock_path = _R + '/runtime/parent-queue.lock' + parent_fds, parent_rows = _directory_chain(_R + '/runtime') + try: + lease = os.open('parent-queue.lock', os.O_RDWR | os.O_CREAT | os.O_NOFOLLOW | os.O_CLOEXEC, + 0o600, dir_fd=parent_fds[-1]) + info = os.fstat(lease) + _need(stat.S_ISREG(info.st_mode) and info.st_nlink == 1, 'G12-N08: parent lease type/link') + lease_identity = _identity(info) + fcntl.flock(lease, fcntl.LOCK_EX | fcntl.LOCK_NB) + _check_chain(parent_rows) + _need(_identity(os.stat('parent-queue.lock', dir_fd=parent_fds[-1], follow_symlinks=False)) == lease_identity, + 'G12-N08: parent lease name identity') + finally: + for descriptor in reversed(parent_fds): + os.close(descriptor) + observation = _exclusive_directory(selection['parent_observation_directory']) + current() + + def _g12_launch_once(): + """P03: retain the actual Popen, actual descriptors and generation.""" + nonlocal process, attempted, launch + _need(not attempted and process is None, 'G12-N06: no second launch attempt') + current() + parent_argv, root_argv, producer_argv = _fixed_argv(selection['label'], selection['source_pins']) + for name in ('stdout', 'stderr'): + outer[name] = os.open('outer-' + name + '.txt', + os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW | os.O_CLOEXEC, + 0o600, dir_fd=observation[0][-1]) + attempted = True + process = subprocess.Popen(parent_argv, cwd=_R, env=dict(_ENV), stdout=outer['stdout'], + stderr=outer['stderr'], close_fds=True, start_new_session=True) + _need(type(process) is subprocess.Popen and type(process.pid) is int and process.pid > 0, + 'G12-N06: actual Popen object/PID') + row = _proc(process.pid) + _need(row is not None and row['ppid'] == os.getpid() and + row['pgid'] == process.pid and row['sid'] == process.pid, 'G12-N06: actual new guard generation/session') + chain.add(row) + launch = {'parent_pid': parent_identity['pid'], 'parent_start_ticks': parent_identity['start_ticks'], + 'guard_pid': row['pid'], 'guard_start_ticks': row['start_ticks'], + 'guard_pgid': row['pgid'], 'guard_sid': row['sid'], 'parent_guard_argv': parent_argv, + 'guard_root_argv': root_argv, 'adapter_producer_argv': producer_argv, + 'cwd': _R, 'environment': dict(_ENV), 'flags': list(_FLAGS), 'launch_record': None} + raw = _canonical({'schema': 'g12-parent-actual-launch-v1', 'selection_sha256': selection_sha, 'source_selection': selection, + 'launch': {k: v for k, v in launch.items() if k != 'launch_record'}}) + b'\n' + _copy_file(observation, 'LAUNCH.json', raw) + evidence['parent_launch'] = _read_file(selection['parent_observation_directory'] + '/LAUNCH.json', _META_CAP, 0o444) + + def _g12_observe_wait_and_close(): + """P04: actual wait and scoped known-chain closure; no status substitute.""" + nonlocal wait_completed, cleanup, parent_stop + _need(process is not None and type(process) is subprocess.Popen, 'G12-N06: missing retained actual Popen') + while process.poll() is None: + _, children, occupied = chain.observe() + if time.monotonic_ns() >= selection['body_deadline_ns']: + parent_stop = 'selected_complete_body_deadline' + elif sum(row['rss_bytes'] for row in children) > 1073741824: + parent_stop = 'selected_known_chain_rss_cap' + elif resource.getrusage(resource.RUSAGE_SELF).ru_maxrss * 1024 > 1073741824: + parent_stop = 'parent_lifetime_rss_cap' + elif any(os.fstat(descriptor).st_size > _LOG_CAP for descriptor in outer.values()): + parent_stop = 'parent_outer_log_cap' + if parent_stop: + raise RuntimeError('G12-N06: parent STOP: ' + parent_stop) + current() + time.sleep(0.05) + code = process.wait() + wait_completed = True + _need(type(code) is int and code == 0 and type(process.returncode) is int and process.returncode == 0, + 'G12-N06: actual guard wait returncode') + cleanup = chain.finish(process, selection['body_deadline_ns'] + selection['retention_tail_allowance_ns'], False) + for name, descriptor in tuple(outer.items()): + os.fsync(descriptor) + os.close(descriptor) + del outer[name] + cleanup['known_streams_closed'] = not outer + cleanup['lease_identity'] = lease_identity + _need(parent_stop is None and cleanup['known_pidfds_closed'] and not cleanup['io_unknown'], + 'G12-N08: complete known closes') + current() + + def _g12_join_original_guard_evidence(): + """P05: retain complete canonical originals; never reconstruct receipt.""" + nonlocal start, receipt, usage, science_directory, run_directory + run = _R + '/runtime/runs/' + selection['label'] + run_directory = _directory_chain(run) + science_directory = _directory_chain(run + '/science') + cleanup['science_directory_identity'] = _identity(os.fstat(science_directory[0][-1])) + fixed = {'guard_START': ('START.json', _META_CAP), 'guard_receipt': ('receipt.json', _META_CAP), + 'guard_stdout': ('stdout.txt', _LOG_CAP), 'guard_stderr': ('stderr.txt', _LOG_CAP), + 'guard_usage': ('usage.json', 16384)} + for name, (filename, cap) in fixed.items(): + evidence[name] = _read_file(run + '/' + filename, cap) + for name in ('stdout', 'stderr'): + evidence['parent_outer_' + name] = _read_file(selection['parent_observation_directory'] + '/outer-' + name + '.txt', _LOG_CAP) + start = _json(evidence['guard_START'][1], _META_CAP) + receipt = _json(evidence['guard_receipt'][1], _META_CAP) + usage = _json(evidence['guard_usage'][1], 16384) + invocation = {'job': selection['job'], 'label': selection['label'], 'stage_sha256': selection['stage_sha256']} + _validate_guard(start, receipt, usage, evidence['guard_stdout'][1], evidence['guard_stderr'][1], + launch['guard_root_argv'], invocation, selection['source_pins'], selection['phase_pin']['sha256']) + fraction, _ = _read_file('/usr/lib/python3.12/fractions.py', 1048576) + _need(start['fractions_sha256'] == fraction['sha256'], 'G12-N07: original fractions source join') + _need(_exact(_json(evidence['parent_outer_stdout'][1], _LOG_CAP), receipt) and + evidence['parent_outer_stderr'][1] == b'', 'G12-N07: actual outer stdout/empty stderr') + current() + + def _g12_collect_complete_pair(): + """P06: complete original common AND diagnostics, followed by joint recheck.""" + nonlocal common, diagnostic, common_payload + _need(wait_completed and process.returncode == 0 and cleanup is not None and receipt is not None, + 'G12-N10: original successful owner/receipt join must precede pair') + science = _R + '/runtime/runs/' + selection['label'] + '/science' + for name in ('common', 'diagnostics'): + originals[name] = _read_file(science + '/g12-reference.' + name + '.json', _PAIR_CAP) + common, diagnostic, common_payload = _validate_pair(originals['common'][1], originals['diagnostics'][1]) + for name in ('common', 'diagnostics'): + _need(_read_file(originals[name][0]['path'], _PAIR_CAP) == originals[name], 'G12-N11: original joint pair changed') + current() + + def _g12_retain_parent_pair_and_evidence(): + """P07: fresh parent directory only after all selected writers are known closed.""" + nonlocal retained + _need(not _children() and cleanup['known_pidfds_closed'] and cleanup['known_streams_closed'], + 'G12-N08: no retained directory until known selected cleanup') + current() + retained = _exclusive_directory(selection['parent_retained_directory']) + for name in ('common', 'diagnostics'): + filename = 'g12-reference.' + name + '.json' + _copy_file(retained, filename, originals[name][1]) + record, raw = _read_file(selection['parent_retained_directory'] + '/' + filename, _PAIR_CAP, 0o444) + _need(raw == originals[name][1] and record['sha256'] == originals[name][0]['sha256'], 'G12-N14: complete retained pair readback') + retained_records[name] = record + observation_raw = _canonical({'schema': 'g12-known-chain-observations-v1', 'cleanup': cleanup, + 'observations': chain.observations}) + b'\n' + _copy_file(observation, 'owned-observations.json', observation_raw) + evidence['parent_owned_observations'] = _read_file(selection['parent_observation_directory'] + '/owned-observations.json', _META_CAP, 0o444) + costs = _actual_costs(entry_ns, own_start, children_start) + accounting_raw = _canonical(costs) + b'\n' + _copy_file(observation, 'preseal-accounting.json', accounting_raw) + evidence['parent_preseal_accounting'] = _read_file(selection['parent_observation_directory'] + '/preseal-accounting.json', _META_CAP, 0o444) + for name in _MANIFEST_SCHEMA['retained_evidence_exact_keys']: + _copy_file(retained, _EVIDENCE_NAMES[name], evidence[name][1]) + record, raw = _read_file(selection['parent_retained_directory'] + '/' + _EVIDENCE_NAMES[name], + max(len(evidence[name][1]), 1), 0o444) + _need(raw == evidence[name][1], 'G12-N14: raw evidence copy differs') + retained_records[name] = record + # Reserve BOTH metadata names before recording final directory identity. + # Existing FD writes/file chmod do not change parent directory entries. + for name in ('manifest.json', 'publication.json'): + reserved[name] = os.open(name, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW | os.O_CLOEXEC, + 0o600, dir_fd=retained[0][-1]) + os.fsync(retained[0][-1]) + current() + + def _g12_seal_once(): + """P08: private actual owner seal; returns only a candidate for later adoption.""" + nonlocal manifest, manifest_record, publication_record, candidate_pin, lease_closed + _need(process is not None and type(process) is subprocess.Popen and process.returncode == 0 and + wait_completed and primary is None and not secondaries and parent_stop is None and not _children() and + not outer and not chain.fds and not chain.unknown, 'G12-N08: actual owner final conjunction') + current() + for name, original in originals.items(): + _need(_read_file(original[0]['path'], _PAIR_CAP) == original, 'G12-N11: original pair final drift') + _need(_read_file(retained_records[name]['path'], _PAIR_CAP, 0o444)[0] == retained_records[name], + 'G12-N14: retained pair final drift') + for name, (record, raw) in source_records.items(): + _need(_read_file(record['path'], max(record['bytes'], 1), record['identity']['full_st_mode'] & 0o7777) == (record, raw), + 'G12-N02: complete selected source drift') + for record, raw in evidence.values(): + _need(_read_file(record['path'], max(record['bytes'], 1), record['identity']['full_st_mode'] & 0o7777) == (record, raw), + 'G12-N07: final complete original raw evidence drift') + for record in (stage_record, jobs_record, phase_record): + _need(_read_file(record['path'], _META_CAP, record['identity']['full_st_mode'] & 0o7777)[0] == record, + 'G12-N02: stage/jobs/phase final identity drift') + os.fchmod(retained[0][-1], 0o500) + # Update exactly our owned mode transition, retaining dev/inode binding. + parent, name, descriptor, old = retained[1][-1] + final_dir_info = os.fstat(descriptor) + _need((final_dir_info.st_dev, final_dir_info.st_ino) == old[:2], 'G12-N14: retained directory owner transition') + retained[1][-1] = (parent, name, descriptor, _directory_key(final_dir_info)) + os.fsync(descriptor) + directory_identity = _identity(final_dir_info) + costs = _actual_costs(entry_ns, own_start, children_start) + account = {'clock': 'monotonic_ns', 'parent_entry_ns': entry_ns, + 'preseal_end_ns': costs['through_ns'], 'parent_preseal_wall_ns': costs['wall_ns'], + 'parent_self_user_seconds': costs['self_user_seconds'], 'parent_self_system_seconds': costs['self_system_seconds'], + 'parent_children_user_seconds': costs['children_user_seconds'], 'parent_children_system_seconds': costs['children_system_seconds'], + 'parent_lifetime_max_rss_kib': costs['lifetime_max_rss_kib'], 'guard_usage': usage, + 'guard_runner_wall_seconds': receipt['runner_wall_seconds'], 'categories': list(_COST_CATEGORIES), + 'complete_tail_accounting_required': True, 'unmeasured_final_tail': None} + launch['launch_record'] = retained_records['parent_launch'] + cleanup['observations_record'] = retained_records['parent_owned_observations'] + manifest = {'schema': 'g12-parent-two-export-custody-v2', + 'invocation': {'stage': selection['stage'], 'job': selection['job'], 'label': selection['label'], + 'stage_sha256': selection['stage_sha256'], 'jobs_sha256': selection['jobs_sha256'], + 'launch_selection_sha256': selection_sha}, + 'selected_sources': selection['source_pins'], 'workload': _MANIFEST_SCHEMA['workload_values'], + 'launch': launch, 'terminal': {'actual_popen_returncode': process.returncode, 'wait_completed': wait_completed, + 'parent_stop': parent_stop, 'primary_error': None, 'secondary_errors': [], 'guard_receipt_missing': False}, + 'guard': {'start': retained_records['guard_START'], 'receipt': retained_records['guard_receipt'], + 'start_fields': start, 'receipt_fields': receipt, 'stdout': retained_records['guard_stdout'], + 'stderr': retained_records['guard_stderr'], 'usage': retained_records['guard_usage']}, + 'cleanup': cleanup, + 'pair': {name: {'original': originals[name][0], 'retained': retained_records[name]} for name in ('common', 'diagnostics')}, + 'retained_evidence': {name: retained_records[name] for name in _MANIFEST_SCHEMA['retained_evidence_exact_keys']}, + 'custody': {'retained_directory': selection['parent_retained_directory'], 'retained_directory_identity': directory_identity, + 'retained_file_mode': '0444', 'created_after_known_cleanup': True, 'source_selection_required': True, + 'known_close_policy': 'Any unknown close rejects publication'}, 'accounting': account, 'scope': _SCOPE} + manifest['pair']['common_payload_sha256'] = common['common_payload_sha256'] + _validate_manifest(manifest, selection['source_pins']['parent']['path'], selection['source_pins']['parent']['sha256']) + raw = _canonical(manifest) + b'\n' + _need(len(raw) <= _META_CAP, 'G12-N14: manifest finite metadata cap') + _write_fd(reserved['manifest.json'], raw) + os.close(reserved['manifest.json']) + del reserved['manifest.json'] + os.fsync(retained[0][-1]) + manifest_record, reread = _read_file(selection['parent_retained_directory'] + '/manifest.json', _META_CAP, 0o444) + _need(reread == raw, 'G12-N14: complete manifest readback') + current() + _need(not _children(), 'G12-N08: unexpected child at final lease close') + fcntl.flock(lease, fcntl.LOCK_UN) + os.close(lease) + lease_closed = True + costs = _actual_costs(entry_ns, own_start, children_start) + publication = {'schema': 'g12-parent-custody-publication-v2', + 'parent_source_sha256': selection['source_pins']['parent']['sha256'], 'launch_selection_sha256': selection_sha, + 'manifest_path': manifest_record['path'], 'manifest_sha256': manifest_record['sha256'], + 'manifest_bytes': manifest_record['bytes'], 'manifest_identity': manifest_record['identity'], + 'retained_pair_sha256': {name: retained_records[name]['sha256'] for name in ('common', 'diagnostics')}, + 'final_pair_recheck_complete': True, 'known_lease_close_completed': lease_closed, + 'primary_error': None, 'secondary_errors': [], 'measured_through_ns': costs['through_ns'], + 'actual_costs_through_ns': costs, 'unmeasured_final_tail': None, + 'complete_cost_qualification': False} + _validate_publication(publication, manifest, manifest_record) + publication_raw = _canonical(publication) + b'\n' + _need(len(publication_raw) <= _META_CAP, 'G12-N15: publication metadata cap') + _write_fd(reserved['publication.json'], publication_raw) + os.close(reserved['publication.json']) + del reserved['publication.json'] + os.fsync(retained[0][-1]) + publication_record, observed = _read_file(selection['parent_retained_directory'] + '/publication.json', _META_CAP, 0o444) + _need(observed == publication_raw and _identity(os.fstat(retained[0][-1])) == directory_identity, + 'G12-N15: final publication readback/directory identity') + current() + # This candidate is not a source selection or completed enclosing invoice. + candidate_pin = (manifest_record['path'], manifest_record['sha256'], manifest_record['bytes'], + tuple(manifest_record['identity'][k] for k in _ID_NAMES), selection['source_pins']['parent']['path'], + selection['source_pins']['parent']['sha256'], publication_record['path'], + publication_record['sha256'], publication_record['bytes']) + + def _g12_finish_failure(): + """P09: always preserve actual first failure, known cleanup and partial originals.""" + nonlocal lease_closed + # Every later error is retained separately; no receipt or PASS replacement. + if chain is not None and not chain.closed: + try: + chain.finish(process, selection['body_deadline_ns'] + selection['retention_tail_allowance_ns'], True) + except BaseException as error: + secondaries.append((error, error.__traceback__)) + for name, descriptor in tuple(outer.items()): + try: + os.close(descriptor) + del outer[name] + except BaseException as error: + secondaries.append((error, error.__traceback__)) + for name, descriptor in tuple(reserved.items()): + try: + os.close(descriptor) + del reserved[name] + except BaseException as error: + secondaries.append((error, error.__traceback__)) + if lease is not None and not lease_closed: + try: + os.close(lease) + lease_closed = True + except BaseException as error: + secondaries.append((error, error.__traceback__)) + # Failure-tail raw records are never advertised as canonical guard data. + if observation is not None and (primary is not None or secondaries): + try: + failures = {'schema': 'g12-parent-failed-attempt-v1', 'attempted': attempted, + 'actual_returncode': None if process is None else process.returncode, + 'primary': None if primary is None else repr(primary[0]), + 'ordered_secondaries': [repr(item[0]) for item in secondaries], + 'known_cleanup': 'UNKNOWN' if chain is None or not chain.closed else 'KNOWN_SELECTED_CHAIN_ONLY', + 'actual_costs_through_prewrite': _actual_costs(entry_ns, own_start, children_start), + 'enclosing_full_failure_tail_required': True} + _copy_file(observation, 'FAILED-ATTEMPT.json', _canonical(failures) + b'\n') + except BaseException as error: + secondaries.append((error, error.__traceback__)) + for domain in (science_directory, run_directory, retained, observation): + if domain is not None: + for descriptor in reversed(domain[0]): + try: + os.close(descriptor) + except BaseException as error: + secondaries.append((error, error.__traceback__)) + + try: + _g12_preflight_and_claim() + _g12_launch_once() + _g12_observe_wait_and_close() + _g12_join_original_guard_evidence() + _g12_collect_complete_pair() + _g12_retain_parent_pair_and_evidence() + _g12_seal_once() + except BaseException as error: + primary = error, error.__traceback__ + try: + _g12_finish_failure() + except BaseException as error: + # Preserve primary even if a secondary bookkeeping append itself failed. + if primary is None: + primary = error, error.__traceback__ + else: + try: + primary[0].add_note('P09 bookkeeping failure: ' + repr(error)) + except BaseException: + pass + _raise_preserved(primary, secondaries) + _need(candidate_pin is not None and lease_closed and not outer and not reserved, + 'G12-N15: final tail incomplete; manifest remains unselected') + return candidate_pin diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/integration/g12_reference_adapter_v1.py.txt b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/integration/g12_reference_adapter_v1.py.txt new file mode 100644 index 0000000000..2a6a222900 --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/integration/g12_reference_adapter_v1.py.txt @@ -0,0 +1,460 @@ +"""Fixed integration adapter: unchanged G12 producer under the actual injected Root. +SOURCE ONLY. The exact new stage is not mounted and no run is authorized. +""" +import os +import sys +import stat +import json +import hashlib +import math +from types import FunctionType, CodeType, ModuleType +_ROOT_PIN = 'f5a2d33f2b4d3651f214156a0e7094c2bb516ce2d5ab7698d18c11f98f35dee0' +_PROVIDER_PIN = '9cbb7368f89e71d1e6cc46db5dc77efed3e03ed2a801c98c88fe316e4d9f3ef2' +_PRODUCER_PIN = 'a346025d5b6e2b26246521c6af6292643a4c2c3286b33ff3996dcf051cd6be26' +_BOOTSTRAP = (bootstrap_root, bootstrap_capability, bootstrap_api) +_CHUNK = 65536 +_MISSING = object() +_ID_NAMES = ('dev', 'ino', 'full_st_mode', 'size', 'mtime_ns', 'ctime_ns') +_R = '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028' + +class _RawG12Errors: + """Fixed error-retention slots; storing raw failures precedes formatting/IO.""" + __slots__ = ('slots', 'count') + def __init__(self): + self.slots = [None] * 4096 + self.count = 0 + def append(self, value): + # All fixed directory/process/stream paths together have fewer than 4096 + # close sites under the 256-component/128-generation source ceilings. + if self.count >= len(self.slots): + raise RuntimeError('G12-N09: fixed raw secondary retention exhausted') + self.slots[self.count] = value + self.count += 1 + def __bool__(self): + return self.count != 0 + def __len__(self): + return self.count + def __getitem__(self, index): + if type(index) is not int or not 0 <= index < self.count: + raise IndexError(index) + return self.slots[index] + def __iter__(self): + for index in range(self.count): + yield self.slots[index] + def __repr__(self): + return repr(tuple(self)) + + +def _need(condition, message): + if not condition: + raise RuntimeError(message) + + +def _exact(value, expected): + if type(value) is not type(expected): + return False + if type(value) in (list, tuple): + return len(value) == len(expected) and all(_exact(a, b) for a, b in zip(value, expected)) + if type(value) is dict: + return set(value) == set(expected) and all(_exact(value[k], expected[k]) for k in expected) + return value == expected + + +def _fields(value, fields): + _need(type(value) is dict and all(type(k) is str for k in value) and + set(value) == set(fields), 'G12-N12: exact field domain differs') + + +def _digest(value): + return type(value) is str and len(value) == 64 and all(c in '0123456789abcdef' for c in value) + + +def _uint(value, positive=False): + _need(type(value) is int and value >= (1 if positive else 0), 'G12-N12: exact integer domain') + + +def _number(value): + _need(type(value) in (int, float) and math.isfinite(value) and value >= 0, + 'G12-N12: finite nonnegative exact number required') + + +def _path(path): + _need(type(path) is str and path.startswith('/') and + all(p not in ('', '.', '..') for p in path.split('/')[1:]), 'G12-N11: absolute canonical path') + return path + + +def _identity(info): + return dict(zip(_ID_NAMES, (info.st_dev, info.st_ino, info.st_mode, info.st_size, + info.st_mtime_ns, info.st_ctime_ns))) + + +def _directory_key(info): + return info.st_dev, info.st_ino, info.st_mode + + +def _directory_chain(path): + """Held no-follow chain; no later absolute path silently changes its owner.""" + _path(path) + _need(len(path.split('/')) <= 257, 'G12-N11: finite directory-component bound') + fds, rows = [], [] + primary = None + try: + fd = os.open('/', os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC) + fds.append(fd) + for part in path.split('/')[1:]: + before = os.stat(part, dir_fd=fd, follow_symlinks=False) + _need(stat.S_ISDIR(before.st_mode), 'G12-N11: directory component type') + child = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW | os.O_CLOEXEC, + dir_fd=fd) + fds.append(child) + opened = os.fstat(child) + _need(_directory_key(before) == _directory_key(opened), 'G12-N11: directory replaced') + rows.append((fd, part, child, _directory_key(opened))) + fd = child + return fds, rows + except BaseException as error: + primary = (error, error.__traceback__) + secondary = _RawG12Errors() + for descriptor in reversed(fds): + try: + os.close(descriptor) + except BaseException as error: + secondary.append((error, error.__traceback__)) + _raise_preserved(primary, secondary) + + +def _check_chain(rows): + for parent, name, descriptor, key in rows: + _need(_directory_key(os.fstat(descriptor)) == key == + _directory_key(os.stat(name, dir_fd=parent, follow_symlinks=False)), + 'G12-N11: directory binding changed') + + +def _raise_preserved(primary, secondaries): + """Never replace first raw failure if evidence formatting or retention fails.""" + if primary is not None: + error, traceback = primary + try: + error.add_note('G12 ordered secondary failures: ' + repr(secondaries)) + except BaseException: + pass + raise error.with_traceback(traceback) + if secondaries: + error, traceback = secondaries[0][:2] + raise error.with_traceback(traceback) + + +def _read_file(path, cap, mode=None): + _path(path) + parent, name = path.rsplit('/', 1) + fds, rows = _directory_chain(parent) + descriptor, primary, secondary, result = None, None, _RawG12Errors(), None + try: + before = os.stat(name, dir_fd=fds[-1], follow_symlinks=False) + _need(stat.S_ISREG(before.st_mode) and before.st_nlink == 1 and + 0 <= before.st_size <= cap and (mode is None or before.st_mode == stat.S_IFREG | mode), + 'G12-N11: regular-file size/mode/link domain') + descriptor = os.open(name, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK | os.O_CLOEXEC, + dir_fd=fds[-1]) + opened = os.fstat(descriptor) + _need(_identity(before) == _identity(opened) and opened.st_nlink == 1, + 'G12-N11: file changed on open') + count, blocks, hasher = 0, [], hashlib.sha256() + while count < opened.st_size: + block = os.read(descriptor, min(_CHUNK, opened.st_size - count)) + _need(bool(block), 'G12-N11: short file read') + count += len(block) + hasher.update(block) + blocks.append(block) + _need(os.read(descriptor, 1) == b'', 'G12-N11: file grew') + after = os.fstat(descriptor) + ending = os.stat(name, dir_fd=fds[-1], follow_symlinks=False) + _need(_identity(before) == _identity(after) == _identity(ending) and + after.st_nlink == ending.st_nlink == 1, 'G12-N11: full file identity changed') + _check_chain(rows) + result = ({'path': path, 'sha256': hasher.hexdigest(), 'bytes': count, + 'identity': _identity(after), 'nlink': 1}, b''.join(blocks)) + except BaseException as error: + primary = (error, error.__traceback__) + for fd in ([descriptor] if descriptor is not None else []) + list(reversed(fds)): + try: + os.close(fd) + except BaseException as error: + secondary.append((error, error.__traceback__)) + _raise_preserved(primary, secondary) + return result + + +def _pairs(items): + result = {} + for key, value in items: + _need(type(key) is str and key not in result, 'G12-N12: duplicate JSON key') + result[key] = value + return result + + +def _nonfinite(value): + raise ValueError('G12-N12: nonfinite JSON token: ' + value) + + +def _canonical(value): + return json.dumps(value, sort_keys=True, separators=(',', ':'), ensure_ascii=True, + allow_nan=False).encode('ascii') + + +def _json(raw, cap, canonical=False, newline=False): + _need(type(raw) is bytes and len(raw) <= cap, 'G12-N12: raw JSON bound') + # Scan lexical nesting before json.loads recursion or object materialization. + depth, quoted, escaped = 0, False, False + for char in raw: + if quoted: + if escaped: + escaped = False + elif char == 92: + escaped = True + elif char == 34: + quoted = False + elif char == 34: + quoted = True + elif char in (91, 123): + depth += 1 + _need(depth <= 256, 'G12-N12: JSON depth limit') + elif char in (93, 125): + depth -= 1 + _need(depth >= 0, 'G12-N12: JSON nesting') + _need(depth == 0 and not quoted, 'G12-N12: incomplete JSON') + value = json.loads(raw.decode('utf-8'), object_pairs_hook=_pairs, parse_constant=_nonfinite) + pending, count = [(value, 0)], 0 + while pending: + item, depth = pending.pop() + count += 1 + _need(count <= cap and depth <= 256, 'G12-N12: JSON node/depth limit') + if type(item) is dict: + pending.extend((x, depth + 1) for pair in item.items() for x in pair) + elif type(item) is list: + pending.extend((x, depth + 1) for x in item) + elif type(item) is str: + _need(len(item) <= cap, 'G12-N12: JSON string limit') + elif type(item) is float: + _need(math.isfinite(item), 'G12-N12: overflowed JSON number') + else: + _need(item is None or type(item) in (bool, int), 'G12-N12: JSON primitive') + if canonical: + _need(raw == _canonical(value) + (b'\n' if newline else b''), 'G12-N12: canonical JSON bytes') + return value + + +def _capture_graph(namespace): + """Capture the fixed own/JSON function graph before candidate exposure.""" + modules = (json, json.decoder, json.encoder, json.scanner, hashlib, os, stat, math) + tuple( + namespace[name] for name in ('subprocess', 'fcntl', 'signal', 'resource', 'time') if name in namespace) + namespaces = [namespace] + [module.__dict__ for module in modules] + namespaces.extend((json._default_decoder.__dict__, json._default_encoder.__dict__)) + records, members, seen = [], [], set() + for mapping in namespaces: + members.append((mapping, tuple(mapping.items()))) + for value in mapping.values(): + candidates = [value] + if type(value) is type: + candidates.extend(value.__dict__.values()) + if value.__module__ in (__name__, 'json.decoder', 'json.encoder', 'subprocess'): + members.append((value.__dict__, tuple(value.__dict__.items()))) + for function in candidates: + if type(function) is not FunctionType or id(function) in seen: + continue + seen.add(id(function)) + records.append((function, function.__code__, function.__globals__, function.__builtins__, + function.__defaults__, function.__kwdefaults__, function.__closure__, + tuple(function.__dict__.items()), + () if function.__kwdefaults__ is None else tuple(function.__kwdefaults__.items()), + () if function.__closure__ is None else tuple((c, c.cell_contents) for c in function.__closure__))) + data = tuple((name, _canonical(namespace[name])) for name in + ('_PAIR_SCHEMA', '_MANIFEST_SCHEMA', '_GUARD_SCHEMA', '_PUBLICATION_SCHEMA', + '_ENGINE_PINS', '_OTHER_SOURCE_PINS', '_ENV', '_EVIDENCE_NAMES') if name in namespace) + return tuple(records), tuple(members), data + + + +def _current_graph(graph): + records, members, data = graph + for mapping, rows in members: + # The capture itself is assigned once after this snapshot. + expected = dict(rows) + for name, value in rows: + _need(mapping.get(name, _MISSING) is value, 'G12-N04: captured namespace member changed: ' + name) + extra = set(mapping) - set(expected) + _need(not extra or mapping is globals() and extra == {'_INITIAL_GRAPH'}, + 'G12-N04: captured namespace census changed') + for name, expected in data: + _need(_canonical(globals()[name]) == expected, 'G12-N04: source-owned schema constant changed') + for f, code, namespace, builtin, defaults, kw, cells, attrs, kws, contents in records: + _need(f.__code__ is code and f.__globals__ is namespace and f.__builtins__ is builtin and + f.__defaults__ is defaults and f.__kwdefaults__ is kw and f.__closure__ is cells and + len(f.__dict__) == len(attrs), 'G12-N04: captured function graph changed') + for name, value in attrs: + _need(f.__dict__.get(name, _MISSING) is value, 'G12-N04: function attributes changed') + if kw is not None: + _need(len(kw) == len(kws), 'G12-N04: keyword-default census changed') + for name, value in kws: + _need(kw.get(name, _MISSING) is value, 'G12-N04: keyword defaults changed') + for cell, value in contents: + _need(cell.cell_contents is value, 'G12-N04: captured closure changed') + + + +def _source_code_shape(code): + _need(type(code) is CodeType, 'G12-N04: exact code type') + def constant(value): + kind = type(value) + if value is None or value is Ellipsis: + return ('singleton', value is Ellipsis) + if kind in (int, bool, str, bytes): + return (kind.__name__, value) + if kind is float: + return ('float', value.hex()) + if kind is tuple: + return ('tuple', tuple(constant(item) for item in value)) + if kind is frozenset: + return ('frozenset', tuple(sorted(constant(item) for item in value))) + if kind is CodeType: + return ('code', _source_code_shape(value)) + raise RuntimeError('G12-N04: unsupported source code constant') + return tuple(constant(value) for value in ( + code.co_argcount, code.co_posonlyargcount, code.co_kwonlyargcount, + code.co_nlocals, code.co_stacksize, code.co_flags, code.co_code, + code.co_names, code.co_varnames, code.co_freevars, code.co_cellvars, + code.co_exceptiontable, code.co_linetable, code.co_firstlineno, + code.co_filename, code.co_name, code.co_qualname, code.co_consts)) + + +def _authenticate_own_functions(root, api, source, path): + _need(api[0]() == _ROOT_PIN, 'G12-N04: Root before selected-source compilation') + code = root._COMPILE(source, path, 'exec', dont_inherit=True, optimize=0) + declared = {item.co_name: item for item in code.co_consts if type(item) is CodeType} + for name, function in tuple(globals().items()): + if type(function) is FunctionType and function.__globals__ is globals(): + _need(name in declared and function.__builtins__ is root.builtins.__dict__ and + _source_code_shape(function.__code__) == _source_code_shape(declared[name]), + 'G12-N04: actual entire own callable differs from selected source: ' + name) + _need(api[0]() == _ROOT_PIN, 'G12-N04: Root after selected-source compilation') + + + +def _g12_adapter_entry(): + root, capability, api = _BOOTSTRAP + _need(root is bootstrap_root and capability is bootstrap_capability and api is bootstrap_api and + type(root) is ModuleType and type(api) is tuple and len(api) == 4 and + all(type(f) is FunctionType and f.__globals__ is root.__dict__ for f in api), + 'G12-N04: unchanged initially injected actual bootstrap objects required') + _need(api[0]() == _ROOT_PIN and sys.flags.optimize == 0, 'G12-N02: Root/assertion source mismatch') + api[1](capability, _PROVIDER_PIN) + _current_graph(_INITIAL_GRAPH) + stage = _R + '/stages/g12-reference-custody-v1' + adapter = stage + '/integration/g12_reference_adapter_v1.py' + _need(__file__ == adapter and type(sys.argv) is list and len(sys.argv) == 5 and + sys.argv[0] == adapter and sys.argv[1] == '--output' and + sys.argv[3:] == ['--lanes', 'g12-reference'], 'G12-N03: exact original guard argv tail') + output = _path(sys.argv[2]) + prefix = _R + '/runtime/runs/' + _need(output.startswith(prefix) and output.endswith('/science'), 'G12-N03: selected guard science path') + label = output[len(prefix):-len('/science')] + _need(bool(label) and all(c in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_' for c in label), + 'G12-N03: fixed simple guard label') + parent_fds, parent_rows = _directory_chain(output.rsplit('/', 1)[0]) + primary, secondary = None, _RawG12Errors() + try: + try: + os.stat('science', dir_fd=parent_fds[-1], follow_symlinks=False) + except FileNotFoundError: + pass + else: + raise RuntimeError('G12-N05: prior science output exists') + _check_chain(parent_rows) + except BaseException as error: + primary = error, error.__traceback__ + for descriptor in reversed(parent_fds): + try: + os.close(descriptor) + except BaseException as error: + secondary.append((error, error.__traceback__)) + _raise_preserved(primary, secondary) + own_record, own_source = _read_file(adapter, 262144, 0o444) + stage_record, stage_raw = _read_file(stage + '/STAGE.json', 262144, 0o444) + declared = _json(stage_raw, 262144) + _need(declared['files']['integration/g12_reference_adapter_v1.py'] == + {'sha256': own_record['sha256'], 'mode': 0o444}, 'G12-N02: exact guard-selected adapter source') + _authenticate_own_functions(root, api, own_source, adapter) + producer_path = stage + '/baseline/full_driver.py' + source_record, source = _read_file(producer_path, 1048576, 0o444) + _need(source_record['sha256'] == _PRODUCER_PIN and source_record['bytes'] == 70246, + 'G12-N02: unchanged accepted producer bytes/mode') + _need(api[0]() == _ROOT_PIN, 'G12-N04: Root before source hashing') + digest, count, actual_source = root._hash_regular(producer_path, 1048576, True) + _need(digest == _PRODUCER_PIN and count == 70246 and actual_source == source, + 'G12-N02: original Root full source hash') + api[1](capability, _PROVIDER_PIN) + producer_argv = [producer_path, '--frozen-root', stage + '/baseline/frozen', + '--reference', stage + '/baseline/reference/certificates/complex-network.json', + '--mode', 'profile', '--output', output] + producer = root.ModuleType('__main__') + namespace = producer.__dict__ + namespace.update({'__file__': producer_path, '__name__': '__main__', + '__builtins__': root.builtins.__dict__, 'bootstrap_root': root, + 'bootstrap_capability': capability, 'bootstrap_api': api}) + argv_owner, modules_owner = sys.argv, sys.modules + prior_main = modules_owner['__main__'] + _need(prior_main.__dict__ is globals(), 'G12-N04: actual Root-installed adapter module owner') + code = root._COMPILE(source, producer_path, 'exec', dont_inherit=True, optimize=0) + _need(api[0]() == _ROOT_PIN, 'G12-N04: Root before unchanged producer entry') + primary, secondary = None, _RawG12Errors() + # Install precisely the two Root._entry alias slots. Do not intercept or + # reinterpret the producer completion marker; only its ordinary return wins. + sys.argv = producer_argv + modules_owner['__main__'] = producer + try: + root._EXEC(code, namespace) + _need(sys.argv is producer_argv and sys.modules is modules_owner and + modules_owner.get('__main__') is producer, 'G12-N09: producer alias ownership lost') + api[1](capability, _PROVIDER_PIN) + _need(api[0]() == _ROOT_PIN, 'G12-N09: Root after unchanged producer ordinary return') + _need(_read_file(producer_path, 1048576, 0o444) == (source_record, source), + 'G12-N09: producer source changed after return') + _need(root._hash_regular(producer_path, 1048576, False)[:2] == (_PRODUCER_PIN, 70246), + 'G12-N09: final actual Root full producer digest') + except BaseException as error: + primary = error, error.__traceback__ + # Each restoration is attempted independently; a foreign slot is never + # overwritten and a secondary cannot replace the retained original primary. + try: + _need(sys.argv is producer_argv, 'G12-N09: argv restoration owner lost') + sys.argv = argv_owner + except BaseException as error: + secondary.append((error, error.__traceback__)) + try: + _need(sys.modules is modules_owner and modules_owner.get('__main__') is producer, + 'G12-N09: module restoration owner lost') + modules_owner['__main__'] = prior_main + except BaseException as error: + secondary.append((error, error.__traceback__)) + try: + _current_graph(_INITIAL_GRAPH) + api[1](capability, _PROVIDER_PIN) + _need(api[0]() == _ROOT_PIN, 'G12-N09: final bootstrap currentness') + _need(_read_file(adapter, 262144, 0o444) == (own_record, own_source) and + _read_file(stage + '/STAGE.json', 262144, 0o444) == (stage_record, stage_raw), + 'G12-N09: adapter/stage source drift') + except BaseException as error: + secondary.append((error, error.__traceback__)) + if secondary: + try: + sys.stderr.write('G12 adapter ordered secondary errors: ' + repr(secondary) + '\n') + sys.stderr.flush() + except BaseException as error: + secondary.append((error, error.__traceback__)) + _raise_preserved(primary, secondary) + + +_INITIAL_GRAPH = _capture_graph(globals()) +if __name__ == '__main__': + _g12_adapter_entry() diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/FREEZE.json b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/FREEZE.json new file mode 100644 index 0000000000..9d62b1726b --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/FREEZE.json @@ -0,0 +1,22 @@ +{ + "files": { + "g12_reference_cold_consumer_v1.py": { + "bytes": 59367, + "mode": "0444", + "sha256": "70f16a3c6e699f7dfbf66137af957323e244d039a647e75e8481855e6d61a610" + }, + "g12_reference_parent_v1.py": { + "bytes": 92203, + "mode": "0444", + "sha256": "5210fe391ef0361639676f6736cd6de1a6dfcb1f6bdaa58f2ced086e7cc35859" + }, + "integration/g12_reference_adapter_v1.py": { + "bytes": 19770, + "mode": "0444", + "sha256": "055e8192e28f2076c45ca22cf4dd1692e0a10e93eb9a2a1153d84229a72ef6fa" + } + }, + "schema": "g12-pre-correction-unreviewed-source-snapshot-v1", + "status": "UNREVIEWED_SOURCE_ONLY_HISTORY_NOT_ADMITTED", + "target_operations": 0 +} diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/g12_reference_cold_consumer_v1.py.txt b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/g12_reference_cold_consumer_v1.py.txt new file mode 100644 index 0000000000..eebf9c2435 --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/g12_reference_cold_consumer_v1.py.txt @@ -0,0 +1,1069 @@ +"""Fixed G12 two-export consumer. SOURCE ONLY; all selections stay closed. + +The selected cold registered-source executor must inject the actual initial +Root/capability/API before candidate exposure, authenticate these exact source +bytes and this entry, and pass those same objects. Python shapes do not prove +that premise. No result registry, setter, caller success flag or new oracle. +""" +import os +import sys +import stat +import json +import hashlib +import math +from types import FunctionType, CodeType, ModuleType + +G12_REFERENCE_HANDOFF = None +# Future immutable nine-tuple exactly as accepted DESIGN-v1; never a setter. +G12_COLD_SOURCE_SELECTION = None +# Future immutable (absolute consumer path, full SHA256, byte count), independently +# pinned by the authenticated registered cold entry before this source executes. +_BOOTSTRAP = (globals().get('bootstrap_root'), globals().get('bootstrap_capability'), + globals().get('bootstrap_api')) +_ROOT_PIN = 'f5a2d33f2b4d3651f214156a0e7094c2bb516ce2d5ab7698d18c11f98f35dee0' +_PROVIDER_PIN = '9cbb7368f89e71d1e6cc46db5dc77efed3e03ed2a801c98c88fe316e4d9f3ef2' +_PRODUCER_PIN = 'a346025d5b6e2b26246521c6af6292643a4c2c3286b33ff3996dcf051cd6be26' +_GUARD_PIN = 'bd882e3dadb1b6aeaa63ee824f1a1c58f8ef2546b6840a2bffa46885a184d3eb' +_AUTHORITY_PIN = 'f279ab86fc17c6a517b035f19d56863919cbd8304de4e7d5332457c6159aec10' +_META_CAP = 262144 +_PAIR_CAP = 268435456 +_CHUNK = 65536 +_LOG_CAP = 2097152 +_MISSING = object() +_ID_NAMES = ('dev', 'ino', 'full_st_mode', 'size', 'mtime_ns', 'ctime_ns') +# BEGIN FIXED G12 FILE AND PAIR LEAF + +def _need(condition, message): + if not condition: + raise RuntimeError(message) + + +def _exact(value, expected): + if type(value) is not type(expected): + return False + if type(value) in (list, tuple): + return len(value) == len(expected) and all(_exact(a, b) for a, b in zip(value, expected)) + if type(value) is dict: + return set(value) == set(expected) and all(_exact(value[k], expected[k]) for k in expected) + return value == expected + + +def _fields(value, fields): + _need(type(value) is dict and all(type(k) is str for k in value) and + set(value) == set(fields), 'G12-N12: exact field domain differs') + + +def _digest(value): + return type(value) is str and len(value) == 64 and all(c in '0123456789abcdef' for c in value) + + +def _uint(value, positive=False): + _need(type(value) is int and value >= (1 if positive else 0), 'G12-N12: exact integer domain') + + +def _number(value): + _need(type(value) in (int, float) and math.isfinite(value) and value >= 0, + 'G12-N12: finite nonnegative exact number required') + + +def _path(path): + _need(type(path) is str and path.startswith('/') and + all(p not in ('', '.', '..') for p in path.split('/')[1:]), 'G12-N11: absolute canonical path') + return path + + +def _identity(info): + return dict(zip(_ID_NAMES, (info.st_dev, info.st_ino, info.st_mode, info.st_size, + info.st_mtime_ns, info.st_ctime_ns))) + + +def _directory_key(info): + return info.st_dev, info.st_ino, info.st_mode + + +def _directory_chain(path): + """Held no-follow chain; no later absolute path silently changes its owner.""" + _path(path) + fds, rows = [], [] + primary = None + try: + fd = os.open('/', os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC) + fds.append(fd) + for part in path.split('/')[1:]: + before = os.stat(part, dir_fd=fd, follow_symlinks=False) + _need(stat.S_ISDIR(before.st_mode), 'G12-N11: directory component type') + child = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW | os.O_CLOEXEC, + dir_fd=fd) + fds.append(child) + opened = os.fstat(child) + _need(_directory_key(before) == _directory_key(opened), 'G12-N11: directory replaced') + rows.append((fd, part, child, _directory_key(opened))) + fd = child + return fds, rows + except BaseException as error: + primary = (error, error.__traceback__) + secondary = [] + for descriptor in reversed(fds): + try: + os.close(descriptor) + except BaseException as error: + secondary.append((error, error.__traceback__)) + _raise_preserved(primary, secondary) + + +def _check_chain(rows): + for parent, name, descriptor, key in rows: + _need(_directory_key(os.fstat(descriptor)) == key == + _directory_key(os.stat(name, dir_fd=parent, follow_symlinks=False)), + 'G12-N11: directory binding changed') + + +def _raise_preserved(primary, secondaries): + """Never replace first raw failure if evidence formatting or retention fails.""" + if primary is not None: + error, traceback = primary + try: + error.add_note('G12 ordered secondary failures: ' + repr(secondaries)) + except BaseException: + pass + raise error.with_traceback(traceback) + if secondaries: + error, traceback = secondaries[0][:2] + raise error.with_traceback(traceback) + + +def _read_file(path, cap, mode=None): + _path(path) + parent, name = path.rsplit('/', 1) + fds, rows = _directory_chain(parent) + descriptor, primary, secondary, result = None, None, [], None + try: + before = os.stat(name, dir_fd=fds[-1], follow_symlinks=False) + _need(stat.S_ISREG(before.st_mode) and before.st_nlink == 1 and + 0 <= before.st_size <= cap and (mode is None or before.st_mode == stat.S_IFREG | mode), + 'G12-N11: regular-file size/mode/link domain') + descriptor = os.open(name, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK | os.O_CLOEXEC, + dir_fd=fds[-1]) + opened = os.fstat(descriptor) + _need(_identity(before) == _identity(opened) and opened.st_nlink == 1, + 'G12-N11: file changed on open') + count, blocks, hasher = 0, [], hashlib.sha256() + while count < opened.st_size: + block = os.read(descriptor, min(_CHUNK, opened.st_size - count)) + _need(bool(block), 'G12-N11: short file read') + count += len(block) + hasher.update(block) + blocks.append(block) + _need(os.read(descriptor, 1) == b'', 'G12-N11: file grew') + after = os.fstat(descriptor) + ending = os.stat(name, dir_fd=fds[-1], follow_symlinks=False) + _need(_identity(before) == _identity(after) == _identity(ending) and + after.st_nlink == ending.st_nlink == 1, 'G12-N11: full file identity changed') + _check_chain(rows) + result = ({'path': path, 'sha256': hasher.hexdigest(), 'bytes': count, + 'identity': _identity(after), 'nlink': 1}, b''.join(blocks)) + except BaseException as error: + primary = (error, error.__traceback__) + for fd in ([descriptor] if descriptor is not None else []) + list(reversed(fds)): + try: + os.close(fd) + except BaseException as error: + secondary.append((error, error.__traceback__)) + _raise_preserved(primary, secondary) + return result + + +def _file_record(value): + _fields(value, ('path', 'sha256', 'bytes', 'identity', 'nlink')) + _path(value['path']) + _need(_digest(value['sha256']) and type(value['nlink']) is int and value['nlink'] == 1, + 'G12-N11: file digest/link record') + _uint(value['bytes']) + _fields(value['identity'], _ID_NAMES) + for key in _ID_NAMES: + _need(type(value['identity'][key]) is int, 'G12-N11: exact stat value') + _uint(value['identity']['dev']) + _uint(value['identity']['ino'], True) + _need(stat.S_ISREG(value['identity']['full_st_mode']) and + value['identity']['size'] == value['bytes'], 'G12-N11: file identity size/type') + + +def _root_read(root, api, record, cap): + _file_record(record) + _need(api[0]() == _ROOT_PIN, 'G12-N04: actual Root currentness') + before = root._hash_regular(record['path'], cap, False) + observed, raw = _read_file(record['path'], cap, 0o444) + after = root._hash_regular(record['path'], cap, False) + _need(_exact(observed, record) and before[:2] == after[:2] == + (record['sha256'], record['bytes']), 'G12-N17: Root/read/full-identity join') + _need(api[0]() == _ROOT_PIN, 'G12-N04: actual Root changed after file read') + return raw + + +def _pairs(items): + result = {} + for key, value in items: + _need(type(key) is str and key not in result, 'G12-N12: duplicate JSON key') + result[key] = value + return result + + +def _nonfinite(value): + raise ValueError('G12-N12: nonfinite JSON token: ' + value) + + +def _canonical(value): + return json.dumps(value, sort_keys=True, separators=(',', ':'), ensure_ascii=True, + allow_nan=False).encode('ascii') + + +def _json(raw, cap, canonical=False, newline=False): + _need(type(raw) is bytes and len(raw) <= cap, 'G12-N12: raw JSON bound') + # Scan lexical nesting before json.loads recursion or object materialization. + depth, quoted, escaped = 0, False, False + for char in raw: + if quoted: + if escaped: + escaped = False + elif char == 92: + escaped = True + elif char == 34: + quoted = False + elif char == 34: + quoted = True + elif char in (91, 123): + depth += 1 + _need(depth <= 256, 'G12-N12: JSON depth limit') + elif char in (93, 125): + depth -= 1 + _need(depth >= 0, 'G12-N12: JSON nesting') + _need(depth == 0 and not quoted, 'G12-N12: incomplete JSON') + value = json.loads(raw.decode('utf-8'), object_pairs_hook=_pairs, parse_constant=_nonfinite) + pending, count = [(value, 0)], 0 + while pending: + item, depth = pending.pop() + count += 1 + _need(count <= cap and depth <= 256, 'G12-N12: JSON node/depth limit') + if type(item) is dict: + pending.extend((x, depth + 1) for pair in item.items() for x in pair) + elif type(item) is list: + pending.extend((x, depth + 1) for x in item) + elif type(item) is str: + _need(len(item) <= cap, 'G12-N12: JSON string limit') + elif type(item) is float: + _need(math.isfinite(item), 'G12-N12: overflowed JSON number') + else: + _need(item is None or type(item) in (bool, int), 'G12-N12: JSON primitive') + if canonical: + _need(raw == _canonical(value) + (b'\n' if newline else b''), 'G12-N12: canonical JSON bytes') + return value + + +def _hex(value, cap): + _need(type(value) is str and len(value) <= cap and len(value) % 2 == 0 and + all(c in '0123456789abcdef' for c in value), 'G12-N12: complete lowercase hex') + return bytes.fromhex(value) + + +def _decimal(value, positive=False): + _need(type(value) is str and bool(value), 'G12-N12: integer tag text') + digits = value[1:] if value.startswith('-') else value + _need(bool(digits) and all(c in '0123456789' for c in digits) and + (digits == '0' or digits[0] != '0') and value != '-0' and + (not positive or (not value.startswith('-') and value != '0')), 'G12-N12: canonical integer') + + +def _tagged(raw, cap): + value = _json(raw, cap, True) + pending = [(value, 0)] + count = 0 + while pending: + node, depth = pending.pop() + count += 1 + _need(count <= cap and depth <= 256 and type(node) is list and len(node) >= 1 and + type(node[0]) is str, 'G12-N12: tagged primitive bound/shape') + tag = node[0] + if tag == 'None': + _need(len(node) == 1, 'G12-N12: None arity') + continue + _need(len(node) == (3 if tag == 'Fraction' else 2), 'G12-N12: primitive arity') + arg = node[1] + if tag == 'bool': + _need(type(arg) is bool, 'G12-N12: bool tag') + elif tag == 'int': + _decimal(arg) + elif tag == 'Fraction': + _decimal(arg) + _decimal(node[2], True) + elif tag == 'str': + _need(type(arg) is str, 'G12-N12: string tag') + elif tag == 'bytes': + _hex(arg, cap) + elif tag == 'float': + _need(type(arg) is str and float.fromhex(arg).hex() == arg, 'G12-N12: float.hex domain') + elif tag in ('tuple', 'list'): + _need(type(arg) is list, 'G12-N12: sequence tag') + pending.extend((item, depth + 1) for item in arg) + elif tag == 'dict': + _need(type(arg) is list, 'G12-N12: ordered dict tag') + for pair in arg: + _need(type(pair) is list and len(pair) == 2, 'G12-N12: dict pair') + pending.extend((item, depth + 1) for item in pair) + else: + raise ValueError('G12-N12: unknown primitive tag') + return value + + +def _rank_events(encoded): + value = _tagged(_hex(encoded, _PAIR_CAP), _PAIR_CAP) + _need(value[0] == 'tuple', 'G12-N12: rank tuple') + for event in value[1]: + _need(event[0] == 'tuple' and len(event[1]) == 2 and event[1][0][0] == 'tuple' and + all(x[0] == 'int' for x in event[1][0][1]) and event[1][1][0] == 'int', + 'G12-N12: rank-event grammar') + return len(value[1]) + + +def _validate_pair(common_raw, diagnostic_raw): + common = _json(common_raw, _PAIR_CAP, True, True) + diagnostic = _json(diagnostic_raw, _PAIR_CAP, True, True) + spec = _PAIR_SCHEMA + _fields(common, spec['common_exact_fields']) + _fields(diagnostic, spec['diagnostic_exact_fields']) + for key, expected in spec['common_constants'].items(): + _need(_exact(common[key], expected), 'G12-N13: original common source/workload binding') + for key, expected in spec['diagnostic_constants'].items(): + _need(_exact(diagnostic[key], expected), 'G12-N13: diagnostic source/role binding') + _need(type(common['literal_original_value']) is bool, 'G12-N12: observed literal exact bool') + _uint(common['remaining_original_case_count'], True) + payload = _hex(common['common_payload_hex'], _PAIR_CAP) + _need(_digest(common['common_payload_sha256']) and + hashlib.sha256(payload).hexdigest() == common['common_payload_sha256'] == + diagnostic['common_payload_sha256'], 'G12-N13: complete common digest join') + tagged = _tagged(payload, _PAIR_CAP) + _need(tagged[0] == 'tuple' and len(tagged[1]) == 10, 'G12-N13: common tuple arity') + prefix = [['str', 'g12-original-remainder-common-v1'], + ['tuple', [['str', p] for p in spec['common_constants']['original_scientific_pins']]], + ['int', '25'], ['tuple', [['int', '0'], ['int', '2'], ['int', '1']]]] + _need(_exact(tagged[1][:4], prefix), 'G12-N13: common inner source/workload prefix') + suffix = ['tuple', [['str', name] for name in ('verify_role_frames', 'full_log_integer_bounds', + 'original_upstream_verify_sources', 'original_serializable', 'complete_original_cli')]] + _need(_exact(tagged[1][-1], suffix), 'G12-N13: original suffix phase order') + for key in ('prefix_end', 'suffix_start', 'cli_end'): + row = diagnostic[key] + _fields(row, spec['diagnostic_snapshot_exact_fields']) + _uint(row['rank_event_count']) + _need(_rank_events(row['ordered_rank_events_hex']) == row['rank_event_count'] and + row['native_binding'] is None and row['cache_binding'] is None, + 'G12-N12: original diagnostic rank/binding domain') + receipt = row['complement_receipt'] + _fields(receipt, spec['complement_receipt_exact_fields']) + _uint(receipt['calls']) + _uint(receipt['canonical_stream_bytes']) + _need(_digest(receipt['sha256']) and receipt['schema'] == + 'v2-jsonl:call,us,vs,result(type=list+values or type=None); ordered exact integer vectors', 'G12-N12: complement receipt') + _rank_events(diagnostic['ordered_rank_suffix_hex']) + _fields(diagnostic['phases'], spec['phase_exact_names']) + for row in diagnostic['phases'].values(): + _fields(row, ('calls', 'wall_seconds', 'cpu_seconds_with_children')) + _need(type(row['calls']) is int and row['calls'] == 1, 'G12-N12: phase calls') + _number(row['wall_seconds']) + _number(row['cpu_seconds_with_children']) + return common, diagnostic, payload + + +def _source_pin(value): + _fields(value, ('path', 'sha256', 'bytes', 'mode')) + _path(value['path']) + _uint(value['bytes']) + _need(_digest(value['sha256']) and type(value['mode']) is str and len(value['mode']) == 4 and + all(c in '01234567' for c in value['mode']), 'G12-N02: exact source pin') + + +def _validate_guard(start, receipt, usage, stdout, stderr, root_argv, invocation, source_pins, phase_sha): + _fields(start, _GUARD_SCHEMA['START_exact_fields']) + _fields(receipt, _GUARD_SCHEMA['receipt_exact_fields']) + _fields(usage, ('user_seconds', 'system_seconds', 'kernel_max_rss_kib', 'exit')) + for key in start: + _need(_exact(start[key], receipt[key]), 'G12-N07: original START/receipt field join') + for key, expected in _GUARD_SCHEMA['required_values'].items(): + _need(_exact(receipt[key], expected), 'G12-N07: original guard success predicate') + for key in ('job', 'label', 'stage_sha256'): + _need(_exact(start[key], invocation[key]), 'G12-N07: selected invocation mismatch') + expected_launch = {'contract': 'trusted-clean-nosite-safe-path-fixedseed-v1', + 'no_site': 1, 'no_user_site': 1, 'safe_path': True, 'ignore_environment': 0, + 'isolated': 0, 'hash_seed_environment': '0', 'hash_randomization': 0, + 'initial_sys_path': ['/usr/lib/python312.zip', '/usr/lib/python3.12', '/usr/lib/python3.12/lib-dynload'], + 'environment': dict(_ENV), + 'trust_boundary': 'Authenticated parent launcher, OS, interpreter and system stdlib before this module; no Python self-authentication claim'} + _need(_exact(start['parent_launch'], expected_launch), 'G12-N07: exact original clean parent launch') + _need(_exact(start['command'], root_argv) and start['runner_sha256'] == _GUARD_PIN and + start['budget_phase_sha256'] == phase_sha and _digest(start['fractions_sha256']), + 'G12-N07: selected command/source/phase binding') + _need(type(start['phase_cap_seconds']) is int and start['phase_cap_seconds'] in (600, 2400), + 'G12-N05: original aggregate cap') + _number(start['spent_before_seconds']) + _need(start['spent_before_seconds'] < start['phase_cap_seconds'], 'G12-N05: consumed budget') + for key in ('wall_seconds', 'runner_wall_seconds', 'runner_user_seconds', 'runner_system_seconds', + 'runner_lifetime_max_rss_kib', 'sampled_process_group_rss_bytes'): + _number(receipt[key]) + limit = min(180, start['phase_cap_seconds'] - start['spent_before_seconds']) + _need(receipt['wall_seconds'] <= limit and receipt['runner_wall_seconds'] <= limit and + receipt['runner_lifetime_max_rss_kib'] * 1024 <= 1073741824 and + receipt['sampled_process_group_rss_bytes'] <= 1073741824, + 'G12-N07: original guard resource caps') + for key in ('user_seconds', 'system_seconds', 'kernel_max_rss_kib'): + _number(usage[key]) + _need(type(usage['exit']) is int and usage['exit'] == 0 and _exact(usage, receipt['usage']), + 'G12-N07: complete original usage join') + for name, raw in (('stdout', stdout), ('stderr', stderr)): + _need(len(raw) <= _LOG_CAP and receipt[name + '_bytes'] == len(raw) and + type(receipt[name + '_bytes']) is int and receipt[name + '_final_bytes'] == len(raw) and + type(receipt[name + '_final_bytes']) is int and + receipt[name + '_sha256'] == hashlib.sha256(raw).hexdigest(), 'G12-N07: complete raw log join') + _need(stderr == b'' and type(receipt['python']) is str and type(receipt['platform']) is str, + 'G12-N07: original stderr/platform fields') + + +def _capture_graph(namespace): + """Capture the fixed own/JSON function graph before candidate exposure.""" + modules = (json, json.decoder, json.encoder, json.scanner, hashlib, os, stat, math) + namespaces = [namespace] + [module.__dict__ for module in modules] + records, members, seen = [], [], set() + for mapping in namespaces: + members.append((mapping, tuple(mapping.items()))) + for value in mapping.values(): + candidates = [value] + if type(value) is type: + candidates.extend(value.__dict__.values()) + if value.__module__ in (__name__, 'json.decoder', 'json.encoder'): + members.append((value.__dict__, tuple(value.__dict__.items()))) + for function in candidates: + if type(function) is not FunctionType or id(function) in seen: + continue + seen.add(id(function)) + records.append((function, function.__code__, function.__globals__, function.__builtins__, + function.__defaults__, function.__kwdefaults__, function.__closure__, + tuple(function.__dict__.items()), + () if function.__kwdefaults__ is None else tuple(function.__kwdefaults__.items()), + () if function.__closure__ is None else tuple((c, c.cell_contents) for c in function.__closure__))) + return tuple(records), tuple(members) + + +def _current_graph(graph): + records, members = graph + for mapping, rows in members: + # The capture itself is assigned once after this snapshot. + expected = dict(rows) + for name, value in rows: + _need(mapping.get(name, _MISSING) is value, 'G12-N04: captured namespace member changed: ' + name) + extra = set(mapping) - set(expected) + _need(not extra or mapping is globals() and extra == {'_INITIAL_GRAPH'}, + 'G12-N04: captured namespace census changed') + for f, code, namespace, builtin, defaults, kw, cells, attrs, kws, contents in records: + _need(f.__code__ is code and f.__globals__ is namespace and f.__builtins__ is builtin and + f.__defaults__ is defaults and f.__kwdefaults__ is kw and f.__closure__ is cells and + len(f.__dict__) == len(attrs), 'G12-N04: captured function graph changed') + for name, value in attrs: + _need(f.__dict__.get(name, _MISSING) is value, 'G12-N04: function attributes changed') + if kw is not None: + _need(len(kw) == len(kws), 'G12-N04: keyword-default census changed') + for name, value in kws: + _need(kw.get(name, _MISSING) is value, 'G12-N04: keyword defaults changed') + for cell, value in contents: + _need(cell.cell_contents is value, 'G12-N04: captured closure changed') +# END FIXED G12 FILE AND PAIR LEAF + +_PAIR_SCHEMA = {'common_constants': {'authority_source_sha256': 'f279ab86fc17c6a517b035f19d56863919cbd8304de4e7d5332457c6159aec10', + 'extra_target': [0, 2, 1], + 'h': 25, + 'literal_original_type': 'bool', + 'original_driver_sha256': '0d976d2eb6b845f20d4a3396591a806f966688b88693cd6a5f8a0c9e48925e36', + 'original_scientific_pins': ['d623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1', + '0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b', + '88bba3caf5975f30fa7abceaea9454110cf3b069233e8241a2ca13d1dff171a7', + 'adc7f1241b42e322a6451854ab7e4b4c146bf78a'], + 'producer_role': 'independent-original-uncached', + 'schema': 'g12-independent-original-reference-envelope-v1', + 'scope': 'Actual original N22 literal and P07 common remainder observations only; ' + 'no original PROFILE_ANCHOR_PASS, FULL_PASS, native qualification or G12 ' + 'approval.', + 'selected_driver_sha256': 'a346025d5b6e2b26246521c6af6292643a4c2c3286b33ff3996dcf051cd6be26'}, + 'common_exact_fields': ['schema', + 'producer_role', + 'selected_driver_sha256', + 'original_driver_sha256', + 'authority_source_sha256', + 'original_scientific_pins', + 'h', + 'extra_target', + 'literal_original_type', + 'literal_original_value', + 'remaining_original_case_count', + 'common_payload_sha256', + 'common_payload_hex', + 'scope'], + 'complement_receipt_exact_fields': ['calls', 'canonical_stream_bytes', 'sha256', 'schema'], + 'diagnostic_constants': {'complement_suffix_limit': 'Only cumulative original start/end receipts; no ' + 'digest subtraction or suffix-stream claim.', + 'completion': 'Exact source-owned intentional marker followed by original ' + 'finally, exact observer restoration, both cold2 checks and ' + 'original source/output custody.', + 'producer_role': 'independent-original-uncached', + 'schema': 'g12-independent-original-reference-diagnostics-v1', + 'selected_driver_sha256': 'a346025d5b6e2b26246521c6af6292643a4c2c3286b33ff3996dcf051cd6be26'}, + 'diagnostic_exact_fields': ['schema', + 'producer_role', + 'selected_driver_sha256', + 'common_payload_sha256', + 'prefix_end', + 'suffix_start', + 'cli_end', + 'ordered_rank_suffix_hex', + 'complement_suffix_limit', + 'phases', + 'completion'], + 'diagnostic_snapshot_exact_fields': ['rank_event_count', + 'ordered_rank_events_hex', + 'complement_receipt', + 'native_binding', + 'cache_binding'], + 'phase_exact_names': ['input_custody', + 'engine_custody', + 'fresh_root_copy', + 'fresh_engine_copy', + 'cold_engine_import', + 'cold_complex_module_load', + 'cold_certify_import', + 'cold_prepare_import', + 'side_construction', + 'checks_initialization', + 'compile_roles', + 'verify_map', + 'verify_labels', + 'verify_role_frames', + 'original_upstream_verify_sources', + 'full_log_integer_bounds', + 'original_serializable', + 'complete_original_cli']} + +_MANIFEST_SCHEMA = {'accounting_exact_fields': ['clock', + 'parent_entry_ns', + 'preseal_end_ns', + 'parent_preseal_wall_ns', + 'parent_self_user_seconds', + 'parent_self_system_seconds', + 'parent_children_user_seconds', + 'parent_children_system_seconds', + 'parent_lifetime_max_rss_kib', + 'guard_usage', + 'guard_runner_wall_seconds', + 'categories', + 'complete_tail_accounting_required', + 'enclosing_accounting_source_pin'], + 'cleanup_exact_fields': ['operating_premises', + 'owned_generations', + 'observed_groups', + 'remaining', + 'current_children', + 'known_streams_closed', + 'known_pidfds_closed', + 'io_unknown', + 'lease_identity', + 'science_directory_identity', + 'observations_record'], + 'custody_exact_fields': ['retained_directory', + 'retained_directory_identity', + 'retained_file_mode', + 'created_after_known_cleanup', + 'source_selection_required', + 'known_close_policy'], + 'exact_top_level_fields': ['schema', + 'invocation', + 'selected_sources', + 'workload', + 'launch', + 'terminal', + 'guard', + 'cleanup', + 'pair', + 'retained_evidence', + 'custody', + 'accounting', + 'scope'], + 'guard_exact_fields': ['start', + 'receipt', + 'start_fields', + 'receipt_fields', + 'stdout', + 'stderr', + 'usage'], + 'invocation_exact_fields': ['stage', + 'job', + 'label', + 'stage_sha256', + 'jobs_sha256', + 'launch_selection_sha256'], + 'launch_exact_fields': ['parent_pid', + 'parent_start_ticks', + 'guard_pid', + 'guard_start_ticks', + 'guard_pgid', + 'guard_sid', + 'parent_guard_argv', + 'guard_root_argv', + 'adapter_producer_argv', + 'cwd', + 'environment', + 'flags', + 'launch_record'], + 'pair_exact_fields': ['common', 'diagnostics', 'common_payload_sha256'], + 'retained_evidence_exact_keys': ['guard_START', + 'guard_receipt', + 'guard_stdout', + 'guard_stderr', + 'guard_usage', + 'parent_launch', + 'parent_outer_stdout', + 'parent_outer_stderr', + 'parent_owned_observations', + 'parent_preseal_accounting'], + 'schema_literal': 'g12-parent-two-export-custody-v1', + 'selected_sources_exact_fields': ['parent', + 'guard', + 'root', + 'provider', + 'adapter', + 'producer', + 'authority', + 'source_pins', + 'reference', + 'engine', + 'runtime_profile', + 'cleanup_leaf_origin'], + 'terminal_exact_fields': ['actual_popen_returncode', + 'wait_completed', + 'parent_stop', + 'primary_error', + 'secondary_errors', + 'guard_receipt_missing'], + 'workload_exact_fields': ['role', + 'h', + 'extra_target', + 'mode', + 'anchor', + 'optimize', + 'original_scientific_pins'], + 'workload_values': {'anchor': None, + 'extra_target': [0, 2, 1], + 'h': 25, + 'mode': 'profile', + 'optimize': 0, + 'original_scientific_pins': ['d623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1', + '0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b', + '88bba3caf5975f30fa7abceaea9454110cf3b069233e8241a2ca13d1dff171a7', + 'adc7f1241b42e322a6451854ab7e4b4c146bf78a'], + 'role': 'independent-original-uncached'}} + +_GUARD_SCHEMA = {'START_exact_fields': ['command', + 'parent_launch', + 'stage_sha256', + 'runner_sha256', + 'fractions_sha256', + 'budget_phase_sha256', + 'spent_before_seconds', + 'phase_cap_seconds', + 'job', + 'label'], + 'receipt_exact_fields': ['command', + 'parent_launch', + 'stage_sha256', + 'runner_sha256', + 'fractions_sha256', + 'budget_phase_sha256', + 'spent_before_seconds', + 'phase_cap_seconds', + 'job', + 'label', + 'exit', + 'wall_seconds', + 'usage', + 'termination', + 'sampled_process_group_rss_bytes', + 'source_bytes_and_modes_unchanged', + 'stdout_sha256', + 'stdout_bytes', + 'stderr_sha256', + 'stderr_bytes', + 'stdout_final_bytes', + 'stderr_final_bytes', + 'retained_log_bytes_stable', + 'output_cap_observed_at', + 'log_read_chunk_bytes', + 'runner_wall_seconds', + 'runner_user_seconds', + 'runner_system_seconds', + 'runner_lifetime_max_rss_kib', + 'python', + 'platform', + 'status'], + 'required_values': {'exit': 0, + 'log_read_chunk_bytes': 65536, + 'output_cap_observed_at': None, + 'retained_log_bytes_stable': True, + 'source_bytes_and_modes_unchanged': True, + 'status': 'PASS', + 'stderr_bytes': 0, + 'stderr_final_bytes': 0, + 'termination': None}} + +_PUBLICATION_SCHEMA = {'exact_fields': ['schema', + 'parent_source_sha256', + 'launch_selection_sha256', + 'manifest_path', + 'manifest_sha256', + 'manifest_bytes', + 'manifest_identity', + 'retained_pair_sha256', + 'final_pair_recheck_complete', + 'known_lease_close_completed', + 'primary_error', + 'secondary_errors', + 'measured_through_ns', + 'actual_costs_through_ns', + 'enclosing_accounting_source_pin', + 'enclosing_tail_join_required'], + 'schema_literal': 'g12-parent-custody-publication-v1'} + +_COST_CATEGORIES = ('source/stage/plan/authentication and dependency preflight', 'parent invocation setup and known lease operations', 'adapter bootstrap source read/hash/compile/exec and argv/module alias custody/restoration', 'entire independent uncached reference including fresh copies/engine imports/original CLI/trace capture/original checks/finally/restoration/cold2', 'guard launch/time/monitoring/STOP/final original source inventory/usage/raw-log hashing/receipt', 'actual parent wait and known descendant/group/FD cleanup', 'canonical receipt and START joins plus all complete raw evidence retention', 'both exports full reads/hashes/JSON/schema/payload decode/crosslinks and repeated pair checks', 'new parent copies/write/fsync/chmod/close/directory sync/readback', 'manifest schema/write/hash/fsync/close/readback and source-selection publication tail', 'parent failure/secondary-error retention and necessary cleanup after deadline', 'cold consumer complete manifest/pair/publication read/hash/parse/decode/recheck and all retained alias lifetimes') + + +def _validate_manifest(manifest, parent_path, parent_sha): + spec = _MANIFEST_SCHEMA + _fields(manifest, spec['exact_top_level_fields']) + _need(manifest['schema'] == spec['schema_literal'], 'G12-N12: custody schema') + for name in ('invocation', 'selected_sources', 'workload', 'launch', 'terminal', 'guard', + 'cleanup', 'pair', 'custody', 'accounting'): + _fields(manifest[name], spec[name + '_exact_fields']) + _fields(manifest['retained_evidence'], spec['retained_evidence_exact_keys']) + _need(_exact(manifest['workload'], spec['workload_values']), 'G12-N13: fixed workload') + invocation = manifest['invocation'] + _need(invocation['stage'] == 'g12-reference-custody-v1' and invocation['job'] == 'g12-reference' and + type(invocation['label']) is str and bool(invocation['label']) and + all(c in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_' for c in invocation['label']), + 'G12-N13: fixed invocation role') + for name in ('stage_sha256', 'jobs_sha256', 'launch_selection_sha256'): + _need(_digest(invocation[name]), 'G12-N12: invocation digest') + sources = manifest['selected_sources'] + for name, pin in sources.items(): + if name != 'engine': + _source_pin(pin) + for name, expected in (('guard', _GUARD_PIN), ('root', _ROOT_PIN), ('provider', _PROVIDER_PIN), + ('producer', _PRODUCER_PIN), ('authority', _AUTHORITY_PIN)): + _need(sources[name]['sha256'] == expected and sources[name]['mode'] == '0444', + 'G12-N02: selected original source mismatch') + _need(sources['producer']['bytes'] == 70246 and sources['parent']['path'] == parent_path and + sources['parent']['sha256'] == parent_sha, 'G12-N02: selected producer/parent identity') + _need(_exact(sources['engine'], _ENGINE_PINS), 'G12-N02: exact original engine source pins') + for name, expected in _OTHER_SOURCE_PINS.items(): + _need(sources[name]['sha256'] == expected, 'G12-N02: selected original dependency mismatch') + terminal = {'actual_popen_returncode': 0, 'wait_completed': True, 'parent_stop': None, + 'primary_error': None, 'secondary_errors': [], 'guard_receipt_missing': False} + _need(_exact(manifest['terminal'], terminal), 'G12-N06: authenticated terminal data rejects') + cleanup = manifest['cleanup'] + _need(_exact(cleanup['remaining'], []) and _exact(cleanup['current_children'], []) and + cleanup['known_streams_closed'] is True and cleanup['known_pidfds_closed'] is True and + cleanup['io_unknown'] is False and type(cleanup['owned_generations']) is list and + bool(cleanup['owned_generations']) and _exact(cleanup['operating_premises'], _OPERATING_PREMISES), + 'G12-N08: known selected chain custody rejects') + for name in ('parent_pid', 'parent_start_ticks', 'guard_pid', 'guard_start_ticks', 'guard_pgid', 'guard_sid'): + _uint(manifest['launch'][name], True) + label = invocation['label'] + stage = _R + '/stages/g12-reference-custody-v1' + science = _R + '/runtime/runs/' + label + '/science' + parent_argv, root_argv, producer_argv = _fixed_argv(label, sources) + launch = manifest['launch'] + _need(_exact(launch['parent_guard_argv'], parent_argv) and _exact(launch['guard_root_argv'], root_argv) and + _exact(launch['adapter_producer_argv'], producer_argv) and launch['cwd'] == _R and + _exact(launch['environment'], _ENV) and _exact(launch['flags'], list(_FLAGS)), + 'G12-N03: exact fixed launch/adapter argv') + retained = _R + '/runtime/g12-reference-parent-custody-v1/' + label + custody = manifest['custody'] + _need(custody['retained_directory'] == retained and custody['retained_file_mode'] == '0444' and + custody['created_after_known_cleanup'] is True and custody['source_selection_required'] is True and + custody['known_close_policy'] == 'Any unknown close rejects publication', 'G12-N14: custody ownership') + _fields(custody['retained_directory_identity'], _ID_NAMES) + _need(custody['retained_directory_identity']['full_st_mode'] == stat.S_IFDIR | 0o500, + 'G12-N14: final retained directory mode') + for name in ('common', 'diagnostics'): + pair = manifest['pair'][name] + _fields(pair, ('original', 'retained')) + _file_record(pair['original']) + _file_record(pair['retained']) + filename = 'g12-reference.' + name + '.json' + _need(pair['original']['path'] == science + '/' + filename and + pair['retained']['path'] == retained + '/' + filename and + pair['original']['sha256'] == pair['retained']['sha256'] and + pair['original']['bytes'] == pair['retained']['bytes'] and + pair['retained']['identity']['full_st_mode'] == stat.S_IFREG | 0o444, + 'G12-N13: original/retained complete pair join') + _need(_digest(manifest['pair']['common_payload_sha256']), 'G12-N13: payload pin') + for name, record in manifest['retained_evidence'].items(): + _file_record(record) + _need(record['path'] == retained + '/' + _EVIDENCE_NAMES[name] and + record['identity']['full_st_mode'] == stat.S_IFREG | 0o444, + 'G12-N14: retained raw evidence path/mode') + for name, evidence_name in (('start', 'guard_START'), ('receipt', 'guard_receipt'), + ('stdout', 'guard_stdout'), ('stderr', 'guard_stderr'), ('usage', 'guard_usage')): + _need(_exact(manifest['guard'][name], manifest['retained_evidence'][evidence_name]), + 'G12-N07: guard retained record join') + _need(_exact(launch['launch_record'], manifest['retained_evidence']['parent_launch']) and + _exact(cleanup['observations_record'], manifest['retained_evidence']['parent_owned_observations']), + 'G12-N08: parent observation record join') + account = manifest['accounting'] + _need(account['clock'] == 'monotonic_ns' and account['complete_tail_accounting_required'] is True and + _exact(account['categories'], list(_COST_CATEGORIES)), 'G12-N15: full cost categories/tail') + for name in ('parent_entry_ns', 'preseal_end_ns', 'parent_preseal_wall_ns'): + _uint(account[name]) + _need(account['preseal_end_ns'] >= account['parent_entry_ns'] and + account['parent_preseal_wall_ns'] == account['preseal_end_ns'] - account['parent_entry_ns'], + 'G12-N15: actual parent clock endpoints') + for name in ('parent_self_user_seconds', 'parent_self_system_seconds', 'parent_children_user_seconds', + 'parent_children_system_seconds', 'parent_lifetime_max_rss_kib', 'guard_runner_wall_seconds'): + _number(account[name]) + _source_pin(account['enclosing_accounting_source_pin']) + _need(_exact(account['guard_usage'], manifest['guard']['receipt_fields']['usage']) and + _exact(account['guard_runner_wall_seconds'], manifest['guard']['receipt_fields']['runner_wall_seconds']), + 'G12-N15: actual guard cost join') + _need(manifest['scope'] == _SCOPE, 'G12-N18: custody scope cannot become scientific approval') + + +def _fixed_argv(label, sources): + stage = _R + '/stages/g12-reference-custody-v1' + science = _R + '/runtime/runs/' + label + '/science' + parent = ['/usr/bin/python3.12', *_FLAGS, _R + '/run_guarded_v3.py', + 'g12-reference-custody-v1', 'g12-reference', label] + root = ['/usr/bin/python3.12', *_FLAGS, stage + '/integration/full_driver.py', + '--root-sha256', _ROOT_PIN, '--provider', stage + '/integration/probe_binding_v3.py', + _PROVIDER_PIN, '--driver', stage + '/integration/g12_reference_adapter_v1.py', + sources['adapter']['sha256'], '--integration', stage + '/integration', '--', + '--output', science, '--lanes', 'g12-reference'] + producer = [stage + '/baseline/full_driver.py', '--frozen-root', stage + '/baseline/frozen', + '--reference', stage + '/baseline/reference/certificates/complex-network.json', + '--mode', 'profile', '--output', science] + return parent, root, producer + + +def _validate_publication(publication, manifest, manifest_record): + _fields(publication, _PUBLICATION_SCHEMA['exact_fields']) + _need(publication['schema'] == _PUBLICATION_SCHEMA['schema_literal'] and + publication['parent_source_sha256'] == manifest['selected_sources']['parent']['sha256'] and + publication['launch_selection_sha256'] == manifest['invocation']['launch_selection_sha256'] and + publication['manifest_path'] == manifest_record['path'] and + publication['manifest_sha256'] == manifest_record['sha256'] and + publication['manifest_bytes'] == manifest_record['bytes'] and + _exact(publication['manifest_identity'], manifest_record['identity']) and + _exact(publication['retained_pair_sha256'], {name: manifest['pair'][name]['retained']['sha256'] + for name in ('common', 'diagnostics')}) and + publication['final_pair_recheck_complete'] is True and publication['known_lease_close_completed'] is True and + publication['primary_error'] is None and _exact(publication['secondary_errors'], []) and + publication['enclosing_tail_join_required'] is True and + _exact(publication['enclosing_accounting_source_pin'], manifest['accounting']['enclosing_accounting_source_pin']), + 'G12-N15: exact publication/manifest/final-tail join') + _uint(publication['measured_through_ns']) + _need(publication['measured_through_ns'] >= manifest['accounting']['preseal_end_ns'], + 'G12-N15: publication clock precedes preseal') + costs = publication['actual_costs_through_ns'] + _fields(costs, ('entry_ns', 'through_ns', 'wall_ns', 'self_user_seconds', 'self_system_seconds', + 'children_user_seconds', 'children_system_seconds', 'lifetime_max_rss_kib')) + for name in ('entry_ns', 'through_ns', 'wall_ns'): + _uint(costs[name]) + _need(costs['entry_ns'] == manifest['accounting']['parent_entry_ns'] and + costs['through_ns'] == publication['measured_through_ns'] and + costs['wall_ns'] == costs['through_ns'] - costs['entry_ns'], 'G12-N15: publication actual clock join') + for name in ('self_user_seconds', 'self_system_seconds', 'children_user_seconds', + 'children_system_seconds', 'lifetime_max_rss_kib'): + _number(costs[name]) + + +def _source_code_shape(code): + _need(type(code) is CodeType, 'G12-N04: exact code type') + def constant(value): + kind = type(value) + if value is None or value is Ellipsis: + return ('singleton', value is Ellipsis) + if kind in (int, bool, str, bytes): + return (kind.__name__, value) + if kind is float: + return ('float', value.hex()) + if kind is tuple: + return ('tuple', tuple(constant(item) for item in value)) + if kind is frozenset: + return ('frozenset', tuple(sorted(constant(item) for item in value))) + if kind is CodeType: + return ('code', _source_code_shape(value)) + raise RuntimeError('G12-N04: unsupported source code constant') + return tuple(constant(value) for value in ( + code.co_argcount, code.co_posonlyargcount, code.co_kwonlyargcount, + code.co_nlocals, code.co_stacksize, code.co_flags, code.co_code, + code.co_names, code.co_varnames, code.co_freevars, code.co_cellvars, + code.co_exceptiontable, code.co_linetable, code.co_firstlineno, + code.co_filename, code.co_name, code.co_qualname, code.co_consts)) + + +def _authenticate_own_functions(root, api, source, path): + _need(api[0]() == _ROOT_PIN, 'G12-N04: Root before selected-source compilation') + code = root._COMPILE(source, path, 'exec', dont_inherit=True, optimize=0) + declared = {item.co_name: item for item in code.co_consts if type(item) is CodeType} + for name, function in tuple(globals().items()): + if type(function) is FunctionType and function.__globals__ is globals(): + _need(name in declared and function.__builtins__ is root.builtins.__dict__ and + _source_code_shape(function.__code__) == _source_code_shape(declared[name]), + 'G12-N04: actual entire own callable differs from selected source: ' + name) + _need(api[0]() == _ROOT_PIN, 'G12-N04: Root after selected-source compilation') + + +def load_original_g12_reference(root, capability, api): + """Return only original literal/count/opaque common/provenance, after joint custody.""" + config = G12_REFERENCE_HANDOFF + selected = G12_COLD_SOURCE_SELECTION + _need(type(config) is tuple and len(config) == 9 and type(selected) is tuple and len(selected) == 3, + 'G12-N01: actual parent handoff and cold source remain unselected') + _need(root is _BOOTSTRAP[0] and capability is _BOOTSTRAP[1] and api is _BOOTSTRAP[2] and + type(root) is ModuleType and type(api) is tuple and len(api) == 4 and + all(type(f) is FunctionType and f.__globals__ is root.__dict__ for f in api), + 'G12-N04: initial actual cold Root/capability/API identities differ') + _need(api[0]() == _ROOT_PIN and sys.flags.optimize == 0, 'G12-N04: authentic Root/assertions') + api[1](capability, _PROVIDER_PIN) + _current_graph(_INITIAL_GRAPH) + source_path, source_sha, source_size = selected + source_record, source_raw = _read_file(source_path, 1048576, 0o444) + _need(source_path == __file__ and source_record['sha256'] == source_sha and + source_record['bytes'] == source_size, 'G12-N04: exact independently selected consumer source') + _authenticate_own_functions(root, api, source_raw, source_path) + path, sha, size, identity, parent_path, parent_sha, publication_path, publication_sha, publication_size = config + _need(_digest(sha) and _digest(parent_sha) and _digest(publication_sha), 'G12-N16: source selection digest domain') + manifest_record = {'path': path, 'sha256': sha, 'bytes': size, 'identity': identity, 'nlink': 1} + manifest_raw = _root_read(root, api, manifest_record, _META_CAP) + manifest = _json(manifest_raw, _META_CAP, True, True) + _validate_manifest(manifest, parent_path, parent_sha) + retained = manifest['custody']['retained_directory'] + _need(path == retained + '/manifest.json' and publication_path == retained + '/publication.json', + 'G12-N16: exact fixed publication/manifest paths') + dirs, rows = _directory_chain(retained) + primary, secondaries, result = None, [], None + try: + _need(_exact(_identity(os.fstat(dirs[-1])), manifest['custody']['retained_directory_identity']), + 'G12-N17: final retained directory identity') + publication_record, _ = _read_file(publication_path, _META_CAP, 0o444) + _need(publication_record['sha256'] == publication_sha and publication_record['bytes'] == publication_size, + 'G12-N15: source-selected final publication bytes') + publication_raw = _root_read(root, api, publication_record, _META_CAP) + publication = _json(publication_raw, _META_CAP, True, True) + _validate_publication(publication, manifest, manifest_record) + evidence = {} + for name, record in manifest['retained_evidence'].items(): + cap = _LOG_CAP if name in ('guard_stdout', 'guard_stderr', 'parent_outer_stdout', 'parent_outer_stderr') else _META_CAP + evidence[name] = _root_read(root, api, record, cap) + launch_data = _json(evidence['parent_launch'], _META_CAP, True, True) + _fields(launch_data, ('schema', 'selection_sha256', 'source_selection', 'launch')) + _need(launch_data['schema'] == 'g12-parent-actual-launch-v1' and + launch_data['selection_sha256'] == manifest['invocation']['launch_selection_sha256'] == + hashlib.sha256(_canonical(launch_data['source_selection'])).hexdigest() and + _exact(launch_data['source_selection']['source_pins'], manifest['selected_sources']) and + _exact(launch_data['launch'], {k: v for k, v in manifest['launch'].items() if k != 'launch_record'}), + 'G12-N07: actual source-selected launch/raw evidence binding') + start = _json(evidence['guard_START'], _META_CAP) + receipt = _json(evidence['guard_receipt'], _META_CAP) + usage = _json(evidence['guard_usage'], 16384) + _need(_exact(start, manifest['guard']['start_fields']) and + _exact(receipt, manifest['guard']['receipt_fields']), 'G12-N07: original raw evidence joins') + _validate_guard(start, receipt, usage, evidence['guard_stdout'], evidence['guard_stderr'], + manifest['launch']['guard_root_argv'], manifest['invocation'], manifest['selected_sources'], + launch_data['source_selection']['phase_pin']['sha256']) + _need(_exact(_json(evidence['parent_outer_stdout'], _LOG_CAP), receipt) and + evidence['parent_outer_stderr'] == b'', 'G12-N07: actual outer raw log join') + common_record = manifest['pair']['common']['retained'] + diagnostic_record = manifest['pair']['diagnostics']['retained'] + common_raw = _root_read(root, api, common_record, _PAIR_CAP) + diagnostic_raw = _root_read(root, api, diagnostic_record, _PAIR_CAP) + common, diagnostics, payload = _validate_pair(common_raw, diagnostic_raw) + _need(common['common_payload_sha256'] == manifest['pair']['common_payload_sha256'], 'G12-N13: pair/manifest payload') + # Joint final reread includes diagnostics even after common decoding. + for record, raw, cap in ((manifest_record, manifest_raw, _META_CAP), + (common_record, common_raw, _PAIR_CAP), + (diagnostic_record, diagnostic_raw, _PAIR_CAP), + (publication_record, publication_raw, _META_CAP)): + _need(_root_read(root, api, record, cap) == raw, 'G12-N17: final full custody set changed') + for name, record in manifest['retained_evidence'].items(): + cap = _LOG_CAP if name in ('guard_stdout', 'guard_stderr', 'parent_outer_stdout', 'parent_outer_stderr') else _META_CAP + _need(_root_read(root, api, record, cap) == evidence[name], 'G12-N17: raw retained evidence drift') + _check_chain(rows) + _need(_exact(_identity(os.fstat(dirs[-1])), manifest['custody']['retained_directory_identity']), + 'G12-N17: final namespace changed after decode') + _need(_read_file(source_path, 1048576, 0o444) == (source_record, source_raw), 'G12-N04: consumer source drift') + _current_graph(_INITIAL_GRAPH) + api[1](capability, _PROVIDER_PIN) + _need(api[0]() == _ROOT_PIN, 'G12-N17: final actual Root currentness') + # Full diagnostic raw bytes stay retained; their hash is part of immutable + # provenance, and no diagnostic counter becomes an equality oracle. + provenance = (path, sha, size, tuple(identity[k] for k in _ID_NAMES), parent_path, parent_sha, + publication_path, publication_sha, publication_size, common_record['sha256'], + diagnostic_record['sha256'], common['common_payload_sha256'], + tuple(common['original_scientific_pins']), _PRODUCER_PIN, _AUTHORITY_PIN) + result = common['literal_original_value'], common['remaining_original_case_count'], payload, provenance + except BaseException as error: + primary = error, error.__traceback__ + for descriptor in reversed(dirs): + try: + os.close(descriptor) + except BaseException as error: + secondaries.append((error, error.__traceback__)) + _raise_preserved(primary, secondaries) + return result + +_R = '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028' + +_ENGINE_PINS = {'compare_side_verifier.py': '6e507bb0c7e00d090a60289fddb6c55e90c946d0850c42c3c5e3e15c27604a68', + 'finite_controls.py': 'df989a831aac43cc1af95169dad8c64a7548760e6e1f96976da996703f2c8f7a', + 'native_backend.py': 'e473c38245c3668715b5a78dfe980b2fe3ed0d0c9b8c97c666fbae6ecf1fffd5', + 'native_gf2.c': 'e9c3c9194a08718bd1575c1cf08c6c6772d3b644c2e274c25a84a1f9249d06cc', + 'profile_side_verifier.py': '9c994378171c20a91539418d93cb8387e1daa93465d6862beefea90e12999c2a', + 'source/complex_circuit.py': 'd623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1', + 'source/complex_network.py': '0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b'} + +_OTHER_SOURCE_PINS = {'cleanup_leaf_origin': '7b3304eaf4884e3029df5095e2b0950c18d1544ad21431a07c033b85e53bd4f7', + 'reference': '1f763d95c7ff163aa71d13cd82784f16665be8afb21f75e76941e2119562098f', + 'runtime_profile': 'ad0ec2aea01b83f97bdeafd9e9208360127fee870d024d353879b5ed99237109', + 'source_pins': '88bba3caf5975f30fa7abceaea9454110cf3b069233e8241a2ca13d1dff171a7'} + +_OPERATING_PREMISES = ('Selected fixed scientific sources, adapter and ordinary profile branch do not fork/spawn threads, ' + 'daemonize, pass writable descriptors to outsiders, or enlist external writers. Trusted ' + 'OS/loader/interpreter/stdlib and cooperating same-user parent launch domain exclude unrelated writer ' + 'interference. This is an explicit finite source/operating premise, not established merely by a clean /proc ' + 'snapshot.') + +_SCOPE = ('Fixed source-data custody only. No G12/P02/full-positive/native/performance/scientific admission; no ' + 'universal writers theorem.') + +_FLAGS = ('-S', '-s', '-P', '-B') + +_ENV = {'LANG': 'C.UTF-8', + 'LC_ALL': 'C.UTF-8', + 'PATH': '/usr/bin:/bin', + 'PYTHONDONTWRITEBYTECODE': '1', + 'PYTHONHASHSEED': '0', + 'TZ': 'UTC'} + +_EVIDENCE_NAMES = {'guard_START': 'guard-START.json', + 'guard_receipt': 'guard-receipt.json', + 'guard_stderr': 'guard-stderr.txt', + 'guard_stdout': 'guard-stdout.txt', + 'guard_usage': 'guard-usage.json', + 'parent_launch': 'parent-LAUNCH.json', + 'parent_outer_stderr': 'parent-outer-stderr.txt', + 'parent_outer_stdout': 'parent-outer-stdout.txt', + 'parent_owned_observations': 'parent-owned-observations.json', + 'parent_preseal_accounting': 'parent-preseal-accounting.json'} + +_INITIAL_GRAPH = _capture_graph(globals()) diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/g12_reference_parent_v1.py.txt b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/g12_reference_parent_v1.py.txt new file mode 100644 index 0000000000..bee9d0bb1d --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/g12_reference_parent_v1.py.txt @@ -0,0 +1,1685 @@ +"""Fixed G12 parent custody source. No execution or publication authority. + +Only a later independently reviewed literal may select the launch. The exact +enclosing-accounting callable/source integration is deliberately unresolved; +P02 refuses before any runtime operation until that source edge is supplied. +No manifest, receipt dictionary or success flag is accepted from a caller. +""" +import time +import resource +import signal +import subprocess +import fcntl +G12_REFERENCE_LAUNCH_SELECTION = None +G12_ENCLOSING_ACCOUNTING_SELECTION = None +import os + + +import sys + + +import stat + + +import json + + +import hashlib + + +import math + + +from types import FunctionType, CodeType, ModuleType + + +_ROOT_PIN = 'f5a2d33f2b4d3651f214156a0e7094c2bb516ce2d5ab7698d18c11f98f35dee0' + + +_PROVIDER_PIN = '9cbb7368f89e71d1e6cc46db5dc77efed3e03ed2a801c98c88fe316e4d9f3ef2' + + +_PRODUCER_PIN = 'a346025d5b6e2b26246521c6af6292643a4c2c3286b33ff3996dcf051cd6be26' + + +_GUARD_PIN = 'bd882e3dadb1b6aeaa63ee824f1a1c58f8ef2546b6840a2bffa46885a184d3eb' + + +_AUTHORITY_PIN = 'f279ab86fc17c6a517b035f19d56863919cbd8304de4e7d5332457c6159aec10' + + +_META_CAP = 262144 + + +_PAIR_CAP = 268435456 + + +_CHUNK = 65536 + + +_LOG_CAP = 2097152 + + +_MISSING = object() + + +_ID_NAMES = ('dev', 'ino', 'full_st_mode', 'size', 'mtime_ns', 'ctime_ns') + + +def _need(condition, message): + if not condition: + raise RuntimeError(message) + + +def _exact(value, expected): + if type(value) is not type(expected): + return False + if type(value) in (list, tuple): + return len(value) == len(expected) and all(_exact(a, b) for a, b in zip(value, expected)) + if type(value) is dict: + return set(value) == set(expected) and all(_exact(value[k], expected[k]) for k in expected) + return value == expected + + +def _fields(value, fields): + _need(type(value) is dict and all(type(k) is str for k in value) and + set(value) == set(fields), 'G12-N12: exact field domain differs') + + +def _digest(value): + return type(value) is str and len(value) == 64 and all(c in '0123456789abcdef' for c in value) + + +def _uint(value, positive=False): + _need(type(value) is int and value >= (1 if positive else 0), 'G12-N12: exact integer domain') + + +def _number(value): + _need(type(value) in (int, float) and math.isfinite(value) and value >= 0, + 'G12-N12: finite nonnegative exact number required') + + +def _path(path): + _need(type(path) is str and path.startswith('/') and + all(p not in ('', '.', '..') for p in path.split('/')[1:]), 'G12-N11: absolute canonical path') + return path + + +def _identity(info): + return dict(zip(_ID_NAMES, (info.st_dev, info.st_ino, info.st_mode, info.st_size, + info.st_mtime_ns, info.st_ctime_ns))) + + +def _directory_key(info): + return info.st_dev, info.st_ino, info.st_mode + + +def _directory_chain(path): + """Held no-follow chain; no later absolute path silently changes its owner.""" + _path(path) + fds, rows = [], [] + primary = None + try: + fd = os.open('/', os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC) + fds.append(fd) + for part in path.split('/')[1:]: + before = os.stat(part, dir_fd=fd, follow_symlinks=False) + _need(stat.S_ISDIR(before.st_mode), 'G12-N11: directory component type') + child = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW | os.O_CLOEXEC, + dir_fd=fd) + fds.append(child) + opened = os.fstat(child) + _need(_directory_key(before) == _directory_key(opened), 'G12-N11: directory replaced') + rows.append((fd, part, child, _directory_key(opened))) + fd = child + return fds, rows + except BaseException as error: + primary = (error, error.__traceback__) + secondary = [] + for descriptor in reversed(fds): + try: + os.close(descriptor) + except BaseException as error: + secondary.append((error, error.__traceback__)) + _raise_preserved(primary, secondary) + + +def _check_chain(rows): + for parent, name, descriptor, key in rows: + _need(_directory_key(os.fstat(descriptor)) == key == + _directory_key(os.stat(name, dir_fd=parent, follow_symlinks=False)), + 'G12-N11: directory binding changed') + + +def _raise_preserved(primary, secondaries): + """Never replace first raw failure if evidence formatting or retention fails.""" + if primary is not None: + error, traceback = primary + try: + error.add_note('G12 ordered secondary failures: ' + repr(secondaries)) + except BaseException: + pass + raise error.with_traceback(traceback) + if secondaries: + error, traceback = secondaries[0][:2] + raise error.with_traceback(traceback) + + +def _read_file(path, cap, mode=None): + _path(path) + parent, name = path.rsplit('/', 1) + fds, rows = _directory_chain(parent) + descriptor, primary, secondary, result = None, None, [], None + try: + before = os.stat(name, dir_fd=fds[-1], follow_symlinks=False) + _need(stat.S_ISREG(before.st_mode) and before.st_nlink == 1 and + 0 <= before.st_size <= cap and (mode is None or before.st_mode == stat.S_IFREG | mode), + 'G12-N11: regular-file size/mode/link domain') + descriptor = os.open(name, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK | os.O_CLOEXEC, + dir_fd=fds[-1]) + opened = os.fstat(descriptor) + _need(_identity(before) == _identity(opened) and opened.st_nlink == 1, + 'G12-N11: file changed on open') + count, blocks, hasher = 0, [], hashlib.sha256() + while count < opened.st_size: + block = os.read(descriptor, min(_CHUNK, opened.st_size - count)) + _need(bool(block), 'G12-N11: short file read') + count += len(block) + hasher.update(block) + blocks.append(block) + _need(os.read(descriptor, 1) == b'', 'G12-N11: file grew') + after = os.fstat(descriptor) + ending = os.stat(name, dir_fd=fds[-1], follow_symlinks=False) + _need(_identity(before) == _identity(after) == _identity(ending) and + after.st_nlink == ending.st_nlink == 1, 'G12-N11: full file identity changed') + _check_chain(rows) + result = ({'path': path, 'sha256': hasher.hexdigest(), 'bytes': count, + 'identity': _identity(after), 'nlink': 1}, b''.join(blocks)) + except BaseException as error: + primary = (error, error.__traceback__) + for fd in ([descriptor] if descriptor is not None else []) + list(reversed(fds)): + try: + os.close(fd) + except BaseException as error: + secondary.append((error, error.__traceback__)) + _raise_preserved(primary, secondary) + return result + + +def _file_record(value): + _fields(value, ('path', 'sha256', 'bytes', 'identity', 'nlink')) + _path(value['path']) + _need(_digest(value['sha256']) and type(value['nlink']) is int and value['nlink'] == 1, + 'G12-N11: file digest/link record') + _uint(value['bytes']) + _fields(value['identity'], _ID_NAMES) + for key in _ID_NAMES: + _need(type(value['identity'][key]) is int, 'G12-N11: exact stat value') + _uint(value['identity']['dev']) + _uint(value['identity']['ino'], True) + _need(stat.S_ISREG(value['identity']['full_st_mode']) and + value['identity']['size'] == value['bytes'], 'G12-N11: file identity size/type') + + +def _pairs(items): + result = {} + for key, value in items: + _need(type(key) is str and key not in result, 'G12-N12: duplicate JSON key') + result[key] = value + return result + + +def _nonfinite(value): + raise ValueError('G12-N12: nonfinite JSON token: ' + value) + + +def _canonical(value): + return json.dumps(value, sort_keys=True, separators=(',', ':'), ensure_ascii=True, + allow_nan=False).encode('ascii') + + +def _json(raw, cap, canonical=False, newline=False): + _need(type(raw) is bytes and len(raw) <= cap, 'G12-N12: raw JSON bound') + # Scan lexical nesting before json.loads recursion or object materialization. + depth, quoted, escaped = 0, False, False + for char in raw: + if quoted: + if escaped: + escaped = False + elif char == 92: + escaped = True + elif char == 34: + quoted = False + elif char == 34: + quoted = True + elif char in (91, 123): + depth += 1 + _need(depth <= 256, 'G12-N12: JSON depth limit') + elif char in (93, 125): + depth -= 1 + _need(depth >= 0, 'G12-N12: JSON nesting') + _need(depth == 0 and not quoted, 'G12-N12: incomplete JSON') + value = json.loads(raw.decode('utf-8'), object_pairs_hook=_pairs, parse_constant=_nonfinite) + pending, count = [(value, 0)], 0 + while pending: + item, depth = pending.pop() + count += 1 + _need(count <= cap and depth <= 256, 'G12-N12: JSON node/depth limit') + if type(item) is dict: + pending.extend((x, depth + 1) for pair in item.items() for x in pair) + elif type(item) is list: + pending.extend((x, depth + 1) for x in item) + elif type(item) is str: + _need(len(item) <= cap, 'G12-N12: JSON string limit') + elif type(item) is float: + _need(math.isfinite(item), 'G12-N12: overflowed JSON number') + else: + _need(item is None or type(item) in (bool, int), 'G12-N12: JSON primitive') + if canonical: + _need(raw == _canonical(value) + (b'\n' if newline else b''), 'G12-N12: canonical JSON bytes') + return value + + +def _hex(value, cap): + _need(type(value) is str and len(value) <= cap and len(value) % 2 == 0 and + all(c in '0123456789abcdef' for c in value), 'G12-N12: complete lowercase hex') + return bytes.fromhex(value) + + +def _decimal(value, positive=False): + _need(type(value) is str and bool(value), 'G12-N12: integer tag text') + digits = value[1:] if value.startswith('-') else value + _need(bool(digits) and all(c in '0123456789' for c in digits) and + (digits == '0' or digits[0] != '0') and value != '-0' and + (not positive or (not value.startswith('-') and value != '0')), 'G12-N12: canonical integer') + + +def _tagged(raw, cap): + value = _json(raw, cap, True) + pending = [(value, 0)] + count = 0 + while pending: + node, depth = pending.pop() + count += 1 + _need(count <= cap and depth <= 256 and type(node) is list and len(node) >= 1 and + type(node[0]) is str, 'G12-N12: tagged primitive bound/shape') + tag = node[0] + if tag == 'None': + _need(len(node) == 1, 'G12-N12: None arity') + continue + _need(len(node) == (3 if tag == 'Fraction' else 2), 'G12-N12: primitive arity') + arg = node[1] + if tag == 'bool': + _need(type(arg) is bool, 'G12-N12: bool tag') + elif tag == 'int': + _decimal(arg) + elif tag == 'Fraction': + _decimal(arg) + _decimal(node[2], True) + elif tag == 'str': + _need(type(arg) is str, 'G12-N12: string tag') + elif tag == 'bytes': + _hex(arg, cap) + elif tag == 'float': + _need(type(arg) is str and float.fromhex(arg).hex() == arg, 'G12-N12: float.hex domain') + elif tag in ('tuple', 'list'): + _need(type(arg) is list, 'G12-N12: sequence tag') + pending.extend((item, depth + 1) for item in arg) + elif tag == 'dict': + _need(type(arg) is list, 'G12-N12: ordered dict tag') + for pair in arg: + _need(type(pair) is list and len(pair) == 2, 'G12-N12: dict pair') + pending.extend((item, depth + 1) for item in pair) + else: + raise ValueError('G12-N12: unknown primitive tag') + return value + + +def _rank_events(encoded): + value = _tagged(_hex(encoded, _PAIR_CAP), _PAIR_CAP) + _need(value[0] == 'tuple', 'G12-N12: rank tuple') + for event in value[1]: + _need(event[0] == 'tuple' and len(event[1]) == 2 and event[1][0][0] == 'tuple' and + all(x[0] == 'int' for x in event[1][0][1]) and event[1][1][0] == 'int', + 'G12-N12: rank-event grammar') + return len(value[1]) + + +def _validate_pair(common_raw, diagnostic_raw): + common = _json(common_raw, _PAIR_CAP, True, True) + diagnostic = _json(diagnostic_raw, _PAIR_CAP, True, True) + spec = _PAIR_SCHEMA + _fields(common, spec['common_exact_fields']) + _fields(diagnostic, spec['diagnostic_exact_fields']) + for key, expected in spec['common_constants'].items(): + _need(_exact(common[key], expected), 'G12-N13: original common source/workload binding') + for key, expected in spec['diagnostic_constants'].items(): + _need(_exact(diagnostic[key], expected), 'G12-N13: diagnostic source/role binding') + _need(type(common['literal_original_value']) is bool, 'G12-N12: observed literal exact bool') + _uint(common['remaining_original_case_count'], True) + payload = _hex(common['common_payload_hex'], _PAIR_CAP) + _need(_digest(common['common_payload_sha256']) and + hashlib.sha256(payload).hexdigest() == common['common_payload_sha256'] == + diagnostic['common_payload_sha256'], 'G12-N13: complete common digest join') + tagged = _tagged(payload, _PAIR_CAP) + _need(tagged[0] == 'tuple' and len(tagged[1]) == 10, 'G12-N13: common tuple arity') + prefix = [['str', 'g12-original-remainder-common-v1'], + ['tuple', [['str', p] for p in spec['common_constants']['original_scientific_pins']]], + ['int', '25'], ['tuple', [['int', '0'], ['int', '2'], ['int', '1']]]] + _need(_exact(tagged[1][:4], prefix), 'G12-N13: common inner source/workload prefix') + suffix = ['tuple', [['str', name] for name in ('verify_role_frames', 'full_log_integer_bounds', + 'original_upstream_verify_sources', 'original_serializable', 'complete_original_cli')]] + _need(_exact(tagged[1][-1], suffix), 'G12-N13: original suffix phase order') + for key in ('prefix_end', 'suffix_start', 'cli_end'): + row = diagnostic[key] + _fields(row, spec['diagnostic_snapshot_exact_fields']) + _uint(row['rank_event_count']) + _need(_rank_events(row['ordered_rank_events_hex']) == row['rank_event_count'] and + row['native_binding'] is None and row['cache_binding'] is None, + 'G12-N12: original diagnostic rank/binding domain') + receipt = row['complement_receipt'] + _fields(receipt, spec['complement_receipt_exact_fields']) + _uint(receipt['calls']) + _uint(receipt['canonical_stream_bytes']) + _need(_digest(receipt['sha256']) and receipt['schema'] == + 'v2-jsonl:call,us,vs,result(type=list+values or type=None); ordered exact integer vectors', 'G12-N12: complement receipt') + _rank_events(diagnostic['ordered_rank_suffix_hex']) + _fields(diagnostic['phases'], spec['phase_exact_names']) + for row in diagnostic['phases'].values(): + _fields(row, ('calls', 'wall_seconds', 'cpu_seconds_with_children')) + _need(type(row['calls']) is int and row['calls'] == 1, 'G12-N12: phase calls') + _number(row['wall_seconds']) + _number(row['cpu_seconds_with_children']) + return common, diagnostic, payload + + +def _source_pin(value): + _fields(value, ('path', 'sha256', 'bytes', 'mode')) + _path(value['path']) + _uint(value['bytes']) + _need(_digest(value['sha256']) and type(value['mode']) is str and len(value['mode']) == 4 and + all(c in '01234567' for c in value['mode']), 'G12-N02: exact source pin') + + +def _validate_guard(start, receipt, usage, stdout, stderr, root_argv, invocation, source_pins, phase_sha): + _fields(start, _GUARD_SCHEMA['START_exact_fields']) + _fields(receipt, _GUARD_SCHEMA['receipt_exact_fields']) + _fields(usage, ('user_seconds', 'system_seconds', 'kernel_max_rss_kib', 'exit')) + for key in start: + _need(_exact(start[key], receipt[key]), 'G12-N07: original START/receipt field join') + for key, expected in _GUARD_SCHEMA['required_values'].items(): + _need(_exact(receipt[key], expected), 'G12-N07: original guard success predicate') + for key in ('job', 'label', 'stage_sha256'): + _need(_exact(start[key], invocation[key]), 'G12-N07: selected invocation mismatch') + expected_launch = {'contract': 'trusted-clean-nosite-safe-path-fixedseed-v1', + 'no_site': 1, 'no_user_site': 1, 'safe_path': True, 'ignore_environment': 0, + 'isolated': 0, 'hash_seed_environment': '0', 'hash_randomization': 0, + 'initial_sys_path': ['/usr/lib/python312.zip', '/usr/lib/python3.12', '/usr/lib/python3.12/lib-dynload'], + 'environment': dict(_ENV), + 'trust_boundary': 'Authenticated parent launcher, OS, interpreter and system stdlib before this module; no Python self-authentication claim'} + _need(_exact(start['parent_launch'], expected_launch), 'G12-N07: exact original clean parent launch') + _need(_exact(start['command'], root_argv) and start['runner_sha256'] == _GUARD_PIN and + start['budget_phase_sha256'] == phase_sha and _digest(start['fractions_sha256']), + 'G12-N07: selected command/source/phase binding') + _need(type(start['phase_cap_seconds']) is int and start['phase_cap_seconds'] in (600, 2400), + 'G12-N05: original aggregate cap') + _number(start['spent_before_seconds']) + _need(start['spent_before_seconds'] < start['phase_cap_seconds'], 'G12-N05: consumed budget') + for key in ('wall_seconds', 'runner_wall_seconds', 'runner_user_seconds', 'runner_system_seconds', + 'runner_lifetime_max_rss_kib', 'sampled_process_group_rss_bytes'): + _number(receipt[key]) + limit = min(180, start['phase_cap_seconds'] - start['spent_before_seconds']) + _need(receipt['wall_seconds'] <= limit and receipt['runner_wall_seconds'] <= limit and + receipt['runner_lifetime_max_rss_kib'] * 1024 <= 1073741824 and + receipt['sampled_process_group_rss_bytes'] <= 1073741824, + 'G12-N07: original guard resource caps') + for key in ('user_seconds', 'system_seconds', 'kernel_max_rss_kib'): + _number(usage[key]) + _need(type(usage['exit']) is int and usage['exit'] == 0 and _exact(usage, receipt['usage']), + 'G12-N07: complete original usage join') + for name, raw in (('stdout', stdout), ('stderr', stderr)): + _need(len(raw) <= _LOG_CAP and receipt[name + '_bytes'] == len(raw) and + type(receipt[name + '_bytes']) is int and receipt[name + '_final_bytes'] == len(raw) and + type(receipt[name + '_final_bytes']) is int and + receipt[name + '_sha256'] == hashlib.sha256(raw).hexdigest(), 'G12-N07: complete raw log join') + _need(stderr == b'' and type(receipt['python']) is str and type(receipt['platform']) is str, + 'G12-N07: original stderr/platform fields') + + +def _capture_graph(namespace): + """Capture the fixed own/JSON function graph before candidate exposure.""" + modules = (json, json.decoder, json.encoder, json.scanner, hashlib, os, stat, math) + namespaces = [namespace] + [module.__dict__ for module in modules] + records, members, seen = [], [], set() + for mapping in namespaces: + members.append((mapping, tuple(mapping.items()))) + for value in mapping.values(): + candidates = [value] + if type(value) is type: + candidates.extend(value.__dict__.values()) + if value.__module__ in (__name__, 'json.decoder', 'json.encoder'): + members.append((value.__dict__, tuple(value.__dict__.items()))) + for function in candidates: + if type(function) is not FunctionType or id(function) in seen: + continue + seen.add(id(function)) + records.append((function, function.__code__, function.__globals__, function.__builtins__, + function.__defaults__, function.__kwdefaults__, function.__closure__, + tuple(function.__dict__.items()), + () if function.__kwdefaults__ is None else tuple(function.__kwdefaults__.items()), + () if function.__closure__ is None else tuple((c, c.cell_contents) for c in function.__closure__))) + return tuple(records), tuple(members) + + +def _current_graph(graph): + records, members = graph + for mapping, rows in members: + # The capture itself is assigned once after this snapshot. + expected = dict(rows) + for name, value in rows: + _need(mapping.get(name, _MISSING) is value, 'G12-N04: captured namespace member changed: ' + name) + extra = set(mapping) - set(expected) + _need(not extra or mapping is globals() and extra == {'_INITIAL_GRAPH'}, + 'G12-N04: captured namespace census changed') + for f, code, namespace, builtin, defaults, kw, cells, attrs, kws, contents in records: + _need(f.__code__ is code and f.__globals__ is namespace and f.__builtins__ is builtin and + f.__defaults__ is defaults and f.__kwdefaults__ is kw and f.__closure__ is cells and + len(f.__dict__) == len(attrs), 'G12-N04: captured function graph changed') + for name, value in attrs: + _need(f.__dict__.get(name, _MISSING) is value, 'G12-N04: function attributes changed') + if kw is not None: + _need(len(kw) == len(kws), 'G12-N04: keyword-default census changed') + for name, value in kws: + _need(kw.get(name, _MISSING) is value, 'G12-N04: keyword defaults changed') + for cell, value in contents: + _need(cell.cell_contents is value, 'G12-N04: captured closure changed') + + +_PAIR_SCHEMA = {'common_constants': {'authority_source_sha256': 'f279ab86fc17c6a517b035f19d56863919cbd8304de4e7d5332457c6159aec10', + 'extra_target': [0, 2, 1], + 'h': 25, + 'literal_original_type': 'bool', + 'original_driver_sha256': '0d976d2eb6b845f20d4a3396591a806f966688b88693cd6a5f8a0c9e48925e36', + 'original_scientific_pins': ['d623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1', + '0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b', + '88bba3caf5975f30fa7abceaea9454110cf3b069233e8241a2ca13d1dff171a7', + 'adc7f1241b42e322a6451854ab7e4b4c146bf78a'], + 'producer_role': 'independent-original-uncached', + 'schema': 'g12-independent-original-reference-envelope-v1', + 'scope': 'Actual original N22 literal and P07 common remainder observations only; ' + 'no original PROFILE_ANCHOR_PASS, FULL_PASS, native qualification or G12 ' + 'approval.', + 'selected_driver_sha256': 'a346025d5b6e2b26246521c6af6292643a4c2c3286b33ff3996dcf051cd6be26'}, + 'common_exact_fields': ['schema', + 'producer_role', + 'selected_driver_sha256', + 'original_driver_sha256', + 'authority_source_sha256', + 'original_scientific_pins', + 'h', + 'extra_target', + 'literal_original_type', + 'literal_original_value', + 'remaining_original_case_count', + 'common_payload_sha256', + 'common_payload_hex', + 'scope'], + 'complement_receipt_exact_fields': ['calls', 'canonical_stream_bytes', 'sha256', 'schema'], + 'diagnostic_constants': {'complement_suffix_limit': 'Only cumulative original start/end receipts; no ' + 'digest subtraction or suffix-stream claim.', + 'completion': 'Exact source-owned intentional marker followed by original ' + 'finally, exact observer restoration, both cold2 checks and ' + 'original source/output custody.', + 'producer_role': 'independent-original-uncached', + 'schema': 'g12-independent-original-reference-diagnostics-v1', + 'selected_driver_sha256': 'a346025d5b6e2b26246521c6af6292643a4c2c3286b33ff3996dcf051cd6be26'}, + 'diagnostic_exact_fields': ['schema', + 'producer_role', + 'selected_driver_sha256', + 'common_payload_sha256', + 'prefix_end', + 'suffix_start', + 'cli_end', + 'ordered_rank_suffix_hex', + 'complement_suffix_limit', + 'phases', + 'completion'], + 'diagnostic_snapshot_exact_fields': ['rank_event_count', + 'ordered_rank_events_hex', + 'complement_receipt', + 'native_binding', + 'cache_binding'], + 'phase_exact_names': ['input_custody', + 'engine_custody', + 'fresh_root_copy', + 'fresh_engine_copy', + 'cold_engine_import', + 'cold_complex_module_load', + 'cold_certify_import', + 'cold_prepare_import', + 'side_construction', + 'checks_initialization', + 'compile_roles', + 'verify_map', + 'verify_labels', + 'verify_role_frames', + 'original_upstream_verify_sources', + 'full_log_integer_bounds', + 'original_serializable', + 'complete_original_cli']} + + +_MANIFEST_SCHEMA = {'accounting_exact_fields': ['clock', + 'parent_entry_ns', + 'preseal_end_ns', + 'parent_preseal_wall_ns', + 'parent_self_user_seconds', + 'parent_self_system_seconds', + 'parent_children_user_seconds', + 'parent_children_system_seconds', + 'parent_lifetime_max_rss_kib', + 'guard_usage', + 'guard_runner_wall_seconds', + 'categories', + 'complete_tail_accounting_required', + 'enclosing_accounting_source_pin'], + 'cleanup_exact_fields': ['operating_premises', + 'owned_generations', + 'observed_groups', + 'remaining', + 'current_children', + 'known_streams_closed', + 'known_pidfds_closed', + 'io_unknown', + 'lease_identity', + 'science_directory_identity', + 'observations_record'], + 'custody_exact_fields': ['retained_directory', + 'retained_directory_identity', + 'retained_file_mode', + 'created_after_known_cleanup', + 'source_selection_required', + 'known_close_policy'], + 'exact_top_level_fields': ['schema', + 'invocation', + 'selected_sources', + 'workload', + 'launch', + 'terminal', + 'guard', + 'cleanup', + 'pair', + 'retained_evidence', + 'custody', + 'accounting', + 'scope'], + 'guard_exact_fields': ['start', + 'receipt', + 'start_fields', + 'receipt_fields', + 'stdout', + 'stderr', + 'usage'], + 'invocation_exact_fields': ['stage', + 'job', + 'label', + 'stage_sha256', + 'jobs_sha256', + 'launch_selection_sha256'], + 'launch_exact_fields': ['parent_pid', + 'parent_start_ticks', + 'guard_pid', + 'guard_start_ticks', + 'guard_pgid', + 'guard_sid', + 'parent_guard_argv', + 'guard_root_argv', + 'adapter_producer_argv', + 'cwd', + 'environment', + 'flags', + 'launch_record'], + 'pair_exact_fields': ['common', 'diagnostics', 'common_payload_sha256'], + 'retained_evidence_exact_keys': ['guard_START', + 'guard_receipt', + 'guard_stdout', + 'guard_stderr', + 'guard_usage', + 'parent_launch', + 'parent_outer_stdout', + 'parent_outer_stderr', + 'parent_owned_observations', + 'parent_preseal_accounting'], + 'schema_literal': 'g12-parent-two-export-custody-v1', + 'selected_sources_exact_fields': ['parent', + 'guard', + 'root', + 'provider', + 'adapter', + 'producer', + 'authority', + 'source_pins', + 'reference', + 'engine', + 'runtime_profile', + 'cleanup_leaf_origin'], + 'terminal_exact_fields': ['actual_popen_returncode', + 'wait_completed', + 'parent_stop', + 'primary_error', + 'secondary_errors', + 'guard_receipt_missing'], + 'workload_exact_fields': ['role', + 'h', + 'extra_target', + 'mode', + 'anchor', + 'optimize', + 'original_scientific_pins'], + 'workload_values': {'anchor': None, + 'extra_target': [0, 2, 1], + 'h': 25, + 'mode': 'profile', + 'optimize': 0, + 'original_scientific_pins': ['d623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1', + '0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b', + '88bba3caf5975f30fa7abceaea9454110cf3b069233e8241a2ca13d1dff171a7', + 'adc7f1241b42e322a6451854ab7e4b4c146bf78a'], + 'role': 'independent-original-uncached'}} + + +_GUARD_SCHEMA = {'START_exact_fields': ['command', + 'parent_launch', + 'stage_sha256', + 'runner_sha256', + 'fractions_sha256', + 'budget_phase_sha256', + 'spent_before_seconds', + 'phase_cap_seconds', + 'job', + 'label'], + 'receipt_exact_fields': ['command', + 'parent_launch', + 'stage_sha256', + 'runner_sha256', + 'fractions_sha256', + 'budget_phase_sha256', + 'spent_before_seconds', + 'phase_cap_seconds', + 'job', + 'label', + 'exit', + 'wall_seconds', + 'usage', + 'termination', + 'sampled_process_group_rss_bytes', + 'source_bytes_and_modes_unchanged', + 'stdout_sha256', + 'stdout_bytes', + 'stderr_sha256', + 'stderr_bytes', + 'stdout_final_bytes', + 'stderr_final_bytes', + 'retained_log_bytes_stable', + 'output_cap_observed_at', + 'log_read_chunk_bytes', + 'runner_wall_seconds', + 'runner_user_seconds', + 'runner_system_seconds', + 'runner_lifetime_max_rss_kib', + 'python', + 'platform', + 'status'], + 'required_values': {'exit': 0, + 'log_read_chunk_bytes': 65536, + 'output_cap_observed_at': None, + 'retained_log_bytes_stable': True, + 'source_bytes_and_modes_unchanged': True, + 'status': 'PASS', + 'stderr_bytes': 0, + 'stderr_final_bytes': 0, + 'termination': None}} + + +_PUBLICATION_SCHEMA = {'exact_fields': ['schema', + 'parent_source_sha256', + 'launch_selection_sha256', + 'manifest_path', + 'manifest_sha256', + 'manifest_bytes', + 'manifest_identity', + 'retained_pair_sha256', + 'final_pair_recheck_complete', + 'known_lease_close_completed', + 'primary_error', + 'secondary_errors', + 'measured_through_ns', + 'actual_costs_through_ns', + 'enclosing_accounting_source_pin', + 'enclosing_tail_join_required'], + 'schema_literal': 'g12-parent-custody-publication-v1'} + + +_COST_CATEGORIES = ('source/stage/plan/authentication and dependency preflight', 'parent invocation setup and known lease operations', 'adapter bootstrap source read/hash/compile/exec and argv/module alias custody/restoration', 'entire independent uncached reference including fresh copies/engine imports/original CLI/trace capture/original checks/finally/restoration/cold2', 'guard launch/time/monitoring/STOP/final original source inventory/usage/raw-log hashing/receipt', 'actual parent wait and known descendant/group/FD cleanup', 'canonical receipt and START joins plus all complete raw evidence retention', 'both exports full reads/hashes/JSON/schema/payload decode/crosslinks and repeated pair checks', 'new parent copies/write/fsync/chmod/close/directory sync/readback', 'manifest schema/write/hash/fsync/close/readback and source-selection publication tail', 'parent failure/secondary-error retention and necessary cleanup after deadline', 'cold consumer complete manifest/pair/publication read/hash/parse/decode/recheck and all retained alias lifetimes') + + +def _validate_manifest(manifest, parent_path, parent_sha): + spec = _MANIFEST_SCHEMA + _fields(manifest, spec['exact_top_level_fields']) + _need(manifest['schema'] == spec['schema_literal'], 'G12-N12: custody schema') + for name in ('invocation', 'selected_sources', 'workload', 'launch', 'terminal', 'guard', + 'cleanup', 'pair', 'custody', 'accounting'): + _fields(manifest[name], spec[name + '_exact_fields']) + _fields(manifest['retained_evidence'], spec['retained_evidence_exact_keys']) + _need(_exact(manifest['workload'], spec['workload_values']), 'G12-N13: fixed workload') + invocation = manifest['invocation'] + _need(invocation['stage'] == 'g12-reference-custody-v1' and invocation['job'] == 'g12-reference' and + type(invocation['label']) is str and bool(invocation['label']) and + all(c in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_' for c in invocation['label']), + 'G12-N13: fixed invocation role') + for name in ('stage_sha256', 'jobs_sha256', 'launch_selection_sha256'): + _need(_digest(invocation[name]), 'G12-N12: invocation digest') + sources = manifest['selected_sources'] + for name, pin in sources.items(): + if name != 'engine': + _source_pin(pin) + for name, expected in (('guard', _GUARD_PIN), ('root', _ROOT_PIN), ('provider', _PROVIDER_PIN), + ('producer', _PRODUCER_PIN), ('authority', _AUTHORITY_PIN)): + _need(sources[name]['sha256'] == expected and sources[name]['mode'] == '0444', + 'G12-N02: selected original source mismatch') + _need(sources['producer']['bytes'] == 70246 and sources['parent']['path'] == parent_path and + sources['parent']['sha256'] == parent_sha, 'G12-N02: selected producer/parent identity') + _need(_exact(sources['engine'], _ENGINE_PINS), 'G12-N02: exact original engine source pins') + for name, expected in _OTHER_SOURCE_PINS.items(): + _need(sources[name]['sha256'] == expected, 'G12-N02: selected original dependency mismatch') + terminal = {'actual_popen_returncode': 0, 'wait_completed': True, 'parent_stop': None, + 'primary_error': None, 'secondary_errors': [], 'guard_receipt_missing': False} + _need(_exact(manifest['terminal'], terminal), 'G12-N06: authenticated terminal data rejects') + cleanup = manifest['cleanup'] + _need(_exact(cleanup['remaining'], []) and _exact(cleanup['current_children'], []) and + cleanup['known_streams_closed'] is True and cleanup['known_pidfds_closed'] is True and + cleanup['io_unknown'] is False and type(cleanup['owned_generations']) is list and + bool(cleanup['owned_generations']) and _exact(cleanup['operating_premises'], _OPERATING_PREMISES), + 'G12-N08: known selected chain custody rejects') + for name in ('parent_pid', 'parent_start_ticks', 'guard_pid', 'guard_start_ticks', 'guard_pgid', 'guard_sid'): + _uint(manifest['launch'][name], True) + label = invocation['label'] + stage = _R + '/stages/g12-reference-custody-v1' + science = _R + '/runtime/runs/' + label + '/science' + parent_argv, root_argv, producer_argv = _fixed_argv(label, sources) + launch = manifest['launch'] + _need(_exact(launch['parent_guard_argv'], parent_argv) and _exact(launch['guard_root_argv'], root_argv) and + _exact(launch['adapter_producer_argv'], producer_argv) and launch['cwd'] == _R and + _exact(launch['environment'], _ENV) and _exact(launch['flags'], list(_FLAGS)), + 'G12-N03: exact fixed launch/adapter argv') + retained = _R + '/runtime/g12-reference-parent-custody-v1/' + label + custody = manifest['custody'] + _need(custody['retained_directory'] == retained and custody['retained_file_mode'] == '0444' and + custody['created_after_known_cleanup'] is True and custody['source_selection_required'] is True and + custody['known_close_policy'] == 'Any unknown close rejects publication', 'G12-N14: custody ownership') + _fields(custody['retained_directory_identity'], _ID_NAMES) + _need(custody['retained_directory_identity']['full_st_mode'] == stat.S_IFDIR | 0o500, + 'G12-N14: final retained directory mode') + for name in ('common', 'diagnostics'): + pair = manifest['pair'][name] + _fields(pair, ('original', 'retained')) + _file_record(pair['original']) + _file_record(pair['retained']) + filename = 'g12-reference.' + name + '.json' + _need(pair['original']['path'] == science + '/' + filename and + pair['retained']['path'] == retained + '/' + filename and + pair['original']['sha256'] == pair['retained']['sha256'] and + pair['original']['bytes'] == pair['retained']['bytes'] and + pair['retained']['identity']['full_st_mode'] == stat.S_IFREG | 0o444, + 'G12-N13: original/retained complete pair join') + _need(_digest(manifest['pair']['common_payload_sha256']), 'G12-N13: payload pin') + for name, record in manifest['retained_evidence'].items(): + _file_record(record) + _need(record['path'] == retained + '/' + _EVIDENCE_NAMES[name] and + record['identity']['full_st_mode'] == stat.S_IFREG | 0o444, + 'G12-N14: retained raw evidence path/mode') + for name, evidence_name in (('start', 'guard_START'), ('receipt', 'guard_receipt'), + ('stdout', 'guard_stdout'), ('stderr', 'guard_stderr'), ('usage', 'guard_usage')): + _need(_exact(manifest['guard'][name], manifest['retained_evidence'][evidence_name]), + 'G12-N07: guard retained record join') + _need(_exact(launch['launch_record'], manifest['retained_evidence']['parent_launch']) and + _exact(cleanup['observations_record'], manifest['retained_evidence']['parent_owned_observations']), + 'G12-N08: parent observation record join') + account = manifest['accounting'] + _need(account['clock'] == 'monotonic_ns' and account['complete_tail_accounting_required'] is True and + _exact(account['categories'], list(_COST_CATEGORIES)), 'G12-N15: full cost categories/tail') + for name in ('parent_entry_ns', 'preseal_end_ns', 'parent_preseal_wall_ns'): + _uint(account[name]) + _need(account['preseal_end_ns'] >= account['parent_entry_ns'] and + account['parent_preseal_wall_ns'] == account['preseal_end_ns'] - account['parent_entry_ns'], + 'G12-N15: actual parent clock endpoints') + for name in ('parent_self_user_seconds', 'parent_self_system_seconds', 'parent_children_user_seconds', + 'parent_children_system_seconds', 'parent_lifetime_max_rss_kib', 'guard_runner_wall_seconds'): + _number(account[name]) + _source_pin(account['enclosing_accounting_source_pin']) + _need(_exact(account['guard_usage'], manifest['guard']['receipt_fields']['usage']) and + _exact(account['guard_runner_wall_seconds'], manifest['guard']['receipt_fields']['runner_wall_seconds']), + 'G12-N15: actual guard cost join') + _need(manifest['scope'] == _SCOPE, 'G12-N18: custody scope cannot become scientific approval') + + +def _fixed_argv(label, sources): + stage = _R + '/stages/g12-reference-custody-v1' + science = _R + '/runtime/runs/' + label + '/science' + parent = ['/usr/bin/python3.12', *_FLAGS, _R + '/run_guarded_v3.py', + 'g12-reference-custody-v1', 'g12-reference', label] + root = ['/usr/bin/python3.12', *_FLAGS, stage + '/integration/full_driver.py', + '--root-sha256', _ROOT_PIN, '--provider', stage + '/integration/probe_binding_v3.py', + _PROVIDER_PIN, '--driver', stage + '/integration/g12_reference_adapter_v1.py', + sources['adapter']['sha256'], '--integration', stage + '/integration', '--', + '--output', science, '--lanes', 'g12-reference'] + producer = [stage + '/baseline/full_driver.py', '--frozen-root', stage + '/baseline/frozen', + '--reference', stage + '/baseline/reference/certificates/complex-network.json', + '--mode', 'profile', '--output', science] + return parent, root, producer + + +def _validate_publication(publication, manifest, manifest_record): + _fields(publication, _PUBLICATION_SCHEMA['exact_fields']) + _need(publication['schema'] == _PUBLICATION_SCHEMA['schema_literal'] and + publication['parent_source_sha256'] == manifest['selected_sources']['parent']['sha256'] and + publication['launch_selection_sha256'] == manifest['invocation']['launch_selection_sha256'] and + publication['manifest_path'] == manifest_record['path'] and + publication['manifest_sha256'] == manifest_record['sha256'] and + publication['manifest_bytes'] == manifest_record['bytes'] and + _exact(publication['manifest_identity'], manifest_record['identity']) and + _exact(publication['retained_pair_sha256'], {name: manifest['pair'][name]['retained']['sha256'] + for name in ('common', 'diagnostics')}) and + publication['final_pair_recheck_complete'] is True and publication['known_lease_close_completed'] is True and + publication['primary_error'] is None and _exact(publication['secondary_errors'], []) and + publication['enclosing_tail_join_required'] is True and + _exact(publication['enclosing_accounting_source_pin'], manifest['accounting']['enclosing_accounting_source_pin']), + 'G12-N15: exact publication/manifest/final-tail join') + _uint(publication['measured_through_ns']) + _need(publication['measured_through_ns'] >= manifest['accounting']['preseal_end_ns'], + 'G12-N15: publication clock precedes preseal') + costs = publication['actual_costs_through_ns'] + _fields(costs, ('entry_ns', 'through_ns', 'wall_ns', 'self_user_seconds', 'self_system_seconds', + 'children_user_seconds', 'children_system_seconds', 'lifetime_max_rss_kib')) + for name in ('entry_ns', 'through_ns', 'wall_ns'): + _uint(costs[name]) + _need(costs['entry_ns'] == manifest['accounting']['parent_entry_ns'] and + costs['through_ns'] == publication['measured_through_ns'] and + costs['wall_ns'] == costs['through_ns'] - costs['entry_ns'], 'G12-N15: publication actual clock join') + for name in ('self_user_seconds', 'self_system_seconds', 'children_user_seconds', + 'children_system_seconds', 'lifetime_max_rss_kib'): + _number(costs[name]) + + +def _source_code_shape(code): + _need(type(code) is CodeType, 'G12-N04: exact code type') + def constant(value): + kind = type(value) + if value is None or value is Ellipsis: + return ('singleton', value is Ellipsis) + if kind in (int, bool, str, bytes): + return (kind.__name__, value) + if kind is float: + return ('float', value.hex()) + if kind is tuple: + return ('tuple', tuple(constant(item) for item in value)) + if kind is frozenset: + return ('frozenset', tuple(sorted(constant(item) for item in value))) + if kind is CodeType: + return ('code', _source_code_shape(value)) + raise RuntimeError('G12-N04: unsupported source code constant') + return tuple(constant(value) for value in ( + code.co_argcount, code.co_posonlyargcount, code.co_kwonlyargcount, + code.co_nlocals, code.co_stacksize, code.co_flags, code.co_code, + code.co_names, code.co_varnames, code.co_freevars, code.co_cellvars, + code.co_exceptiontable, code.co_linetable, code.co_firstlineno, + code.co_filename, code.co_name, code.co_qualname, code.co_consts)) + + +_R = '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028' + + +_ENGINE_PINS = {'compare_side_verifier.py': '6e507bb0c7e00d090a60289fddb6c55e90c946d0850c42c3c5e3e15c27604a68', + 'finite_controls.py': 'df989a831aac43cc1af95169dad8c64a7548760e6e1f96976da996703f2c8f7a', + 'native_backend.py': 'e473c38245c3668715b5a78dfe980b2fe3ed0d0c9b8c97c666fbae6ecf1fffd5', + 'native_gf2.c': 'e9c3c9194a08718bd1575c1cf08c6c6772d3b644c2e274c25a84a1f9249d06cc', + 'profile_side_verifier.py': '9c994378171c20a91539418d93cb8387e1daa93465d6862beefea90e12999c2a', + 'source/complex_circuit.py': 'd623617f7c5cb3189580883a8ab30c0bd3832688ae3f1f0c1f881bbbbff8e0c1', + 'source/complex_network.py': '0da395e67ac04fa213494e71012c1b19b544596d34cdce5a3b172b1fb6af5f1b'} + + +_OTHER_SOURCE_PINS = {'cleanup_leaf_origin': '7b3304eaf4884e3029df5095e2b0950c18d1544ad21431a07c033b85e53bd4f7', + 'reference': '1f763d95c7ff163aa71d13cd82784f16665be8afb21f75e76941e2119562098f', + 'runtime_profile': 'ad0ec2aea01b83f97bdeafd9e9208360127fee870d024d353879b5ed99237109', + 'source_pins': '88bba3caf5975f30fa7abceaea9454110cf3b069233e8241a2ca13d1dff171a7'} + + +_OPERATING_PREMISES = ('Selected fixed scientific sources, adapter and ordinary profile branch do not fork/spawn threads, ' + 'daemonize, pass writable descriptors to outsiders, or enlist external writers. Trusted ' + 'OS/loader/interpreter/stdlib and cooperating same-user parent launch domain exclude unrelated writer ' + 'interference. This is an explicit finite source/operating premise, not established merely by a clean /proc ' + 'snapshot.') + + +_SCOPE = ('Fixed source-data custody only. No G12/P02/full-positive/native/performance/scientific admission; no ' + 'universal writers theorem.') + + +_FLAGS = ('-S', '-s', '-P', '-B') + + +_ENV = {'LANG': 'C.UTF-8', + 'LC_ALL': 'C.UTF-8', + 'PATH': '/usr/bin:/bin', + 'PYTHONDONTWRITEBYTECODE': '1', + 'PYTHONHASHSEED': '0', + 'TZ': 'UTC'} + + +_EVIDENCE_NAMES = {'guard_START': 'guard-START.json', + 'guard_receipt': 'guard-receipt.json', + 'guard_stderr': 'guard-stderr.txt', + 'guard_stdout': 'guard-stdout.txt', + 'guard_usage': 'guard-usage.json', + 'parent_launch': 'parent-LAUNCH.json', + 'parent_outer_stderr': 'parent-outer-stderr.txt', + 'parent_outer_stdout': 'parent-outer-stdout.txt', + 'parent_owned_observations': 'parent-owned-observations.json', + 'parent_preseal_accounting': 'parent-preseal-accounting.json'} + + + +def _proc(pid): + # Derived from original supervisor proc; PermissionError is never absence. + descriptor, primary, secondaries, result = None, None, [], None + try: + descriptor = os.open('/proc/' + str(pid) + '/stat', os.O_RDONLY | os.O_NOFOLLOW | os.O_CLOEXEC) + raw = os.read(descriptor, 8193) + _need(len(raw) <= 8192 and os.read(descriptor, 1) == b'', 'G12-N08: process-stat finite bound') + end = raw.rfind(b') ') + _need(end >= 0 and raw.split(b' ', 1)[0] == str(pid).encode('ascii'), 'G12-N08: process-stat PID') + fields = raw[end + 2:].split() + _need(len(fields) >= 22 and fields[0] in (b'R', b'S', b'D', b'Z', b'T', b't', b'X', b'x', b'I', b'K', b'W', b'P'), + 'G12-N08: process-stat shape/state') + result = {'pid': pid, 'ppid': int(fields[1]), 'pgid': int(fields[2]), 'sid': int(fields[3]), + 'start_ticks': int(fields[19]), 'state': fields[0].decode('ascii'), + 'rss_bytes': int(fields[21]) * os.sysconf('SC_PAGE_SIZE')} + for key in ('pid', 'ppid', 'pgid', 'sid', 'start_ticks', 'rss_bytes'): + _uint(result[key], key in ('pid', 'start_ticks')) + except (FileNotFoundError, ProcessLookupError): + result = None + except BaseException as error: + primary = error, error.__traceback__ + if descriptor is not None: + try: + os.close(descriptor) + except BaseException as error: + secondaries.append((error, error.__traceback__)) + _raise_preserved(primary, secondaries) + return result + + +def _census(): + rows = {} + with os.scandir('/proc') as entries: + for entry in entries: + if entry.name.isdecimal(): + _need(len(rows) < 65536, 'G12-N08: finite process census bound') + row = _proc(int(entry.name)) + if row is not None: + rows[row['pid']] = row + return rows + + +def _children(): + return [row for row in _census().values() if row['ppid'] == os.getpid()] + + +class _KnownG12Chain: + """Scoped generation/pidfd observation only; never universal writer proof.""" + def __init__(self): + _need(not _children(), 'G12-N08: initial parent child domain must be empty') + _need(os.listdir('/proc/self/task') == [str(os.getpid())], 'G12-N08: single initial parent task') + self.rows, self.fds, self.groups, self.observations = {}, {}, set(), [] + self.parent_pid = os.getpid() + self.parent_group = os.getpgrp() + self.closed = False + self.unknown = False + + def add(self, row): + key = row['pid'], row['start_ticks'] + if key in self.rows: + _need(self.rows[key]['pid'] == row['pid'], 'G12-N08: owned generation identity') + if row['pgid'] != self.parent_group: + self.groups.add((row['pgid'], row['sid'])) + return + _need(row['pid'] != self.parent_pid and len(self.rows) < 128, 'G12-N08: fixed owned process bound') + descriptor = os.pidfd_open(row['pid'], 0) + # A failed/ambiguous adoption rejects; never treat it as known closure. + self.fds[key] = descriptor + current = _proc(row['pid']) + _need(current is not None and (current['pid'], current['start_ticks']) == key, + 'G12-N08: process generation changed during pidfd adoption') + self.rows[key] = dict(current) + if current['pgid'] != self.parent_group: + self.groups.add((current['pgid'], current['sid'])) + + def observe(self): + _need(not self.closed, 'G12-N08: closed observation domain') + rows = _census() + known = {pid for pid, start in self.rows if pid in rows and rows[pid]['start_ticks'] == start} + for pid in known: + self.add(rows[pid]) + changed = True + while changed: + changed = False + for pid, row in rows.items(): + if pid not in known and (row['ppid'] == self.parent_pid or row['ppid'] in known): + self.add(row) + known.add(pid) + changed = True + occupied = [row for row in rows.values() if (row['pgid'], row['sid']) in self.groups] + current = [rows[pid] for pid in known] + _need(len(self.observations) < 4096, 'G12-N08: finite observation retention') + self.observations.append({'monotonic_ns': time.monotonic_ns(), 'current': current, 'occupied_groups': occupied}) + return rows, current, occupied + + def stop_known(self): + self.observe() + for key, descriptor in self.fds.items(): + current = _proc(key[0]) + if current is not None: + _need((current['pid'], current['start_ticks']) == key, 'G12-N08: generation ambiguity before signal') + if current['state'] != 'Z': + try: + signal.pidfd_send_signal(descriptor, signal.SIGKILL, None, 0) + except ProcessLookupError: + pass + + def finish(self, process, deadline, failed): + _need(type(deadline) is int, 'G12-N08: selected paid cleanup deadline') + current, occupied = [], [] + while True: + if failed: + self.stop_known() + if process is not None: + process.poll() + _, current, occupied = self.observe() + if not current and not occupied and not _children(): + break + if not failed or time.monotonic_ns() >= deadline: + raise RuntimeError('G12-N08: selected-chain cleanup UNKNOWN') + time.sleep(0.01) + primary, secondaries = None, [] + for key, descriptor in tuple(self.fds.items()): + try: + os.close(descriptor) + del self.fds[key] + except BaseException as error: + self.unknown = True + secondaries.append((error, error.__traceback__)) + self.closed = not self.fds and not self.unknown + _raise_preserved(primary, secondaries) + return {'operating_premises': _OPERATING_PREMISES, + 'owned_generations': list(self.rows.values()), + 'observed_groups': [{'pgid': g, 'sid': s} for g, s in sorted(self.groups)], + 'remaining': [], 'current_children': [], 'known_streams_closed': False, + 'known_pidfds_closed': self.closed, 'io_unknown': self.unknown, + 'lease_identity': None, 'science_directory_identity': None, + 'observations_record': None} + + +def _trusted_parent_launch(): + _need(sys.executable == '/usr/bin/python3.12' and sys.flags.optimize == 0 and + sys.flags.no_site == sys.flags.no_user_site == sys.flags.dont_write_bytecode == 1 and + sys.flags.safe_path and sys.flags.ignore_environment == sys.flags.isolated == sys.flags.hash_randomization == 0, + 'G12-N02: original clean parent interpreter flags') + _need(dict(os.environ) == _ENV and tuple(sys.path) == + ('/usr/lib/python312.zip', '/usr/lib/python3.12', '/usr/lib/python3.12/lib-dynload'), + 'G12-N02: original clean environment/search path') + _need(sys.gettrace() is None and sys.getprofile() is None, 'G12-N04: no parent tracing callbacks') + + +def _exclusive_directory(path): + parent, name = _path(path).rsplit('/', 1) + fds, rows = _directory_chain(parent) + primary, secondaries, result = None, [], None + try: + os.mkdir(name, 0o700, dir_fd=fds[-1]) + descriptor = os.open(name, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW | os.O_CLOEXEC, dir_fd=fds[-1]) + fds.append(descriptor) + current = os.fstat(descriptor) + _need(current.st_mode == stat.S_IFDIR | 0o700, 'G12-N14: new parent directory mode') + rows.append((fds[-2], name, descriptor, _directory_key(current))) + _check_chain(rows) + result = fds, rows + except BaseException as error: + primary = error, error.__traceback__ + if primary is not None: + for descriptor in reversed(fds): + try: + os.close(descriptor) + except BaseException as error: + secondaries.append((error, error.__traceback__)) + _raise_preserved(primary, secondaries) + return result + + +def _write_fd(descriptor, raw): + _need(type(raw) is bytes, 'G12-N14: exact retained byte copy') + offset, hasher = 0, hashlib.sha256() + while offset < len(raw): + block = raw[offset:offset + _CHUNK] + written = os.write(descriptor, block) + _need(type(written) is int and 0 < written <= len(block), 'G12-N14: complete copy write progress') + hasher.update(block[:written]) + offset += written + _need(offset == len(raw) and hasher.hexdigest() == hashlib.sha256(raw).hexdigest(), + 'G12-N14: complete copied byte digest') + os.fsync(descriptor) + os.fchmod(descriptor, 0o444) + os.fsync(descriptor) + + +def _copy_file(directory, name, raw): + fds, rows = directory + descriptor = os.open(name, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW | os.O_CLOEXEC, + 0o600, dir_fd=fds[-1]) + primary, secondaries = None, [] + try: + _write_fd(descriptor, raw) + _check_chain(rows) + except BaseException as error: + primary = error, error.__traceback__ + try: + os.close(descriptor) + except BaseException as error: + secondaries.append((error, error.__traceback__)) + _raise_preserved(primary, secondaries) + os.fsync(fds[-1]) + + +def _actual_costs(entry_ns, own_start, children_start): + through = time.monotonic_ns() + own, children = resource.getrusage(resource.RUSAGE_SELF), resource.getrusage(resource.RUSAGE_CHILDREN) + return {'entry_ns': entry_ns, 'through_ns': through, 'wall_ns': through - entry_ns, + 'self_user_seconds': own.ru_utime - own_start.ru_utime, + 'self_system_seconds': own.ru_stime - own_start.ru_stime, + 'children_user_seconds': children.ru_utime - children_start.ru_utime, + 'children_system_seconds': children.ru_stime - children_start.ru_stime, + 'lifetime_max_rss_kib': own.ru_maxrss} + + +def _require_existing_accounting_source_owner(): + # SOURCE INTEGRATION GAP, not a missing future output hash. Accepted design + # supplies no named existing callable/pin/ABI establishing actual ownership + # and paid memory/body/retention/cold/publication allowances. No callback or + # serialized funding flag is substituted. A reviewed integration derivative + # must replace this precise leaf before launch can be selected. + _need(G12_ENCLOSING_ACCOUNTING_SELECTION is not None, + 'G12-N05: exact existing enclosing accounting source integration is absent') + raise RuntimeError('G12-N15: no independently reviewed named accounting source entry is bound') + + +def run_g12_reference(): + """P01: one source-private invocation; accepts no caller completion data.""" + selection = G12_REFERENCE_LAUNCH_SELECTION + _need(type(selection) is dict, 'G12-N01: exact immutable launch source literal remains None') + # This gate precedes proc/phase/locks/files/processes. None is not authority. + _require_existing_accounting_source_owner() + entry_ns = time.monotonic_ns() + own_start, children_start = resource.getrusage(resource.RUSAGE_SELF), resource.getrusage(resource.RUSAGE_CHILDREN) + selection_bytes = _canonical(selection) + selection_sha = hashlib.sha256(selection_bytes).hexdigest() + parent_graph = _capture_graph(globals()) + phase, stage_data, stage_record, jobs_record, phase_record = None, None, None, None, None + source_records, originals, evidence, retained_records = {}, {}, {}, {} + parent_identity = _proc(os.getpid()) + process, chain, lease, lease_identity = None, None, None, None + lease_closed, attempted, wait_completed = False, False, False + outer = {} + observation, retained, science_directory, run_directory = None, None, None, None + primary, secondaries, parent_stop = None, [], None + cleanup, common, diagnostic, common_payload = None, None, None, None + start, receipt, usage, launch = None, None, None, None + manifest, manifest_record, publication_record = None, None, None + reserved = {} + candidate_pin = None + + def current(): + _need(G12_REFERENCE_LAUNCH_SELECTION is selection and _canonical(selection) == selection_bytes, + 'G12-N16: selected launch source changed') + _current_graph(parent_graph) + _need(_proc(os.getpid())['start_ticks'] == parent_identity['start_ticks'], 'G12-N08: parent generation') + _need(os.listdir('/proc/self/task') == [str(os.getpid())], 'G12-N08: parent thread domain changed') + if lease is not None and not lease_closed: + _need(_identity(os.fstat(lease)) == lease_identity and os.fstat(lease).st_nlink == 1, + 'G12-N08: actual parent lease identity changed') + for domain in (observation, retained, science_directory, run_directory): + if domain is not None: + _check_chain(domain[1]) + + def _g12_preflight_and_claim(): + """P02: exact source/phase/namespace gate; separate parent-queue lease.""" + nonlocal phase, stage_data, stage_record, jobs_record, phase_record, chain + nonlocal lease, lease_identity, observation + _fields(selection, ('schema', 'stage', 'job', 'label', 'stage_sha256', 'jobs_sha256', 'source_pins', + 'phase_pin', 'accounting_selection', 'body_deadline_ns', 'retention_tail_allowance_ns', + 'parent_observation_directory', 'parent_retained_directory')) + _need(selection['schema'] == 'g12-one-reference-launch-selection-v1' and + selection['stage'] == 'g12-reference-custody-v1' and selection['job'] == 'g12-reference', + 'G12-N02: fixed G12 launch role') + label = selection['label'] + _need(type(label) is str and bool(label) and + all(c in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_' for c in label), + 'G12-N03: fixed selected guard label') + _need(selection['parent_observation_directory'] == _R + '/runtime/g12-reference-parent-observation-v1/' + label and + selection['parent_retained_directory'] == _R + '/runtime/g12-reference-parent-custody-v1/' + label, + 'G12-N02: fixed parent namespace') + _uint(selection['body_deadline_ns'], True) + _uint(selection['retention_tail_allowance_ns'], True) + _need(selection['body_deadline_ns'] > entry_ns, 'G12-N05: no remaining complete body allowance') + _trusted_parent_launch() + sources = selection['source_pins'] + _fields(sources, _MANIFEST_SCHEMA['selected_sources_exact_fields']) + _need(_exact(sources['engine'], _ENGINE_PINS), 'G12-N02: exact seven original engine pins') + for name, pin in sources.items(): + if name == 'engine': + continue + _source_pin(pin) + observed, raw = _read_file(pin['path'], max(pin['bytes'], 1), int(pin['mode'], 8)) + _need(observed['sha256'] == pin['sha256'] and observed['bytes'] == pin['bytes'], + 'G12-N02: selected source bytes/modes') + source_records[name] = observed, raw + _need(sources['parent']['path'] == __file__, 'G12-N04: external parent source selection') + for name, expected in (('guard', _GUARD_PIN), ('root', _ROOT_PIN), ('provider', _PROVIDER_PIN), + ('producer', _PRODUCER_PIN), ('authority', _AUTHORITY_PIN)): + _need(sources[name]['sha256'] == expected and sources[name]['mode'] == '0444', 'G12-N02: original source pin') + for name, expected in _OTHER_SOURCE_PINS.items(): + _need(sources[name]['sha256'] == expected, 'G12-N02: original dependency pin') + _source_pin(selection['phase_pin']) + phase_record, phase_raw = _read_file(selection['phase_pin']['path'], _META_CAP, + int(selection['phase_pin']['mode'], 8)) + _need(selection['phase_pin']['path'] == _R + '/control/EXECUTION-PHASE.json' and + phase_record['sha256'] == selection['phase_pin']['sha256'] and + phase_record['bytes'] == selection['phase_pin']['bytes'], 'G12-N05: original phase identity') + phase = _json(phase_raw, _META_CAP) + _need(type(phase['aggregate_cap_seconds']) is int and phase['aggregate_cap_seconds'] in (600, 2400), + 'G12-N05: original unchanged aggregate cap') + stage = _R + '/stages/g12-reference-custody-v1' + stage_record, stage_raw = _read_file(stage + '/STAGE.json', _META_CAP, 0o444) + jobs_record, jobs_raw = _read_file(stage + '/JOBS.json', _META_CAP, 0o444) + _need(stage_record['sha256'] == selection['stage_sha256'] and + jobs_record['sha256'] == selection['jobs_sha256'], 'G12-N02: independently selected stage/jobs') + stage_data = _json(stage_raw, _META_CAP) + jobs = _json(jobs_raw, _META_CAP) + _need(_exact(jobs, {'g12-reference': {'bootstrap': {'driver': 'integration/g12_reference_adapter_v1.py', + 'provider': 'integration/probe_binding_v3.py'}, 'lanes': 'g12-reference', 'optimized': False}}), + 'G12-N03: exact only-job bootstrap/lanes/no-finite/no-optimization') + _need(stage_data['runner_sha256'] == _GUARD_PIN, 'G12-N02: original runner source') + for relative, row in stage_data['files'].items(): + _need(type(relative) is str and all(x not in ('', '.', '..') for x in relative.split('/')) and + not relative.startswith('/'), 'G12-N02: stage closure relative path') + _fields(row, ('sha256', 'mode')) + _need(type(row['mode']) is int, 'G12-N02: original source mode') + observed, _ = _read_file(stage + '/' + relative, 16777216, row['mode']) + _need(observed['sha256'] == row['sha256'], 'G12-N02: complete staged source closure') + # Exact census rejects undeclared files/directories/symlinks, including an + # alternate staged authority. Walk source paths only; no runtime payloads. + actual = set() + for path, dirs, files in os.walk(stage, followlinks=False): + for name in dirs: + _need(stat.S_ISDIR(os.lstat(path + '/' + name).st_mode), 'G12-N02: stage directory symlink') + for name in files: + full = path + '/' + name + _need(stat.S_ISREG(os.lstat(full).st_mode), 'G12-N02: stage nonregular source') + relative = full[len(stage) + 1:] + if relative != 'STAGE.json': + actual.add(relative) + _need(actual == set(stage_data['files']), 'G12-N02: exact staged closure census') + for name, pin in sources.items(): + if name not in ('engine', 'parent', 'guard', 'cleanup_leaf_origin'): + _need(pin['path'].startswith(stage + '/'), 'G12-N02: selected source outside new stage') + relative = pin['path'][len(stage) + 1:] + _need(stage_data['files'][relative] == {'sha256': pin['sha256'], 'mode': int(pin['mode'], 8)}, + 'G12-N02: selected source/stage binding') + chain = _KnownG12Chain() + for path in (_R + '/runtime/runs/' + label, selection['parent_observation_directory'], + selection['parent_retained_directory']): + parent, name = path.rsplit('/', 1) + fds, rows = _directory_chain(parent) + try: + try: + os.stat(name, dir_fd=fds[-1], follow_symlinks=False) + except FileNotFoundError: + pass + else: + raise RuntimeError('G12-N05: prior output/evidence/custody path exists') + _check_chain(rows) + finally: + for descriptor in reversed(fds): + os.close(descriptor) + # Separate from the original guard's science.lock. No contention wait. + lock_path = _R + '/runtime/parent-queue.lock' + parent_fds, parent_rows = _directory_chain(_R + '/runtime') + try: + lease = os.open('parent-queue.lock', os.O_RDWR | os.O_CREAT | os.O_NOFOLLOW | os.O_CLOEXEC, + 0o600, dir_fd=parent_fds[-1]) + info = os.fstat(lease) + _need(stat.S_ISREG(info.st_mode) and info.st_nlink == 1, 'G12-N08: parent lease type/link') + lease_identity = _identity(info) + fcntl.flock(lease, fcntl.LOCK_EX | fcntl.LOCK_NB) + _check_chain(parent_rows) + _need(_identity(os.stat('parent-queue.lock', dir_fd=parent_fds[-1], follow_symlinks=False)) == lease_identity, + 'G12-N08: parent lease name identity') + finally: + for descriptor in reversed(parent_fds): + os.close(descriptor) + observation = _exclusive_directory(selection['parent_observation_directory']) + current() + + def _g12_launch_once(): + """P03: retain the actual Popen, actual descriptors and generation.""" + nonlocal process, attempted, launch + _need(not attempted and process is None, 'G12-N06: no second launch attempt') + current() + parent_argv, root_argv, producer_argv = _fixed_argv(selection['label'], selection['source_pins']) + for name in ('stdout', 'stderr'): + outer[name] = os.open('outer-' + name + '.txt', + os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW | os.O_CLOEXEC, + 0o600, dir_fd=observation[0][-1]) + attempted = True + process = subprocess.Popen(parent_argv, cwd=_R, env=dict(_ENV), stdout=outer['stdout'], + stderr=outer['stderr'], close_fds=True, start_new_session=True) + _need(type(process) is subprocess.Popen and type(process.pid) is int and process.pid > 0, + 'G12-N06: actual Popen object/PID') + row = _proc(process.pid) + _need(row is not None and row['ppid'] == os.getpid() and + row['pgid'] == process.pid and row['sid'] == process.pid, 'G12-N06: actual new guard generation/session') + chain.add(row) + launch = {'parent_pid': parent_identity['pid'], 'parent_start_ticks': parent_identity['start_ticks'], + 'guard_pid': row['pid'], 'guard_start_ticks': row['start_ticks'], + 'guard_pgid': row['pgid'], 'guard_sid': row['sid'], 'parent_guard_argv': parent_argv, + 'guard_root_argv': root_argv, 'adapter_producer_argv': producer_argv, + 'cwd': _R, 'environment': dict(_ENV), 'flags': list(_FLAGS), 'launch_record': None} + raw = _canonical({'schema': 'g12-parent-actual-launch-v1', 'selection_sha256': selection_sha, 'source_selection': selection, + 'launch': {k: v for k, v in launch.items() if k != 'launch_record'}}) + b'\n' + _copy_file(observation, 'LAUNCH.json', raw) + evidence['parent_launch'] = _read_file(selection['parent_observation_directory'] + '/LAUNCH.json', _META_CAP, 0o444) + + def _g12_observe_wait_and_close(): + """P04: actual wait and scoped known-chain closure; no status substitute.""" + nonlocal wait_completed, cleanup, parent_stop + _need(process is not None and type(process) is subprocess.Popen, 'G12-N06: missing retained actual Popen') + while process.poll() is None: + _, children, occupied = chain.observe() + if time.monotonic_ns() >= selection['body_deadline_ns']: + parent_stop = 'selected_complete_body_deadline' + elif sum(row['rss_bytes'] for row in children) > 1073741824: + parent_stop = 'selected_known_chain_rss_cap' + elif resource.getrusage(resource.RUSAGE_SELF).ru_maxrss * 1024 > 1073741824: + parent_stop = 'parent_lifetime_rss_cap' + elif any(os.fstat(descriptor).st_size > _LOG_CAP for descriptor in outer.values()): + parent_stop = 'parent_outer_log_cap' + if parent_stop: + raise RuntimeError('G12-N06: parent STOP: ' + parent_stop) + current() + time.sleep(0.05) + code = process.wait() + wait_completed = True + _need(type(code) is int and code == 0 and type(process.returncode) is int and process.returncode == 0, + 'G12-N06: actual guard wait returncode') + cleanup = chain.finish(process, selection['body_deadline_ns'] + selection['retention_tail_allowance_ns'], False) + for name, descriptor in tuple(outer.items()): + os.fsync(descriptor) + os.close(descriptor) + del outer[name] + cleanup['known_streams_closed'] = not outer + cleanup['lease_identity'] = lease_identity + _need(parent_stop is None and cleanup['known_pidfds_closed'] and not cleanup['io_unknown'], + 'G12-N08: complete known closes') + current() + + def _g12_join_original_guard_evidence(): + """P05: retain complete canonical originals; never reconstruct receipt.""" + nonlocal start, receipt, usage, science_directory, run_directory + run = _R + '/runtime/runs/' + selection['label'] + run_directory = _directory_chain(run) + science_directory = _directory_chain(run + '/science') + cleanup['science_directory_identity'] = _identity(os.fstat(science_directory[0][-1])) + fixed = {'guard_START': ('START.json', _META_CAP), 'guard_receipt': ('receipt.json', _META_CAP), + 'guard_stdout': ('stdout.txt', _LOG_CAP), 'guard_stderr': ('stderr.txt', _LOG_CAP), + 'guard_usage': ('usage.json', 16384)} + for name, (filename, cap) in fixed.items(): + evidence[name] = _read_file(run + '/' + filename, cap) + for name in ('stdout', 'stderr'): + evidence['parent_outer_' + name] = _read_file(selection['parent_observation_directory'] + '/outer-' + name + '.txt', _LOG_CAP) + start = _json(evidence['guard_START'][1], _META_CAP) + receipt = _json(evidence['guard_receipt'][1], _META_CAP) + usage = _json(evidence['guard_usage'][1], 16384) + invocation = {'job': selection['job'], 'label': selection['label'], 'stage_sha256': selection['stage_sha256']} + _validate_guard(start, receipt, usage, evidence['guard_stdout'][1], evidence['guard_stderr'][1], + launch['guard_root_argv'], invocation, selection['source_pins'], selection['phase_pin']['sha256']) + fraction, _ = _read_file('/usr/lib/python3.12/fractions.py', 1048576) + _need(start['fractions_sha256'] == fraction['sha256'], 'G12-N07: original fractions source join') + _need(_exact(_json(evidence['parent_outer_stdout'][1], _LOG_CAP), receipt) and + evidence['parent_outer_stderr'][1] == b'', 'G12-N07: actual outer stdout/empty stderr') + current() + + def _g12_collect_complete_pair(): + """P06: complete original common AND diagnostics, followed by joint recheck.""" + nonlocal common, diagnostic, common_payload + _need(wait_completed and process.returncode == 0 and cleanup is not None and receipt is not None, + 'G12-N10: original successful owner/receipt join must precede pair') + science = _R + '/runtime/runs/' + selection['label'] + '/science' + for name in ('common', 'diagnostics'): + originals[name] = _read_file(science + '/g12-reference.' + name + '.json', _PAIR_CAP) + common, diagnostic, common_payload = _validate_pair(originals['common'][1], originals['diagnostics'][1]) + for name in ('common', 'diagnostics'): + _need(_read_file(originals[name][0]['path'], _PAIR_CAP) == originals[name], 'G12-N11: original joint pair changed') + current() + + def _g12_retain_parent_pair_and_evidence(): + """P07: fresh parent directory only after all selected writers are known closed.""" + nonlocal retained + _need(not _children() and cleanup['known_pidfds_closed'] and cleanup['known_streams_closed'], + 'G12-N08: no retained directory until known selected cleanup') + current() + retained = _exclusive_directory(selection['parent_retained_directory']) + for name in ('common', 'diagnostics'): + filename = 'g12-reference.' + name + '.json' + _copy_file(retained, filename, originals[name][1]) + record, raw = _read_file(selection['parent_retained_directory'] + '/' + filename, _PAIR_CAP, 0o444) + _need(raw == originals[name][1] and record['sha256'] == originals[name][0]['sha256'], 'G12-N14: complete retained pair readback') + retained_records[name] = record + observation_raw = _canonical({'schema': 'g12-known-chain-observations-v1', 'cleanup': cleanup, + 'observations': chain.observations}) + b'\n' + _copy_file(observation, 'owned-observations.json', observation_raw) + evidence['parent_owned_observations'] = _read_file(selection['parent_observation_directory'] + '/owned-observations.json', _META_CAP, 0o444) + costs = _actual_costs(entry_ns, own_start, children_start) + accounting_raw = _canonical(costs) + b'\n' + _copy_file(observation, 'preseal-accounting.json', accounting_raw) + evidence['parent_preseal_accounting'] = _read_file(selection['parent_observation_directory'] + '/preseal-accounting.json', _META_CAP, 0o444) + for name in _MANIFEST_SCHEMA['retained_evidence_exact_keys']: + _copy_file(retained, _EVIDENCE_NAMES[name], evidence[name][1]) + record, raw = _read_file(selection['parent_retained_directory'] + '/' + _EVIDENCE_NAMES[name], + max(len(evidence[name][1]), 1), 0o444) + _need(raw == evidence[name][1], 'G12-N14: raw evidence copy differs') + retained_records[name] = record + # Reserve BOTH metadata names before recording final directory identity. + # Existing FD writes/file chmod do not change parent directory entries. + for name in ('manifest.json', 'publication.json'): + reserved[name] = os.open(name, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW | os.O_CLOEXEC, + 0o600, dir_fd=retained[0][-1]) + os.fsync(retained[0][-1]) + current() + + def _g12_seal_once(): + """P08: private actual owner seal; returns only a candidate for later adoption.""" + nonlocal manifest, manifest_record, publication_record, candidate_pin, lease_closed + _need(process is not None and type(process) is subprocess.Popen and process.returncode == 0 and + wait_completed and primary is None and not secondaries and parent_stop is None and not _children() and + not outer and not chain.fds and not chain.unknown, 'G12-N08: actual owner final conjunction') + current() + for name, original in originals.items(): + _need(_read_file(original[0]['path'], _PAIR_CAP) == original, 'G12-N11: original pair final drift') + _need(_read_file(retained_records[name]['path'], _PAIR_CAP, 0o444)[0] == retained_records[name], + 'G12-N14: retained pair final drift') + for name, (record, raw) in source_records.items(): + _need(_read_file(record['path'], max(record['bytes'], 1), record['identity']['full_st_mode'] & 0o7777) == (record, raw), + 'G12-N02: complete selected source drift') + for record, raw in evidence.values(): + _need(_read_file(record['path'], max(record['bytes'], 1), record['identity']['full_st_mode'] & 0o7777) == (record, raw), + 'G12-N07: final complete original raw evidence drift') + for record in (stage_record, jobs_record, phase_record): + _need(_read_file(record['path'], _META_CAP, record['identity']['full_st_mode'] & 0o7777)[0] == record, + 'G12-N02: stage/jobs/phase final identity drift') + os.fchmod(retained[0][-1], 0o500) + # Update exactly our owned mode transition, retaining dev/inode binding. + parent, name, descriptor, old = retained[1][-1] + final_dir_info = os.fstat(descriptor) + _need((final_dir_info.st_dev, final_dir_info.st_ino) == old[:2], 'G12-N14: retained directory owner transition') + retained[1][-1] = (parent, name, descriptor, _directory_key(final_dir_info)) + os.fsync(descriptor) + directory_identity = _identity(final_dir_info) + costs = _actual_costs(entry_ns, own_start, children_start) + account = {'clock': 'monotonic_ns', 'parent_entry_ns': entry_ns, + 'preseal_end_ns': costs['through_ns'], 'parent_preseal_wall_ns': costs['wall_ns'], + 'parent_self_user_seconds': costs['self_user_seconds'], 'parent_self_system_seconds': costs['self_system_seconds'], + 'parent_children_user_seconds': costs['children_user_seconds'], 'parent_children_system_seconds': costs['children_system_seconds'], + 'parent_lifetime_max_rss_kib': costs['lifetime_max_rss_kib'], 'guard_usage': usage, + 'guard_runner_wall_seconds': receipt['runner_wall_seconds'], 'categories': list(_COST_CATEGORIES), + 'complete_tail_accounting_required': True, 'enclosing_accounting_source_pin': selection['accounting_selection']} + launch['launch_record'] = retained_records['parent_launch'] + cleanup['observations_record'] = retained_records['parent_owned_observations'] + manifest = {'schema': 'g12-parent-two-export-custody-v1', + 'invocation': {'stage': selection['stage'], 'job': selection['job'], 'label': selection['label'], + 'stage_sha256': selection['stage_sha256'], 'jobs_sha256': selection['jobs_sha256'], + 'launch_selection_sha256': selection_sha}, + 'selected_sources': selection['source_pins'], 'workload': _MANIFEST_SCHEMA['workload_values'], + 'launch': launch, 'terminal': {'actual_popen_returncode': process.returncode, 'wait_completed': wait_completed, + 'parent_stop': parent_stop, 'primary_error': None, 'secondary_errors': [], 'guard_receipt_missing': False}, + 'guard': {'start': retained_records['guard_START'], 'receipt': retained_records['guard_receipt'], + 'start_fields': start, 'receipt_fields': receipt, 'stdout': retained_records['guard_stdout'], + 'stderr': retained_records['guard_stderr'], 'usage': retained_records['guard_usage']}, + 'cleanup': cleanup, + 'pair': {name: {'original': originals[name][0], 'retained': retained_records[name]} for name in ('common', 'diagnostics')}, + 'retained_evidence': {name: retained_records[name] for name in _MANIFEST_SCHEMA['retained_evidence_exact_keys']}, + 'custody': {'retained_directory': selection['parent_retained_directory'], 'retained_directory_identity': directory_identity, + 'retained_file_mode': '0444', 'created_after_known_cleanup': True, 'source_selection_required': True, + 'known_close_policy': 'Any unknown close rejects publication'}, 'accounting': account, 'scope': _SCOPE} + manifest['pair']['common_payload_sha256'] = common['common_payload_sha256'] + _validate_manifest(manifest, selection['source_pins']['parent']['path'], selection['source_pins']['parent']['sha256']) + raw = _canonical(manifest) + b'\n' + _need(len(raw) <= _META_CAP, 'G12-N14: manifest finite metadata cap') + _write_fd(reserved['manifest.json'], raw) + os.close(reserved['manifest.json']) + del reserved['manifest.json'] + os.fsync(retained[0][-1]) + manifest_record, reread = _read_file(selection['parent_retained_directory'] + '/manifest.json', _META_CAP, 0o444) + _need(reread == raw, 'G12-N14: complete manifest readback') + current() + _need(not _children(), 'G12-N08: unexpected child at final lease close') + fcntl.flock(lease, fcntl.LOCK_UN) + os.close(lease) + lease_closed = True + costs = _actual_costs(entry_ns, own_start, children_start) + publication = {'schema': 'g12-parent-custody-publication-v1', + 'parent_source_sha256': selection['source_pins']['parent']['sha256'], 'launch_selection_sha256': selection_sha, + 'manifest_path': manifest_record['path'], 'manifest_sha256': manifest_record['sha256'], + 'manifest_bytes': manifest_record['bytes'], 'manifest_identity': manifest_record['identity'], + 'retained_pair_sha256': {name: retained_records[name]['sha256'] for name in ('common', 'diagnostics')}, + 'final_pair_recheck_complete': True, 'known_lease_close_completed': lease_closed, + 'primary_error': None, 'secondary_errors': [], 'measured_through_ns': costs['through_ns'], + 'actual_costs_through_ns': costs, 'enclosing_accounting_source_pin': selection['accounting_selection'], + 'enclosing_tail_join_required': True} + _validate_publication(publication, manifest, manifest_record) + publication_raw = _canonical(publication) + b'\n' + _need(len(publication_raw) <= _META_CAP, 'G12-N15: publication metadata cap') + _write_fd(reserved['publication.json'], publication_raw) + os.close(reserved['publication.json']) + del reserved['publication.json'] + os.fsync(retained[0][-1]) + publication_record, observed = _read_file(selection['parent_retained_directory'] + '/publication.json', _META_CAP, 0o444) + _need(observed == publication_raw and _identity(os.fstat(retained[0][-1])) == directory_identity, + 'G12-N15: final publication readback/directory identity') + current() + # This candidate is not a source selection or completed enclosing invoice. + candidate_pin = (manifest_record['path'], manifest_record['sha256'], manifest_record['bytes'], + tuple(manifest_record['identity'][k] for k in _ID_NAMES), selection['source_pins']['parent']['path'], + selection['source_pins']['parent']['sha256'], publication_record['path'], + publication_record['sha256'], publication_record['bytes']) + + def _g12_finish_failure(): + """P09: always preserve actual first failure, known cleanup and partial originals.""" + nonlocal lease_closed + # Every later error is retained separately; no receipt or PASS replacement. + if chain is not None and not chain.closed: + try: + chain.finish(process, selection['body_deadline_ns'] + selection['retention_tail_allowance_ns'], True) + except BaseException as error: + secondaries.append((error, error.__traceback__)) + for name, descriptor in tuple(outer.items()): + try: + os.close(descriptor) + del outer[name] + except BaseException as error: + secondaries.append((error, error.__traceback__)) + for name, descriptor in tuple(reserved.items()): + try: + os.close(descriptor) + del reserved[name] + except BaseException as error: + secondaries.append((error, error.__traceback__)) + if lease is not None and not lease_closed: + try: + os.close(lease) + lease_closed = True + except BaseException as error: + secondaries.append((error, error.__traceback__)) + # Failure-tail raw records are never advertised as canonical guard data. + if observation is not None and (primary is not None or secondaries): + try: + failures = {'schema': 'g12-parent-failed-attempt-v1', 'attempted': attempted, + 'actual_returncode': None if process is None else process.returncode, + 'primary': None if primary is None else repr(primary[0]), + 'ordered_secondaries': [repr(item[0]) for item in secondaries], + 'known_cleanup': 'UNKNOWN' if chain is None or not chain.closed else 'KNOWN_SELECTED_CHAIN_ONLY', + 'actual_costs_through_prewrite': _actual_costs(entry_ns, own_start, children_start), + 'enclosing_full_failure_tail_required': True} + _copy_file(observation, 'FAILED-ATTEMPT.json', _canonical(failures) + b'\n') + except BaseException as error: + secondaries.append((error, error.__traceback__)) + for domain in (science_directory, run_directory, retained, observation): + if domain is not None: + for descriptor in reversed(domain[0]): + try: + os.close(descriptor) + except BaseException as error: + secondaries.append((error, error.__traceback__)) + + try: + _g12_preflight_and_claim() + _g12_launch_once() + _g12_observe_wait_and_close() + _g12_join_original_guard_evidence() + _g12_collect_complete_pair() + _g12_retain_parent_pair_and_evidence() + _g12_seal_once() + except BaseException as error: + primary = error, error.__traceback__ + try: + _g12_finish_failure() + except BaseException as error: + # Preserve primary even if a secondary bookkeeping append itself failed. + if primary is None: + primary = error, error.__traceback__ + else: + try: + primary[0].add_note('P09 bookkeeping failure: ' + repr(error)) + except BaseException: + pass + _raise_preserved(primary, secondaries) + _need(candidate_pin is not None and lease_closed and not outer and not reserved, + 'G12-N15: final tail incomplete; manifest remains unselected') + return candidate_pin diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/integration/g12_reference_adapter_v1.py.txt b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/integration/g12_reference_adapter_v1.py.txt new file mode 100644 index 0000000000..cd582600f7 --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody-implementation/pre-correction-source-v1/integration/g12_reference_adapter_v1.py.txt @@ -0,0 +1,420 @@ +"""Fixed integration adapter: unchanged G12 producer under the actual injected Root. +SOURCE ONLY. The exact new stage is not mounted and no run is authorized. +""" +import os +import sys +import stat +import json +import hashlib +import math +from types import FunctionType, CodeType, ModuleType +_ROOT_PIN = 'f5a2d33f2b4d3651f214156a0e7094c2bb516ce2d5ab7698d18c11f98f35dee0' +_PROVIDER_PIN = '9cbb7368f89e71d1e6cc46db5dc77efed3e03ed2a801c98c88fe316e4d9f3ef2' +_PRODUCER_PIN = 'a346025d5b6e2b26246521c6af6292643a4c2c3286b33ff3996dcf051cd6be26' +_BOOTSTRAP = (bootstrap_root, bootstrap_capability, bootstrap_api) +_CHUNK = 65536 +_MISSING = object() +_ID_NAMES = ('dev', 'ino', 'full_st_mode', 'size', 'mtime_ns', 'ctime_ns') +_R = '/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028' + +def _need(condition, message): + if not condition: + raise RuntimeError(message) + + +def _exact(value, expected): + if type(value) is not type(expected): + return False + if type(value) in (list, tuple): + return len(value) == len(expected) and all(_exact(a, b) for a, b in zip(value, expected)) + if type(value) is dict: + return set(value) == set(expected) and all(_exact(value[k], expected[k]) for k in expected) + return value == expected + + +def _fields(value, fields): + _need(type(value) is dict and all(type(k) is str for k in value) and + set(value) == set(fields), 'G12-N12: exact field domain differs') + + +def _digest(value): + return type(value) is str and len(value) == 64 and all(c in '0123456789abcdef' for c in value) + + +def _uint(value, positive=False): + _need(type(value) is int and value >= (1 if positive else 0), 'G12-N12: exact integer domain') + + +def _number(value): + _need(type(value) in (int, float) and math.isfinite(value) and value >= 0, + 'G12-N12: finite nonnegative exact number required') + + +def _path(path): + _need(type(path) is str and path.startswith('/') and + all(p not in ('', '.', '..') for p in path.split('/')[1:]), 'G12-N11: absolute canonical path') + return path + + +def _identity(info): + return dict(zip(_ID_NAMES, (info.st_dev, info.st_ino, info.st_mode, info.st_size, + info.st_mtime_ns, info.st_ctime_ns))) + + +def _directory_key(info): + return info.st_dev, info.st_ino, info.st_mode + + +def _directory_chain(path): + """Held no-follow chain; no later absolute path silently changes its owner.""" + _path(path) + fds, rows = [], [] + primary = None + try: + fd = os.open('/', os.O_RDONLY | os.O_DIRECTORY | os.O_CLOEXEC) + fds.append(fd) + for part in path.split('/')[1:]: + before = os.stat(part, dir_fd=fd, follow_symlinks=False) + _need(stat.S_ISDIR(before.st_mode), 'G12-N11: directory component type') + child = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW | os.O_CLOEXEC, + dir_fd=fd) + fds.append(child) + opened = os.fstat(child) + _need(_directory_key(before) == _directory_key(opened), 'G12-N11: directory replaced') + rows.append((fd, part, child, _directory_key(opened))) + fd = child + return fds, rows + except BaseException as error: + primary = (error, error.__traceback__) + secondary = [] + for descriptor in reversed(fds): + try: + os.close(descriptor) + except BaseException as error: + secondary.append((error, error.__traceback__)) + _raise_preserved(primary, secondary) + + +def _check_chain(rows): + for parent, name, descriptor, key in rows: + _need(_directory_key(os.fstat(descriptor)) == key == + _directory_key(os.stat(name, dir_fd=parent, follow_symlinks=False)), + 'G12-N11: directory binding changed') + + +def _raise_preserved(primary, secondaries): + """Never replace first raw failure if evidence formatting or retention fails.""" + if primary is not None: + error, traceback = primary + try: + error.add_note('G12 ordered secondary failures: ' + repr(secondaries)) + except BaseException: + pass + raise error.with_traceback(traceback) + if secondaries: + error, traceback = secondaries[0][:2] + raise error.with_traceback(traceback) + + +def _read_file(path, cap, mode=None): + _path(path) + parent, name = path.rsplit('/', 1) + fds, rows = _directory_chain(parent) + descriptor, primary, secondary, result = None, None, [], None + try: + before = os.stat(name, dir_fd=fds[-1], follow_symlinks=False) + _need(stat.S_ISREG(before.st_mode) and before.st_nlink == 1 and + 0 <= before.st_size <= cap and (mode is None or before.st_mode == stat.S_IFREG | mode), + 'G12-N11: regular-file size/mode/link domain') + descriptor = os.open(name, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK | os.O_CLOEXEC, + dir_fd=fds[-1]) + opened = os.fstat(descriptor) + _need(_identity(before) == _identity(opened) and opened.st_nlink == 1, + 'G12-N11: file changed on open') + count, blocks, hasher = 0, [], hashlib.sha256() + while count < opened.st_size: + block = os.read(descriptor, min(_CHUNK, opened.st_size - count)) + _need(bool(block), 'G12-N11: short file read') + count += len(block) + hasher.update(block) + blocks.append(block) + _need(os.read(descriptor, 1) == b'', 'G12-N11: file grew') + after = os.fstat(descriptor) + ending = os.stat(name, dir_fd=fds[-1], follow_symlinks=False) + _need(_identity(before) == _identity(after) == _identity(ending) and + after.st_nlink == ending.st_nlink == 1, 'G12-N11: full file identity changed') + _check_chain(rows) + result = ({'path': path, 'sha256': hasher.hexdigest(), 'bytes': count, + 'identity': _identity(after), 'nlink': 1}, b''.join(blocks)) + except BaseException as error: + primary = (error, error.__traceback__) + for fd in ([descriptor] if descriptor is not None else []) + list(reversed(fds)): + try: + os.close(fd) + except BaseException as error: + secondary.append((error, error.__traceback__)) + _raise_preserved(primary, secondary) + return result + + +def _pairs(items): + result = {} + for key, value in items: + _need(type(key) is str and key not in result, 'G12-N12: duplicate JSON key') + result[key] = value + return result + + +def _nonfinite(value): + raise ValueError('G12-N12: nonfinite JSON token: ' + value) + + +def _canonical(value): + return json.dumps(value, sort_keys=True, separators=(',', ':'), ensure_ascii=True, + allow_nan=False).encode('ascii') + + +def _json(raw, cap, canonical=False, newline=False): + _need(type(raw) is bytes and len(raw) <= cap, 'G12-N12: raw JSON bound') + # Scan lexical nesting before json.loads recursion or object materialization. + depth, quoted, escaped = 0, False, False + for char in raw: + if quoted: + if escaped: + escaped = False + elif char == 92: + escaped = True + elif char == 34: + quoted = False + elif char == 34: + quoted = True + elif char in (91, 123): + depth += 1 + _need(depth <= 256, 'G12-N12: JSON depth limit') + elif char in (93, 125): + depth -= 1 + _need(depth >= 0, 'G12-N12: JSON nesting') + _need(depth == 0 and not quoted, 'G12-N12: incomplete JSON') + value = json.loads(raw.decode('utf-8'), object_pairs_hook=_pairs, parse_constant=_nonfinite) + pending, count = [(value, 0)], 0 + while pending: + item, depth = pending.pop() + count += 1 + _need(count <= cap and depth <= 256, 'G12-N12: JSON node/depth limit') + if type(item) is dict: + pending.extend((x, depth + 1) for pair in item.items() for x in pair) + elif type(item) is list: + pending.extend((x, depth + 1) for x in item) + elif type(item) is str: + _need(len(item) <= cap, 'G12-N12: JSON string limit') + elif type(item) is float: + _need(math.isfinite(item), 'G12-N12: overflowed JSON number') + else: + _need(item is None or type(item) in (bool, int), 'G12-N12: JSON primitive') + if canonical: + _need(raw == _canonical(value) + (b'\n' if newline else b''), 'G12-N12: canonical JSON bytes') + return value + + +def _capture_graph(namespace): + """Capture the fixed own/JSON function graph before candidate exposure.""" + modules = (json, json.decoder, json.encoder, json.scanner, hashlib, os, stat, math) + namespaces = [namespace] + [module.__dict__ for module in modules] + records, members, seen = [], [], set() + for mapping in namespaces: + members.append((mapping, tuple(mapping.items()))) + for value in mapping.values(): + candidates = [value] + if type(value) is type: + candidates.extend(value.__dict__.values()) + for function in candidates: + if type(function) is not FunctionType or id(function) in seen: + continue + seen.add(id(function)) + records.append((function, function.__code__, function.__globals__, function.__builtins__, + function.__defaults__, function.__kwdefaults__, function.__closure__, + tuple(function.__dict__.items()), + () if function.__kwdefaults__ is None else tuple(function.__kwdefaults__.items()), + () if function.__closure__ is None else tuple((c, c.cell_contents) for c in function.__closure__))) + return tuple(records), tuple(members) + + +def _current_graph(graph): + records, members = graph + for mapping, rows in members: + # The capture itself is assigned once after this snapshot. + expected = dict(rows) + for name, value in rows: + _need(mapping.get(name, _MISSING) is value, 'G12-N04: captured namespace member changed: ' + name) + extra = set(mapping) - set(expected) + _need(not extra or mapping is globals() and extra == {'_INITIAL_GRAPH'}, + 'G12-N04: captured namespace census changed') + for f, code, namespace, builtin, defaults, kw, cells, attrs, kws, contents in records: + _need(f.__code__ is code and f.__globals__ is namespace and f.__builtins__ is builtin and + f.__defaults__ is defaults and f.__kwdefaults__ is kw and f.__closure__ is cells and + len(f.__dict__) == len(attrs), 'G12-N04: captured function graph changed') + for name, value in attrs: + _need(f.__dict__.get(name, _MISSING) is value, 'G12-N04: function attributes changed') + if kw is not None: + _need(len(kw) == len(kws), 'G12-N04: keyword-default census changed') + for name, value in kws: + _need(kw.get(name, _MISSING) is value, 'G12-N04: keyword defaults changed') + for cell, value in contents: + _need(cell.cell_contents is value, 'G12-N04: captured closure changed') + + +def _source_code_shape(code): + _need(type(code) is CodeType, 'G12-N04: exact code type') + def constant(value): + kind = type(value) + if value is None or value is Ellipsis: + return ('singleton', value is Ellipsis) + if kind in (int, bool, str, bytes): + return (kind.__name__, value) + if kind is float: + return ('float', value.hex()) + if kind is tuple: + return ('tuple', tuple(constant(item) for item in value)) + if kind is frozenset: + return ('frozenset', tuple(sorted(constant(item) for item in value))) + if kind is CodeType: + return ('code', _source_code_shape(value)) + raise RuntimeError('G12-N04: unsupported source code constant') + return tuple(constant(value) for value in ( + code.co_argcount, code.co_posonlyargcount, code.co_kwonlyargcount, + code.co_nlocals, code.co_stacksize, code.co_flags, code.co_code, + code.co_names, code.co_varnames, code.co_freevars, code.co_cellvars, + code.co_exceptiontable, code.co_linetable, code.co_firstlineno, + code.co_filename, code.co_name, code.co_qualname, code.co_consts)) + + +def _authenticate_own_functions(root, api, source, path): + _need(api[0]() == _ROOT_PIN, 'G12-N04: Root before selected-source compilation') + code = root._COMPILE(source, path, 'exec', dont_inherit=True, optimize=0) + declared = {item.co_name: item for item in code.co_consts if type(item) is CodeType} + for name, function in tuple(globals().items()): + if type(function) is FunctionType and function.__globals__ is globals(): + _need(name in declared and function.__builtins__ is root.builtins.__dict__ and + _source_code_shape(function.__code__) == _source_code_shape(declared[name]), + 'G12-N04: actual entire own callable differs from selected source: ' + name) + _need(api[0]() == _ROOT_PIN, 'G12-N04: Root after selected-source compilation') + + + +def _g12_adapter_entry(): + root, capability, api = _BOOTSTRAP + _need(root is bootstrap_root and capability is bootstrap_capability and api is bootstrap_api and + type(root) is ModuleType and type(api) is tuple and len(api) == 4 and + all(type(f) is FunctionType and f.__globals__ is root.__dict__ for f in api), + 'G12-N04: unchanged initially injected actual bootstrap objects required') + _need(api[0]() == _ROOT_PIN and sys.flags.optimize == 0, 'G12-N02: Root/assertion source mismatch') + api[1](capability, _PROVIDER_PIN) + _current_graph(_INITIAL_GRAPH) + stage = _R + '/stages/g12-reference-custody-v1' + adapter = stage + '/integration/g12_reference_adapter_v1.py' + _need(__file__ == adapter and type(sys.argv) is list and len(sys.argv) == 5 and + sys.argv[0] == adapter and sys.argv[1] == '--output' and + sys.argv[3:] == ['--lanes', 'g12-reference'], 'G12-N03: exact original guard argv tail') + output = _path(sys.argv[2]) + prefix = _R + '/runtime/runs/' + _need(output.startswith(prefix) and output.endswith('/science'), 'G12-N03: selected guard science path') + label = output[len(prefix):-len('/science')] + _need(bool(label) and all(c in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_' for c in label), + 'G12-N03: fixed simple guard label') + parent_fds, parent_rows = _directory_chain(output.rsplit('/', 1)[0]) + primary, secondary = None, [] + try: + try: + os.stat('science', dir_fd=parent_fds[-1], follow_symlinks=False) + except FileNotFoundError: + pass + else: + raise RuntimeError('G12-N05: prior science output exists') + _check_chain(parent_rows) + except BaseException as error: + primary = error, error.__traceback__ + for descriptor in reversed(parent_fds): + try: + os.close(descriptor) + except BaseException as error: + secondary.append((error, error.__traceback__)) + _raise_preserved(primary, secondary) + own_record, own_source = _read_file(adapter, 262144, 0o444) + stage_record, stage_raw = _read_file(stage + '/STAGE.json', 262144, 0o444) + declared = _json(stage_raw, 262144) + _need(declared['files']['integration/g12_reference_adapter_v1.py'] == + {'sha256': own_record['sha256'], 'mode': 0o444}, 'G12-N02: exact guard-selected adapter source') + _authenticate_own_functions(root, api, own_source, adapter) + producer_path = stage + '/baseline/full_driver.py' + source_record, source = _read_file(producer_path, 1048576, 0o444) + _need(source_record['sha256'] == _PRODUCER_PIN and source_record['bytes'] == 70246, + 'G12-N02: unchanged accepted producer bytes/mode') + _need(api[0]() == _ROOT_PIN, 'G12-N04: Root before source hashing') + digest, count, actual_source = root._hash_regular(producer_path, 1048576, True) + _need(digest == _PRODUCER_PIN and count == 70246 and actual_source == source, + 'G12-N02: original Root full source hash') + api[1](capability, _PROVIDER_PIN) + producer_argv = [producer_path, '--frozen-root', stage + '/baseline/frozen', + '--reference', stage + '/baseline/reference/certificates/complex-network.json', + '--mode', 'profile', '--output', output] + producer = root.ModuleType('__main__') + namespace = producer.__dict__ + namespace.update({'__file__': producer_path, '__name__': '__main__', + '__builtins__': root.builtins.__dict__, 'bootstrap_root': root, + 'bootstrap_capability': capability, 'bootstrap_api': api}) + argv_owner, modules_owner = sys.argv, sys.modules + prior_main = modules_owner['__main__'] + _need(prior_main.__dict__ is globals(), 'G12-N04: actual Root-installed adapter module owner') + code = root._COMPILE(source, producer_path, 'exec', dont_inherit=True, optimize=0) + _need(api[0]() == _ROOT_PIN, 'G12-N04: Root before unchanged producer entry') + primary, secondary = None, [] + # Install precisely the two Root._entry alias slots. Do not intercept or + # reinterpret the producer completion marker; only its ordinary return wins. + sys.argv = producer_argv + modules_owner['__main__'] = producer + try: + root._EXEC(code, namespace) + _need(sys.argv is producer_argv and sys.modules is modules_owner and + modules_owner.get('__main__') is producer, 'G12-N09: producer alias ownership lost') + api[1](capability, _PROVIDER_PIN) + _need(api[0]() == _ROOT_PIN, 'G12-N09: Root after unchanged producer ordinary return') + _need(_read_file(producer_path, 1048576, 0o444) == (source_record, source), + 'G12-N09: producer source changed after return') + _need(root._hash_regular(producer_path, 1048576, False)[:2] == (_PRODUCER_PIN, 70246), + 'G12-N09: final actual Root full producer digest') + except BaseException as error: + primary = error, error.__traceback__ + # Each restoration is attempted independently; a foreign slot is never + # overwritten and a secondary cannot replace the retained original primary. + try: + _need(sys.argv is producer_argv, 'G12-N09: argv restoration owner lost') + sys.argv = argv_owner + except BaseException as error: + secondary.append((error, error.__traceback__)) + try: + _need(sys.modules is modules_owner and modules_owner.get('__main__') is producer, + 'G12-N09: module restoration owner lost') + modules_owner['__main__'] = prior_main + except BaseException as error: + secondary.append((error, error.__traceback__)) + try: + _current_graph(_INITIAL_GRAPH) + api[1](capability, _PROVIDER_PIN) + _need(api[0]() == _ROOT_PIN, 'G12-N09: final bootstrap currentness') + _need(_read_file(adapter, 262144, 0o444) == (own_record, own_source) and + _read_file(stage + '/STAGE.json', 262144, 0o444) == (stage_record, stage_raw), + 'G12-N09: adapter/stage source drift') + except BaseException as error: + secondary.append((error, error.__traceback__)) + if secondary: + try: + sys.stderr.write('G12 adapter ordered secondary errors: ' + repr(secondary) + '\n') + sys.stderr.flush() + except BaseException as error: + secondary.append((error, error.__traceback__)) + _raise_preserved(primary, secondary) + + +_INITIAL_GRAPH = _capture_graph(globals()) +if __name__ == '__main__': + _g12_adapter_entry() diff --git a/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody/DESIGN-v1.json b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody/DESIGN-v1.json new file mode 100644 index 0000000000..df7b078d5c --- /dev/null +++ b/research/h25-cache-source-handoff/snapshot/areas/cache-s0308-source-completion-v2/g12-custody/DESIGN-v1.json @@ -0,0 +1,975 @@ +{ + "activity": { + "metadata_only_verification": "Read/hashes and JSON construction/parse of owned design metadata only; no target scientific payload/decoder or source was imported/executed.", + "network": 0, + "process_or_lock_operations": 0, + "protected_bookkeeping_runtime_runs_read_or_enumerated": false, + "report_files_written_only_under_owned_g12_custody": true, + "source_or_stage_implementation": 0, + "target_execution_tests_helpers_compiler_native_scientific_decoder_runs": 0, + "target_imports": 0 + }, + "adapter_contract": { + "actual_bootstrap": "bootstrap_root, bootstrap_capability, bootstrap_api are the same objects Root._entry injected, not caller descriptors, imported substitutes, or objects recovered from JSON.", + "authority_boundary": "Adapter passing authentic objects preserves the external Root-source selection premise. This is not Python self-authentication; it depends on the trusted launcher/Root/OS/interpreter/stdlib specified below.", + "checks_before_source_execution": [ + "Require optimize==0 and api[0]() equals pinned Root; validate actual capability with api[1](capability, exact provider pin); retain actual initially supplied root/API and source-owned operation aliases.", + "Require exact newstage integration adapter path, no symlink components, new external output path computed by the selected parent/guard run; output must not exist and cannot be below stage or frozen root.", + "Require accepted producer source complete digest/size/mode; actual Root._hash_regular on stage/baseline/full_driver.py with finite bound; authenticated API calls on both sides. The accepted producer is not edited.", + "Build exactly [producer_path, --frozen-root, stage/baseline/frozen, --reference, stage/baseline/reference/certificates/complex-network.json, --mode, profile, --output, guard_science_path]. Do not pass --anchor, --lanes, --finite-only or optimization flags to producer.", + "Create root.ModuleType(__main__) with exact producer __file__, builtins owner, and the unchanged actual bootstrap objects. Set its __name__ to __main__; save prior sys.argv object and sys.modules[__main__] identity; set producer argv/module alias.", + "Use root._COMPILE(exact_source, exact_producer_path, exec, dont_inherit=True, optimize=0), api currentness checks, then root._EXEC(code, fresh_producer_namespace). This is the same admitted source-execution leaf as Root._entry, not importlib/runpy reconstruction of the producer." + ], + "completion": "Only ordinary successful return through the unchanged producer._g12_reference_entry is eligible for adapter postchecks. The adapter never catches the producer marker to manufacture success and never calls producer internals separately.", + "entry_function": "_g12_adapter_entry()", + "input_argv": "Exactly [absolute_adapter_path, --output, absolute_guard_run_science_path, --lanes, g12-reference]; no other arguments.", + "restoration_and_errors": "After source execution, require producer argv/module aliases retain their expected identities before restoration. Restore only owned slots once; retain first raw exception/traceback and ordered secondary errors, emit stderr where possible; any secondary blocks ordinary adapter success. Do not overwrite a foreign slot or replace the original primary. Require api[0] and producer source bytes unchanged after return.", + "source_anchors": { + "guard": [ + [ + 230, + 247 + ] + ], + "producer": [ + [ + 136, + 174 + ], + [ + 858, + 860 + ], + [ + 1094, + 1178 + ], + [ + 1190, + 1226 + ] + ], + "root": [ + [ + 804, + 833 + ] + ] + } + }, + "authority": { + "path": "/home/d3lerium/.codex/.chatgpt-projects/g-p-6ad5817fd84881918865926b6fd51453/outputs/h25-data-handling-20261028/areas/cache-s0308-source-completion-v2/parent/AUTHORIZATION-v2.json", + "scope": "Parent delegated bounded G12 custody design only; independent exact design review required before implementation; no execution authority.", + "sha256": "9e32514288fed2b1d2873387bf81861ffcd9e1b56d2ab4828be13a311e629106" + }, + "cold_consumer_design": { + "authenticity_limit": "Source selection of the parent manifest/publication record establishes immutable data provenance under the trusted launcher. Consumer does not recreate parent Popen/lease/owner from JSON; absence of valid source selection stays closed.", + "caller_authority": "Only the existing authenticated cold registered-source entry may call it, passing initially captured actual Root/capability/API before candidate exposure. Verify its exact source/argument ownership there; function shape checks alone cannot authenticate a supplied root.", + "costs": "All reads, hashes, strict parsing, complete hex decode, final triple/pair rechecks, retained memory and source/cold checks are charged to the actual candidate/reference invoice. No reference production or custody is amortized away or treated as free.", + "function": "load_original_g12_reference(root, capability, api) -> (literal,count,common_bytes,provenance)", + "order": [ + "Call authentic api[0] and api[1](capability, expected provider pin), verify selected consumer function/source identity and pristine source-owned read/JSON/hash operation aliases under the cold entry; None fails immediately.", + "Read exact source-selected manifest with complete bytes/mode/path identity checks and original Root._hash_regular on both sides. Root._hash_regular L480-506 alone does not check full mode or final path identity; add source-owned nofollow/dirfd/full-mode checks without modifying Root.", + "Parse strict manifest schema; require pinned parent source identity and exact fixed Root/provider/adapter/producer/authority/guard/workload/argv bindings. Validate complete successful guard and actual-terminal fields as part of authenticated parent manifest data, not as independently trusted booleans.", + "Verify the source-selected final publication/accounting record joins this exact manifest digest and parent source and records successful final close/tail; do not synthesize it from manifest fields. Retained original raw evidence remains fully available; manifest holds complete parent-validated original START/receipt field joins.", + "Read both retained common and diagnostic complete files under actual Root and fixed manifest FileRecords, strict exact schema/crosslink checks, decode full common hex and hash it; retain complete raw diagnostic bytes/provenance even though it is not a candidate equality output.", + "After decode, re-read manifest and BOTH retained exports and publication record, recheck complete hashes, modes, identities and directory bindings together, then authentic Root/API currentness and selected consumer ownership once more. Mutation of diagnostics after the first common read rejects.", + "Expose only observed exact bool literal, positive exact int count, opaque complete common bytes, and immutable provenance including manifest/pair/publication/source/workload pins. Keep full diagnostics in parent retention; do not promote diagnostic counters to expected scientific equality values." + ], + "original_transport_not_adopted": "The existing common-only fourtuple draft is insufficient and remains unselected; it is a location/pattern reference only, not an accepted transport dependency.", + "source_selection": "G12_REFERENCE_HANDOFF = None remains unchanged in the existing draft. Proposed new consumer also starts None. Later immutable source literal is (manifest_absolute_path,manifest_sha256,manifest_bytes,manifest_identity,parent_source_path,parent_source_sha256,final_publication_record_path,final_publication_record_sha256,final_publication_record_bytes). This is source-selected after actual parent custody and final accounting; no runtime setter/callback/registry." + }, + "design_decisions": [ + "Use a G12-specific trusted parent with its own actual Popen of the unchanged original guard. Do not call the full historical composed controller or relabel the current funded runner as a G12 executor.", + "Use the existing actual Root/provider bootstrap and one small fixed integration adapter. The adapter source-executes the unchanged producer from the baseline directory using the actual Root/capability/API objects it received from Root._entry.", + "A scoped known-process observation leaf follows the current supervisor generation/pidfd pattern. It does not claim universal writer exclusion or a hostile-fork sandbox. Missing/denied/ambiguous observations fail closed.", + "Create the immutable retained parent domain only after successful guard join and known process/stream cleanup. It is outside every declared child output subtree and has no inherited directory or writable file descriptor.", + "Parent source-owned completion, exact original guard START/receipt/raw logs, both complete exports and known custody must all join before sealing. A serialized PASS, caller success boolean, common-only payload or diagnostic completion text is insufficient.", + "Later cold consumption authenticates a separately source-selected manifest and both retained exports under the actual Root. It transports original literal/count/common bytes and provenance; it does not reconstruct a live parent or add a new oracle.", + "All current runtime/source selections remain None. Actual future output hashes are values produced by the future successful custody operation; they are not prerequisites to this source design or a reason to invent payloads." + ], + "finite_IO_contract": { + "FileIdentity": "Exact tuple(dev:int>=0, ino:int>0, full_st_mode:int, size:int>=0, mtime_ns:int, ctime_ns:int); retain nlink:int and require regular, nonsymlink, nlink==1 for named files. Exclude atime only because own reads may change it.", + "cap_semantics": "Finite rejection ceilings only, not a resource grant or evidence that actual data fits. Original 1GiB/resource/body caps still apply to simultaneous raw bytes, JSON trees, decoded hex and copies; over-cap or insufficient paid headroom blocks before materialization. Any actual size above selected bound is a visible closed branch, not silent truncation.", + "chunk_bytes": 65536, + "common_cap_bytes": 268435456, + "current_action": "These are source requirements only; no export file or runtime evidence has been read or decoded.", + "diagnostic_cap_bytes": 268435456, + "future_decoder_limits": "Source-fixed depth <=256; decoded node_count <= the relevant fixed file byte ceiling; individual string/hex length <= that ceiling. These are exact defensive rejection limits, checked within genuine memory/time budget. No relaxation/retry during actual custody.", + "json": "Exact UTF-8/ASCII canonical producer JSON plus one newline, duplicate keys rejected by object_pairs_hook at all levels, reject NaN/Infinity, only exact builtin JSON primitives; booleans never pass integer fields. Bound raw bytes before decoding, decoded depth/node/hex work by selected finite limits inside actual resource/time budget. Do not execute target scientific decoders or import producer to validate data.", + "metadata_cap_bytes": 262144, + "read_pair": "Use authenticated source-owned openat/no-follow directory traversal and held dirfd, O_RDONLY|O_NOFOLLOW|O_NONBLOCK|O_CLOEXEC. lstat/path identity == opened fstat == post-read fstat == final lstat. Read exactly initial size in bounded chunks plus bounded EOF confirmation; short read, growth, replacement, changed mode/link count, wrong parent directory, or close error rejects. Recheck both originals jointly after both reads and before commit; retained copies receive same checks.", + "write_copy": "Exclusive O_CREAT|O_EXCL|O_NOFOLLOW|O_CLOEXEC; partial writes loop with positive progress; hash all written bytes; fsync/fchmod/readback/known close; no copy operation is assumed complete from its return status alone." + }, + "finite_negative_branches": [ + { + "id": "G12-N01", + "result": "Reject before dependent operation; no execution or expected reference.", + "trigger": "launch or handoff source selection None/missing/foreign" + }, + { + "id": "G12-N02", + "result": "Reject before scientific entry; unchanged accepted producer remains intact.", + "trigger": "Root/provider/adapter/producer/authority/stage/source/reference pin or mode mismatch, historical 2a941 authority" + }, + { + "id": "G12-N03", + "result": "Adapter refuses; never silently removes an unrecognized option.", + "trigger": "wrong guard tail, --finite-only, -O, wrong lanes, supplied anchor or alternate producer CLI" + }, + { + "id": "G12-N04", + "result": "Cold/adapter source entry refuses; shapes/status do not establish provenance.", + "trigger": "fake or restored Root/API/capability, copied function namespace, foreign initial source owner" + }, + { + "id": "G12-N05", + "result": "No launch or no publication; preserve failed attempt; no retry.", + "trigger": "budget/phase/lease contention, prior label output, orphan prior attempt, inadequate full tail" + }, + { + "id": "G12-N06", + "result": "Bounded known cleanup and raw evidence; no canonical success receipt invented.", + "trigger": "Popen raises or no retained Popen/generation, nonzero return, timeout/RSS/output cap, parent STOP" + }, + { + "id": "G12-N07", + "result": "Reject pair sealing; outer status cannot override guard predicates.", + "trigger": "guard return0 but receipt absent/nonzero/termination/STOP/stderr/input drift/log drift/usage incomplete" + }, + { + "id": "G12-N08", + "result": "Cleanup/custody UNKNOWN; no manifest selection or universal closure claim.", + "trigger": "unknown/denied process observation, remaining descendant/group/child, unknown stream/FD close, namespace owner loss" + }, + { + "id": "G12-N09", + "result": "Preserve first primary and ordered secondaries; reject successful completion even if files exist.", + "trigger": "producer primary/secondary/restoration/cold2 failure, adapter ownership/restoration failure" + }, + { + "id": "G12-N10", + "result": "Retain partial originals, no manifest or common-only fallback.", + "trigger": "only common export, missing diagnostic, partial diagnostic, missing common" + }, + { + "id": "G12-N11", + "result": "Reject complete-byte custody; no stable/read-only shortcut.", + "trigger": "symlink/hardlink/foreign namespace, short read, changed size/mode/identity or incomplete hash" + }, + { + "id": "G12-N12", + "result": "Reject without target science decoding or repair.", + "trigger": "duplicate JSON key, NaN/Infinity, bool-as-int, unknown schema/field/tag, bad hex, finite decoder limit exceeded" + }, + { + "id": "G12-N13", + "result": "Reject; matching self-reported completion strings are irrelevant.", + "trigger": "producer/role/source/workload mismatch across pair/manifest, payload hash or inner-prefix mismatch" + }, + { + "id": "G12-N14", + "result": "Preserve partial retained files with no seal; final manifest bytes alone do not qualify.", + "trigger": "copy/fsync/chmod/close/readback/final alias check failure or unexpected child after first check" + }, + { + "id": "G12-N15", + "result": "Manifest stays unselected; handoff None; no completed invoice or custody approval.", + "trigger": "manifest written but enclosing final cost/close/publication tail fails or lacks actual authority" + }, + { + "id": "G12-N16", + "result": "Reject; only later immutable source literal selects actual parent custody.", + "trigger": "candidate source supplies success bool, result registry or arbitrary manifest path at runtime" + }, + { + "id": "G12-N17", + "result": "No expected literal/count/common is exposed.", + "trigger": "cold recheck detects manifest/common/diagnostic/publication mutation or Root/reader ownership drift" + }, + { + "id": "G12-N18", + "result": "Out of scope; original separate controls remain required.", + "trigger": "attempt to use G12 diagnostics as P02 standard-workload/native/full-positive/performance approval" + } + ], + "full_cost_invoice": { + "accounting_rule": "Measure whole parent entry through final close/retention/publication with monotonic wall and self+children CPU, preserve original GNU time/guard raw measurements and peak/lifetime memory observations, and separately meter later cold-consumer work. Nested producer phase timings are not added as if disjoint. No reclassification of profile as performance sample.", + "bounds": "Preserve first failure and every observed cap; never silently truncate complete files to fit, reroll a failure, hide secondary cost or drop diagnostic retention.", + "execution_gate": "Actual later run must have a separately authorized exact source-owned budget/phase covering entire parent/reference/custody/consumer/publication costs. Original guard phase/lock/limit checks remain unchanged. Future numerical caps/reservations are not invented here. Lack of runtime authority does not block construction/review of this closed source design.", + "no_budget_or_funding_created": true, + "required_categories": [ + "source/stage/plan/authentication and dependency preflight", + "parent invocation setup and known lease operations", + "adapter bootstrap source read/hash/compile/exec and argv/module alias custody/restoration", + "entire independent uncached reference including fresh copies/engine imports/original CLI/trace capture/original checks/finally/restoration/cold2", + "guard launch/time/monitoring/STOP/final original source inventory/usage/raw-log hashing/receipt", + "actual parent wait and known descendant/group/FD cleanup", + "canonical receipt and START joins plus all complete raw evidence retention", + "both exports full reads/hashes/JSON/schema/payload decode/crosslinks and repeated pair checks", + "new parent copies/write/fsync/chmod/close/directory sync/readback", + "manifest schema/write/hash/fsync/close/readback and source-selection publication tail", + "parent failure/secondary-error retention and necessary cleanup after deadline", + "cold consumer complete manifest/pair/publication read/hash/parse/decode/recheck and all retained alias lifetimes" + ], + "tail_rule": "Manifest stores preseal costs and exact billing boundaries. After manifest write/readback and actual lease close, a fixed source-owned final-publication record joins manifest hash and complete operation costs through its own pre-write point. A separately retained authoritative enclosing completion charge covers final-record write/readback/close and final source-selection publication. The enclosing receipt cannot be replaced by a self-reported completed flag. If no actual authorized enclosing source-owned accounting path covers that last tail, selection remains None; no infinite self-accounting recursion or free tail claim." + }, + "known_process_and_namespace_contract": { + "failure_limit": "If failed launch/guard leaves an unseen or unadopted descendant outside observed known ownership, source records cleanup UNKNOWN and never seals. It must not claim a universal cleanup result from inherited process-group kill alone.", + "leaf_basis": "Current supervisor proc/census/generation/children_now L114-146 and OwnedDomain L205-309; use only this finite G12 observation/cleanup leaf, not bind_active_run_root or current controller. No native subreaper installation is required for successful fixed wait chain under stated premise; no claim about arbitrary orphaning/hostile fork.", + "mandatory_leaf_differences": "PermissionError, malformed/oversized process metadata, failed descriptor close, unknown observation, generation ambiguity or unsupported pidfd operation is a STOP/unknown result; never interpret it as empty. Never signal parent or a PID without retained generation/pidfd. Initial parent child set and thread set must be empty/single-task; no concurrent children may be created.", + "namespace": "Original guard run folder and producer science directory are fixed from the selected label, were absent before launch, and are retained by identity after join. Parent lease and source-selected role restrictions exclude another cooperating writer. Directory FD chain checks reject symlink components/rename/substitution. Symlink/hardlink/foreign names and unexpected output alias ownership block pair custody.", + "parent_domain": "Fresh R/runtime/g12-reference-parent-custody-v1/