Files
rune/scripts/complete_close_contract_layout_contract.py
Nick 4402c4284b chore(store): close layout_contract dichotomy contract BUILDER-2026-10-14T05:21:12Z-4723a5-factory-gap-lc (parity 4bbed58d)
Walk draft->approved->building->verifying in one process; final entry
via close() per the quality-gate law (predicted-vs-observed
contract_quality computed; raw closed-transition refused — the first
walk attempt hit exactly that gate and completed through close()).
2026-10-14 06:25:44 +01:00

60 lines
2.0 KiB
Python

#!/usr/bin/env python3
"""Complete the layout_contract dichotomy close: the walk reached
'verifying' (BUILDER-2026-10-14T05:21:12Z-4723a5-factory-gap-lc); the
final step must enter via close() — the quality-gate law (2026-10-13)
requires the predicted-vs-observed contract_quality computation, not a
raw transition. One process, no interleaved writers.
Usage: complete_close_contract_layout_contract.py
"""
import json
import os
import sys
from pathlib import Path
os.environ.setdefault(
"CS_RUST_LIB",
"/mnt/workdrive/rune/src/rust/capability_scoring/target/release/libcapability_scoring.so",
)
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
from rune.construction_interface import ConstructionInterface
PARITY_SHA = "9ed9a7a2"
EVIDENCE = f"parity {PARITY_SHA}"
CID = "BUILDER-2026-10-14T05:21:12Z-4723a5-factory-gap-lc"
iface = ConstructionInterface(builder="factory-gap-lc")
r = iface.close(
CID,
observed_evidence=[
{"kind": "port_evidence", "detail": "parity " + PARITY_SHA,
"entity": "module:layout_contract"},
{"kind": "port_evidence", "detail":
"frozen corpus 35 cases byte-identical (frozen_lc_gap_truth.json); "
"gap_battery 10/10; clippy -D warnings clean",
"entity": "module:layout_contract"},
{"kind": "port_evidence", "detail":
"live parity 35/35 + byte-identical re-freeze "
"(scripts/check_layout_contract_parity.py); layout+consumer tests "
"64/64 BOTH pins",
"entity": "module:layout_contract"},
{"kind": "port_evidence", "detail":
"dichotomy audit 2/6 PARTIAL -> 6/6 FULL (RUST)",
"entity": "module:layout_contract"},
],
)
print("close:", json.dumps(r)[:400])
if not r.get("success"):
print("CLOSE FAILED — aborting")
sys.exit(1)
doc = iface.scaffold.load()
e = iface.scaffold.contract(doc, CID)
print("FINAL PHASE:", e.get("phase") if e else "MISSING")
if not e or e.get("phase") != "closed":
sys.exit(1)
print("CLOSED", CID)