Files
rune/scripts/walk_contract_batch_g.py
T

83 lines
4.2 KiB
Python

#!/usr/bin/env python3
"""Open + walk the #2479 dichotomy-wave construction contracts for the
batch-g quartet (execution_trace, pane_authority, skill_compiler,
meaningful_events) to verifying. Full lifecycle in ONE process."""
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
OBJECTIVES = {
"execution_trace": (
"Complete the execution_trace dichotomy port to FULL Rust (#2479 "
"tranche): journal task.outcome parsing kernel + receipt assembly "
"(build_receipt/trace_task law incl. None-when-no-outcome, "
"assigned_model→payload.model fallback and completed_at fallback) "
"as doc-envelope FFI (et_* symbols, free via capability_scoring "
"cs_free_string — no free re-export); et_loader mirroring "
"broker_loader.py; facade owns the file I/O (journal read stays "
"host-side per Law 7), RUNE_ET_CORE=python pin; frozen-oracle "
"battery (every public function, all branches incl. malformed "
"journal lines and empty task_id); live parity 100%; Phase B "
"language-advantage pass (typed Receipt struct)."
),
"pane_authority": (
"Complete the pane_authority dichotomy port to FULL Rust (#2479 "
"tranche): two-pane authority semantics kernel (classify_utterance "
"control/amendment/discussion law incl. mid-utterance control "
"phrases and the stop/pause/cancel status mapping) as doc-envelope "
"FFI (pa_* symbols, free via capability_scoring cs_free_string — "
"no free re-export); pa_loader mirroring broker_loader.py; facade "
"delegation with RUNE_PA_CORE=python pin; frozen-oracle battery "
"(every public function, all branches, deep-copied task inputs); "
"live parity 100%; Phase B language-advantage pass (exhaustive "
"UtteranceKind enum)."
),
"skill_compiler": (
"Complete the skill_compiler dichotomy port to FULL Rust (#2479 "
"tranche): sequence_id (Python json.dumps(sort_keys=True) byte law "
"+ sha256[:12]) + candidate_skill (evidence-or-{} falsy law) + "
"sandbox gate (default shape check, passed=all, vacuous-True empty "
"steps) + promote gate as doc-envelope FFI (sk_* symbols, free via "
"capability_scoring cs_free_string — no free re-export); sk_loader "
"mirroring broker_loader.py; facade owns the replay_fn callback "
"(host-side by nature) with RUNE_SKC_CORE=python pin; "
"frozen-oracle battery (every public function, all branches incl. "
"replay-crash-is-failure); live parity 100%; Phase B "
"language-advantage pass (typed SandboxVerdict)."
),
"meaningful_events": (
"Complete the meaningful_events dichotomy port to FULL Rust (#2479 "
"tranche): the eight-trigger table (ordered) + should_fire law "
"(unknown/stop/absent/rate-limited with Python int() truncation, "
"exact reason strings) + fire_due ordering + mark_fired copy "
"semantics as doc-envelope FFI (me_* symbols, free via "
"capability_scoring cs_free_string — no free re-export); me_loader "
"mirroring broker_loader.py; facade owns the wall clock (now "
"passed per op), RUNE_ME_CORE=python pin; frozen-oracle battery "
"(every trigger class, all branches incl. truncation cases); live "
"parity 100%; Phase B language-advantage pass (const trigger "
"table of typed records)."
),
}
iface = ConstructionInterface(builder="factory-batch-g")
for mod, objective in OBJECTIVES.items():
r = iface.submit_need(objective, origin="builder")
print(f"submit_need[{mod}]:", json.dumps(r)[:200])
if not r.get("success"):
print("NEED FAILED — aborting")
sys.exit(1)
cid = r["ids"]["contract_id"]
print(f"contract_id[{mod}]:", cid)
for phase in ("approved", "building", "verifying"):
t = iface.transition(cid, phase)
print(f"transition[{mod}]->{phase}:", json.dumps(t)[:120])
if not t.get("success"):
sys.exit(1)
print(f"CONTRACT[{mod}]", cid, "verifying")