Skip to content

fix(detail): count the library's seasons in the series hero - #635

Merged
Quick104 merged 2 commits into
Silo-Server:mainfrom
Rhainland:fix/season-count-library
Oct 6, 2026
Merged

Quick104 merged 2 commits into
Silo-Server:mainfrom
Rhainland:fix/season-count-library

Conversation

@Rhainland

@Rhainland Rhainland commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: N/A
Validation tasks: changes #337 C2; changes #338 C2

The series hero read "5 Seasons" for a show whose library holds only Season 1, Season 2 and Specials. It showed season_count, which comes from the metadata provider and counts every aired season. The hero now counts the seasons on the server, so it agrees with the season chips.

Approach

The hero counts the seasons the series page loads from the library, leaving out Specials, and leaves the count off until the season list arrives. tvOS shares the facts line and gets the same change. (The web series page already counts its loaded seasons.)

Validation

  • Unit tests for ignoring the provider total, skipping Specials and hiding the count before seasons load, on iOS and tvOS: pass.
  • Manual, iPhone simulator: Breaking Bad with Specials, Season 1 and Season 2 reads "2 Seasons".
  • scripts/ci/check-no-api-v1.sh: pass.
  • All 22 app fixes from this validation run, merged together on main (6242652): the full iOS unit suite ran 2,691 tests. The only failures are ArtworkURLTests.testDeliveryCapabilityOnIOSUsesV2RouteAndResets and ImageSizeCapabilityTests.testResetClearsCapability, which fail the same way on main. tvOS build-for-testing and the macOS build succeed.
  • Local builds used Swift 6.3.3, which needs the ThumbHash type annotations from fix(build): annotate ThumbHash cosine tables so Swift 6.3.3 can type-check them #608 to compile. That change was applied locally and is not part of this PR.

Simulator screenshots (iOS 26.5, tvOS 26.5):

a18-seasons

Risks

None identified.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.

AI Disclosure

  • Harness: Claude Code, running in T3 Code
  • Tool(s): Claude Code subagents, xcodebuild, Xcode Simulator (simctl, Maestro), GitHub CLI
  • Model(s): claude-opus-5-5
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: A separate Claude Code reviewer agent (claude-opus-5-5) read this branch's diff against main at medium effort, checking behaviour, platform guards (iOS, tvOS, macOS), tests and commit hygiene. It found the phone tests would not compile in the tvOS test target. They are now iOS-only, and a tvOS test covers the tvOS facts line.

Note

Fix series hero to count library seasons instead of provider total

  • Adds Array<Season>.librarySeasonCount, which counts only non-Special, non-zero seasons in Models.swift
  • Updates PhoneHeroMetadata.seriesFactsLine and TVHeroMetadata.seriesFactsLine to use this count from the loaded library season list instead of ItemDetail's provider season total
  • The season count is omitted from the facts line until seasons load; episode-focused facts on tvOS are unchanged
  • Adds SeriesHeroSeasonCountTests covering Specials exclusion, singular/plural labels, and the empty-list case, with fixtures decoded through the production HTTP decoder
  • Behavioral Change: the hero season count can differ from the provider's reported total, and shows no count while the season list is empty

Macroscope summarized 53b4f37.

The series hero read "5 Seasons" for a show whose library holds only Season 1, Season 2, and Specials. It showed season_count, which comes from the metadata provider and counts every season the show has aired, not the seasons on the server.

The hero now counts the seasons the series page loads from the library, leaving out Specials, so it agrees with the season chips. The count stays off the facts line until the season list arrives. The web series page also counts its loaded season list rather than season_count. tvOS shares the same facts line and gets the same change.

SeriesHeroSeasonCountTests covers the provider total being ignored, Specials being skipped, and the count staying hidden before seasons load.

Found during the Series validation, silo-apple#337.
@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 25 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1d7b5f28-102b-47f7-b726-8aaf1c73a774
📥 Commits

Reviewing files that changed from the base of the PR and between 6242652 and 53b4f37.

📒 Files selected for processing (6)
  • iosApp/Tests/SeriesHeroSeasonCountTests.swift
  • iosApp/iosApp/Networking/Models.swift
  • iosApp/iosApp/Screens/Detail/Phone/PhoneHeroMetadata.swift
  • iosApp/iosApp/Screens/Detail/SeriesDetailContent.swift
  • iosApp/iosApp/tvOS/Screens/Detail/TVDetailHero.swift
  • iosApp/iosApp/tvOS/Screens/Detail/TVSeriesDetailView.swift
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@silo-kody

silo-kody Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

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 settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@Rhainland Rhainland mentioned this pull request Oct 5, 2026
11 tasks

private func season(_ number: Int, isSpecials: Bool? = nil) throws -> Season {
let specials = isSpecials.map { ",\"isSpecials\":\($0)" } ?? ""
return try JSONDecoder().decode(Season.self, from: Data(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Kody Rules medium

Fixture decoding in iosApp/Tests/SeriesHeroSeasonCountTests.swift uses an unconfigured JSONDecoder for Season, so it does not exercise the production snake-case decoding configuration. Set decoder.keyDecodingStrategy to .convertFromSnakeCase, matching the ItemDetail fixture and the API contract.

Kody rule violation: Use consistent API normalization and production-equivalent decoding

Prompt for LLM

File iosApp/Tests/SeriesHeroSeasonCountTests.swift:

Line 46:

Fixture decoding in iosApp/Tests/SeriesHeroSeasonCountTests.swift uses an unconfigured JSONDecoder for Season, so it does not exercise the production snake-case decoding configuration. Set decoder.keyDecodingStrategy to .convertFromSnakeCase, matching the ItemDetail fixture and the API contract.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 53b4f37: the season fixtures now decode snake_case JSON into the v2 Season with HTTPClient.makeJSONDecoder() and project it through Season(catalog:), the path the seasons read uses.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks—the change described in 53b4f379 addresses this suggestion. Using snake_case fixtures with HTTPClient.makeJSONDecoder() and then Season(catalog:) exercises the production decoding and projection path, rather than just configuring a standalone decoder. No further change is needed for this comment.

SeriesHeroSeasonCountTests decoded Season from camelCase keys with a
default JSONDecoder, a path the app never uses for seasons. The
fixtures now decode the server's snake_case JSON into the v2 Season
with HTTPClient's decoder and project it, as the seasons read does.
@silo-kody

silo-kody Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

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 settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@Quick104
Quick104 merged commit 7eeabf2 into Silo-Server:main Oct 6, 2026
6 checks 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