Skip file watchers on remote volumes#424
Merged
schuyler merged 1 commit intoJun 30, 2026
Merged
Conversation
schuyler
requested changes
Jun 22, 2026
schuyler
left a comment
Owner
There was a problem hiding this comment.
Thanks for the PR, @yusufm!
Issues
- Resource watchers unguarded:
MPResourceWatcherSet -addWatcherForPath:is a secondMPFileWatcherinstantiation site with nocanWatchPath:check, so resource files (images/CSS/scripts) on remote volumes still hit the same failure this PR fixes for documents. - Non-existent path regression:
NSURLVolumeIsLocalKeyrequires the file to exist, socanWatchPath:returns NO for a path that transiently doesn't exist (e.g. after an external editor's atomic rename-replace save), which can leave auto-reload disabled — falling back to the parent directory for the locality check would avoid this. - Stale watcher on early-return: the new early-return in
MPDocument -startFileWatchingruns beforestopFileWatching, so a previously-armed watcher can leak ifcanWatchPath:returns NO for an already-watched session.
Suggestions
- Branch coverage: the empty-string and non-existent-path branches of
canWatchPath:are untested and quick to cover in CI. - Diagnostics: passing an
NSError *instead ofNULLtogetResourceValue:forKey:error:and logging it would make the "Device not configured" case from #371 easier to diagnose. - Doc comment: the header comment describes only the local-volume case, though the method also returns NO for nil, empty, and non-existent paths.
Generated by Claude Code
This was referenced Jun 30, 2026
schuyler
pushed a commit
that referenced
this pull request
Jun 30, 2026
## Summary - skip vnode file watching when a path is not on a local volume - avoid creating document/resource watchers for remote/network files - cover local and nil watchability checks ## Tests - xcodebuild test -workspace "MacDown 3000.xcworkspace" -scheme MacDown -only-testing:MacDownTests/MPFileWatcherTests -only-testing:MacDownTests/MPResourceWatcherSetTests -destination 'platform=macOS' Related to #371
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
Tests
Related to #371