Repository navigation
refactor(core): index_sync module owns insert/remove/persist policy (operations.rs) - #1347
Merged
Merged
Conversation
…operations.rs) Introduce index_sync with an IndexWriter seam (VectorIndex + a recording/failing fake in tests), one retry/persist policy and a SyncOutcome that reports what landed. Migrate every index call in operations.rs (remember, update, forget, soft_forget, promote, bulk_forget_*, delete_namespace) and the lib.rs add_to_index/remove_from_index helpers. Removes three inline copies of the 3x200ms retry plus persist_index_after_delete, and stops retrying deterministic dimension-mismatch errors. Refs #1340 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
This was referenced Oct 7, 2026
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.
What
Step 1 of the index sync module (#1340, tracked in #1345).
uteke-core/src/index_sync.rs: anIndexWriterseam (adapters:VectorIndex, plus a recording/failing fake in tests), oneSyncPolicy(3 attempts, 200 ms), and aSyncOutcomethat says what actually happened (insert_error,persist_error,missing). Entry points:upsert,remove_ids,persist.operations.rs—remember,update_memory,forget,soft_forget,promote,bulk_forget_{by_tag,cold,all}(soft + hard) anddelete_namespace— plusUteke::add_to_index/remove_from_indexinlib.rs. Direct index calls inoperations.rs: 15 → 0.persist_index_after_delete.forgetand bulk deletes still return an error when the index cannot be persisted (the DB rows are gone),rememberstill reportsembedding_written=false/vector_error,soft_forget/promotestill only warn.Why
~60 index call sites across 7 modules hand-sequenced store write → insert/remove → save with five different failure policies. A policy change (or a bug like the lock-timeout deletion fixed in #1320) had to be made in every copy. One module = one place to change, and a fake adapter lets the failure policy be tested without files or locks.
Behaviour changes (intended)
soft_forget/promotepersist with the same retry as the other paths (they used a single attempt,promoteignored the error).<op>: database rows were changed, but the vector index could not be updated: …. Run uteke repair).Testing
VectorIndex.cargo fmt --check,cargo clippy --workspace --all-targetsclean;cargo test --workspacegreen (core 596); vecq-only core build green (594).forget(exercised only through the fake adapter).Not in this PR
The remaining 33 direct call sites (
maintenance.rs14,lib.rs8 incl. document paths,consolidate.rs4,edges.rs4,import_export.rs3) follow in the next PR; document upsert atomicity is #1341; debounced saves live behind this seam later.Refs #1340
🤖 Generated with Claude Code