Repository navigation
fix(detail): count the library's seasons in the series hero - #635
Conversation
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.
|
Warning Review limit reachedYou'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. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (6)
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 |
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
|
||
| private func season(_ number: Int, isSpecials: Bool? = nil) throws -> Season { | ||
| let specials = isSpecials.map { ",\"isSpecials\":\($0)" } ?? "" | ||
| return try JSONDecoder().decode(Season.self, from: Data( |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
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
scripts/ci/check-no-api-v1.sh: pass.main(6242652): the full iOS unit suite ran 2,691 tests. The only failures areArtworkURLTests.testDeliveryCapabilityOnIOSUsesV2RouteAndResetsandImageSizeCapabilityTests.testResetClearsCapability, which fail the same way onmain. tvOSbuild-for-testingand the macOS build succeed.Simulator screenshots (iOS 26.5, tvOS 26.5):
Risks
None identified.
Checklist
AI Disclosure
mainat 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
Array<Season>.librarySeasonCount, which counts only non-Special, non-zero seasons in Models.swiftPhoneHeroMetadata.seriesFactsLineandTVHeroMetadata.seriesFactsLineto use this count from the loaded library season list instead ofItemDetail's provider season totalSeriesHeroSeasonCountTestscovering Specials exclusion, singular/plural labels, and the empty-list case, with fixtures decoded through the production HTTP decoderMacroscope summarized 53b4f37.