Repository navigation
fix(search): answer search capabilities while Meilisearch is unreachable - #3159
Conversation
The capabilities read failed with a 500 whenever Meilisearch was configured but its index could not be read, although searches fall back to PostgreSQL. Apple clients read it only for the All scope, so All failed while Movies and Series worked. Report the PostgreSQL provider in that state instead.
Follow the same checks the ranking session uses, so capabilities also report the fallback while the circuit breaker is open or the index schema is incompatible, instead of waiting on Meilisearch.
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:
|
|
The iOS/tvOS “All” search transition from an error to results is not shown; the API excerpts establish the capabilities endpoint response but not the client-visible screen. Add before-and-after captures of the same search on the affected client surface(s), or explain why they could not be captured. No diff. Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
|
Fit: 10/10 · Readiness: 8/10 — conditional Reviewed head No new actionable code defects found. The fix belongs in the server's capability resolver: an optional search provider should not prevent clients from discovering features the PostgreSQL fallback supports. The new fallback gates match ranking-session creation, preserve cancellation and configuration errors, and leave existing cursors pinned to their original provider. Verification
Before landing
Validated features
These records cover successful name searches and do not identify a Meilisearch outage fixture. Their healthy search outcomes retain the same behavior; fallback recovery improves. No regression or major invalidation of those passes is established. The validation helper missed recorded closed tasks and some result formats, so raw task bodies were checked; this is not a complete validation-board audit. Compatibility and manual Apple and Android accept omitted Meilisearch limits; no client patch is required for this response. Web capability flags remain available. Jellyfin compatibility does not call the changed endpoint. Note AI disclosure: this review was produced for Quick104 by |
|
Thank you! Looking forward to this :D |
SearchContinuationCapabilities copied the checks createRankingSession uses to decide whether Meilisearch can rank a search, and the copy had already drifted (no client check, different error handling). Move the checks into one rankingIndex helper that both call, so capabilities keep reporting the provider searches actually use. Add a table row that keeps an unsupported result window an error rather than a PostgreSQL fallback. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Quick104
left a comment
There was a problem hiding this comment.
I reviewed 922d40d and found two things: a cleanup I'm making on this branch, and a contract question for the maintainers. The fix itself holds up. The new table test fails on the base in all four fallback rows and passes here.
🤖 Claude Code (claude-opus-5-5)
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:
|
Silo review summaryReviewed runtime head: 1739b27 (fix on top of the contributor's 922d40d), base 62b1a6e. Current head: 4819bf0, which documents the maintainer's capability-contract decision without changing runtime code. Fit: 8/10 · Readiness: 8/10 — required CI green, contract decision resolved Fit. This fixes a real client failure: the "All" search on iOS and tvOS failed while Meilisearch was down, even though searches kept working through PostgreSQL. The fix is on the server, where it belongs, because the apps deliberately treat a failed capabilities read as a failed search. It doesn't score higher because the capability document's Readiness. The new table test fails on the base in all four fallback rows and passes on the head. The author also checked the endpoint against a local build with Meilisearch stopped: 500 before the fix, 200 Addressed
Decisions and follow-ups
Validated featuresUnavailable: the validation board couldn't be read during this review. The User manualNo change needed. The Meilisearch section already says PostgreSQL answers searches while Meilisearch can't, and this PR makes the apps behave that way. Apple / AndroidNo client change is needed. Apple and Android read only the boolean flags from this document, and they accept a response without the Meilisearch limits. Review methodMulti-agent review (three finders and a verification pass) by Claude Code (claude-opus-5-5), plus one cross-provider round by Codex (gpt-6.1-sol) on 922d40d. Codex raised the health-contract question, now resolved by the maintainer, and a deadline-handling point, answered above. The evidence posted in the PR body still matches the current head; the follow-up commit doesn't change any response. 🤖 Claude Code (claude-opus-5-5) Contract documentation and CI handoff: Codex in T3 Code (gpt-6-astra). No approval or merge. |
|
The Go test failure on 1739b27 is the existing playback cleanup race in #3361: This run uses the same unmodified base on which the playback failure was already reproduced during this review batch. I requested one retry of the failed job: https://github.com/Silo-Server/silo-server/actions/runs/41359577323/job/125006923370. That attempt is superseded by documentation head 4819bf0, whose required CI now passes. The capability-contract decision is resolved: the maintainer chose the current serving provider, documented in 4819bf0. All review threads are resolved. — Codex in T3 Code, gpt-6-astra |
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
Closes #2617
Related issue: N/A
Validation tasks: none
On a server set up to use Meilisearch,
GET /api/v2/catalog/search/capabilitiesreturned a 500 ("An unexpected error occurred.") whenever Silo could not read the Meilisearch index: Meilisearch down or unreachable, or the index not built yet. Searches kept working in that state because they fall back to PostgreSQL. The iOS and tvOS apps read this endpoint only for the "All" filter, to decide whether to include episodes, and treat a failed read as a failed search. So "All" showed "An unexpected error occurred." while "Movies" and "Series" returned results. The web app does not need a successful capabilities read to search, so it kept working.This change makes the endpoint report the provider that is actually serving searches. While the Meilisearch index can't be read, it now answers
provider: postgreswithout the Meilisearch result window and session limits, which is what searches report insearch_diagnosticsin that state.Approach
The fix is in
CatalogResolver.SearchContinuationCapabilities. The checks that decide whether Meilisearch can rank a search live in onerankingIndexhelper, whichcreateRankingSessionand the capabilities read both call, so the two cannot drift apart. Silo reports PostgreSQL in the same cases where the Meilisearch provider sends searches to PostgreSQL: the index state can't be read, no index has been built, the index schema is incompatible, the provider's circuit breaker is open after recent failures, or Meilisearch can't return the index settings. A cancelled request still returns its error. Two configuration errors keep their existing responses: missing Redis session storage and an unsupported result window.No client change is needed. The apps already accept a response without the Meilisearch limits. The API contract and catalog documentation explicitly allow these provider and limit fields to reflect the responding server's current ranking availability. Replicas can differ, and these fields affect
revisionandETag. Clients use each search response'ssearch_diagnosticsfor its actual provider and limits.Validation
Local server with Meilisearch configured. The test data had movies, a series with 90 episodes whose titles contain the search word, audiobook and ebook libraries, and about 60,000 more synthetic episodes. I replayed the Apple Search requests with curl: the capabilities read, then a title search for each filter. Before the fix, the capabilities read returned 500 while Meilisearch was down. After the fix it returns 200 with
provider: postgres, and with Meilisearch running it still returnsprovider: meilisearchand its limits. Title searches returned 200 throughout.PostgreSQL-only search returned the same responses before and after the fix.
New table test: a reachable index reports Meilisearch and its limits. An unreachable server, an unbuilt index, an incompatible schema, or an open circuit reports PostgreSQL. Every fallback row fails without the fix.
Review follow-up (1739b27) moved the shared checks into
rankingIndexand added a table row that keeps an unsupported result window asearch_window_unsupportederror.go testforinternal/catalog,internal/apiv2andinternal/api/handlersandmake lint-changedpass on that commit.go build ./...,gofmt,go veton the touched packages,make lint-changed,make verify-local-paths,make verify-apiv2-openapi, andgo testforinternal/catalog,internal/apiv2andinternal/api/handlersall pass. The fullmake test-goand the web half were not run; this change touches no web code.Documentation follow-up (4819bf0):
git diff --checkandmake verify-local-pathspass. Runtime code is unchanged by that commit.Evidence
API responses from a local build, with Meilisearch stopped:
Not checked on an Apple device. From the Apple client code, the capabilities read is the only request "All" makes that the other filters don't, so it no longer fails there. The report doesn't say whether the reporter's server uses Meilisearch; the issue comment asks.
Risks
The capability answer reflects one server at the time of the read. It does not certify dependency health or guarantee that a later search will use the same provider. A PostgreSQL index-state read failure can also produce
provider: postgres, even when the database outage prevents searches. Provider and limit changes invalidate cached capability answers; Meilisearch fallbacks remain visible in logs and search diagnostics.Checklist
AI Disclosure
Note
Fix answer search capabilities reporting when Meilisearch is unreachable
MeilisearchSearchProvider.rankingIndex, which returns the active index, compatibility, and validated result window, and reports fallback when the client is absent, the circuit is open, the index is unbuilt or incompatible, or settings cannot be fetchedCatalogResolver.SearchContinuationCapabilitiesnow reports PostgreSQL capabilities without Meilisearch limits when the helper signals fallback, instead of returning an error; only context-cancellation errors still propagateMacroscope summarized 4819bf0.