You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor(playback): trust server edition and version order - #1133
Android detail screens and direct-play starters re-ranked editions and versions locally, and direct-play (PlaybackVersionSelector) ignored playback_variants altogether, sorting by bitrate instead. On multi-edition titles where an alternate 4K cut had higher bitrate than the default Theatrical cut, direct play could launch a different edition than the detail page.
This change removes duplicate edition and version re-ranking on Android phone and Android TV, decodes playback_variants on WatchDetail so direct-play follows the server's default edition, and adds the shared 13-case subtitle auto-selection conformance suite.
Approach
DetailVersionSelector drops local edition preference ranking and SERVER_ORDER version sorting, trusting playback_variants and per-part version order from the server while keeping local quality-cap filtering and explicit picks.
WatchDetail (CatalogModels / WatchDetailV2Api) now decodes playback_variants, and PlaybackVersionSelector uses it when resolving a starting version without an explicit fileId across mobile and TV playback starters (PlayerViewModel, MobileVideoPlaybackStarter, TvVideoPlaybackStarter).
AutoSubtitleResolverTest exercises all 13 cross-client subtitle conformance cases.
Unit tests: ./gradlew :shared:testDebugUnitTest :androidApp:testDebugUnitTest :androidTvApp:testDebugUnitTest passed (including 1,427 Android TV tests and all 13 subtitle conformance cases).
Lint and builds: ./gradlew :androidApp:lintDebug :androidTvApp:lintDebug :androidApp:assembleDebug :androidTvApp:assembleDebug passed.
Live sandbox end-to-end checks on API 36 emulators (against the paired silo-server branch):
Android phone emulator: opened a multi-edition title (4K Director's Cut at lower file ID vs 1080p Theatrical) on Edition: Theatrical, verified Edition sheet ordered Theatrical before Directors Cut, switched editions cleanly, played file_id: "56" from detail (1920x816, advancing time, 0 dropped frames), and verified direct-play without fileId on a second multi-edition title played Theatrical file_id: "55" instead of the 4K Special Edition.
Android TV emulator: opened the detail screen on Edition: Theatrical, verified Edition picker order, and verified direct-play without fileId streamed Theatrical file_id: "56" (1920x816, advancing time, 0 dropped frames).
Not run: physical Android devices were unreachable on the network during testing; tablet and foldable layouts share DetailVersionSelector and were not separately captured.
Model(s): gemini-4-neon-xhigh; architecture review council members claude-opus-5-5 (high) and gpt-6.2-sol (high)
Involvement: Fully AI-generated; human verification pending
Adversarial review: pre-implementation architecture review across claude-opus-5-5 and gpt-6.2-sol, which settled moving edition/version ordering to the server while keeping quality caps and subtitle defaults client-finalized.
Note
Trust server edition order and add playback variants to WatchDetail decoding
Adds an optional playbackVariants field (serialized as playback_variants) to WatchDetail in CatalogModels.kt, and WatchDetailV2Api.kt now decodes it, adapting nested default_file_id, part, and version fields the same as top-level versions
selectDetailPlaybackVersion in DetailVersionSelector.kt and selectPlaybackVersion in PlaybackVersionSelector.kt now pick the first server-ordered edition instead of ranking cuts by name and Auto-file quality. Auto selection returns the first known-resolution candidate within the quality cap, or the closest known resolution above it; last-played lastFileId still wins
Mobile and TV playback starters pass the watch detail's playback variants into version selection, and tests are reordered to server order with new conformance cases
Behavioral Change: Auto quality selection no longer sorts by resolution, HDR, or file size — first matching candidate in server order wins; check selectDetailPlaybackVersion and selectPlaybackVersion for consumers relying on old ranking
This change adds playback variants to watch-detail decoding and uses server order when selecting editions and files. Mobile and TV playback paths pass variants to the shared selector. Shared tests also add subtitle resolver conformance cases.
Changes: Playback Version Selection
Layer / File(s)
Summary
Decode playback variant data shared/src/commonMain/kotlin/org/siloserver/silo/model/catalog/CatalogModels.kt, shared/src/commonMain/kotlin/org/siloserver/silo/network/apiv2/WatchDetailV2Api.kt, shared/src/commonTest/kotlin/org/siloserver/silo/network/apiv2/WatchDetailMarkerV2Test.kt
WatchDetail now includes playback variants. The API adapter converts optional IDs and nested versions. A test checks variant decoding, default file ID, and nested version duration.
The selectors use server order for editions and files, with resolution-cap and fallback rules. Tests cover edition selection, candidate order, and resolution handling.
Pass variants from playback entry points androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/*, androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvVideoPlaybackStarter.kt, androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/detail/*Test.kt
Mobile and TV playback paths pass variants into selection. The TV resolver defaults omitted variants to an empty list. TV test fixtures now list higher-resolution files first.
Phone and TV playback now follow the server's edition and version order, with quality caps and explicit file choices unchanged. No concrete merge-blocking defect was found. Until the paired server change ships, older servers will have their returned order followed.
Security architecture risk: Low · up to d0f32
Using Silo Server’s order helps detail pages and direct playback agree on the default edition. The main risk is that an incompatible edition entry can now block playback for an affected title even when the requested file is valid. Leaving edition metadata out still allows playback, although the default choice can differ from the previous Android behavior.
Retained concerns
Trivial · reliability · observed: Optional playback_variants can now prevent phone and TV streaming starts that do not need edition selection. The merge base ignored this field; the head rejects the whole WatchDetail if, for example, a nested version lacks duration_seconds even though the requested file is valid in top-level versions. Preserve strict validation of the title and top-level files, but isolate unusable recommendation data so an explicit file or resume choice can still proceed.
observed — Server-supplied variant references can reorder or narrow the Android client’s automatic choice for the current title, but cannot add a file to its top-level WatchDetail versions. The selector returns the matching top-level file record rather than trusting the nested copy.
Trust Boundaries and Controls
observed — WatchDetail still uses the authenticated, owner-scoped request and checks the returned content ID. The TV starter still checks that the metadata owner, profile, and server match before passing the selected file to session admission. Server order acts as a recommendation, not a grant of playback authority.
Dependencies
inferred — Consistent defaults across server versions depend on Silo Server providing both a canonical edition order and a top-level file order consistent with that edition. The reported paired-branch validation does not establish what other deployed versions emit or whether their nested version records satisfy the new decoder.
Resilience and Maintainability Implications
observed — The fallback works only after WatchDetail has decoded: omitted variants use the first edition represented in top-level versions, and well-formed variants with no usable file matches fall back to the top-level list. A projection error instead ends the start before session admission; retrying the same incompatible response or picking a different file does not reach that fallback.
Rollout and rollback
inferred — Silo Server now controls the default by ordering the watch-detail lists; the client still honors explicit file choices after a successful decode. If a server deployment returns incompatible variants, restoring a compatible response or omitting the optional field allows affected clients to start playback again. Omission does not restore the merge base’s local ranking.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: the refactor makes playback follow the server's edition and version order. It uses the conventional commit form and is specific. It matches the raw summary, which show…
Description check
The description is detailed and on-topic. It explains the problem, the approach (DetailVersionSelector ranking removal, WatchDetail playback_variants decoding, PlaybackVersionSelector use), validation…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: the refactor makes playback follow the server's edition and version order. It uses the conventional commit form and is specific. It matches the raw summary, which shows the removal of local edition ranking and the change to selectPlaybackVersion ordering.
Full details: Description check
Explanation
The description is detailed and on-topic. It explains the problem, the approach (DetailVersionSelector ranking removal, WatchDetail playback_variants decoding, PlaybackVersionSelector use), validation steps, and risks. These match the raw summary's file-level changes.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Fix failing CI checks
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
The reason will be displayed to describe this comment to others. Learn more.
Nested playback variants reject versions using the existing duration field
Playback startup fails when nested versions use duration, as in the existing v2 playback-variant fixture, because adaptVersion requires duration_seconds. Adapt nested versions to their wire contract rather than requiring the top-level watch-version duration field.
Prompt for LLM
File shared/src/commonMain/kotlin/org/siloserver/silo/network/apiv2/WatchDetailV2Api.kt, lines 73-74:
Nested playback variants reject versions using the existing duration field
The new nested-version adapter requires `duration_seconds`, but the existing v2 playback-variant fixture represents nested versions with `duration`, causing decoding to fail for that shape and preventing playback startup. Adapt nested versions using their actual wire contract rather than requiring the top-level watch-version duration field.
The reason will be displayed to describe this comment to others. Learn more.
Verified against silo-server/internal/apiv2/watch.go: on /api/v2/watch/{id}, WatchPlaybackVariantPart.versions carries WatchFileVersion objects whose wire field is duration_seconds (unlike /api/v2/catalog/items/{id}, which uses FileVersion.duration). Added a decoding test in WatchDetailMarkerV2Test (d0f32ce). 🤖 Antigravity (gemini-4-neon)
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarifying. Given the verified /api/v2/watch/{id} contract, my suggestion conflated it with the catalog endpoint and was incorrect. Requiring duration_seconds for nested watch versions is consistent with that contract, so no adapter change is needed for this issue.
The added decoding test should help guard against future regressions.
The reason will be displayed to describe this comment to others. Learn more.
Direct playback can select a different edition without variants
A quality cap can make direct playback start a different cut from the detail page when playback_variants is absent. Build candidates with playbackEditions even when variants are empty.
Prompt for LLM
File shared/src/commonMain/kotlin/org/siloserver/silo/playback/PlaybackVersionSelector.kt, lines 30-32:
Direct playback can select a different edition without variants
When `playback_variants` is absent, a quality cap filters all editions instead of the first edition, so direct playback can start a different cut from the detail page. Build candidates with `playbackEditions` even when variants are empty, as the detail selector does.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in d0f32ce: selectPlaybackVersion now scopes candidates through playbackEditions(versions, variants) even when variants is empty, matching DetailVersionSelector. 🤖 Antigravity (gemini-4-neon)
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. Scoping candidates through playbackEditions when variants are empty addresses the reported mismatch, assuming the first edition matches the detail selector. I haven’t independently verified the commit or its tests.
The reason will be displayed to describe this comment to others. Learn more.
Last-played file bypasses quality selection across cut variants
The unconditional lastFileId return prevents ordinary resume from selecting another quality variant of the same cut. Select among the cut's presentation variants using the quality preference, preserving the exact file only for an explicit later-part resume.
File shared/src/commonMain/kotlin/org/siloserver/silo/playback/PlaybackVersionSelector.kt, line 29:
Last-played file bypasses quality selection across cut variants
Resolve the cut containing `lastFileId` and select among its presentation variants using the quality preference, preserving the exact last-played file only for an explicit later-part resume. Currently, the earlier unconditional `lastFileId` return bypasses this new edition selection whenever that file is still listed, so an ordinary resume cannot choose another quality variant of the same cut.
Kody rule violation: [Rank automatic playback across variants of the selected cut](https://kodus.siloserver.org/settings/code-review/1247142403/kody-rules/8c595953-0458-4ef9-b15a-c5c859ec5860?teamId=ba9922fc-c0ea-4cf8-87bb-9d4f42ffc73e)
The reason will be displayed to describe this comment to others. Learn more.
Keeping this out of this PR: returning lastFileId when still listed is pre-existing base behavior guarded by PlaybackVersionSelectorTest.lastPlayedFileStillWinsWhenAvailable, unchanged by this PR. 🤖 Antigravity (gemini-4-neon)
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Since the lastFileId behavior predates this PR and is covered by an existing test, I’ll withdraw this suggestion from the PR. Changing how resume applies quality preferences can be considered separately.
## Evidence is still Evidence: PENDING; the validation narrative describes emulator checks but includes no captures or evidence link.
The changed default edition and edition/version ordering (shared/src/commonMain/kotlin/org/siloserver/silo/playback/DetailVersionSelector.kt, shared/src/commonMain/kotlin/org/siloserver/silo/network/apiv2/WatchDetailV2Api.kt) reaches phone, tablet, foldable folded and open, and Android TV; add before-and-after captures of the same detail screen and data for each, naming each device and build/commit, plus a recording if showing the edition-switch flow.
Direct-play’s selected edition/file (shared/src/commonMain/kotlin/org/siloserver/silo/playback/PlaybackVersionSelector.kt, androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/MobileVideoPlaybackStarter.kt, androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModel.kt, androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvVideoPlaybackStarter.kt) reaches phone, tablet, foldable folded and open, and Android TV; add before-and-after captures or a recording that demonstrates the selected playback on each device, with device and build/commit details.
Suggested fix: No diff; attach the requested captures or recording and replace Evidence: PENDING with the evidence link or attachments. The PR notes that tablet and foldable captures were not separately taken and that physical devices were unavailable; those explanations do not provide the missing evidence.
Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.
The reason will be displayed to describe this comment to others. Learn more.
Auto playback disagrees with detail selection for unknown resolutions
Direct playback and the detail page can select different versions when the first file has an unknown resolution. Apply the same unknown-resolution fallback policy in both selectors.
Prompt for LLM
File shared/src/commonMain/kotlin/org/siloserver/silo/playback/PlaybackVersionSelector.kt, lines 34-36:
Auto playback disagrees with detail selection for unknown resolutions
With Auto quality, a first file with unknown resolution wins here while the detail selector skips it in favor of a known-resolution file, so direct play and the detail page select different versions. Apply the same unknown-resolution fallback policy in both selectors.
Suggested code:
if (target == PLAYBACK_QUALITY_AUTO) {
return candidates.firstOrNull { playbackResolutionRank(it.resolution) > 0 } ?: candidates.first()
}
The reason will be displayed to describe this comment to others. Learn more.
Fixed in d0f32ce: selectPlaybackVersion now skips unknown-resolution versions when a known-resolution version exists in AUTO / uncapped mode, matching DetailVersionSelector.autoFile. 🤖 Antigravity (gemini-4-neon)
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. The reported fix aligns Auto direct playback with the detail selector’s unknown-resolution fallback. I haven’t independently verified commit d0f32cef8.
Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.
Reviewing changes in Silo
Include the related issue, expected behavior, and validation steps in the PR description.
For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
Follow this repository's AGENTS.md and CONTRIBUTING.md.
Request another review with @kody start-review in a PR comment.
React with 👍 or 👎 to give feedback on individual suggestions.
Review settingsReview Options
The following review options are enabled or disabled:
Options
Enabled
Bug
✅
Performance
✅
Security
✅
Business Logic
❌
⚠️ 6 Kody Rule(s) were not evaluated
These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:
Validate download ownership before publishing subtitle bytes
Bind playback markers to the actual playing file
Share route-aware audio decisions and preserve original-format decoder fallback
Apply playback route eligibility consistently at admission and media loading
The evidence link is present, but the PR says the tablet and foldable layouts were not separately captured. The changed selectors are shared by phone and TV detail/playback paths and are not limited to phone-sized layouts, so those surfaces are affected too.
Default edition and version ordering on detail screens — the evidence page should show before-and-after captures of the same detail screen and data on an Android tablet and a foldable both folded and open.
Edition/file chosen for direct playback — the evidence page should also demonstrate the selected playback on an Android tablet and a foldable both folded and open.
The PR notes physical devices were unavailable; emulator captures are acceptable under CONTRIBUTING.md. Suggested fix: No diff — add the missing device captures to the evidence page. The existing link counts as evidence; these device variants should be present there for reviewers to check.
Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments
1
Optional playback_variants can now prevent phone and TV streaming starts that do not need edition selection. The merge base ignored this field; the head rejects the whole WatchDetail if, for example, a nested version lacks duration_seconds even though the requested file is valid in top-level versions. Preserve strict validation of the title and top-level files, but isolate unusable recommendation data so an explicit file or resume choice can still proceed.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: e573a7f3-7539-47a1-8605-76a80d7f9245
Commits
Reviewing files that changed from the base of the PR and between b15d2be and d0f32ce.
Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.
Brings in Silo main at ecd3423: server edition and version order for
playback starts (Silo-Server#1133), which hand-offs follow through Silo's TV starter,
and direct passthrough seek fixes for Silo's own player (Silo-Server#1132). Neither
touches the External Player's dependencies.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012qpc8JWornyCaGCu28gSBU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Related issue: N/A
Validation tasks: none
Other clients: Apple Silo-Server/silo-apple#1357; Roku Silo-Server/silo-roku#128; Web Silo-Server/silo-server#5835
Android detail screens and direct-play starters re-ranked editions and versions locally, and direct-play (
PlaybackVersionSelector) ignoredplayback_variantsaltogether, sorting by bitrate instead. On multi-edition titles where an alternate 4K cut had higher bitrate than the default Theatrical cut, direct play could launch a different edition than the detail page.This change removes duplicate edition and version re-ranking on Android phone and Android TV, decodes
playback_variantsonWatchDetailso direct-play follows the server's default edition, and adds the shared 13-case subtitle auto-selection conformance suite.Approach
DetailVersionSelectordrops local edition preference ranking andSERVER_ORDERversion sorting, trustingplayback_variantsand per-part version order from the server while keeping local quality-cap filtering and explicit picks.WatchDetail(CatalogModels/WatchDetailV2Api) now decodesplayback_variants, andPlaybackVersionSelectoruses it when resolving a starting version without an explicitfileIdacross mobile and TV playback starters (PlayerViewModel,MobileVideoPlaybackStarter,TvVideoPlaybackStarter).AutoSubtitleResolverTestexercises all 13 cross-client subtitle conformance cases.playback_variantsordering in refactor(playback): make server the authority for default edition and version order silo-server#5835.Validation
./gradlew :shared:testDebugUnitTest :androidApp:testDebugUnitTest :androidTvApp:testDebugUnitTestpassed (including 1,427 Android TV tests and all 13 subtitle conformance cases)../gradlew :androidApp:lintDebug :androidTvApp:lintDebug :androidApp:assembleDebug :androidTvApp:assembleDebugpassed.silo-serverbranch):Edition: Theatrical, verified Edition sheet orderedTheatricalbeforeDirectors Cut, switched editions cleanly, playedfile_id: "56"from detail (1920x816, advancing time, 0 dropped frames), and verified direct-play withoutfileIdon a second multi-edition title played Theatricalfile_id: "55"instead of the 4K Special Edition.Edition: Theatrical, verified Edition picker order, and verified direct-play withoutfileIdstreamed Theatricalfile_id: "56"(1920x816, advancing time, 0 dropped frames).DetailVersionSelectorand were not separately captured.Evidence
Evidence: https://evidence.siloserver.org/r/silo-android/pr-1133/
Risks
playback_variantsby lowest file ID, Android opens on the server's returned order until the server updates.Checklist
AI Disclosure
agent-device;silo-evidencegemini-4-neon-xhigh; architecture review council membersclaude-opus-5-5(high) andgpt-6.2-sol(high)claude-opus-5-5andgpt-6.2-sol, which settled moving edition/version ordering to the server while keeping quality caps and subtitle defaults client-finalized.Note
Trust server edition order and add playback variants to
WatchDetaildecodingplaybackVariantsfield (serialized asplayback_variants) toWatchDetailin CatalogModels.kt, and WatchDetailV2Api.kt now decodes it, adapting nesteddefault_file_id, part, and version fields the same as top-level versionsselectDetailPlaybackVersionin DetailVersionSelector.kt andselectPlaybackVersionin PlaybackVersionSelector.kt now pick the first server-ordered edition instead of ranking cuts by name and Auto-file quality. Auto selection returns the first known-resolution candidate within the quality cap, or the closest known resolution above it; last-playedlastFileIdstill winsselectDetailPlaybackVersionandselectPlaybackVersionfor consumers relying on old rankingMacroscope summarized d0f32ce.