Repository navigation
Fix config hot reload after directory recreation - #1209
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes configuration hot-reload so that deleting and recreating the configuration directory still triggers reloads, and it prevents configuration writes when running under unit tests (and other non-app runtime contexts).
Changes:
- Introduces a generic
FileWatcherbacked by FSEvents to watch stable parent roots (survives directory recreation). - Replaces
DispatchSourceFileSystemObject-based config watchers inConfigurationStatewith the newFileWatcher. - Improves runtime detection via
ProcessEnvironmentand gates configuration saving when not running as the app; adds unit tests for both.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| LinearMouse/Utilities/FileWatcher.swift | Adds an FSEvents-based watcher that can keep detecting changes even if the watched directory is deleted/recreated. |
| LinearMouse/State/ConfigurationState.swift | Switches config hot reload to FileWatcher and prevents saves outside app runtime (tests/previews). |
| LinearMouse/Utilities/ProcessEnvironment.swift | Expands test-environment detection and adds isRunningApp for gating side effects. |
| LinearMouseUnitTests/Utilities/FileWatcherTests.swift | Adds coverage to ensure events are reported after a watched directory is recreated. |
| LinearMouseUnitTests/Utilities/ProcessEnvironmentTests.swift | Adds coverage verifying the unit test host is detected as running tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Testing
Closes #1205