Skip to content

fix(settings): make the Audio Language setting reach playback - #103

Closed
Quick104 wants to merge 1 commit into
mainfrom
fix/audio-language-has-effect
Closed

Quick104 wants to merge 1 commit into
mainfrom
fix/audio-language-has-effect

Conversation

@Quick104

Copy link
Copy Markdown
Contributor

Problem

The Audio Language picker writes a value that nothing ever reads. Verified P1 from Silo-Server/silo-server#376.

PlayerSettings wrote playback.audio_language as a device setting, but repository-wide that value was only ever loaded, cached, displayed, and written back inside the settings layer — no detail, session-start, route-planning, or player-selection path consumed it. The server picks the initial audio track from the profile's language field instead, and WireFormatModels.asUserProfile was deliberately dropping that field, while UpdateProfileBody had no way to write it.

Net effect: changing a visible setting did nothing.

Fix

Point the setting at what the server actually reads.

  • Profile.language now flows through asUserProfile into UserProfile.language, and UpdateProfileBody gained language so the client can write it.
  • Both settings view models replace the device-backed preferredAudioLanguage with a profile editor field plus saveAudioLanguage(), which PUTs to /api/v1/profiles/{id}, refreshes the local activeProfile snapshot, and flushes the item ResponseCache (and tvOS ItemDetailCache) so an already-visited detail screen stops showing the stale track.
  • Both pickers now build from the shared PlaybackLanguageOption.all list the subtitle and metadata pickers already use, deleting two duplicated 9-entry lists. This is required, not cosmetic: a language set from the web client (zh/ru/ar/hi) would otherwise render as a blank row.
  • The now-dead device-scoped audioLanguage state is removed from PlayerSettings. PlayerDeviceSettingKey.audioLanguage is kept so "Reset Playback Overrides" still clears rows written by older builds — leaving a dead write path would have undercut the point of the fix.
  • Streaming footers now say the setting is profile-wide.

No server change is needed: PUT /profiles/{id} already accepts language for self-service, stores it, and returns it. silo-android already reads activeProfile?.language.

Verification

Built on mac-builder in an isolated worktree — all three schemes, zero errors:

Scheme Target Result
Silo iOS Simulator ✅ SUCCEEDED (52s)
SiloTV tvOS Simulator ✅ SUCCEEDED (36s)
SiloMac macOS ✅ SUCCEEDED (35s)

All remaining warnings are pre-existing and in untouched files (SubtitleSession, Pairing/*, PendingReportStore, TVAudiobookDetailView, DownloadsManagerComponents).

The repo's only two executable scripts (resolve-marketing-version.test.sh, resolve-platform.test.sh) also pass. There is no Swift unit-test target to run.

Known limits and follow-ups

  • Not device-verified. Compiles on all three platforms; the actual picker → profile → server → track-selection round trip was not exercised against a live server.
  • Stranded device rows, and this one matters for the contract. Existing playback.audio_language rows in user_device_settings from earlier builds are now orphaned. Harmless today, but the settings contract (feat(settings): add the canonical contract manifest and validator silo-server#473) resolves that key profile_device → profile, so a stale row would shadow the new profile value — and it would be a value the user set months ago and saw no effect from. Needs an explicit migration disposition server-side; deliberately not papered over with a client-side DELETE.
  • Language list is still narrower than the web's — 12 entries plus the original sentinel, versus the full ISO 639-1 list the web writes. Pre-existing gap shared with the subtitle and metadata pickers; this change improves it (9 → 12) without closing it. An unmatched selection displays blank, it does not overwrite the stored value.
  • No write coalescing. Two picker changes in rapid succession could land out of order. Acceptable given every platform's picker is one-change-per-visit, and consistent with the existing subtitle path.
  • Pre-existing bug, deliberately not fixed: all four activeProfile = UserProfile(...) reconstructions drop isPrimary, silently resetting it to false after any profile save. Second concern, and anything keying off isPrimary would change behavior. Worth its own issue.
  • UI change worth a screenshot: the picker goes from 9 to 13 rows, and the empty label changes from "Default" to "No Preference" — matching the web and honest now that the value is profile-wide.

Part of Silo-Server/silo-server#376.

AI-use disclosure

Implemented with AI assistance (Claude Opus 5) under maintainer direction. Builds were run and confirmed independently on mac-builder rather than reported from the implementing agent, which had no Swift toolchain available.

The Audio Language picker wrote `playback.audio_language` as a
device-scoped setting that nothing read — not this repo, not the server.
The server resolves the initial audio track from the profile's
`language` field (silo-server `internal/catalog/detail.go` emits it as
`effective_audio_track_index`, which `PlaybackSessionBridge` forwards at
session start), and `WireFormatModels.asUserProfile` was deliberately
dropping that field on the way into `UserProfile`.

Carry `language` through into `UserProfile`, let `UpdateProfileBody`
write it, and point the iOS/macOS and tvOS pickers at the profile value
through a new `saveAudioLanguage()` on both settings view models. Both
pickers now build from the shared `PlaybackLanguageOption.all` list the
subtitle and metadata pickers already use, so a language set from the web
client (zh/ru/ar/hi) renders instead of showing a blank row, and the two
hardcoded nine-entry copies are gone.

The choice is profile-wide rather than per-device, so the Streaming
footer now says so and the dead device-scoped `PlayerSettings`
audio-language state is removed. `PlayerDeviceSettingKey.audioLanguage`
stays so "Reset Playback Overrides" still deletes rows written by older
builds.

Refs Silo-Server/silo-server#376

AI-use disclosure: implemented with Claude Code.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6453db2e-fc12-4151-8cac-73d46421e876

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/audio-language-has-effect

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant