Files
rune/scripts/admit_wave_k27_self_transform.py
Nick 834eece4d7 feat(runtime+facade): batch landing — receipt presentation, compaction, composer depth, themes, Sleight wiring, gitignore hygiene, taxonomy
- K27 receipt presentation: full decision+evidence+effect packages,
  expandable sections, UNKNOWN-never-success in every dimension state,
  spine verdicts via evidence.Evaluate (read-only import)
- 2.6-depth compaction: append-per-message (O(1) tail line, 198 bytes
  steady-state), compaction every 64 appends (512/channel hot), cool
  archives per memory-continuity contract, nothing deleted, exact-by-ID
  across compaction+restart+tamper, legacy checkpoints heal on load
- K27 composer depth: 3-line input per old TUI contracts (§2.3 history
  walk, placeholder, stash/restore), deterministic natural-language
  resolution (40+ pinned phrases), palette natural-tier + ctrl+p bind,
  Accessibility profile (keyboard-only/no-color/reduced-motion)
- K27 themes: 10 fixed Go theme tables (byte-exact from Textual 8.2.8,
  not guessed; nord/dracula-default/monokai/solarized/catppuccin/tokyo-
  night/flexoki/gruvbox), /theme command (mirrors _cmd_theme exactly),
  live-editor data shape (staged per-token preview overrides), base bg
  rgb(30,30,40), no-drift drift test anchoring Go to retiring Python
- Sleight live wiring: operator._context_broker registers seventh
  contributor 'continuity' (bucket 2, fail-closed); K16 allowlist
  amended (memory_continuity.working_set); matrices now run against
  the live road; 102 tests green
- .gitignore hygiene: directory-level traps fixed (internal/ re-includes
  .go/.json/.md only; root-anchored /index/ /journal/ /state/; fixtures
  + testdata re-included at any depth); 6-test frozen gate; unified_check
  member wired; real git add (no -f) proven on testmod/internal
- Receipts, compaction, composer, themes, sleight-wiring, hygiene all
  under ADMIT contracts (101+ contracts, 0 research-gate violations)
- main.go NOT landed (chat-live P1 wave owns it, still in flight)
2026-10-17 22:00:03 +01:00

