Repository navigation
fix(host-service): let an ignore-rule change bypass the refresh interval - #9480
Open
Bruno-rose wants to merge 2 commits into
Open
Bruno-rose wants to merge 2 commits into
Bruno-rose wants to merge 2 commits into
Conversation
…ever re-checks the native prune
…efresh interval A .gitignore or info/exclude edit within 5s of the last ignored-dir refresh hit the min-interval early return. rulesChanged stayed set with nothing to retry it, so the native watcher kept pruning a dir the edit had un-ignored until some later emit happened to land outside the interval.
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 19 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Contributor
There was a problem hiding this comment.
No issues found across 2 files
Architecture diagram
sequenceDiagram
participant W as GitWatcher
participant S as IgnoredDirsState
participant FS as File System
participant FW as Filesystem Watcher
Note over W,FS: Git Watcher Refresh Flow
W->>FS: .gitignore / info/exclude change detected
FS-->>W: File change event
W->>S: Mark rulesChanged = true
W->>W: Call refreshIgnoredDirs()
W->>S: Check refreshing flag
alt Not currently refreshing
W->>S: Check ignore-rule staleness
alt rulesChanged is set
W->>W: Bypass min-interval check (NEW behavior)
W->>FS: Refresh ignored dirs
FS-->>W: Updated ignore rules
W->>W: Re-evaluate native watch prune
W->>S: Reset rulesChanged = false
W->>S: Update lastRefreshAt timestamp
else rulesChanged is not set
alt Min interval elapsed
W->>FS: Refresh ignored dirs
FS-->>W: Updated ignore rules
W->>S: Update lastRefreshAt timestamp
else Min interval not elapsed
W->>W: Skip refresh (min-interval guard)
end
end
else Currently refreshing
W->>W: Skip refresh (already in progress)
Note over W,S: rulesChanged remains set for retry
end
Note over W,FW: Native watcher behavior
W->>FW: Update watch configuration
FW->>FS: Track only non-ignored directories
FS-->>FW: Directory structure events
This branch has not been deployed
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 & why
Fixes #9461.
A
.gitignoreedit within 5 s of the last ignored-dirs refresh hit the min-interval return.rulesChangedstayed set with nothing to retry it, so the native watcher kept skipping a folder the user had un-ignored. The min-interval check now does not apply whenrulesChangedis set.How I tested it
Failing regression test in
git-watcher.test.tswith a real temp git repo. The bug was first found by checking every order of events in a small model, then reproduced against the real code.packages/host-service:bun run testgives 2758 pass, 0 fail.Checklist
type(scope): subject)bun run lintandbun run typecheckpass (CI fails on lint warnings too)Summary by cubic
Fixes #9461: a
.gitignoreorinfo/excludeedit within 5s of the last ignored-dirs refresh was dropped by the min-interval guard, leavingrulesChangedset with nothing to retry it and the native watcher still pruning a folder the user had un-ignored.The min-interval check now skips when
rulesChangedis set, so rule edits always trigger a refresh.Written for commit 3e13a08. Summary will update on new commits.