Files
rune/scripts/walk_close_contract_graph_memory.py
T
Nick 1203f23d02 chore(store): close contract BUILDER-2026-10-14T03:18:15Z-056c94-factory-gap-gm (parity 16b55694)
graph_memory gap-close: 2/9 PARTIAL -> 9/9 FULL (RUST); frozen truth 38
cases byte-identical, battery 2/2, live parity 1330/1330, clippy clean,
Python both pins green (pre-existing baselines unchanged on stashed
base). Evidence: verification/gm_*.{log,exit}.
2026-10-14 04:37:23 +01:00

82 lines
3.7 KiB
Python

#!/usr/bin/env python3
"""Walk + close the #2479 dichotomy-wave contract for graph_memory 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_graph_memory.py <parity_sha>")
iface = ConstructionInterface(builder="factory-gap-gm")
r = iface.submit_need(
"Close the PARTIAL gaps in src/rust/graph_memory against the "
"src/rune/graph_memory.py oracle (dichotomy wave, issue #2479 "
"tranche): the six audit-named functions (now_iso seconds-precision "
"kernel, connect DDL shape, resolve_entity type-fallback + alias "
"resolution decisions, add_edge write-time gating + duplicate-vs-"
"supersede kernel with exact float semantics, query BFS fact "
"projection, stats top-8 projection) plus the handle_hook contract, "
"frozen-truth battery generated against the live oracle through the "
"gm_freeze_seams rig (wiped-per-process hermetic store, byte-identical "
"--verify), Rust battery green with truth embedded via include_str!, "
"clippy --all-targets -D warnings 0, live parity 1330/1330 (frozen FFI "
"rows + 60 seeded dual-mode fuzz op-sequences + supersession-chain "
"checks), Python oracle tests green under both pins (graph suites 7/8 "
"with 1 pre-existing worktree-only store-cache failure verified "
"identical on the stashed base), audit 2/9 PARTIAL -> 9/9 FULL (RUST).",
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"graph_memory RUST dichotomy gap-close — parity commit {PARITY_SHA}; "
"dichotomy audit fn coverage 2/9 PARTIAL -> 9/9 FULL (missing list "
"emptied, RUST side); 38-row frozen gap truth "
"(scripts/gen_graph_memory_truth.py under scripts/gm_freeze_seams — "
"byte-identical across generation and --verify runs), Rust battery "
"2/2 with the gap truth embedded via include_str! (scripted store "
"mirrors the oracle SQL semantics row for row), live parity 1330/1330 "
"(15 frozen FFI rows + 1310 fuzz checks over 60 seeded op-sequences "
"dual-mode RUNE_GRAPH_MEMORY_CORE=python vs live core + 5 live "
"supersession-chain checks), cargo clippy --all-targets -D warnings "
"0, Python tests both pins (graph suites 7 passed + 1 pre-existing "
"worktree-only store-cache failure, test_p1_03 baseline 23 "
"pre-existing failures identical on the stashed base), ruff clean. "
"Kernel owns the decisions; SQLite IO stays Python (the oracle's "
"fns are db-handle-bound). Evidence: verification/gm_*.{log,exit}."
),
}], scope_files=[
"src/rune/graph_memory.py",
"src/rune/gm_loader.py",
"src/rust/graph_memory/src/lib.rs",
"src/rust/graph_memory/src/branch_battery.rs",
"src/rust/graph_memory/frozen_truth.json",
"src/rust/graph_memory/Cargo.toml",
"scripts/gen_graph_memory_truth.py",
"scripts/gm_freeze_seams/sitecustomize.py",
"scripts/check_graph_memory_parity.py",
])
print("close:", json.dumps(c)[:300])
print("CONTRACT", cid, "closed" if c.get("success") else "CLOSE_FAILED")