Files
rune/scripts/admit_wave_k24_responsive_changes.py
Nick 7253976a98 feat(tui+runtime): K24 responsive changes-view 3.2 — selective rewind through the real engine
tui/changes: side-by-side/unified/auto layout (SplitMinWidth=83, s
cycles, manual survives resize); runtime wiring drives the restore-
points engine via its public CLI (separate module, internal by law);
selective external-file restore (overwrite preview per file, sha-
compared, WILL RESTORE/WILL OVERWRITE, J/K + space toggle, v restores
ONLY selected); one-command revert through the REAL engine (tests build
the actual binary); dirty-tree protection live (blocked-dirty before
any engine call). Engine: additive RewindFiles + --file (unknown path
refuses whole; 3.1 semantics byte-identical). 8 stub failures red-first;
all frozen suites green incl -race, -count=3. Main-session verify:
changes green + race own run.
2026-10-17 17:40:09 +01:00

138 lines
5.5 KiB
Python

"""Admission dispatch for wave K24 responsive changes-view runtime
wiring (spec 3.2 depth).
classify + activate + admit (the headless scaffolding entry law,
scripts/admit_wave_k15_cooling.py pattern): the responsive
changes-view runtime wiring on the landed tui/changes groundwork and
the landed restore-points engine, 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 = (
"spec 3.2 responsive changes-view runtime wiring on the tui/changes "
"groundwork: side-by-side wide / unified narrow / manual layout "
"switch (s cycles auto->split->unified, SplitMinWidth=83, resize "
"responsive), selective external-file overwrite preview (exact "
"paths, saved size, sha-compared current state, WILL RESTORE / "
"WILL OVERWRITE, J/K file cursor + space toggle, v restores ONLY "
"selected files, external point with no selection refuses "
"select-files), one-command revert executed through the REAL "
"restore-points engine via its public process surface (rewind "
"files-only, additive --file selective filter with "
"unknown-path-refuses-whole so broad directory rollback does not "
"exist), and dirty-tree protection live off git status "
"--porcelain checked at act time (blocked-dirty before any engine "
"call). Seed mode unchanged: every frozen groundwork path and "
"fixture byte-identical."
)
AFFECTED = [
"tui/changes/layout.go",
"tui/changes/layout_test.go",
"tui/changes/runtime.go",
"tui/changes/runtime_test.go",
"tui/changes/changes.go",
"tui/changes/render.go",
"tui/changes/README.md",
"tui/changes/testdata/diff-edit-split.v1.txt",
"tui/changes/testdata/diff-new-split.v1.txt",
"tui/changes/testdata/diff-delete-split.v1.txt",
"tui/changes/testdata/diff-binary-split.v1.txt",
"tui/changes/testdata/diff-identical-split.v1.txt",
"src/go/restore-points/internal/restorepoints/rewind.go",
"src/go/restore-points/internal/restorepoints/cli.go",
"src/go/restore-points/internal/restorepoints/rewind_select_test.go",
"scripts/admit_wave_k24_responsive_changes.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-k24-responsive-changes",
"objective": OBJECTIVE,
"origin": "worker",
"project": "rune",
"task_ref": "wave-K24-responsive-changes",
"affected_surface": AFFECTED,
"evidence_refs": [
"docs/openspec/changes/add-native-rune-tui/specs/"
"file-change-safety/spec.md",
"tui/changes/README.md",
"src/go/restore-points/internal/restorepoints/engine.go",
"src/go/restore-points/internal/restorepoints/rewind.go",
],
}
act = cact.activate(md, need=need, scaffold=scaffold,
builder="wave-K24-responsive-changes")
print("activated:", act.get("activated"), act.get("mode"))
env = cadm.admit(
act,
objective=OBJECTIVE,
builder="wave-K24-responsive-changes",
affected_surface=AFFECTED,
evidence_refs=need["evidence_refs"],
origin="worker",
task_ref="wave-K24-responsive-changes",
expected_new_entities=[
"tui/changes/layout.go (split renderer + layout law)",
"tui/changes/runtime.go (engine/VCS process seam)",
"tui/changes/layout_test.go (frozen width matrix)",
"tui/changes/runtime_test.go (frozen engine-real suite)",
"tui/changes/testdata/diff-<case>-split.v1.txt (5 fixtures)",
"src/go/restore-points/internal/restorepoints/"
"rewind_select_test.go (frozen selective-rewind suite)",
],
expected_runtime_effects=[
"v on a live point restores files on disk through the real "
"restore-points engine and records the engine result in "
"the receipt",
"an external point restores ONLY the space-selected files; "
"v with no selection refuses select-files and changes "
"nothing",
"a revert target touching a file dirty in git status "
"refuses blocked-dirty before any engine call, leaving "
"your bytes byte-identical",
"rewind --file with a path outside the point refuses the "
"whole restore (no broad rollback)",
],
verification_obligations=[
"cd tui && go test ./changes/ -count=1 green (also -race), "
"go build ./... and go vet clean, gofmt clean",
"cd src/go/restore-points && go test ./... -count=1 green "
"(landed 3.1 suite unbroken by the additive --file "
"surface), go vet clean",
],
approval_ref="user:wave-K24-responsive-changes dispatch",
contract_id="ADMIT-wave-K24-responsive-changes",
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())