85 lines
4.1 KiB
Python
85 lines
4.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Open AND close the #2479 dichotomy-wave construction contract for
|
|
behavior (Rust gap-close) — the FULL lifecycle walk in ONE process
|
|
(shared-store clobber hazard; transitions can take ~60s each)."""
|
|
import json
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
|
|
|
|
os.environ["CS_RUST_LIB"] = (
|
|
"/mnt/workdrive/rune-wave-cf/src/rust/capability_scoring/target/release/"
|
|
"libcapability_scoring.so")
|
|
|
|
from rune.construction_interface import ConstructionInterface # noqa: E402
|
|
|
|
iface = ConstructionInterface(builder="factory-gap-bh")
|
|
|
|
r = iface.submit_need(
|
|
"Close the PARTIAL gaps in src/rust/behavior against the "
|
|
"src/rune/behavior.py oracle (dichotomy wave, issue #2479 tranche): "
|
|
"name-preserving ports of the 8 unmatched functions (_bh_core, connect, "
|
|
"_correction_matches_python, _habit_matches_python, _reinforce_rust, "
|
|
"_reinforce_python, list_items, behavior_stats) — rows-in/decisions-out "
|
|
"with SQLite IO staying Python (no crate links a sqlite driver), the "
|
|
"connect schema DDL frozen verbatim as sqlite stores it, reinforce as a "
|
|
"fetch-row→math→write-back ReinforcePlan (ts an argument, no-clock law), "
|
|
"list_items ordering with the rowid tie law, the python-pin predicate "
|
|
"matrix, and 6 new doc-envelope FFI symbols. Truth: gen_behavior_truth.py "
|
|
"pinned-clock corpus (regeneration byte-identical x2) + 81-case "
|
|
"freeze_truth envelope corpus (--verify byte-identical). Battery 17/17 "
|
|
"(full pre→final row replay verbatim); clippy --all-targets -D warnings "
|
|
"0; parity FROZEN 137/137 through the cdylib FFI + LIVE 14/14 "
|
|
"facade-vs-pin; pytest 7/7 both pins. Audit 6/14 → 14/14 FULL.",
|
|
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)
|
|
|
|
for phase in ("approved", "building", "verifying"):
|
|
t = iface.transition(cid, phase)
|
|
print(f"transition->{phase}:", json.dumps(t)[:220])
|
|
if not t.get("success"):
|
|
sys.exit(1)
|
|
|
|
c = iface.close(cid, observed_evidence=[{
|
|
"kind": "port_evidence",
|
|
"detail": "behavior dichotomy completion — parity 0158dece "
|
|
"feat(behavior): close PARTIAL gaps — dichotomy wave; Phase B "
|
|
"14f95f14 refactor(behavior): Phase B language-advantage pass "
|
|
"— dichotomy wave; both pushed gitea/master. The 8 missing "
|
|
"oracle fns ported name-preserving into src/rust/behavior "
|
|
"(_bh_core probe with the RUNE_BEHAVIOR_CORE pin, connect as "
|
|
"ConnectSpec schema data, the python-pin predicates, both "
|
|
"reinforce halves as one ReinforcePlan, list_items with the "
|
|
"sqlite tie law, behavior_stats) plus bh_connect/bh_core_probe/"
|
|
"bh_python_predicates/bh_reinforce_plan/bh_list_items/"
|
|
"bh_behavior_stats FFI. Freeze rig: pinned clock via "
|
|
"freeze_truth._pin_clock over behavior.datetime — "
|
|
"regeneration byte-identical x2; bh_pure_truth.json 81-case "
|
|
"envelope verified byte-identical by freeze_truth.py --verify. "
|
|
"Battery 17/17 replay VERBATIM (full pre→final rows, schema "
|
|
"DDL, predicate matrix, pure corpus); parity "
|
|
"scripts/check_behavior_parity.py FROZEN 137/137 cdylib FFI + "
|
|
"LIVE 14/14; clippy --all-targets -D warnings 0; pytest 7/7 "
|
|
"both pins. Audit 6/14 → 14/14 FULL (repo 93/192). Evidence: "
|
|
"verification/behavior-*.log + verification/summary-behavior.md.",
|
|
}], scope_files=[
|
|
"src/rust/behavior/src/lib.rs",
|
|
"src/rust/behavior/src/branch_battery.rs",
|
|
"src/rust/behavior/src/bh_truth.json",
|
|
"src/rust/behavior/bh_pure_truth.json",
|
|
"src/rust/behavior/Cargo.toml",
|
|
"scripts/gen_behavior_truth.py",
|
|
"scripts/check_behavior_parity.py",
|
|
])
|
|
print("close:", json.dumps(c)[:400])
|
|
print("CONTRACT", cid, "closed" if c.get("success") else "CLOSE_FAILED")
|
|
sys.exit(0 if c.get("success") else 1)
|