Skip to content

refactor(core): route remaining index writes through index_sync - #1348

Merged
ajianaz merged 1 commit into
developfrom
refactor/index-sync-remaining-sites
Oct 7, 2026
Merged

ajianaz merged 1 commit into
developfrom
refactor/index-sync-remaining-sites

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

What

Step 2 of the index sync module (#1340, tracked in #1345; step 1 was #1347).

  • Migrate the remaining non-document index writes to index_sync: maintenance.rs (aging cleanup soft/hard, prune, lifecycle deprecate + prune, repair rebuild save, re-embed, shutdown), consolidate.rs (3 sites), edges.rs (supersede / undo_supersession), import_export.rs (write-ahead insert, rollback, final save).
  • index_sync gains insert_unsaved / remove_unsaved for batch paths that save once at the end, and SyncOutcome::warn_if_stale.
  • Every index save outside lib.rs document paths now uses the one retry policy; direct calls left in core are index.build (full rebuild) and the document upsert/delete paths in lib.rs, which belong to refactor(core): document upsert as embed-then-commit #1341.

Why

Finishes the single-policy goal of #1340 for everything but documents: 5 maintenance loops that copied for id … index.remove; if let Err(e) = index.save() { warn } and 2 let _ = index.save() (undo_supersession) are gone; a persist failure now behaves the same everywhere.

Behaviour changes (intended)

  • Saves in these paths now retry like the rest (3 × 200 ms) instead of failing on the first error; shutdown persists with the same policy (a flush error is still returned).
  • Warning text is unified (<operation>: index persist failed after 3 attempts: …).
  • undo_supersession no longer ignores a failed persist silently (it warns).

Testing

  • 2 new module tests (insert_unsaved never saves and rejects wrong dims without retrying; transient insert retries then one persist) on top of the 9 from refactor(core): index_sync module owns insert/remove/persist policy (operations.rs) #1347.
  • cargo fmt --check, cargo clippy --workspace --all-targets clean; cargo test --workspace green (core 596); vecq-only core build green (594).
  • Not covered by automated tests: failure paths of maintenance/consolidate/import against a real failing index (policy is covered through the fake adapter).

Refs #1340

🤖 Generated with Claude Code

Migrate maintenance (aging cleanup, prune, lifecycle, repair, re-embed, shutdown),
consolidate, edges (supersede/undo) and import/export to the index_sync policy.
Adds insert_unsaved/remove_unsaved for batch paths that save once, and
SyncOutcome::warn_if_stale. Document paths in lib.rs stay for #1341.

Refs #1340

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@ajianaz ajianaz added enhancement New feature or request scope:core Core engine work labels Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit 6aa7b37 into develop Oct 7, 2026
15 checks passed
@ajianaz
ajianaz deleted the refactor/index-sync-remaining-sites branch October 13, 2026 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request scope:core Core engine work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant