fix(index): remove stale files during reindex - #27
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bc13c731e3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // This function performs a full project scan, so rebuild the visible document set from | ||
| // scratch. Updating only the paths we encounter leaves deleted or newly ignored files in the | ||
| // index forever, causing searches to return stale source code. | ||
| writer.delete_all_documents()?; |
There was a problem hiding this comment.
Preserve the prior index when a full scan is incomplete
When a directory cannot be traversed or an existing source file cannot be read—for example because of a transient permission or filesystem error—the loop counts the error as files_skipped and continues to a successful commit. Because all documents are now deleted first, that commit silently removes every previously indexed document from the affected subtree even though those files were neither deleted nor ignored, leaving an incomplete index while reporting success. Abort or roll back a rebuild on scan/read errors, or delete only paths that were conclusively determined to be absent or ignored.
Useful? React with 👍 / 👎.
Summary
Verification
cargo fmt --checkcargo clippy -- -D warningscargo test