sidebar: ignore Access events in config watcher - #218
Merged
Conversation
On Linux the notify backend also reports reads (open/access/close) of watched files, and a config reload reads the very file being watched: every reload scheduled the next one, bumping config_version and re-rendering every sidebar client once per debounce interval (5/s), forever. Filter out EventKind::Access so only mutations (create, modify, remove, rename) trigger a reload.
The config watcher still allowed ignored access events to fill its bounded channel and trigger reloads through overflow. The git status watcher also subscribed to read events, so each status refresh could schedule another one without producing a visible sidebar update. Configure both mutation-driven watchers with notify's CORE event mask and filter irrelevant config events before enqueueing them. Preserve rescan events as reload signals because their path lists may be incomplete. Cover the Linux access event shapes, atomic rename paths, rescan recovery, and the shared watcher mask in regression tests.
raine
force-pushed
the
fix/sidebar-config-access-loop
branch
from
August 4, 2026 19:16
f11820b to
b776fc0
Compare
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.
Fixes #217
Problem
spawn_config_watcherfilters fs events only by basename, not by event kind. On Linux,notify's inotify backend also delivers Access events (open/read/close-nowrite) — and a config reload reads the watched file itself. So every reload scheduled the next one after the 200 ms debounce:config_versionbumped ~5×/s forever, re-rendering every sidebar client on each bump (visible flicker; 180k+ bump lines in my log over a day). Details and repro in #217.Fix
Extract the filter into
config_event_triggers_reload()and rejectEventKind::Access(_). Mutations (create/modify/remove/rename) still trigger reloads, so atomic-rename editor saves keep working.Testing
cargo test(1397 passed),cargo fmt --checkclean,cargo clippyintroduces no new warnings.touch config.yamlproduces exactly oneconfig_versionbump followed by silence; before the patch it bumped every ~203 ms indefinitely.