Skip to content

feat(search): include episodes in All results on servers that support it - #630

Merged
Quick104 merged 2 commits into
Silo-Server:mainfrom
Rhainland:feat/search-episodes
Oct 6, 2026
Merged

Quick104 merged 2 commits into
Silo-Server:mainfrom
Rhainland:feat/search-episodes

Conversation

@Rhainland

@Rhainland Rhainland commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: Silo-Server/silo-server#1249
Validation tasks: changes #337 C1

Dependency: the server side is Silo-Server/silo-server#1995. This PR works against servers with or without it (it checks a capability flag), so it can merge in either order. Its API v2 fixtures are synced from that PR's branch; run scripts/sync-apiv2-fixtures.sh once more after the server PR merges.

Search "All" with audiobooks hidden sent type=video, which covers movies and series only, so episodes never appeared: a search for "Pilot" showed No results. On servers that advertise the new video_with_episodes scope, "All" now includes episodes, captioned with their series and episode code.

Approach

  • Servers that advertise video_with_episodes_scope in GET /api/v2/catalog/search/capabilities get type=video_with_episodes for "All", and the same value as the people media_scope. Older servers keep video, because they ignore the new value on the catalog and reject it on people search. The Watch Party picker keeps video.
  • The capability read that already gated people search is shared by the title and people lookups and runs once per search model. If it times out or the connection fails, the search fails with the usual Try Again error instead of silently narrowing to video; a server without the read (404 or v1-only) offers no extra features.
  • While a new search waits, Search shows the grid's loading state instead of a blank page.
  • BrowseItem decodes series_id, series_title, season_number and episode_number. iOS and tvOS grids caption episode cards with the series name and "S01E02 · Pilot", and an episode card opens its series on that episode.

Validation

  • Unit tests for the scope choice per capability, the capability failure states, episode captions and routing: pass.
  • Manual, iPhone simulator against a server with the scope: "All" search for "Pilot" lists Breaking Bad S01E01 · Pilot; tapping it opens the series on Season 1 with Pilot selected. iPad: "Pilot" and "Grilled" pass.
  • Manual, iPad simulator with the server hung during a search: loading state, then the error with Try Again.
  • tvOS build-for-testing on this branch: pass.
  • 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):

a13-search

Risks

None identified for older servers; they keep today's behaviour.

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 that on iOS and macOS a tapped episode result loaded the episode page before redirecting to the series, because the card handled the tap itself. Episode cards now open the series directly. It also noted the fixtures pin a branch-only server commit, which the dependency note above covers.

Note

Include episodes in All search results on servers that support episode search

The Search screen now checks the server's search capabilities before an All-filter search. If the server exposes the new episode-search scope, the All filter uses the episode-inclusive scope; otherwise it keeps the video-only scope.

  • SiloAPI.catalogSearchFeatures returns normalized people and episode-scope support; 404 or server-update-required responses map to unsupported features, while other errors propagate (SiloAPI.swift)
  • SearchViewModel resolves the media scope once per search, shares one cached in-flight capability read across concurrent title and people work, and retries after a failed read (SearchViewModel.swift)
  • BrowseItem and section-item converters now carry series id, series title, season, and episode number. Episode cards show the series title as the primary caption and the episode code/title as secondary (Models.swift, EpisodeCardCaption.swift)
  • Selecting an episode result opens the parent series detail route with episode resume context instead of the episode itself (Route.swift, MediaCard.swift)
  • Search content now uses an explicit SearchContentState with a platform-specific loading view while a search is pending (SearchView.swift)
  • Risk: episode-aware searches wait for capability resolution and send no title request if that read fails non-404 (timeout, credentials); the cached read is cleared so later searches retry — check SearchViewModel.loadSearchFeatures and mediaScope

Macroscope summarized e4df997.

Search "All" with audiobooks hidden sent type=video, which covers movies and series only, so episodes never appeared (a search for "Pilot" showed No results). Servers that advertise video_with_episodes_scope in GET /api/v2/catalog/search/capabilities now get type=video_with_episodes for that case, and the same value as the people media_scope. Older servers keep video, because they ignore the new value on the catalog and reject it on people search. The Watch Party picker, which reuses the search model, keeps video.

The capabilities read that already gated people search is now shared by the title and people lookups and runs once per search model.

BrowseItem decodes series_id, series_title, season_number, and episode_number. The iOS and tvOS catalog grids caption episode cards with the series name and "S01E02 · Pilot", reusing EpisodeCardCaption from Home, and an episode card opens its series on that episode directly.

Resynced the API v2 contract fixtures to the server commit that adds the scope (09c4ac176, from the server pull request that adds it); they need one more resync once that commit lands on server main.
…ties can't be read

When the server stopped answering during a search, the capabilities read timed out after 15 seconds and Search quietly fell back to type=video. Once the server came back, an episode such as "Grilled" showed No results. The 401 in the server log was for that abandoned request: the server checked the session after the client had already disconnected, so the client never received the 401. The capabilities read uses the same authenticated path as the catalog and people reads and refreshes on a 401 like they do.

Search now narrows All to video only when the server actually answers without video_with_episodes_scope, or has no capabilities read (a v1-only server, or a 404). A timeout, lost connection, or refused credentials fails the search with the usual Try Again error, and the failed read is not kept, so the retry asks again.

