fix(watcher): detect changes in polling fallback - #21
Merged
Merged
Conversation
Snapshot included files before polling and refresh only when their metadata changes, avoiding refresh loops from unchanged or excluded index files.
Trigger a one-time refresh after the first fallback snapshot so edits during watcher loss or scanning are not missed. Normalize trailing data-directory separators before deriving the excluded basename to keep index writes out of polling.
Preserve reconciliation events received before the index is ready and replay one pending refresh after boot completes, so startup changes are not lost.
Allow queued reconciliation and later watcher events to trigger the first build after an empty or lazily initialized workspace, instead of waiting for index.ready to become true.
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.
What this PR does
Before this PR:
The polling fallback refreshed on every interval, could not reliably exclude index-directory events, and treated the first fallback snapshot as the baseline. Startup changes could be missed because reconciliation callbacks were discarded while the index was not ready. Empty or lazily initialized workspaces could keep queuing watcher events without ever building new files. Absolute
dataDirvalues with trailing separators also produced an empty exclusion name.After this PR:
The fallback snapshots included regular files and refreshes only when the included tree changes. It performs one reconciliation after the first successful snapshot, queues it until boot completes, and drains it even when the current index is empty so the first build can discover new files. Later watcher events can likewise trigger that first build. The watcher trims trailing separators before deriving the exclusion basename, with focused regression coverage for all paths.
Type of change
Bug fix
Breaking changes (if any)
None.