Repository navigation
feat(catalog): add a video_with_episodes search scope - #1995
Conversation
Problem: a v2 search client cannot ask for movies, series, and episodes while leaving out audiobooks and books. The catalog type parameter takes one media scope; video covers movies and series only, and an unrecognized value is dropped, which searches every media type. iOS search sends video for All when audiobooks are hidden, so episodes never appear (silo-apple#337 C1). Change: /api/v2 accepts type=video_with_episodes on the query source. A text search (nonempty q) returns movies, series, and episodes ranked together, with no audiobooks, ebooks, or manga. Without q, and for getCatalogFilters and searchCatalogFacet, it covers the same rows as video, since browse never mixes episode rows into media items. Other sources answer 422 at query.type (body.type on POST catalog/query), and stored definitions (smart collections, sections) still reject the value. listPeople accepts it as media_scope. getCatalogSearchCapabilities advertises video_with_episodes_scope: true. Compat: additive. video keeps its meaning everywhere. The /api/v1 grammar is unchanged and still drops the value. Older servers drop it on the catalog (searching every type) and refuse it on listPeople, so clients must check the capability flag and fall back to video. Tests: scope expansion, definition validation, v1/v2 parsing, provider request, and a PostgreSQL end-to-end search over relevance, sorted, and rule-filtered paths; v2 handler, capability, and people tests. Regenerated the OpenAPI artifact, the capability fixture, and the web v2 types.
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:
|
|
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 13 minutes. View limit detailsLimit details: You’ve used all 4 included reviews currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (3)
ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (17)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughAdds the ChangesVideo-with-episodes search scope
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant CatalogAPI
participant ParseCatalogRequestWithOptions
participant CatalogResolver
participant catalogSearchAccess
participant SearchProvider
CatalogAPI->>ParseCatalogRequestWithOptions: Parse query with search scopes enabled
ParseCatalogRequestWithOptions-->>CatalogAPI: Return request with SearchMediaScope
CatalogResolver->>catalogSearchAccess: Select search item types
catalogSearchAccess-->>CatalogResolver: Return movie, series, and episode types
CatalogResolver->>SearchProvider: Search with selected item types and unscoped definition
Suggested reviewers: Merge Risk: ⚪ Minimal · up to This change adds an episode-inclusive search scope to the v2 API, gated by a capability flag and left out of browse and facets. No concrete merge-blocking risk was found. The PostgreSQL end-to-end test has not been run locally, so run it in CI before merging. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The new search option retains existing visibility checks and leaves ordinary browsing unchanged. No introduced access bypass was identified. Clients must check support before using the option, and verification remains incomplete. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❓ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 65.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 13 files. (4 skipped: 3 unsupported, 1 too large.) ✨ 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 |
|
C1 still needs initial human validation; this check does not treat an unrun case as unblocked or passed. Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
|
Changed the line to |
|
Silo's pull request guidance changed today (#2016). A PR that changes what a user sees now needs before-and-after evidence in its Evidence section, and a PR with no visible change says Missing here: Before-and-after excerpts of the catalog search response for the same query (for example 'Pilot') listing result titles, or screenshots of the client search. The rules are in Show visible changes, and the PR template shows the Evidence section layout. I've converted this PR to draft for now. Mark it ready for review once the Evidence section is filled in. Generated by Claude Code |
|
The excerpts cover the text-search results and capability flag, but not these other visible behaviors:
Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
|
The validation impact line omits two previously passed People-search cases and the tvOS Series search case. In
Suggested -Validation tasks: changes Silo-Server/silo-apple#337 C1
+Validation tasks: changes Silo-Server/silo-apple#307 C3; changes Silo-Server/silo-apple#308 C3; changes Silo-Server/silo-apple#337 C1; changes Silo-Server/silo-apple#338 C1Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
|
Added same-query people responses using media_scope=video_with_episodes and no-q catalog browse using type=video_with_episodes. Updated the validation line and rationale for Apple’s previously passed People-search cases and the shared tvOS search path. Those passed cases need re-validation. |
Quick104
left a comment
There was a problem hiding this comment.
Review of 09c4ac1. The scope does what the description says on both search providers. Episodes come back, audiobooks don't, video keeps its meaning, /api/v1 ignores the value, and stored definitions refuse it. Cursors and Meilisearch ranking sessions both bind the item types, so page 2 matches page 1 on any node. TestResolveVideoWithEpisodesSearch passes against a freshly migrated PostgreSQL database.
Two findings are inline. A summary comment follows with the remaining notes, including two older search bugs that this scope makes easier to reach.
Review by Claude Code (claude-opus-5-5), with a read-only cross-check by Codex (gpt-6.1-sol).
| Q string `query:"q" maxLength:"200" doc:"Name prefix or fragment; empty lists the first people"` | ||
| Limit int `query:"limit" minimum:"1" maximum:"100" default:"20" doc:"Most people to answer"` | ||
| MediaScope string `query:"media_scope" enum:"video,movie,series,episode,audiobook,ebook,manga" doc:"Restrict people to accessible credits in this media scope; omitted searches all media scopes"` | ||
| MediaScope string `query:"media_scope" enum:"video,video_with_episodes,movie,series,episode,audiobook,ebook,manga" doc:"Restrict people to accessible credits in this media scope; omitted searches all media scopes. video covers movies and series; video_with_episodes adds episodes (check getCatalogSearchCapabilities.video_with_episodes_scope first)"` |
There was a problem hiding this comment.
Low, needs your call: on real libraries, media_scope=video_with_episodes probably returns the same people as video.
PersonRepository.search reaches credits only through item_people JOIN media_items mi ... mi.type = ANY(...). Every production ReplacePeople caller writes credits for a media item: metadata enrichment for movies and series, plus the audiobook, ebook and manga paths. Episodes live in episodes, not media_items, so I found no path that stores an episode-typed credit. The existing media_scope=episode has the same gap, so this predates the PR.
Impact: the parameter doc, docs/catalog-api.md and the capability description say the scope "adds episodes". The description also says Apple's All search will now surface "people credited only on episodes", and the #307 C3 / #308 C3 entries rest on that. If no such credits exist, people search doesn't change for those cases. The people half of the evidence page would then show a synthetic fixture rather than real data. I couldn't check a real library's item_people rows, so treat this as likely rather than confirmed.
Options:
- Keep the value on
listPeoplefor symmetry with the catalog scope, and reword the docs to say it matchesvideountil episode credits are stored. - Drop it from
listPeople, and keep the capability description to the catalog.
Either way, the validation note for the two People-search C3 cases may need to change. I'm leaving this one to you.
…ource A section request carrying type=video_with_episodes failed the section's overlay check first, so the 422 named query.source (body.source on POST) instead of the documented query.type. Refuse the search-only scope on any recognized non-query source before the per-source checks run, and correct the comment that said only the query source runs a text search. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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:
|
Review summaryReviewed head: 85f20af (the PR's 09c4ac1 plus one fix commit from this review). Fit: 8/10 · Readiness: 7/10 — conditional Addressed
Open
Older bugs this scope makes easier to reach (not introduced here)A
Codex also traced two more that I haven't reproduced. Meilisearch ranking windows apply the query limit before the maturity filter. File-based sorts ( Apple's All search will now route through this path, so these deserve their own issue. They don't belong in this PR. Validated featuresThe changed behaviour is opt-in: only requests that send the new value see a difference. No passed case regresses.
Other checks
Scores
Review by Claude Code (claude-opus-5-5), with a read-only cross-check by Codex (gpt-6.1-sol). Fix commit by Claude Code. |
|
The evidence link covers people search and no-query browse, but the new scope also changes the filter values returned by these endpoints:
Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
|
One additional passed result is affected: Suggested Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
Conflict resolution: main's video_with_episodes search scope (#1995) and this branch's facet value search each added a flag to the catalog search capabilities; both are kept, and the OpenAPI document, fixtures, and web types are regenerated. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Problem
Related issue: #1249
Validation tasks: changes Silo-Server/silo-apple#307 C3; changes Silo-Server/silo-apple#308 C3; changes Silo-Server/silo-apple#337 C1; changes Silo-Server/silo-apple#338 C1
A v2 client cannot search movies, series and episodes together while leaving out audiobooks and books.
type=videocovers movies and series only, and an unknown value is dropped, which searches every media type. The iOS app sendsvideofor "All" when audiobooks are hidden, so a search for an episode title such as "Pilot" finds nothing.This adds a
video_with_episodesscope for text search and advertises it as a capability, so clients can opt in and keepvideoon older servers.Approach
/api/v2acceptstype=video_with_episodeson the query source. A text search (nonemptyq) returns movies, series and episodes ranked together, with no audiobooks, ebooks or manga.q, and forgetCatalogFiltersandsearchCatalogFacet, it covers the same rows asvideo, because browse never mixes episode rows into media items.query.type(body.typeonPOST catalog/query). Stored definitions (smart collections, sections) still reject the value.listPeopleaccepts it asmedia_scope.getCatalogSearchCapabilitiesadvertisesvideo_with_episodes_scope: true.docs/catalog-api.mddocuments the scope.The change is additive.
videokeeps its meaning everywhere, and/api/v1still drops the value. Older servers drop it on the catalog (searching every type) and refuse it onlistPeople, so clients must check the capability flag and fall back tovideo.Validation
go build,go vet,gofmt,make lint-changed: pass.make test-go: the only failures are the hardware-acceleration, transcode and probe tests that also fail onmainon the test machine (macOS, no VAAPI, QSV or NVIDIA devices). A few timing tests that failed once while the machine was loaded passed on three reruns.make verify-settings-bindings-all, the otherverify-*targets in CONTRIBUTING, and the router artifact test: pass.pnpm run lint,format:check,build,budget:checkandmake test-web(739 files, 5,786 tests): pass.SILO_TEST_DATABASE_URLand was not run locally.With Apple #630, All search uses this capability to include episodes and people credited only on episodes. That expands the results in the previously passed iOS and tvOS People-search C3 cases; re-run those cases after merge, along with Series search C1 on both platforms.
Supplementary evidence covers people search with media_scope=video_with_episodes and no-query browse with type=video_with_episodes, using the same synthetic fixture.
Evidence: https://evidence.siloserver.org/r/silo-server/pr-1995/
Evidence
No first-party client sends
video_with_episodesyet, so these are API excerpts. Same request both times, as the admin's profile, trimmed to each result'stypeandtitle(episodes also show their series):GET <server>/api/v2/catalog?type=video_with_episodes&q=PilotBefore
{ "total": 5, "items": [ { "type": "episode", "title": "Pilot", "series_title": "Maple Street", "season_number": 1, "episode_number": 1 }, { "type": "episode", "title": "Pilot", "series_title": "Harbor Lights", "season_number": 1, "episode_number": 1 }, { "type": "episode", "title": "Pilot", "series_title": "Open Road", "season_number": 1, "episode_number": 1 }, { "type": "audiobook", "title": "The Pilot" }, { "type": "movie", "title": "The Pilot Light" } ] }After
{ "total": 4, "items": [ { "type": "episode", "title": "Pilot", "series_title": "Maple Street", "season_number": 1, "episode_number": 1 }, { "type": "episode", "title": "Pilot", "series_title": "Harbor Lights", "season_number": 1, "episode_number": 1 }, { "type": "episode", "title": "Pilot", "series_title": "Open Road", "season_number": 1, "episode_number": 1 }, { "type": "movie", "title": "The Pilot Light" } ] }Before, the server ignored the unknown value and searched every media type, so the audiobook appeared. After, the audiobook is left out.
type=video&q=Pilotreturns only "The Pilot Light" on both builds.GET <server>/api/v2/catalog/search/capabilitiesBefore
{ "people_media_scope": true, "person_prefetch": true, "provider": "postgres" }After
{ "people_media_scope": true, "person_prefetch": true, "video_with_episodes_scope": true, "provider": "postgres" }Surface and build:
/api/v2/catalogsearch and/api/v2/catalog/search/capabilities; before c762177 (main at this PR's base), after 09c4ac1 (PR head). Test library with Movies, TV, Mixed and Audiobooks libraries and synthetic files; the three "Pilot" episodes and the audiobook "The Pilot" are in the test library.Risks
None identified. Clients that do not read the capability keep their current behaviour.
Merge order: Silo-Server/silo-apple#630 vendors this branch's fixtures and needs one more fixture sync after this merges. The app works against servers with or without this change.
Checklist
AI Disclosure
mainat medium effort, checking API compatibility, behaviour, tests and commit hygiene. It confirmed the change is additive on/api/v2, that browse, filters and saved definitions are unaffected, and that/api/v1ignores the value. No findings.Note
Add
video_with_episodessearch scope to catalog APIvideo_with_episodesmedia scope for people and catalog search. The newParseCatalogRequestWithOptionsparser in catalog_parser.go accepts it as a request type, stores it on the newCatalogRequest.SearchMediaScopefield, and rejects it for non-query sources withErrSearchMediaScopeSource.video_with_episodes_scope=true, and the OpenAPI contract, generated web schema, and catalog-api.md docs are updated. See catalog_items.go and catalog_search_capabilities.go.parseCatalogRequestin the v2 adapter now reports search-scope source errors atquery.typeinstead of the generic source location. Stored query definitions still rejectvideo_with_episodesviaIsValidMediaScope; only request parsing accepts it.Macroscope summarized 85f20af.