Fix LocalDiscovery subscriber notifications broken on macOS due to unresolved symlink in temp path — Closes #115#116
Merged
conradbzura merged 2 commits intowool-labs:mainfrom Mar 24, 2026
Conversation
…tibility On macOS, tempfile.gettempdir() returns an unresolved symlink (/var/folders/...) while FSEvents delivers event paths using the resolved real path (/private/var/folders/...). The lexical path comparison in the watchdog handler never matched, so subscriber notifications silently failed and discovery fell back to polling or hung indefinitely.
Exercises the subscriber with no poll_interval so discovery relies entirely on watchdog filesystem notifications. Without the resolved path fix, the test times out because on_modified never matches the FSEvents event path.
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.
Summary
Resolve the temp directory path in
_watchdog_pathand_lockso that stored notification file paths use the same canonical form as paths delivered by macOS FSEvents. On macOS,tempfile.gettempdir()returns an unresolved symlink (/var/folders/…) while FSEvents reports the resolved real path (/private/var/folders/…). The lexicalPath.__eq__comparison in_Watchdog.on_modifiednever matched, so subscriber notifications silently failed — discovery fell back to polling or hung indefinitely whenpoll_intervalwasNone.Closes #115
Proposed changes
Resolve temp directory symlinks in path helpers
Add
.resolve()toPath(tempfile.gettempdir())in both_watchdog_pathand_lock. This ensures the notification file path stored by the subscriber and the event path reported by FSEvents use the same resolved form, so theon_modifiedhandler matches correctly.Regression test for watchdog notification path
Add
test___aiter___with_watchdog_notificationtoTestLocalDiscoverySubscriber. The test creates a subscriber with nopoll_interval(no polling fallback) so discovery relies entirely on watchdog filesystem notifications. Without the fix, the test times out after 2 seconds; with the fix, it completes in under 0.5 seconds.Test cases
TestLocalDiscoverySubscriber