Private
Public Access
TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 5: refactor(mcp_client): migrate 8 Batch C sites to Result[T]
Phase 5 Batch C (8 INTERNAL_BROAD_CATCH sites in mcp_client.py): Added _result variants in the Result Variants region: - ts_cpp_get_definition_result - ts_cpp_get_signature_result - ts_cpp_update_definition_result - py_get_skeleton_result (uses ASTParser) - py_get_code_outline_result (uses outline_tool, NOT ASTParser) - py_get_symbol_info_result (returns Result[tuple[str, int]]) - py_get_definition_result (uses ast.parse directly) - py_update_definition_result (delegates to set_file_slice_result) Each legacy string-returning function now delegates to its _result variant; the try/except Exception is REMOVED from the legacy function. The _result variants for py_* functions use ast.parse directly (matching the existing implementation pattern). py_get_code_outline_result uses outline_tool (not ASTParser as originally assumed). Phase 4 test loosened (BC<=24, total MIG<=72) to allow Batch C overshoot. Audit: mcp_client BC 24 -> 16. Total MIG 72 -> 64.
This commit is contained in:
@@ -155,23 +155,25 @@ def test_phase3_audit_baseline_matches_phase1_audit_json():
|
||||
# ============ Phase 4 tests (3) ============
|
||||
|
||||
def test_phase4_mcp_client_broad_catch_decreased_to_24():
|
||||
"""Phase 4 Batch B migrated 8 more BC sites (32 -> 24)."""
|
||||
"""Phase 4 Batch B migrated 8 more BC sites (32 -> 24).
|
||||
Loosened to <=24 to allow Phase 5 Batch C to overshoot (the Batch C
|
||||
partial migration reduces BC further)."""
|
||||
data = _audit_live()
|
||||
files = {f["filename"]: f for f in data["files"]}
|
||||
findings = files["src\\mcp_client.py"]["findings"]
|
||||
bc = sum(1 for f in findings if f["category"] == "INTERNAL_BROAD_CATCH")
|
||||
assert bc == 24, f"expected mcp_client BC=24 after Phase 4, got {bc}"
|
||||
assert bc <= 24, f"expected mcp_client BC<=24 after Phase 4, got {bc}"
|
||||
|
||||
|
||||
def test_phase4_total_migration_target_decreased_to_72():
|
||||
"""Total MIG was 88; after Phase 4 Batch B it's 88 - 16 = 72."""
|
||||
"""Total MIG was 88; after Phase 4 Batch B it's <= 88 - 16 = 72."""
|
||||
data = _audit_live()
|
||||
files = {f["filename"]: f for f in data["files"]}
|
||||
total = 0
|
||||
for key in TARGETS:
|
||||
findings = files[key]["findings"]
|
||||
total += sum(1 for f in findings if f["category"] in MIG)
|
||||
assert total == 72, f"expected total MIG=72 after Phase 4, got {total}"
|
||||
assert total <= 72, f"expected total MIG<=72 after Phase 4, got {total}"
|
||||
|
||||
|
||||
def test_phase4_modules_import_cleanly():
|
||||
|
||||
Reference in New Issue
Block a user