#!/usr/bin/env python3 """Open the #2479 dichotomy-wave gap-closing construction contract for capability_broker (PARTIAL → 20/20 fn coverage). Walks draft→approved→ building in ONE process (shared-store clobber hazard). Close happens after the two landings are pushed, with SHA evidence (close_contract_gap_cb.py). Usage: open_contract_gap_cb.py """ 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-gap-cb") r = iface.submit_need( "Close capability_broker PARTIAL gaps (dichotomy wave, issue #2479 " "tranche): port the 10 audit-missing functions name-preserving into " "the existing Rust crate (_native_tool_schemas, load_registry, " "_cards_are_stale, load_cards, generate_card, build_cards, _cs_core, " "_py_score_card, match_capabilities, handle_hook) with doc-envelope " "FFI cb_* (cs_free_string shared via capability_scoring, never " "re-exported), ctypes loader mirroring broker_loader.py, facade " "delegation with RUNE_CAPABILITY_BROKER_CORE=python pin; frozen-truth " "battery via the shared freeze_truth.py harness replayed VERBATIM in " "a cfg(test) battery; live parity 100% on the new fns; 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) c = r["ids"]["contract_id"] print("contract_id:", c) for phase in ("approved", "building"): t = iface.transition(c, phase) print(f"transition->{phase}:", json.dumps(t)[:300]) if not t.get("success"): sys.exit(1) print("OPENED", c)