Repository navigation
feat(settings): adopt contract language catalogs - #114
Conversation
📝 WalkthroughWalkthroughThe settings contract now defines revisioned language option sets and unset labels. Server-provided suggestions are decoded, merged with contract values, normalized, deduplicated, and localized for dynamic iOS and tvOS language pickers. Older server contract revisions now produce upgrade-required errors. ChangesLanguage picker contract and UI
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant SettingsContractManifest
participant EffectiveSettingValue
participant PlayerSettings
participant ProfilePrefsEditor
participant SettingsViewModel
participant PlaybackLanguageOption
participant LanguagePicker
SettingsContractManifest->>SettingsViewModel: provide option metadata and unset labels
EffectiveSettingValue->>PlayerSettings: provide audio suggestedValues
EffectiveSettingValue->>ProfilePrefsEditor: provide subtitle and metadata suggestedValues
PlayerSettings->>SettingsViewModel: expose audio suggestions
ProfilePrefsEditor->>SettingsViewModel: expose subtitle and metadata suggestions
SettingsViewModel->>PlaybackLanguageOption: pass selections and suggestions
PlaybackLanguageOption->>LanguagePicker: return normalized localized options
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@iosApp/iosApp/Networking/PlaybackPrefsModels.swift`:
- Around line 188-195: Update languageIdentity to canonicalize the first
language component using Locale’s ISO-639-1 alpha-2 identifier, falling back to
the original language component when no alpha-2 value exists; retain the
existing normalization and lowercase joining behavior for the remaining
components.
In `@iosApp/iosApp/Screens/Player/PlayerSettings.swift`:
- Line 741: Update importLegacySettingsIfNeeded where it creates the synthetic
EffectiveSettingValue to copy the original entry.suggestedValues into the
replacement. Preserve those suggestions so the audioLanguageSuggestions
assignment from effectiveByKey retains server-provided runtime choices during
legacy import.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a9fbb39c-e11f-43ae-923c-11dc28a481a8
⛔ Files ignored due to path filters (1)
iosApp/iosApp/Networking/SettingKeys.generated.swiftis excluded by!**/*.generated.*
📒 Files selected for processing (18)
iosApp/Tests/Fixtures/SettingsContract/SOURCEiosApp/Tests/Fixtures/SettingsContract/conformance.jsoniosApp/Tests/Fixtures/SettingsContract/manifest.jsoniosApp/Tests/ProfileAndQualitySettingsTests.swiftiosApp/Tests/SettingValuesAPITests.swiftiosApp/Tests/SettingsConformanceTests.swiftiosApp/Tests/SettingsContractResolve.swiftiosApp/iosApp/Networking/PlaybackPrefsModels.swiftiosApp/iosApp/Networking/SettingValueModels.swiftiosApp/iosApp/Screens/Player/PlayerSettings.swiftiosApp/iosApp/Screens/Settings/PlaybackSettingsView.swiftiosApp/iosApp/Screens/Settings/ProfilePrefsEditor.swiftiosApp/iosApp/Screens/Settings/SettingsViewModel.swiftiosApp/iosApp/Screens/Settings/SubtitleSettingsView.swiftiosApp/iosApp/tvOS/Screens/Settings/TVPlaybackSettingsView.swiftiosApp/iosApp/tvOS/Screens/Settings/TVSettingsComponents.swiftiosApp/iosApp/tvOS/Screens/Settings/TVSettingsViewModel.swiftiosApp/iosApp/tvOS/Screens/Settings/TVSubtitleSettingsView.swift
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 306911293d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cde1bee6af
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
iosApp/iosApp/Screens/Player/PlayerSettings.swift (1)
183-185: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winClear stale runtime suggestions on scope/cache reload.
applyCachedSettingsForCurrentScope()restoresaudioLanguagebut leaves this transient array intact. After a server/profile change followed by a failed refresh, the picker can show suggestions from the prior scope. Clear it with the cached state (or persist it per scope).Proposed fix
private func applyCachedSettingsForCurrentScope() { + audioLanguageSuggestions = [] preferredQualityResolution = Self.cachedQualityResolution(defaults)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@iosApp/iosApp/Screens/Player/PlayerSettings.swift` around lines 183 - 185, Update applyCachedSettingsForCurrentScope() to clear audioLanguageSuggestions whenever cached settings are restored, ensuring failed refreshes cannot retain suggestions from a previous scope while preserving the existing audioLanguage restoration behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@iosApp/iosApp/Screens/Player/PlayerSettings.swift`:
- Around line 183-185: Update applyCachedSettingsForCurrentScope() to clear
audioLanguageSuggestions whenever cached settings are restored, ensuring failed
refreshes cannot retain suggestions from a previous scope while preserving the
existing audioLanguage restoration behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: fc29faf9-e7ab-451f-a84d-2db33851426b
📒 Files selected for processing (8)
iosApp/Tests/PlayerSettingsFlushTests.swiftiosApp/Tests/ProfileAndQualitySettingsTests.swiftiosApp/Tests/SettingValuesAPITests.swiftiosApp/Tests/SettingsConformanceTests.swiftiosApp/iosApp/Networking/ContinuumAPI+Settings.swiftiosApp/iosApp/Networking/PlaybackPrefsModels.swiftiosApp/iosApp/Networking/SettingValueModels.swiftiosApp/iosApp/Screens/Player/PlayerSettings.swift
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5b40fd1114
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| guard !decoded.contractIsAheadOfServer else { | ||
| throw SettingsAPIError.serverUpgradeRequired | ||
| } |
There was a problem hiding this comment.
Propagate revision failure to playback controls
When this revision-2 client connects to a revision-1 server, this guard now makes PlayerSettings.refreshFromServer() return .serverUpgradeRequired, but both settings view models discard that result and the iOS/macOS and tvOS playback controls remain enabled; they display cached values and continue queueing quality, audio-language, and behavior writes despite declaring the server contract incompatible. The fresh evidence after the earlier comment is that effective reads are now rejected here, but the resulting state is propagated only through ProfilePrefsEditor, so carry the player refresh result into the playback UI and disable or explain those controls as well.
AGENTS.md reference: AGENTS.md:L19-L22
Useful? React with 👍 / 👎.
Problem
The Apple clients used separate hard-coded language lists, leaving iOS, tvOS, and macOS with fewer metadata and subtitle choices than the web app and making future cross-platform drift likely.
Approach
025083159f9624269483479cc05de02a822c6cd2suggested_values, and the exact current wire valuePlayerSettingsandProfilePrefsEditorCanonical Server contract: Silo-Server/silo-server#521
Companion PRs
Verification
Verified on the remote
mac-builderfrom an exact sync of commit2fadaabcplus this branch's changes:SiloXCTest suite on a clean iPhone 17 Pro simulator — 944 tests, 0 failuresSettingsConformanceTestsafter the final Server commit pin — 7 tests, 0 failures0250831502508315A first run on an existing signed-in simulator produced 12 old settings-refresh assertions because persisted profile state triggered the one-time migration path. The unchanged tree passed all 944 tests on a newly created clean simulator; that disposable simulator was removed afterward without touching the existing simulator.
Risks and follow-up
AI Disclosure
Summary by CodeRabbit
New Features
Bug Fixes
Tests