Skip to content

feat(settings): add shared language option catalogs - #521

Merged
Quick104 merged 1 commit into
mainfrom
codex/settings-language-catalog
Jul 30, 2026
Merged

Quick104 merged 1 commit into
mainfrom
codex/settings-language-catalog

Conversation

@Quick104

@Quick104 Quick104 commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

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

  • bump the settings manifest to revision 2 and add reusable, advisory option_sets for audio, subtitle, and metadata languages
  • keep language_tag open rather than turning the catalog into a validation enum
  • generate presentation metadata into the Go, TypeScript, Swift, and Kotlin bindings
  • return suggested_values as the contract floor plus access-scoped catalog languages and the exact current value
  • deduplicate true ISO aliases while preserving meaningful region/script choices such as pt and pt-BR
  • migrate the web settings controls to the generated catalogs and browser-localized language names
  • pin conformance coverage so generated clients cannot silently drift from the manifest

The picker rule is: contract floor + deployment-observed values + exact current value.

Part of #135

Companion PRs

Verification

  • make test-go — full Go suite passed
  • make test-web — 248 files, 1600 tests passed
  • go vet ./... — passed
  • focused Go handler, contract, and generator tests — passed
  • focused web language/settings tests — 39 passed
  • production web build — passed
  • pnpm run lint — zero errors; existing warnings only
  • pnpm run format:check — passed
  • golangci-lint v2.12.2 run --new-from-rev=b1b093007ce6defa17ecc5f7faeecc8d65d300f0 ./... — 0 issues
  • make verify-settings-bindings-all verify-local-paths — passed

UI note: this changes the contents and source of existing select controls; it does not change their layout.

Risks and follow-up

  • Option sets are advisory by design, so older clients remain compatible and unknown valid tags remain writable.
  • Catalog lookups run only when the effective request includes audio/subtitle language keys; failures fall back to the contract floor.
  • The client PRs vendor this exact manifest commit and add drift tests.

AI Disclosure

  • Tool(s): Codex in T3 Code; Claude Code CLI
  • Model(s): gpt-5.6-sol; claude-fable-5
  • Involvement: fully AI-generated
  • Adversarial review: Reviewed contract openness, alias/region identity, access-scoped catalog enrichment, unknown-current-value retention, generated-binding drift, and all three client integrations. Changed-lines lint found duplicated raw setting keys; they were replaced with generated settingskeys constants. 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

    • Language selectors now provide context-specific suggestions for audio, subtitle, and catalog metadata settings.
    • Suggestions can include values detected in the current deployment, while preserving the currently selected language.
    • Language names are displayed in a localized, user-friendly format.
    • Nullable settings now show appropriate labels such as “No preference,” “None,” or “Library default.”
  • Bug Fixes

    • Improved handling of language aliases and duplicate language options.
    • Settings remain compatible with newly introduced language values across contract revisions.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The 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.

Changes

Language presentation metadata

Layer / File(s) Summary
Define revisioned option-set metadata
contracts/settings/v1/..., internal/settingscontract/contract.go, docs/superpowers/specs/...
The manifest schema and contract define language option sets, per-setting references, unset labels, and revision filtering; fixtures and revision constants move to revision 2.
Validate option-set invariants
internal/settingscontract/validate.go, internal/settingscontract/contract_test.go
Validation and tests cover supported types, canonical language tags, duplicate values, revision bounds, references, and nullable unset labels.
Generate client presentation metadata
cmd/settingsgen/main.go, cmd/settingsgen/main_test.go
Generators emit TypeScript, Kotlin, and Swift option-set definitions and revision-filtered presentation helpers with deterministic ordering.
Merge observed language suggestions
internal/api/handlers/settings_values.go, internal/api/handlers/settings_values_test.go, internal/api/router.go
Effective settings responses combine contract options with access-scoped observed languages, normalize aliases, preserve current values, and expose suggested_values.
Render contract-driven language selectors
web/src/lib/settingsContract.ts, web/src/lib/languageOptions.ts, web/src/lib/settingsDisplay.ts, web/src/pages/settings/..., web/src/hooks/queries/settingValues.ts, web/src/lib/*.test.ts
Web settings derive language options per definition from contract metadata, runtime suggestions, and current values, including context-specific unset labels.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

  • Silo-Server/silo-server#479: Introduces the cross-platform settings contract that this change extends with advisory presentation metadata.

Suggested labels: v1

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: shared settings language option catalogs were added.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/settings-language-catalog

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added the v1.0 Silo v1 scope - auto-adds to the Silo v1 project label Jul 30, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
contracts/settings/v1/manifest.json (1)

4-131: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Triplicated language list across three option sets.

playback_audio_languages, playback_subtitle_languages, and catalog_metadata_languages are currently identical, 37-entry lists. Since contract_test.go's TestLanguageOptionSetsAreCanonicalAndReferenced expects 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 | 🔵 Trivial

Native client coordination.

These generated Swift/Kotlin bindings expose the new option-set/suggestedOptions/unsetLabel metadata 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

📥 Commits

Reviewing files that changed from the base of the PR and between b1b0930 and 0250831.

📒 Files selected for processing (22)
  • cmd/settingsgen/main.go
  • cmd/settingsgen/main_test.go
  • contracts/settings/v1/conformance.json
  • contracts/settings/v1/manifest.json
  • contracts/settings/v1/manifest.schema.json
  • docs/superpowers/specs/2026-07-10-cross-platform-user-settings-contract-design.md
  • internal/api/handlers/settings_values.go
  • internal/api/handlers/settings_values_test.go
  • internal/api/router.go
  • internal/settingscontract/contract.go
  • internal/settingscontract/contract_test.go
  • internal/settingscontract/validate.go
  • internal/settingskeys/keys.go
  • web/src/hooks/queries/settingValues.ts
  • web/src/lib/languageOptions.test.ts
  • web/src/lib/languageOptions.ts
  • web/src/lib/settingsConformance.json
  • web/src/lib/settingsContract.ts
  • web/src/lib/settingsDisplay.ts
  • web/src/pages/settings/LibrarySettings.tsx
  • web/src/pages/settings/PlaybackSettings.tsx
  • web/src/pages/settings/SubtitleAppearanceSettings.tsx

@Quick104
Quick104 merged commit d70b291 into main Jul 30, 2026
5 checks passed
@Quick104
Quick104 deleted the codex/settings-language-catalog branch July 30, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v1.0 Silo v1 scope - auto-adds to the Silo v1 project

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant