fix(review): refresh capped RAG files on full reindex - #4405
Merged
Conversation
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4405 +/- ##
=======================================
Coverage 93.96% 93.96%
=======================================
Files 401 401
Lines 36892 36892
Branches 13490 13490
=======================================
Hits 34667 34667
Misses 1569 1569
Partials 656 656
🚀 New features to boost your workflow:
|
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
MAX_CHUNKS_PER_REPOas fully done before inspecting per-path metadata, which prevented changed files from being deleted/replaced and left stale chunks in capped repos.Description
src/review/rag-index.tsso the per-repo cap is checked only after consulting the stored per-path metadata and the unchanged-blob (blobSha) shortcut; the loop now allows processing a path if it has known stored chunks to delete and replace while still stopping for unknown/new paths once the cap is reached.if (stored >= MAX_CHUNKS_PER_REPO && (!known || known.count <= 0))to preserve the cap for genuinely new content but permit refreshes of existing paths.test/unit/rag-index.test.tsthat seeds a repo already at the cap, marks one path as changed (newblob_sha) and asserts that the changed file is re-embedded and the repo remains capped overall.Testing
npx vitest run test/unit/rag-index.test.ts -t "refreshes changed files", and it passed (regression reproduced and fixed).test/unit/rag-index.test.ts; the targeted regression and related index tests passed, but three existing cron fan-out tests in that file timed out (15s timeout) and are unrelated to the cap change.Codex Task