Skip to content

fix(watcher): detect changes in polling fallback - #21

Merged
JohnXu22786 merged 4 commits into
mainfrom
bug/watcher-polling-change-detection
Sep 12, 2026
Merged

JohnXu22786 merged 4 commits into
mainfrom
bug/watcher-polling-change-detection

Conversation

@JohnXu22786

@JohnXu22786 JohnXu22786 commented Sep 12, 2026

Copy link
Copy Markdown
Owner

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 dataDir values 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.

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.
@JohnXu22786
JohnXu22786 marked this pull request as ready for review September 12, 2026 07:41
@JohnXu22786
JohnXu22786 merged commit f8d0622 into main Sep 12, 2026
2 checks passed
@JohnXu22786
JohnXu22786 deleted the bug/watcher-polling-change-detection branch September 12, 2026 07:41
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