Files
rune/scripts/admit_wave_graph_projection.py
T
Nick a1cc0c7721 feat(tui+research): graph projection 5.5 + wazero-vs-IPC trial
- tui/graphproj: read-only headless graph projection — bi-temporal model,
  one resolution path feeding text/table/tree + JSON/DOT/Mermaid/SVG
  exports (contradictory-temporal-fact resolves IDENTICALLY everywhere);
  opaque deep links with literal fallback; versioned router with typed
  stale-link errors; honest pagination; typed degradation; non-semantic
  layout; no-graphics mode complete. 15 tests red-first. Main-session
  verify: green own run.
- wazero-vs-ipc-trial.json: Rust->wasm32-wasip1 under wazero (AOT) vs
  Go-subprocess JSONL — wasm MATCHES IPC per-item at batch-1000
  (11.5us vs 11.5us), WINS 2-8x below (cold 151us vs 1176us); trap
  isolation verified (guest abort = host-survives error); crossover
  ~batch-1000 on this machine. Real Rust toolchain used (serde_json),
  /tmp bench sources, zero repo pollution.
2026-10-16 23:16:02 +01:00

112 lines
3.9 KiB
Python

"""Admission dispatch for wave graph-projection (openspec task 5.5).
classify + activate + admit (the headless scaffolding entry law,
tests/test_construction_admission.py pattern): the headless graph
projection build on the existing rune project, 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 = (
"headless graph projection (openspec add-native-rune-tui task 5.5, "
"I-R2-015 seam admitted with consumer fixture + deletion test): a new "
"read-only tui/graphproj package — search/tree/table/text views plus "
"JSON/DOT/Mermaid/SVG exports over the bi-temporal memory graph; "
"opaque read-only deep-link IDs with a literal no-router fallback; a "
"versioned router returning typed stale-link errors; pagination; "
"typed degradation; layout explicitly non-semantic; contradictory "
"temporal facts resolved by ONE resolution path identical through "
"every view and export; mutations only through domain APIs (this "
"package never writes)"
)
AFFECTED = [
"tui/graphproj/doc.go",
"tui/graphproj/model.go",
"tui/graphproj/resolve.go",
"tui/graphproj/link.go",
"tui/graphproj/router.go",
"tui/graphproj/view.go",
"tui/graphproj/export.go",
"tui/graphproj/layout.go",
"tui/graphproj/README.md",
"tui/graphproj/graphproj_test.go",
"tui/graphproj/frozen_test.go",
"tui/graphproj/testdata/temporal-fact-text.v1.txt",
"tui/graphproj/testdata/temporal-fact-table.v1.txt",
"tui/graphproj/testdata/deep-link-fallback.v1.txt",
"scripts/admit_wave_graph_projection.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-graph-projection",
"objective": OBJECTIVE,
"origin": "worker",
"project": "rune",
"task_ref": "wave-graph-projection",
"affected_surface": AFFECTED,
"evidence_refs": [
"docs/openspec/changes/add-native-rune-tui/tasks.md",
"docs/openspec/changes/add-native-rune-tui/specs/memory-context-continuity/spec.md",
"src/rune/graph_memory.py",
"tui/memory/README.md",
],
}
act = cact.activate(md, need=need, scaffold=scaffold,
builder="wave-graph-projection")
print("activated:", act.get("activated"), act.get("mode"))
env = cadm.admit(
act,
objective=OBJECTIVE,
builder="wave-graph-projection",
affected_surface=AFFECTED,
evidence_refs=need["evidence_refs"],
origin="worker",
task_ref="wave-graph-projection",
expected_new_entities=[
"tui/graphproj (package)",
"scripts/admit_wave_graph_projection.py",
],
expected_runtime_effects=[
"contradictory temporal facts resolve identically through text, table and export views",
"stale deep links return typed stale-link errors, never a wrong node",
],
verification_obligations=[
"go test ./... in tui/ green",
"unified_check --members go_suite green",
],
approval_ref="user:wave-graph-projection dispatch",
contract_id="ADMIT-wave-graph-projection",
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())