Combine directory monitoring fixes into one implementation#565
Open
moreaki wants to merge 2 commits intomangerlahn:mainfrom
Open
Combine directory monitoring fixes into one implementation#565moreaki wants to merge 2 commits intomangerlahn:mainfrom
moreaki wants to merge 2 commits intomangerlahn:mainfrom
Conversation
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
This PR combines the work that was previously split across #559, #561, and #562 into one coherent implementation for app-directory discovery and monitoring.
Instead of merging three overlapping changes that each patch one failure mode, this PR reshapes the
AppDirectory/AppLibrarypath so Latest now has a single directory-monitoring design that:DispatchGroupimbalance that could crash during initial directory setupSupersedes:
What Changed
1. Replace the root-only watcher with recursive monitoring
AppDirectorynow uses a recursive FSEvents-based monitor instead of a singleDispatchSourceFileSystemObjecton the root directory.That means the live watcher now matches what the initial scan already did: recursively discover apps below the configured application roots.
This resolves the subfolder refresh gap described in #562.
2. Keep startup alive when monitoring cannot be established
If a configured scan path cannot be monitored, Latest no longer crashes.
Instead:
This preserves the resilience work from #559.
3. Surface observation failures to the user through native macOS UI
Following the request in the last user comment on #559, Latest now visibly alerts the user when a scan directory cannot be monitored.
The app:
EACCES/EPERM)This turns the degraded path from a silent fallback into something the user can actually act on.
4. Fix startup callback accounting in
AppLibraryAppLibrary.setupDirectoryObservers()still uses aDispatchGroupto wait for each newly createdAppDirectoryto complete its initial scan.The previous implementation assumed that a new observer would only produce one callback during startup. In practice, that assumption could fail and lead to an unbalanced
dispatch_group_leave()crash.This PR makes the startup completion path one-shot per new observer, and routes all later callbacks through the existing deferred update scheduler.
This absorbs the fix from #561.
Files / Areas Touched
Latest/Model/Directory/AppDirectory.swiftLatest/Model/Directory/AppLibrary.swiftLatest/Model/UpdateCheckCoordinator.swiftLatest/Interface/Main Window/Window Controllers/MainWindowController.swiftLatest/Resources/en.lproj/Localizable.stringsTests/OSVersionTest.swiftBehavioral Result
After this PR:
DispatchGroup.leave()crashVerification
Build:
xcodebuild -project Latest.xcodeproj -scheme Latest -configuration Debug CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= buildTests:
xcodebuild testis still blocked in this environment by the existing test-target dependency problem resolvingCommerceKit/StoreFoundationwhen importingLatestNotes
The point of this PR is to leave the project with one maintainable end state instead of three partially overlapping branches that all modify directory observation for different reasons.