diff --git a/tests/test_baseline_result.py b/tests/test_baseline_result.py index c4dbdb0b..62054512 100644 --- a/tests/test_baseline_result.py +++ b/tests/test_baseline_result.py @@ -329,3 +329,34 @@ def test_phase9_modules_import_cleanly(): assert hasattr(src.ai_client, "_classify_deepseek_error") assert hasattr(src.ai_client, "_classify_minimax_error") assert hasattr(src.ai_client, "set_provider") + + +# ============ Phase 9 redo tests (TIER1_REVIEW, 4 sites) ============ + +def test_phase9_redo_ai_client_unclear_zero(): + """After Phase 9 redo per TIER1_REVIEW: + - L332, L355 refactored to return ErrorInfo (BOUNDARY_CONVERSION) + - L394, L716, L723, L994 migrated to Result[T] + UNCLEAR should be 0. + """ + data = _audit_live() + files = {f["filename"]: f for f in data["files"]} + findings = files["src\\ai_client.py"]["findings"] + unclear = sum(1 for f in findings if f["category"] == "UNCLEAR") + assert unclear == 0, f"expected ai_client UNCLEAR=0 after Phase 9 redo, got {unclear}" + + +def test_phase9_redo_new_helpers_exist(): + """The new _result helpers added in Phase 9 redo must exist on ai_client.""" + import src.ai_client + assert hasattr(src.ai_client, "_set_minimax_provider_result") + assert hasattr(src.ai_client, "_parse_tool_args_result") + assert hasattr(src.ai_client, "_reread_file_items_result") + + +def test_phase9_redo_modules_import_cleanly(): + """Verify ai_client imports after Phase 9 redo migrations.""" + import src.ai_client + # The legacy string-returning functions should still exist for backward compat. + assert callable(getattr(src.ai_client, "set_provider", None)) + assert callable(getattr(src.ai_client, "_reread_file_items", None))