104 lines
4.2 KiB
Python
104 lines
4.2 KiB
Python
#!/usr/bin/env python3
|
|
"""Close the #2479 dichotomy-wave rune_operator TASK-LIFECYCLE/STATE family
|
|
gap contract (GO port, family lane factory-heavy-ro-life). Full lifecycle
|
|
walk in ONE process (shared-store clobber hazard). Carries the pushed
|
|
parity SHA as evidence.
|
|
|
|
Usage: python3 scripts/close_contract_operator_lifecycle.py
|
|
"""
|
|
import json
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
os.environ.setdefault(
|
|
"CS_RUST_LIB",
|
|
"/mnt/workdrive/rune/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
|
|
|
|
PARITY_SHA = "d0006488"
|
|
EVIDENCE = f"parity {PARITY_SHA}"
|
|
|
|
iface = ConstructionInterface(builder="factory-heavy-ro-life")
|
|
|
|
r = iface.submit_need(
|
|
"rune_operator dichotomy TASK-LIFECYCLE/STATE family gap-close (GO): "
|
|
"name-preserving port of the 12 audit-missing lifecycle fns into "
|
|
"src/go/operator-deep/gaps_lifecycle.go — get_conversation_window, "
|
|
"list_tasks (method + module), _routing_profiles_path, "
|
|
"_construction_store, _construction_note, _construction_activation "
|
|
"(override parse + target derivation + canonical observation rows; "
|
|
"classify/intent/activate outputs arrive as inputs — their modules' "
|
|
"own port surfaces), _init_conversation_state + the "
|
|
"migrate_operator_tasks ledger import (status map, idempotent skip, "
|
|
"completed-result message replay, current-task restore), _load "
|
|
"(defaults/dataclass-field filter/corrupt degrade), _save (ordered "
|
|
"Python json.dump indent=2 byte-parity writer), "
|
|
"_clear_pending_approval, _terminalize_execution_failure (task "
|
|
"state + canonical transition + full OperatorResponse failure "
|
|
"envelope), _emit_task_outcome/_emit_task_failed journal payload "
|
|
"contracts. Frozen truth truth_lifecycle.json 37 rows under "
|
|
"scripts/olc_freeze_seams (pinned clock, deterministic uuid "
|
|
"counter, fixed scratch, cone cores pinned, event_bus recorder), "
|
|
"freeze_truth --verify byte-identical x3; Go battery "
|
|
"gaps_lifecycle_test.go replays the truth verbatim (ordered parse; "
|
|
"save rows byte-compare); live parity 35/35 "
|
|
"(scripts/check_operator_lifecycle_parity.py) incl. env-unset "
|
|
"derive branches; gofmt/vet/go build/go test green; Python 65x2 "
|
|
"both pins (delegation live and RUNE_RUNE_OPERATOR_CORE=python). "
|
|
"Dichotomy audit rune_operator 29/68 -> 42/68 — the "
|
|
"TASK-LIFECYCLE/STATE family is complete; remaining fns belong to "
|
|
"sibling family lanes. Documented divergences in "
|
|
"verification/olc-summary.md. Delivered on gitea/master: feat "
|
|
+ PARITY_SHA + ".",
|
|
origin="builder",
|
|
)
|
|
print("submit_need:", json.dumps(r)[:300])
|
|
if not r.get("success"):
|
|
print("NEED FAILED — aborting")
|
|
sys.exit(1)
|
|
c = r["ids"]["contract_id"]
|
|
print("contract_id:", c)
|
|
|
|
for phase in ("approved", "building", "verifying"):
|
|
t = iface.transition(c, phase, evidence_ref=EVIDENCE)
|
|
ok = t.get("success")
|
|
print(f"transition {phase}: success={ok}")
|
|
if not ok:
|
|
print(json.dumps(t)[:600])
|
|
sys.exit(1)
|
|
|
|
res = iface.close(
|
|
c,
|
|
observed_evidence=[
|
|
{
|
|
"kind": "port_evidence",
|
|
"detail": (
|
|
"frozen truth truth_lifecycle.json 37 rows byte-identical "
|
|
"via freeze_truth.py --verify (x3); Go battery "
|
|
"gaps_lifecycle_test.go green (verbatim truth replay + "
|
|
"unit contracts); live parity 35/35 via "
|
|
"scripts/check_operator_lifecycle_parity.py; "
|
|
"gofmt/vet/build/test clean; Python 65x2 both pins — "
|
|
"evidence verification/olc-*.exit + olc-summary.md"
|
|
),
|
|
}
|
|
],
|
|
scope_files=[
|
|
"src/go/operator-deep/gaps_lifecycle.go",
|
|
"src/go/operator-deep/gaps_lifecycle_test.go",
|
|
"src/go/operator-deep/truth_lifecycle.json",
|
|
"src/go/operator-deep/main.go",
|
|
"scripts/olc_freeze_seams/sitecustomize.py",
|
|
"scripts/gen_operator_lifecycle_truth.py",
|
|
"scripts/check_operator_lifecycle_parity.py",
|
|
"verification/olc-summary.md",
|
|
],
|
|
)
|
|
print("close:", json.dumps(res)[:400])
|
|
sys.exit(0 if res.get("success") else 1)
|