155 lines
6.2 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Admission dispatch for the wave-K27-self-transform build (openspec
task 6.2).
classify + activate + admit (the headless scaffolding entry law,
tests/test_construction_admission.py pattern): the Spec 6.2
self-transformation pipeline runtime — the 13-stage proposal-only
pipeline (PROPOSE → … → ROLLBACK_OR_CLOSE) with D01–D10 and
RM01–RM15 + IAM01–IAM22 binding, every stage gated through the landed
DEP05/DEP06/DEP07 modules, no self-activation possible (D10),
user-dispatch approved.
"""
import json
import os
import subprocess
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__), "..")
SLUG = "wave-K27-self-transform"
RESEARCH_SLUG = "self-transform"
OBJECTIVE = (
"Spec 6.2 self-transformation pipeline runtime (openspec task 6.2): "
"the 13-stage proposal-only pipeline from synthesis "
"exact_candidate_flow (PROPOSE, CONSTRUCTION_CONTRACT, "
"PRE_DECISION_LEDGER, EFFECT_ELIGIBILITY, "
"STATIC_AND_DETERMINISTIC_GUARDS, "
"INDEPENDENT_BEHAVIORAL_QUALIFICATION, READ_ONLY_SHADOW, "
"OWNER_AUTHORIZATION, STAGE_AND_ATTEST, BOUNDED_CANARY_IF_ELIGIBLE, "
"PROMOTE_OR_REJECT, OBSERVE_AND_RECEIPT, ROLLBACK_OR_CLOSE) with "
"D01-D10 owner decisions and RM01-RM15 + IAM01-IAM22 mitigations "
"bound to their enforcing stages. Every stage is gated through the "
"landed prerequisites exercised for real: DEP05 owner_envelope "
"(stage 8 acknowledge/activation-attempt envelopes, one-use law), "
"DEP06 effect_mediation (stage 4 registry enumeration + stage 7 "
"read-only shadow inside a real mediation scope with the sieve "
"verdict), DEP07 self_change_qualification (stage 6 activation_gate "
"over the exact staged generation). Proposal flow end-to-end "
"frozen: no self-activation possible (D10) — stages 9-11 are "
"unreachable, DEP01-DEP04 are not live-proven, and no activation "
"implementation exists in the runtime (deploy_promotion remains the "
"only seam). Red-first frozen battery "
"tests/test_self_transform_pipeline.py proves the full proposal "
"flow, every DEP gate receipt, and the D10 refusal even under a "
"perfectly valid owner activation envelope"
)
AFFECTED = [
"src/rune/self_transform_pipeline.py",
"tests/test_self_transform_pipeline.py",
"scripts/admit_wave_k27_self_transform.py",
]
def run_gate() -> str:
"""The admission-time research gate: BEFORE mint (the research-first
law). Resolves the dedicated self-transform chain."""
cmd = [sys.executable, "scripts/check_research_gate.py", "admit",
"--slug", SLUG, "--objective", OBJECTIVE,
"--research-slug", RESEARCH_SLUG]
r = subprocess.run(cmd, cwd=ROOT, capture_output=True, text=True)
print(r.stdout, end="")
if r.returncode != 0:
print("research gate REFUSED — contract not minted")
raise SystemExit(1)
markers = [line for line in r.stdout.splitlines()
if line.startswith(("exempt:research-gate:",
"research-gate:ALLOW"))]
if not markers:
print("research gate allowed but printed no marker — refusing "
"to mint without a recordable chain marker")
raise SystemExit(1)
return markers[0]
def main() -> int:
marker = run_gate() # gate FIRST — a refusal never reaches the mint
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-k27-self-transform",
"objective": OBJECTIVE,
"origin": "worker",
"project": "rune",
"task_ref": "wave-K27-self-transform",
"affected_surface": AFFECTED,
"evidence_refs": [
marker,
"docs/openspec/changes/add-native-rune-tui/tasks.md",
"research/harness-survey/self-transformation/synthesis.json",
"research/harness-survey/self-transformation/qualify.json",
],
}
act = cact.activate(md, need=need, scaffold=scaffold,
builder="wave-K27-self-transform")
print("activated:", act.get("activated"), act.get("mode"))
env = cadm.admit(
act,
objective=OBJECTIVE,
builder="wave-K27-self-transform",
affected_surface=AFFECTED,
evidence_refs=need["evidence_refs"],
origin="worker",
task_ref="wave-K27-self-transform",
expected_new_entities=[
"src/rune/self_transform_pipeline.py (13-stage proposal-only "
"runtime; D01-D10 + RM/IAM bindings; DEP05/06/07 exercised; "
"D10 freeze)",
"tests/test_self_transform_pipeline.py (36 frozen tests: "
"stage universe, per-stage gates, DEP gate receipts, "
"no-self-activation, journal integrity, end-to-end flow)",
],
expected_runtime_effects=[
"self-change candidates flow propose → … → owner "
"authorization as PROPOSALS only; the runtime structurally "
"refuses activation (SELF_ACTIVATION_IMPOSSIBLE) even with "
"a valid owner envelope until DEP01-DEP04 repairs are "
"live-proven",
],
verification_obligations=[
"PYTHONPATH=src python -m pytest "
"tests/test_self_transform_pipeline.py green (36 frozen "
"tests) plus neighbor batteries test_owner_envelope, "
"test_effect_mediation, test_self_change_qualification "
"green (114 combined)",
],
approval_ref=f"user:wave-K27-self-transform dispatch; {marker}",
contract_id="ADMIT-wave-K27-self-transform",
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())