docs(track): result_migration_review_pass decisions for src/ai_client.py INTERNAL_RETHROW (6 PATTERN_1, 0 migration-target)
This commit is contained in:
@@ -136,7 +136,18 @@ Other audit findings (unchanged by this review pass):
|
||||
|
||||
### 2.7 `src/ai_client.py` — INTERNAL_RETHROW sites (6, baseline)
|
||||
|
||||
*(filled in Task 3.1)*
|
||||
| Line | Context | Snippet | Decision | Pattern / Rationale |
|
||||
|---|---|---|---|---|
|
||||
| 277 | `_load_credentials` (file load) | `except FileNotFoundError: raise FileNotFoundError(...)` with helpful setup message | **PATTERN_1** | Catch + convert + raise as same type with better message. Provides actionable instructions in the error message. Baseline transition pattern. |
|
||||
| 801 | `_default_send` (Result→Exception bridge) | `if not res.ok: ... raise res.errors[0].original` | **PATTERN_1** | Result→Exception bridge: re-raise original SDK exception. Legacy callers expect exceptions; the Result layer above provides the structured error info |
|
||||
| 802 | `_default_send` (Result→Exception bridge) | `raise RuntimeError(res.errors[0].message if res.errors else "Unknown OpenAI error")` | **PATTERN_1** | Result→Exception bridge: convert Result error to RuntimeError. Same as L801 |
|
||||
| 1234 | `_list_anthropic_models` (Anthropic SDK) | `except Exception as exc: raise _classify_anthropic_error(exc) from exc` | **PATTERN_1** | Catch + convert + raise as different type: convert raw SDK exception to structured ErrorInfo. `from exc` preserves the traceback |
|
||||
| 1529 | `_list_gemini_models` (Gemini SDK) | `except Exception as exc: raise _classify_gemini_error(exc) from exc` | **PATTERN_1** | Same as L1234, Gemini SDK |
|
||||
| 2520 | `_dashscope_call` (Qwen/DashScope SDK) | `if status_code != 200: raise classify_dashscope_error(...)` | **PATTERN_1** | Result→Exception bridge: explicit raise on API non-200 status. Caller (Result-based) catches and converts. No try/except in this function; the raise is the explicit "this is a domain error" path |
|
||||
|
||||
**Subtotals:** 6 PATTERN_1 + 0 PATTERN_2/3 + 0 migration-target.
|
||||
|
||||
**Note:** All 6 baseline ai_client INTERNAL_RETHROW sites are the "Result→Exception bridge" pattern. This is the canonical pattern for the baseline transition: Result-based provider functions still raise on hard failures for legacy callers, but the convention layer above catches and converts to a Result. The 2026-06-12 refactor intentionally preserved this pattern for the boundary.
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user