Repository navigation
feat(settings): add shared language option catalogs - #521
Conversation
📝 WalkthroughWalkthroughThe settings contract adds revisioned advisory language option sets and unset labels. Backend effective-setting responses merge authored and observed language values. TypeScript, Kotlin, Swift, and web clients consume the metadata for dynamic language selectors. ChangesLanguage presentation metadata
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested labels: 🚥 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.
🧹 Nitpick comments (2)
contracts/settings/v1/manifest.json (1)
4-131: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winTriplicated language list across three option sets.
playback_audio_languages,playback_subtitle_languages, andcatalog_metadata_languagesare currently identical, 37-entry lists. Sincecontract_test.go'sTestLanguageOptionSetsAreCanonicalAndReferencedexpects three distinct option-set IDs, this appears intentional (to allow future divergence) rather than an accident — but as-is, adding/removing a language requires three manual, easy-to-desync edits with nothing enforcing parity.Consider either documenting explicitly that these are allowed to diverge, or adding a lightweight test asserting they stay in sync until a real divergence is needed.
🤖 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 `@contracts/settings/v1/manifest.json` around lines 4 - 131, The three language option sets duplicate identical lists without documenting or enforcing their intentional parity. Add a lightweight contract test near TestLanguageOptionSetsAreCanonicalAndReferenced that compares playback_audio_languages, playback_subtitle_languages, and catalog_metadata_languages and fails when their options diverge, while preserving their distinct option-set IDs.cmd/settingsgen/main_test.go (1)
10-68: 🗄️ Data Integrity & Integration | 🔵 TrivialNative client coordination.
These generated Swift/Kotlin bindings expose the new option-set/
suggestedOptions/unsetLabelmetadata to iOS/Android. Confirm the native client repositories have (or have planned) matching follow-up to consume this generated metadata, so those platforms aren't left behind while the web client already renders it.As per coding guidelines: "Client-visible changes to API, authentication, playback, sessions, library, or metadata behavior generally require coordinated follow-up in both client repositories rather than leaving a platform behind."
🤖 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 `@cmd/settingsgen/main_test.go` around lines 10 - 68, Coordinate matching follow-up work in the iOS and Android client repositories for the generated metadata verified by TestPresentationMetadataIsGeneratedForEveryClientLanguage. Confirm or create tracked implementation work to consume option sets, suggestedOptions, and unsetLabel in the native settings UIs, and reference those follow-ups in the change so neither platform is left behind.Source: Coding guidelines
🤖 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.
Nitpick comments:
In `@cmd/settingsgen/main_test.go`:
- Around line 10-68: Coordinate matching follow-up work in the iOS and Android
client repositories for the generated metadata verified by
TestPresentationMetadataIsGeneratedForEveryClientLanguage. Confirm or create
tracked implementation work to consume option sets, suggestedOptions, and
unsetLabel in the native settings UIs, and reference those follow-ups in the
change so neither platform is left behind.
In `@contracts/settings/v1/manifest.json`:
- Around line 4-131: The three language option sets duplicate identical lists
without documenting or enforcing their intentional parity. Add a lightweight
contract test near TestLanguageOptionSetsAreCanonicalAndReferenced that compares
playback_audio_languages, playback_subtitle_languages, and
catalog_metadata_languages and fails when their options diverge, while
preserving their distinct option-set IDs.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b814337d-0d21-4bff-b3cd-855ae0c22372
📒 Files selected for processing (22)
cmd/settingsgen/main.gocmd/settingsgen/main_test.gocontracts/settings/v1/conformance.jsoncontracts/settings/v1/manifest.jsoncontracts/settings/v1/manifest.schema.jsondocs/superpowers/specs/2026-07-10-cross-platform-user-settings-contract-design.mdinternal/api/handlers/settings_values.gointernal/api/handlers/settings_values_test.gointernal/api/router.gointernal/settingscontract/contract.gointernal/settingscontract/contract_test.gointernal/settingscontract/validate.gointernal/settingskeys/keys.goweb/src/hooks/queries/settingValues.tsweb/src/lib/languageOptions.test.tsweb/src/lib/languageOptions.tsweb/src/lib/settingsConformance.jsonweb/src/lib/settingsContract.tsweb/src/lib/settingsDisplay.tsweb/src/pages/settings/LibrarySettings.tsxweb/src/pages/settings/PlaybackSettings.tsxweb/src/pages/settings/SubtitleAppearanceSettings.tsx
Problem
The settings contract describes language values as open BCP 47 tags, but it does not tell clients which values to present. The web, Apple, and Android apps therefore maintained separate hard-coded lists that had already drifted, leaving metadata and subtitle choices missing on mobile.
Approach
option_setsfor audio, subtitle, and metadata languageslanguage_tagopen rather than turning the catalog into a validation enumsuggested_valuesas the contract floor plus access-scoped catalog languages and the exact current valueptandpt-BRThe picker rule is: contract floor + deployment-observed values + exact current value.
Part of #135
Companion PRs
Verification
make test-go— full Go suite passedmake test-web— 248 files, 1600 tests passedgo vet ./...— passedpnpm run lint— zero errors; existing warnings onlypnpm run format:check— passedgolangci-lint v2.12.2 run --new-from-rev=b1b093007ce6defa17ecc5f7faeecc8d65d300f0 ./...— 0 issuesmake verify-settings-bindings-all verify-local-paths— passedUI note: this changes the contents and source of existing select controls; it does not change their layout.
Risks and follow-up
AI Disclosure
settingskeysconstants. A persisted-state Apple simulator failure was isolated and the unchanged code passed all 944 tests on a clean simulator.Summary by CodeRabbit
New Features
Bug Fixes