fix(catalog): assign external subtitle track indexes#451
Conversation
buildVersionSubtitleTracks never set Index on external subtitle entries, so every external sub in a version's subtitle_tracks serialized the zero value. Any file with two external subs (or one external plus an embedded stream index 0) published duplicate indexes; clients keying subtitle rows on index crashed (Compose LazyColumn duplicate key) or resolved selections against the wrong track. Externals now carry their combined-space ordinal (externals occupy 0..n-1 in the playback selection space — the same identity session subtitle_urls and ResolveSubtitlePolicyV3 use); embedded entries keep their ffprobe stream indexes unchanged.
|
Warning Review limit reached
Next review available in: 48 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughExternal subtitle tracks now receive deterministic sequential indexes during track construction. A new test verifies external index uniqueness, embedded index preservation, track count, and external-track marking. ChangesSubtitle Track Indexing
Estimated code review effort: 2 (Simple) | ~5 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
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/catalog/detail.go`:
- Around line 3415-3421: The external subtitle loop in
internal/catalog/detail.go lines 3415-3421 must assign collision-free full
playback indexes, not local ordinals: follow the same positive-index and
zero-fallback contract used by downstream selectors, accounting for video,
audio, and embedded subtitle indexes. Add collision cases and assert both
consumer-facing and serialized indexes in
internal/catalog/detail_subtitle_tracks_test.go lines 15-42.
🪄 Autofix (Beta)
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: f392177d-70fc-4d98-8437-81ae4c686a97
📒 Files selected for processing (2)
internal/catalog/detail.gointernal/catalog/detail_subtitle_tracks_test.go
Summary
Without this, every external subtitle serialized with index
0, producing duplicate client keys and allowing the wrong subtitle track to be selected.Verification
go test ./internal/cataloggit diff --check upstream/main...HEADSummary by CodeRabbit
Bug Fixes
Tests