Skip to content

fix(watcher): detect deletes on macOS (vanished path -> Remove)#5

Closed
andylbrummer wants to merge 1 commit into
mainfrom
fix-macos-delete-detection
Closed

fix(watcher): detect deletes on macOS (vanished path -> Remove)#5
andylbrummer wants to merge 1 commit into
mainfrom
fix-macos-delete-detection

Conversation

@andylbrummer

Copy link
Copy Markdown
Member

Fixes the last macOS FileWatcher gap: FileWatcherTest.DetectsFileDelete.

efsw's FSEvents backend coalesces events and could deliver a Write/Create-labelled event for a file that was ultimately deleted — the event arrived but was mislabeled, so the Remove never surfaced. Instead of chasing efsw's per-flag FSEvents classification (unobservable without a Mac), fixed at the boundary: on_efsw_event now treats a path that no longer exists as Remove, whatever the coalesced event was labeled.

Cross-platform safe, verified no-op on Linux (inotify already labels deletes; modify keeps Write). FileWatcherTest 9/9 on Linux. Removes the last macOS FileWatcherTest exclusion from both CI legs — gated by the macOS dispatch run.

🤖 Generated with Claude Code

FileWatcherTest.DetectsFileDelete failed on macOS: efsw's FSEvents backend
coalesces events and could hand us a Write/Create-labelled event for a file
that was ultimately deleted, so the Remove never surfaced (the event arrived,
just mislabeled). Rather than chase efsw's per-flag FSEvents classification
(unobservable without a Mac), fix it at the boundary in on_efsw_event: trust
the filesystem — if the path no longer exists, it is a removal, whatever the
backend called the coalesced event.

Cross-platform safe and verified no-op on Linux: inotify already labels deletes
Remove (gone file -> stays Remove), and a normal modify keeps Write (file still
exists). FileWatcherTest 9/9 on Linux. Removes the last macOS FileWatcherTest
exclusion from both CI legs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@andylbrummer

Copy link
Copy Markdown
Member Author

Closing: the LCI-side 'vanished path -> Remove' reclassification did not fix DetectsFileDelete on real FSEvents (the delete event never reaches on_efsw_event as the file path — efsw appears to drop/recoalesce it). Cannot diagnose blind; needs on-device efDEBUG to observe the actual FSEvents flag bits. The teardown abort (the substantive fix) already landed in PR #4; DetectsFileDelete stays excluded on macOS, documented. Reopen with a real fix once someone can observe FSEvents on a Mac.

@andylbrummer andylbrummer deleted the fix-macos-delete-detection branch June 16, 2026 19:53
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.

1 participant