From b599a781bfa8a8fb09a8dea7fa924edb353c21cb Mon Sep 17 00:00:00 2001 From: AAAmirinu <89093942+AAAmirinu@users.noreply.github.com> Date: Thu, 15 Oct 2026 15:01:19 +0900 Subject: [PATCH] Add exact Windows input-role adapter for selected replay comparison --- .../selected-windows-role-adapter/README.md | 152 +++++++++ .../selected-windows-role-adapter/RESULT.json | 198 ++++++++++++ .../SOURCES.json | 102 +++++++ .../selected-windows-role-adapter/TASK.json | 104 +++++++ .../VALIDATION.json | 25 ++ .../selected-windows-role-adapter/VERIFY.json | 38 +++ .../compare_roles.py | 120 ++++++++ .../vendor/pr2101/POLICY.json | 279 +++++++++++++++++ .../vendor/pr2101/SOURCES.json | 288 ++++++++++++++++++ .../vendor/pr2101/compare_outputs.py | 125 ++++++++ .../vendor/pr2101/vendor/invoice_compare.py | 125 ++++++++ .../vendor/pr2101/vendor/strict_compare.py | 260 ++++++++++++++++ .../selected-windows-role-adapter/verify.py | 262 ++++++++++++++++ 13 files changed, 2078 insertions(+) create mode 100644 research/selected-windows-role-adapter/README.md create mode 100644 research/selected-windows-role-adapter/RESULT.json create mode 100644 research/selected-windows-role-adapter/SOURCES.json create mode 100644 research/selected-windows-role-adapter/TASK.json create mode 100644 research/selected-windows-role-adapter/VALIDATION.json create mode 100644 research/selected-windows-role-adapter/VERIFY.json create mode 100644 research/selected-windows-role-adapter/compare_roles.py create mode 100644 research/selected-windows-role-adapter/vendor/pr2101/POLICY.json create mode 100644 research/selected-windows-role-adapter/vendor/pr2101/SOURCES.json create mode 100644 research/selected-windows-role-adapter/vendor/pr2101/compare_outputs.py create mode 100644 research/selected-windows-role-adapter/vendor/pr2101/vendor/invoice_compare.py create mode 100644 research/selected-windows-role-adapter/vendor/pr2101/vendor/strict_compare.py create mode 100644 research/selected-windows-role-adapter/verify.py diff --git a/research/selected-windows-role-adapter/README.md b/research/selected-windows-role-adapter/README.md new file mode 100644 index 0000000000..c6d262473f --- /dev/null +++ b/research/selected-windows-role-adapter/README.md @@ -0,0 +1,152 @@ +# Exact Windows input roles for the selected final-output comparator + +**Scoped verifier engineering; constructed relocation fixtures, no supplier +execution and no new kappa.** This adds an opt-in adapter for the six input +roles in Adam Gall's [PR2101](https://github.com/CrocSwap/integer-mult-bounds/pull/2101) +complete output comparison. All five required predecessor files are retained +byte-for-byte at `a247ef876e50bf3a7d890c7c1f9b409576674d7d` and authenticated +before import. + +PR2101's `compare_outputs.prepare` requires absolute POSIX roots and constructs +input keys with `/`. A correctly bound constructed Windows receipt therefore +fails with `root must be an absolute POSIX path`. Its output inventory already +uses POSIX relative names; the failure is confined to the six absolute input +keys. PR2101 explicitly did not claim a Windows execution result. + +## Contract and implementation + +`compare_roles.py` accepts a typed root `{style, path}` for each of `work` and +`local`. Supported styles are `posix` and `windows-drive`. A Windows root must +use its exact ordinary absolute drive spelling and backslashes. UNC, device, +extended-length, mixed-separator, relative, dot-component, trailing-dot/space, +reserved-device and alternate-data-stream spellings reject. These restrictions +are a bounded lexical input contract, not a Windows filesystem equivalence +algorithm. POSIX backslashes remain literal filename characters. + +For each side, the adapter: + +1. Requires the unchanged complete 105-file inventory and three external input + byte strings. It parses the independent receipt with the predecessor's + duplicate-key-aware, exact-number parser. +2. Builds the six expected native paths from the pinned role suffixes. Each + exact key must name its correct actual same-side input digest. Missing, + extra, stale, swapped and alternatively spelled keys reject. Windows keys + which collide under `casefold` reject conservatively; case is never folded + to accept a receipt. +3. Rewrites **only** those six authenticated keys in a copy of + `INDEPENDENT-T16.json` to fixed synthetic POSIX roots. No other string, key, + digest or field is rewritten. Receipt paths are never followed for I/O. +4. Delegates to PR2101's unchanged complete comparator, which authenticates the + six edges again, both invoice edges and all 22 log references; it compares + all 105 outputs with its original exact typed policy. The only inherited + quotients are the two authenticated invoice links, six role keys and 22 + fresh timing fields. All other fields, including historical times, remain + covered. The coupled outer-log validator is exposed unchanged. + +For a fixed validated context, construction gives six distinct expected keys. +Exact dictionary equality binds each key to its input digest before the +injective six-key translation. Thus the translation cannot erase a difference +in role assignment or any field outside that dictionary. This is the narrow +reason for the adapter; replacing every backslash in a receipt would not have +this property. The proof argument is source-level and the tests are finite, +not a formal verification of either comparator. + +Example use after loading this module: + +```python +reference_context = { + "work": {"style": "posix", "path": "/reviewed/run"}, + "local": {"style": "posix", "path": "/reviewed/local"}, + "external": reference_input_bytes, +} +candidate_context = { + "work": {"style": "windows-drive", "path": r"C:\replay\candidate"}, + "local": {"style": "windows-drive", "path": r"C:\replay\local"}, + "external": candidate_input_bytes, +} +report = compare_roles.compare(reference_files, candidate_files, + reference_context, candidate_context) +if not report["equivalent"]: + raise ValueError("complete output differs") +if (compare_roles.outer_log(reference_log, reference_files) != + compare_roles.outer_log(candidate_log, candidate_files)): + raise ValueError("coupled outer log differs") +``` + +`*_files` must contain the entire strict output directory, including all eleven +inner logs. The caller must authenticate its reference and supply the actual +three byte strings under `local-word`, `local-replay`, and `owners`. Merely +passing a trusted-looking root does not authenticate a supplier run. The test +fixture demonstrates the required archive and receipt bindings. + +## Verification and evidence + +```sh +python3.12 -I -B research/selected-windows-role-adapter/verify.py +python3.12 scripts/research_package.py --package research/selected-windows-role-adapter --check-only +python3.12 scripts/research_package.py --package research/selected-windows-role-adapter +``` + +The registered replay passed normally and under `-O` in 63.81 seconds total: +**6 positive controls and 176 rejected faults per execution**. All new guards +use explicit exceptions. `RESULT.json` lists every control. The fixture +authenticates both immutable archives, the ten PR1042 local provider inputs, +the PR1094 result/assembly/replay receipts and the selected owners. Its 105 +strict outputs and thirteen-line outer log are the reviewed archived run. + +Six constructed positives cover unchanged POSIX inputs, Windows drive paths +with Japanese characters and spaces, literal POSIX backslashes, an identical +Windows pair, Windows relocation composed with invoice reformatting and all +22 fresh timing changes, and its coupled outer log. Failure controls cover +all six digest/key omissions and aliases, all fifteen distinct role swaps, +all 105 output omissions, an extra output, fourteen unsupported root forms, +a six-key/five-Windows-identity collision, duplicate JSON keys, identical stale +inputs, scientific/type and raw-link changes, an unlisted path-like string, +an uncoupled log, and five immutable predecessor source mutations. + +Executed locally on native Windows with CPython 3.12.11. Native `Path` spelling +also agrees for the six constructed Windows keys. This observation is path +construction evidence, **not fresh Windows supplier output**. A separate Codex +agent reviewed the adapter, independently checked unchanged POSIX report +equality, non-mutation and the case-collision fixture, and identified a test +gap that was fixed: malformed roots are now tested directly instead of being +rejected incidentally by a stale receipt key. No independent human review or +hosted-CI pass is claimed. + +## Open next questions + +Apply this adapter to the separate fresh Windows successor replay coordinated +in [Discussion2333](https://github.com/CrocSwap/integer-mult-bounds/discussions/2333) +and published as [PR2336](https://github.com/CrocSwap/integer-mult-bounds/pull/2336). +Supply its exact roots and three actual external inputs, compare every output, +and validate the outer log. Stop on an unclassified scientific/log mismatch; +do not broaden normalization just to make a run pass. PR2336 reports eleven +CRLF-only inner-log differences. This adapter retains PR2101's byte-exact inner +log policy, so a full Windows comparison needs a separately reviewed log +policy if those differences are present. PR2336's execution is credited as a +concurrent reported result, not reproduced here. The structured question is in +`TASK.json`. UNC/extended-length paths, filesystem alias equivalence, full cold +ancestry, supplier mathematics and inherited all-size obligations are outside +this package. + +## Attribution and coordination + +Current main base: `0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2`, priority +revision4. The one-shot picker chose verifier engineering, nonce +`4727282e9476c909011340ff0b783e8c`. Live overlap found #2333 already taking +PR2316's supplier-wrapper handoff, so this scope was narrowed before substantive +implementation. The canonical claim is in +[Discussion1472](https://github.com/CrocSwap/integer-mult-bounds/discussions/1472#discussioncomment-18941855). + +Credit Adam Gall (PR2101 full comparison and PR2059 invoice binding), +commdata2338 (PR2040 strict typed comparison), Josie Elliston (PR1824 selected +final-stage portability), josecarlosgonzalezroque-design (PR2316 Windows +manifest audit), and Maxime Fleury/Antoine Olivier (payload/container rule). +The supplier and selected evidence retain Rohan Arun, Jeremy Kothe, Hao Yan, +Douglas Colkitt and their credited predecessor lineage. The unchanged vendor +files retain their original authorship and license notices. + +Prepared for AAAmirinu with substantial OpenAI Codex assistance in design, +implementation, testing and writing, including a separate AI review. New work +Apache-2.0. No selected source, manifest, frontier, maintainer decision or +existing PR is modified. diff --git a/research/selected-windows-role-adapter/RESULT.json b/research/selected-windows-role-adapter/RESULT.json new file mode 100644 index 0000000000..619bf7d132 --- /dev/null +++ b/research/selected-windows-role-adapter/RESULT.json @@ -0,0 +1,198 @@ +{ + "status": "PASS_SELECTED_WINDOWS_ROLE_ADAPTER", + "source_inputs": 7, + "predecessor_rejection": "root must be an absolute POSIX path", + "output_files": 105, + "roles": 6, + "authenticated_edges_per_side": 30, + "fresh_supplier_run": false, + "positive_controls": [ + "unchanged-posix-reference", + "windows-drive-japanese-spaces", + "posix-literal-backslash-retained", + "windows-identical-side-still-authenticated", + "windows-composed-invoice-and-22-times", + "coupled-outer-log-retained" + ], + "negative_controls": [ + "stale-digest:C:\\proof runs\\\u5019\u88dc\\source\\data\\OWNERS.json.gz", + "missing-role:C:\\proof runs\\\u5019\u88dc\\source\\data\\OWNERS.json.gz", + "separator-alias:C:\\proof runs\\\u5019\u88dc\\source\\data\\OWNERS.json.gz", + "case-alias:C:\\proof runs\\\u5019\u88dc\\source\\data\\OWNERS.json.gz", + "stale-digest:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\split-centres\\CANONICAL-WORD.json.gz", + "missing-role:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\split-centres\\CANONICAL-WORD.json.gz", + "separator-alias:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\split-centres\\CANONICAL-WORD.json.gz", + "case-alias:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\split-centres\\CANONICAL-WORD.json.gz", + "stale-digest:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\split-centres\\GLOBAL-TEMPLATE.json.gz", + "missing-role:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\split-centres\\GLOBAL-TEMPLATE.json.gz", + "separator-alias:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\split-centres\\GLOBAL-TEMPLATE.json.gz", + "case-alias:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\split-centres\\GLOBAL-TEMPLATE.json.gz", + "stale-digest:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\work\\complex-nine-native\\DATA-PHASES.json", + "missing-role:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\work\\complex-nine-native\\DATA-PHASES.json", + "separator-alias:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\work\\complex-nine-native\\DATA-PHASES.json", + "case-alias:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\work\\complex-nine-native\\DATA-PHASES.json", + "stale-digest:D:\\local inputs\\\u4f9b\u7d66\\CANONICAL-WORD.json.gz", + "missing-role:D:\\local inputs\\\u4f9b\u7d66\\CANONICAL-WORD.json.gz", + "separator-alias:D:\\local inputs\\\u4f9b\u7d66\\CANONICAL-WORD.json.gz", + "case-alias:D:\\local inputs\\\u4f9b\u7d66\\CANONICAL-WORD.json.gz", + "stale-digest:D:\\local inputs\\\u4f9b\u7d66\\INDEPENDENT-LOCAL-REPLAY.json", + "missing-role:D:\\local inputs\\\u4f9b\u7d66\\INDEPENDENT-LOCAL-REPLAY.json", + "separator-alias:D:\\local inputs\\\u4f9b\u7d66\\INDEPENDENT-LOCAL-REPLAY.json", + "case-alias:D:\\local inputs\\\u4f9b\u7d66\\INDEPENDENT-LOCAL-REPLAY.json", + "role-swap:C:\\proof runs\\\u5019\u88dc\\source\\data\\OWNERS.json.gz:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\split-centres\\CANONICAL-WORD.json.gz", + "role-swap:C:\\proof runs\\\u5019\u88dc\\source\\data\\OWNERS.json.gz:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\split-centres\\GLOBAL-TEMPLATE.json.gz", + "role-swap:C:\\proof runs\\\u5019\u88dc\\source\\data\\OWNERS.json.gz:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\work\\complex-nine-native\\DATA-PHASES.json", + "role-swap:C:\\proof runs\\\u5019\u88dc\\source\\data\\OWNERS.json.gz:D:\\local inputs\\\u4f9b\u7d66\\CANONICAL-WORD.json.gz", + "role-swap:C:\\proof runs\\\u5019\u88dc\\source\\data\\OWNERS.json.gz:D:\\local inputs\\\u4f9b\u7d66\\INDEPENDENT-LOCAL-REPLAY.json", + "role-swap:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\split-centres\\CANONICAL-WORD.json.gz:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\split-centres\\GLOBAL-TEMPLATE.json.gz", + "role-swap:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\split-centres\\CANONICAL-WORD.json.gz:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\work\\complex-nine-native\\DATA-PHASES.json", + "role-swap:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\split-centres\\CANONICAL-WORD.json.gz:D:\\local inputs\\\u4f9b\u7d66\\CANONICAL-WORD.json.gz", + "role-swap:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\split-centres\\CANONICAL-WORD.json.gz:D:\\local inputs\\\u4f9b\u7d66\\INDEPENDENT-LOCAL-REPLAY.json", + "role-swap:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\split-centres\\GLOBAL-TEMPLATE.json.gz:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\work\\complex-nine-native\\DATA-PHASES.json", + "role-swap:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\split-centres\\GLOBAL-TEMPLATE.json.gz:D:\\local inputs\\\u4f9b\u7d66\\CANONICAL-WORD.json.gz", + "role-swap:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\split-centres\\GLOBAL-TEMPLATE.json.gz:D:\\local inputs\\\u4f9b\u7d66\\INDEPENDENT-LOCAL-REPLAY.json", + "role-swap:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\work\\complex-nine-native\\DATA-PHASES.json:D:\\local inputs\\\u4f9b\u7d66\\CANONICAL-WORD.json.gz", + "role-swap:C:\\proof runs\\\u5019\u88dc\\strict\\global8\\base\\work\\complex-nine-native\\DATA-PHASES.json:D:\\local inputs\\\u4f9b\u7d66\\INDEPENDENT-LOCAL-REPLAY.json", + "role-swap:D:\\local inputs\\\u4f9b\u7d66\\CANONICAL-WORD.json.gz:D:\\local inputs\\\u4f9b\u7d66\\INDEPENDENT-LOCAL-REPLAY.json", + "missing-output:ADMISSION-CONTROLS.json", + "missing-output:ASSEMBLY.json", + "missing-output:BIT-SUPPLIER-CONTROLS.json", + "missing-output:INDEPENDENT-T16.json", + "missing-output:REPLAY.json", + "missing-output:STAGES.json", + "missing-output:admission-controls.log", + "missing-output:assembly.log", + "missing-output:audit.log", + "missing-output:bind.log", + "missing-output:bind8.log", + "missing-output:bit-supplier-controls.log", + "missing-output:emit.log", + "missing-output:global/BINDING.json", + "missing-output:global/PLAN.json", + "missing-output:global/audit/ASYNC-AUDIT.json", + "missing-output:global/audit/GLOBAL-PREFIX.json", + "missing-output:global/audit/IDLE-REMAINDER-FRAMES.json", + "missing-output:global/audit/OWNERS-AND-PROFILE.json", + "missing-output:global/audit/PREFIX-AND-INVOICE.json", + "missing-output:global/base/providers/gauge44/CANONICAL-WORD.json.gz", + "missing-output:global/base/providers/gauge44/CLIFFORD-RECIPES.json", + "missing-output:global/base/providers/gauge44/CLIFFORD-REVIEW.json", + "missing-output:global/base/providers/gauge44/FULL-WORD.json.gz", + "missing-output:global/base/providers/gauge44/INDEPENDENT-LOCAL-REPLAY.json", + "missing-output:global/base/providers/gauge44/LOCAL-CHECKS.json", + "missing-output:global/base/providers/gauge44/LOCAL-PROGRAMS.json.gz", + "missing-output:global/base/providers/gauge44/RESIDUAL-ADAPTERS.json", + "missing-output:global/base/providers/gauge44/SCALAR-FRAME-AUDIT.json", + "missing-output:global/base/providers/gauge44/WRAPPER-CHECKS.json", + "missing-output:global/base/split-centres/CANONICAL-WORD.json.gz", + "missing-output:global/base/split-centres/CLIFFORD-RECIPES.json", + "missing-output:global/base/split-centres/CLIFFORD-REVIEW.json", + "missing-output:global/base/split-centres/GLOBAL-TEMPLATE.json.gz", + "missing-output:global/base/split-centres/INDEPENDENT-LOCAL-REPLAY.json", + "missing-output:global/base/split-centres/INDEPENDENT-REPLAY.json", + "missing-output:global/base/split-centres/INTEGRATION.json", + "missing-output:global/base/split-centres/LOCAL-CHECKS.json", + "missing-output:global/base/split-centres/LOCAL-PROGRAMS.json.gz", + "missing-output:global/base/split-centres/RESIDUAL-ADAPTERS.json", + "missing-output:global/base/split-centres/SCALAR-FRAME-AUDIT.json", + "missing-output:global/base/split-centres/WRAPPER-CHECKS.json", + "missing-output:global/base/work/complex-nine-native/DATA-PHASES.json", + "missing-output:global/hosted/ACTUAL-SIGMAS.json.gz", + "missing-output:global/hosted/GLOBAL-TEMPLATE.json.gz", + "missing-output:global/hosted/HOSTED.json", + "missing-output:global/hosted/IDLE-REMAINDER-FRAMES.json.gz", + "missing-output:global8/BINDING.json", + "missing-output:global8/PLAN.json", + "missing-output:global8/base/providers/gauge44/CANONICAL-WORD.json.gz", + "missing-output:global8/base/providers/gauge44/CLIFFORD-RECIPES.json", + "missing-output:global8/base/providers/gauge44/CLIFFORD-REVIEW.json", + "missing-output:global8/base/providers/gauge44/FULL-WORD.json.gz", + "missing-output:global8/base/providers/gauge44/INDEPENDENT-LOCAL-REPLAY.json", + "missing-output:global8/base/providers/gauge44/LOCAL-CHECKS.json", + "missing-output:global8/base/providers/gauge44/LOCAL-PROGRAMS.json.gz", + "missing-output:global8/base/providers/gauge44/RESIDUAL-ADAPTERS.json", + "missing-output:global8/base/providers/gauge44/SCALAR-FRAME-AUDIT.json", + "missing-output:global8/base/providers/gauge44/WRAPPER-CHECKS.json", + "missing-output:global8/base/split-centres/CANONICAL-WORD.json.gz", + "missing-output:global8/base/split-centres/CLIFFORD-RECIPES.json", + "missing-output:global8/base/split-centres/CLIFFORD-REVIEW.json", + "missing-output:global8/base/split-centres/GLOBAL-TEMPLATE.json.gz", + "missing-output:global8/base/split-centres/INDEPENDENT-LOCAL-REPLAY.json", + "missing-output:global8/base/split-centres/INDEPENDENT-REPLAY.json", + "missing-output:global8/base/split-centres/INTEGRATION.json", + "missing-output:global8/base/split-centres/LOCAL-CHECKS.json", + "missing-output:global8/base/split-centres/LOCAL-PROGRAMS.json.gz", + "missing-output:global8/base/split-centres/RESIDUAL-ADAPTERS.json", + "missing-output:global8/base/split-centres/SCALAR-FRAME-AUDIT.json", + "missing-output:global8/base/split-centres/WRAPPER-CHECKS.json", + "missing-output:global8/base/work/complex-nine-native/DATA-PHASES.json", + "missing-output:independent-t16.log", + "missing-output:invoice.log", + "missing-output:lift/GLOBAL-TEMPLATE.json.gz", + "missing-output:lift/PARENT-LIFT-RECEIPT.json", + "missing-output:lift/PLAN.json", + "missing-output:lift16.log", + "missing-output:parent16/complex-global/base/split-centres/CANONICAL-WORD.json.gz", + "missing-output:parent16/complex-global/base/split-centres/CLIFFORD-RECIPES.json", + "missing-output:parent16/complex-global/base/split-centres/CLIFFORD-REVIEW.json", + "missing-output:parent16/complex-global/base/split-centres/GLOBAL-TEMPLATE.json.gz", + "missing-output:parent16/complex-global/base/split-centres/INDEPENDENT-LOCAL-REPLAY.json", + "missing-output:parent16/complex-global/base/split-centres/INDEPENDENT-REPLAY.json", + "missing-output:parent16/complex-global/base/split-centres/INTEGRATION.json", + "missing-output:parent16/complex-global/base/split-centres/LOCAL-CHECKS.json", + "missing-output:parent16/complex-global/base/split-centres/LOCAL-PROGRAMS.json.gz", + "missing-output:parent16/complex-global/base/split-centres/RESIDUAL-ADAPTERS.json", + "missing-output:parent16/complex-global/base/split-centres/SCALAR-FRAME-AUDIT.json", + "missing-output:parent16/complex-global/base/split-centres/WRAPPER-CHECKS.json", + "missing-output:parent16/complex-global/base/work/complex-nine-native/DATA-PHASES.json", + "missing-output:parent558/complex-global/base/split-centres/CANONICAL-WORD.json.gz", + "missing-output:parent558/complex-global/base/split-centres/CLIFFORD-RECIPES.json", + "missing-output:parent558/complex-global/base/split-centres/CLIFFORD-REVIEW.json", + "missing-output:parent558/complex-global/base/split-centres/GLOBAL-TEMPLATE.json.gz", + "missing-output:parent558/complex-global/base/split-centres/INDEPENDENT-LOCAL-REPLAY.json", + "missing-output:parent558/complex-global/base/split-centres/INDEPENDENT-REPLAY.json", + "missing-output:parent558/complex-global/base/split-centres/INTEGRATION.json", + "missing-output:parent558/complex-global/base/split-centres/LOCAL-CHECKS.json", + "missing-output:parent558/complex-global/base/split-centres/LOCAL-PROGRAMS.json.gz", + "missing-output:parent558/complex-global/base/split-centres/RESIDUAL-ADAPTERS.json", + "missing-output:parent558/complex-global/base/split-centres/SCALAR-FRAME-AUDIT.json", + "missing-output:parent558/complex-global/base/split-centres/WRAPPER-CHECKS.json", + "missing-output:parent558/complex-global/base/work/complex-nine-native/DATA-PHASES.json", + "missing-output:restore-parent.log", + "extra-output", + "unsupported-root:C:relative", + "unsupported-root:\\rooted", + "unsupported-root:C:/mixed", + "unsupported-root:C:\\double\\\\separator", + "unsupported-root:C:\\dot\\.\\part", + "unsupported-root:C:\\parent\\..\\part", + "unsupported-root:C:\\trailing\\", + "unsupported-root:C:\\space ", + "unsupported-root:C:\\dot.", + "unsupported-root:C:\\CON", + "unsupported-root:C:\\name:stream", + "unsupported-root:\\\\server\\share\\work", + "unsupported-root:\\\\?\\C:\\work", + "unsupported-root:\\\\.\\C:\\work", + "case-insensitive-role-collision", + "untyped-style", + "scientific-or-binding:INDEPENDENT-T16.json:161", + "scientific-or-binding:ASSEMBLY.json:162", + "scientific-or-binding:INDEPENDENT-T16.json:163", + "scientific-or-binding:INDEPENDENT-T16.json:164", + "scientific-or-binding:ADMISSION-CONTROLS.json:165", + "scientific-or-binding:REPLAY.json:166", + "unlisted-path-string-is-not-relocated", + "duplicate-json-key", + "identically-stale-native-roles", + "uncoupled-outer-log", + "vendor-source-drift:vendor/pr2101/compare_outputs.py", + "vendor-source-drift:vendor/pr2101/POLICY.json", + "vendor-source-drift:vendor/pr2101/SOURCES.json", + "vendor-source-drift:vendor/pr2101/vendor/strict_compare.py", + "vendor-source-drift:vendor/pr2101/vendor/invoice_compare.py" + ], + "positive_count": 6, + "negative_count": 176, + "scope": "Constructed Windows-drive/POSIX role relocation on authenticated reviewed outputs; no native supplier replay or new kappa." +} diff --git a/research/selected-windows-role-adapter/SOURCES.json b/research/selected-windows-role-adapter/SOURCES.json new file mode 100644 index 0000000000..303e7e5270 --- /dev/null +++ b/research/selected-windows-role-adapter/SOURCES.json @@ -0,0 +1,102 @@ +{ + "schema_version": 1, + "base_commit": "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11", + "sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "e8870e5917057d59b730eb14721a778639eca050", + "sha256": "d46eb6d5b3e279428753d770653663fbdf1063e55c255ea073d768f344927ef7" + }, + { + "path": "research/community-frontier1042-audit/RESULT.json", + "usage": "input", + "git_blob": "8182d0818c0cbda7e52c10120f15b2c3a2c8f933", + "sha256": "bf12c6ed3b412539638b76addb40591a631609b2ab9e5ee0db1f6bbe067d0ec0" + }, + { + "path": "research/community-frontier1042-audit/selected-replay.tar.gz", + "usage": "input", + "git_blob": "6f4dc6fe7631d8aacf8081fcaecf32197181685b", + "sha256": "22c3f4dce4b897a1d423d1388801933e288b6a6b1906cb15e1b16a5eb68db754" + }, + { + "path": "research/community-frontier1094-audit/ASSEMBLY.json", + "usage": "input", + "git_blob": "5fd676df060f3b450782fdf5ff5f6beb63a5eeb0", + "sha256": "1122cb3a575f8c788345fc1bf4c108ac7c3250fb81a5988671f5eb04b3ab3045" + }, + { + "path": "research/community-frontier1094-audit/REPLAY.json", + "usage": "input", + "git_blob": "2cfb7fffa7cd78f418be16c13224c3206b6d0183", + "sha256": "ce0678fa7abaab221de74baeace0c6696d5ea23a36719a58cff230215a06aae7" + }, + { + "path": "research/community-frontier1094-audit/RESULT.json", + "usage": "input", + "git_blob": "131d9c96a54632ae385ced4138fd7f30ad448a3e", + "sha256": "1e3e47e9ec24bcb6fb5f703b7fce0aab658d84ff72bfae5da3ae429d17b6e752" + }, + { + "path": "research/community-frontier1094-audit/selected-replay.tar.gz", + "usage": "input", + "git_blob": "c24daf067f9c543421d89ca2eeaa4eb78a57fb6f", + "sha256": "f1da80610bf33c58527f18ad63b4350d0b864e1d4486141ee17ac9bed4d529d6" + }, + { + "path": "research/complex-t16-rare-pattern-exchanges/data/OWNERS.json.gz", + "usage": "input", + "git_blob": "d3ba33d7e703a3229d9fb8a360f69d2f318bbb70", + "sha256": "87902c528dfab7d503dcf8a784260e3ab6fb7424c418a1820f7261f25be7b6bc" + } + ], + "vendored_sources": [ + { + "path": "vendor/pr2101/compare_outputs.py", + "upstream_path": "research/selected-final-replay-closure/compare_outputs.py", + "commit": "a247ef876e50bf3a7d890c7c1f9b409576674d7d", + "pr": "https://github.com/CrocSwap/integer-mult-bounds/pull/2101", + "sha256": "5e881d3d8591f99e208a394fdeed46c12994d99e9e36a7a062969916eb440b26", + "license": "Apache-2.0" + }, + { + "path": "vendor/pr2101/POLICY.json", + "upstream_path": "research/selected-final-replay-closure/POLICY.json", + "commit": "a247ef876e50bf3a7d890c7c1f9b409576674d7d", + "pr": "https://github.com/CrocSwap/integer-mult-bounds/pull/2101", + "sha256": "1168976bd55a5e3bff657fc8877066d54fc68fe3bc8572c9d8d914c35b277a03", + "license": "Apache-2.0" + }, + { + "path": "vendor/pr2101/SOURCES.json", + "upstream_path": "research/selected-final-replay-closure/SOURCES.json", + "commit": "a247ef876e50bf3a7d890c7c1f9b409576674d7d", + "pr": "https://github.com/CrocSwap/integer-mult-bounds/pull/2101", + "sha256": "b4b807fc199315e4ae73d6a49adb03e8efc5f0e8a264db9affb640a7f179f9d8", + "license": "Apache-2.0" + }, + { + "path": "vendor/pr2101/vendor/strict_compare.py", + "upstream_path": "research/selected-final-replay-closure/vendor/strict_compare.py", + "commit": "a247ef876e50bf3a7d890c7c1f9b409576674d7d", + "pr": "https://github.com/CrocSwap/integer-mult-bounds/pull/2101", + "sha256": "7592c2475a851ac68a6db1a82af4ae9db466690c7e2c1daced654c5641b66492", + "license": "Apache-2.0" + }, + { + "path": "vendor/pr2101/vendor/invoice_compare.py", + "upstream_path": "research/selected-final-replay-closure/vendor/invoice_compare.py", + "commit": "a247ef876e50bf3a7d890c7c1f9b409576674d7d", + "pr": "https://github.com/CrocSwap/integer-mult-bounds/pull/2101", + "sha256": "ddd241a78c16ca4c8a10aaf4aee04a60fe9e171b82e586339d7c3be601a0e3ac", + "license": "Apache-2.0" + } + ] +} diff --git a/research/selected-windows-role-adapter/TASK.json b/research/selected-windows-role-adapter/TASK.json new file mode 100644 index 0000000000..3810fee088 --- /dev/null +++ b/research/selected-windows-role-adapter/TASK.json @@ -0,0 +1,104 @@ +{ + "schema_version": 1, + "task_id": "portable-replay", + "priority_revision": 4, + "base_commit": "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2", + "original_card": { + "id": "portable-replay", + "question": "Can one reproducible environment or artifact-comparison failure be repaired?", + "starting_points": [ + "research/gzip-container-reproducibility/README.md", + "docs/ci-verification.md" + ], + "methods": [ + "Reproduce one portability failure and add a minimal cross-environment fix.", + "Audit one canonical-payload comparison for omitted proof-relevant fields." + ], + "acceptance_gate": "Preserve immutable source hashes and proof-relevant content; a different compressed byte stream alone is not a mathematical mismatch.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read the gzip-container reproducibility examples and distinguish frozen source bytes from regenerated payloads.", + "scope": "Positive control / source-bound orientation only; this is not a new construction or full cold replay." + }, + "first_experiment": "Reproduce one specific mismatch or audit one canonical comparison for omitted proof-relevant fields.", + "bottleneck_link": "Portable exact checks prevent environment failures from blocking valid contributions.", + "allowed_variations": [ + "One interpreter/version mismatch or one payload field comparison." + ], + "scope_change_triggers": [ + "Removing immutable-source pins because generated compressed bytes differ." + ], + "overlap_terms": [ + "gzip container", + "reproducibility", + "canonical payload" + ] + }, + "scope_status": "refined", + "actual_scope": "Authenticate and adapt six exact Windows-drive or POSIX input-role keys before the unchanged PR2101 complete105-output comparison; constructed archive fixture only, no supplier execution.", + "scope_change_reason": "The live Windows successor execution handoff was already claimed in Discussion2333. This complementary portable-replay interface test supplies an opt-in comparator adapter without repeating that run.", + "bottleneck_link": "The binding selected supplier needs complete output comparison across environments; accepting path relocation must preserve each source role and every scientific field.", + "budget_minutes": 60, + "stop_rule": "One exact PR2101 comparator boundary; stop rather than relax unclassified fields or duplicate the active Windows supplier replay.", + "outcome": "completed", + "evidence": "RESULT.json: 6 positive controls and 176 rejected faults; exact105-file comparator reused; separate AI review fixed malformed-root test coverage. Normal and optimized registered replay recorded in VALIDATION.json.", + "author": "AAAmirinu", + "ai_assistance": "Substantial OpenAI Codex assistance in design, implementation, verification and writing; separate Codex agent review, no independent human review.", + "open_questions": [ + { + "question": "Can the fresh Windows successor supplier outputs be admitted by this exact role adapter and the unchanged105-file comparator?", + "why_it_matters": "Constructed relocation fixtures establish the comparator boundary, not native supplier execution or downstream output identity.", + "first_step": "Coordinate with Discussion2333; pass the fresh output inventory, exact native work/local roots and three external input byte strings to compare_roles.compare and validate the coupled outer log.", + "blocked_by": "Needs a composed check of fresh native outputs; PR2336 reports CRLF-only logs, which this adapter intentionally leaves to the unchanged byte-exact log policy." + } + ], + "selection_nonce": "4727282e9476c909011340ff0b783e8c", + "scope_key": "91a9a2afec282c926282/windows-exact-input-roles", + "claim": "https://github.com/CrocSwap/integer-mult-bounds/discussions/1472#discussioncomment-18941855", + "predecessors": [ + { + "pr": 2101, + "head": "a247ef876e50bf3a7d890c7c1f9b409576674d7d", + "credit": "Adam Gall; complete comparator and retained PR2040/2059 predicates" + }, + { + "pr": 2316, + "head": "1b732744b66cc3461559d52349ae07fa31d444f8", + "credit": "josecarlosgonzalezroque-design; Windows manifest admission audit" + }, + { + "pr": 1824, + "head": "ad5b1248f25a71983b20617e2f3a80be22f03990", + "credit": "Josie Elliston; selected final-stage portability fixture" + } + ], + "upstream_checkpoint": { + "commit": "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2", + "priority_revision": 4, + "checked_at_utc": "2026-10-15T05:48:57Z", + "relevant_change": "None; first proposed supplier scope narrowed after live Discussion2333 claim." + }, + "overlap": { + "open_prs": 546, + "discussion_records": 1053, + "complete_pagination": true, + "warnings": [], + "fetched_at_utc": "2026-10-15T05:47:12Z", + "limitations": "PR titles/bodies, Discussion bodies/comments/replies, top-level package notes and ledger; not arbitrary diffs. Targeted predecessor heads and code inspected separately." + }, + "submission_overlap": { + "checked_at_utc": "2026-10-15T05:59:46Z", + "canonical_main": "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2", + "priority_revision": 4, + "open_prs": 552, + "discussion_records": 1063, + "complete_pagination": true, + "warnings": [], + "relevant_update": "PR2336 independently published native Windows successor execution. This package remains the separately claimed exact six-role adapter to PR2101; complete inner-log policy unchanged." + } +} diff --git a/research/selected-windows-role-adapter/VALIDATION.json b/research/selected-windows-role-adapter/VALIDATION.json new file mode 100644 index 0000000000..8b0e759b19 --- /dev/null +++ b/research/selected-windows-role-adapter/VALIDATION.json @@ -0,0 +1,25 @@ +{ + "checked_at_utc": "2026-10-15T05:58:42Z", + "platform": "native Windows", + "python": "CPython 3.12.11", + "source_base": "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2", + "commands": [ + { + "command": "python -B scripts/research_package.py --package research/selected-windows-role-adapter --check-only", + "exit_code": 0, + "result": "PASS_PACKAGE_METADATA_AND_PINS" + }, + { + "command": "python3.12 -B scripts/research_package.py --package research/selected-windows-role-adapter", + "exit_code": 0, + "elapsed_seconds": 63.8101513, + "result": "PASS_REGISTERED_RESEARCH_PACKAGE", + "child_modes": ["-I -B", "-I -O -B"], + "positives_each": 6, + "negatives_each": 176 + } + ], + "independent_review": "Separate Codex agent checked exact five-file predecessor snapshot, unchanged POSIX report equivalence, non-mutation, native path spellings and conservative case collision. Malformed-root test gap fixed. No independent human review.", + "not_run": ["fresh supplier replay", "cold ancestry", "Linux execution", "macOS execution", "hosted CI", "formal mathematical verification"], + "assistance": "Substantial OpenAI Codex assistance; Apache-2.0" +} diff --git a/research/selected-windows-role-adapter/VERIFY.json b/research/selected-windows-role-adapter/VERIFY.json new file mode 100644 index 0000000000..32399bb261 --- /dev/null +++ b/research/selected-windows-role-adapter/VERIFY.json @@ -0,0 +1,38 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/community-frontier1042-audit/RESULT.json", + "research/community-frontier1042-audit/selected-replay.tar.gz", + "research/community-frontier1094-audit/ASSEMBLY.json", + "research/community-frontier1094-audit/REPLAY.json", + "research/community-frontier1094-audit/RESULT.json", + "research/community-frontier1094-audit/selected-replay.tar.gz", + "research/complex-t16-rare-pattern-exchanges/data/OWNERS.json.gz" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 600, + "checks": "Authenticated105-file fixture; exact six-role adapter and source, role, alias, inventory, scientific and binding controls." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 600, + "checks": "Same explicit rejection controls with Python assertions disabled." + } + ] +} diff --git a/research/selected-windows-role-adapter/compare_roles.py b/research/selected-windows-role-adapter/compare_roles.py new file mode 100644 index 0000000000..1cb8556258 --- /dev/null +++ b/research/selected-windows-role-adapter/compare_roles.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python3 +"""Exact six-role path adapter to PR2101's unchanged complete comparator. + +AAAmirinu with substantial OpenAI Codex assistance. Apache-2.0. +The underlying comparison is Adam Gall's PR2101, retaining the credited +PR2040/PR2059 predicates. This adapter does not execute a supplier. +""" +import hashlib +import importlib.util +import json +from pathlib import Path, PurePosixPath, PureWindowsPath +import re + +HERE = Path(__file__).resolve().parent +RESERVED = {'work': '/__selected_roles__/work', 'local': '/__selected_roles__/local'} + + +def require(condition, message): + if not condition: + raise ValueError(message) + + +def check_bytes(raw, expected, name): + require(hashlib.sha256(raw).hexdigest() == expected, 'source drift: ' + name) + + +def load_predecessor(): + records = json.loads((HERE / 'SOURCES.json').read_bytes())['vendored_sources'] + expected = {'vendor/pr2101/' + name for name in ( + 'compare_outputs.py', 'POLICY.json', 'SOURCES.json', + 'vendor/strict_compare.py', 'vendor/invoice_compare.py')} + require(len(records) == 5 and {r['path'] for r in records} == expected, + 'vendored source inventory differs') + for row in records: + check_bytes((HERE / row['path']).read_bytes(), row['sha256'], row['path']) + spec = importlib.util.spec_from_file_location( + 'pr2101_closed_comparison', HERE / 'vendor/pr2101/compare_outputs.py') + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +predecessor = load_predecessor() + + +def role_path(root, suffix): + """Join trusted role suffixes; never normalize a key supplied by a receipt. + + Deliberately narrow spelling policy: canonical POSIX roots or ordinary + absolute Windows drive roots with backslashes. UNC/device/extended-length + roots and alternative spelling are unsupported and reject. + """ + require(type(root) is dict and set(root) == {'style', 'path'}, 'invalid typed root') + style, value = root['style'], root['path'] + require(type(value) is str and value and '\x00' not in value, 'invalid root path') + part = PurePosixPath(suffix) + require(suffix and part.as_posix() == suffix and not part.is_absolute() + and '..' not in part.parts and '\\' not in suffix and ':' not in suffix, + 'noncanonical role suffix') + if style == 'posix': + predecessor.strict.Roots([('root', value)]) + return str(PurePosixPath(value).joinpath(*part.parts)) + require(style == 'windows-drive', 'unsupported root style') + path = PureWindowsPath(value) + require(re.fullmatch(r'[A-Za-z]:', path.drive) is not None and path.is_absolute() + and str(path) == value and '/' not in value and '..' not in path.parts, + 'root must be a canonical absolute Windows drive path') + # Windows normalizes these lexical aliases. Do not silently identify them. + for component in path.parts[1:]: + require(not component.endswith((' ', '.')) + and not any(c in component for c in '<>:"|?*') + and all(ord(c) >= 32 for c in component) + and not PureWindowsPath(component).is_reserved(), + 'unsupported Windows root component') + return str(path.joinpath(*part.parts)) + + +def adapt(files, context): + """Authenticate exactly six native role edges, then translate only their keys. + + Caller-supplied roots describe the executed run, not filesystem access: + this function never opens a receipt path. Literal strings elsewhere and + all other keys/values remain untouched. PR2101 rechecks the six edges. + """ + require(type(context) is dict and set(context) == {'work', 'local', 'external'}, + 'invalid comparison context') + require(set(files) == predecessor.NAMES, 'complete 105-file inventory differs') + external = context['external'] + require(type(external) is dict and set(external) == {'local-word', 'local-replay', 'owners'} + and all(type(raw) is bytes for raw in external.values()), 'invalid external inputs') + independent = predecessor.strict.read_json(files['INDEPENDENT-T16.json']) + require(type(independent) is dict and type(independent.get('input_sha256')) is dict, + 'missing independent input roles') + expected, translated, identities = {}, {}, set() + for role in predecessor.POLICY['input_roles']: + root = context[role['root']] + native = role_path(root, role['suffix']) + identity = (root['style'], native.casefold() if root['style'] == 'windows-drive' else native) + require(identity not in identities and native not in expected, 'colliding input roles') + identities.add(identity) + raw = files[role['target']] if 'target' in role else external[role['external']] + expected[native] = predecessor.digest(raw) + translated[RESERVED[role['root']] + '/' + role['suffix']] = predecessor.digest(raw) + require(len(expected) == len(translated) == 6 and + predecessor.strict.tree(independent['input_sha256']) == predecessor.strict.tree(expected), + 'stale, missing, aliased, or misbound native input role') + independent['input_sha256'] = translated + updated = dict(files) + updated['INDEPENDENT-T16.json'] = predecessor.invoice.canonical(independent) + return updated, {**RESERVED, 'external': external} + + +def compare(reference, candidate, reference_context, candidate_context): + left, left_context = adapt(reference, reference_context) + right, right_context = adapt(candidate, candidate_context) + return predecessor.compare(left, right, left_context, right_context) + + +outer_log = predecessor.outer_log +read_files = predecessor.read_files diff --git a/research/selected-windows-role-adapter/vendor/pr2101/POLICY.json b/research/selected-windows-role-adapter/vendor/pr2101/POLICY.json new file mode 100644 index 0000000000..2ca89dfeab --- /dev/null +++ b/research/selected-windows-role-adapter/vendor/pr2101/POLICY.json @@ -0,0 +1,279 @@ +{ + "schema_version": 1, + "scope": "Exactly the selected PR1094 final-stage strict output inventory; not an arbitrary dependency graph.", + "files": [ + "ADMISSION-CONTROLS.json", + "ASSEMBLY.json", + "BIT-SUPPLIER-CONTROLS.json", + "INDEPENDENT-T16.json", + "REPLAY.json", + "STAGES.json", + "admission-controls.log", + "assembly.log", + "audit.log", + "bind.log", + "bind8.log", + "bit-supplier-controls.log", + "emit.log", + "global/BINDING.json", + "global/PLAN.json", + "global/audit/ASYNC-AUDIT.json", + "global/audit/GLOBAL-PREFIX.json", + "global/audit/IDLE-REMAINDER-FRAMES.json", + "global/audit/OWNERS-AND-PROFILE.json", + "global/audit/PREFIX-AND-INVOICE.json", + "global/base/providers/gauge44/CANONICAL-WORD.json.gz", + "global/base/providers/gauge44/CLIFFORD-RECIPES.json", + "global/base/providers/gauge44/CLIFFORD-REVIEW.json", + "global/base/providers/gauge44/FULL-WORD.json.gz", + "global/base/providers/gauge44/INDEPENDENT-LOCAL-REPLAY.json", + "global/base/providers/gauge44/LOCAL-CHECKS.json", + "global/base/providers/gauge44/LOCAL-PROGRAMS.json.gz", + "global/base/providers/gauge44/RESIDUAL-ADAPTERS.json", + "global/base/providers/gauge44/SCALAR-FRAME-AUDIT.json", + "global/base/providers/gauge44/WRAPPER-CHECKS.json", + "global/base/split-centres/CANONICAL-WORD.json.gz", + "global/base/split-centres/CLIFFORD-RECIPES.json", + "global/base/split-centres/CLIFFORD-REVIEW.json", + "global/base/split-centres/GLOBAL-TEMPLATE.json.gz", + "global/base/split-centres/INDEPENDENT-LOCAL-REPLAY.json", + "global/base/split-centres/INDEPENDENT-REPLAY.json", + "global/base/split-centres/INTEGRATION.json", + "global/base/split-centres/LOCAL-CHECKS.json", + "global/base/split-centres/LOCAL-PROGRAMS.json.gz", + "global/base/split-centres/RESIDUAL-ADAPTERS.json", + "global/base/split-centres/SCALAR-FRAME-AUDIT.json", + "global/base/split-centres/WRAPPER-CHECKS.json", + "global/base/work/complex-nine-native/DATA-PHASES.json", + "global/hosted/ACTUAL-SIGMAS.json.gz", + "global/hosted/GLOBAL-TEMPLATE.json.gz", + "global/hosted/HOSTED.json", + "global/hosted/IDLE-REMAINDER-FRAMES.json.gz", + "global8/BINDING.json", + "global8/PLAN.json", + "global8/base/providers/gauge44/CANONICAL-WORD.json.gz", + "global8/base/providers/gauge44/CLIFFORD-RECIPES.json", + "global8/base/providers/gauge44/CLIFFORD-REVIEW.json", + "global8/base/providers/gauge44/FULL-WORD.json.gz", + "global8/base/providers/gauge44/INDEPENDENT-LOCAL-REPLAY.json", + "global8/base/providers/gauge44/LOCAL-CHECKS.json", + "global8/base/providers/gauge44/LOCAL-PROGRAMS.json.gz", + "global8/base/providers/gauge44/RESIDUAL-ADAPTERS.json", + "global8/base/providers/gauge44/SCALAR-FRAME-AUDIT.json", + "global8/base/providers/gauge44/WRAPPER-CHECKS.json", + "global8/base/split-centres/CANONICAL-WORD.json.gz", + "global8/base/split-centres/CLIFFORD-RECIPES.json", + "global8/base/split-centres/CLIFFORD-REVIEW.json", + "global8/base/split-centres/GLOBAL-TEMPLATE.json.gz", + "global8/base/split-centres/INDEPENDENT-LOCAL-REPLAY.json", + "global8/base/split-centres/INDEPENDENT-REPLAY.json", + "global8/base/split-centres/INTEGRATION.json", + "global8/base/split-centres/LOCAL-CHECKS.json", + "global8/base/split-centres/LOCAL-PROGRAMS.json.gz", + "global8/base/split-centres/RESIDUAL-ADAPTERS.json", + "global8/base/split-centres/SCALAR-FRAME-AUDIT.json", + "global8/base/split-centres/WRAPPER-CHECKS.json", + "global8/base/work/complex-nine-native/DATA-PHASES.json", + "independent-t16.log", + "invoice.log", + "lift/GLOBAL-TEMPLATE.json.gz", + "lift/PARENT-LIFT-RECEIPT.json", + "lift/PLAN.json", + "lift16.log", + "parent16/complex-global/base/split-centres/CANONICAL-WORD.json.gz", + "parent16/complex-global/base/split-centres/CLIFFORD-RECIPES.json", + "parent16/complex-global/base/split-centres/CLIFFORD-REVIEW.json", + "parent16/complex-global/base/split-centres/GLOBAL-TEMPLATE.json.gz", + "parent16/complex-global/base/split-centres/INDEPENDENT-LOCAL-REPLAY.json", + "parent16/complex-global/base/split-centres/INDEPENDENT-REPLAY.json", + "parent16/complex-global/base/split-centres/INTEGRATION.json", + "parent16/complex-global/base/split-centres/LOCAL-CHECKS.json", + "parent16/complex-global/base/split-centres/LOCAL-PROGRAMS.json.gz", + "parent16/complex-global/base/split-centres/RESIDUAL-ADAPTERS.json", + "parent16/complex-global/base/split-centres/SCALAR-FRAME-AUDIT.json", + "parent16/complex-global/base/split-centres/WRAPPER-CHECKS.json", + "parent16/complex-global/base/work/complex-nine-native/DATA-PHASES.json", + "parent558/complex-global/base/split-centres/CANONICAL-WORD.json.gz", + "parent558/complex-global/base/split-centres/CLIFFORD-RECIPES.json", + "parent558/complex-global/base/split-centres/CLIFFORD-REVIEW.json", + "parent558/complex-global/base/split-centres/GLOBAL-TEMPLATE.json.gz", + "parent558/complex-global/base/split-centres/INDEPENDENT-LOCAL-REPLAY.json", + "parent558/complex-global/base/split-centres/INDEPENDENT-REPLAY.json", + "parent558/complex-global/base/split-centres/INTEGRATION.json", + "parent558/complex-global/base/split-centres/LOCAL-CHECKS.json", + "parent558/complex-global/base/split-centres/LOCAL-PROGRAMS.json.gz", + "parent558/complex-global/base/split-centres/RESIDUAL-ADAPTERS.json", + "parent558/complex-global/base/split-centres/SCALAR-FRAME-AUDIT.json", + "parent558/complex-global/base/split-centres/WRAPPER-CHECKS.json", + "parent558/complex-global/base/work/complex-nine-native/DATA-PHASES.json", + "restore-parent.log" + ], + "stages": [ + "restore-parent", + "bind8", + "lift16", + "bind", + "emit", + "audit", + "invoice", + "assembly", + "admission-controls", + "bit-supplier-controls", + "independent-t16" + ], + "timings": { + "STAGES.json": [ + [ + 0, + "seconds" + ], + [ + 1, + "seconds" + ], + [ + 2, + "seconds" + ], + [ + 3, + "seconds" + ], + [ + 4, + "seconds" + ], + [ + 5, + "seconds" + ], + [ + 6, + "seconds" + ], + [ + 7, + "seconds" + ], + [ + 8, + "seconds" + ], + [ + 9, + "seconds" + ], + [ + 10, + "seconds" + ] + ], + "REPLAY.json": [ + [ + "stages", + 0, + "seconds" + ], + [ + "stages", + 1, + "seconds" + ], + [ + "stages", + 2, + "seconds" + ], + [ + "stages", + 3, + "seconds" + ], + [ + "stages", + 4, + "seconds" + ], + [ + "stages", + 5, + "seconds" + ], + [ + "stages", + 6, + "seconds" + ], + [ + "stages", + 7, + "seconds" + ], + [ + "stages", + 8, + "seconds" + ], + [ + "stages", + 9, + "seconds" + ], + [ + "stages", + 10, + "seconds" + ] + ] + }, + "input_roles": [ + { + "root": "work", + "suffix": "strict/global8/base/split-centres/GLOBAL-TEMPLATE.json.gz", + "target": "global8/base/split-centres/GLOBAL-TEMPLATE.json.gz" + }, + { + "root": "work", + "suffix": "strict/global8/base/work/complex-nine-native/DATA-PHASES.json", + "target": "global8/base/work/complex-nine-native/DATA-PHASES.json" + }, + { + "root": "work", + "suffix": "strict/global8/base/split-centres/CANONICAL-WORD.json.gz", + "target": "global8/base/split-centres/CANONICAL-WORD.json.gz" + }, + { + "root": "local", + "suffix": "CANONICAL-WORD.json.gz", + "external": "local-word" + }, + { + "root": "local", + "suffix": "INDEPENDENT-LOCAL-REPLAY.json", + "external": "local-replay" + }, + { + "root": "work", + "suffix": "source/data/OWNERS.json.gz", + "external": "owners" + } + ], + "invoice_edges": [ + { + "file": "ADMISSION-CONTROLS.json", + "path": [ + "input_sha256", + "fresh_invoice" + ], + "target": "global/audit/PREFIX-AND-INVOICE.json" + }, + { + "file": "ASSEMBLY.json", + "path": [ + "input_sha256", + "fresh_invoice" + ], + "target": "global/audit/PREFIX-AND-INVOICE.json" + } + ] +} diff --git a/research/selected-windows-role-adapter/vendor/pr2101/SOURCES.json b/research/selected-windows-role-adapter/vendor/pr2101/SOURCES.json new file mode 100644 index 0000000000..2c62938cac --- /dev/null +++ b/research/selected-windows-role-adapter/vendor/pr2101/SOURCES.json @@ -0,0 +1,288 @@ +{ + "schema_version": 1, + "base_commit": "564148b82ae9df72163f22106f15e73efca8aff2", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11", + "sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "e8870e5917057d59b730eb14721a778639eca050", + "sha256": "d46eb6d5b3e279428753d770653663fbdf1063e55c255ea073d768f344927ef7" + }, + { + "path": "research/community-frontier1042-audit/RESULT.json", + "usage": "input", + "git_blob": "8182d0818c0cbda7e52c10120f15b2c3a2c8f933", + "sha256": "bf12c6ed3b412539638b76addb40591a631609b2ab9e5ee0db1f6bbe067d0ec0" + }, + { + "path": "research/community-frontier1042-audit/selected-replay.tar.gz", + "usage": "input", + "git_blob": "6f4dc6fe7631d8aacf8081fcaecf32197181685b", + "sha256": "22c3f4dce4b897a1d423d1388801933e288b6a6b1906cb15e1b16a5eb68db754" + }, + { + "path": "research/community-frontier1094-audit/ASSEMBLY.json", + "usage": "input", + "git_blob": "5fd676df060f3b450782fdf5ff5f6beb63a5eeb0", + "sha256": "1122cb3a575f8c788345fc1bf4c108ac7c3250fb81a5988671f5eb04b3ab3045" + }, + { + "path": "research/community-frontier1094-audit/REPLAY.json", + "usage": "input", + "git_blob": "2cfb7fffa7cd78f418be16c13224c3206b6d0183", + "sha256": "ce0678fa7abaab221de74baeace0c6696d5ea23a36719a58cff230215a06aae7" + }, + { + "path": "research/community-frontier1094-audit/RESULT.json", + "usage": "input", + "git_blob": "131d9c96a54632ae385ced4138fd7f30ad448a3e", + "sha256": "1e3e47e9ec24bcb6fb5f703b7fce0aab658d84ff72bfae5da3ae429d17b6e752" + }, + { + "path": "research/community-frontier1094-audit/STAGES.json", + "usage": "input", + "git_blob": "a92499421609e4cdb5630f2697d2bad4b5a42a83", + "sha256": "72ad3ba266488da6bb6a41be404700dcea183a85002a5428df0033685c56d8be" + }, + { + "path": "research/community-frontier1094-audit/selected-replay.tar.gz", + "usage": "input", + "git_blob": "c24daf067f9c543421d89ca2eeaa4eb78a57fb6f", + "sha256": "f1da80610bf33c58527f18ad63b4350d0b864e1d4486141ee17ac9bed4d529d6" + }, + { + "path": "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/CANONICAL-WORD.json.gz", + "usage": "input", + "git_blob": "a2e5a1ffd454a353bd2d2100bc26259ff5b57af7", + "sha256": "66d3c3c70983224650643a0a05a21ac6c6959f84d0f4528650601016f5a76844" + }, + { + "path": "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/CLIFFORD-RECIPES.json", + "usage": "input", + "git_blob": "526192f5056e4d7abd7c6ecd26d73319bc25d08e", + "sha256": "534ace870cabe515987e00f50f71550030965006ea18978e0924590ac6944345" + }, + { + "path": "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/CLIFFORD-REVIEW.json", + "usage": "input", + "git_blob": "d6670b5c1555eff7695811e60f75d1285af16ad2", + "sha256": "ee9b86428278392d2c933f76d60e51f5af90d4ab67e4d3937ed2fa416e7755ab" + }, + { + "path": "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/INDEPENDENT-LOCAL-REPLAY.json", + "usage": "input", + "git_blob": "c2e057a3ab4e18ad9711bcd24071780918f81c40", + "sha256": "ad3f2b941127688f98ce6872d00f110644f1c2b156f8adad1b6700e838ed0e26" + }, + { + "path": "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/INDEPENDENT-REPLAY.json", + "usage": "input", + "git_blob": "c2e057a3ab4e18ad9711bcd24071780918f81c40", + "sha256": "ad3f2b941127688f98ce6872d00f110644f1c2b156f8adad1b6700e838ed0e26" + }, + { + "path": "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/INTEGRATION.json", + "usage": "input", + "git_blob": "ba436009d75f548e6345b7e32a21e343263bc5d4", + "sha256": "5c14538134dfffbc58fa4b4d2f26b270ec5f56d17d4bf23752c82964f45171db" + }, + { + "path": "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/LOCAL-CHECKS.json", + "usage": "input", + "git_blob": "2b019f86cd37f3112ee051241f93b7ab3ec6261c", + "sha256": "79177449e404403964ce1b2f4a9a8bd49e1916daba3123d7fd7f5cfd1f1ac0ea" + }, + { + "path": "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/LOCAL-PROGRAMS.json.gz", + "usage": "input", + "git_blob": "3b2aa5db6747008c9f9c06a572cdc21e14eb8d27", + "sha256": "99a18eede965accf65943e490b8d2b2ffb9f1c9bc6babdb825413a80cbea2cde" + }, + { + "path": "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/RESIDUAL-ADAPTERS.json", + "usage": "input", + "git_blob": "2a81814dca80e70ae99a2f9ca403de07573c36bd", + "sha256": "baafef737acc16dafbe1150896feb16744f3d669fa123bb2bff19ecc4e71b275" + }, + { + "path": "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/SCALAR-FRAME-AUDIT.json", + "usage": "input", + "git_blob": "089f202be813ab0221f52b8ac7072d478c3f7497", + "sha256": "73b3601a6239502475a272ea0c46945fd42034486aaf43e66a212eb4f012ca44" + }, + { + "path": "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/split-centres/WRAPPER-CHECKS.json", + "usage": "input", + "git_blob": "5efe2efe55e1ef33eb3da11642034ad6085c21c1", + "sha256": "9a09146e686c4f535b04fdef3753fe01dad8f5e8881a69408a91394acb5b48f5" + }, + { + "path": "research/community-k492-audit/pr622/replay/baseline558/complex-global/base/work/complex-nine-native/DATA-PHASES.json", + "usage": "input", + "git_blob": "d9a4f84211182ca200c081ea061d724c8a2cfb70", + "sha256": "c5916ff312678f12aba403847643fbbc29f643acec60bdf836fa56cd3e8251fa" + }, + { + "path": "research/community-k492-audit/pr622/replay/baseline558/complex-global/controller-input/split-centres/CANONICAL-WORD.json.gz", + "usage": "input", + "git_blob": "3b0a475178f4e4ad107e3595992c872e47e83c63", + "sha256": "de2be0f4b6d24ace368fd5b834b7a00f9625d0a1824c4ff969f2db5f115db667" + }, + { + "path": "research/complex-k492-owner-repair/vendor/multicold/code/run_portable.py", + "usage": "input", + "git_blob": "2fed13f432df4d76ce72185dd79fac63d96aee96", + "sha256": "322d29d43dbee8130cde15d4bf05396698b5e3dfe3735813899db91cc0ba7955" + }, + { + "path": "research/complex-k492-owner-repair/vendor/multicold/engines/base_two_moment.py", + "usage": "input", + "git_blob": "14a90fa0e788217856f070382c9e61bd7c603c61", + "sha256": "aee70c242a2f1d225528fabe2002e1564d1dc884797c07d28a831c7878ee9098" + }, + { + "path": "research/complex-k492-owner-repair/vendor/multicold/engines/moment.py", + "usage": "input", + "git_blob": "7d697cb45203fe72d97037403d6da41f71f3b7fd", + "sha256": "81cbc864e106418fc7854322746f72180cb8110ff39f74450a3b8d55a82c1482" + }, + { + "path": "research/complex-k492-owner-repair/vendor/multicold/engines/outer.py", + "usage": "input", + "git_blob": "43007488ad2c43187c77cc6798beff8b1cd76ad2", + "sha256": "c1ebb52163a7219504c728a5c2b098bf1e50bf20148a2879c5a74c3cadc7c03c" + }, + { + "path": "research/complex-k492-owner-repair/vendor/multicold/inputs/PR543-EXPECTED.json", + "usage": "input", + "git_blob": "b61d859826246e0c3dabbe096e57ad7015eadfd5", + "sha256": "06eccee9f6b77e140833df83407e7996dc948c17d49b0779ab171fbe463fd28d" + }, + { + "path": "research/complex-k492-owner-repair/vendor/multicold/vendor/pr558/vendor/pr552/complex-global/vendor531/code/prepare_supplier_base.py", + "usage": "input", + "git_blob": "650fc9fd77fd61930ab3a352cd8d0fb5b7f0f03b", + "sha256": "f5eae94aca965d0008bc07cff8245ccb7509042ccad457d3bcb7d51c1e9409f0" + }, + { + "path": "research/complex-k492-owner-repair/vendor/multicold/vendor/pr558/vendor/pr552/complex-global/vendor531/evidence/audit/PREFIX-AND-INVOICE.json", + "usage": "input", + "git_blob": "a16bf40bccc81278a443e0d5f09b44495035de81", + "sha256": "ce1bfa49be88ae67a404f606a11db2232b7e1f2610d4418058e39749d86d8478" + }, + { + "path": "research/complex-k492-owner-repair/vendor/multicold/vendor/pr558/vendor/pr552/complex-global/vendor535/inputs/ROUND20-PARENT-TEMPLATE.json.gz", + "usage": "input", + "git_blob": "3e28a9b59f8fde608e59ebd5fbdbc22ca54558d4", + "sha256": "025448abdf2012d327e50a009084e1501690d05e650300d2982836aa0350ae00" + }, + { + "path": "research/complex-t16-rare-pattern-exchanges/CANDIDATE.json", + "usage": "input", + "git_blob": "d80e967cb9ee9003ace480474399b4e5ee16f7d1", + "sha256": "e5fe28718bd517bbb2e9cd377778bf76bd89012b71e48889784ea45e4dfd7dd4" + }, + { + "path": "research/complex-t16-rare-pattern-exchanges/MANIFEST.json", + "usage": "input", + "git_blob": "3216666bd231516f8d2387e3096d6a5bd413b519", + "sha256": "16a964621e718c8da4c859ccbb280c3c00816ca72874e955910fdf0ef27a0adc" + }, + { + "path": "research/complex-t16-rare-pattern-exchanges/MOVES.json", + "usage": "input", + "git_blob": "a0d272b433b05eead7d0b7bbf2962a84faf854e5", + "sha256": "d902f129f4c66e4bfe0e1a2e2c602ed71022d11ed938bfa801a087bb8b3b0d1a" + }, + { + "path": "research/complex-t16-rare-pattern-exchanges/OWNERS.json.gz", + "usage": "input", + "git_blob": "d3ba33d7e703a3229d9fb8a360f69d2f318bbb70", + "sha256": "87902c528dfab7d503dcf8a784260e3ab6fb7424c418a1820f7261f25be7b6bc" + }, + { + "path": "research/complex-t16-rare-pattern-exchanges/PRICE.json", + "usage": "input", + "git_blob": "f0e765d35128eef8079bdb90c2ebe25db9c9b7ba", + "sha256": "08372c20bee19530083ba15d3a95ce019df68679bae8a52a77fbe8d9c311fc5c" + }, + { + "path": "research/complex-t16-rare-pattern-exchanges/PROFILE.json", + "usage": "input", + "git_blob": "7acbdeb81015d4681b5773489369a2a8b0d46d79", + "sha256": "cf539f314584ee0b6d7102d2344be96a63defa88b9d9ab6ffe05cddd6c13a874" + }, + { + "path": "research/complex-t16-rare-pattern-exchanges/README.md", + "usage": "input", + "git_blob": "f205b7132243aedcb2aa85110a44f0c8cd1e4fe1", + "sha256": "da542711a6a3eb01ce1ebdf8f28a748e6195512687f61d003b95ac5ff281a7b2" + }, + { + "path": "research/complex-t16-rare-pattern-exchanges/SOURCE.json", + "usage": "input", + "git_blob": "1e43afd08c060373b6fde3c775c23c180cb6a794", + "sha256": "4cfd44cebfe88f4450294239fbea8feecb564338dc3027b76065227f5d19cb6f" + }, + { + "path": "research/complex-t16-rare-pattern-exchanges/VALIDATION.json", + "usage": "input", + "git_blob": "cf1de72638625b8d0845ce2756d68d97f7e55f42", + "sha256": "93d2f78759a7fdfaeb1023387d85f059a7db285b8767ef2c3692a0c21ea3e1c5" + }, + { + "path": "research/complex-t16-rare-pattern-exchanges/data/OWNERS.json.gz", + "usage": "input", + "git_blob": "d3ba33d7e703a3229d9fb8a360f69d2f318bbb70", + "sha256": "87902c528dfab7d503dcf8a784260e3ab6fb7424c418a1820f7261f25be7b6bc" + }, + { + "path": "research/complex-t16-rare-pattern-exchanges/data/PLAN.json", + "usage": "input", + "git_blob": "f1bec76e8e9b7a1f09c1e05cb6cce973b6e59f1b", + "sha256": "7bd786ba8e66408f02aa9ef446eaf20c1bfe981ea2e4dd1e5a929f0aa7767bc0" + }, + { + "path": "research/complex-t16-rare-pattern-exchanges/data/SPEC.json", + "usage": "input", + "git_blob": "af013ccc2975d9d575d116f8a463cc947f220c8d", + "sha256": "8cb51f25a5da4a29d3783853025b73ff1f452429d4fdb30c599e598bcab0e71d" + }, + { + "path": "research/complex-t16-rare-pattern-exchanges/upstream1087.tar.gz", + "usage": "input", + "git_blob": "2970ef79b0441e937449bed30f68f2e0558186ba", + "sha256": "d4acf04daef85d4514f80ec5fcd2492d0c60e5d6c49fa71b3e6523f8db2dea86" + }, + { + "path": "research/complex-t16-rare-pattern-exchanges/verify.py", + "usage": "input", + "git_blob": "9d471cf90835bc91d32bb0216c2bb867011a7420", + "sha256": "b8c2f76b305c5c9ceb42df203deef564857d17f1f8182d0745dda9ab96e3d4de" + } + ], + "vendored_sources": [ + { + "path": "vendor/strict_compare.py", + "upstream_path": "research/strict-replay-payload-comparison/compare.py", + "commit": "d31c1418c0c23994d1444dbd9d356b9a8238fd5e", + "url": "https://raw.githubusercontent.com/CrocSwap/integer-mult-bounds/d31c1418c0c23994d1444dbd9d356b9a8238fd5e/research/strict-replay-payload-comparison/compare.py", + "sha256": "7592c2475a851ac68a6db1a82af4ae9db466690c7e2c1daced654c5641b66492", + "git_blob": "127f143bb8e46ca9be26210bcdd2d15c12a79798" + }, + { + "path": "vendor/invoice_compare.py", + "upstream_path": "research/selected-invoice-reference-rebinding/compare_invoice.py", + "commit": "323703a83640f4c104469bf29db18d7d579cb587", + "url": "https://raw.githubusercontent.com/CrocSwap/integer-mult-bounds/323703a83640f4c104469bf29db18d7d579cb587/research/selected-invoice-reference-rebinding/compare_invoice.py", + "sha256": "ddd241a78c16ca4c8a10aaf4aee04a60fe9e171b82e586339d7c3be601a0e3ac", + "git_blob": "2b2460f5ca416e0944b3fb862d1354566bd239c2" + } + ] +} diff --git a/research/selected-windows-role-adapter/vendor/pr2101/compare_outputs.py b/research/selected-windows-role-adapter/vendor/pr2101/compare_outputs.py new file mode 100644 index 0000000000..e020b39d8a --- /dev/null +++ b/research/selected-windows-role-adapter/vendor/pr2101/compare_outputs.py @@ -0,0 +1,125 @@ +#!/usr/bin/env python3 +"""Closed PR1094 final-output caller for the pinned PR2040/PR2059 predicates. + +All 105 output files are compared. Only two authenticated invoice links, six +exact input-path roles, and 22 stage-time fields receive normalization. +Adam Gall, with substantial OpenAI Codex assistance. Apache-2.0. +""" +from decimal import Decimal +import hashlib +import importlib.util +import json +from pathlib import Path + +HERE = Path(__file__).resolve().parent + + +def require(condition, message): + if not condition: + raise ValueError(message) + + +def digest(raw): + return hashlib.sha256(raw).hexdigest() + + +def load_vendor(name): + records = json.loads((HERE / 'SOURCES.json').read_bytes())['vendored_sources'] + record = next(row for row in records if row['path'] == 'vendor/' + name + '.py') + path = HERE / record['path'] + require(digest(path.read_bytes()) == record['sha256'], 'vendored source drift: ' + name) + spec = importlib.util.spec_from_file_location(name, path) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +strict = load_vendor('strict_compare') +invoice = load_vendor('invoice_compare') +POLICY = json.loads((HERE / 'POLICY.json').read_bytes()) +NAMES = frozenset(POLICY['files']) +STAGES = POLICY['stages'] + + +def read_files(directory): + return {name: path.read_bytes() for name, path in strict.inventory(directory).items()} + + +def prepare(files, context): + """Validate per-side raw edges before any equality or representation quotient. + + context contains logical work/local roots and exactly three actual external + input byte strings. No filesystem path from a receipt is followed. + Other digest fields remain literal, not inferred graph edges. + """ + require(set(files) == NAMES, 'complete 105-file inventory differs') + require(set(context) == {'work', 'local', 'external'}, 'invalid comparison context') + strict.Roots([('work', context['work']), ('local', context['local'])]) + external = context['external'] + require(set(external) == {'local-word', 'local-replay', 'owners'}, 'external role set differs') + stages = strict.read_json(files['STAGES.json']) + replay = strict.read_json(files['REPLAY.json']) + require(type(stages) is list and len(stages) == len(STAGES), 'stage inventory differs') + require(type(replay) is dict and 'stages' in replay, 'missing replay stage binding') + require(strict.tree(stages) == strict.tree(replay['stages']), 'stage receipts disagree') + for name, paths in POLICY['timings'].items(): + strict.validate_timings(stages if name == 'STAGES.json' else replay, paths) + for expected, stage in zip(STAGES, stages): + require(type(stage) is dict and stage.get('name') == expected, 'stage order differs') + require(type(stage.get('exit_code')) is int and stage['exit_code'] == 0, 'stage did not pass') + require(type(stage.get('log_sha256')) is str and + stage['log_sha256'] == digest(files[expected + '.log']), 'stale stage log: ' + expected) + independent = strict.read_json(files['INDEPENDENT-T16.json']) + require(type(independent) is dict and type(independent.get('input_sha256')) is dict, + 'missing independent input roles') + expected_inputs, rebound = {}, {} + for role in POLICY['input_roles']: + path = context[role['root']] + '/' + role['suffix'] + raw = files[role['target']] if 'target' in role else external[role['external']] + expected_inputs[path] = digest(raw) + rebound[role['root'] + ':' + role['suffix']] = digest(raw) + require(len(expected_inputs) == 6 and + strict.tree(independent['input_sha256']) == strict.tree(expected_inputs), + 'stale, missing, or misbound independent input role') + independent['input_sha256'] = rebound + # Reuse the three-node predecessor unchanged; it authenticates both links + # before rebinding and retains the complete invoice and consumer payloads. + replacements = invoice.normalized({name: files[name] for name in invoice.FILES}) + # This receipt's pinned schema is integer/string/Boolean JSON, like the + # invoice domain. Reparse through that domain before its serialization. + independent = invoice.parse(json.dumps(independent).encode('utf-8')) + replacements['INDEPENDENT-T16.json'] = invoice.canonical(independent) + return replacements + + +def compare(reference, candidate, reference_context, candidate_context): + left = prepare(reference, reference_context) + right = prepare(candidate, candidate_context) + result = {} + for name in sorted(NAMES): + result[name] = strict.classify(name, left.get(name, reference[name]), + right.get(name, candidate[name]), + timing_paths=POLICY['timings'].get(name, ())) + return {'equivalent': all(strict.accepted(row) for row in result.values()), + 'files': result, 'checked_files': len(result), + 'authenticated_raw_edges_per_side': 30, + 'normalized_invoice_edges_per_side': 2, + 'relocated_input_roles_per_side': 6, + 'permitted_stage_timing_fields_per_side': 22} + + +def outer_log(raw, files): + """Check all 13 lines and bind all printed times to the same-side receipt.""" + lines = raw.decode('utf-8').splitlines() + require(raw.endswith(b'\n') and len(lines) == 13, 'outer log inventory differs') + stages = strict.read_json(files['STAGES.json']) + for index, name in enumerate(STAGES): + fields = lines[index].split(' ') + require(len(fields) == 3 and fields[:2] == ['PASS', name], 'outer log stage differs') + seconds = Decimal(fields[2]) + require(seconds.is_finite() and seconds >= 0 and seconds == stages[index]['seconds'], + 'outer log timing differs from its receipt') + expected = ['PASS_GAUGE44_T16_STRICT_GLOBAL_REPLAY 0.001672660197076918', + 'PASS_T16_RARE_PATTERN_EXCHANGES 0.001672660197076918'] + require(lines[11:] == expected, 'outer log final result differs') + return [*('PASS ' + name for name in STAGES), *expected] diff --git a/research/selected-windows-role-adapter/vendor/pr2101/vendor/invoice_compare.py b/research/selected-windows-role-adapter/vendor/pr2101/vendor/invoice_compare.py new file mode 100644 index 0000000000..2b2460f5ca --- /dev/null +++ b/research/selected-windows-role-adapter/vendor/pr2101/vendor/invoice_compare.py @@ -0,0 +1,125 @@ +#!/usr/bin/env python3 +"""Compare only PR1094's three-node invoice subgraph, never admit a supplier. + +Authenticate each side's two literal raw invoice references before replacing +those two fields by a complete canonical invoice digest. Every other field is +retained. The accepted JSON domain is the reviewed integer/string/Boolean/null +schema: decimal/exponent numbers, duplicate keys and nonfinite values fail. + +Adam Gall, with substantial OpenAI Codex assistance. Apache-2.0. +""" +import argparse +import hashlib +import json +from pathlib import Path + +INVOICE = "global/audit/PREFIX-AND-INVOICE.json" +CONSUMERS = ("ADMISSION-CONTROLS.json", "ASSEMBLY.json") +FILES = (INVOICE, *CONSUMERS) +REFERENCE_PATH = ("input_sha256", "fresh_invoice") +SCOPE = "PR1094 three-node invoice subgraph only; not mathematical admission" + + +class InvalidGraph(ValueError): + """Malformed JSON, incomplete subgraph, or an unauthenticated raw edge.""" + + +def sha256(raw): + return hashlib.sha256(raw).hexdigest() + + +def _unique_object(pairs): + result = {} + for key, value in pairs: + if key in result: + raise InvalidGraph("duplicate JSON key: " + repr(key)) + result[key] = value + return result + + +def _unsupported_number(value): + raise InvalidGraph("outside reviewed integer JSON domain: " + value) + + +def parse(raw): + """Parse without binary64 rounding or Python Boolean/integer conflation.""" + try: + return json.loads(raw, object_pairs_hook=_unique_object, + parse_float=_unsupported_number, + parse_constant=_unsupported_number) + except (ValueError, UnicodeError) as exc: + raise InvalidGraph(str(exc)) from exc + + +def canonical(value): + """An injective encoding of parsed trees up to object order/string escapes.""" + return json.dumps(value, sort_keys=True, ensure_ascii=True, + separators=(",", ":"), allow_nan=False).encode("ascii") + + +def normalized(files): + """Return complete canonical bytes, after authenticating BOTH raw edges. + + Callers must establish trust in their reference separately. Byte-identical + inputs do not bypass parsing or edge checks. No path, time, generic digest, + or unknown field is masked. Only the named three files are in this API. + """ + if set(files) != set(FILES): + raise InvalidGraph("expected exactly the three declared subgraph files") + values = {name: parse(files[name]) for name in FILES} + if any(type(value) is not dict for value in values.values()): + raise InvalidGraph("each subgraph artifact must be a JSON object") + raw_digest = sha256(files[INVOICE]) + for name in CONSUMERS: + inputs = values[name].get("input_sha256") + if type(inputs) is not dict: + raise InvalidGraph(name + ": missing input_sha256 object") + digest = inputs.get("fresh_invoice") + if type(digest) is not str or digest != raw_digest: + raise InvalidGraph(name + ": stale or misbound fresh_invoice") + invoice = canonical(values[INVOICE]) + content_digest = sha256(invoice) + result = {INVOICE: invoice} + for name in CONSUMERS: + values[name]["input_sha256"]["fresh_invoice"] = content_digest + result[name] = canonical(values[name]) + return result + + +def compare(reference, candidate): + """A fresh parse and edge check on each side, then complete byte equality.""" + left, right = normalized(reference), normalized(candidate) + different = [name for name in FILES if left[name] != right[name]] + return { + "scope": SCOPE, + "equivalent": not different, + "different_files": different, + "authenticated_edges_per_side": len(CONSUMERS), + "reference_invoice_raw_sha256": sha256(reference[INVOICE]), + "candidate_invoice_raw_sha256": sha256(candidate[INVOICE]), + "reference_canonical_sha256": {name: sha256(left[name]) for name in FILES}, + "candidate_canonical_sha256": {name: sha256(right[name]) for name in FILES}, + } + + +def read_graph(directory): + """Read the three documented paths; other directory files are OUT OF SCOPE.""" + return {name: (directory / name).read_bytes() for name in FILES} + + +def main(argv=None): + parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + parser.add_argument("reference", type=Path, help="trusted strict-output directory") + parser.add_argument("candidate", type=Path, help="candidate strict-output directory") + args = parser.parse_args(argv) + try: + report = compare(read_graph(args.reference), read_graph(args.candidate)) + except (OSError, InvalidGraph) as exc: + print(json.dumps({"scope": SCOPE, "valid_graph": False, "error": str(exc)})) + return 2 + print(json.dumps(report, sort_keys=True, indent=2)) + return 0 if report["equivalent"] else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/research/selected-windows-role-adapter/vendor/pr2101/vendor/strict_compare.py b/research/selected-windows-role-adapter/vendor/pr2101/vendor/strict_compare.py new file mode 100644 index 0000000000..127f143bb8 --- /dev/null +++ b/research/selected-windows-role-adapter/vendor/pr2101/vendor/strict_compare.py @@ -0,0 +1,260 @@ +#!/usr/bin/env python3 +"""Strict, opt-in comparison of generated replay payloads (standard library). + +This does not authenticate a replay or replace immutable source hashes. +Prepared for commdata2338 with substantial OpenAI Codex assistance. Apache-2.0. +""" +import argparse +from decimal import Decimal, InvalidOperation +import gzip +import json +from pathlib import Path, PurePosixPath +import sys +import zlib + + +class InvalidPayload(ValueError): + pass + + +def require(condition, message): + if not condition: + raise InvalidPayload(message) + + +def read_json(raw): + """Reject ambiguous objects; preserve every JSON number exactly.""" + def pairs(items): + result = {} + for key, value in items: + require(key not in result, 'duplicate JSON key: ' + repr(key)) + result[key] = value + return result + + def constant(value): + raise InvalidPayload('nonfinite JSON constant: ' + value) + + return json.loads(raw, object_pairs_hook=pairs, parse_float=Decimal, + parse_constant=constant) + + +class Roots: + """Injective lexical POSIX path map; path tags cannot equal literal text.""" + def __init__(self, pairs=()): + self.pairs = [] + tokens, prefixes = set(), set() + for token, prefix in pairs: + require(type(token) is str and bool(token), 'empty root token') + require(type(prefix) is str and prefix.startswith('/'), + 'root must be an absolute POSIX path') + require(str(PurePosixPath(prefix)) == prefix and + not prefix.startswith('//') and '..' not in prefix.split('/'), + 'root must be lexically canonical') + require(token not in tokens, 'duplicate root token: ' + token) + require(prefix not in prefixes, 'duplicate root prefix: ' + prefix) + tokens.add(token) + prefixes.add(prefix) + self.pairs.append((token, prefix)) + self.tokens = frozenset(tokens) + self.pairs.sort(key=lambda pair: -len(pair[1])) + + def string(self, value): + for token, prefix in self.pairs: + if value == prefix: + return ('path', token, '') + if prefix == '/' and value.startswith('/'): + return ('path', token, value) + if value.startswith(prefix + '/'): + return ('path', token, value[len(prefix):]) + return ('string', value) + + +EMPTY_ROOTS = Roots() + + +def validate_timings(value, paths): + require(type(paths) in (list, tuple), 'timing paths must be an array') + seen = set() + for path in paths: + require(type(path) in (tuple, list), 'timing path must be an array') + require(all(type(p) in (str, int) for p in path), 'invalid timing path component') + path = tuple(path) + require(path not in seen, 'duplicate timing path') + seen.add(path) + node = value + for component in path: + if type(node) is dict and type(component) is str: + require(component in node, 'missing timing field: ' + repr(path)) + elif type(node) is list and type(component) is int: + require(0 <= component < len(node), 'missing timing index: ' + repr(path)) + else: + raise InvalidPayload('timing path has wrong shape: ' + repr(path)) + node = node[component] + require(type(node) in (int, Decimal), 'timing must be numeric, not Boolean/string') + require(node >= 0 and (type(node) is int or node.is_finite()), + 'timing must be finite and nonnegative') + return frozenset(seen) + + +def tree(value, roots=EMPTY_ROOTS, timings=frozenset(), path=()): + """A tagged, lossless tree, except for explicitly declared path/time quotients.""" + if path in timings: + return ('timing',) + if type(value) is dict: + items = [(roots.string(k), tree(v, roots, timings, path + (k,))) + for k, v in value.items()] + require(len({k for k, _ in items}) == len(items), 'relocation key collision') + return ('object', tuple(sorted(items))) + if type(value) is list: + return ('array', tuple(tree(v, roots, timings, path + (i,)) + for i, v in enumerate(value))) + if type(value) is str: + return roots.string(value) + if type(value) is bool: + return ('boolean', value) + if value is None: + return ('null',) + if type(value) is int: + return ('integer', value) + if type(value) is Decimal: + require(value.is_finite(), 'nonfinite decimal') + return ('decimal', value) + raise InvalidPayload('unsupported JSON type: ' + type(value).__name__) + + +def first_difference(a, b, path=()): + """Diagnostic typed path; equality is checked on the entire tagged trees.""" + if a == b: + return None + if a[0] == b[0] == 'object': + left, right = dict(a[1]), dict(b[1]) + for key in sorted(left.keys() | right.keys()): + if key not in left or key not in right: + return {'path': [*path, list(key)], 'kind': 'missing-or-extra-key'} + diff = first_difference(left[key], right[key], (*path, list(key))) + if diff: + return diff + elif a[0] == b[0] == 'array': + if len(a[1]) != len(b[1]): + return {'path': list(path), 'kind': 'array-length'} + for i, (x, y) in enumerate(zip(a[1], b[1])): + diff = first_difference(x, y, (*path, i)) + if diff: + return diff + return {'path': list(path), 'kind': 'value-or-type', + 'reference': repr(a)[:160], 'run': repr(b)[:160]} + + +def classify(name, reference, run, ref_roots=EMPTY_ROOTS, run_roots=EMPTY_ROOTS, + timing_paths=()): + require(ref_roots.tokens == run_roots.tokens, 'root-token sets must agree') + compressed = name.endswith('.gz') + json_name = name[:-3] if compressed else name + try: + a = gzip.decompress(reference) if compressed else reference + b = gzip.decompress(run) if compressed else run + if not json_name.endswith('.json'): + require(not timing_paths, 'timing policy on a non-JSON file') + if reference == run: + return {'cls': 'bytes'} + return {'cls': 'gzip-container' if a == b else 'binary-diff'} + ja, jb = read_json(a), read_json(b) + # Validate even byte-identical inputs: identical malformed JSON is not + # positive evidence, nor is a missing/invalid declared time field. + ta, tb = validate_timings(ja, timing_paths), validate_timings(jb, timing_paths) + # Equal payload bytes with the same path interpretation need no tree + # allocation. Parsing and time validation above still run in full. + if a == b and ref_roots.pairs == run_roots.pairs: + return {'cls': 'bytes' if reference == run else 'gzip-container'} + relocated_a, relocated_b = tree(ja, ref_roots), tree(jb, run_roots) + if relocated_a == relocated_b: + if reference == run: + return {'cls': 'bytes'} + if a == b: + return {'cls': 'gzip-container'} + if not ref_roots.pairs and not run_roots.pairs: + return {'cls': 'json-format'} + if tree(ja) == tree(jb): + return {'cls': 'json-format'} + return {'cls': 'json-relocated'} + timed_a = tree(ja, ref_roots, ta) if ta else relocated_a + timed_b = tree(jb, run_roots, tb) if tb else relocated_b + if timed_a == timed_b: + return {'cls': 'json-diff', 'verdict': 'declared-timing'} + return {'cls': 'json-diff', 'verdict': 'proof-relevant-candidate', + 'first_difference': first_difference(timed_a, timed_b)} + except (ValueError, UnicodeError, OSError, EOFError, zlib.error, InvalidOperation) as exc: + return {'cls': 'invalid', 'reason': str(exc)} + + +def accepted(result): + return result['cls'] in {'bytes', 'gzip-container', 'json-format', 'json-relocated'} or ( + result['cls'] == 'json-diff' and result['verdict'] == 'declared-timing') + + +def inventory(root): + require(root.is_dir(), 'comparison root is not a directory: ' + str(root)) + require(not root.is_symlink(), 'comparison root must not be a symlink') + result = {} + for path in sorted(root.rglob('*')): + require(not path.is_symlink(), 'symlink outside the file-comparison contract') + if path.is_file(): + result[path.relative_to(root).as_posix()] = path + return result + + +def compare(reference, run, ref_roots=EMPTY_ROOTS, run_roots=EMPTY_ROOTS, timings=None): + require(ref_roots.tokens == run_roots.tokens, 'root-token sets must agree') + timings = timings or {} + left, right = inventory(reference), inventory(run) + require(set(timings) <= left.keys() & right.keys(), 'timing policy names absent files') + result = {} + for name in sorted(left.keys() | right.keys()): + if name not in right: + result[name] = {'cls': 'missing'} + elif name not in left: + result[name] = {'cls': 'extra'} + else: + result[name] = classify(name, left[name].read_bytes(), right[name].read_bytes(), + ref_roots, run_roots, timings.get(name, ())) + return result + + +def main(): + parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + parser.add_argument('reference', type=Path) + parser.add_argument('run', type=Path) + parser.add_argument('--ref-root', action='append', default=[], metavar='TOKEN=/absolute/path') + parser.add_argument('--run-root', action='append', default=[], metavar='TOKEN=/absolute/path') + parser.add_argument('--timings', type=Path, help='JSON object: filename -> exact typed path arrays') + parser.add_argument('--out', type=Path, help='write detailed JSON to a new file') + args = parser.parse_args() + try: + def roots(values): + pairs = [] + for value in values: + token, sep, prefix = value.partition('=') + require(bool(sep), 'expected TOKEN=/absolute/path') + pairs.append((token, prefix)) + return Roots(pairs) + policy = read_json(args.timings.read_bytes()) if args.timings else {} + require(type(policy) is dict, 'timing policy must be an object') + result = compare(args.reference, args.run, roots(args.ref_root), roots(args.run_root), policy) + counts = {} + for value in result.values(): + key = value['cls'] + (':' + value['verdict'] if 'verdict' in value else '') + counts[key] = counts.get(key, 0) + 1 + report = {'equivalent': all(map(accepted, result.values())), 'counts': counts, 'files': result} + if args.out: + with args.out.open('x', encoding='utf-8') as stream: + json.dump(report, stream, indent=2, sort_keys=True) + stream.write('\n') + print(json.dumps({'equivalent': report['equivalent'], 'counts': counts}, sort_keys=True)) + return 0 if report['equivalent'] else 1 + except (ValueError, OSError) as exc: + print('INVALID_COMPARISON: ' + str(exc), file=sys.stderr) + return 2 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/research/selected-windows-role-adapter/verify.py b/research/selected-windows-role-adapter/verify.py new file mode 100644 index 0000000000..a65e069e38 --- /dev/null +++ b/research/selected-windows-role-adapter/verify.py @@ -0,0 +1,262 @@ +#!/usr/bin/env python3 +"""Source-bound PR2101 Windows-role audit; constructed relocation, no supplier run. + +AAAmirinu with substantial OpenAI Codex assistance. Apache-2.0. +Fixture bindings follow Adam Gall's PR2101 and Josie Elliston's PR1824. +""" +import argparse +import copy +import gzip +import itertools +import json +import os +from pathlib import Path, PurePosixPath +import sys +import tarfile + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +sys.path.insert(0, str(HERE)) +import compare_roles as adapter + +old = adapter.predecessor +require = adapter.require +A1094 = 'research/community-frontier1094-audit/' +A1042 = 'research/community-frontier1042-audit/' +OWNER = 'research/complex-t16-rare-pattern-exchanges/data/OWNERS.json.gz' +REF_WORK = '/private/tmp/batch1099-selected/candidate' +REF_LOCAL = '/private/tmp/batch1047-selected/slots/local' + + +def authenticate(): + rows = json.loads((HERE / 'SOURCES.json').read_bytes())['files'] + inputs = [r for r in rows if r['usage'] == 'input'] + for row in inputs: + adapter.check_bytes((ROOT / row['path']).read_bytes(), row['sha256'], row['path']) + return len(inputs) + + +def archive_files(path, prefix=''): + result = {} + with tarfile.open(path) as archive: + for member in archive: + if member.isdir() or not member.name.startswith(prefix): + continue + name = member.name[len(prefix):] + part = PurePosixPath(name) + require(member.isfile() and name and part.as_posix() == name + and not part.is_absolute() and '..' not in part.parts + and '\\' not in name and name not in result, 'unsafe archive member') + result[name] = archive.extractfile(member).read() + return result + + +def fixture(): + local = archive_files(ROOT / (A1042 + 'selected-replay.tar.gz'), 'slots/local/') + receipt1042 = json.loads((ROOT / (A1042 + 'RESULT.json')).read_bytes()) + bound = {n.removeprefix('slots/local/'): h for n, h in receipt1042['artifacts'].items() + if n.startswith('slots/local/')} + require(len(bound) == 10 and {n: old.digest(b) for n, b in local.items()} == bound, + 'local input binding differs') + archived = archive_files(ROOT / (A1094 + 'selected-replay.tar.gz')) + require(archived['RESULT.json'] == (ROOT / (A1094 + 'RESULT.json')).read_bytes(), + 'selected result binding differs') + for name in ('ASSEMBLY.json', 'REPLAY.json'): + require(archived['candidate/strict/' + name] == (ROOT / (A1094 + name)).read_bytes(), + 'selected certificate/receipt binding differs') + result = json.loads(archived['RESULT.json']) + require(result['baseline_receipt_sha256'] == old.digest((ROOT / (A1042 + 'RESULT.json')).read_bytes()) + and result['assembly_sha256'] == old.digest(archived['candidate/strict/ASSEMBLY.json']), + 'selected lineage binding differs') + files = {n.removeprefix('candidate/strict/'): b for n, b in archived.items() + if n.startswith('candidate/strict/')} + context = {'work': {'style': 'posix', 'path': REF_WORK}, + 'local': {'style': 'posix', 'path': REF_LOCAL}, + 'external': {'local-word': local['CANONICAL-WORD.json.gz'], + 'local-replay': local['INDEPENDENT-LOCAL-REPLAY.json'], + 'owners': (ROOT / OWNER).read_bytes()}} + old.outer_log(archived['rare-pattern-exchanges.log'], files) + return files, context, archived['rare-pattern-exchanges.log'] + + +def encoded(value): + return (json.dumps(value, sort_keys=True, ensure_ascii=True) + '\n').encode('ascii') + + +def mutate(files, name, operation): + raw = files[name] + value = json.loads(gzip.decompress(raw) if name.endswith('.gz') else raw) + operation(value) + raw = encoded(value) + if name.endswith('.gz'): + raw = gzip.compress(raw, mtime=0) + return dict(files, **{name: raw}) + + +def relocated(files, original, work, local, style): + """Independent exact fixture spelling oracle: explicit separators, not adapter joins.""" + context = {'work': {'style': style, 'path': work}, + 'local': {'style': style, 'path': local}, 'external': original['external']} + keymap = {} + for role in old.POLICY['input_roles']: + previous = original[role['root']]['path'] + '/' + role['suffix'] + prefix = context[role['root']]['path'] + keymap[previous] = (prefix + '\\' + role['suffix'].replace('/', '\\') + if style == 'windows-drive' else prefix + '/' + role['suffix']) + updated = mutate(files, 'INDEPENDENT-T16.json', lambda v: v.__setitem__( + 'input_sha256', {keymap[k]: digest for k, digest in v['input_sha256'].items()})) + return updated, context + + +def run(): + source_count = authenticate() + reference, refctx, reference_log = fixture() + positives, negatives = [], [] + + def rejects(label, call): + try: + report = call() + except (ValueError, TypeError, KeyError): + negatives.append(label) + return + require(type(report) is dict and report.get('equivalent') is False, + 'negative control accepted: ' + label) + negatives.append(label) + + def accepts(label, files, context, against=reference, leftctx=refctx): + report = adapter.compare(against, files, leftctx, context) + require(report['equivalent'] and report['checked_files'] == 105 + and report['authenticated_raw_edges_per_side'] == 30, 'positive rejected: ' + label) + positives.append(label) + + accepts('unchanged-posix-reference', reference, refctx) + win, winctx = relocated(reference, refctx, r'C:\proof runs\候補', r'D:\local inputs\供給', 'windows-drive') + untyped = {**winctx, 'work': winctx['work']['path'], 'local': winctx['local']['path']} + try: + old.prepare(win, untyped) + except ValueError as exc: + require(str(exc) == 'root must be an absolute POSIX path', 'unexpected predecessor rejection') + old_failure = str(exc) + else: + raise ValueError('pinned predecessor unexpectedly accepts Windows roots') + accepts('windows-drive-japanese-spaces', win, winctx) + posix, posctx = relocated(reference, refctx, '/tmp/literal\\backslash', '/tmp/local', 'posix') + accepts('posix-literal-backslash-retained', posix, posctx) + accepts('windows-identical-side-still-authenticated', win, winctx, win, winctx) + if os.name == 'nt': + for role in old.POLICY['input_roles']: + require(str(Path(winctx[role['root']]['path']).joinpath(*role['suffix'].split('/'))) + == adapter.role_path(winctx[role['root']], role['suffix']), 'native Windows spelling differs') + + keys = list(json.loads(win['INDEPENDENT-T16.json'])['input_sha256']) + for key in keys: + for label, op in ( + ('stale-digest', lambda v, key=key: v['input_sha256'].__setitem__(key, '0' * 64)), + ('missing-role', lambda v, key=key: v['input_sha256'].pop(key)), + ('separator-alias', lambda v, key=key: v['input_sha256'].__setitem__(key.replace('\\', '/'), v['input_sha256'].pop(key))), + ('case-alias', lambda v, key=key: v['input_sha256'].__setitem__(key.lower(), v['input_sha256'].pop(key))), + ): + bad = mutate(win, 'INDEPENDENT-T16.json', op) + rejects(label + ':' + key, lambda bad=bad: adapter.compare(reference, bad, refctx, winctx)) + digests = json.loads(win['INDEPENDENT-T16.json'])['input_sha256'] + require(len(set(digests.values())) == 6, 'swap controls require distinct role hashes') + for first, second in itertools.combinations(keys, 2): + def swap(v, first=first, second=second): + d = v['input_sha256']; d[first], d[second] = d[second], d[first] + bad = mutate(win, 'INDEPENDENT-T16.json', swap) + rejects('role-swap:' + first + ':' + second, + lambda bad=bad: adapter.compare(reference, bad, refctx, winctx)) + for name in sorted(win): + bad = dict(win); del bad[name] + rejects('missing-output:' + name, lambda bad=bad: adapter.compare(reference, bad, refctx, winctx)) + rejects('extra-output', lambda: adapter.compare(reference, dict(win, **{'EXTRA.json': b'{}'}), refctx, winctx)) + + malformed = [r'C:relative', r'\rooted', 'C:/mixed', r'C:\double\\separator', + r'C:\dot\.\part', r'C:\parent\..\part', 'C:\\trailing\\', + r'C:\space ', r'C:\dot.', r'C:\CON', r'C:\name:stream', + r'\\server\share\work', r'\\?\C:\work', r'\\.\C:\work'] + for path in malformed: + # Exercise root validation itself; unchanged receipt keys would reject + # later as stale even if the canonical-root guard were accidentally lost. + rejects('unsupported-root:' + path, lambda path=path: adapter.role_path( + {'style': 'windows-drive', 'path': path}, 'CANONICAL-WORD.json.gz')) + collision_ctx = {'work': {'style': 'windows-drive', 'path': r'C:\root'}, + 'local': {'style': 'windows-drive', 'path': r'c:\ROOT\STRICT\GLOBAL8\BASE\SPLIT-CENTRES'}, + 'external': refctx['external']} + collision_keys = {} + for role in old.POLICY['input_roles']: + before = refctx[role['root']]['path'] + '/' + role['suffix'] + collision_keys[before] = collision_ctx[role['root']]['path'] + '\\' + role['suffix'].replace('/', '\\') + collision = mutate(reference, 'INDEPENDENT-T16.json', lambda v: v.__setitem__( + 'input_sha256', {collision_keys[k]: digest for k, digest in v['input_sha256'].items()})) + require(len(set(collision_keys.values())) == 6 and + len({k.casefold() for k in collision_keys.values()}) == 5, + 'collision control must have six literal keys and five Windows identities') + rejects('case-insensitive-role-collision', lambda: adapter.compare(reference, collision, refctx, collision_ctx)) + ctx = copy.deepcopy(winctx); ctx['work']['style'] = 'automatic' + rejects('untyped-style', lambda: adapter.compare(reference, win, refctx, ctx)) + for name, op in ( + ('INDEPENDENT-T16.json', lambda v: v.__setitem__('live', True)), + ('ASSEMBLY.json', lambda v: v.__setitem__('kappa', '1/2')), + ('INDEPENDENT-T16.json', lambda v: v.__setitem__('unknown_path', r'C:\proof runs\候補')), + ('INDEPENDENT-T16.json', lambda v: v['input_sha256'].__setitem__('work:fake', '0' * 64)), + ('ADMISSION-CONTROLS.json', lambda v: v['input_sha256'].__setitem__('fresh_invoice', '0' * 64)), + ('REPLAY.json', lambda v: v['stages'][0].__setitem__('log_sha256', '0' * 64)), + ): + bad = mutate(win, name, op) + rejects('scientific-or-binding:' + name + ':' + str(len(negatives)), + lambda bad=bad: adapter.compare(reference, bad, refctx, winctx)) + # Even path-like strings present on BOTH sides remain literal outside the six keys. + left = mutate(reference, 'INDEPENDENT-T16.json', lambda v: v.__setitem__('note', REF_WORK + '/literal')) + right = mutate(win, 'INDEPENDENT-T16.json', lambda v: v.__setitem__('note', winctx['work']['path'] + r'\literal')) + rejects('unlisted-path-string-is-not-relocated', lambda: adapter.compare(left, right, refctx, winctx)) + bad = dict(win); bad['INDEPENDENT-T16.json'] = b'{"live":0,"live":1,' + win['INDEPENDENT-T16.json'].lstrip()[1:] + rejects('duplicate-json-key', lambda: adapter.compare(reference, bad, refctx, winctx)) + # An identically corrupted pair must reject, not pass a byte-equality fast path. + bad = mutate(win, 'INDEPENDENT-T16.json', lambda v: v['input_sha256'].__setitem__(keys[0], '0' * 64)) + rejects('identically-stale-native-roles', lambda: adapter.compare(bad, bad, winctx, winctx)) + + # Composition with the predecessor's declared invoice and timing quotients. + composed = dict(win) + invoice = old.invoice.INVOICE + composed[invoice] = encoded(json.loads(win[invoice])) + require(composed[invoice] != win[invoice], 'invoice positive must change bytes') + for name in old.invoice.CONSUMERS: + composed = mutate(composed, name, lambda v: v['input_sha256'].__setitem__('fresh_invoice', old.digest(composed[invoice]))) + for name in ('REPLAY.json', 'STAGES.json'): + def retime(v, name=name): + for i, row in enumerate(v if name == 'STAGES.json' else v['stages']): + row['seconds'] = 100 + i + composed = mutate(composed, name, retime) + accepts('windows-composed-invoice-and-22-times', composed, winctx) + log = ('\n'.join(['PASS ' + n + ' ' + str(100 + i) for i, n in enumerate(old.STAGES)] + + reference_log.decode().splitlines()[11:]) + '\n').encode() + require(old.outer_log(log, composed) == old.outer_log(reference_log, reference), 'composed outer log differs') + positives.append('coupled-outer-log-retained') + rejects('uncoupled-outer-log', lambda: old.outer_log(log.replace(b'100\n', b'101\n', 1), composed)) + for row in json.loads((HERE / 'SOURCES.json').read_bytes())['vendored_sources']: + rejects('vendor-source-drift:' + row['path'], lambda row=row: adapter.check_bytes( + (HERE / row['path']).read_bytes() + b'\0', row['sha256'], row['path'])) + return {'status': 'PASS_SELECTED_WINDOWS_ROLE_ADAPTER', 'source_inputs': source_count, + 'predecessor_rejection': old_failure, 'output_files': 105, 'roles': 6, + 'authenticated_edges_per_side': 30, 'fresh_supplier_run': False, + 'positive_controls': positives, 'negative_controls': negatives, + 'positive_count': len(positives), 'negative_count': len(negatives), + 'scope': 'Constructed Windows-drive/POSIX role relocation on authenticated reviewed outputs; no native supplier replay or new kappa.'} + + +def main(): + ap = argparse.ArgumentParser(description=__doc__) + ap.add_argument('--write', action='store_true') + args = ap.parse_args() + result = run() + if args.write: + (HERE / 'RESULT.json').write_text(json.dumps(result, indent=2, ensure_ascii=True) + '\n', encoding='utf8', newline='\n') + else: + require(result == json.loads((HERE / 'RESULT.json').read_bytes()), 'deterministic result differs') + print(result['status'], 'files=105 roles=6 positives=' + str(result['positive_count']), + 'negatives=' + str(result['negative_count']), 'no_supplier_run no_new_kappa') + + +if __name__ == '__main__': + main()