Routing/transport/execution family (heavy-port lane factory-heavy-ro-exec, worktree rune-wave-rp): the 25 audit-named missing fns ported name-preserving to src/go/operator-deep/gaps_execution.go — both _build_model_router defs, _sorted_tool_names, _filter_safety_noise, _wire_auto_filer, _reconcile_guarded, _transport_for, _runtime_for_model, _capability_selection, _conversation_messages, _attach_runtime_objects, _apply_runtime_result, _ensure_canonical, _channel_for_task, _response_envelope, _context_broker, the six _contributor_* blocks, _execute_on_model with its nested _fold_attempt, _finalize_runtime_response, _log_token_usage. Frozen truth 72 rows (truth_execution.json, scripts/roexec_freeze.py — pinned clock/uuid/monotonic rig, journaling seam fakes, id-placeholder law) regenerated byte-identical x3 (sha256 866f958e); battery 72/72 + full operator-deep suite green; live parity frozen==regen (scripts/check_ro_exec_parity.py, exit 0); gofmt/vet/build clean; pytest 53 passed BOTH pins (RUNE_OPERATOR_CORE pin proven vacuous); audit rune_operator 29/68 PARTIAL -> 56/68 FULL (GO), wave 128/192. Evidence: verification/roexec-*.exit + summary-roexec.md (logs gitignored).
66 lines
2.4 KiB
Python
66 lines
2.4 KiB
Python
#!/usr/bin/env python3
|
|
"""check_ro_exec_parity — live-parity driver for the rune_operator
|
|
routing/transport/execution family gap-close (worktree rune-wave-rp).
|
|
|
|
Re-freezes truth from the LIVE Python oracle
|
|
(/mnt/workdrive/rune/src/rune/rune_operator.py, deterministic rig in
|
|
scripts/roexec_freeze.py: pinned clock/uuid/monotonic, hermetic HOME,
|
|
journaling seam fakes) into a scratch file and byte-compares it against
|
|
the committed frozen truth. The Go side replays the SAME rows through
|
|
the kernels in src/go/operator-deep/truth_execution_test.go (72/72).
|
|
|
|
Exit 0 iff regen == frozen, byte-for-byte.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import hashlib
|
|
import subprocess
|
|
import sys
|
|
import tempfile
|
|
from pathlib import Path
|
|
|
|
REPO = Path(__file__).resolve().parents[1]
|
|
COMMITTED = REPO / "src" / "go" / "operator-deep" / "truth_execution.json"
|
|
|
|
|
|
def main() -> int:
|
|
if not COMMITTED.exists():
|
|
print("committed truth missing")
|
|
return 1
|
|
want = COMMITTED.read_bytes()
|
|
with tempfile.NamedTemporaryFile(suffix=".json", delete=False) as fh:
|
|
scratch = Path(fh.name)
|
|
try:
|
|
# roexec_freeze.py writes to its fixed TRUTH_OUT target; run it on a
|
|
# scratch COPY of the tree-free state by capturing the bytes it just
|
|
# regenerated in-place, then restoring the committed bytes.
|
|
before = COMMITTED.read_bytes()
|
|
proc = subprocess.run(
|
|
[sys.executable, str(REPO / "scripts" / "roexec_freeze.py")],
|
|
capture_output=True, text=True, timeout=600,
|
|
)
|
|
got = COMMITTED.read_bytes()
|
|
if before != want: # paranoia: the file on disk IS the committed truth
|
|
COMMITTED.write_bytes(before)
|
|
print("committed truth changed during check")
|
|
return 1
|
|
COMMITTED.write_bytes(before)
|
|
if proc.returncode != 0:
|
|
print("generator failed:", proc.stderr[-2000:])
|
|
return 1
|
|
scratch.write_bytes(got)
|
|
ha, hb = hashlib.sha256(want).hexdigest(), hashlib.sha256(got).hexdigest()
|
|
print(f"frozen={len(want)}B sha256={ha}")
|
|
print(f"regen ={len(got)}B sha256={hb}")
|
|
if ha != hb:
|
|
print("PARITY FAILURE: regenerated truth differs from frozen")
|
|
return 1
|
|
print("live parity: frozen == regenerated (byte-identical)")
|
|
return 0
|
|
finally:
|
|
scratch.unlink(missing_ok=True)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|