Files
rune/scripts/walk_close_contract_structural_model.py

83 lines
3.9 KiB
Python

#!/usr/bin/env python3
"""Walk + close the #2479 dichotomy-wave contract for structural_model 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_structural_model.py <parity_sha> <phaseb_sha>")
iface = ConstructionInterface(builder="factory-gap-stm")
r = iface.submit_need(
"Close the PARTIAL gaps in src/rust/structural_model against the "
"src/rune/structural_model.py oracle (dichotomy wave, issue #2479 "
"tranche): the eleven audit-missing functions (workspace_record, "
"workspace_advance, _init_project, save, reload, add, relate, "
"state_owned, verification_surfaces, canonical_state_owner, "
"supersession; deployment_surfaces replaced its stub), the "
"lowercase-stale filters on dependencies/consumers, and the full §18F "
"impact_closure shape; fix-first repair of the dead delegation seam "
"(sm_loader was the SHARD_MANAGER loader — AttributeError → Python "
"floor on every call; now stm_loader, the crate's sm_* FFI, "
"RUNE_STM_CORE=python pins the floor; workspace_advance keeps the "
"oracle's in-place mutation law), frozen-truth battery generated "
"against the live oracle (70 cases, byte-identical --verify), Rust "
"battery 16/16 with the truth embedded via include_str!, live parity "
"4620/4620 (frozen FFI replay + 300-doc seeded fuzz + dual-mode "
"facade), cargo clippy --all-targets -D warnings clean, Python tests "
"green under both pins, 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(f"transition->{phase}: ok")
print("walked to verifying")
c = iface.close(cid, observed_evidence=[{
"kind": "port_evidence",
"detail": (
f"structural_model RUST dichotomy gap-close — parity commit {PARITY_SHA}, "
f"Phase B commit {PHASEB_SHA}; dichotomy audit fn coverage 9/20 PARTIAL "
"-> 21/21 FULL (missing list emptied; the +1 fn is the _stm_core facade "
"probe, contract mirrored in the crate per the _ss_core pattern); "
"70-case frozen gap truth (scripts/gen_structural_model_truth.py — "
"byte-identical across generation and --verify runs), Rust battery "
"16/16 with the gap truth embedded via include_str!, live parity "
"4620/4620 (frozen FFI replay + 300-doc seeded fuzz oracle-vs-kernel "
"+ dual-mode facade on RUNE_STM_CORE=python vs live core), cargo "
"clippy --all-targets -D warnings 0, Python tests both pins "
"(test_structural_model 7/7; the wider structural suites carry 2 "
"pre-existing failures + 12 errors verified byte-identical on the "
"stashed base). Dead-seam fix documented in stm_loader.py."
),
}], scope_files=[
"src/rune/structural_model.py",
"src/rune/stm_loader.py",
"src/rust/structural_model/Cargo.toml",
"src/rust/structural_model/src/lib.rs",
"src/rust/structural_model/src/gap.rs",
"src/rust/structural_model/src/frozen_battery.rs",
"src/rust/structural_model/src/frozen_sm_truth.json",
"scripts/gen_structural_model_truth.py",
"scripts/check_structural_model_parity.py",
])
print("close:", json.dumps(c)[:300])
print("CONTRACT", cid, "closed" if c.get("success") else "CLOSE_FAILED")