86 lines
4.1 KiB
Python
86 lines
4.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Close the #2479 dichotomy-wave contract for builder_bridge_cli in ONE
|
|
process (submit → approved → building → verifying → closed), with SHA
|
|
evidence. Run with CS_RUST_LIB pointing 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"))
|
|
|
|
PARITY_SHA = sys.argv[1] if len(sys.argv) > 1 else ""
|
|
PHASEB_SHA = sys.argv[2] if len(sys.argv) > 2 else ""
|
|
if not (PARITY_SHA and PHASEB_SHA):
|
|
sys.exit("usage: close_contract_builder_bridge_cli.py <parity_sha> <phaseb_sha>")
|
|
|
|
from rune.construction_interface import ConstructionInterface
|
|
|
|
iface = ConstructionInterface(builder="factory-batch-i")
|
|
|
|
r = iface.submit_need(
|
|
"Port builder_bridge_cli to FULL Go (#2479 dichotomy tranche, GO "
|
|
"verdict): the CLI shell with exact oracle semantics — argv join-then-"
|
|
"strip (inner spaces kept), --json consumed only at argv[1] (anywhere "
|
|
"else it is task text), print()'s always-trailing newline (empty "
|
|
"capsule renders a single \\n), Python json.dumps byte-parity "
|
|
"(insertion order, ', '/': ' separators, ensure_ascii \\uXXXX, "
|
|
"surrogate pairs) — over the deterministic preflight chain (route "
|
|
"authority mirrored from src/go/adaptive-router incl. the rrf cgo "
|
|
"membrane; capsule render from src/go/builder-bridge; rune-safe "
|
|
"truncation per the str[:n] law; Python's [:200]-on-joined-reasons "
|
|
"precedence). Reactive seams excluded per event-wait precedent "
|
|
"(memory retrieval, construction projection — oracle degrade paths; "
|
|
"PL1 lessons empty by design). Frozen truth 13 cases from the live "
|
|
"oracle subprocess under pinned seams (frozen clock sitecustomize "
|
|
"rig, empty memory/construction stores, HOME isolation for the "
|
|
"hardcoded ~/.config/opencode shard sources); byte-deterministic "
|
|
"regeneration; live parity Go binary == Python oracle 13/13; Phase B "
|
|
"allocation-flat render pass (measured, allocs-asserted).",
|
|
origin="builder",
|
|
)
|
|
print("submit_need:", json.dumps(r)[:200])
|
|
if not r.get("success"):
|
|
sys.exit(1)
|
|
cid = r["ids"]["contract_id"]
|
|
print("contract_id:", cid)
|
|
|
|
for phase in ("approved", "building", "verifying"):
|
|
t = iface.transition(cid, phase)
|
|
if not t.get("success"):
|
|
print(f"transition->{phase} FAILED:", json.dumps(t)[:300])
|
|
sys.exit(1)
|
|
print("walked to verifying")
|
|
|
|
c = iface.close(cid, observed_evidence=[{
|
|
"kind": "port_evidence",
|
|
"detail": (
|
|
f"builder_bridge_cli GO dichotomy completion — parity commit {PARITY_SHA}, "
|
|
f"Phase B commit {PHASEB_SHA}; fn coverage 0/1 NOT TOUCHED -> 1/1 FULL "
|
|
"(audit CURRENT instrument); frozen-truth battery replays 13 cases "
|
|
"byte-identical (src/go/builder-bridge-cli/truth.json, generated from "
|
|
"the live oracle subprocess: scripts/gen_builder_bridge_cli_truth.py — "
|
|
"re-run regenerates byte-identical); live parity Go binary == live "
|
|
"Python oracle on all 13 argv vectors under identical pinned env "
|
|
"(frozen clock, empty stores, HOME isolation) 13/13 IDENTICAL; "
|
|
"go build + go vet + gofmt clean; Python suite tests/test_builder_bridge.py "
|
|
"13 passed (no Python surface touched). Documented divergences: "
|
|
"memory retrieval + construction projection are reactive seams that "
|
|
"stay Python (event-wait precedent) — the Go preflight returns the "
|
|
"oracle's own degrade-path output (empty lines) which is exactly what "
|
|
"the frozen corpus pins; provenance 'ambiguous' renders Go 'false' vs "
|
|
"Python 'False' (not observable in any CLI output)."
|
|
),
|
|
}], scope_files=[
|
|
"src/rune/builder_bridge_cli.py",
|
|
"src/go/builder-bridge-cli/go.mod",
|
|
"src/go/builder-bridge-cli/main.go",
|
|
"src/go/builder-bridge-cli/preflight.go",
|
|
"src/go/builder-bridge-cli/truth.json",
|
|
"src/go/builder-bridge-cli/truth_test.go",
|
|
"scripts/gen_builder_bridge_cli_truth.py",
|
|
"scripts/bbc_freeze_seams/sitecustomize.py",
|
|
"scripts/close_contract_builder_bridge_cli.py",
|
|
])
|
|
print("close:", json.dumps(c)[:300])
|
|
print("CONTRACT", cid, "closed" if c.get("success") else "CLOSE_FAILED")
|