Files
rune/scripts/close_contract_construction_pattern.py
T

60 lines
3.1 KiB
Python

#!/usr/bin/env python3
"""Close the #2479 dichotomy-wave construction contract for
construction_pattern with SHA evidence."""
import json
import os
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
os.environ["CS_RUST_LIB"] = str(
Path(__file__).resolve().parents[1] / "src" / "rust" / "capability_scoring" / "target" / "release" / "libcapability_scoring.so"
)
from rune.construction_interface import ConstructionInterface
cid = sys.argv[1]
iface = ConstructionInterface(builder="factory-gap-cp")
t = iface.transition(cid, "verifying", evidence_ref="feat 1ad658cf — battery 14/14, clippy 0, harness 18/18, live parity 192/192 both pins, pytest 30/30+20/20 both pins; phase B f2ae1b0f — SignalTally struct + free _check, zero-copy _surface_text tokens, Map::with_capacity(3) need envelope (battery 14/14, parity 192/192 both pins re-run post-B)")
print("transition->verifying:", json.dumps(t)[:300])
if not t.get("success"):
print("TRANSITION FAILED — aborting"); sys.exit(1)
c = iface.close(cid, observed_evidence=[{
"kind": "port_evidence",
"detail": "construction_pattern dichotomy completion — feat 1ad658cf + phase B f2ae1b0f "
"'feat(construction_pattern): close PARTIAL gaps — dichotomy "
"wave'. Audit PARTIAL 7/13 -> FULL 13/13 (headline 74/192, "
"fn 1358/2278). Ported _need_dict (FFI need envelope, wired "
"into cp_evaluate/cp_derive) and _surface_text (evidence "
"token union); renamed _path_matches/_entity_matches/"
"_obligation_when_hit + the _check closure to their exact "
"Python names (bodies already ported; name-preserving law, "
"precedent structural_store _sorted). Truth 70->96 cases "
"(path_match 11, entity_match 9, need_dict 2, surface_text "
"4, when_hit 14 incl. re.split empty-quirk and truthy-not-"
"True always) + harness surface frozen_truth.json 18 cases. "
"Verification all exit 0 (verification/summary.md): battery "
"14 tests replay 96 cases VERBATIM; clippy 0 warnings; "
"harness verify 18/18 byte-identical; live parity 192/192 "
"both pins (check_construction_pattern_parity.py; class ops "
"through cp_loader under the kernel pin); pytest 30/30 "
"module + 20/20 consumers under RUNE_CP_CORE=python and "
"auto. Zero regressions.",
}], scope_files=[
"src/rune/construction_pattern.py",
"src/rust/construction_pattern/src/lib.rs",
"src/rust/construction_pattern/src/branch_battery.rs",
"src/rust/construction_pattern/src/frozen_cp_truth.json",
"src/rust/construction_pattern/frozen_truth.json",
"scripts/gen_construction_pattern_truth.py",
"scripts/gen_construction_pattern_harness_truth.py",
"scripts/check_construction_pattern_parity.py",
"tests/test_construction_pattern.py",
"verification/summary.md",
])
print("close:", json.dumps(c)[:300])
print("CONTRACT", cid, "closed" if c.get("success") else "CLOSE_FAILED")