Private
Public Access
0
0
Files
manual_slop/tests
ed ee50c26556 refactor(rag_engine): migrate 3 index_file sites to Result[T] (Phase 13 sites 3+4+SS)
index_file had 3 try/except sites with similar patterns:

Site 3 (BC at L247): try: mtime = os.path.getmtime(full_path); except Exception: return
Site 4 (BC at L261): try: with open(full_path, ...) as f: content = f.read(); except Exception: return
Site 6 (SS at L255): try: res = self.collection.get(...); ...; except Exception: pass

Body: broad catch + early return/pass = SS-style violation.

New helpers:
- _get_file_mtime_result(full_path) -> Result[float]
  Catches OSError only (specific to file stat failures).
- _check_existing_index_result(file_path, mtime) -> Result[bool]
  Catches broad Exception (chromadb collection.get failures vary).
  Returns data=True if already indexed (skip), data=False if needs re-indexing.
- _read_file_content_result(full_path) -> Result[str]
  Catches (OSError, UnicodeDecodeError) (file I/O + encoding failures).

Legacy index_file calls each helper; on Result errors, returns early
(preserving the original behavior of skipping the file on failure).

Audit: rag_engine BC 3 -> 1 (L341 _async_search_mcp remaining).
SS: 1 -> 0.
2026-06-20 16:10:35 -04:00
..