fix: restore RAG search health indexes - #1614
Conversation
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe migration validates four required RAG search-health indexes without creating them. It reports missing, invalid, or mismatched indexes. Schema tests compare normalized definitions across the schema, migration, and drift manifest. Documentation records the drift investigation. ChangesRAG index restoration
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Comment |
Updates to Preview Branch (codex/restore-rag-indexes-20260804) ↗︎
Tasks are run on every commit but only new migration files are pushed.
View logs for this Workflow Run ↗︎. |
BigSimmo
commented
Aug 5, 2026
@codex review the exact current head. Focus on migration safety, idempotency, index definitions, rollback implications, and whether the tests actually pin the repository-to-production repair. Do not modify files or provider data. |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
BigSimmo
commented
Aug 5, 2026
@codex resolve actionable Codex review findings for this pull request and current head using the repository instructions. This is the pull request's single automatic repair pass: do not perform a fresh review, create new standalone findings, or request another review. Work only the existing unresolved Codex threads on the current head. The only repository destination is BigSimmo/Database, and the only branch destination is the pull request head branch codex/restore-rag-indexes-20260804 at starting commit f932897; never publish fixes to a detached or synthetic work branch and never create a stacked pull request. Use the authenticated GitHub connector to commit each approved fix to BigSimmo/Database:codex/restore-rag-indexes-20260804, then verify that the pull request head contains the published commit before reporting success. Always fix P0 and P1 findings. For P2 and lower findings, fix only clear, scoped, low-risk issues; otherwise disposition them with a concise reason. For a fixed thread, reply with as the first line and as the second line. For a no-code disposition, use followed by . These result markers authorize the workflow to close that exact thread only after it verifies a fixed commit is the pull request head; a local-only commit is not a fix. If publication or verification fails, do not use either result marker, do not claim success, and leave the thread open with the blocker. If human input or new authorization is required, do the same. Finish only after every actionable thread is fixed or dispositioned and closed, or explicitly left open for a human decision. Do not update the branch from main, address unrelated reviews, broaden scope, or create more than one scoped fix commit. Do not use external APIs, paid services, credentials, dependency changes, or broad refactors unless explicitly authorized. Add targeted tests where behavior changes and run the narrowest relevant validation. |
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
CI triageCI failed on this PR. Automated classification of the 2 failed job(s):
Compared with main CI run #8060 (cancelled). Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger. |
BigSimmo
commented
Aug 5, 2026
@codex review the exact current head |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
BigSimmo
commented
Aug 5, 2026
@codex please resolve failing CI testing and all comments and address any remaining issues with this PR |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Summary
Testing
|
BigSimmo
commented
Aug 5, 2026
@cursoragent Work the current open PR end-to-end. Confirm the PR number and GitHub head first from context. If more than one open PR could apply, stop and say which one you would use and why. Fetch and start from the remote tip that matches that GitHub head. If the named branch ref is missing or stale, use the PR head ref. Preserve unrelated local WIP, including any local-only ledger commits; do not discard dirty work, and do not treat a local-ahead commit as the reviewed tip. Do not merge the PR, force-push, rebase, or arm auto-merge unless I explicitly ask. No provider-backed gates without separate approval. If you cannot push or resolve threads, diagnose and comment only; if inline replies fail, resolve when possible and put dispositions in the summary comment. If auto-merge is already armed, push only for a real blocker, and avoid pushes that would cancel in-flight required CI unless the push itself clears that blocker. If the PR is already merged or closed: confirm the head and merge commit, note required-CI outcome, post one summary, and stop. Goal: deep review plus Bugbot, fix actionable issues with the smallest correct changes, clear merge / required-CI / thread blockers, run strong local offline verification, push fixes, append the review ledger, and post one PR summary. Prefer thoroughness over speed. Regenerate large assets only when a fix requires it; then run the asset check and keep compatibility aliases byte-identical where the repo uses them. Snapshot the GitHub head SHA: tip, base, behind/ahead, mergeable state, merge-tree versus origin/main (real conflict versus behind-but-clean), required checks on that tip including Production UI when selected, advisory separately, unresolved actionable threads. Missing checks while dirty are not green. If the tip moves mid-work, re-snapshot and continue from the new head. Ledger-lookup against that GitHub head under the heavy review-and-fix scope for this PR. Already reviewed at this head with clean merge-tree, green required checks, and no new actionable threads → summarize, comment, stop unless I asked for a fresh superseding pass. Follow the repo review protocol. Unblock once: real conflict → merge origin/main (prefer main’s shared queues; keep this PR’s notes); behind-but-clean → one sync, late if required CI is in flight; clean → leave. Labels like skip-branch-sync do not block a manual sync needed to clear a real blocker. No sync thrash. After any sync or push, re-snapshot tip, merge-tree, and required checks before declaring done. Dedupe the ledger if a merge touched it. Review high-confidence delta risks only. Separate PR-introduced defects from pre-existing re-emitted debt. For generated assets, review contracts, aliases, cache, and manifests—not every generated line. If protected RAG or ranking surfaces are touched, say so before editing; fix PR-body policy text only when wrong or missing. Ignore bot noise. No nit spam or broad rewrites. Escalate verification by touched risk: clinical / RAG / privacy / migrations / auth → domain check plus production-readiness when warranted; UI / phone-chrome / routing / styling → ensure plus phone-chrome or UI gates when warranted; generated assets or docs inventory/links → asset or docs checks when warranted. Fix P0/P1 always; clear scoped P2 when locally provable; else disposition and resolve. Required-check failures on this tip only; ignore advisory. Prefer reverting a bad autofix commit. After fixes: format and commit before push; smallest targeted proof; repo cheap gate; repo PR-local gate. No release, lighthouse, live eval, or live provider gates without approval. Push only this PR’s fix commits. Append ledger for the final GitHub head under the heavy scope. Never push a ledger-only tip—include ledger in a real fix push, or leave a no-change ledger append local and unpushed. One PR comment: tip, sync/merge-tree, fixed versus dispositioned, threads, required CI, decisive local gate lines, residual risks; merge left to me. Inline only for remaining human-needed P0/P1. Stop when merge-tree is clean on the current GitHub tip, actionable threads are clear, required checks are green or clearly in progress, heavy gates for scope passed, summary posted, merge left to me. REMEMBER TO GROUND YOUR RESPONSES AGAINST THE CURRENT REPO AND ENSURE THAT THE EDITS DO NOT CAUSE REGRESSION AND ADDITIONALLY, the edits make sense and take the entire repo and branch into account. |
PR #1614 is merge-ready on tip What I fixed
Status
Residual
|
Require presence, indisvalid/indisready, and normalized pg_get_indexdef matches for the four search-health indexes, and canonicalize drift-style table/(cols) spacing in the schema contract normalizer. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Temporary PR_POLICY_BODY.md so CI can rewrite the pull request description with the complete clinical governance checklist and risk/rollback fields. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
PR #1614 review-and-fix summaryTip: Fixed
Dispositioned / threads
Required CI on tip
Local gates (decisive)
Residual risks
Merge left to you. |
Use SET LOCAL for timeouts so later migrations on the same CLI session do not inherit them, document the canonical-only name and flat WHERE contracts, and pin SQL↔TS normalizer lockstep plus no-alias coverage in the schema test. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Record the out-of-band investigation that the #1614 repair migration does not itself explain why the earlier reconcile indexes were missing on live. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Review findings disposition (pasted follow-up + babysit)GitHub review threads were already resolved on tip
Pushed tip: Local proof
Skills
Merge left to you after fresh exact-head CI is green. |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
BigSimmo
commented
Aug 5, 2026
@cursoragent resolve merge conflict |
Merge conflict on PR #1614 is resolved and pushed. Conflict: only Resolution: kept main’s Tip: |
Merge conflict resolvedTip: Resolution: kept main’s Checks: |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Order changes the normalized output, so presence-only checks are not enough.
Uh oh!
There was an error while loading. Please reload this page.
The 2026-08-06 row for PR #1614's post-merge audit used a raw commit SHA in the "Branch or ref" column instead of a PR/branch reference, so ledger:lookup could never find it by branch name or PR number — defeating the review-throttle guard. Flagged independently by Devin and Sentry review bots on PR #1636. Append-only ledger, so this supersedes rather than edits the prior row. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EGgb4y8raYMDE4mAXUGmT6


Summary
indisvalid/indisready), or non-canonical versus the pinned definition; a drifted hosted target must prebuild missing indexes withCREATE INDEX CONCURRENTLYoutside the migration transaction, validate them, and only then mark the version applied.schema.sql.schema.sql, anddrift-manifest.json, while separately pinning the mark-applied guard.RAG impact: no retrieval behaviour change — full definitions are pinned but unchanged; the guard validates presence, validity, and canonical match only.
Verification
f932897760ff667ddecd5d5db405303761a1b82anpm run check:rag:fixtures— 36 golden cases, 23 suitesnpm run check:migration-rolenpm run test -- tests/supabase-schema.test.ts— 74/74 after validation + normalizer fixsearch_schema_health()—ok: true,missing: [](pre-fix evidence)indisvalid=trueandindisready=true(pre-fix evidence)npm run eval:retrieval:quality— not required because no retrieval/ranking SQL, comparator, or index definition changesRisk and rollout
Clinical Governance Preflight
Clinical KB Database(sjrfecxgysukkwxsowpy)Merge gate
Do not merge until fresh exact-head CI passes and migration-safety review threads are verified against the current head.
Summary by CodeRabbit
Bug Fixes
Tests
Documentation