Files
rune/scripts/close_contract_batch_a.py
T

54 lines
1.8 KiB
Python

#!/usr/bin/env python3
"""Close the #2479 dichotomy-wave construction contract for <module>.
verifying+closed back-to-back IN ONE PROCESS (shared-store clobber hazard).
Usage: close_contract_batch_a.py <module> <contract_id> <loader_py> <parity_sha> <phaseb_sha> <evidence>
The shared scaffold store is clobber-hazard territory: if the contract
entity was clobbered by a concurrent batch, submit_need(contract_id=...)
re-walks the SAME contract id on the fresh store (concept_topology law).
"""
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
module, cid, loader_py, parity_sha, phaseb_sha = sys.argv[1:6]
evidence = sys.argv[6]
iface = ConstructionInterface(builder="factory-batch-a")
r = iface.submit_need(
f"Port src/rune/{module}.py to FULL Rust (dichotomy factory, issue "
f"#2479 tranche): doc-envelope FFI, ctypes loader, facade delegation "
f"pin, frozen-truth battery, live parity 100%, Phase B "
f"language-advantage pass.",
origin="builder",
contract_id=cid,
)
print("submit_need:", json.dumps(r)[:300])
if not r.get("success"):
print("NEED FAILED — aborting")
sys.exit(1)
t = iface.transition(cid, "verifying")
print("transition->verifying:", json.dumps(t)[:300])
if not t.get("success"):
sys.exit(1)
c = iface.close(cid, observed_evidence=[{
"kind": "port_evidence",
"detail": evidence,
}], scope_files=[
f"src/rune/{module}.py",
f"src/rune/{loader_py}",
f"src/rust/{module}/src/lib.rs",
f"src/rust/{module}/src/branch_battery.rs",
f"scripts/gen_{module}_truth.py",
])
print("close:", json.dumps(c)[:400])
print("CONTRACT", cid, "closed" if c.get("success") else "CLOSE_FAILED")