Skip to content

fix(watcher): keep a full scan owed after a failed sync (#1964) - #1977

Merged
colbymchenry merged 1 commit into
colbymchenry:mainfrom
danusha2345:fix/1964-full-scan-retry
Sep 27, 2026
Merged

colbymchenry merged 1 commit into
colbymchenry:mainfrom
danusha2345:fix/1964-full-scan-retry

Conversation

@danusha2345

Copy link
Copy Markdown
Contributor

Fixes #1964.

Problem

A removed directory sets needsFullScan without adding to pendingFiles. The watcher's reschedule gate after a failed sync checked only pendingFiles, so when that full scan failed (lock contention or an error) it was never retried. The removed directory's symbols stayed in the index until an unrelated edit triggered another sync.

Fix

Reschedule while needsFullScan is set as well: this.pendingFiles.size > 0 || this.needsFullScan. This is the same one-line change #1875 carries for HDL filelists, split out so the bug is fixed independently of that PR.

Tests

watcher.test.ts:

  • a directory removal whose sync fails with lock contention, and with a generic error, is retried as a full scan (both fail on main);
  • a directory removal, and a .gitignore change, that arrive during a scoped sync each get a full scan after that sync. Both already pass on main when driven through the watch-event path, so they only pin that behaviour. I couldn't reproduce the mid-sync case from the issue this way; if it goes through ingestEventForTests, the gate change covers it too.

Full suite on this branch (Linux, Node 22, native kernel): all tests pass except the known extraction.test.ts pool-worker crash from #1779 (fixed by #1883), which is intermittent and also occurs on main; that file alone passes 655/655.

🤖 Generated with Claude Code

…#1964)

A directory removal adds no pending file, only needsFullScan. The retry
after a failed sync (lock contention or a generic failure) was gated on
pending files alone, so the owed full reconcile was dropped and the
removed directory's files kept their nodes. Reschedule while needsFullScan
is set as well. A regression test also pins the mid-sync scope-change case,
which already follows a scoped pass with a full scan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@colbymchenry

Copy link
Copy Markdown
Owner

Thanks @danusha2345! Verified this against current main: the reproduction from #1964 passes and the tests are green. Merged, and it will be in the next release.

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.

Watcher drops the full scan a directory removal or scope change asks for when the sync fails or the event arrives mid-sync

2 participants