From 5634edade1db84ddefa25f2cbf92e79da6cce7eb Mon Sep 17 00:00:00 2001 From: Dylan Roy <249851642+d6g8k5htny-coder@users.noreply.github.com> Date: Sat, 3 Oct 2026 07:45:14 -0700 Subject: [PATCH] Repair readiness output transactions and witness state validation Reject unsafe output destinations, prepare replacements before installation, restore prior bytes on recoverable failure, and retain recovery diagnostics. Reject malformed proposed witness-edge slots and non-Boolean controlling fields. Add 25 regression tests and immutable historical fixtures so tests remain valid after register execution. Resolves the five engineering findings in PR183 review5401199597. Original mathematics, proposals, live GRAPH/SELECTOR and status are unchanged; scientific effect NONE. Fresh nonauthor successor review by OpenAI/Codex c100; authors root/c99, delegated by Dylan Roy. Human review NONE. Full integration checks remain required. --- .../register-execution-readiness.yml | 2 + .../RECONCILIATION.md | 10 + .../SOURCE_FILES.json | 12 +- .../reconciliation_check.py | 24 +- .../README.md | 17 + .../execution_dryrun.py | 93 +- .../fixtures/witness_baseline/GRAPH.json | 1041 +++++++++++++++++ .../witness_baseline/SELECTOR_REGION.json | 71 ++ .../fixtures/witness_baseline/SOURCE.json | 21 + .../test_execution_dryrun.py | 234 ++++ .../test_witness_states.py | 200 ++++ 11 files changed, 1712 insertions(+), 13 deletions(-) create mode 100644 reviews/register_execution_readiness_20260930/fixtures/witness_baseline/GRAPH.json create mode 100644 reviews/register_execution_readiness_20260930/fixtures/witness_baseline/SELECTOR_REGION.json create mode 100644 reviews/register_execution_readiness_20260930/fixtures/witness_baseline/SOURCE.json create mode 100644 reviews/register_execution_readiness_20260930/test_execution_dryrun.py create mode 100644 reviews/register_execution_readiness_20260930/test_witness_states.py diff --git a/.github/workflows/register-execution-readiness.yml b/.github/workflows/register-execution-readiness.yml index 95ff83606..c6262ab5e 100644 --- a/.github/workflows/register-execution-readiness.yml +++ b/.github/workflows/register-execution-readiness.yml @@ -32,6 +32,8 @@ jobs: PYTHONDONTWRITEBYTECODE: '1' run: | set -euo pipefail + python -B -S -m unittest discover -s reviews/register_execution_readiness_20260930 -p 'test_*.py' -v + python -B -O -S -m unittest discover -s reviews/register_execution_readiness_20260930 -p 'test_*.py' -v python -B -S reviews/register_execution_readiness_20260930/execution_dryrun.py --mutants python -B -S reviews/register_execution_readiness_20260930/execution_dryrun.py --skip-old-node-move python -B -S reviews/register_execution_readiness_20260930/execution_dryrun.py --selector-node-only diff --git a/reviews/c6_witness_collision_reconciliation_20260929/RECONCILIATION.md b/reviews/c6_witness_collision_reconciliation_20260929/RECONCILIATION.md index 63599b625..efd6aa656 100644 --- a/reviews/c6_witness_collision_reconciliation_20260929/RECONCILIATION.md +++ b/reviews/c6_witness_collision_reconciliation_20260929/RECONCILIATION.md @@ -31,6 +31,16 @@ with `RESULTS.json` in the baseline state and with `RESULTS_INSTALLED.json` in t installed selector table is accepted only when the graph carries the proposal, and the open witness node may carry none of its proposed edges (mutants `selector-ahead`, `witness-edges-partial`; four added in all). Nothing in §§1–7 changes. The §1a register-equivalent alternative (no separate residual node) is not an accepted installed state, since Math-#173 presupposes the separate node. +v1.9 (C110 engineering successor, 3 October 2026; OpenAI/Codex delegated executor +`/root/c99_custody_audit`, author of this repair after its original-head review): the old witness must remain +literally `controlling: false`; proposed Boolean fields cannot be satisfied by integers; and an edge on a proposed +endpoint pair must carry an exact proposed relation/Boolean-required tuple. The historical required edge from the +witness to `math.d5-component.offpin-second-moment-review` remains allowed alongside the separately proposed +supporting edge to that same target. This prevents malformed edges from being mistaken for absent proposal edges. +The bounded state and full-checker regressions live outside this sealed packet at +`reviews/register_execution_readiness_20260930/test_witness_states.py`. Accepted baseline and installed outputs +remain unchanged. This repair does not expand the checker to a universal graph validator, change any mathematical +proposal or execute the register; successor acceptance requires separate review. Independence count: 0; human review: NONE. **Effect:** register reconciliation, **declarative only**. This record introduces **no new mathematical claim**. It binds the merged C6 chain to exact bytes, quotes the open obligation as the register recorded it, states which reviewed theorem discharges that obligation and at what scope, states precisely what is *not* discharged, and proposes the diff --git a/reviews/c6_witness_collision_reconciliation_20260929/SOURCE_FILES.json b/reviews/c6_witness_collision_reconciliation_20260929/SOURCE_FILES.json index ad59fa5c5..2a2f97f5f 100644 --- a/reviews/c6_witness_collision_reconciliation_20260929/SOURCE_FILES.json +++ b/reviews/c6_witness_collision_reconciliation_20260929/SOURCE_FILES.json @@ -16,9 +16,9 @@ }, { "path": "RECONCILIATION.md", - "bytes": 44686, - "sha256": "81db346cb7594d8b284b548d1de052bac31041034d30f739fa87bb51d3225851", - "git_blob": "63599b6258045793979986e5c89e466b9fc4e5e5" + "bytes": 45762, + "sha256": "ce5ab424c3c7289c1548221956055f0d8f4404ec60a5de5d1293135745df2fde", + "git_blob": "efd6aa656f1877aca66ff2969214228cf66c3fbf" }, { "path": "RESULTS.json", @@ -28,9 +28,9 @@ }, { "path": "reconciliation_check.py", - "bytes": 35466, - "sha256": "9560763b3c8499f77b033ca9b77d24f1a5374e1283b0ce2e385b17eafb372860", - "git_blob": "6e8a0f6e663ebdbd8052dc5d435927234776046a" + "bytes": 36795, + "sha256": "ec5c919812e2765892df0e5a3eb512c696427483cabd2960feb8a9da72d03f9b", + "git_blob": "94058a013fde66f3413df8a46e8d5d86632e33f7" }, { "path": "RESULTS_INSTALLED.json", diff --git a/reviews/c6_witness_collision_reconciliation_20260929/reconciliation_check.py b/reviews/c6_witness_collision_reconciliation_20260929/reconciliation_check.py index 6e8a0f6e6..94058a013 100644 --- a/reviews/c6_witness_collision_reconciliation_20260929/reconciliation_check.py +++ b/reviews/c6_witness_collision_reconciliation_20260929/reconciliation_check.py @@ -190,7 +190,7 @@ def check_verdicts(root): def check_obligation(root): graph = json.loads((root / GRAPH).read_text(encoding="utf-8")) node = graph["nodes"].get(WITNESS) - if not node or node.get("kind") != "region": + if not isinstance(node, dict) or node.get("kind") != "region" or node.get("controlling") is not False: return False if node.get("classification") == "OPEN_ACTIVE": ok = node.get("fingerprint") == "eta->0 mutual witness separation" @@ -246,7 +246,9 @@ def check_negatives(src): def matches(live, fields): - return isinstance(live, dict) and all(live.get(k) == v for k, v in fields.items()) + return isinstance(live, dict) and all(live.get(k) == v and + (type(v) is not bool or type(live.get(k)) is bool) + for k, v in fields.items()) def installed_state(graph, proposed_nodes, proposed_edges): @@ -257,7 +259,8 @@ def installed_state(graph, proposed_nodes, proposed_edges): node on a proposed source. 'installed': every node present, every edge not leaving the witness node live, and the witness node OPEN_ACTIVE with none of its proposed edges live (step 4 pending) or PROVED_REVIEWED with all of them live and their required targets PROVED_REVIEWED (Codex 4143661519). 'baseline': nothing of the proposal live. - Anything else is 'partial' and rejected.""" + The old witness must remain literally noncontrolling. Edges on a proposed endpoint pair must match a proposed + tuple with a Boolean required flag, or the one preserved historical offpin edge. Anything else is 'partial'.""" nodes = graph["nodes"] proposed = {n["id"]: n for n in proposed_nodes} present, mismatched = set(), set() @@ -279,19 +282,30 @@ def installed_state(graph, proposed_nodes, proposed_edges): mismatched.add(nid) live_edges = {(e["from"], e["to"], e["required"], e["relation"]) for e in graph["edges"]} wanted = {(e["from"], e["to"], e["required"], e["relation"]) for e in proposed_edges} + # Count exact proposed edges only after rejecting malformed edges on their endpoint pairs. Otherwise, e.g. + # required=False in place of True vanishes from the intersection and masquerades as an untouched open witness. + # The baseline already carries this required offpin edge; section 7 separately proposes a supporting edge to + # the same target. Preserve both distinct relation slots rather than rejecting the historical tuple. + historical = (WITNESS, "math.d5-component.offpin-second-moment-review", True, "requires_evidence") + pairs = {(e[0], e[1]) for e in wanted} + allowed = wanted | {historical} + edges_ok = all(type(e["required"]) is bool and + (e["from"], e["to"], e["required"], e["relation"]) in allowed + for e in graph["edges"] if (e["from"], e["to"]) in pairs) wit_edges = {e for e in wanted if e[0] == WITNESS} other = wanted - wit_edges n_other, n_wit = len(other & live_edges), len(wit_edges & live_edges) wit = nodes.get(WITNESS) if isinstance(nodes.get(WITNESS), dict) else {} cls = wit.get("classification") + noncontrolling = wit.get("controlling") is False targets_ok = all(nodes.get(e[1], {}).get("classification") == "PROVED_REVIEWED" for e in wit_edges if e[2] is True) if MUT == "witness-edges-partial": wit_ok = cls == "OPEN_ACTIVE" or (cls == "PROVED_REVIEWED" and targets_ok) else: wit_ok = (cls == "OPEN_ACTIVE" and n_wit == 0) or (cls == "PROVED_REVIEWED" and n_wit == len(wit_edges) and targets_ok) - if not mismatched and set(present) == set(proposed) and n_other == len(other) and wit_ok: + if edges_ok and noncontrolling and not mismatched and set(present) == set(proposed) and n_other == len(other) and wit_ok: state = "installed" - elif not mismatched and not present and n_other == 0 and n_wit == 0: + elif edges_ok and noncontrolling and not mismatched and not present and n_other == 0 and n_wit == 0: state = "baseline" else: state = "partial" diff --git a/reviews/register_execution_readiness_20260930/README.md b/reviews/register_execution_readiness_20260930/README.md index 299adcab6..b05633766 100644 --- a/reviews/register_execution_readiness_20260930/README.md +++ b/reviews/register_execution_readiness_20260930/README.md @@ -1,5 +1,12 @@ # Register execution readiness — Math-#167, #160 and #173 against their own checkers after execution +**C110 engineering successor (3 October 2026).** OpenAI/Codex found further +maintenance-output and witness-state defects at PR183 head `0efd00e`. The original +six review repairs remain distinct from these new findings. The successor adds +executable regression controls in this directory; they run in both Python modes +before the three existing composition checks. No mathematical proposal, live +register, selector table or scientific status is executed by these repairs. + **Object:** REGISTER-EXECUTION-READINESS-20260930-v1. **Author:** Anthropic Claude, Claude Code session `session_017Mi3hxjaxV45x6zo6o1ee3` — the same session that authored the three records (author-side; exposure stated in §5). **Read at:** Math- `main` `dda8991` (30 September 2026; Math-#177 merged). @@ -88,6 +95,16 @@ repository, neither inside it nor one of its parents, that does not exist or is deletes anything). `--write-installed-results` (maintenance of this packet) writes the pinned installed outputs only after every checker, both interpreter modes and, if requested, every mutant have passed. +Maintenance also rejects symlinks in destination paths and nonregular existing +outputs, prepares all new outputs and recovery copies before replacing any pin, +and restores prior bytes on recoverable replacement failure. It preserves file +permissions and does not write through a hardlink to another name. If restoration +itself fails, the command fails explicitly and retains the named recovery copy. +Use an exclusively owned checkout: this is not crash-atomic across three files +and does not provide exclusion against a concurrent writer. A write error gives +`repository_written: null` (inspect the error/recovery report); a successful write +gives `true`, and an ordinary dry run gives `false`. + ``` python -B -S reviews/register_execution_readiness_20260930/execution_dryrun.py --mutants python -B -S reviews/register_execution_readiness_20260930/execution_dryrun.py --skip-old-node-move diff --git a/reviews/register_execution_readiness_20260930/execution_dryrun.py b/reviews/register_execution_readiness_20260930/execution_dryrun.py index a083afa58..20bded667 100644 --- a/reviews/register_execution_readiness_20260930/execution_dryrun.py +++ b/reviews/register_execution_readiness_20260930/execution_dryrun.py @@ -32,9 +32,11 @@ import hashlib import importlib.util import json +import os import pathlib import re import shutil +import stat import subprocess import sys import tempfile @@ -164,6 +166,85 @@ def compose(out, skip_old_node_move, selector_node_only): return report +def write_installed_outputs(root, outputs): + """Prepare all pins before replacing any; roll back recoverable install failures. + + This maintenance operation requires an exclusively owned checkout. It is not + a cross-file atomic transaction against process termination or another writer. + Symlink paths are rejected; replacing a regular hardlinked pin preserves its + other names. A failed rollback retains its backup and reports its location. + """ + root = root.resolve() + originals, modes = {}, {} + for name, (folder, _) in PACKETS.items(): + target = root / folder / "RESULTS_INSTALLED.json" + relative = target.relative_to(root) + for i in range(1, len(relative.parts) + 1): + part = root.joinpath(*relative.parts[:i]) + if part.is_symlink(): + raise ValueError("symlink output path rejected: " + str(part)) + if not target.parent.is_dir(): + raise ValueError("output parent directory missing: " + str(target.parent)) + if target.exists() and not stat.S_ISREG(target.stat().st_mode): + raise ValueError("regular output file required: " + str(target)) + originals[target] = target.read_bytes() if target.exists() else None + modes[target] = stat.S_IMODE(target.stat().st_mode) if target.exists() else 0o644 + + temporary, retained, staged, backups, installed = [], set(), {}, {}, [] + + def stage(target, data): + fd, name = tempfile.mkstemp(prefix=".installed-result-", dir=target.parent) + path = pathlib.Path(name) + temporary.append(path) + with os.fdopen(fd, "wb") as stream: + stream.write(data) + path.chmod(modes[target]) + return path + + primary_error = None + try: + for name, (folder, _) in PACKETS.items(): + target = root / folder / "RESULTS_INSTALLED.json" + staged[target] = stage(target, outputs[name]) + backups[target] = stage(target, originals[target]) if originals[target] is not None else None + try: + for target, replacement in staged.items(): + os.replace(replacement, target) + installed.append(target) + except BaseException as error: + failures = [] + for target in reversed(installed): + try: + if backups[target] is None: + target.unlink() + else: + os.replace(backups[target], target) + except OSError as rollback_error: + if backups[target] is not None: + retained.add(backups[target]) + failures.append(str(target) + ": " + str(rollback_error) + + "; backup=" + str(backups[target])) + if failures: + raise RuntimeError("output rollback incomplete: " + "; ".join(failures)) from error + raise + except BaseException as error: + primary_error = error + raise + finally: + cleanup_errors = [] + for path in temporary: + if path not in retained: + try: + path.unlink(missing_ok=True) + except OSError as error: + cleanup_errors.append(str(path) + ": " + str(error)) + if cleanup_errors: + prior = (str(primary_error) if primary_error is not None + else "output installation completed") + raise RuntimeError(prior + "; temporary cleanup incomplete: " + + "; ".join(cleanup_errors)) from primary_error + + def run_checkers(root, out, mutants, write_installed): """Run every checker (both interpreter modes, and every mutant if asked) on the executed copy; then, only if all of that passed, write the pinned installed outputs if asked; then compare with the pinned files.""" @@ -197,12 +278,18 @@ def run_checkers(root, out, mutants, write_installed): valid &= not not_rejected and len(rejected) == len(names) results[name] = entry outputs[name] = outs[("-B", "-S")] + if write_installed and valid: + try: + write_installed_outputs(root, outputs) + except (OSError, ValueError, RuntimeError) as error: + for entry in results.values(): + entry.update(written=None, write_error=str(error), matches_RESULTS_INSTALLED=None) + return False, results ok = valid for name, (pdir, script) in PACKETS.items(): entry = results[name] pinned = root / pdir / "RESULTS_INSTALLED.json" if write_installed and valid: # never on a failed run (Codex 4143661525) - pinned.write_bytes(outputs[name]) entry["written"] = str(pinned.relative_to(root)) elif write_installed: entry["written"] = None @@ -260,7 +347,9 @@ def main(): shutil.rmtree(tmp, ignore_errors=True) payload = {"object": "REGISTER-EXECUTION-DRYRUN-20260930-v1", "scenario": scenario, "composition": report, "checkers": checkers, "mutants_run": args.mutants, "passed": bool(composed and ok), - "scientific_effect": "NONE", "repository_written": bool(args.write_installed_results), + "scientific_effect": "NONE", "repository_write_requested": bool(args.write_installed_results), + "repository_written": (None if any("write_error" in entry for entry in checkers.values()) + else any(entry.get("written") for entry in checkers.values())), "meaning": "composition of three declarative proposals on a scratch copy; validation by the hard gate; the " "records' own checkers in their installed state; not an execution, not acceptance"} print(json.dumps(payload, indent=2, sort_keys=True)) diff --git a/reviews/register_execution_readiness_20260930/fixtures/witness_baseline/GRAPH.json b/reviews/register_execution_readiness_20260930/fixtures/witness_baseline/GRAPH.json new file mode 100644 index 000000000..220b56867 --- /dev/null +++ b/reviews/register_execution_readiness_20260930/fixtures/witness_baseline/GRAPH.json @@ -0,0 +1,1041 @@ +{ + "schema_version": 1, + "object": "DOWNSTREAM-HARD-GATE-20260925-v1", + "campaign": { + "main_issues": [ + 86, + 90 + ], + "disposition": "research-integrity control; scientific effect NONE" + }, + "terminal_classifications": [ + "PROVED_REVIEWED", + "SUPERSEDED_NONBLOCKING", + "REFUTED", + "BLOCKED_ABSENT" + ], + "non_discharge_tokens": [ + "GREEN_CI", + "HASH_MATCH", + "ARCHITECTURAL_ADMISSION", + "NUMERICAL_EXPERIMENT", + "SAME_AUTHOR_REVIEW", + "NAVIGATION_SUCCESS", + "AUTHOR_SELF_CHECK" + ], + "nodes": { + "hist.rnu_env.py": { + "layer": "D0", + "kind": "carrier", + "classification": "BLOCKED_ABSENT", + "controlling": false, + "fingerprint": "ABSENT", + "notes": "Historical D3 carrier; no successor claims byte identity" + }, + "hist.CL_ANTHROPIC_BUNDLE_2026-09-17_v5.zip": { + "layer": "D0", + "kind": "carrier", + "classification": "BLOCKED_ABSENT", + "controlling": false, + "fingerprint": "ABSENT", + "notes": "Historical archive absent" + }, + "hist.allcell_fdz_enclosures.json": { + "layer": "D0", + "kind": "carrier", + "classification": "BLOCKED_ABSENT", + "controlling": false, + "fingerprint": "ABSENT", + "notes": "Historical cell carrier absent" + }, + "hist.ENV-RESCOV": { + "layer": "D0", + "kind": "predicate", + "classification": "OPEN_HISTORICAL", + "controlling": false, + "fingerprint": "status-rn-unif-ordered-wall-1", + "notes": "OPEN for historical D3; qualitatively rederived on newer routes where proved" + }, + "hist.ALLCELL-FDZ-Q4": { + "layer": "D0", + "kind": "predicate", + "classification": "OPEN_HISTORICAL", + "controlling": false, + "fingerprint": "status-rn-unif-ordered-wall-2", + "notes": "Not a dependency of the fixed-remote theorem" + }, + "hist.LOGQ-TAIL": { + "layer": "D0", + "kind": "predicate", + "classification": "OPEN_HISTORICAL", + "controlling": false, + "fingerprint": "status-rn-unif-ordered-wall-3", + "notes": "Replaced only inside named successors" + }, + "hist.SYM-Fw-jet": { + "layer": "D0", + "kind": "predicate", + "classification": "OPEN_HISTORICAL", + "controlling": false, + "fingerprint": "status-rn-unif-ordered-wall-4", + "notes": "Analogous interface rederived; no historical certificate identity" + }, + "hist.CH-LIFT": { + "layer": "D0", + "kind": "predicate", + "classification": "OPEN_ACTIVE", + "controlling": false, + "fingerprint": "status-rn-unif-ch-lift", + "notes": "Still mathematically relevant for shrinking charts" + }, + "hist.Piece-2-annulus": { + "layer": "D0", + "kind": "predicate", + "classification": "OPEN_ACTIVE", + "controlling": false, + "fingerprint": "status-rn-unif-piece-2", + "notes": "Active mathematical blocker for shrinking/pin-collision regions" + }, + "hist.OBL-H5-JETMOD": { + "layer": "D0", + "kind": "predicate", + "classification": "OPEN_HISTORICAL", + "controlling": false, + "fingerprint": "status-rn-unif-jetmod", + "notes": "No 2026-09-24 proof claims certified 24-jet enclosure" + }, + "hist.lemma_closed": { + "layer": "D0", + "kind": "register", + "classification": "FALSE", + "controlling": false, + "fingerprint": "lemma_closed=false", + "notes": "Scientific effect NONE; this gate never flips the register" + }, + "math.uniform-matrix-cap-lifetime": { + "layer": "D1", + "kind": "candidate", + "author_provider": "OpenAI", + "classification": "PROVED_REVIEWED", + "controlling": false, + "review_issue": 63, + "fingerprint": "9350ad6eaba6626b93c3dedeef9e2ff816e5cdf1c8318e85fb27499141c84bc7", + "source": "imports/lifetime_parent_20260925/UNIFORM_MATRIX_CAP_AND_LIFETIME.md", + "notes": "Parent Gaussian selection / Kac-Rice / elder chain. Theorems A, B, C accepted at existential scope, read with the four required reading-rule component nodes (congruence erratum, section 9 replacement v1.1, cap sections 1-5, reconciliation record with W1 and the embedding radius).", + "review_source": "reviews/d1_chain_reconciliation_20260928/RECONCILIATION.md", + "review_disposition": "ACCEPT_AT_EXISTENTIAL_SCOPE", + "review_providers": [ + "xAI/Grok via Cursor (D1-A-E, section 9 v1.1, partial slices)", + "Anthropic/Claude (A1-A7, cap, section 9 v1.1, sections 11-12)" + ], + "scope": "fixed d>=2 and L; compact births and positive gap marks for Theorems A and B, with B and K of positive length for Theorem B (singleton intervals give zero mark-window intensity); embedding radius r < L/(4 sqrt 2); all frames; Theorem C leading term only; no numerical C, r_*, z_* or coefficient; no d>=3 lower bound; no RN/24-jet", + "reading_rule": [ + "math.d1-component.congruence-erratum", + "math.d1-component.section9-replacement-v1_1", + "math.d1-component.marked-cylinder-cap", + "math.d1-component.reconciliation-record" + ] + }, + "math.d1-component.congruence-erratum": { + "layer": "D1", + "kind": "reading_rule_component", + "classification": "PROVED_REVIEWED", + "controlling": false, + "component_of": "math.uniform-matrix-cap-lifetime", + "component_role": "amendment", + "author_provider": "OpenAI", + "fingerprint": "bad7ef609c4ad8c41ad6af562c1b6807921e19a9d556ed793ad1a0db6e202028", + "source": "imports/lifetime_parent_20260925/ERRATUM_CONGRUENCE.md", + "ledger_items": [ + "A3-E1" + ], + "review_basis": [ + { + "review": "C1", + "provider": "Anthropic", + "verdict": "ACCEPT", + "depth": "full" + }, + { + "review": "G3", + "provider": "xAI", + "verdict": "ACCEPT", + "depth": "full" + } + ], + "review_source": "reviews/d1_chain_reconciliation_20260928/LEDGER.json", + "scope": "congruence factor D_r = diag(r^-1/2, I) in parent section 5; replaces the displayed factor" + }, + "math.d1-component.section9-replacement-v1_1": { + "layer": "D1", + "kind": "reading_rule_component", + "classification": "PROVED_REVIEWED", + "controlling": false, + "component_of": "math.uniform-matrix-cap-lifetime", + "component_role": "amendment", + "author_provider": "OpenAI", + "fingerprint": "845abf9f9c99d672c2a10a887b5a2e7206a3d2de3d876f35f75ff6e2dc13e62f", + "source": "reviews/d1_section9_borel_repair_20260925/REPAIR.md", + "ledger_items": [ + "D1-B-E2" + ], + "review_basis": [ + { + "review": "C1", + "provider": "Anthropic", + "verdict": "ACCEPT", + "depth": "full" + }, + { + "review": "G2", + "provider": "xAI", + "verdict": "ACCEPT", + "depth": "full" + } + ], + "review_source": "reviews/d1_chain_reconciliation_20260928/LEDGER.json", + "scope": "replaces parent section 9 (Borel elder mark in weighted pair Kac-Rice), C1-C6" + }, + "math.d1-component.marked-cylinder-cap": { + "layer": "D1", + "kind": "reading_rule_component", + "classification": "PROVED_REVIEWED", + "controlling": false, + "component_of": "math.uniform-matrix-cap-lifetime", + "component_role": "deterministic_support", + "author_provider": "OpenAI", + "fingerprint": "0bf922b9203c29088b12388807aa0e2ecd020485eb0f6e919679841b5b2636fc", + "source": "imports/lifetime_parent_20260925/MARKED_CYLINDER_CAP_PROOF.md", + "ledger_items": [ + "CAP" + ], + "review_basis": [ + { + "review": "C1", + "provider": "Anthropic", + "verdict": "ACCEPT", + "depth": "full" + }, + { + "review": "G3", + "provider": "xAI", + "verdict": "ACCEPT", + "depth": "full" + } + ], + "review_source": "reviews/d1_chain_reconciliation_20260928/LEDGER.json", + "scope": "deterministic separating cap, sections 1-5 (lines 1-168) only; sections 6-8 are not consumed" + }, + "math.d1-component.reconciliation-record": { + "layer": "D1", + "kind": "reading_rule_component", + "classification": "PROVED_REVIEWED", + "controlling": false, + "component_of": "math.uniform-matrix-cap-lifetime", + "component_role": "reading_rule_record", + "author_provider": "Anthropic", + "source": "reviews/d1_chain_reconciliation_20260928/", + "ledger_items": [ + "S11", + "S12", + "R-W1", + "R-embedding-radius" + ], + "review_basis": [ + { + "review": "C2", + "provider": "Anthropic", + "verdict": "ACCEPT", + "depth": "full", + "item": "S11, S12 (record section 6)" + }, + { + "item": "R-W1", + "raised_in": "C1", + "raised_by_provider": "Anthropic", + "discharged_in": "RECONCILIATION.md section 5" + }, + { + "item": "R-embedding-radius", + "raised_in": "G3", + "raised_by_provider": "xAI", + "discharged_in": "RECONCILIATION.md section 5" + } + ], + "technical_checks_non_discharge": [ + { + "review": "https://github.com/d6g8k5htny-coder/Math-/pull/126#pullrequestreview-5345687857", + "provider": "OpenAI", + "role": "author provider of the parent; A4, section 12 and register binding; never discharge" + } + ], + "review_source": "reviews/d1_chain_reconciliation_20260928/LEDGER.json", + "scope": "nonauthor record binding the reading rule (E1, E2, W1, r < L/(4 sqrt 2)) and the interface-to-review ledger; the whole directory is bound" + }, + "math.lifetime-remainder": { + "layer": "D2", + "kind": "candidate", + "classification": "AUTHOR_SIDE_CANDIDATE", + "controlling": false, + "review_issue": 67, + "fingerprint": "380b7d0abdb0fe2de5a6564565af9560d3f1b1ce22fd5538927db0c52f4f3a4a", + "source": "frontiers/three_fronts_20260924/LIFETIME_REMAINDER.md", + "notes": "Imports named #63 interfaces (D1-A-E); not parent collapse; does not consume Theorem A (1.1)", + "review_disposition": "ACCEPT", + "review_provider": "xAI/Grok via Cursor", + "review_source": "https://github.com/d6g8k5htny-coder/main/issues/67#issuecomment-5841782206", + "scope": "Theorem R at its stated existential O(1)-remainder scope; no numerical constants or radii" + }, + "math.side24-coefficient": { + "layer": "D3", + "kind": "candidate", + "classification": "AUTHOR_SIDE_CANDIDATE", + "controlling": false, + "review_issue": 65, + "fingerprint": "c06daccc4ba4b9168522b9888b76a7d599934fc3b91bd753ee5d492262917769", + "source": "coefficients/side24_v1/PROOF.md", + "notes": "Evaluates parent Eq15.2; parent reconciled in reviews/d1_chain_reconciliation_20260928/RECONCILIATION.md", + "review_disposition": "ACCEPT", + "review_provider": "xAI/Grok via Cursor", + "review_source": "https://github.com/d6g8k5htny-coder/main/issues/65#issuecomment-5841269490", + "scope": "coefficient calculation for SIDE24 d=2,3; persistence reading via reconciled parent Theorem C; no finite-radius band" + }, + "math.rn-count-interface": { + "layer": "D4", + "kind": "candidate", + "classification": "AUTHOR_SIDE_CANDIDATE", + "controlling": false, + "review_issue": 67, + "fingerprint": "aa993f5217bd70e6d1060402d121ab659f6582a098e29042c67585a345a8e3ab", + "source": "frontiers/three_fronts_20260924/RN_COUNT_INTERFACE.md", + "notes": "Probability-to-count interface; not an expected-count rate" + }, + "math.rn-fixed-remote-window": { + "layer": "D4", + "kind": "candidate", + "classification": "AUTHOR_SIDE_CANDIDATE", + "controlling": false, + "review_issue": 76, + "fingerprint": "a332bae9bdc0106ce17047f7e0409cc3d94eb610a0c7b74ba5ba2d01a1620cb7", + "source": "frontiers/remote_window_20260924/PROOF.md", + "notes": "Cubic mean on fixed spatial exclusion and between-pin height window" + }, + "math.rn-region.fixed-remote": { + "layer": "D4", + "kind": "region", + "classification": "COVERED_BY_CANDIDATE", + "controlling": false, + "fingerprint": "dist>=rho and between-pin height", + "notes": "Covered by rn-fixed-remote-window candidate only", + "coverage_source": "math.rn-fixed-remote-window" + }, + "math.rn-region.mesoscopic-scaled-annulus": { + "layer": "D5", + "kind": "region", + "classification": "PROVED_REVIEWED", + "controlling": false, + "fingerprint": "x=r y with A<=|y|<=B away from pins", + "notes": "Reviewed only at D5-d with R >= B (covers the reviewed fixed annulus); see the complete D5 reconciliation reading rule. No d>2, numerical, elder-selection, JETMOD, or witness-collision closure.", + "scope": "D5-d with R >= B (covers the reviewed fixed annulus)", + "review_source": "reviews/d5_reconciliation_20260929/RECONCILIATION.md", + "review_disposition": "ACCEPT_AT_STATED_SCOPE", + "reading_rule": [ + "math.d5-component.punctured-pin-proof", + "math.d5-component.punctured-pin-review-111", + "math.d5-component.punctured-pin-continuum-review", + "math.d5-component.punctured-pin-continuum-check", + "math.d5-component.collar-proof", + "math.d5-component.collar-review", + "math.d5-component.annulus-proof", + "math.d5-component.annulus-review" + ] + }, + "math.rn-region.pin-collision": { + "layer": "D5", + "kind": "region", + "classification": "PROVED_REVIEWED", + "controlling": false, + "fingerprint": "near +-e1/2 scaled pin sites", + "notes": "Reviewed only at D5-a, D5-b, D5-d; see the complete D5 reconciliation reading rule. No d>2, numerical, elder-selection, JETMOD, or witness-collision closure.", + "scope": "D5-a, D5-b, D5-d", + "review_source": "reviews/d5_reconciliation_20260929/RECONCILIATION.md", + "review_disposition": "ACCEPT_AT_STATED_SCOPE", + "reading_rule": [ + "math.d5-component.punctured-pin-proof", + "math.d5-component.punctured-pin-review-111", + "math.d5-component.punctured-pin-continuum-review", + "math.d5-component.punctured-pin-continuum-check", + "math.d5-component.collar-proof", + "math.d5-component.collar-review" + ] + }, + "math.rn-region.intermediate-r-to-rho": { + "layer": "D5", + "kind": "region", + "classification": "PROVED_REVIEWED", + "controlling": false, + "fingerprint": "r<<|x|<2, numerical, elder-selection, JETMOD, or witness-collision closure.", + "scope": "D5-e (I3/I4, window I_r)", + "review_source": "reviews/d5_reconciliation_20260929/RECONCILIATION.md", + "review_disposition": "ACCEPT_AT_STATED_SCOPE", + "reading_rule": [ + "math.d5-component.intermediate-window-proof", + "math.d5-component.i5-review-xai", + "math.d5-component.i5-review-claude" + ] + }, + "math.rn-region.witness-collision": { + "layer": "D5", + "kind": "region", + "classification": "OPEN_ACTIVE", + "controlling": false, + "fingerprint": "eta->0 mutual witness separation", + "notes": "Off-pin fixed-separation second-moment evidence is reviewed and sharp global order is reviewed and merged through Math-#145, but the regional shrinking pin/witness-collision mechanism and its source-bound graph fold remain open.", + "scope": "catalog C6", + "review_source": "reviews/d5_reconciliation_20260929/RECONCILIATION.md", + "review_disposition": "OPEN", + "reading_rule": [ + "math.d5-component.offpin-second-moment-review" + ] + }, + "math.rn-mesoscopic-reduction": { + "layer": "D5", + "kind": "candidate", + "classification": "AUTHOR_SIDE_REDUCTION", + "controlling": false, + "fingerprint": "Math-PR7-draft", + "source": "external:Math-PR7", + "notes": "Legacy author-side PR7 route. Regionally superseded/nonblocking for the reviewed fixed-annulus between-pin height-window subregion; still unresolved for scopes outside that theorem." + }, + "math.p15-full-price": { + "layer": "D6", + "kind": "candidate", + "classification": "AUTHOR_SIDE_CANDIDATE", + "controlling": false, + "review_issue": 74, + "fingerprint": "full-price-20260924", + "source": "frontiers/full_price_20260924/PROOF.md", + "notes": "Full probability cube under demand>=2; review open. Price-boundary refutation is a scope boundary, not a required premise." + }, + "math.p15-price-boundary": { + "layer": "D6", + "kind": "candidate", + "classification": "REFUTED", + "controlling": false, + "fingerprint": "498af650ef7139c39d2630561dbfd0822c495ce6308a6cac8b767aefe0c2a40b", + "source": "frontiers/three_fronts_20260924/P15_PRICE_BOUNDARY.md", + "notes": "Unrestricted same-palette transformed-price extension is false" + }, + "eng.hard-gate": { + "layer": "D7", + "kind": "integrity_control", + "classification": "ENGINEERING_CONTROL", + "controlling": false, + "fingerprint": "downstream-hard-gate-20260925-v1", + "source": "frontiers/downstream_gate_20260925/", + "notes": "This package; never mathematical discharge" + }, + "eng.main-pr87-crosswalk": { + "layer": "D0", + "kind": "engineering", + "classification": "HOLD", + "controlling": false, + "fingerprint": "main-PR87-3d4969ab-ci-unexpected-file", + "source": "https://github.com/d6g8k5htny-coder/main/pull/87", + "notes": "Human D0 crosswalk exists; math_status_check rejects unlisted file until allowlist patch lands" + }, + "eng.d0-packet-allowlist-fix": { + "layer": "D7", + "kind": "engineering", + "classification": "AUTHOR_SIDE_CANDIDATE", + "controlling": false, + "fingerprint": "84b7ad724e4da1c5b4b396c90ae03d4ddedc37771a6e45e1082a45fd80d7ff4a", + "source": "frontiers/downstream_gate_20260925/patches/d0_packet_allowlist.patch", + "notes": "Portable fix verified locally; Cursor cannot push to main (403); awaiting agent/owner with write" + }, + "math.rn-selector-region-crosswalk": { + "layer": "D4", + "kind": "inventory", + "classification": "ENGINEERING_CONTROL", + "controlling": false, + "fingerprint": "rn-selector-region-crosswalk-20260925-v1", + "source": "frontiers/downstream_gate_20260925/SELECTOR_REGION.json", + "notes": "Maps historical selectors onto fixed-remote vs open complements" + }, + "math.rn-fixed-annulus-window": { + "layer": "D5", + "kind": "candidate", + "classification": "AUTHOR_SIDE_CANDIDATE", + "controlling": false, + "fingerprint": "081abc13c5e66342c13df2af2bd6b114f320486f", + "source": "frontiers/rn_thin_tube_20260925/FIXED_ANNULUS_CANDIDATE.md", + "review_source": "reviews/pr22_fixed_annulus_nonauthor_20260925/REVIEW.md", + "scope": "d=2; fixed L; fixed scaled annulus 10; all frames; between-pin height window", + "notes": "Source-bound xAI/Grok technical ACCEPT at exact scoped theorem only. No global D5/RN/JETMOD, k->0, d>=3, pin-neighborhood, intermediate-scale, collision, or elder-selection closure.", + "review_disposition": "ACCEPT", + "review_provider": "xAI/Grok via Cursor", + "scientific_status_unchanged": true + }, + "math.rn-region.fixed-annulus-window": { + "layer": "D5", + "kind": "region", + "classification": "COVERED_BY_CANDIDATE", + "controlling": false, + "fingerprint": "fixed-d2-annulus-between-pin-window-reviewed", + "notes": "Covered by math.rn-fixed-annulus-window only at its exact declared scope.", + "review_disposition": "ACCEPT_AT_SCOPED_SOURCE", + "coverage_source": "math.rn-fixed-annulus-window" + }, + "regional.fixed-annulus.high-jet-route": { + "layer": "D0", + "kind": "regional_supersession", + "classification": "SUPERSEDED_NONBLOCKING", + "controlling": false, + "fingerprint": "regional-bypass-fixed-annulus-window-v1", + "scope": "fixed d=2 scaled annulus; compact positive gaps; between-pin height window", + "notes": "For this scope only, the reviewed analytic route bypasses CH-LIFT / Piece-2 / OBL-H5-JETMOD. Historical predicates remain OPEN/ABSENT in their original replay scopes." + }, + "math.d5-pin-neighborhood-first-moment": { + "layer": "D5", + "kind": "candidate", + "classification": "PROVED_REVIEWED", + "controlling": false, + "scope": "D5-a..D5-f of RECONCILIATION.md section 2; existential constants; fixed T; compact marks with k >= k_- > 0; d = 2", + "source": "reviews/d5_reconciliation_20260929/RECONCILIATION.md" + }, + "math.d5-component.punctured-pin-proof": { + "layer": "D5", + "kind": "reading_rule_component", + "classification": "PROVED_REVIEWED", + "controlling": false, + "component_of": "math.d5-pin-neighborhood-first-moment", + "component_role": "proof", + "author_provider": "OpenAI", + "fingerprint": "f972e50bc07674ebce9d971d1a1bd4dba2f8036dde37ecb57d8a44a35650f76a", + "source": "reviews/d5_local_collar_20260928/PUNCTURED_PIN_PROOF.md", + "review_basis": [ + { + "review": "#111", + "provider": "xAI", + "verdict": "ACCEPT algebra; continuum HOLD", + "depth": "algebraic" + }, + { + "review": "d5_punctured_pin_continuum_claude_20260929", + "provider": "Anthropic", + "verdict": "ACCEPT existential", + "depth": "full" + } + ] + }, + "math.d5-component.punctured-pin-review-111": { + "layer": "D5", + "kind": "reading_rule_component", + "classification": "PROVED_REVIEWED", + "controlling": false, + "component_of": "math.d5-pin-neighborhood-first-moment", + "component_role": "review_record", + "author_provider": "xAI", + "fingerprint": "668d74825f156c929177bc1a3481cf421de4dd7874e7b25b2aece6c10aa7dc0e", + "source": "reviews/d5_punctured_pin_nonauthor_20260928/REVIEW.md" + }, + "math.d5-component.punctured-pin-continuum-review": { + "layer": "D5", + "kind": "reading_rule_component", + "classification": "PROVED_REVIEWED", + "controlling": false, + "component_of": "math.d5-pin-neighborhood-first-moment", + "component_role": "review_record", + "author_provider": "Anthropic", + "fingerprint": "124c472cc064ba24021cb4bb8da1002836a4ce26c8df506228f5c20609f6575a", + "source": "reviews/d5_punctured_pin_continuum_claude_20260929/REVIEW.md" + }, + "math.d5-component.punctured-pin-continuum-check": { + "layer": "D5", + "kind": "reading_rule_component", + "classification": "PROVED_REVIEWED", + "controlling": false, + "component_of": "math.d5-pin-neighborhood-first-moment", + "component_role": "review_checker", + "author_provider": "Anthropic", + "fingerprint": "57bc87d11271b47ebccec6ea73abf823fa90e3a8c3c7d7cd2165bdc6f7e4175c", + "source": "reviews/d5_punctured_pin_continuum_claude_20260929/pp_continuum_check.py" + }, + "math.d5-component.collar-proof": { + "layer": "D5", + "kind": "reading_rule_component", + "classification": "PROVED_REVIEWED", + "controlling": false, + "component_of": "math.d5-pin-neighborhood-first-moment", + "component_role": "proof", + "author_provider": "OpenAI", + "fingerprint": "794babe0fd039c3a93c401c0b8978316331af009fad45f953e63fbe7e1e31aab", + "source": "reviews/d5_local_collar_20260928/COLLAR_PROOF.md", + "review_basis": [ + { + "review": "d5_collar_count_20260928", + "provider": "not named in record", + "verdict": "ACCEPT existential", + "depth": "full" + }, + { + "review": "Math-#105 comment 5872932723 (external)", + "provider": "Anthropic", + "verdict": "CONFIRMED", + "depth": "full" + } + ] + }, + "math.d5-component.collar-review": { + "layer": "D5", + "kind": "reading_rule_component", + "classification": "PROVED_REVIEWED", + "controlling": false, + "component_of": "math.d5-pin-neighborhood-first-moment", + "component_role": "review_record", + "author_provider": "not named in record", + "fingerprint": "8c8c30cc3b19601a7421341d5da8cb6c982fbc1fcc5ae4791acafa11cc81ee4e", + "source": "reviews/d5_collar_count_20260928/REVIEW.md" + }, + "math.d5-component.annulus-proof": { + "layer": "D5", + "kind": "reading_rule_component", + "classification": "PROVED_REVIEWED", + "controlling": false, + "component_of": "math.d5-pin-neighborhood-first-moment", + "component_role": "proof", + "author_provider": "OpenAI", + "fingerprint": "d55e2c03bb17e7977ff94130cc1ff21e54840cd1e20dc4e41ea9ad52228beb05", + "source": "frontiers/rn_annulus_bridge_20260925/PROOF.md", + "review_basis": [ + { + "review": "pr28_annulus_bridge_nonauthor_20260925", + "provider": "xAI", + "verdict": "ACCEPT R1-R7", + "depth": "full" + } + ] + }, + "math.d5-component.annulus-review": { + "layer": "D5", + "kind": "reading_rule_component", + "classification": "PROVED_REVIEWED", + "controlling": false, + "component_of": "math.d5-pin-neighborhood-first-moment", + "component_role": "review_record", + "author_provider": "xAI", + "fingerprint": "69ea7a479a9e8a5150cbe07b373772ab22413a1d81194d5a6a78adf6ada5f03f", + "source": "reviews/pr28_annulus_bridge_nonauthor_20260925/REVIEW.md" + }, + "math.d5-component.intermediate-window-proof": { + "layer": "D5", + "kind": "reading_rule_component", + "classification": "PROVED_REVIEWED", + "controlling": false, + "component_of": "math.d5-pin-neighborhood-first-moment", + "component_role": "proof", + "author_provider": "OpenAI", + "fingerprint": "b3eb9456d7058b5b78149cfca4e072679beda85cd1a0293d209664a542db66cf", + "source": "frontiers/intermediate_window_20260928/PROOF.md", + "review_basis": [ + { + "review": "d5_i5_planar_f_20260928", + "provider": "xAI", + "verdict": "ACCEPT existential", + "depth": "full" + }, + { + "review": "d5_intermediate_window_claude_20260928", + "provider": "Anthropic", + "verdict": "ACCEPT", + "depth": "full" + } + ] + }, + "math.d5-component.i5-review-xai": { + "layer": "D5", + "kind": "reading_rule_component", + "classification": "PROVED_REVIEWED", + "controlling": false, + "component_of": "math.d5-pin-neighborhood-first-moment", + "component_role": "review_record", + "author_provider": "xAI", + "fingerprint": "527d66e72b079ef7c854987f7e9d44f2252b81aa0e8d9e7ef3b45deb02388659", + "source": "reviews/d5_i5_planar_f_20260928/REVIEW.md" + }, + "math.d5-component.i5-review-claude": { + "layer": "D5", + "kind": "reading_rule_component", + "classification": "PROVED_REVIEWED", + "controlling": false, + "component_of": "math.d5-pin-neighborhood-first-moment", + "component_role": "review_record", + "author_provider": "Anthropic", + "fingerprint": "fb3207802bf2d92ad138bc338a36f39bcd3a94440669b9aba9558e566f767976", + "source": "reviews/d5_intermediate_window_claude_20260928/REVIEW.md" + }, + "math.d5-component.remote-window-proof": { + "layer": "D5", + "kind": "reading_rule_component", + "classification": "PROVED_REVIEWED", + "controlling": false, + "component_of": "math.d5-pin-neighborhood-first-moment", + "component_role": "proof", + "author_provider": "OpenAI", + "fingerprint": "a332bae9bdc0106ce17047f7e0409cc3d94eb610a0c7b74ba5ba2d01a1620cb7", + "source": "frontiers/remote_window_20260924/PROOF.md", + "review_basis": [ + { + "review": "STATUS D4 (main#76, external)", + "provider": "nonauthor", + "verdict": "ACCEPT", + "depth": "full" + } + ] + }, + "math.d5-component.offpin-second-moment-review": { + "layer": "D5", + "kind": "reading_rule_component", + "classification": "PROVED_REVIEWED", + "controlling": false, + "component_of": "math.rn-region.witness-collision", + "component_role": "review_record", + "author_provider": "nonauthor", + "fingerprint": "43beb4ef7da5bf71e15164d5c4bc1862db387d83f906aebdf9831625b1ca6369", + "source": "reviews/d5_offpin_second_moment_20260928/REVIEW.md" + } + }, + "edges": [ + { + "from": "math.lifetime-remainder", + "to": "math.uniform-matrix-cap-lifetime", + "required": true, + "relation": "imports_named_interfaces" + }, + { + "from": "math.side24-coefficient", + "to": "math.uniform-matrix-cap-lifetime", + "required": true, + "relation": "evaluates_eq_15_2" + }, + { + "from": "math.uniform-matrix-cap-lifetime", + "to": "math.d1-component.congruence-erratum", + "required": true, + "relation": "reads_with_congruence_erratum" + }, + { + "from": "math.uniform-matrix-cap-lifetime", + "to": "math.d1-component.section9-replacement-v1_1", + "required": true, + "relation": "reads_section9_as_replaced_v1_1" + }, + { + "from": "math.uniform-matrix-cap-lifetime", + "to": "math.d1-component.marked-cylinder-cap", + "required": true, + "relation": "consumes_cap_sections_1_5" + }, + { + "from": "math.uniform-matrix-cap-lifetime", + "to": "math.d1-component.reconciliation-record", + "required": true, + "relation": "reads_with_reconciled_rule_W1_radius" + }, + { + "from": "math.rn-fixed-remote-window", + "to": "math.rn-count-interface", + "required": true, + "relation": "supplies_numerator_on_restricted_region" + }, + { + "from": "math.rn-fixed-remote-window", + "to": "math.rn-region.fixed-remote", + "required": false, + "relation": "covers_region" + }, + { + "from": "math.rn-mesoscopic-reduction", + "to": "math.rn-fixed-remote-window", + "required": true, + "relation": "successor_scale_after_fixed_remote" + }, + { + "from": "math.rn-mesoscopic-reduction", + "to": "math.rn-region.mesoscopic-scaled-annulus", + "required": false, + "relation": "targets_region" + }, + { + "from": "math.rn-mesoscopic-reduction", + "to": "hist.CH-LIFT", + "required": false, + "relation": "reopens_scaled_chart_problem" + }, + { + "from": "math.rn-mesoscopic-reduction", + "to": "hist.Piece-2-annulus", + "required": false, + "relation": "addresses_partial_piece" + }, + { + "from": "math.p15-full-price", + "to": "math.p15-price-boundary", + "required": false, + "relation": "boundary_counterexample_not_required_premise" + }, + { + "from": "hist.ENV-RESCOV", + "to": "hist.rnu_env.py", + "required": true, + "relation": "historical_certificate_carrier" + }, + { + "from": "hist.ALLCELL-FDZ-Q4", + "to": "hist.allcell_fdz_enclosures.json", + "required": true, + "relation": "historical_certificate_carrier" + }, + { + "from": "hist.SYM-Fw-jet", + "to": "hist.CL_ANTHROPIC_BUNDLE_2026-09-17_v5.zip", + "required": false, + "relation": "historical_bundle_identity" + }, + { + "from": "eng.main-pr87-crosswalk", + "to": "eng.d0-packet-allowlist-fix", + "required": true, + "relation": "ci_unblock_depends_on_allowlist_patch" + }, + { + "from": "math.rn-selector-region-crosswalk", + "to": "math.rn-fixed-remote-window", + "required": false, + "relation": "inventories_covered_region" + }, + { + "from": "math.rn-selector-region-crosswalk", + "to": "math.rn-count-interface", + "required": false, + "relation": "inherits_no_markov_reversal" + }, + { + "from": "math.rn-fixed-annulus-window", + "to": "math.rn-count-interface", + "required": true, + "relation": "supplies_expected_count_on_reviewed_scoped_region" + }, + { + "from": "math.rn-fixed-annulus-window", + "to": "math.rn-region.fixed-annulus-window", + "required": false, + "relation": "covers_reviewed_subregion" + }, + { + "from": "math.rn-fixed-annulus-window", + "to": "regional.fixed-annulus.high-jet-route", + "required": false, + "relation": "regionally_supersedes_historical_high_jet_route" + }, + { + "from": "regional.fixed-annulus.high-jet-route", + "to": "hist.CH-LIFT", + "required": false, + "relation": "regional_bypass_only" + }, + { + "from": "regional.fixed-annulus.high-jet-route", + "to": "hist.Piece-2-annulus", + "required": false, + "relation": "regional_bypass_only" + }, + { + "from": "regional.fixed-annulus.high-jet-route", + "to": "hist.OBL-H5-JETMOD", + "required": false, + "relation": "regional_bypass_only" + }, + { + "from": "math.d5-pin-neighborhood-first-moment", + "to": "math.d5-component.punctured-pin-proof", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.d5-pin-neighborhood-first-moment", + "to": "math.d5-component.punctured-pin-review-111", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.d5-pin-neighborhood-first-moment", + "to": "math.d5-component.punctured-pin-continuum-review", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.d5-pin-neighborhood-first-moment", + "to": "math.d5-component.punctured-pin-continuum-check", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.d5-pin-neighborhood-first-moment", + "to": "math.d5-component.collar-proof", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.d5-pin-neighborhood-first-moment", + "to": "math.d5-component.collar-review", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.d5-pin-neighborhood-first-moment", + "to": "math.d5-component.annulus-proof", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.d5-pin-neighborhood-first-moment", + "to": "math.d5-component.annulus-review", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.d5-pin-neighborhood-first-moment", + "to": "math.d5-component.intermediate-window-proof", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.d5-pin-neighborhood-first-moment", + "to": "math.d5-component.i5-review-xai", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.d5-pin-neighborhood-first-moment", + "to": "math.d5-component.i5-review-claude", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.d5-pin-neighborhood-first-moment", + "to": "math.d5-component.remote-window-proof", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.rn-region.pin-collision", + "to": "math.d5-component.punctured-pin-proof", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.rn-region.pin-collision", + "to": "math.d5-component.punctured-pin-review-111", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.rn-region.pin-collision", + "to": "math.d5-component.punctured-pin-continuum-review", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.rn-region.pin-collision", + "to": "math.d5-component.punctured-pin-continuum-check", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.rn-region.pin-collision", + "to": "math.d5-component.collar-proof", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.rn-region.pin-collision", + "to": "math.d5-component.collar-review", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.rn-region.mesoscopic-scaled-annulus", + "to": "math.d5-component.punctured-pin-proof", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.rn-region.mesoscopic-scaled-annulus", + "to": "math.d5-component.punctured-pin-review-111", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.rn-region.mesoscopic-scaled-annulus", + "to": "math.d5-component.punctured-pin-continuum-review", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.rn-region.mesoscopic-scaled-annulus", + "to": "math.d5-component.punctured-pin-continuum-check", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.rn-region.mesoscopic-scaled-annulus", + "to": "math.d5-component.collar-proof", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.rn-region.mesoscopic-scaled-annulus", + "to": "math.d5-component.collar-review", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.rn-region.mesoscopic-scaled-annulus", + "to": "math.d5-component.annulus-proof", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.rn-region.mesoscopic-scaled-annulus", + "to": "math.d5-component.annulus-review", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.rn-region.intermediate-r-to-rho", + "to": "math.d5-component.intermediate-window-proof", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.rn-region.intermediate-r-to-rho", + "to": "math.d5-component.i5-review-xai", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.rn-region.intermediate-r-to-rho", + "to": "math.d5-component.i5-review-claude", + "required": true, + "relation": "requires_evidence" + }, + { + "from": "math.rn-region.witness-collision", + "to": "math.d5-component.offpin-second-moment-review", + "required": true, + "relation": "requires_evidence" + } + ] +} diff --git a/reviews/register_execution_readiness_20260930/fixtures/witness_baseline/SELECTOR_REGION.json b/reviews/register_execution_readiness_20260930/fixtures/witness_baseline/SELECTOR_REGION.json new file mode 100644 index 000000000..ebffdb096 --- /dev/null +++ b/reviews/register_execution_readiness_20260930/fixtures/witness_baseline/SELECTOR_REGION.json @@ -0,0 +1,71 @@ +{ + "schema_version": 1, + "object": "RN-SELECTOR-REGION-CROSSWALK-20260925-v1", + "meaning": "D4 inventory: which historical selectors/walls a region still needs; not theorem acceptance", + "no_event_to_expectation_reversal": true, + "legacy_24jet_discharged": false, + "regions": [ + "fixed-remote", + "mesoscopic-scaled-annulus", + "pin-collision", + "intermediate-r-to-rho", + "witness-collision" + ], + "selectors": { + "ALLCELL-FDZ-Q4": { + "fixed-remote": "NOT_REQUIRED", + "mesoscopic-scaled-annulus": "NOT_REQUIRED", + "pin-collision": "OPEN_HISTORICAL", + "intermediate-r-to-rho": "OPEN_HISTORICAL", + "witness-collision": "OPEN_HISTORICAL", + "notes": "Fixed-remote analytic route does not consume the old cell carrier" + }, + "CH-LIFT": { + "fixed-remote": "BYPASSED_BY_FIXED_RHO", + "mesoscopic-scaled-annulus": "REOPENED", + "pin-collision": "OPEN_ACTIVE", + "intermediate-r-to-rho": "OPEN_ACTIVE", + "witness-collision": "NOT_APPLICABLE", + "notes": "Fixed rho avoids shrinking singularity; scaled charts reopen CH-LIFT" + }, + "Piece-2-annulus": { + "fixed-remote": "PARTIAL_COVER_ONLY", + "mesoscopic-scaled-annulus": "PARTIAL_PR7_REDUCTION", + "pin-collision": "OPEN_ACTIVE", + "intermediate-r-to-rho": "OPEN_ACTIVE", + "witness-collision": "OPEN_ACTIVE", + "notes": "Active mathematical blocker outside fixed-remote and unfinished PR7 ledger" + }, + "H5-REMOTE-THRESHOLD": { + "fixed-remote": "PARTIAL_COVER_DECLARED_REGION", + "mesoscopic-scaled-annulus": "OPEN_ACTIVE", + "pin-collision": "OPEN_ACTIVE", + "intermediate-r-to-rho": "OPEN_ACTIVE", + "witness-collision": "OPEN_ACTIVE", + "notes": "Cubic expected count only on declared height/spatial region" + }, + "OBL-H5-JETMOD": { + "fixed-remote": "NOT_DISCHARGED", + "mesoscopic-scaled-annulus": "NOT_DISCHARGED", + "pin-collision": "NOT_DISCHARGED", + "intermediate-r-to-rho": "NOT_DISCHARGED", + "witness-collision": "NOT_DISCHARGED", + "notes": "No 2026-09-24 proof claims certified 24-jet enclosure" + }, + "ENV-RESCOV": { + "fixed-remote": "REDERIVED_QUALITATIVELY", + "mesoscopic-scaled-annulus": "REDERIVED_QUALITATIVELY", + "pin-collision": "OPEN_HISTORICAL", + "intermediate-r-to-rho": "OPEN_HISTORICAL", + "witness-collision": "OPEN_HISTORICAL", + "notes": "Historical D3 still OPEN; newer routes use positive Fourier spectrum" + } + }, + "covered_region_ids": ["math.rn-region.fixed-remote"], + "open_region_ids": [ + "math.rn-region.mesoscopic-scaled-annulus", + "math.rn-region.pin-collision", + "math.rn-region.intermediate-r-to-rho", + "math.rn-region.witness-collision" + ] +} diff --git a/reviews/register_execution_readiness_20260930/fixtures/witness_baseline/SOURCE.json b/reviews/register_execution_readiness_20260930/fixtures/witness_baseline/SOURCE.json new file mode 100644 index 000000000..7364535a2 --- /dev/null +++ b/reviews/register_execution_readiness_20260930/fixtures/witness_baseline/SOURCE.json @@ -0,0 +1,21 @@ +{ + "schema": 1, + "purpose": "Immutable historical test inputs only; noncontrolling; not the live scientific register", + "scientific_effect": "NONE", + "repository": "https://github.com/d6g8k5htny-coder/Math-", + "commit": "d3a0b6ca759a38da44cd7e1a88c6b6ce54c32f86", + "files": { + "GRAPH.json": { + "source_path": "frontiers/downstream_gate_20260925/GRAPH.json", + "bytes": 38753, + "sha256": "8822e9618678321a342d69cd0b8ae6552de1b5d578c331de5072b2892ee9dd09", + "git_blob": "220b56867f24c5ef6f55a3cce70490e9777cf3af" + }, + "SELECTOR_REGION.json": { + "source_path": "frontiers/downstream_gate_20260925/SELECTOR_REGION.json", + "bytes": 2753, + "sha256": "53fa0ec88e417882eff2a40e4b575c639d43b7e8787e7fb8917aa22ace79390d", + "git_blob": "ebffdb0969c7d3484f8fd1f4352ea290346f0318" + } + } +} diff --git a/reviews/register_execution_readiness_20260930/test_execution_dryrun.py b/reviews/register_execution_readiness_20260930/test_execution_dryrun.py new file mode 100644 index 000000000..f7831e8a9 --- /dev/null +++ b/reviews/register_execution_readiness_20260930/test_execution_dryrun.py @@ -0,0 +1,234 @@ +"""Output-maintenance regressions: real files and bounded checker subprocesses.""" +import importlib.util +import json +import os +from pathlib import Path +import tempfile +import unittest +from unittest.mock import patch + +spec = importlib.util.spec_from_file_location("dryrun", Path(__file__).with_name("execution_dryrun.py")) +dryrun = importlib.util.module_from_spec(spec) +spec.loader.exec_module(dryrun) + + +class OutputMaintenanceTests(unittest.TestCase): + def setUp(self): + self.tmp = tempfile.TemporaryDirectory() + self.addCleanup(self.tmp.cleanup) + self.root = Path(self.tmp.name).resolve() / "repo" + self.out = Path(self.tmp.name).resolve() / "executed" + self.pins = [] + self.old = [] + self.payload = b'{"passed": true, "register_state": "installed"}\n' + for i, (folder, script) in enumerate(dryrun.PACKETS.values()): + pin = self.root / folder / "RESULTS_INSTALLED.json" + pin.parent.mkdir(parents=True) + data = ("old pin %d\n" % i).encode() + pin.write_bytes(data) + self.pins.append(pin) + self.old.append(data) + entry = self.out / folder / script + entry.parent.mkdir(parents=True) + entry.write_text('import sys\nMUTANTS = ("reject",)\n' + 'if "--mutant" in sys.argv: sys.exit(1)\n' + 'print(\'{"passed": true, "register_state": "installed"}\')\n') + + def run_write(self): + return dryrun.run_checkers(self.root, self.out, True, True) + + def assert_old(self): + self.assertEqual([p.read_bytes() for p in self.pins], self.old) + + def test_success_updates_all_outputs(self): + ok, report = self.run_write() + self.assertTrue(ok) + self.assertEqual([p.read_bytes() for p in self.pins], [self.payload] * 3) + self.assertTrue(all(v["written"] for v in report.values())) + + def test_late_checker_failure_preserves_every_pin(self): + folder, script = list(dryrun.PACKETS.values())[-1] + (self.out / folder / script).write_text('import sys\nMUTANTS = ("reject",)\nsys.exit(1)\n') + ok, report = self.run_write() + self.assertFalse(ok) + self.assert_old() + self.assertTrue(all(v["written"] is None for v in report.values())) + + def test_invalid_second_destination_does_not_write_first(self): + self.pins[1].unlink() + self.pins[1].mkdir() + try: + ok, _ = self.run_write() + except OSError: + ok = False + self.assertFalse(ok) + self.assertEqual(self.pins[0].read_bytes(), self.old[0]) + self.assertEqual(self.pins[2].read_bytes(), self.old[2]) + self.assertTrue(self.pins[1].is_dir()) + + def test_leaf_symlink_never_overwrites_external_target(self): + outside = Path(self.tmp.name) / "outside" + outside.write_bytes(b"outside sentinel\n") + self.pins[0].unlink() + self.pins[0].symlink_to(outside) + ok, _ = self.run_write() + self.assertFalse(ok) + self.assertEqual(outside.read_bytes(), b"outside sentinel\n") + self.assertEqual(self.pins[1].read_bytes(), self.old[1]) + self.assertTrue(self.pins[0].is_symlink()) + + def test_parent_symlink_never_overwrites_external_target(self): + parent = self.pins[0].parent + outside = Path(self.tmp.name) / "outside-directory" + parent.rename(outside) + parent.symlink_to(outside, target_is_directory=True) + ok, _ = self.run_write() + self.assertFalse(ok) + self.assertEqual((outside / self.pins[0].name).read_bytes(), self.old[0]) + self.assertEqual(self.pins[1].read_bytes(), self.old[1]) + + def test_hardlinked_old_pin_does_not_modify_other_name(self): + outside = Path(self.tmp.name) / "hardlinked-old-pin" + os.link(self.pins[0], outside) + ok, _ = self.run_write() + self.assertTrue(ok) + self.assertEqual(outside.read_bytes(), self.old[0]) + self.assertEqual(self.pins[0].read_bytes(), self.payload) + + def test_second_replacement_failure_restores_all_old_outputs(self): + real_replace = os.replace + failed = False + + def fail_once(source, destination, *args, **kwargs): + nonlocal failed + if Path(destination) == self.pins[1] and not failed: + failed = True + raise OSError("injected second-destination failure") + return real_replace(source, destination, *args, **kwargs) + + with patch.object(os, "replace", side_effect=fail_once): + ok, _ = self.run_write() + self.assertFalse(ok) + self.assert_old() + + def test_missing_pins_can_be_created_after_validation(self): + for pin in self.pins: + pin.unlink() + ok, _ = self.run_write() + self.assertTrue(ok) + self.assertEqual([p.read_bytes() for p in self.pins], [self.payload] * 3) + + def test_staging_failure_preserves_all_outputs(self): + real_mkstemp = tempfile.mkstemp + calls = 0 + + def fail_third(*args, **kwargs): + nonlocal calls + calls += 1 + if calls == 3: + raise OSError("injected staging failure") + return real_mkstemp(*args, **kwargs) + + with patch.object(tempfile, "mkstemp", side_effect=fail_third): + ok, _ = self.run_write() + self.assertFalse(ok) + self.assert_old() + self.assertEqual(list(self.root.rglob(".installed-result-*")), []) + + def test_rollback_failure_is_explicit_and_retains_recovery_bytes(self): + real_replace = os.replace + calls = 0 + + def fail_install_and_rollback(source, destination): + nonlocal calls + calls += 1 + if calls in (2, 3): + raise OSError("injected install/rollback failure") + return real_replace(source, destination) + + with patch.object(os, "replace", side_effect=fail_install_and_rollback): + ok, report = self.run_write() + self.assertFalse(ok) + self.assertTrue(all("rollback incomplete" in v["write_error"] for v in report.values())) + backups = list(self.root.rglob(".installed-result-*")) + self.assertEqual(len(backups), 1) + self.assertEqual(backups[0].read_bytes(), self.old[0]) + self.assertEqual(self.pins[0].read_bytes(), self.payload) + self.assertEqual(self.pins[1].read_bytes(), self.old[1]) + + def test_failure_removes_new_pin_when_original_was_absent(self): + for pin in self.pins: + pin.unlink() + real_replace = os.replace + + def fail_second(source, destination): + if Path(destination) == self.pins[1]: + raise OSError("injected second install failure") + return real_replace(source, destination) + + with patch.object(os, "replace", side_effect=fail_second): + ok, _ = self.run_write() + self.assertFalse(ok) + self.assertTrue(all(not pin.exists() for pin in self.pins)) + + def test_existing_file_permissions_are_preserved(self): + self.pins[0].chmod(0o640) + ok, _ = self.run_write() + self.assertTrue(ok) + self.assertEqual(self.pins[0].stat().st_mode & 0o777, 0o640) + + def test_cleanup_failure_keeps_rollback_recovery_path_in_report(self): + real_replace, real_unlink = os.replace, Path.unlink + calls = 0 + + def fail_install_and_rollback(source, destination): + nonlocal calls + calls += 1 + if calls in (2, 3): + raise OSError("injected install/rollback failure") + return real_replace(source, destination) + + def fail_cleanup(path, *args, **kwargs): + if path.name.startswith(".installed-result-"): + raise OSError("injected cleanup failure") + return real_unlink(path, *args, **kwargs) + + with patch.object(os, "replace", side_effect=fail_install_and_rollback), \ + patch.object(Path, "unlink", fail_cleanup): + ok, report = self.run_write() + self.assertFalse(ok) + error = next(iter(report.values()))["write_error"] + self.assertIn("rollback incomplete", error) + backups = [p for p in self.root.rglob(".installed-result-*") if p.read_bytes() == self.old[0]] + self.assertEqual(len(backups), 1) + self.assertIn(str(backups[0]), error) + + def test_cleanup_stat_failure_cannot_hide_recovery_location(self): + real_replace, real_exists = os.replace, Path.exists + calls = 0 + + def fail_install_and_rollback(source, destination): + nonlocal calls + calls += 1 + if calls in (2, 3): + raise OSError("injected install/rollback failure") + return real_replace(source, destination) + + def fail_cleanup_stat(path): + if calls >= 3 and path.name.startswith(".installed-result-"): + raise PermissionError("injected cleanup stat failure") + return real_exists(path) + + with patch.object(os, "replace", side_effect=fail_install_and_rollback), \ + patch.object(Path, "exists", fail_cleanup_stat): + ok, report = self.run_write() + self.assertFalse(ok) + error = next(iter(report.values()))["write_error"] + self.assertIn("rollback incomplete", error) + backups = [p for p in self.root.rglob(".installed-result-*") if p.read_bytes() == self.old[0]] + self.assertEqual(len(backups), 1) + self.assertIn(str(backups[0]), error) + + +if __name__ == "__main__": + unittest.main() diff --git a/reviews/register_execution_readiness_20260930/test_witness_states.py b/reviews/register_execution_readiness_20260930/test_witness_states.py new file mode 100644 index 000000000..7417f34b8 --- /dev/null +++ b/reviews/register_execution_readiness_20260930/test_witness_states.py @@ -0,0 +1,200 @@ +"""Bounded witness-state regressions; fixtures never modify the live register.""" +import copy +import hashlib +import importlib.util +import json +from pathlib import Path +import shutil +import subprocess +import sys +import tempfile +import unittest + + +ROOT = Path(__file__).resolve().parents[2] +PACKET = ROOT / "reviews/c6_witness_collision_reconciliation_20260929" +ENTRY = PACKET / "reconciliation_check.py" +SPEC = importlib.util.spec_from_file_location("witness_checker", ENTRY) +witness = importlib.util.module_from_spec(SPEC) +SPEC.loader.exec_module(witness) +PROPOSAL = json.loads((PACKET / "PROPOSED_TRANSITIONS.json").read_text()) +BASELINE = Path(__file__).with_name("fixtures") / "witness_baseline" +BASELINE_SOURCES = json.loads((BASELINE / "SOURCE.json").read_text()) +HISTORICAL_EDGE = { + "from": "math.rn-region.witness-collision", + "to": "math.d5-component.offpin-second-moment-review", + "required": True, + "relation": "requires_evidence", +} + + +def edge_fields(edge): + return {key: edge[key] for key in ("from", "to", "required", "relation")} + + +def baseline_bytes(name): + """Historical test inputs stay independent of the live register's execution state.""" + data = (BASELINE / name).read_bytes() + identity = BASELINE_SOURCES["files"][name] + if len(data) != identity["bytes"] or hashlib.sha256(data).hexdigest() != identity["sha256"]: + raise ValueError("historical witness fixture identity mismatch: " + name) + return data + + +def graph_fixture(stage): + """Compose normative JSON directly, without the checker's state/build helpers.""" + graph = json.loads(baseline_bytes("GRAPH.json")) + if stage != "baseline": + for node in PROPOSAL["proposed_graph_nodes"]: + graph["nodes"][node["id"]] = {k: copy.deepcopy(v) for k, v in node.items() if k != "id"} + graph["edges"] += [edge_fields(e) for e in PROPOSAL["proposed_graph_edges"] + if stage == "reviewed" or e["from"] != witness.WITNESS] + if stage == "reviewed": + graph["nodes"][witness.WITNESS]["classification"] = "PROVED_REVIEWED" + return graph + + +def state(graph): + return witness.installed_state(graph, PROPOSAL["proposed_graph_nodes"], + PROPOSAL["proposed_graph_edges"])["state"] + + +class WitnessStates(unittest.TestCase): + def test_baseline_and_both_documented_installed_states(self): + for stage, expected in (("baseline", "baseline"), ("open", "installed"), ("reviewed", "installed")): + with self.subTest(stage=stage): + self.assertEqual(state(graph_fixture(stage)), expected) + + def test_historical_offpin_edge_is_preserved(self): + for stage in ("baseline", "open", "reviewed"): + with self.subTest(stage=stage): + graph = graph_fixture(stage) + self.assertIn(HISTORICAL_EDGE, graph["edges"]) + self.assertEqual(state(graph), "baseline" if stage == "baseline" else "installed") + + def test_old_witness_must_remain_literal_noncontrolling(self): + for stage in ("baseline", "open", "reviewed"): + for value in (True, 0, None): + with self.subTest(stage=stage, value=value): + graph = graph_fixture(stage) + graph["nodes"][witness.WITNESS]["controlling"] = value + self.assertEqual(state(graph), "partial") + + def test_component_boolean_cannot_be_integer_zero(self): + for node in PROPOSAL["proposed_graph_nodes"]: + if node.get("controlling") is False: + with self.subTest(node=node["id"]): + graph = graph_fixture("open") + graph["nodes"][node["id"]]["controlling"] = 0 + self.assertEqual(state(graph), "partial") + + def test_malformed_proposal_edge_is_not_absent_or_exact(self): + # Even an extra malformed parallel edge must not disappear in set intersection. + for proposed in PROPOSAL["proposed_graph_edges"]: + for field, value in (("required", not proposed["required"]), + ("required", int(proposed["required"])), + ("relation", "unrecognized_relation")): + wrong = edge_fields(proposed) + wrong[field] = value + if wrong == HISTORICAL_EDGE and type(wrong["required"]) is bool: + continue + for stage in ("open", "reviewed"): + with self.subTest(stage=stage, source=proposed["from"], target=proposed["to"], + field=field, value=value): + graph = graph_fixture(stage) + graph["edges"].append(wrong) + self.assertEqual(state(graph), "partial") + + def test_each_witness_edge_is_partial_while_open_or_missing_after_review(self): + for proposed in PROPOSAL["proposed_graph_edges"]: + if proposed["from"] != witness.WITNESS: + continue + with self.subTest(target=proposed["to"]): + edge = edge_fields(proposed) + graph = graph_fixture("open") + graph["edges"].append(edge) + self.assertEqual(state(graph), "partial") + graph = graph_fixture("reviewed") + graph["edges"].remove(edge) + self.assertEqual(state(graph), "partial") + + def test_selector_cannot_run_ahead_of_graph(self): + self.assertFalse(witness.selector_state_ok(True, "baseline")) + self.assertFalse(witness.selector_state_ok(True, "partial")) + self.assertTrue(witness.selector_state_ok(False, "baseline")) + self.assertTrue(witness.selector_state_ok(True, "installed")) + + +class WitnessCLI(unittest.TestCase): + def setUp(self): + self.tmp = tempfile.TemporaryDirectory() + self.addCleanup(self.tmp.cleanup) + self.root = Path(self.tmp.name) + needed = set(witness.INVENTORY) | { + witness.HERE + "/PROPOSED_TRANSITIONS.json", + witness.HERE + "/RECONCILIATION.md", witness.D5_TRANSITIONS, "PROOF_INDEX.md", witness.CATALOG, + } + for relative in needed: + target = self.root / relative + target.parent.mkdir(parents=True, exist_ok=True) + shutil.copyfile(ROOT / relative, target) + for relative, name in ((witness.GRAPH, "GRAPH.json"), (witness.SELECTOR, "SELECTOR_REGION.json")): + target = self.root / relative + target.parent.mkdir(parents=True, exist_ok=True) + target.write_bytes(baseline_bytes(name)) + + def run_graph(self, graph, installed_selector=True): + (self.root / witness.GRAPH).write_text(json.dumps(graph)) + selector = json.loads(baseline_bytes("SELECTOR_REGION.json")) + if installed_selector: + proposal = PROPOSAL["selector_region_proposal"] + for name, value in proposal["cells"].items(): + for region in proposal["regions"]: + selector["selectors"][name][region] = value + selector["covered_region_ids"] = proposal["resulting_covered_region_ids"] + selector["open_region_ids"] = proposal["resulting_open_region_ids"] + (self.root / witness.SELECTOR).write_text(json.dumps(selector)) + flags = ["-O"] if sys.flags.optimize else [] + run = subprocess.run([sys.executable, "-B", *flags, "-S", str(ENTRY)], cwd=self.root, + capture_output=True, timeout=60) + self.assertEqual(run.stderr, b"") + return run, json.loads(run.stdout) + + def test_accepted_states_keep_exact_pinned_outputs(self): + for stage, filename in (("baseline", "RESULTS.json"), ("open", "RESULTS_INSTALLED.json"), + ("reviewed", "RESULTS_INSTALLED.json")): + with self.subTest(stage=stage): + run, result = self.run_graph(graph_fixture(stage), stage != "baseline") + self.assertEqual(run.returncode, 0) + self.assertTrue(result["passed"]) + self.assertEqual(run.stdout, (PACKET / filename).read_bytes()) + + def test_wrong_required_edge_is_rejected_by_full_checker(self): + graph = graph_fixture("open") + graph["edges"].append({"from": witness.WITNESS, + "to": "math.c6-witness-collision-factorial-moment", + "required": False, "relation": "requires_evidence"}) + run, result = self.run_graph(graph) + self.assertEqual(run.returncode, 1) + self.assertFalse(result["checks"]["TRANSITIONS"]) + self.assertFalse(result["passed"]) + + def test_controlling_witness_is_rejected_by_full_checker(self): + graph = graph_fixture("reviewed") + graph["nodes"][witness.WITNESS]["controlling"] = True + run, result = self.run_graph(graph) + self.assertEqual(run.returncode, 1) + self.assertFalse(result["checks"]["OBLIGATION"]) + self.assertFalse(result["passed"]) + + def test_integer_controlling_component_is_rejected_by_full_checker(self): + graph = graph_fixture("open") + graph["nodes"]["math.c6-witness-collision-factorial-moment"]["controlling"] = 0 + run, result = self.run_graph(graph) + self.assertEqual(run.returncode, 1) + self.assertFalse(result["checks"]["TRANSITIONS"]) + self.assertFalse(result["passed"]) + + +if __name__ == "__main__": + unittest.main()