Some watcher events only request a full scan-diff: a removed directory (#1285) and a .gitignore / codegraph.json scope change (#1590) set needsFullScan without adding anything to pendingFiles. The gate that retries a failed sync, or runs the follow-up for events that landed mid-sync, checks only pendingFiles (src/sync/watcher.ts:990 on main ba3c21e):
if (this.pendingFiles.size > 0 && !this.stopped) {
So the full scan such an event asked for is dropped in two cases:
- The sync fails (lock contention or an error). It's never retried.
- The event arrives during a scoped sync. No follow-up full scan runs when that sync finishes.
In both cases the removed directory's symbols, or the files the new scope excludes, stay in the index until some unrelated edit triggers another sync.
Repro (the real FileWatcher with inertForTests, driven by ingestEventForTests; syncFn fails on its first call and records every call):
removed dir, lock failure ["FULL"] ← never retried
removed dir, sync error ["FULL"] ← never retried
control: src edit, lock failure [["src/a.ts"],["src/a.ts"]] ← retried
A directory removal that arrives during a scoped sync of src/a.ts gives [["src/a.ts"]], with no follow-up full scan.
Fix: reschedule when this.pendingFiles.size > 0 || this.needsFullScan.
#1875 already makes this exact change, for the case where an HDL filelist changes mid-sync. It fixes both cases above, but it's part of the Verilog feature. Filing this separately so the bug is tracked whether or not that PR lands as one piece. If it helps land sooner, I can open a small PR with just the gate change and regression tests for both cases.
Some watcher events only request a full scan-diff: a removed directory (#1285) and a
.gitignore/codegraph.jsonscope change (#1590) setneedsFullScanwithout adding anything topendingFiles. The gate that retries a failed sync, or runs the follow-up for events that landed mid-sync, checks onlypendingFiles(src/sync/watcher.ts:990onmainba3c21e):So the full scan such an event asked for is dropped in two cases:
In both cases the removed directory's symbols, or the files the new scope excludes, stay in the index until some unrelated edit triggers another sync.
Repro (the real
FileWatcherwithinertForTests, driven byingestEventForTests;syncFnfails on its first call and records every call):A directory removal that arrives during a scoped sync of
src/a.tsgives[["src/a.ts"]], with no follow-up full scan.Fix: reschedule when
this.pendingFiles.size > 0 || this.needsFullScan.#1875 already makes this exact change, for the case where an HDL filelist changes mid-sync. It fixes both cases above, but it's part of the Verilog feature. Filing this separately so the bug is tracked whether or not that PR lands as one piece. If it helps land sooner, I can open a small PR with just the gate change and regression tests for both cases.