Files
rune/scripts/admit_wave_live_proof.py
T
2026-10-17 11:07:31 +01:00

120 lines
4.7 KiB
Python

"""Admission dispatch for wave-K11 live proof (spec 1.3 live-proven
tool/provider paths, runtime side).
classify + activate + admit (the headless scaffolding entry law,
scripts/admit_wave_i3_live_task_tree.py pattern): the live-proof harness
builds on the existing rune project, user-dispatch approved via
"user:wave-K11-live-proof dispatch".
"""
import json
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src"))
from rune import construction_activation as cact # noqa: E402
from rune import construction_admission as cadm # noqa: E402
from rune import construction_mode as cmode # noqa: E402
from rune import scaffold as sc # noqa: E402
ROOT = os.path.join(os.path.dirname(__file__), "..")
OBJECTIVE = (
"build the spec 1.3 live-proof harness (openspec add-native-rune-tui "
"task 1.3, tools-providers-devices live-proven tool/provider paths "
"requirement): a receipt-bearing live-verification harness that runs "
"auth check, minimal real call, classified failure injection, and "
"bound recovery for every exposed tool (tool_executor TOOLS) and "
"configured provider (provider_registry), records each phase as an "
"evidence-bearing proof receipt (owner-issued IDs/digests, observed "
"verdicts only, secret fields schema-denied, failure/recovery binding "
"integrity), and computes status that reads live-proof receipts ONLY "
"— LIVE_PROVEN or UNMEASURED, never inferred from config presence"
)
AFFECTED = [
"src/rune/live_proof.py",
"tests/test_live_proof_receipt_schema.py",
"tests/test_live_proof_unmeasured.py",
"tests/test_live_proof_failure_recovery_integrity.py",
"tests/fixtures/live_proof/unmeasured_fixture.json",
"scripts/admit_wave_live_proof.py",
]
def main() -> int:
store = os.path.join(ROOT, "store", "scaffold")
scaffold = sc.Scaffold(store, "rune")
md = cmode.classify_mode(
OBJECTIVE,
target_project="rune",
project_exists=True,
affected_surface=AFFECTED,
)
print("classified mode:", md.mode)
need = {
"need_id": "need-wave-live-proof",
"objective": OBJECTIVE,
"origin": "worker",
"project": "rune",
"task_ref": "wave-K11-live-proof",
"affected_surface": AFFECTED,
"evidence_refs": [
"docs/openspec/changes/add-native-rune-tui/specs/"
"tools-providers-devices/spec.md",
"docs/openspec/changes/add-native-rune-tui/tasks.md",
"src/rune/tool_executor.py",
"src/rune/provider_registry.py",
],
}
act = cact.activate(md, need=need, scaffold=scaffold,
builder="wave-live-proof")
print("activated:", act.get("activated"), act.get("mode"))
env = cadm.admit(
act,
objective=OBJECTIVE,
builder="wave-live-proof",
affected_surface=AFFECTED,
evidence_refs=need["evidence_refs"],
origin="worker",
task_ref="wave-K11-live-proof",
expected_new_entities=[
"src/rune/live_proof.py (proof harness: receipts, status, "
"live runs, CLI)",
"tests/test_live_proof_receipt_schema.py (frozen)",
"tests/test_live_proof_unmeasured.py (frozen)",
"tests/test_live_proof_failure_recovery_integrity.py (frozen)",
"tests/fixtures/live_proof/unmeasured_fixture.json (frozen)",
],
expected_runtime_effects=[
"live-verification runs per exposed tool/provider: auth "
"check, minimal real call, failure injection, recovery — "
"each phase recorded as a digest-sealed receipt",
"status renders LIVE_PROVEN only from valid live-proof "
"receipts; config existence, partial/stale/tampered "
"receipts render UNMEASURED with a named reason",
],
verification_obligations=[
"pytest tests/test_live_proof_receipt_schema.py green "
"(frozen: proof-receipt schema)",
"pytest tests/test_live_proof_unmeasured.py green (frozen: "
"unmeasured-never-verified fixture)",
"pytest tests/test_live_proof_failure_recovery_integrity.py "
"green (frozen: failure/recovery receipt integrity)",
"python -m rune.live_proof run produces receipts and honest "
"status (unmeasured renders unmeasured)",
],
approval_ref="user:wave-K11-live-proof dispatch",
contract_id="ADMIT-wave-live-proof",
project_store=store,
project_id="rune",
)
print(json.dumps(env, indent=2, default=str)[:2400])
return 0 if env.get("success") else 1
if __name__ == "__main__":
sys.exit(main())