diff --git a/tests/test_cruft_removal.py b/tests/test_cruft_removal.py index fb82c829..e23d7b4c 100644 --- a/tests/test_cruft_removal.py +++ b/tests/test_cruft_removal.py @@ -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)" ) \ No newline at end of file