Skip to content

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
conradbzura:115-fix-symlink-watchdog-path
Mar 24, 2026
Merged

Fix LocalDiscovery subscriber notifications broken on macOS due to unresolved symlink in temp path — Closes #115#116
conradbzura merged 2 commits intowool-labs:mainfrom
conradbzura:115-fix-symlink-watchdog-path

Conversation

@conradbzura
Copy link
Copy Markdown
Contributor

Summary

Resolve the temp directory path in _watchdog_path and _lock so 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 lexical Path.__eq__ comparison in _Watchdog.on_modified never matched, so subscriber notifications silently failed — discovery fell back to polling or hung indefinitely when poll_interval was None.

Closes #115

Proposed changes

Resolve temp directory symlinks in path helpers

Add .resolve() to Path(tempfile.gettempdir()) in both _watchdog_path and _lock. This ensures the notification file path stored by the subscriber and the event path reported by FSEvents use the same resolved form, so the on_modified handler matches correctly.

Regression test for watchdog notification path

Add test___aiter___with_watchdog_notification to TestLocalDiscoverySubscriber. The test creates a subscriber with no poll_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

# Test Suite Given When Then Coverage Target
1 TestLocalDiscoverySubscriber A subscriber with no poll_interval (watchdog-only) A worker is published It should yield the event promptly via filesystem notification Regression for #115: on_modified path comparison with resolved symlinks

…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.
@conradbzura conradbzura marked this pull request as ready for review March 24, 2026 03:32
@conradbzura conradbzura merged commit ca2652d into wool-labs:main Mar 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LocalDiscovery subscriber notifications broken on macOS due to unresolved symlink in temp path

1 participant