Skip to content

fix(index): remove stale files during reindex - #27

Merged
mstuart merged 1 commit into
mainfrom
fix/reindex-remove-stale-files
Sep 25, 2026
Merged

mstuart merged 1 commit into
mainfrom
fix/reindex-remove-stale-files

Conversation

@mstuart

@mstuart mstuart commented Sep 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • clear the existing Tantivy documents before a full project scan
  • prevent deleted or newly ignored source files from remaining searchable
  • add a regression test covering deletion followed by reindex

Verification

  • cargo fmt --check
  • cargo clippy -- -D warnings
  • cargo test

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-25T20:11:27.528820Z bc13c73 PR opened
🔒 Security Review ✅ Completed 2026-09-25T20:16:56.314185Z bc13c73 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@mstuart
mstuart merged commit e62811e into main Sep 25, 2026
3 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/indexer/walker.rs
// 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()?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@mstuart
mstuart deleted the fix/reindex-remove-stale-files branch September 25, 2026 20:11
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