[codex] Fix HNSW delete/reinsert rebuild#142
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
Fixes SQLR-8: HNSW indexes could panic after rows were deleted and new vectors were inserted within the same open connection.
Root Cause
DELETE/ vector-columnUPDATEmarked HNSW indexes asneeds_rebuild, but only the pager save path rebuilt them. In-memory INSERT still appended into the stale graph. Deleted rowids could remain in neighbor lists, and the HNSWget_vecclosure returned an empty vector for those stale ids, eventually causingDistanceMetric::computeto assert or index into a zero-length slice.Changes
SQLRiteErrors for empty or mismatched vector dimensions instead of panicking.examples/nodejs-notesdb.reopen()workaround and the known-limitation README entry.docs/sql-engine.mdwith the current dirty-index lifecycle.Validation
document_id = 2.cargo build --workspace --exclude sqlrite-desktop --exclude sqlrite-python --exclude sqlrite-nodejs --exclude sqlrite-benchmarks --all-targetscargo test --workspace --exclude sqlrite-desktop --exclude sqlrite-python --exclude sqlrite-nodejs --exclude sqlrite-benchmarkscargo test hnsw --libnpm testinexamples/nodejs-notescargo fmt --all -- --checkcargo clippy --workspace --exclude sqlrite-desktop --exclude sqlrite-python --exclude sqlrite-nodejs --exclude sqlrite-benchmarks --all-targets(passes with existing warnings)cargo doc --workspace --exclude sqlrite-desktop --exclude sqlrite-python --exclude sqlrite-nodejs --exclude sqlrite-benchmarks --no-deps(passes with existing rustdoc warnings)Deploy Plan
Because this is a process-aborting bug in the engine and affects SDK consumers, ship as a patch release.
scripts/bump-version.sh 0.10.1.AGENTS.md, including workspace build/test/clippy/doc andexamples/nodejs-notes npm test.examples/nodejs-notes, verify therefreshflow no longer performs a close/reopen hop and announce that consumers can remove their own workaround.Notes
Unrelated local dirty files were intentionally left out of this PR: an untracked
AGENTS.mdand a mode-only change onexamples/nodejs-notes/bin/sqlrite-notes.mjs.