Private
Public Access
0
0

docs(artifacts): Phase 2 wrapper inventory (9 P1 cruft sites; per-file mapping for Phases 3-7)

Phase 2 inventory output: 9 legacy wrappers (all P1 drop-errors-via-.data).
- Phase 3 (mcp_client): 1 (_resolve_and_check)
- Phase 4 (ai_client): 5 (_reread_file_items, _list_anthropic_models, _list_gemini_models, _extract_gemini_thoughts, _list_minimax_models)
- Phase 5 (rag_engine): 1 (_chunk_code)
- Phase 6 (gui_2): 2 (_detect_refresh_rate_win32, _resolve_font_path)

Source-of-truth note: PHASE1_AUDIT_BASELINE.json was gitignored and lost;
this inventory was regenerated from a current-tree scan via
scripts/audit_legacy_wrappers.py (revised to exclude the proper _result
helpers themselves from the wrapper pattern).
This commit is contained in:
2026-06-20 19:41:48 -04:00
parent a61b025158
commit 102f219904
+60
View File
@@ -0,0 +1,60 @@
# Phase 2 — Legacy Wrapper Inventory
**Generated:** 2026-06-20
**Total legacy wrappers found:** 9 (all P1 — `return _x_result(...).data` patterns)
## Source-of-truth note
The `tests/artifacts/PHASE1_AUDIT_BASELINE.json` was lost (gitignored; not in any branch).
This inventory was generated by `scripts/audit_legacy_wrappers.py` against the CURRENT
(post-migration) `src/` tree, which is the correct surface for the wrapper removal work.
The audit script (revised in this phase) flags ONLY functions that:
1. Have a `_x` name (private)
2. Their body calls `_x_result(...)` (the proper Result helper)
3. They unwrap `.data` (P1) or just return the Result (P3)
Functions whose own name ends in `_result` (the proper Result helpers themselves)
are NOT wrappers — they ARE the Result-returning helpers.
## Per-file legacy wrappers (9 total)
| # | File | Line | Wrapper | Pattern | In-site callers | Notes |
|---|------|------|---------|---------|-----------------|-------|
| 1 | src/mcp_client.py | 175 | `_resolve_and_check` | P1 | 7 (internal use + dispatch_tool_call) | Returns tuple[Path\|None, str]; drops ErrorInfo structure. Used as a quick-rejection helper inside the MCP dispatch boundary. |
| 2 | src/rag_engine.py | 250 | `_chunk_code` | P1 | 2 (self + caller) | Returns str on success, formatted error on failure; drops ErrorInfo. |
| 3 | src/gui_2.py | 227 | `_detect_refresh_rate_win32` | P1 | 2 (self + caller) | Returns float refresh rate; on failure returns 0.0 (drops ErrorInfo). |
| 4 | src/gui_2.py | 277 | `_resolve_font_path` | P1 | 2 (self + caller) | Returns Path or None on failure (drops ErrorInfo). |
| 5 | src/ai_client.py | 1073 | `_reread_file_items` | P1 | 5 | Returns list[dict]; drops ErrorInfo. |
| 6 | src/ai_client.py | 1358 | `_list_anthropic_models` | P1 | 2 | Returns list[str]; drops ErrorInfo. |
| 7 | src/ai_client.py | 1668 | `_list_gemini_models` | P1 | 2 | Returns list[str]; drops ErrorInfo. |
| 8 | src/ai_client.py | 1815 | `_extract_gemini_thoughts` | P1 | 2 | Returns str; drops ErrorInfo. |
| 9 | src/ai_client.py | 2487 | `_list_minimax_models` | P1 | 5 | Returns list[str]; drops ErrorInfo. |
## Patterns NOT flagged (and why)
- **All `def _x_result(...):` functions** (91 total): these ARE the proper Result helpers.
- **Public `def tool_name(...):` functions in mcp_client.py** (search_files, list_directory, etc.):
These are MCP protocol boundaries; they MUST return `str` per the JSON-RPC wire format.
They are protocol drain points, not internal cruft.
- **Functions that don't call their sibling `_result` variant**: not wrappers.
## Audit script revision
The original `scripts/audit_legacy_wrappers.py` (per spec §Plan Task 2.1) had a bug:
it flagged any function with `_result(` in its body, including the proper helpers
themselves (which call OTHER `_result` helpers). The fix is in `is_legacy_wrapper`:
require the function name NOT to end in `_result`, AND the body must call
`name + "_result"` specifically (its sibling helper).
This narrowed the finding from 111 (false-positive inflated) to 9 (true legacy wrappers).
## Phase 3-7 mapping
| Phase | File | Wrappers |
|-------|------|----------|
| 3 | src/mcp_client.py | `_resolve_and_check` (1) |
| 4 | src/ai_client.py | `_reread_file_items`, `_list_anthropic_models`, `_list_gemini_models`, `_extract_gemini_thoughts`, `_list_minimax_models` (5) |
| 5 | src/rag_engine.py | `_chunk_code` (1) |
| 6 | src/gui_2.py | `_detect_refresh_rate_win32`, `_resolve_font_path` (2) |
| 7 | (none) | — |