Files
rune/scripts/close_contract_final_f0.py
T
Nick 795bb97465
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 FINAL-WAVE F0 lane dichotomy contract BUILDER-2026-10-15T08:57:05Z-de0643-factory-final-f0 (parity 2c97b685+f9399d40)
One-process walk (draft->approved->building->verifying->closed) via
iface.close() with contract_quality observed_evidence. Parity SHAs:
graph_projection 2c97b685 (3/6 -> 6/6 FULL, 3 fns + 4-defect fix set);
recall_router f9399d40 (2/3 -> 3/3 FULL, handle_hook). Lane leaves the
audit at PARTIAL 0 — 154/193 modules FULL, fn-level 1950/2301 (85%).
Evidence: verification/summary-gp.md + summary-rr.md + f0-close-walk.
2026-10-15 09:59:54 +01:00

148 lines
6.3 KiB
Python

#!/usr/bin/env python3
"""Close the FINAL-WAVE F0 lane dichotomy contract (builder
factory-final-f0): 2 modules, 4 audit-missing functions ported
name-preserving into existing crates (1 Rust + 1 Go). Full lifecycle
walk in ONE process (shared-store clobber hazard). Final step is
iface.close() with contract_quality observed_evidence. Safe to re-run:
pass the contract id.
Carries the already-pushed parity SHAs as evidence:
graph_projection 8e3cc569
recall_router 9d9ecdca
Usage: close_contract_final_f0.py [contract_id]
"""
import json
import os
import sys
from pathlib import Path
os.environ.setdefault(
"CS_RUST_LIB",
str(Path(__file__).resolve().parents[1]
/ "src/rust/capability_scoring/target/release/libcapability_scoring.so"),
)
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
from rune.construction_interface import ConstructionInterface
SHAS = "graph_projection 8e3cc569; recall_router 9d9ecdca"
NEED = (
"FINAL-WAVE F0 lane (#2479 dichotomy wave): the residue audit "
"found 4 name-preserving-port gaps across the last 2 PARTIAL "
"modules; all ported into EXISTING crates (1 Rust + 1 Go), each "
"verify-gated then pushed per-module. graph_projection "
"_model_to_dicts/write_all/_now (kernel-side assembly + .get "
"defaults with facade-side attribute probes; the three-format file "
"writer with an in-crate py_dumps_sorted emitter replicating "
"json.dumps indent=1 sort_keys=True byte law — ensure_ascii, "
"lowercase hex, astral surrogate pairs; the strftime/gmtime UTC "
"stamp law over civil_from_days with an injectable epoch seam "
"pin_epoch_secs/gp_pin_epoch, i64::MIN un-pin sentinel). DEFECTS "
"FOUND+FIXED (write_all byte parity exposed them): kernel "
"project_json dropped generated_at entirely; project_dot label "
"fallback ignored the split(':',1)[-1] law; project_mermaid "
"numbered ids in entity order instead of sorted(set) with dedup, "
"missed the label quote-escape and used the full-id fallback. "
"Facade: gp_loader honors RUNE_GP_CORE=python (rig-pin-gap law) + "
"new fns with configured argtypes/restype (restype default "
"truncated pointers). Truth: 4 shared-harness cases (freeze_truth "
"--verify OK) + 9 kernel-seam cases (epochs incl. 0/-1, attr "
"branch, write_all placeholder paths + verbatim bytes, clock "
"pinned per row), regen x2 byte-identical. Battery 12/12; clippy "
"-D warnings + fmt clean; live parity failures=0 (sample + empty "
"+ 60-model seeded fuzz at BYTE level); pytest 4/4 both pins. "
"3/6 PARTIAL -> 6/6 FULL. recall_router handle_hook (gaps.go: "
"handleHook + exported HandleHook twin, hook-engine convention; "
"data accepted but DROPPED per the oracle, interface{} rides "
"null/objects/arrays/scalars). Truth: 7 shared-harness cases "
"(freeze_truth --verify OK), regen x2 byte-identical; truth_test.go "
"VERBATIM replay; live parity 47 cases failures=0 (frozen + 40 "
"seeded fuzz incl. unicode events + the data-drop key law, via a "
"temp go-run stdin/stdout harness — package main not importable, "
"go test swallows stdin); go build/test/vet/gofmt clean; NEW "
"tests/test_recall_router.py 5/5 BOTH pins (module had no suite). "
"2/3 PARTIAL -> 3/3 FULL. Both pushed per-commit to gitea/master "
"(ancestor-verified after fetch+rebase; audit-doc rebase conflicts "
"resolved by instrument regeneration — the documented law). "
"Delivered on gitea/master: " + SHAS + "."
)
iface = ConstructionInterface(builder="factory-final-f0")
if len(sys.argv) > 1:
cid = sys.argv[1]
print("resuming contract:", cid)
else:
r = iface.submit_need(NEED, origin="builder")
print("submit_need:", json.dumps(r)[:300])
if not r.get("success"):
print("NEED FAILED — aborting")
sys.exit(1)
cid = r["ids"]["contract_id"]
print("contract_id:", cid)
def phase_of(cid):
doc = iface.scaffold.load()
e = iface.scaffold.contract(doc, cid)
return e.get("phase") if e else "MISSING"
phase = phase_of(cid)
print("current phase:", phase)
for want in ("approved", "building", "verifying"):
if phase == want or phase in ("verifying", "closed"):
break
t = iface.transition(cid, want, evidence_ref="FINAL-WAVE F0 lane")
ok = t.get("success")
print(f"transition->{want}:", "ok" if ok else json.dumps(t)[:300])
if not ok:
sys.exit(1)
phase = want
c = iface.close(
cid,
observed_evidence=[{
"kind": "port_evidence",
"detail": "FINAL-WAVE F0 lane — 2 modules, 4 fns, both FULL: "
+ SHAS + ". Each module verify-gated before push "
"(frozen truth regen x2 byte-identical, batteries "
"green, clippy / go vet+gofmt+build clean, Python "
"both pins, live parity at byte level) and pushed "
"per-commit to gitea/master (ancestor-verified after "
"fetch+rebase). Contains the graph_projection "
"4-defect fix set (generated_at omission, DOT label "
"fallback, Mermaid sorted-set numbering + label "
"quote-escape) exposed by write_all byte parity. "
"Full matrix + per-module exit codes in "
"verification/summary-gp.md + summary-rr.md.",
}],
scope_files=[
"src/rust/graph_projection/src/lib.rs",
"src/rust/graph_projection/src/truth_battery.rs",
"src/rust/graph_projection/frozen_gp_truth.json",
"src/rust/graph_projection/frozen_gp_gap_truth.json",
"src/rune/gp_loader.py",
"src/rune/graph_projection.py",
"scripts/gen_graph_projection_truth.py",
"scripts/check_graph_projection_parity.py",
"src/go/recall-router/gaps.go",
"src/go/recall-router/frozen_rr_truth.json",
"src/go/recall-router/truth_test.go",
"scripts/gen_recall_router_truth.py",
"scripts/check_recall_router_parity.py",
"tests/test_recall_router.py",
"verification/summary-gp.md",
"verification/summary-rr.md",
],
)
print("close:", json.dumps(c)[:400])
final = phase_of(cid)
print("FINAL PHASE:", final)
ok = c.get("success") and final == "closed"
print("CLOSED" if ok else "CLOSE_FAILED", cid)
sys.exit(0 if ok else 1)