#!/usr/bin/env python3 """Open + walk + close the #2479 dichotomy-wave construction contract for message_graph. 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( "Port src/rune/message_graph.py to FULL Rust (dichotomy factory, " "issue #2479 tranche): doc-envelope FFI, ctypes loader, facade " "delegation with RUNE_MG_CORE=python pin, frozen-truth battery, " "live parity 100%, Phase B language-advantage pass.", 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": "message_graph parity port — parity 1f7a2664 " "feat(message_graph): port to FULL Rust — dichotomy wave; " "Phase B 7194f69a refactor(message_graph): Phase B " "language-advantage pass — dichotomy wave (both pushed " "gitea/master). Battery 12 tests replay 68 frozen-oracle " "cases VERBATIM; live parity 68/68 byte-identical; clippy 0; " "Python suite green under both pins (9+9).", }], scope_files=[ "src/rune/message_graph.py", "src/rune/mg_loader.py", "src/rust/message_graph/src/lib.rs", "src/rust/message_graph/src/branch_battery.rs", "scripts/gen_message_graph_truth.py", ]) print("close:", json.dumps(c)[:400]) print("CONTRACT", cid, "closed" if c.get("success") else "CLOSE_FAILED")