Skip to content

fix(playback): honor device audio language selection - #596

Merged
Quick104 merged 3 commits into
mainfrom
agent/fix-device-audio-language-resolution
Aug 11, 2026
Merged

Quick104 merged 3 commits into
mainfrom
agent/fix-device-audio-language-resolution

Conversation

@Quick104

@Quick104 Quick104 commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • propagate the explicit X-Silo-Device-Id identity into catalog detail preference resolution
  • make Playback V3 resolve playback.audio_language through the canonical settings context for series, library, device, and profile scopes
  • remove the V3 fallback read from the legacy library-preference table while retaining concrete series track identity
  • preserve idempotent retries for pre-device attempt digests while binding new attempts to normalized device identity
  • send the Web player's stable browser device identity through Playback V3 starts
  • cover device isolation, canonical scope precedence, explicit track priority, catalog request propagation, legacy retries, and Web player headers

Apple already writes its audio-language picker to profile_device. The server previously omitted the device ID when computing both effective_audio_track_index and an omitted Playback V3 audio track, so Apple’s saved setting could never win.

Fixes #595
Part of #376

Validation

  • go test ./internal/catalog ./internal/api/handlers
  • make verify-local-paths
  • cd web && pnpm exec vitest run src/player/player-fetch.test.ts
  • cd web && pnpm run build
  • cd web && pnpm run lint (zero errors; existing warnings remain)
  • cd web && pnpm run format:check
  • git diff --check origin/main...HEAD
  • make test-go ran across the repository; the changed packages pass. The run still hits the two existing Jellycompat process-lock failures, which reproduce on an untouched origin/main checkout. Three concurrent NVENC probe tests also failed in that full run but pass when rerun directly on both this branch and origin/main.

AI Disclosure

  • Tool(s): Codex in T3 Code
  • Model(s): gpt-5.6-sol
  • Involvement: AI-assisted implementation, verification, and review under maintainer direction

Summary by CodeRabbit

  • New Features

    • Added support for device-specific audio-language preferences.
    • Audio preferences now honor device, library, series, and profile precedence, with original-language fallback.
    • Playback requests are recognized per device, preventing accidental reuse across devices.
    • Player requests now include device identity for consistent preference handling.
  • Bug Fixes

    • Improved handling of equivalent device identifiers during playback retries.
    • Preserved compatibility with existing playback requests.
    • Playback now reports settings-resolution errors instead of silently using an empty preference.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The change propagates normalized device IDs through web playback requests, access filters, catalog audio resolution, and Playback V3. Canonical settings now control device-aware audio selection. Playback attempt digests support device identity and legacy replay compatibility.

Changes

Device-scoped audio playback

Layer / File(s) Summary
Web device identity wiring
web/src/api/client.ts, web/src/player/..., web/src/playback/..., web/src/pages/audiobooks/...
The web player exposes a stable device ID and sends it through the X-Silo-Device-Id header. Tests update player configuration fixtures and verify the header.
Device identity propagation
internal/api/handlers/access_filter.go, internal/api/handlers/items.go, internal/catalog/access_filter.go, internal/api/handlers/access_filter_test.go
Handlers trim request device IDs and include them in scoped and fallback access filters. catalog.AccessFilter stores the requesting device ID.
Canonical audio resolution
internal/catalog/detail.go, internal/api/handlers/playback.go, internal/catalog/detail_version_prefs_test.go, internal/api/handlers/playback_test.go
Audio resolution uses canonical profile, device, library, series, and default precedence. Resolution and decoding errors propagate to callers.
Playback V3 integration
internal/api/handlers/playback_v3.go, internal/api/handlers/playback_v3_test.go
Playback attempt digests include normalized device IDs. Replay checks distinguish equivalent and different devices while accepting legacy body-only digests. Track selection uses device-aware preferences.

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

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant PlaybackV3
  participant Catalog
  participant SettingsResolver
  Client->>PlaybackV3: Start playback with device ID
  PlaybackV3->>PlaybackV3: Normalize device ID and compute digests
  PlaybackV3->>Catalog: Resolve preferred audio track
  Catalog->>SettingsResolver: Resolve canonical audio language
  SettingsResolver-->>Catalog: Return language by precedence
  Catalog-->>PlaybackV3: Return selected track
  PlaybackV3-->>Client: Return playback response or replay conflict
Loading

Possibly related issues

Possibly related PRs

Suggested labels: v1

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 21.43% 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 The changes satisfy issue #595 through device propagation, canonical precedence, explicit-track priority, fallback behavior, and focused tests.
Out of Scope Changes check ✅ Passed The changes remain within the device-aware playback and catalog resolution objectives, including related retry hardening and test updates.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: honoring device-specific audio language selection during playback.
✨ 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 agent/fix-device-audio-language-resolution

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 95adf18daf

ℹ️ 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".

Comment thread internal/api/handlers/playback.go Resolved
Comment thread internal/api/handlers/playback_v3.go Resolved
@Quick104
Quick104 force-pushed the agent/fix-device-audio-language-resolution branch from 95adf18 to 0853aff Compare August 11, 2026 19:45
@coderabbitai coderabbitai Bot added the v1.0 Silo v1 scope - auto-adds to the Silo v1 project label Aug 11, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0853aff417

ℹ️ 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".

Comment thread internal/api/handlers/playback_v3.go Resolved
Comment thread internal/api/handlers/playback_v3.go Resolved

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

Actionable comments posted: 1

🤖 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 `@internal/api/handlers/playback_v3.go`:
- Around line 510-533: Restrict legacy digest matching in
playbackStartRequestDigestsV3.matches to requests with no device ID: retain
current-digest matching for all requests, but only accept the empty or body-only
legacy digest when the originating request’s device identity is also empty.
Update the digest type or matching flow to retain that identity context, and add
coverage proving a legacy digest retried with a different device ID is rejected
as playback_attempt_reused.
🪄 Autofix

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: 2cef4970-ffd8-4ff8-bb56-da526d864cd5

📥 Commits

Reviewing files that changed from the base of the PR and between 0853aff and 88a6600.

📒 Files selected for processing (12)
  • internal/api/handlers/playback_v3.go
  • internal/api/handlers/playback_v3_test.go
  • web/src/api/client.ts
  • web/src/pages/audiobooks/player/audiobookPlaybackContext.tsx
  • web/src/pages/audiobooks/player/useAudiobookPlayback.test.ts
  • web/src/playback/WatchPlaybackChrome.tsx
  • web/src/player/components/VideoPlayer.test.tsx
  • web/src/player/components/WatchPage.test.ts
  • web/src/player/context/PlayerConfigContext.tsx
  • web/src/player/hooks/usePlaybackSession.test.ts
  • web/src/player/player-fetch.test.ts
  • web/src/player/player-fetch.ts

Comment thread internal/api/handlers/playback_v3.go Resolved
@Quick104
Quick104 merged commit 2dc7d5e into main Aug 11, 2026
16 of 17 checks passed
@Quick104
Quick104 deleted the agent/fix-device-audio-language-resolution branch August 11, 2026 20:19
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.

fix(playback): honor device audio language during server track selection

1 participant