Skip to content

feat(store): the index knows its embedding space — search refuses to mix - #46

Merged
AbsoluteMode merged 1 commit into
mainfrom
feat/embed-fp-guard
Aug 3, 2026
Merged

feat(store): the index knows its embedding space — search refuses to mix#46
AbsoluteMode merged 1 commit into
mainfrom
feat/embed-fp-guard

Conversation

@AbsoluteMode

Copy link
Copy Markdown
Owner

Maxim asked: «у данных есть мета флаг каким эмбеддером они собраны?» — per-file, yes (the fingerprint inside every indexed_files.sig, e.g. v2:voyage/voyage-4-large/1024:…). But the question exposed the hole: search never checked. A same-dimension model swap passes the schema check, and until the next index run every query lands in a different vector space than the corpus — silently garbage ranking.

  • A clean index_corpus pass records provider/model/dim in a new meta table (one k/v table; rides the existing transaction discipline).
  • recall_search compares before embedding: on mismatch it skips KNN entirely (no embed call at all — asserted in the test) and returns the FTS path with a degraded note naming both spaces and the fix.
  • The marker moves only after a clean pass: a failed file keeps its rolled-back old-space vectors, so the corpus stays officially mixed until a full run heals it.
  • Existing indexes have no marker → behave exactly as before until their next index run (no false degradation on upgrade).

Suite 329 passed.

🤖 Generated with Claude Code

Every file row already carried the embed fingerprint in its signature (that
is what drives clean re-embeds), but SEARCH never checked: swap to a
same-dimension model and the query lands in a different vector space than
the corpus — silently garbage ranking until the next index run. Now a clean
index pass records provider/model/dim in a meta table, and recall_search
compares before embedding: on mismatch it skips KNN entirely and returns the
FTS path with an honest degraded note naming both spaces and the fix. The
marker moves only after a CLEAN pass — a failed file keeps rolled-back
old-space vectors, so the corpus stays officially mixed until healed.
Existing indexes have no marker and behave exactly as before until their
next index run.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@AbsoluteMode
AbsoluteMode merged commit b885308 into main Aug 3, 2026
8 checks passed
@AbsoluteMode
AbsoluteMode deleted the feat/embed-fp-guard branch August 3, 2026 10:05
AbsoluteMode added a commit that referenced this pull request Aug 3, 2026
…roadmap item (#49)

Lead, How it works, CLI reference and the Russian intro now say three
sources; Roadmap marks Cursor shipped; Troubleshooting gains the
'embedder changed' degraded row (#46's guard deserves a doc line).

Co-authored-by: max <niceizzy1337@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants