Files
rune/scripts/admit_wave_ci_e2e_rig.py

105 lines
4.1 KiB
Python

"""Admission dispatch for wave ci-e2e-rig (permanent CI proof rig + workflow script contract).
classify + activate + admit (the headless scaffolding entry law,
tests/test_construction_admission.py pattern): the release deep-dive's
tag-repair proof (temporary second runner + scratch repo) promoted to a
permanent, reusable CI proof rig, plus the three-pipeline workflow
script contract tests. User-dispatch approved.
"""
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 = (
"promote the release deep-dive's tag-repair proof rig (temporary second "
"runner + scratch repo) into a permanent, reusable CI proof rig: "
"scripts/ci_e2e_rig.sh registers a scratch runner, creates a scratch "
"repo, runs a workflow end-to-end, verifies outputs, and tears down — "
"documented and tested — plus tests/test_workflow_script_contract.py "
"extended to cover the three pipelines (auto-version, tui-release, "
"maintenance) so any future workflow edit reintroducing the SIGPIPE "
"pipe or dropping the GITEA_REF_NAME tag fallback goes RED at test "
"time, not in production (red-first)"
)
AFFECTED = [
"scripts/ci_e2e_rig.sh",
"scripts/admit_wave_ci_e2e_rig.py",
"tests/test_ci_e2e_rig.py",
"tests/test_workflow_script_contract.py",
"docs/ci-e2e-rig.md",
]
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-ci-e2e-rig",
"objective": OBJECTIVE,
"origin": "worker",
"project": "rune",
"task_ref": "wave-ci-e2e-rig",
"affected_surface": AFFECTED,
"evidence_refs": [
"scripts/tag_repair.py",
".gitea/workflows/auto-version.yml",
".gitea/workflows/tui-release.yml",
".gitea/workflows/maintenance.yml",
"tests/test_workflow_script_contract.py",
],
}
act = cact.activate(md, need=need, scaffold=scaffold,
builder="wave-ci-e2e-rig")
print("activated:", act.get("activated"), act.get("mode"))
env = cadm.admit(
act,
objective=OBJECTIVE,
builder="wave-ci-e2e-rig",
affected_surface=AFFECTED,
evidence_refs=need["evidence_refs"],
origin="worker",
task_ref="wave-ci-e2e-rig",
expected_new_entities=[
"scripts/ci_e2e_rig.sh (scratch-runner + scratch-repo e2e proof rig, teardown-safe)",
"tests/test_ci_e2e_rig.py (rig contract tests, non-live)",
],
expected_runtime_effects=[
"scripts/ci_e2e_rig.sh registers a scratch Gitea runner, creates a scratch repo, runs a workflow end-to-end, verifies outputs, and tears everything down",
"the workflow script contract tests cover auto-version, tui-release, and maintenance: SIGPIPE pipes and missing tag fallbacks go RED at test time",
],
verification_obligations=[
"tests/test_ci_e2e_rig.py green (rig syntax, dry-run mode, teardown-on-failure contract — nothing live launched)",
"tests/test_workflow_script_contract.py green with the three pipelines covered and the new SIGPIPE/tag-fallback guards provably red-first (mutation spot-check)",
"bash -n clean on scripts/ci_e2e_rig.sh; no live gitea launch during the gaming session",
],
approval_ref="user:50-scale distribution 2026-10-20",
contract_id="ADMIT-wave-ci-e2e-rig",
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())