- 18O: ONE canonical structural Scaffold of Scaffolding itself (store/scaffold/structural.json — 31 entities, 46 authority-graded relationships: domains/subsystems/components with real source paths, state stores, verification, deployment, the bounded build_mode adapter marked legacy_of). 5 consistency held-outs: sources exist, no duplicate truth with Spine, legacy not hidden, schema known to consent machinery. - 18P SELF-SCAFFOLDED UPGRADE PROOF: contract 18q-graph-projection driven end-to-end FROM the maintained scaffold — structural lookup → contextually-generated research plan → qualified Build Basis → impact closure → visible preview → contract+workspace record → event-bridged verification (resumed via event, verdict success) → authority re-read → scaffold updated by the model itself → closed. All 11 steps scaffold-driven; zero architecture rediscovery. - 18Q: graph_projection.py — stable versioned READ-ONLY projection (JSON/DOT/Mermaid) over structural truth; never an authority. 4 held-outs incl. read-only proof. - 18N generalisation: adversarial paraphrase families (37 unseen phrases across 6 tests) found and fixed 4 REAL semantic gaps: negation frames, idiom-prefix imperatives, modal+proposal referent ordering, all-stale-proposals fallthrough, preceding-context relative-that disambiguation. - 18M full backend convergence: /build start now MINTS a canonical Construction Contract (classified) before BuildManager — no route runs an independent construction state machine. Suite 1966 green; ratchets PASS.
76 lines
2.7 KiB
Python
76 lines
2.7 KiB
Python
"""test_self_scaffold.py — T18 §18O: Scaffolding models ITSELF in ONE
|
|
canonical structural Scaffold; consistency is enforced by tests, not
|
|
hoped for."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
REPO = Path(__file__).resolve().parent.parent
|
|
sys.path.insert(0, str(REPO / "src"))
|
|
|
|
from rune import structural_model as sm # noqa: E402
|
|
from rune import structural_migration as mig # noqa: E402
|
|
|
|
STORE = REPO / "store" / "scaffold"
|
|
|
|
|
|
def _model():
|
|
return sm.StructuralModel(STORE, "scaffolding")
|
|
|
|
|
|
def test_18o_self_scaffold_exists_and_is_versioned():
|
|
m = _model()
|
|
assert m.get("project:scaffolding") is not None
|
|
assert m.doc.get("schema_version") == sm.SCHEMA_VERSION
|
|
|
|
|
|
def test_18o_all_modeled_sources_exist_in_reality():
|
|
"""Every component with a source path must point at a REAL file —
|
|
the self-scaffold cannot drift into fiction (18H principle)."""
|
|
m = _model()
|
|
checked = 0
|
|
for e in m.doc["entities"]:
|
|
src = (e.get("ext") or {}).get("source") or \
|
|
(e.get("identities") or {}).get("source")
|
|
if src:
|
|
assert (REPO / src).is_file(), f"{e['id']} → missing {src}"
|
|
checked += 1
|
|
assert checked >= 15 # the model covers the real surface
|
|
|
|
|
|
def test_18o_no_duplicate_structural_truth_with_spine():
|
|
"""Spine owns Rune's self-model; the project scaffold models the
|
|
SCAFFOLDING project. Same generic core, separate stores — the
|
|
relationship is defined, not duplicated (rule K)."""
|
|
import json
|
|
spine_doc = json.loads((REPO / "store/spine/current.json").read_text())
|
|
project = _model()
|
|
# both use kind:id entities (shared discipline) but the project model
|
|
# carries domains/subsystems Spine does not duplicate as Rune modules
|
|
spine_ids = {e["id"] for e in spine_doc["entities"]}
|
|
for e in project.doc["entities"]:
|
|
if e["kind"] in ("domain", "subsystem"):
|
|
assert e["id"] not in spine_ids # no cross-store duplication
|
|
|
|
|
|
def test_18o_legacy_adapter_is_marked_not_hidden():
|
|
m = _model()
|
|
adapter = m.get("component:build_mode_adapter")
|
|
assert adapter is not None
|
|
assert adapter.get("ext", {}).get("bounded_adapter") is True
|
|
sup = m.supersession("component:build_mode_adapter")
|
|
assert "subsystem:kernel" in sup["legacy_of"]
|
|
|
|
|
|
def test_18o_schema_version_known_to_consent_machinery():
|
|
m = _model()
|
|
# a hypothetical uplift to v2 would classify by its changes
|
|
assert mig.classify_migration(
|
|
from_v=m.doc["schema_version"], to_v=2,
|
|
changes=["add optional kind 'capability'"]) == "MINOR"
|
|
assert mig.classify_migration(
|
|
from_v=m.doc["schema_version"], to_v=2,
|
|
changes=["rename belongs_to to part_of"]) == "MATERIAL"
|