Files
rune/scripts/open_contract_gap_al.py
Nick 29989a5b27 feat(audit_ledger): close PARTIAL gaps — dichotomy wave
audit 2/8 PARTIAL -> 8/8 FULL (RUST). The chain kernels live in the
evidence_provenance crate (the live ep seam the oracle already delegates
hash+verify through — one chain, one key, RECONCILE-DON'T-CLOBBER): the
three missing log_* wrappers ported name-preserving (log_promotion,
log_gate_result, log_drift_alert + ep_* FFI + ep_loader bindings), the
facade switched onto RUNE_AUDIT_LEDGER_CORE delegation with _py_*
vintage fallbacks (both-pins law), and the audit mapping aliased to the
crate (drift_compression precedent). The divergent W6-era
src/rust/audit_ledger stub (SHA-256 concat, wrong field names, never the
live chain) is deleted.

RUNE_FROZEN_NOW clock seam (PP_ACTIVE_THREADS pattern) added to
now_iso_utc so pinned-python and Rust ledger writes hash byte-identically.

Fix-first, frozen-proof (two pre-existing kernel defects):
- get_entries negative-limit slice law: Python lines[-limit:] with
  limit<0 drops the FRONT (lines[|limit|:]), not all lines.
- pyjson integral-float parse: numbers with '.'/exponent now parse as
  Json::Float (json.loads law) — "0.0" round-trips as 0.0, never
  collapses to 0; any Python-written entry with an integral float
  previously HMAC-verified FAILING (payload bytes differed). habitmath
  count/confidence extraction arms widened Num|Float (restores
  test_behavior_decision_math).

Frozen truth: 16-case envelope via the shared freeze_truth harness +
scripts/al_freeze_seams rig (sequential chain: missing-file branches,
genesis first append, the three log_* detail shapes, mixed-type details,
get_entries limit lattice 50/3/1/0/-2/100, full-chain verify,
_compute_hash sort_keys law). --verify byte-identical (x2). Rust battery
audit_battery.rs replays the corpus VERBATIM (include_str!) + asserts the
ledger FILE bytes equal expected pyjson dumps. Live parity 360/360
(pinned/live/kernel 16 each, file-byte parity EQUAL, 5 seams incl. the
documented missing-hash crash-superset asserted per-side, fuzz seed 2479
300/300 rounds incl. file bytes, CLI parity 5/5 python -m vs Rust bin).
cargo build/clippy -D warnings/fmt/test clean; pytest 11/11 BOTH pins;
ruff clean; ep canary 66/0; canary_audit_ledger isolated 74/0 both pins.

Evidence: verification/al-*.exit + al-summary.md (logs local, *.log
gitignored).
2026-10-14 16:41:39 +01:00

50 lines
2.0 KiB
Python

#!/usr/bin/env python3
"""Open the #2479 dichotomy-wave gap-closing construction contract for
audit_ledger (PARTIAL 2/8 → 8/8 fn coverage). Walks draft→approved→
building in ONE process (shared-store clobber hazard). Close happens after
the landing is pushed, with SHA evidence (close_contract_gap_al.py).
CS_RUST_LIB must point at a BUILT capability_scoring .so before any
submit_need (the Python oracle is retired and raises).
"""
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
iface = ConstructionInterface(builder="factory-gap-al")
r = iface.submit_need(
"Close audit_ledger PARTIAL gaps (dichotomy wave, issue #2479 "
"tranche): the chain kernels live in the evidence_provenance crate "
"(the live ep seam the oracle already delegates hash+verify through) — "
"port the three missing log_* wrappers name-preserving "
"(log_promotion, log_gate_result, log_drift_alert + ep_* FFI + "
"loader bindings), switch the facade onto RUNE_AUDIT_LEDGER_CORE "
"delegation with _py_* vintage fallbacks, add the RUNE_FROZEN_NOW "
"clock seam for cross-language byte parity, fix-first the two "
"frozen-truth-proven kernel defects (get_entries negative-limit "
"slice law; pyjson integral-float parse→dump round-trip), delete the "
"divergent W6 src/rust/audit_ledger stub (RECONCILE-DON'T-CLOBBER), "
"alias the audit mapping, freeze 16-case truth via the shared "
"harness, Rust battery replay + file-byte law, live parity 100% on "
"the gap fns.",
origin="builder",
)
print("submit_need:", json.dumps(r)[:400])
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"):
t = iface.transition(c, phase)
print(f"transition->{phase}:", json.dumps(t)[:300])
if not t.get("success"):
sys.exit(1)
print("OPENED", c)