Private
Public Access
0
0
Files
manual_slop/src
ed 1e323cae7d refactor(rag_engine): migrate _async_search_mcp JSON parse to Result[T] (Phase 13 site 5)
Site 5 (BC at L290): _async_search_mcp (nested in _search_mcp) had:
    try:
        data = json.loads(res_str)
        if isinstance(data, list): return data
        elif isinstance(data, dict) and 'results' in data: return data['results']
        return []
    except:
        return []

Body: bare 'except:' + return [] = empty default = SS-style violation.

Migrated to Result[T] via new module-level helper _parse_search_response_result:
- Returns Result(data=parsed_list) on success
- Returns Result(data=None, errors=[ErrorInfo]) on JSON parse failure
- Handles the list/dict/no-results branch logic

The helper is module-level (does not use self) and is placed BEFORE
class RAGEngine to avoid breaking the class definition (a def at column 0
inside a class ends the class prematurely).

Legacy _async_search_mcp delegates to the helper; on Result errors,
returns [] (preserving the original behavior).

Audit: rag_engine BC 1 -> 0; migration-target: 0.
Remaining 4 INTERNAL_RETHROW sites are Pattern 1/3 of the styleguide
(known audit limitation).
2026-06-20 16:24:09 -04:00
..