Repository navigation
fix(rag): drop stale legacy chunks from document summaries - #3662
Conversation
loadDocumentSummaryContext kept NULL-generation chunks alongside the committed generation's chunks. The fenced commit path does not delete legacy rows, so a reindexed document could be summarised from both its old and new text. Legacy rows now stand in only while the committed generation has written no chunks, matching the commit RPC's preserve rule. Search ranking and retrieval RPCs are unchanged; only the document summary context is affected. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018UBtJDgQZJ3eBsxLWte9r4
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Warning Review limit reachedYour organization has reached its usage spending cap. Adjust your spending cap in the billing tab. Next included review available in 42 minutes. View limit details
Comment |
Code Review ✅ Approved🟡 Medium risk · Changing summary chunk selection to drop legacy rows when committed chunks exist could omit useful context if generation metadata is inconsistent. Document summaries now drop stale NULL-generation legacy chunks once the committed generation has written its own chunks, so reindexed documents no longer mix old and new content. Documents never reindexed still summarise from legacy chunks. No issues found. VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Approved For more verification details, comment OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Important Your trial ends in 3 days — upgrade now to keep code review, CI analysis, auto-apply, custom automations, and more. Was this helpful? React with 👍 / 👎 | Gitar |
There was a problem hiding this comment.
BigSimmo has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Claude encountered an error after 2s —— View job I'll analyze this and get back to you. |
Summary
loadDocumentSummaryContextfilters out NULL-generation rows whenever any committed-generation row is present. No query, migration or ranking change.rag_cache_scope_revision_v1calls inrag-cache.ts) is deliberately not changed. Every call is a fresh before/after fence against revocation and mid-request reindexing, and the function's own contract forbids a memo. Making the RPC cheaper would need a database change.Areas touched: Answer engine
RAG impact: no retrieval behaviour change — only the document-summary context changes; search retrieval, ranking, ordering and RPCs are untouched, and the retrieval eval canary does not exercise summaries
Verification
tests/rag-document-summary.test.tswere run without the fix: "drops stale NULL-generation chunks once the committed generation has rows" failed (Tests 1 failed | 5 passed (6)). With the fix:Tests 6 passed (6).npm run test:focused:Tests 1328 passed (1328).Risk and rollout
Notes
Generated by Claude Code
Summary by cubic
Fixes document summaries mixing stale legacy chunks with newly committed chunks after a reindex.
loadDocumentSummaryContextnow drops NULL-generation (legacy) rows whenever the committed generation has written chunks of its own, matching the commit RPC's preserve rule. Documents that were never reindexed still summarise from their legacy chunks.Written for commit 6469d47. Summary will update on new commits.