Repository navigation
Keep the integration device ID from its first read - #5943
Merged
bgoncal merged 1 commit intoOct 1, 2026
Merged
Conversation
The identifier the server knows an installation by came straight from the platform's vendor identifier on every read. A build that derives it differently, such as the Mac moving from Catalyst to a native app, would register a second device the next time a server is added. The first value seen is now stored in the app group and preferred from then on.
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation matches the migration requirements and includes appropriate isolated tests.
Review effort: Balanced
Findings: None
What changed in this PR
Persists the first available vendor identifier to preserve server registration across Catalyst-to-native macOS migration.
Changes:
- Store and reuse the first non-nil vendor identifier.
- Add persistence and fallback tests.
- Isolate the Watch registrar test from persisted state.
| File | Description |
|---|---|
Sources/Shared/Settings/SettingsStore.swift |
Persists and reuses the integration device ID. |
Tests/App/Settings/SettingsStoreIntegrationDeviceID.test.swift |
Tests persistence and delayed identifier availability. |
Tests/Shared/Watch/WatchDeviceRegistrar.test.swift |
Preserves stored ID around the test. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5943 +/- ##
==========================================
+ Coverage 51.65% 51.74% +0.09%
==========================================
Files 1231 1231
Lines 81093 81146 +53
==========================================
+ Hits 41888 41990 +102
+ Misses 39205 39156 -49
☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
AI Policy
Select exactly one option that describes AI usage in this contribution:
Summary
integrationDeviceID, the identifier the server knows an installation by, was derived from the platform's vendor identifier on every read. The first value seen is now stored in the app group and preferred from then on, so a build that derives the identifier differently keeps the registration it already has instead of registering a second device the next time a server is added.This prepares the move from the Mac Catalyst app to the native macOS app (#5935): the native app cannot produce
UIDevice.identifierForVendor, and in a test upgrade on the same Mac, adding a server again went to the "name this device" step because the server's registered device did not match. With the identifier stored by a Catalyst release first, the native app reads the same value.Nothing is stored while the platform has no identifier to give, so a later read can still pick it up; until then the keychain
deviceIDfallback applies as before.Screenshots
Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#
Any other notes
Should ship in a release before the native macOS app does.