Skip to content

fix(web): update metadata for selected version - #414

Merged
Quick104 merged 4 commits into
Silo-Server:mainfrom
Rhainland:fix/meta-selected-version
Jul 16, 2026
Merged

Quick104 merged 4 commits into
Silo-Server:mainfrom
Rhainland:fix/meta-selected-version

Conversation

@Rhainland

@Rhainland Rhainland commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • derive movie and episode hero runtime and quality badges from the selected file version
  • use the logical playback-variant duration for multipart editions
  • share the selected-media summary logic across movie and episode detail pages
  • add regression coverage for version switching, multipart duration, and file-scoped audio metadata

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:check
  • pnpm run build
  • make verify-local-paths
  • manual browser validation with Standard, Director's Cut 1080p, and Director's Cut 720p fixtures

The 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

    • Media detail pages now display duration, resolution, HDR, and audio badges for the currently selected playback version.
    • Multipart playback durations are reflected accurately, with fallback to the item’s runtime when needed.
  • Bug Fixes

    • Updated metadata and quality badges automatically when selecting a different movie or episode version.

@Rhainland
Rhainland marked this pull request as ready for review July 15, 2026 19:36
@coderabbitai

coderabbitai Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Quick104, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 27 minutes

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

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 950884da-6c33-4f39-9a2d-86a6211addaa

📥 Commits

Reviewing files that changed from the base of the PR and between 1b9cc3d and 786b435.

📒 Files selected for processing (8)
  • web/src/lib/mediaFormat.ts
  • web/src/pages/ItemDetail/EpisodeContent.test.tsx
  • web/src/pages/ItemDetail/EpisodeContent.tsx
  • web/src/pages/ItemDetail/MovieContent.test.tsx
  • web/src/pages/ItemDetail/MovieContent.tsx
  • web/src/pages/ItemDetail/components/QualityBadges.tsx
  • web/src/pages/ItemDetail/components/selectedMediaSummary.test.ts
  • web/src/pages/ItemDetail/components/selectedMediaSummary.ts
📝 Walkthrough

Walkthrough

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

Changes

Selected media badge summaries

Layer / File(s) Summary
Selected media summary resolution
web/src/pages/ItemDetail/components/selectedMediaSummary.ts, web/src/pages/ItemDetail/components/selectedMediaSummary.test.ts
Adds SelectedMediaSummary and resolves selected-file duration, resolution, HDR, audio, multipart totals, and runtime fallback with test coverage.
Quality badge summary contract
web/src/pages/ItemDetail/components/QualityBadges.tsx
Changes QualityBadges to receive a resolved summary and render badges from its technical attributes.
Movie and episode badge integration
web/src/pages/ItemDetail/MovieContent.tsx, web/src/pages/ItemDetail/EpisodeContent.tsx, web/src/pages/ItemDetail/MovieContent.test.tsx, web/src/pages/ItemDetail/EpisodeContent.test.tsx
Passes selected media summaries into duration and quality badges and tests updates after ActionBar version changes.

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
Loading

Suggested reviewers: quick104

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: metadata now reflects the selected version.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

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

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

🧹 Nitpick comments (1)
web/src/pages/ItemDetail/components/selectedMediaSummary.ts (1)

26-29: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Extract total_duration to reduce duplication.

You can extract the fallback logic for total_duration to 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

📥 Commits

Reviewing files that changed from the base of the PR and between c36d70d and 1b9cc3d.

📒 Files selected for processing (7)
  • web/src/pages/ItemDetail/EpisodeContent.test.tsx
  • web/src/pages/ItemDetail/EpisodeContent.tsx
  • web/src/pages/ItemDetail/MovieContent.test.tsx
  • web/src/pages/ItemDetail/MovieContent.tsx
  • web/src/pages/ItemDetail/components/QualityBadges.tsx
  • web/src/pages/ItemDetail/components/selectedMediaSummary.test.ts
  • web/src/pages/ItemDetail/components/selectedMediaSummary.ts

Copy link
Copy Markdown
Contributor Author

Addressed the CodeRabbit maintainability nit in 38e3f9f by extracting variantDuration and reusing it in the multipart duration selection. This is behavior-preserving; the focused resolver suite still passes (5/5), and Prettier plus git diff --check are clean.

Quick104 and others added 2 commits July 16, 2026 15:00
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]>
@Quick104

Copy link
Copy Markdown
Contributor

Pushed two maintainer commits addressing review findings and the conflict with main:

  • Merge with main (095ad25): resolved the QualityBadges conflict with fix(overlays): derive dynamic-range badges from Dolby Vision metadata #365 semantically — SelectedMediaSummary now carries the Dolby Vision-aware videoRangeLabel (computed from the selected file's video tracks only) instead of the boolean hdr flag, so DV/HDR10+/HLG badges stay file-scoped when switching versions. Also hardened the variant lookup with parts ?? [] / versions ?? [] guards to match versionRankingUtils.
  • refactor (786b435): deduplicated the identical local formatDuration helpers in MovieContent/EpisodeContent into formatRuntimeMinutes in lib/mediaFormat.

Validation: targeted suites pass (52 tests incl. a new file-scoped DV label case), tsc -b clean, lint 0 errors, format:check and make verify-local-paths clean. The SeasonContent.test.tsx QueryClient failures are pre-existing on main from #364 and unrelated.

@Quick104
Quick104 merged commit 95779c4 into Silo-Server:main Jul 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants