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): make server the authority for default edition and version order - #5835
Default edition and version selection lived in five places that disagreed. On a multi-edition title where a non-default cut (such as a 4K Director's Cut) had a lower file ID than the Theatrical cut, /api/v2/catalog/items/{id} and /api/v2/watch/{id} ordered playback_variants by lowest file ID, Watch Together chose the lowest file ID directly, and each client re-ranked editions and versions locally. Direct-play paths and Watch Together rooms could open a different cut than the detail page, and every client duplicated the same edition and quality sorting rules.
This change makes the server the authority for default edition and version order via the existing playback_variants and versions arrays, reuses that order in Watch Together, removes the duplicate client ranking from the web app, and adds a shared cross-client subtitle selection conformance fixture.
Approach
internal/catalog/detail.go adds EditionPreferenceRank and OrderPlaybackVariants so playback_variants[0] is the server's recommended edition for the acting viewer: explicit remembered edition (effective_version_edition_key), then user_data.last_edition_key, then the edition holding user_data.last_file_id, then standard/unnamed editions, then theatrical editions, then other cuts, breaking ties by lowest file ID. Both catalog detail and watch-state builders apply this order.
internal/watchtogether/selection_resolver.go reuses OrderPlaybackVariants for default room selection so Watch Together picks the same default cut as catalog detail instead of the lowest file ID.
/api/v2 wire shapes stay unchanged; internal/apiv2/{catalog_items,watch,playback}.go, contracts/api/v2/openapi.json, web/src/api/v2/schema.ts, and docs/catalog-api.md document the server-owned ordering and concrete file_id start contract. Quality caps stay on the client because network tier is local to the device, and subtitle auto-resolution stays client-finalized because OS caption profiles and per-device burn-in support differ across platforms.
web/src/pages/ItemDetail/components/versionRankingUtils.ts and versionOptions.ts drop local edition preference and version re-sorting, opening on playback_variants[0] (or an explicit pick) and filtering that variant's server-ordered versions against the local quality cap.
contracts/playback/subtitle-selection-conformance.json defines 13 cross-client subtitle auto-selection cases exercised in web and mirrored in the paired Apple, Android, and Roku PRs.
Validation
Go build, formatting, vet, lint, and contracts: make embed-stub, go build ./..., gofmt -l ., go mod tidy -diff, go vet ./..., make lint-changed, make lint-router-recovery, make verify-fork-pins, verify-settings-bindings-all, verify-playback-fixtures, verify-route-inventory, verify-apiv2-openapi, verify-apiv2-web-types, verify-apiv2-contract (0 breaking changes), verify-apiv2-fixtures, TestCommittedArtifactMatchesRouter, verify-local-paths, verify-case-collisions, verify-size-ratchet, verify-bidi, and verify-migrations all passed.
Go test suite: make test-go passed across all packages (including new edition-ordering and Watch Together tests).
Web gates: pnpm run lint, pnpm run format:check, pnpm run build, pnpm run budget:check, and make test-web (375 files, 3,611 tests, including all 13 subtitle conformance cases) all passed.
Live sandbox end-to-end check: verified against an isolated server sandbox on multi-edition movies where a 4K alternate cut had a lower file ID than a 1080p Theatrical cut. Confirmed /api/v2/catalog/items/{id}, /api/v2/watch/{id}, and Watch Together room selection all chose Theatrical first; verified remembered-edition promotion flipped both /items and /watch after starting an Extended cut; verified the web detail page opened on Theatrical, listed editions in server order, and streamed playback with concrete file_id and omitted audio_track_index/subtitle_track_index. Desktop web was exercised live; phone-width web layout was not separately captured because this change alters selection order rather than responsive layout.
Clients that have not updated yet still re-rank playback_variants locally and stay compatible because no /api/v2 field names, types, or statuses changed.
Clients running against an older server that orders playback_variants by lowest file ID will open on that server order until the server updates.
Checklist
I read and can explain the complete diff.
This pull request addresses one concern.
Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
The Evidence section shows every change a user can see, or how I checked a change nobody sees.
AI Disclosure
Harness: Antigravity in T3 Code
Tool(s): GitHub CLI; T3 Code browser preview; silo-dev-builder sandbox; silo-evidence
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 keeping concrete file_id at start, keeping quality caps and subtitle defaults client-finalized, reusing server edition ordering in Watch Together, and omitting automatic audio_track_index on Apple.
Note
Make the server authoritative for default edition and version ordering
Adds OrderPlaybackVariants in detail.go, which orders playback variants by explicit selected file, saved edition or file history, edition preference class, and first-part quality. Adds SelectPlaybackMarkers so all markers come from one source version instead of being filled from other cuts.
Applies the same ordering in the catalog, watch-detail, and Watch Together handlers. Watch Together room selection in selection_resolver.go now uses playback-variant order instead of picking the lowest file ID.
Removes client-side edition and file re-ranking in versionRankingUtils.ts. The client keeps only the local resolution cap within the server-ordered list; selectDefaultPlaybackVariantVersion falls back to the first server-ordered edition.
Adds resolveSubtitleAutoSelect filtering by isDeliverableSubtitleCodec in subtitleSort.ts, with a shared conformance fixture copied to the web app and a test keeping both copies in sync.
Updates API docs and OpenAPI schemas in catalog-api.md and openapi.json to describe server ordering, recommended file IDs, and part ordering.
Behavioral Change: nil markers on a chosen source version are no longer inherited from another cut; Watch Together defaults may differ when the lowest file ID was previously chosen; removed helpers include bestEditionAuto, editionPreference, compareServerOrder, playbackVersionExists, and selectedPlaybackMarker in the web and catalog packages.
Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).
The server now orders playback variants using viewer and edition preferences. Watch Together and web clients use that order when selecting versions. The web subtitle selector filters undeliverable codecs and updates automatic track selection. API descriptions and a shared conformance fixture document these behaviors.
Changes: Playback variant ordering
Layer / File(s)
Summary
Server variant ordering and API contract internal/catalog/detail.go, internal/catalog/playback_variant_order_test.go, internal/api/handlers/*, internal/apiv2/*, contracts/api/v2/openapi.json, docs/catalog-api.md
The catalog orders variants by selected file, remembered edition or file, edition preference, and first-part quality. Marker selection uses the selected file or first ordered variant default. API descriptions document recommended files, version ordering, and client selection guidance.
Watch Together version selection internal/watchtogether/selection_resolver.go, internal/watchtogether/selection_resolver_test.go
Watch Together checks readable versions in playback-variant order. Its fallback considers readability, presentation-part order, edition preference, and quality.
Web version selection web/src/api/v2/schema.ts, web/src/pages/ItemDetail/components/*
The web client preserves server edition and version order when selecting defaults and building edition options. It applies the local quality cap to server-ordered versions.
The web selector filters undeliverable codecs, checks exact track signatures, and applies language and forced-track rules. The shared fixture defines expected selections, and API descriptions explain omitted audio and subtitle selectors.
Silo-Server/silo-server issue 1159 — The changes add shared conformance cases for automatic subtitle selection from audio and forced-track fixtures.
Silo-Server/silo-server issue 1157 — The changes cover automatic subtitle selection by detected audio language, but do not address the other stated criteria.
Silo-Server/silo-server issue 5738 — The changes define server-side version ordering that a preview could display, but do not add the requested preview endpoint.
Suggested reviewers:rhainland, rangodj, blurbery
Merge Risk: Minimal · previous review ae978
The server now decides the default playback edition and version order, and the web client, Watch Together and subtitle selection follow it. The markers and picker-default concerns raised earlier are fixed in this revision. No remaining merge-blocking issue was found.
Security architecture risk: Moderate · up to ae978
Centralizing playback recommendations makes the default more consistent across clients. The main risk is in Watch Together: a room can now default to a cut that a viewer cannot play, even when the cut previously selected would have worked. Automatic recovery stays within the selected cut, so the host may need to choose another file explicitly.
Retained concerns
Minor · reliability · inferred: A readable opening file is not necessarily playable under a viewer's device capabilities or server policy. For example, the new canonical order can choose an HDR-only cut ahead of a lower-ID SDR cut that the merge base would have selected. If playback refuses the HDR source and that cut has no eligible sibling, automatic fallback cannot choose the playable SDR cut and leaves the room on the refused file. Preserve the shared timeline once playback starts, but make the recovery path explicit when the newly chosen default cannot play and another cut requires a fresh host selection.
observed — A personalized recommendation affects the acting viewer's detail response. A room's resolved file affects every participant's shared timeline, but the room selection does not grant access to that file. Playback independently checks the requesting viewer's item and file access, and room attachment checks that the playback session matches the selected file.
Trust Boundaries and Controls
observed — The requested content, library, and file IDs influence room selection through the acting profile's catalog access filter. An explicitly requested file must occur in the returned versions. Playback start authorizes the supplied file again before probing or planning, so the recommendation does not substitute for authorization.
Dependencies
observed — Web Item Detail uses server order for its unpinned default after explicit and remembered choices. It applies the device's quality cap within the chosen edition; when known versions exist but none fit, it selects the lowest known resolution in that edition rather than comparing other cuts.
Data and control flow
observed — Top-level markers follow the explicitly selected or recommended file. When that file has no marker, the server no longer fills the gap with timestamps from another cut.
Resilience and Maintainability Implications
observed — Watch Together resolves the file before staging and checks host identity and lobby state before persisting it. After a playback refusal, only a connected member can trigger fallback for the current revision and failed file. A successful replacement advances the revision and resets attachment readiness; a missing replacement leaves the selection unchanged. This protects against stale reports and timeline switches, but cannot repair a newly preferred cut for which no eligible same-timeline version exists.
Rollout and rollback
inferred — Clients adopting server-order selection need a server that supplies recommendation order. If only the server is rolled back, those clients can consume the older ordering without a schema error and silently change the default cut. In Watch Together, the host can avoid the implicit default by selecting an accessible file explicitly; the player still decides whether each viewer can play that file.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: the server becomes the authority for default edition and playback version order. The changeset matches this. It adds OrderPlaybackVariants and SelectPlaybackMarkers in…
Description check
The description states the problem, the approach, validation steps, risks, and a live evidence link. It covers the server-side ordering, the Watch Together change, the web client changes, and the shar…
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 server becomes the authority for default edition and playback version order. The changeset matches this. It adds OrderPlaybackVariants and SelectPlaybackMarkers in detail.go, applies that order in catalog and watch handlers, reuses it in Watch Together, and removes client-side edition and version ranking in the web app. The title uses the conventional refactor(playback) prefix and is 83 characters, which is acceptable.
Full details: Description check
Explanation
The description states the problem, the approach, validation steps, risks, and a live evidence link. It covers the server-side ordering, the Watch Together change, the web client changes, and the shared subtitle conformance fixture. The description is clearly related to the changeset.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
The reason will be displayed to describe this comment to others. Learn more.
Match the audio language when falling back to forced subtitles
When Auto cannot find the preferred subtitle language and showForcedSubtitles is enabled, this fallback selects a forced track in any language. For example, English subtitle preferences with Japanese audio and only a French forced track now automatically enable French subtitles. It can also choose an unrelated-language track over an available audio-language forced track based on format priority. Use the existing audio-language-aware forcedForAudio() fallback instead of searching all forced tracks.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 384de309c6: replaced the unconditional forced-track fallback with forcedForAudio() and added two conformance cases in contracts/playback/subtitle-selection-conformance.json. 🤖 Antigravity (gemini-4-neon)
The reason will be displayed to describe this comment to others. Learn more.
Unavailable effective edition skips the remembered edition fallback
An unavailable effectiveEditionKey causes selection to skip an available LastEditionKey and fall back to LastFileID or default ranking. Try each remembered key in priority order, falling back only when it has no matching variant.
Prompt for LLM
File internal/catalog/detail.go, lines 5078-5082:
Unavailable effective edition skips the remembered edition fallback
When the effective edition key is unavailable among accessible variants, the code skips `LastEditionKey` and falls directly to `LastFileID` or default ranking, even if the last edition is still available. Try each remembered key in priority order and fall back only when the preceding key has no matching variant.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 1a2e591310: OrderPlaybackVariants now tries effectiveEditionKey, then userData.LastEditionKey, then userData.LastFileID in priority order, falling through whenever a hint matches no accessible variant (TestOrderPlaybackVariantsRememberedFallback). 🤖 Antigravity (gemini-4-neon)
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. The described fallback order addresses the suggestion: if the effective edition is unavailable, selection tries the remembered edition before falling back to the last file. The added test is intended to cover that behavior.
I haven’t independently verified the commit or test.
The reason will be displayed to describe this comment to others. Learn more.
Watch Together ignores the host's remembered edition
A host who last watched a non-default cut can get a different edition than the catalog and watch endpoints recommend because DetailService.GetWatchDetail does not load that preference. Load and apply the host's edition preference before selecting the room version.
Prompt for LLM
File internal/watchtogether/selection_resolver.go, line 56:
Watch Together ignores the host's remembered edition
The room resolver receives variants from `DetailService.GetWatchDetail`, which never loads the host's remembered edition, so a host who last watched a non-default cut gets a different edition than the catalog and watch endpoints recommend. Load and apply the host's edition preference before selecting the room version.
The reason will be displayed to describe this comment to others. Learn more.
Intentional: Watch Together rooms use viewer-agnostic canonical edition order (detail.PlaybackVariants[0]) so a shared room starts on the canonical cut rather than one member's personal watch history. Clarified docs/catalog-api.md in 1a2e591310 to state this explicitly, and updated preferredVariantRoomVersion to prefer opening parts (PartIndex <= 1) over later-part-only variants. 🤖 Antigravity (gemini-4-neon)
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarifying. The suggestion to apply the host’s remembered edition is not applicable: Watch Together intentionally uses viewer-agnostic canonical ordering so the room does not inherit one participant’s personal history.
The opening-part preference also addresses the case where a variant contains only later parts. I haven’t independently verified the documentation or code changes.
Would you like me to save the viewer-agnostic selection decision as a repository memory for future reviews?
The reason will be displayed to describe this comment to others. Learn more.
Merged presentations can select a lower-quality file under the local cap
Concatenating individually sorted presentations can cause a 1080p cap to select a 480p file before a later 1080p file. Restore the top-level versions ordering after merging each edition's first-part versions.
Prompt for LLM
File web/src/pages/ItemDetail/components/versionRankingUtils.ts, lines 190-193:
Merged presentations can select a lower-quality file under the local cap
When one edition has multiple presentations, concatenating their individually sorted versions leaves the merged list out of quality order, so a 1080p cap can select the first presentation's 480p file before a later presentation's 1080p file. Restore the top-level server ordering after merging each edition's first-part versions.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 384de309c6: merged edition version lists now restore the server's top-level versions order via byServerOrder, covered by versionRankingUtils.test.ts. 🤖 Antigravity (gemini-4-neon)
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing the suggestion. The reported fix restores the server’s top-level version order after merging presentations, with a test covering the change. I haven’t independently verified the commit.
The reason will be displayed to describe this comment to others. Learn more.
Saved subtitle signatures bypass Auto mode language checks
A saved track can override matching audio or an empty preferredLanguage that disables subtitles. Move findExactSubtitleSignatureMatch after Auto mode's language checks.
Prompt for LLM
File web/src/player/utils/subtitleSort.ts, lines 243-246:
Saved subtitle signatures bypass Auto mode language checks
A saved signature now selects a full subtitle track before Auto checks whether the audio already matches the preferred language or subtitles are explicitly disabled with an empty language. Move the signature match after the Auto mode's language checks so saved tracks do not override those settings.
The reason will be displayed to describe this comment to others. Learn more.
Intentional cross-client behavior: an exact saved track signature outranks same-language suppression in auto mode across Web, Apple, Android (AutoSubtitleResolver), and Roku (guarded by conformance case auto_exact_track_signature_wins_over_same_language_suppression) so an explicit series/movie pick such as English SDH on an English show is preserved; mode="off" disables it. 🤖 Antigravity (gemini-4-neon)
The reason will be displayed to describe this comment to others. Learn more.
Understood. I withdraw the recommendation to move the signature match past the same-language check: the conformance case confirms that a saved exact track is intended to win in auto mode. Use mode="off" to disable it.
The empty preferredLanguage case is a separate question; the cited conformance case does not establish its intended behavior. Should an exact saved signature also take precedence when preferredLanguage is empty?
Would you like me to preserve the confirmed same-language behavior as a repository memory for future reviews?
The reason will be displayed to describe this comment to others. Learn more.
Auto mode selects forced subtitles in an unrelated language
Viewers can receive forced subtitles in a language unrelated to their audio. Restrict anyForced to tracks matching the appropriate audio language.
Prompt for LLM
File web/src/player/utils/subtitleSort.ts, lines 255-256:
Auto mode selects forced subtitles in an unrelated language
When no track matches the preferred subtitle language, this fallback selects any forced track regardless of its language, so an English-speaking viewer can receive forced subtitles in an unrelated language. Restrict forced-track fallback to the appropriate audio language.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 384de309c6: restricted the Auto forced-subtitle fallback to forcedForAudio() so unrelated-language forced tracks are ignored. 🤖 Antigravity (gemini-4-neon)
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. The reported fix in 384de309c6 addresses the concern by limiting the fallback to forced subtitles matching the audio language. I haven’t independently verified the commit.
Watch Together consumes catalog order but bypasses the viewer preference enrichment that gives that order its documented meaning. For a host whose remembered cut differs from the catalog's generic first playable cut, a room selection without a file ID can stage a different timeline even when both cuts are readable. The merge base already allowed disagreement by selecting the lowest-file-ID cut; the PR changes that rule without delivering the advertised shared default. Decide whether rooms should use the host's personalized recommendation or an explicitly documented room-specific default; keep the readable-source fallback explicit either way.
1
Use a variant order that differs from flat fallback.
Both assertions expect standard file 2. If preferredRoomVersion stops reading PlaybackVariants, this test still passes because flat fallback also selects file 2.
Add a case with Director's Cut first in the supplied variant order, as a remembered edition would produce. Expect file 1 with variants and file 2 without variants. This checks the resolver's new ordering contract independently of edition-name ranking.
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: 60d87002-3001-42e0-859e-279ec8caf0e1
Commits
Reviewing files that changed from the base of the PR and between a55887d and 16ce9e3.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Preferred editions inherit markers from another cut
The catalog response can expose timestamps from a different cut when the preferred edition lacks intro or credits markers. Change selectedPlaybackMarker to use only the promoted variant's default file and leave missing markers unset.
Prompt for LLM
File internal/api/handlers/catalog_resources.go, lines 159-162:
Preferred editions inherit markers from another cut
When the viewer's preferred edition has no intro or credits marker, `selectedPlaybackMarker` scans subsequent editions and returns their marker, so the catalog response exposes timestamps from a different cut. Select markers only from the promoted variant's default file and leave missing markers unset rather than falling back to another edition.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 1a2e591310: SelectPlaybackMarkers now reads markers solely from selectedFileID or variants[0].DefaultFileID (including nil) instead of scanning subsequent cuts (TestSelectPlaybackMarkers). 🤖 Antigravity (gemini-4-neon)
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. The described fix addresses the cross-edition marker fallback, and TestSelectPlaybackMarkers covers the selection behavior. I haven’t independently verified the commit or test results.
Watch Together shares the catalog comparator but not the viewer preference inputs. The API guide describes room defaults as reusing the acting viewer's order, yet a host whose remembered cut differs from the canonical cut can stage a different timeline when no file ID is supplied, even when both cuts are readable. Disagreement was possible in the merge base, but the new rule does not deliver the newly documented agreement. Should rooms use the host's personalized recommendation or explicitly promise a viewer-agnostic default? Keep the readable-source fallback explicit either way.
The new room selector treats the first visible part of the first readable variant as an opening part. If only part two of a preferred cut is visible, it can now displace a complete, lower-ID cut that the merge base would have started from the beginning. The fallback used after a playback refusal is pinned to the selected presentation and part, so it cannot repair that choice. For implicit room starts, distinguish a readable opening part from a readable later part before committing the shared source.
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: ca512ee9-cd28-4adf-b5a3-f67a3df46091
Commits
Reviewing files that changed from the base of the PR and between 16ce9e3 and 384de30.
Files skipped from review as they are similar to previous changes: 1
internal/watchtogether/selection_resolver.go
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
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
❌
⚠️ 4 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:
Preserve optional store capabilities through production wrappers
Detach mandatory cleanup from request cancellation and bound its lifetime
Preserve durable media identity and share identity-evidence precedence
Bound decoder throughput trades and share direct-play eligibility
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
❌
⚠️ 4 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:
Preserve optional store capabilities through production wrappers
Detach mandatory cleanup from request cancellation and bound its lifetime
Preserve durable media identity and share identity-evidence precedence
Bound decoder throughput trades and share direct-play eligibility
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments
1
A readable opening file is not necessarily playable under a viewer's device capabilities or server policy. For example, the new canonical order can choose an HDR-only cut ahead of a lower-ID SDR cut that the merge base would have selected. If playback refuses the HDR source and that cut has no eligible sibling, automatic fallback cannot choose the playable SDR cut and leaves the room on the refused file. Preserve the shared timeline once playback starts, but make the recovery path explicit when the newly chosen default cannot play and another cut requires a fresh host selection.
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: 6650a90f-263e-4286-a52f-eed9ad38d405
Commits
Reviewing files that changed from the base of the PR and between 618f8df and ae978da.
Files skipped from review as they are similar to previous changes: 1
internal/apiv2/watch.go
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
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; Android Silo-Server/silo-android#1133; Roku Silo-Server/silo-roku#128
Default edition and version selection lived in five places that disagreed. On a multi-edition title where a non-default cut (such as a 4K Director's Cut) had a lower file ID than the Theatrical cut,
/api/v2/catalog/items/{id}and/api/v2/watch/{id}orderedplayback_variantsby lowest file ID, Watch Together chose the lowest file ID directly, and each client re-ranked editions and versions locally. Direct-play paths and Watch Together rooms could open a different cut than the detail page, and every client duplicated the same edition and quality sorting rules.This change makes the server the authority for default edition and version order via the existing
playback_variantsandversionsarrays, reuses that order in Watch Together, removes the duplicate client ranking from the web app, and adds a shared cross-client subtitle selection conformance fixture.Approach
internal/catalog/detail.goaddsEditionPreferenceRankandOrderPlaybackVariantssoplayback_variants[0]is the server's recommended edition for the acting viewer: explicit remembered edition (effective_version_edition_key), thenuser_data.last_edition_key, then the edition holdinguser_data.last_file_id, then standard/unnamed editions, then theatrical editions, then other cuts, breaking ties by lowest file ID. Both catalog detail and watch-state builders apply this order.internal/watchtogether/selection_resolver.goreusesOrderPlaybackVariantsfor default room selection so Watch Together picks the same default cut as catalog detail instead of the lowest file ID./api/v2wire shapes stay unchanged;internal/apiv2/{catalog_items,watch,playback}.go,contracts/api/v2/openapi.json,web/src/api/v2/schema.ts, anddocs/catalog-api.mddocument the server-owned ordering and concretefile_idstart contract. Quality caps stay on the client because network tier is local to the device, and subtitle auto-resolution stays client-finalized because OS caption profiles and per-device burn-in support differ across platforms.web/src/pages/ItemDetail/components/versionRankingUtils.tsandversionOptions.tsdrop local edition preference and version re-sorting, opening onplayback_variants[0](or an explicit pick) and filtering that variant's server-ordered versions against the local quality cap.contracts/playback/subtitle-selection-conformance.jsondefines 13 cross-client subtitle auto-selection cases exercised in web and mirrored in the paired Apple, Android, and Roku PRs.Validation
make embed-stub,go build ./...,gofmt -l .,go mod tidy -diff,go vet ./...,make lint-changed,make lint-router-recovery,make verify-fork-pins,verify-settings-bindings-all,verify-playback-fixtures,verify-route-inventory,verify-apiv2-openapi,verify-apiv2-web-types,verify-apiv2-contract(0 breaking changes),verify-apiv2-fixtures,TestCommittedArtifactMatchesRouter,verify-local-paths,verify-case-collisions,verify-size-ratchet,verify-bidi, andverify-migrationsall passed.make test-gopassed across all packages (including new edition-ordering and Watch Together tests).pnpm run lint,pnpm run format:check,pnpm run build,pnpm run budget:check, andmake test-web(375 files, 3,611 tests, including all 13 subtitle conformance cases) all passed./api/v2/catalog/items/{id},/api/v2/watch/{id}, and Watch Together room selection all chose Theatrical first; verified remembered-edition promotion flipped both/itemsand/watchafter starting an Extended cut; verified the web detail page opened on Theatrical, listed editions in server order, and streamed playback with concretefile_idand omittedaudio_track_index/subtitle_track_index. Desktop web was exercised live; phone-width web layout was not separately captured because this change alters selection order rather than responsive layout.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-5835/
Risks
playback_variantslocally and stay compatible because no/api/v2field names, types, or statuses changed.playback_variantsby lowest file ID will open on that server order until the server updates.Checklist
AI Disclosure
silo-dev-buildersandbox;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 keeping concretefile_idat start, keeping quality caps and subtitle defaults client-finalized, reusing server edition ordering in Watch Together, and omitting automaticaudio_track_indexon Apple.Note
Make the server authoritative for default edition and version ordering
OrderPlaybackVariantsin detail.go, which orders playback variants by explicit selected file, saved edition or file history, edition preference class, and first-part quality. AddsSelectPlaybackMarkersso all markers come from one source version instead of being filled from other cuts.selectDefaultPlaybackVariantVersionfalls back to the first server-ordered edition.resolveSubtitleAutoSelectfiltering byisDeliverableSubtitleCodecin subtitleSort.ts, with a shared conformance fixture copied to the web app and a test keeping both copies in sync.bestEditionAuto,editionPreference,compareServerOrder,playbackVersionExists, andselectedPlaybackMarkerin the web and catalog packages.Macroscope summarized b7400e2.