Repository navigation
[codex] feat(jellycompat): use catalog search provider - #236
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughUpdates Jellyfin compat search to use Compat Catalog Search Integration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
Note Unit test generation is a public access feature. Expect some limitations and changes as we gather feedback and continue to improve it. Generating unit tests... This may take up to 20 minutes. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
cmd/silo/main.go (1)
2188-2198: 🚀 Performance & Scalability | 🔵 Trivial | 🏗️ Heavy liftShare the existing
CatalogSearchServiceinstead of creating a second one.
internal/api/router.goLines 453-462 already build aCatalogSearchServiceand startStartCoverageRefresh. Spinning up another service here means every compat-enabled process runs two coverage-refresh loops against the same DB/settings. Please construct it once incmd/siloand pass the shared service/provider into both the API router and JellyCompat. As per coding guidelines,cmd/silocontains the main server entrypoint, so server bootstrap and executable wiring should live there.🤖 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 `@cmd/silo/main.go` around lines 2188 - 2198, The compat bootstrap is creating a second CatalogSearchService and starting another StartCoverageRefresh loop; instead, construct the CatalogSearchService once in cmd/silo/main.go and share that same instance/provider with both the API router and JellyCompat. Update the wiring around catalog.NewCatalogSearchService, StartCoverageRefresh, and compatDeps.CatalogSearchProvider so the service is created and initialized only once in the main server entrypoint, then passed through to the router setup rather than rebuilt inside internal/api/router.go.Source: Coding guidelines
🤖 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 `@cmd/silo/main.go`:
- Around line 2188-2198: The compat bootstrap is creating a second
CatalogSearchService and starting another StartCoverageRefresh loop; instead,
construct the CatalogSearchService once in cmd/silo/main.go and share that same
instance/provider with both the API router and JellyCompat. Update the wiring
around catalog.NewCatalogSearchService, StartCoverageRefresh, and
compatDeps.CatalogSearchProvider so the service is created and initialized only
once in the main server entrypoint, then passed through to the router setup
rather than rebuilt inside internal/api/router.go.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a0bab040-5d3a-4b52-a0ae-ef62986a7dc1
📥 Commits
Reviewing files that changed from the base of the PR and between 41a1fc8 and 451c5a4120d6f0807465833b11e4ca3888a633f0.
📒 Files selected for processing (11)
cmd/silo/main.gointernal/api/router.gointernal/jellycompat/batch_progress_test.gointernal/jellycompat/content_direct.gointernal/jellycompat/content_direct_test.gointernal/jellycompat/content_service.gointernal/jellycompat/handlers_items.gointernal/jellycompat/handlers_items_test.gointernal/jellycompat/handlers_persons.gointernal/jellycompat/router.gointernal/jellycompat/server.go
|
✅ Created PR with unit tests: #237 |
451c5a4 to
9472b34
Compare
|
Follow-up validation for Jellyfin Web search buckets:
This fixes the regression where Series were being inferred into the Videos bucket from exclude-only filters. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@internal/jellycompat/query.go`:
- Around line 346-358: The effectiveItemTypes helper is collapsing exclude-only
requests with unknown values to nil, which later causes handlers_items.go to
treat the filter as no-match instead of keeping the default compat video scope.
Update effectiveItemTypes so that when rawIncluded is empty and rawExcluded maps
to no compat types, it still returns compatVideoTypeList; only return a reduced
or empty set when excluded values actually intersect with compat item types. Use
the existing symbols effectiveItemTypes, mapIncludeItemTypes, hasNonEmptyValues,
and compatVideoTypeList to keep the behavior consistent.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: eef19459-080d-4c58-9e7e-6d43882bc635
📥 Commits
Reviewing files that changed from the base of the PR and between 451c5a4120d6f0807465833b11e4ca3888a633f0 and 9472b34.
📒 Files selected for processing (13)
cmd/silo/main.gointernal/api/router.gointernal/jellycompat/batch_progress_test.gointernal/jellycompat/content_direct.gointernal/jellycompat/content_direct_test.gointernal/jellycompat/content_service.gointernal/jellycompat/handlers_items.gointernal/jellycompat/handlers_items_test.gointernal/jellycompat/handlers_persons.gointernal/jellycompat/query.gointernal/jellycompat/query_test.gointernal/jellycompat/router.gointernal/jellycompat/server.go
🚧 Files skipped from review as they are similar to previous changes (10)
- internal/jellycompat/router.go
- internal/api/router.go
- internal/jellycompat/content_service.go
- cmd/silo/main.go
- internal/jellycompat/server.go
- internal/jellycompat/content_direct_test.go
- internal/jellycompat/batch_progress_test.go
- internal/jellycompat/handlers_persons.go
- internal/jellycompat/handlers_items_test.go
- internal/jellycompat/content_direct.go
| func effectiveItemTypes(rawIncluded, rawExcluded []string) []string { | ||
| included := mapIncludeItemTypes(rawIncluded) | ||
| excluded := mapIncludeItemTypes(rawExcluded) | ||
| if len(excluded) == 0 { | ||
| return included | ||
| } | ||
|
|
||
| base := included | ||
| if len(base) == 0 && !hasNonEmptyValues(rawIncluded) { | ||
| base = compatVideoTypeList | ||
| } | ||
| if len(base) == 0 { | ||
| return nil |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Keep exclude-only unknown types on the default compat scope.
When ExcludeItemTypes is present but none of its values map to compat types (for example ExcludeItemTypes=TvChannel), this helper returns nil. Line 278 in internal/jellycompat/handlers_items.go then treats hasItemTypeFilter && len(itemTypes) == 0 as no-match, so those requests now return an empty page instead of the default video scope. Only exclusions that actually remove compat types should collapse the set.
Suggested fix
func effectiveItemTypes(rawIncluded, rawExcluded []string) []string {
included := mapIncludeItemTypes(rawIncluded)
excluded := mapIncludeItemTypes(rawExcluded)
if len(excluded) == 0 {
+ if len(included) == 0 && !hasNonEmptyValues(rawIncluded) && hasNonEmptyValues(rawExcluded) {
+ return compatVideoTypeList
+ }
return included
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| func effectiveItemTypes(rawIncluded, rawExcluded []string) []string { | |
| included := mapIncludeItemTypes(rawIncluded) | |
| excluded := mapIncludeItemTypes(rawExcluded) | |
| if len(excluded) == 0 { | |
| return included | |
| } | |
| base := included | |
| if len(base) == 0 && !hasNonEmptyValues(rawIncluded) { | |
| base = compatVideoTypeList | |
| } | |
| if len(base) == 0 { | |
| return nil | |
| func effectiveItemTypes(rawIncluded, rawExcluded []string) []string { | |
| included := mapIncludeItemTypes(rawIncluded) | |
| excluded := mapIncludeItemTypes(rawExcluded) | |
| if len(excluded) == 0 { | |
| if len(included) == 0 && !hasNonEmptyValues(rawIncluded) && hasNonEmptyValues(rawExcluded) { | |
| return compatVideoTypeList | |
| } | |
| return included | |
| } | |
| base := included | |
| if len(base) == 0 && !hasNonEmptyValues(rawIncluded) { | |
| base = compatVideoTypeList | |
| } | |
| if len(base) == 0 { | |
| return nil |
🤖 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 `@internal/jellycompat/query.go` around lines 346 - 358, The effectiveItemTypes
helper is collapsing exclude-only requests with unknown values to nil, which
later causes handlers_items.go to treat the filter as no-match instead of
keeping the default compat video scope. Update effectiveItemTypes so that when
rawIncluded is empty and rawExcluded maps to no compat types, it still returns
compatVideoTypeList; only return a reduced or empty set when excluded values
actually intersect with compat item types. Use the existing symbols
effectiveItemTypes, mapIncludeItemTypes, hasNonEmptyValues, and
compatVideoTypeList to keep the behavior consistent.
* feat(jellycompat): use catalog search provider * fix(jellycompat): route video search buckets to provider
Part of #201. Follow-up to #220.
What changed
QueryResultresponse shape while propagatingEnableTotalRecordCount=falseasSkipTotalto the search provider.Why
Clients such as Infuse, VidHub, and other Jellyfin API consumers should benefit from the same search engine selection as the native Silo catalog API instead of staying on the older direct search path.
Validation
git diff --checkGOWORK=off go test ./internal/jellycompat -run 'Test(SearchItemsUsesCatalogSearchProviderWithCompatScope|SearchItemsFallsBackToItemRepoWhenProviderMissing|HandleItemsSearchPropagatesEnableTotalRecordCount)$' -count=1GOWORK=off go test ./internal/catalog ./internal/api/handlers -count=1make dev-deploy.catalog.search.provider = meilisearch, the active index is populated, and pending index events are 0./Search/Hints?SearchTerm=Little Trouble Girls&Limit=5returned 200 with the expected movie result./Users/{id}/Items?...IncludeItemTypes=Movie,Series&EnableTotalRecordCount=falsereturned 200 with results./Users/{id}/Items?...IncludeItemTypes=Movie,Series&EnableTotalRecordCount=truereturned 200 with results.Notes
GOWORK=off go test ./internal/jellycompat -count=1still fails the existing web-component lock tests:TestBeginWebOperationRecoversDeadProcessLockandTestBeginWebOperationRejectsLiveProcessLock../cmd/silocompile remains blocked locally whenweb/distis absent, due the existing embed asset requirement.AI-assisted implementation with manual review and live dev validation.
Summary by CodeRabbit