Files
rune/scripts/close_contract_gap_cb.py
T
Nick 1003e56cad chore(store): close capability_broker dichotomy contract BUILDER-2026-10-13T16:01:25Z-9b9389-factory-gap-cb (feat 1a35b4ce, Phase B 2eb91c0e)
One-process walk building->verifying->closed with SHA evidence
(scripts/close_contract_gap_cb.py; verification/cb-close-walk.{log,exit}).
Module audit 10/19 PARTIAL -> 19/19 FULL; parity 468/468; freeze --verify
33 byte-identical; both-pins green; full-suite zero-delta vs master
baseline.
2026-10-14 04:56:08 +01:00

76 lines
3.5 KiB
Python

#!/usr/bin/env python3
"""Close the #2479 dichotomy-wave gap-closing construction contract for
capability_broker with SHA evidence (opener: open_contract_gap_cb.py).
One process: building -> verifying -> closed (shared-store clobber
hazard law). CS_RUST_LIB must point at a BUILT capability_scoring .so."""
import json
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
FEAT_SHA = sys.argv[1] if len(sys.argv) > 1 else ""
PHASEB_SHA = sys.argv[2] if len(sys.argv) > 2 else ""
if not (FEAT_SHA and PHASEB_SHA):
sys.exit("usage: close_contract_gap_cb.py <feat_sha> <phaseb_sha>")
from rune.construction_interface import ConstructionInterface
cid = "BUILDER-2026-10-13T16:01:25Z-9b9389-factory-gap-cb"
iface = ConstructionInterface(builder="factory-gap-cb")
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": (
f"capability_broker dichotomy gap-close — feat commit {FEAT_SHA}, "
f"Phase B commit {PHASEB_SHA}, both verified as gitea/master "
"ancestors. Module audit 10/19 PARTIAL -> 19/19 FULL "
"(missing list empty). The 10 audit-missing fns ported "
"name-preserving into src/rust/capability_broker/src/gap.rs "
"(_native_tool_schemas, load_registry, _cards_are_stale, "
"load_cards, generate_card, build_cards, _cs_core, "
"_py_score_card, match_capabilities, handle_hook) with cb_* "
"doc-envelope FFI, ctypes loader bindings, facade delegation "
"under RUNE_CAPABILITY_BROKER_CORE. Frozen-truth battery "
"(gap_battery.rs) replays the 33-case shared-harness corpus "
"VERBATIM (include_str!) — 11/0 green; freeze_truth.py --verify "
"33 cases byte-identical against the live oracle (fixture-pinned "
"standalone + self-verifying regen); live parity 468/468 "
"(frozen=33 fuzz=421 live=14) = 100% on the gap fns; clippy "
"-D warnings clean; adjacent pytest 107/107 BOTH pins; full "
"suite both pins zero-delta vs the 118-failure master baseline. "
"Evidence: verification/cb-*.{log,exit} + cb-summary.md "
"(committed with the Phase B). Phase B advantages: trait CbIo "
"IO injection, Result error paths, exhaustive handle_hook "
"match, zero-copy static tables, in-process Rust-to-Rust cs "
"kernel delegation. Adjacent fix-first with proof: "
"tests/test_connection_pool.py evict-oldest flag normalized to "
"basenames (raw tempdir-path substring flake, ~17% isolated; "
"fd74311b-class instrument bug, not a port regression)."
),
}], scope_files=[
"src/rust/capability_broker/src/gap.rs",
"src/rust/capability_broker/src/gap_battery.rs",
"src/rust/capability_broker/src/lib.rs",
"src/rust/capability_broker/src/broker.rs",
"src/rust/capability_broker/frozen_gap_truth.json",
"src/rune/broker_loader.py",
"src/rune/capability_broker.py",
"scripts/gen_capability_broker_gap_truth.py",
"scripts/check_capability_broker_gap_parity.py",
"scripts/open_contract_gap_cb.py",
"scripts/close_contract_gap_cb.py",
"tests/test_capability_broker_delegation.py",
"tests/test_p1_01_capability_authority.py",
"tests/test_connection_pool.py",
"verification/cb-summary.md",
])
print("close:", json.dumps(c)[:300])
print("CONTRACT", cid, "closed" if c.get("success") else "CLOSE_FAILED")
sys.exit(0 if c.get("success") else 1)