Files
rune/scripts/walk_close_contract_builder_bridge.py
Nick 050e142d61 chore(store): close builder_bridge dichotomy contract BUILDER-2026-10-14T04:51:14Z-20ac15-factory-gap-bb (parity 7cc134c2)
builder_bridge gap-close: 3/11 PARTIAL -> 11/11 FULL (GO); frozen truth
22 cases byte-identical (generation, --verify, regeneration under the
bb_freeze_seams rig), Go battery + -race green, live parity 11/11 case
families byte-equal vs the live oracle (dict + markdown + construction
lines + store resolution incl. the default-store branch), gofmt/vet/
build clean, Python both pins green. Evidence: verification/bb_*.{log,
txt,exit,md}.
2026-10-14 06:10:10 +01:00

95 lines
4.6 KiB
Python

#!/usr/bin/env python3
"""Walk + close the #2479 dichotomy-wave contract for builder_bridge on the
FRESH master store (one process, per the shared-store clobber pattern)."""
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
PARITY_SHA = sys.argv[1] if len(sys.argv) > 1 else ""
if not PARITY_SHA:
sys.exit("usage: walk_close_contract_builder_bridge.py <parity_sha>")
iface = ConstructionInterface(builder="factory-gap-bb")
r = iface.submit_need(
"Close the PARTIAL gaps in src/go/builder-bridge against the "
"src/rune/builder_bridge.py oracle (dichotomy wave, issue #2479 "
"tranche): the eight audit-missing functions (to_dict capsule "
"projection with line caps, _construction_store env/default seam, "
"_active_construction_lines segment-architecture read-only projection "
"incl. pattern/layout obligation rendering, _default_selector, "
"_get_selector lazy singleton, _retrieve_memory degrade-safe "
"abstention + block extraction, _cached_memory TTL/eviction cache, "
"_validated_lessons_for PL1-empty contract) plus the preflight wiring "
"over a vendored adaptive-router (pure-Go detectFlags transcribed from "
"the oracle's route_risk_flags insertion order), frozen-truth battery "
"generated against the live oracle through the bb_freeze_seams rig "
"(pinned HOME, committed fixture stores, byte-identical --verify and "
"regeneration), go build/vet/gofmt/test -race green, live parity 11 "
"case families byte-equal on dict+markdown+lines+store incl. the "
"default-store branch, Python oracle tests green under both pins, "
"audit 3/11 PARTIAL -> 11/11 FULL (GO).",
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(f"transition->{phase}: ok")
print("walked to verifying")
c = iface.close(cid, observed_evidence=[{
"kind": "port_evidence",
"detail": (
f"builder_bridge GO dichotomy gap-close — parity commit {PARITY_SHA}; "
"dichotomy audit fn coverage 3/11 PARTIAL -> 11/11 FULL (missing list "
"emptied, GO side); 22-row frozen truth "
"(scripts/gen_builder_bridge_truth.py under scripts/bb_freeze_seams "
"— pinned HOME/RUNE_HOME so every selector source abstains "
"deterministically, committed construction fixtures store_active/"
"store_quiet/store_terminal; byte-identical across generation, "
"--verify and regeneration), Go battery green (frozen replay + LRU "
"TTL/eviction/refresh + render branches + preflight route pins, "
"-race), live parity 11/11 case families byte-equal vs the live "
"oracle (capsule dict + markdown + construction lines + store "
"resolution, generated_at timestamp-normalized, incl. the "
"default-store branch reading the real store live on both sides), "
"gofmt/go vet/go build ./... clean, Python tests both pins green "
"(RUNE_BUILDER_BRIDGE_CORE=python and live; one pre-existing "
"env-dependent test failure verified identical on pristine main). "
"Documented divergences: populated-store hybrid memory recall stays "
"Python-side (the frozen surface is the degrade-safe abstention "
"both sides reproduce byte-equal); the selector None branch and "
"default-store path derivation are live-parity-gated. Evidence: "
"verification/bb_*.{log,txt,exit,md}."
),
}], scope_files=[
"src/rune/builder_bridge.py",
"src/go/builder-bridge/main.go",
"src/go/builder-bridge/adaptive_router.go",
"src/go/builder-bridge/construction.go",
"src/go/builder-bridge/memory.go",
"src/go/builder-bridge/replay.go",
"src/go/builder-bridge/truth_test.go",
"src/go/builder-bridge/truth.json",
"src/go/builder-bridge/fixtures/store_active/segments/entities/20-contract-active.json",
"src/go/builder-bridge/fixtures/store_quiet/.gitkeep",
"src/go/builder-bridge/fixtures/store_terminal/segments/entities/10-contract-terminal.json",
"scripts/gen_builder_bridge_truth.py",
"scripts/bb_freeze_seams/sitecustomize.py",
"scripts/check_builder_bridge_parity.py",
])
print("close:", json.dumps(c)[:300])
print("CONTRACT", cid, "closed" if c.get("success") else "CLOSE_FAILED")