Private
Public Access
0
0

test(cruft_removal): Phase 9 invariant tests (4 tests; verify wrappers + tests)

Phase 9 (Patch Phase) invariant tests per Tier 1's spec.md §12.6:

1. test_phase9_audit_legacy_wrappers_finds_zero: 0 legacy wrappers
2. test_phase9_baseline_tests_31_of_31_pass: 31/31 baseline tests pass
3. test_phase9_gui_2_wrappers_gone: _detect_refresh_rate_win32 +
   _resolve_font_path deleted from src/gui_2.py
4. test_phase9_rag_engine_chunk_code_gone: RAGEngine._chunk_code deleted

The 3 wrappers Tier 1 said were remaining in the tier-2-clone
(per the remote-tracking branch at 8f6d044d) are actually all
gone in the merged branch state. The 7 originally-failing baseline
tests all pass.

This is the Phase 9 task 5 deliverable: invariant test that verifies
the 3 wrappers and 7 tests with REAL pytest output, not claimed counts.

Test result: 4/4 Phase 9 tests pass. Total cruft_removal tests: 18.
This commit is contained in:
2026-06-21 08:41:10 -04:00
parent 9e89bdc784
commit 84af01a777
+54
View File
@@ -175,4 +175,58 @@ def test_phase6_audit_finds_zero_wrappers_in_src():
)
assert "Found 0 legacy wrappers" in r.stdout, (
f"expected 0 legacy wrappers in src/, but audit found:\n{r.stdout[:500]}"
)
# ============ Phase 9 (Patch Phase — corrective verification) ============
def test_phase9_audit_legacy_wrappers_finds_zero():
"""Phase 9 invariant: scripts/audit_legacy_wrappers.py finds 0 legacy wrappers in src/.
The 3 wrappers Tier 1 said were remaining in the tier-2-clone
(_detect_refresh_rate_win32, _resolve_font_path, _chunk_code) are
actually all gone in the merged branch state.
"""
r = subprocess.run(
["uv", "run", "python", "scripts/audit_legacy_wrappers.py"],
capture_output=True, text=True,
)
assert "Found 0 legacy wrappers" in r.stdout, (
f"Phase 9 invariant: expected 0 legacy wrappers; audit found:\n{r.stdout[:500]}"
)
def test_phase9_baseline_tests_31_of_31_pass():
"""Phase 9 invariant: the 7 originally-failing baseline tests all pass.
Tier 1's spec said 7 tests were failing; the merged branch state
has all 31 tests passing. The 7 scaffolding failures were fixed in
Phase 1 (synthesized PHASE1_AUDIT_BASELINE.json from inventory docs).
"""
r = subprocess.run(
["uv", "run", "python", "-m", "pytest", "tests/test_baseline_result.py",
"--tb=no", "-q"],
capture_output=True, text=True,
)
assert "31 passed" in r.stdout, (
f"Phase 9 invariant: expected 31/31 baseline tests to pass; got:\n{r.stdout[-500:]}"
)
def test_phase9_gui_2_wrappers_gone():
"""Phase 9 invariant: gui_2._detect_refresh_rate_win32 + _resolve_font_path are DELETED."""
from src import gui_2
assert not hasattr(gui_2, "_detect_refresh_rate_win32"), (
"_detect_refresh_rate_win32 wrapper STILL EXISTS (should be deleted)"
)
assert not hasattr(gui_2, "_resolve_font_path"), (
"_resolve_font_path wrapper STILL EXISTS (should be deleted)"
)
def test_phase9_rag_engine_chunk_code_gone():
"""Phase 9 invariant: RAGEngine._chunk_code is DELETED."""
from src.rag_engine import RAGEngine
assert not hasattr(RAGEngine, "_chunk_code"), (
"RAGEngine._chunk_code STILL EXISTS (should be deleted)"
)