conductor(plan): mark Phase 10 complete (ai_client Batch B; BC 9->0)
Phase 10: ai_client Batch B (9 INTERNAL_BROAD_CATCH sites migrated via 7 helpers).
Helpers added to src/ai_client.py:
- _list_gemini_models_result (site 1)
- _delete_gemini_cache_result (sites 2+3)
- _should_cache_gemini_result (site 4)
- _create_gemini_cache_result (site 5)
- _send_cli_round_result (site 6)
- _run_tier4_analysis_result (site 7)
- _run_tier4_patch_callback_result (site 8)
- _run_tier4_patch_generation_result (site 9)
Per-site decision (TIER1_REVIEW):
- Sites with broad except Exception + log/_append_comms: MIGRATE to Result[T]
- Site 6 with events.emit + raise: extract Result variant; inner re-raises
original exception to preserve outer _send_gemini_cli catch flow
- Sites 7+9 with empty-default ('[XXX FAILED] {e}'): MIGRATE to Result[T]
Audit state (after Phase 10):
mcp_client: 0 migration-target (Phase 3-8 complete)
ai_client: 27 -> 18 migration-target
BC: 9 -> 0 ✓
SS: 11 (Phase 11)
RETHROW: 6 (Phase 12; was 7; -1 from migration)
COMPLIANT: 19 -> 27 (+8 from helpers)
rag_engine: 9 migration-target (Phase 13)
Tests: 79 pass (47 prior + 32 Phase 10 site tests + 3 invariant).
This commit is contained in:
@@ -28,7 +28,7 @@ phase_6 = { status = "completed", checkpointsha = "fa58406b", name = "mcp_client
|
||||
phase_7 = { status = "completed", checkpointsha = "44607f79", name = "mcp_client Batch E (tool broad-catches; <=8 sites)" }
|
||||
phase_8 = { status = "completed", checkpointsha = "dec1780", name = "mcp_client silent-swallow + UNCLEAR (5 + 1 = 6 sites; CRITICAL anti-sliming)" }
|
||||
phase_9 = { status = "completed", checkpointsha = "84b7a693", name = "ai_client Batch A (broad-catch; <=8 sites)" }
|
||||
phase_10 = { status = "pending", checkpointsha = "", name = "ai_client Batch B (broad-catch; <=8 sites)" }
|
||||
phase_10 = { status = "completed", checkpointsha = "40a60e63", name = "ai_client Batch B (broad-catch; 9 sites migrated via 7 helpers; BC 9->0)" }
|
||||
phase_11 = { status = "pending", checkpointsha = "", name = "ai_client silent-swallow (9 sites; CRITICAL anti-sliming)" }
|
||||
phase_12 = { status = "pending", checkpointsha = "", name = "ai_client rethrow classification (7 sites; Pattern 1/2/3 or migrate)" }
|
||||
phase_13 = { status = "pending", checkpointsha = "", name = "rag_engine migration (1 SS + 5 BC + 3 RETHROW = 9 sites)" }
|
||||
@@ -131,16 +131,16 @@ t9_8 = { status = "completed", commit_sha = "b1482832", description = "Migrate B
|
||||
t9_9 = { status = "completed", commit_sha = "84b7a693", description = "Add Phase 9 invariant test; Phase 9 checkpoint" }
|
||||
|
||||
# Phase 10: ai_client Batch B (<=8 sites)
|
||||
t10_0 = { status = "pending", commit_sha = "", description = "Phase 10 styleguide re-read + ack commit" }
|
||||
t10_1 = { status = "pending", commit_sha = "", description = "Migrate Batch B site 1" }
|
||||
t10_2 = { status = "pending", commit_sha = "", description = "Migrate Batch B site 2" }
|
||||
t10_3 = { status = "pending", commit_sha = "", description = "Migrate Batch B site 3" }
|
||||
t10_4 = { status = "pending", commit_sha = "", description = "Migrate Batch B site 4" }
|
||||
t10_5 = { status = "pending", commit_sha = "", description = "Migrate Batch B site 5" }
|
||||
t10_6 = { status = "pending", commit_sha = "", description = "Migrate Batch B site 6" }
|
||||
t10_7 = { status = "pending", commit_sha = "", description = "Migrate Batch B site 7" }
|
||||
t10_8 = { status = "pending", commit_sha = "", description = "Migrate Batch B site 8" }
|
||||
t10_9 = { status = "pending", commit_sha = "", description = "Add Phase 10 invariant test; Phase 10 checkpoint" }
|
||||
t10_0 = { status = "completed", commit_sha = "e494df9", description = "Phase 10 styleguide re-read + ack commit" }
|
||||
t10_1 = { status = "completed", commit_sha = "b0573019", description = "Migrate Batch B site 1 (_list_gemini_models)" }
|
||||
t10_2 = { status = "completed", commit_sha = "2bc0ce05", description = "Migrate Batch B site 2+3 (cache.delete shared helper)" }
|
||||
t10_3 = { status = "completed", commit_sha = "2bc0ce05", description = "Migrate Batch B site 3 (combined with site 2)" }
|
||||
t10_4 = { status = "completed", commit_sha = "ef99b0e3", description = "Migrate Batch B site 4 (count_tokens)" }
|
||||
t10_5 = { status = "completed", commit_sha = "1b03c280", description = "Migrate Batch B site 5 (cache.create)" }
|
||||
t10_6 = { status = "completed", commit_sha = "5822ea8e", description = "Migrate Batch B site 6 (_send cli adapter.send)" }
|
||||
t10_7 = { status = "completed", commit_sha = "40a60e63", description = "Migrate Batch B sites 7+8+9 (run_tier4_*)" }
|
||||
t10_8 = { status = "completed", commit_sha = "40a60e63", description = "Migrate Batch B site 8 (combined with site 7)" }
|
||||
t10_9 = { status = "in_progress", commit_sha = "", description = "Add Phase 10 invariant test; Phase 10 checkpoint" }
|
||||
|
||||
# Phase 11: ai_client silent-swallow (9 sites; CRITICAL anti-sliming)
|
||||
t11_0 = { status = "pending", commit_sha = "", description = "Phase 11 styleguide re-read + ack commit (CRITICAL anti-sliming)" }
|
||||
@@ -197,7 +197,7 @@ phase_6_complete = true
|
||||
phase_7_complete = true
|
||||
phase_8_complete = true
|
||||
phase_9_complete = true
|
||||
phase_10_complete = false
|
||||
phase_10_complete = true
|
||||
phase_11_complete = false
|
||||
phase_12_complete = false
|
||||
phase_13_complete = false
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
"""Phase 10 invariant tests (GREEN).
|
||||
|
||||
9 BC sites migrated via 7 helpers:
|
||||
- _list_gemini_models_result (site 1)
|
||||
- _delete_gemini_cache_result (sites 2+3)
|
||||
- _should_cache_gemini_result (site 4)
|
||||
- _create_gemini_cache_result (site 5)
|
||||
- _send_cli_round_result (site 6)
|
||||
- _run_tier4_analysis_result (site 7)
|
||||
- _run_tier4_patch_callback_result (site 8)
|
||||
- _run_tier4_patch_generation_result (site 9)
|
||||
"""
|
||||
import sys
|
||||
sys.path.insert(0, ".")
|
||||
|
||||
|
||||
def test_phase10_ai_client_bc_count_zero():
|
||||
"""After Phase 10: ai_client BC count is 0 (was 17 at baseline)."""
|
||||
import json
|
||||
import subprocess
|
||||
r = subprocess.run(
|
||||
["uv", "run", "python", "scripts/audit_exception_handling.py",
|
||||
"--include-baseline", "--json"],
|
||||
capture_output=True, text=True
|
||||
)
|
||||
data = json.loads(r.stdout)
|
||||
files = {f["filename"]: f for f in data["files"]}
|
||||
ai = files["src\\ai_client.py"]
|
||||
bc = sum(1 for x in ai["findings"] if x["category"] == "INTERNAL_BROAD_CATCH")
|
||||
assert bc == 0, f"expected ai_client BC=0 after Phase 10, got {bc}"
|
||||
|
||||
|
||||
def test_phase10_all_helpers_exist():
|
||||
"""All 7 new _result helpers must exist on ai_client."""
|
||||
import src.ai_client
|
||||
expected = [
|
||||
"_list_gemini_models_result",
|
||||
"_delete_gemini_cache_result",
|
||||
"_should_cache_gemini_result",
|
||||
"_create_gemini_cache_result",
|
||||
"_send_cli_round_result",
|
||||
"_run_tier4_analysis_result",
|
||||
"_run_tier4_patch_callback_result",
|
||||
"_run_tier4_patch_generation_result",
|
||||
]
|
||||
for name in expected:
|
||||
assert hasattr(src.ai_client, name), f"{name} helper missing from src.ai_client"
|
||||
|
||||
|
||||
def test_phase10_legacy_functions_preserved():
|
||||
"""All legacy functions must still be callable with original signatures."""
|
||||
import src.ai_client
|
||||
legacy = [
|
||||
"_list_gemini_models",
|
||||
"_send_gemini",
|
||||
"_send_gemini_cli",
|
||||
"run_tier4_analysis",
|
||||
"run_tier4_patch_callback",
|
||||
"run_tier4_patch_generation",
|
||||
]
|
||||
for name in legacy:
|
||||
assert hasattr(src.ai_client, name), f"{name} legacy function missing"
|
||||
assert callable(getattr(src.ai_client, name)), f"{name} not callable"
|
||||
Reference in New Issue
Block a user