fix(rag): validate source paths on retrieved chunks — filter stale paths (#4689)#4713
Merged
mrveiss merged 1 commit intoDev_new_guifrom Apr 15, 2026
Merged
fix(rag): validate source paths on retrieved chunks — filter stale paths (#4689)#4713mrveiss merged 1 commit intoDev_new_guifrom
mrveiss merged 1 commit intoDev_new_guifrom
Conversation
…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.
✅ SSOT Configuration Compliance: Passing🎉 No hardcoded values detected that have SSOT config equivalents! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4689
Summary
_filter_stale_chunks()toRAGService: after each ChromaDB retrieval, loads the DocIndexer hash cache and drops chunks whosesource_pathis absent (file removed/moved since last index run)advanced_search()after_execute_and_cache_searchTest Status
✅ 6 unit tests: valid chunk passes, stale chunk filtered, warning logged, cache unavailable → no filter, empty cache → no filter