Skip to content

fix(rag): validate source paths on retrieved chunks — filter stale paths (#4689)#4713

Merged
mrveiss merged 1 commit intoDev_new_guifrom
issue-4689
Apr 15, 2026
Merged

fix(rag): validate source paths on retrieved chunks — filter stale paths (#4689)#4713
mrveiss merged 1 commit intoDev_new_guifrom
issue-4689

Conversation

@mrveiss
Copy link
Copy Markdown
Owner

@mrveiss mrveiss commented Apr 15, 2026

Closes #4689

Summary

  • Added _filter_stale_chunks() to RAGService: after each ChromaDB retrieval, loads the DocIndexer hash cache and drops chunks whose source_path is absent (file removed/moved since last index run)
  • Logs a WARNING with the stale path list
  • Graceful fallback: if cache file is missing/empty/unreadable, full result list returned unchanged — RAG is never disrupted
  • Called from advanced_search() after _execute_and_cache_search

Test Status

✅ 6 unit tests: valid chunk passes, stale chunk filtered, warning logged, cache unavailable → no filter, empty cache → no filter

…stale paths (#4689)

Add `_filter_stale_chunks()` to RAGService: after each ChromaDB retrieval,
load the DocIndexer hash cache and drop any chunks whose source_path is
absent (file removed/moved since last index run).  Logs a WARNING with the
stale path list.  Graceful fallback: if the cache file is missing, empty,
or unreadable the full result list is returned unchanged so RAG is never
disrupted.  Called from `advanced_search()` after `_execute_and_cache_search`.

6 unit tests cover: valid chunk passes through, stale chunk filtered,
warning logged, cache unavailable → no filter, empty cache → no filter,
missing cache file → no filter.
@mrveiss mrveiss merged commit 7c88835 into Dev_new_gui Apr 15, 2026
3 of 4 checks passed
@mrveiss mrveiss deleted the issue-4689 branch April 15, 2026 17:16
@github-actions
Copy link
Copy Markdown

✅ SSOT Configuration Compliance: Passing

🎉 No hardcoded values detected that have SSOT config equivalents!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant