#!/usr/bin/env python3 """Open + walk + close the #2479 dichotomy-wave construction contract for drift_ledger. Full lifecycle in ONE process (shared-store clobber hazard, see notes-construction-intent-batch.md).""" import json import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src")) from rune.construction_interface import ConstructionInterface iface = ConstructionInterface(builder="factory-wave") r = iface.submit_need( "Complete the drift_ledger dichotomy port to FULL Rust (#2479 tranche): " "check/alert-loop, snapshot/anchor assembly, auto-fix routing and fix " "gate as doc-envelope FFI; dl_loader ctypes loader mirroring " "broker_loader.py (free via capability_scoring cs_free_string); facade " "delegation with RUNE_DL_CORE=python pin; frozen-oracle battery (87 " "cases, every public function/branch); live parity 100%; Phase B " "language-advantage pass; dichotomy-audit instrument fixes (curator " "alias + hyphen-twin mapping).", origin="builder", ) print("submit_need:", json.dumps(r)[:400]) if not r.get("success"): print("NEED FAILED — aborting"); sys.exit(1) cid = r["ids"]["contract_id"] print("contract_id:", cid) for phase in ("approved", "building", "verifying"): t = iface.transition(cid, phase) print(f"transition->{phase}:", json.dumps(t)[:300]) if not t.get("success"): sys.exit(1) c = iface.close(cid, observed_evidence=[{ "kind": "port_evidence", "detail": "drift_ledger dichotomy completion — parity c0ec3135 " "feat(drift_ledger): port remaining cores to FULL Rust — " "dichotomy wave; Phase B 62e47b38 refactor(drift_ledger): " "Phase B language-advantage pass — dichotomy wave (both pushed " "gitea/master). Battery 8 tests replay the 87-case frozen " "oracle truth VERBATIM; live parity 87/87 byte-identical " "(RUNE_DL_CORE=auto vs =python); clippy -D warnings clean; " "Python tests green (22 passed on drift-touching suites; 6 " "pre-existing unrelated failures on the clean tree). Audit: " "drift-ledger 14/14 FULL, drift_ledger 20/22 FULL, curator " "40/43 FULL after the instrument fixes.", }], scope_files=[ "src/rune/drift_ledger.py", "src/rune/dl_loader.py", "src/rust/drift_ledger/src/lib.rs", "src/rust/drift_ledger/src/branch_battery.rs", "scripts/gen_drift_ledger_truth.py", "scripts/dichotomy_audit.py", "docs/dichotomy-rebase-honest-audit.md", ]) print("close:", json.dumps(c)[:400]) print("CONTRACT", cid, "closed" if c.get("success") else "CLOSE_FAILED")