Repository navigation
fix(web): update metadata for selected version - #414
Conversation
|
Warning Review limit reached
Next review available in: 27 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 (8)
📝 WalkthroughWalkthroughMovie and episode detail views now derive displayed duration and quality badges from the selected playback version. A shared resolver handles file attributes, multipart durations, and runtime fallback. Tests cover resolver behavior and badge updates after version selection. ChangesSelected media badge summaries
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant ActionBar
participant DetailContent
participant resolveSelectedMediaSummary
participant MetadataBadges
participant QualityBadges
ActionBar->>DetailContent: select playback version
DetailContent->>resolveSelectedMediaSummary: resolve selected version
resolveSelectedMediaSummary-->>DetailContent: media summary
DetailContent->>MetadataBadges: update duration
DetailContent->>QualityBadges: update quality summary
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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.
🧹 Nitpick comments (1)
web/src/pages/ItemDetail/components/selectedMediaSummary.ts (1)
26-29: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueExtract
total_durationto reduce duplication.You can extract the fallback logic for
total_durationto a local variable to slightly improve readability and avoid evaluating the expression twice.💡 Proposed refactor
- const durationSeconds = - isMultipart && (selectedVariant?.total_duration ?? 0) > 0 - ? (selectedVariant?.total_duration ?? 0) - : (selectedVersion?.duration ?? 0); + const variantDuration = selectedVariant?.total_duration ?? 0; + const durationSeconds = + isMultipart && variantDuration > 0 + ? variantDuration + : (selectedVersion?.duration ?? 0);🤖 Prompt for 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. In `@web/src/pages/ItemDetail/components/selectedMediaSummary.ts` around lines 26 - 29, In the selectedMediaSummary duration calculation, extract selectedVariant?.total_duration with its zero fallback into a local variable, then reuse that variable for both the positivity check and the ternary result. Keep the existing selectedVersion?.duration fallback behavior unchanged.
🤖 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.
Nitpick comments:
In `@web/src/pages/ItemDetail/components/selectedMediaSummary.ts`:
- Around line 26-29: In the selectedMediaSummary duration calculation, extract
selectedVariant?.total_duration with its zero fallback into a local variable,
then reuse that variable for both the positivity check and the ternary result.
Keep the existing selectedVersion?.duration fallback behavior unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 7861d47b-d62a-4c6d-8648-ce79795efc5f
📒 Files selected for processing (7)
web/src/pages/ItemDetail/EpisodeContent.test.tsxweb/src/pages/ItemDetail/EpisodeContent.tsxweb/src/pages/ItemDetail/MovieContent.test.tsxweb/src/pages/ItemDetail/MovieContent.tsxweb/src/pages/ItemDetail/components/QualityBadges.tsxweb/src/pages/ItemDetail/components/selectedMediaSummary.test.tsweb/src/pages/ItemDetail/components/selectedMediaSummary.ts
|
Addressed the CodeRabbit maintainability nit in 38e3f9f by extracting |
Semantic resolution for the QualityBadges conflict with Silo-Server#365: the selected-version summary now carries the Dolby Vision-aware video range label (videoRangeLabel) instead of the boolean HDR flag, computed from the selected file's video tracks only. Also hardens the variant lookup against missing parts/versions arrays, matching versionRankingUtils. Co-Authored-By: Claude Fable 5 <[email protected]>
MovieContent and EpisodeContent carried identical local formatDuration helpers; move the minutes-based badge formatter into lib/mediaFormat as formatRuntimeMinutes alongside the other canonical media-spec helpers. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Pushed two maintainer commits addressing review findings and the conflict with main:
Validation: targeted suites pass (52 tests incl. a new file-scoped DV label case), |
Summary
Root cause
The hero runtime used the item-level metadata runtime, while quality badges independently selected the highest resolution, HDR flag, and audio codec from every available file. Changing the edition or version dropdown therefore did not affect the displayed badges and could produce a combination that did not belong to any single file.
User impact
Changing an edition or version now immediately updates runtime, resolution, HDR, and audio codec badges to describe that selected file. Multipart editions display their combined logical runtime.
Part of #196
Validation
pnpm exec vitest run src/pages/ItemDetail/MovieContent.test.tsx src/pages/ItemDetail/EpisodeContent.test.tsx src/pages/ItemDetail/components/selectedMediaSummary.test.ts src/pages/ItemDetail/components/versionRankingUtils.test.ts --reporter=dot(39 tests passed)pnpm run lint(0 errors; existing warnings remain)pnpm run format:checkpnpm run buildmake verify-local-pathsThe full frontend suite passed 1,263 tests. Four unrelated existing tests failed because their test environments lack a QueryClient or ResizeObserver.
AI use disclosure
Codex was used to investigate the issue, implement the fix, add tests, and prepare this pull request. The resulting code and behavior were reviewed and validated locally.
Summary by CodeRabbit
New Features
Bug Fixes