Private
Public Access
test(baseline): add 3 Phase 9 redo invariant tests (UNCLEAR=0)
TIER-2 READ TIER1_REVIEW Phase 9 redo. Phase 9 redo per TIER1_REVIEW: - Heuristic E added (narrow + structured error carrier) - L332, L355 refactored to return ErrorInfo (now BOUNDARY_CONVERSION) - L394, L716, L723, L994 migrated to Result[T] Audit: ai_client UNCLEAR 6 -> 0. Total tests: 31 pass (was 28).
This commit is contained in:
@@ -329,3 +329,34 @@ def test_phase9_modules_import_cleanly():
|
|||||||
assert hasattr(src.ai_client, "_classify_deepseek_error")
|
assert hasattr(src.ai_client, "_classify_deepseek_error")
|
||||||
assert hasattr(src.ai_client, "_classify_minimax_error")
|
assert hasattr(src.ai_client, "_classify_minimax_error")
|
||||||
assert hasattr(src.ai_client, "set_provider")
|
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))
|
||||||
|
|||||||
Reference in New Issue
Block a user