While a new search waits for capabilities, titles, or people, Search shows the result grid's loading state (poster placeholders on iOS and macOS, a spinner on tvOS) instead of a blank page. The view model now decides which state the screen shows, and the view switches on that.
@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 59 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: 2feece63-6563-45a7-9d83-ab07d4c13381
📥 Commits

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

📒 Files selected for processing (30)
  • iosApp/Tests/APIv2ContractTests.swift
  • iosApp/Tests/Fixtures/APIv2/SOURCE
  • iosApp/Tests/Fixtures/APIv2/cancel_device_login_not_found.json
  • iosApp/Tests/Fixtures/APIv2/complete_account_identity_link_invalid_grant.json
  • iosApp/Tests/Fixtures/APIv2/complete_oauth_login_invalid_grant.json
  • iosApp/Tests/Fixtures/APIv2/create_account_identity_link_ticket_wrong_password.json
  • iosApp/Tests/Fixtures/APIv2/delete_account_identity_last_sign_in_method.json
  • iosApp/Tests/Fixtures/APIv2/download_capability.json
  • iosApp/Tests/Fixtures/APIv2/get_catalog_search_capabilities_ok.json
  • iosApp/Tests/Fixtures/APIv2/get_system_info_ok.json
  • iosApp/Tests/Fixtures/APIv2/link_account_identity_with_credentials_directory_refused.json
  • iosApp/Tests/Fixtures/APIv2/playback_installation_changed.json
  • iosApp/Tests/Fixtures/APIv2/playback_invalid_protocol.json
  • iosApp/Tests/Fixtures/APIv2/playback_start_opaque_ids.json
  • iosApp/Tests/Fixtures/APIv2/refresh_session_provider_unavailable.json
  • iosApp/Tests/Fixtures/APIv2/sign_in_with_network_identity_off_overlay.json
  • iosApp/Tests/Fixtures/DiagnosticsContract/SOURCE
  • iosApp/Tests/SearchCapabilityScopeTests.swift
  • iosApp/Tests/SearchEpisodeResultsTests.swift
  • iosApp/iosApp/Components/EpisodeCardCaption.swift
  • iosApp/iosApp/Components/MediaCard.swift
  • iosApp/iosApp/Components/MediaRow.swift
  • iosApp/iosApp/Navigation/Route.swift
  • iosApp/iosApp/Networking/APIv2/APIv2CatalogModels.swift
  • iosApp/iosApp/Networking/Models.swift
  • iosApp/iosApp/Networking/SiloAPI.swift
  • iosApp/iosApp/Screens/Browse/CatalogGrid.swift
  • iosApp/iosApp/Screens/Search/SearchView.swift
  • iosApp/iosApp/Screens/Search/SearchViewModel.swift
  • iosApp/iosApp/tvOS/Screens/Components/TVCatalogGrid.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 ❌

}

static func isEpisode(_ item: SectionItem) -> Bool {
static func isEpisode(_ item: some EpisodeCaptionSource) -> Bool {

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

Episode caption loss occurs in iosApp/iosApp/Components/EpisodeCardCaption.swift because the generalized isEpisode(_:) predicate handles catalog rows but recognizes only the lowercased string "episode" without trimming whitespace, rejecting accepted "episodes" values and whitespace-padded episode types. Use a shared API normalization helper that trims whitespace, compares case-insensitively, and recognizes both "episode" and "episodes".

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

Prompt for LLM

File iosApp/iosApp/Components/EpisodeCardCaption.swift:

Line 27:

Episode caption loss occurs in iosApp/iosApp/Components/EpisodeCardCaption.swift because the generalized isEpisode(_:) predicate handles catalog rows but recognizes only the lowercased string "episode" without trimming whitespace, rejecting accepted "episodes" values and whitespace-padded episode types. Use a shared API normalization helper that trims whitespace, compares case-insensitively, and recognizes both "episode" and "episodes".

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.

Not changing. The predicate is unchanged from main (item.type.lowercased() == "episode"); this PR only widens its parameter from SectionItem to the protocol. The server emits episode rows with the literal type episode: catalog search builds them as 'episode'::text (the search indexer and exact-episode search), and Home section rows use the same value. No v2 endpoint sends episodes or a padded type for an item, so there is nothing for the extra normalization to match.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Agreed—this suggestion is a false positive. I incorrectly assumed that episodes and whitespace-padded values were accepted item types without evidence.

Given the server contract you described, item.type.lowercased() == "episode" handles the emitted value correctly. Widening the parameter to EpisodeCaptionSource doesn’t change that behavior, so no normalization change is warranted for this PR.

@Quick104
Quick104 merged commit a47eb78 into Silo-Server:main Oct 6, 2026
6 checks passed
Quick104 added a commit that referenced this pull request Oct 7, 2026
#630 and #575 each added seriesId, seriesTitle, seasonNumber and
episodeNumber to BrowseItem. Both landed on main, so the struct declares
them twice and neither the iOS nor the tvOS app compiles. Keep the copy
#575 placed beside the progress fields, which the Watch Party series row
initializer passes in that order, and drop the duplicate arguments in
init(sectionItem:).

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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