Repository navigation
Stop dropping_handle_stops_events flaking on macOS - #38
Merged
Merged
Conversation
The test asserts that no events arrive after the watcher handle is dropped, but it was also catching events queued before the drop. macOS FSEvents reports changes from shortly before the stream opened, so the `initial` write the fixture makes before starting the watcher could still be sitting in the channel, and the assertion failed with a single stray `tasks.md`. Draining the channel before the drop keeps what the test is actually for. The point is that `drop` joins the debouncer thread so the channel is inert when it returns, and that still gets asserted against the ten writes made after the drop. There is deliberately still no settling sleep after the drop, since that would hide a regression back to detached shutdown. Seen on two unrelated PRs on macos-latest within an hour, so this was blocking merges rather than being a curiosity.
This was referenced Aug 9, 2026
Merged
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.
watcher::tests::dropping_handle_stops_eventshas failed on macos-latest ontwo unrelated PRs within an hour, so it is blocking merges rather than being a
curiosity.
What was happening
The test asserts that no events arrive after the watcher handle is dropped, but
it was also catching events queued before the drop. macOS FSEvents reports
changes from shortly before the stream opened, so the
initialwrite thefixture makes before starting the watcher could still be sitting in the channel
when the assertion ran. The failure was always a single stray
tasks.md:The fix
Drain the channel before the drop, so the assertion covers only events caused
after it.
What the test is for is preserved:
dropjoins the debouncer thread, so thechannel must be inert when it returns, and that is still asserted against the
ten writes made after the drop. There is deliberately still no settling sleep
after the drop, since that would hide a regression back to detached shutdown.
Ran the test 20 times locally after the change with no failures.