Files
rune/scripts/walk_close_contract_local_tool_runtime.py
Nick 2b4e0d595b
Auto-version and Release / release (push) Successful in 45s
deploy / deploy (push) Skipped
CI Pipeline / lint (push) Canceled after 0s
CI Pipeline / unit-tests (push) Canceled after 0s
CI Pipeline / go-surface (push) Canceled after 0s
CI Pipeline / rust-surface (push) Canceled after 0s
CI Pipeline / canary (push) Canceled after 0s
CI Pipeline / best-practices (push) Canceled after 0s
CI Pipeline / documentation (push) Canceled after 0s
CI Pipeline / type-check (push) Canceled after 0s
CI Pipeline / gitea-offline (push) Canceled after 0s
CI Pipeline / required-checks (push) Canceled after 0s
CI Pipeline / CI Pipeline / notify-event-bridge (push) Canceled after 0s
chore(store): close local_tool_runtime dichotomy contract BUILDER-2026-10-13T06:10:03Z-450c18-factory-gap-ltr (parity d6cbc059, phase B f9ab75fd)
2026-10-13 07:19:20 +01:00

83 lines
3.6 KiB
Python

#!/usr/bin/env python3
"""Walk + close the #2479 dichotomy-wave contract for local_tool_runtime 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 ""
PHASEB_SHA = sys.argv[2] if len(sys.argv) > 2 else ""
if not (PARITY_SHA and PHASEB_SHA):
sys.exit("usage: walk_close_contract_local_tool_runtime.py <parity_sha> <phaseb_sha>")
iface = ConstructionInterface(builder="factory-gap-ltr")
r = iface.submit_need(
"Close the PARTIAL gaps in src/go/local-tool-runtime against the "
"src/rune/local_tool_runtime.py oracle (dichotomy wave, issue #2479 "
"tranche): name-preserving 1:1 port of the 22 unmatched functions "
"(_find_capability_executor, _extract_context_length, context_length, "
"reset_context_length_cache, supports_tools, supports_thinking, "
"_positive_int, _model_capabilities, resume, approve, reject, "
"_expose_tools, _deduplicate, _tool_message, _event_to_state, "
"_event_from_state, _request_to_state, _request_from_state, "
"_with_fallback_prompt and companions), IO behind injectable seams, "
"frozen-truth battery generated against the live Python oracle "
"(RUNE core pinned to python, deep-copied inputs), existing tests "
"green + gofmt/vet clean, live parity 100% on the new functions, "
"Phase B language-advantage pass.",
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"local_tool_runtime GO dichotomy gap-close — parity commit {PARITY_SHA}, "
f"Phase B commit {PHASEB_SHA}; dichotomy audit fn coverage 8/30 PARTIAL "
"-> 30/30 FULL; frozen-truth battery 96 rows vs live oracle "
"(scripts/gen_local_tool_runtime_truth.py, byte-deterministic), "
"go test -race green, gofmt/vet clean, Python oracle tests 23 passed "
"(delegation live and RUNE_LOCAL_TOOL_RUNTIME_CORE=python pinned). "
"Documented divergences: Python bool-sub-int quirk in "
"_extract_context_length, uuid call_ids in text-fallback envelopes "
"(wildcard), exception type names (message parity only)."
),
}], scope_files=[
"src/rune/local_tool_runtime.py",
"src/go/local-tool-runtime/main.go",
"src/go/local-tool-runtime/runtime.go",
"src/go/local-tool-runtime/capabilities.go",
"src/go/local-tool-runtime/context_registry.go",
"src/go/local-tool-runtime/protocol_core.go",
"src/go/local-tool-runtime/registry.go",
"src/go/local-tool-runtime/state.go",
"src/go/local-tool-runtime/executor.go",
"src/go/local-tool-runtime/executor_io.go",
"src/go/local-tool-runtime/helpers.go",
"src/go/local-tool-runtime/phaseb.go",
"src/go/local-tool-runtime/phaseb_test.go",
"src/go/local-tool-runtime/truth_test.go",
"src/go/local-tool-runtime/truth.json",
"src/go/local-tool-runtime/tools_registry.json",
"scripts/gen_local_tool_runtime_truth.py",
"scripts/open_contract_local_tool_runtime.py",
])
print("close:", json.dumps(c)[:300])
print("CONTRACT", cid, "closed" if c.get("success") else "CLOSE_FAILED")