Skip to content

Fix library search parsing and source fallback failures - #167

Merged
filiksyos merged 1 commit into
mainfrom
fix/library-search-resilience-20261006
Oct 6, 2026
Merged

filiksyos merged 1 commit into
mainfrom
fix/library-search-resilience-20261006

Conversation

@filiksyos

@filiksyos filiksyos commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Quote and escape metadata values before composing raw PostgREST filters, including commas, parentheses, quotes and backslashes.
  • Complete the code search fallback chain independently of website results; recover FTS timeouts with metadata search and reuse one embedding for hybrid rows/count.
  • Preserve source failure state: return explicit partial-result metadata, avoid caching partial API responses, and return a retryable 503 on a total outage rather than false empty results.
  • Show retryable error/partial states in the library; prevent stale responses and pagination across changing source sets.
  • Add 21 credential-free regression tests and a focused GitHub Actions check.

Verification

  • 21 regression tests passed (pnpm test:library).
  • tsc --noEmit and changed-file ESLint passed.
  • Production next build passed using no external service credentials.
  • Independent review completed; both identified fallback/pagination edge cases fixed.
  • Full-repo pnpm lint still reports the existing lib/use-partner-preview.ts:13 set-state-in-effect error and two existing accessibility warnings in components/reverse-prompt-home.tsx.
  • Preview deployment and live API checks passed; see details below.

Provider configuration

The existing Azure embedding deployment failure and OpenAI fallback invalid_api_key are external configuration issues. No credentials, provider settings or database schema were changed. Keyword search now survives those failures.

Preview verification completed

  • Vercel preview READY for exact head 64710167858ea4fadc7e335794730627cf161b73.
  • GitHub Actions library-search passed all 21 regressions, TypeScript and focused ESLint: https://github.com/filiksyos/gitreverse/actions/runs/37471526409
  • Live API requests with comma, parentheses, quote and backslash searches no longer produce filter parse failures. accounting, returns 200 and keyword results despite the provider credential failure.
  • Some queries, including a full 24-result accounting search, can still intermittently exceed the existing 3-second database statement timeout. Failures now produce explicit partial-result metadata or a sanitized 503, rather than false empty success; database performance and provider configuration remain separate work.
  • Browser-based preview UI verification was blocked by Vercel authentication. No preview access-control change was made; the public production UI will be checked after the authorized merge.

Production verification

  • Merged as f464745e7c104996c02690fc37d5dd248ae1fda2; production deployment dpl_9DkhoGmcQ2HoW2sgcJSKHvA7eos6 is READY and attached to gitreverse.com.
  • Public production API punctuation checks passed. A 24-result accounting, search returned 200, 24 rows and total 4,814 through keyword fallback.
  • Public browser verified the partial-results warning on an intermittent DB timeout, successful recovery through Try again, and replacing an interrupted load-more request with a newer search.
  • No PostgREST parse-failure logs found for the new production deployment during verification.
  • Remaining infrastructure limitations: the embedding deployment/credential failures and intermittent database search timeouts need separate configuration/performance remediation. No database or security settings were changed.

Follow-up performance diagnosis (read-only)

Catalog inspection and EXPLAIN show the existing idx_prompt_cache_search_vector GIN index is used for the full-text count, but the sorted LIMIT 24 row query chooses the cached-at index and filters vectors row by row. An ID-first MATERIALIZED matching CTE instead plans GIN bitmap scan → matched-ID sort → 24 primary-key lookups. The narrow follow-up is a SECURITY INVOKER keyword-search RPC preserving filters, ordering and RLS, plus explicit database migration rollout. No database change, EXPLAIN ANALYZE or measured performance claim was made in this PR.

Preserve partial source failures, surface retryable outage states, share hybrid vectors, and cover search regressions.
@vercel

vercel Bot commented Oct 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
gitreverse Ready Ready Preview Oct 6, 2026 1:31pm UTC

Request Review

@filiksyos
filiksyos marked this pull request as ready for review October 6, 2026 13:35
@filiksyos
filiksyos merged commit f464745 into main Oct 6, 2026
4 checks passed

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

This branch was successfully deployed

1 active deployment
Preview — 64710167 Deployed Oct 6, 2026 by vercel[bot]
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.

1 participant