refactor(core): reconcile current watcher policy - #46949
Merged
Merged
Conversation
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.
Why
Location watcher reconciliation captures an ignore policy before asynchronous repository-target discovery, then uses generation numbers to reject stale captures. Reading the current policy after discovery preserves the same behavior without carrying a snapshot across the wait.
What Changes
policy.current()before deciding whether to watch it.stoppedwhile reconciliation holds it.The previous generation checks already handled this race. This is a simplification, not a new refresh or watcher policy. The permit, plugin-activation wait, duplicate-subscription check, and close-before-replacement ordering remain unchanged.
Scope
Only Location watcher reconciliation and the existing watcher test file. No changes to policy APIs, native watcher implementations, or general filesystem containment.
Verification
The new race test uses deferred synchronization, a gated real
realPathcall, and an instrumented watcher subscription. Temporarily moving the policy read before target discovery made it fail with an unwanted subscription; the correct ordering was restored before the final checks. Existing native watcher tests run separately against the local filesystem.49 tests passed across three files, including local native watcher cases. Core typechecking and formatting passed. Scoped lint reported zero errors and one existing
consistent-returnwarning in target discovery. The pre-push workspace typecheck passed all 33 tasks, with 27 cache hits.