diff --git a/tests/test_baseline_result.py b/tests/test_baseline_result.py index 4b5015ec..c4dbdb0b 100644 --- a/tests/test_baseline_result.py +++ b/tests/test_baseline_result.py @@ -300,3 +300,32 @@ def test_phase8_modules_import_cleanly(): # derive_code_path_result; these are integration tests, not attribute tests. assert hasattr(src.mcp_client, "py_find_usages_result") assert hasattr(src.mcp_client, "derive_code_path_result") + + +# ============ Phase 9 tests (3) ============ + +def test_phase9_ai_client_broad_catch_decreased(): + """After Phase 9 Batch A (8 BC sites migrated), ai_client BC <= 9 (17 - 8).""" + data = _audit_live() + files = {f["filename"]: f for f in data["files"]} + findings = files["src\\ai_client.py"]["findings"] + bc = sum(1 for f in findings if f["category"] == "INTERNAL_BROAD_CATCH") + assert bc <= 9, f"expected ai_client BC<=9 after Phase 9, got {bc}" + + +def test_phase9_ai_client_silent_swallow_count(): + """After Phase 9, ai_client INTERNAL_SILENT_SWALLOW count is recorded for Phase 11.""" + data = _audit_live() + files = {f["filename"]: f for f in data["files"]} + findings = files["src\\ai_client.py"]["findings"] + ss = sum(1 for f in findings if f["category"] == "INTERNAL_SILENT_SWALLOW") + # Some sites moved from BC to SS via exception narrowing; record for Phase 11. + assert ss >= 0, f"ss count check (informational): {ss}" + + +def test_phase9_modules_import_cleanly(): + """Verify ai_client imports after Batch A migrations.""" + import src.ai_client + assert hasattr(src.ai_client, "_classify_deepseek_error") + assert hasattr(src.ai_client, "_classify_minimax_error") + assert hasattr(src.ai_client, "set_provider")