89 lines
2.8 KiB
Python
89 lines
2.8 KiB
Python
"""SCAFFOLD-TRANCHE-0012 §12E: proportional depth held-out matrix."""
|
|
import os
|
|
import sys
|
|
|
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src"))
|
|
|
|
from rune.construction_depth import select_depth # noqa: E402
|
|
|
|
|
|
def test_typo_light():
|
|
d = select_depth("LOCAL_CHANGE", objective="fix typo",
|
|
affected_surface=["src/x.py"])
|
|
assert d.level == "LIGHT"
|
|
assert "project bootstrap" in " ".join(d.bypassed)
|
|
|
|
|
|
def test_small_bounded_parser_fix_light():
|
|
d = select_depth("LOCAL_CHANGE", objective="fix parser edge case",
|
|
affected_surface=["src/parser.py"])
|
|
assert d.level == "LIGHT"
|
|
|
|
|
|
def test_schema_migration_standard_escalates():
|
|
d = select_depth("EXISTING_PROJECT_CHANGE", has_migration=True)
|
|
assert d.level in ("STANDARD", "FULL")
|
|
assert "migration proof" in " ".join(d.ceremony)
|
|
|
|
|
|
def test_breaking_api_full():
|
|
d = select_depth("EXISTING_PROJECT_CHANGE", breaking=True,
|
|
has_migration=True)
|
|
assert d.level == "FULL"
|
|
|
|
|
|
def test_ui_user_locked_retains_obligation_at_light():
|
|
d = select_depth("LOCAL_CHANGE", user_locked_layout=True)
|
|
assert d.level == "LIGHT"
|
|
assert "layout obligation check" in " ".join(d.ceremony)
|
|
|
|
|
|
def test_new_skill_standard():
|
|
d = select_depth("EXISTING_PROJECT_CHANGE")
|
|
assert d.level == "STANDARD"
|
|
|
|
|
|
def test_new_standalone_project_full():
|
|
d = select_depth("PROJECT_BUILD")
|
|
assert d.level == "FULL"
|
|
assert "project bootstrap" in " ".join(d.ceremony)
|
|
|
|
|
|
def test_ambiguous_unresolved_not_light():
|
|
"""§13C: UNKNOWN means construction hasn't started — not LIGHT."""
|
|
d = select_depth("UNKNOWN")
|
|
assert d.level == "UNRESOLVED"
|
|
assert "probe" in " ".join(d.ceremony)
|
|
|
|
|
|
def test_non_construction_no_construction_depth():
|
|
"""§13C: NOT_CONSTRUCTION has NO construction depth — not LIGHT."""
|
|
d = select_depth("NOT_CONSTRUCTION")
|
|
assert d.level == "NONE"
|
|
assert d.bypassed == ["all"]
|
|
|
|
|
|
def test_wide_surface_escalates_to_full():
|
|
d = select_depth("EXISTING_PROJECT_CHANGE",
|
|
affected_surface=[f"f{i}.py" for i in range(8)])
|
|
assert d.level == "FULL"
|
|
|
|
|
|
def test_high_uncertainty_probe_first():
|
|
d = select_depth("EXISTING_PROJECT_CHANGE", uncertainty="high")
|
|
assert d.ceremony[0] == "evidence probe"
|
|
|
|
|
|
def test_small_never_bypasses_governance():
|
|
"""Invariant: 'small' means proportional, not bypassed."""
|
|
d = select_depth("LOCAL_CHANGE")
|
|
assert "classification" in " ".join(d.ceremony)
|
|
assert "durable result" in " ".join(d.ceremony)
|
|
|
|
|
|
def test_one_line_typo_no_six_artefacts():
|
|
"""Invariant: a one-line typo doesn't create meaningless ceremony."""
|
|
d = select_depth("LOCAL_CHANGE")
|
|
assert len(d.ceremony) <= 5 # classification + scope + verify + durable
|
|
assert "patterns" in " ".join(d.bypassed)
|