fix(store): make cleanupOrphanedVectors atomic across both vector tables (#766) - #856
Merged
Merged
Conversation
…les (#766) An interruption between the two DELETEs could leave content_vectors claiming chunks were embedded after vectors_vec had already dropped them, so a later reactivation skipped re-embed. Count and both deletes now share BEGIN IMMEDIATE.
|
Dear tobi/qmd,
We would like to acknowledge that we have received your request and a ticket has been created.
A support representative will be reviewing your request and will send you a personal response.(usually within 24-48 hours).
Thank you for your patience.
…On Thu, Aug 13 2026, at 02:15 AM, tobi/qmd ***@***.***> wrote:
Summary
* Rebases / lands the #766 fix on current (#766) main after #851 extracted (#851) countOrphanedVectors. cleanupOrphanedVectors now runs the orphan count and both DELETEs ( vectors_vec then content_vectors) in one BEGIN IMMEDIATE transaction.
* An interruption between the two DELETEs could leave stale content_vectors rows for a hash that no longer has vec rows. A later reactivation then looked already-embedded, so qmd embed skipped it and the document was silently unsearchable by vector.
* Adds unit tests for the happy path, injected mid-delete failure (rollback), outer-transaction savepoint rollback, and inner-savepoint isolation.
Supersedes #766 (same fix, rebased onto post- (#766) #851 (#851) main).
Test plan Local Bun store tests: 264 pass, 13 skip Local Node store tests: 264 pass, 13 skip Local Node test/: 976 pass, 73 skip Local Bun test/: 976 pass, 80 skip CI Bun + Node 22/23 green You can view, comment on, or merge this pull request online at: #856 (#856) Commit Summary 1bf23f2 fix(store): make cleanupOrphanedVectors atomic across both vector tables (#766) (1bf23f2) File Changes
( 4 files) (https://github.com/tobi/qmd/pull/856/files) M CHANGELOG.md
(8) (https://github.com/tobi/qmd/pull/856/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed) M src/db.ts
(4) (https://github.com/tobi/qmd/pull/856/files#diff-1d214e57ddda9095d296e5700ebce701333bfefcf417e234c584d14091b2f50d) M src/store.ts
(59) (https://github.com/tobi/qmd/pull/856/files#diff-2717c7fb31c2070dd96f07394997809bc9be7f3fff03ab638db696cc480f39b6) M test/store.test.ts
(133) (https://github.com/tobi/qmd/pull/856/files#diff-ecc9e7b9a74de1ebac3cd3038ffc91cd42684ca2890738d3b93139c723c36407) Patch Links: https://github.com/tobi/qmd/pull/856.patch (https://github.com/tobi/qmd/pull/856.patch) https://github.com/tobi/qmd/pull/856.diff (https://github.com/tobi/qmd/pull/856.diff)
—
Reply to this email directly, view it on GitHub, or (#856?email_source=notifications&email_token=BRF3HG45HEAXJQ3KKITZWQ35JUQEXA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42DENRXGUYDIMJVGSTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVRTG633UMVZF6Y3MNFRWW) unsubscribe. (https://github.com/notifications/unsubscribe-auth/BRF3HG6367WVD7EOBWX5IDT5JUQEXAVCNFSNUABGKJSXA33TNF2G64TZHMYTCMJSGM3DKMZQGE5US43TOVSTWNJRGM3TAOJTGA2DJILWAI)
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and (https://github.com/notifications/mobile/ios/BRF3HG3O2VIYD27KYHNHDHT5JUQEXA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42DENRXGUYDIMJVGSTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVJTG633UMVZF62LPOM) Android. Download it today! (https://github.com/notifications/mobile/android/BRF3HG7NFRRZV5ZS2MWWGO35JUQEXA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42DENRXGUYDIMJVGSTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVZTG633UMVZF6YLOMRZG62LE)
You are receiving this because you are subscribed to this thread. Message ID: <tobi/qmd/pull/856 @ github . com> [
{
***@***.***": "http://schema.org",
***@***.***": "EmailMessage",
"potentialAction": {
***@***.***": "ViewAction",
"target": "#856?email_source=notifications\u0026email_token=BRF3HG7WU5DVZ2OWSJZ6VP35JUQEXA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42DENRXGUYDIMJVGSTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVNTW2YLJNRPWG3DJMNVQ",
"url": "#856?email_source=notifications\u0026email_token=BRF3HG7WU5DVZ2OWSJZ6VP35JUQEXA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42DENRXGUYDIMJVGSTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVNTW2YLJNRPWG3DJMNVQ",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
***@***.***": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]
|
This was referenced Aug 13, 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.
Summary
mainafter fix(cli): report orphaned embedding vectors and add cleanup --dry-run #851 extractedcountOrphanedVectors.cleanupOrphanedVectorsnow runs the orphan count and both DELETEs (vectors_vecthencontent_vectors) in oneBEGIN IMMEDIATEtransaction.content_vectorsrows for a hash that no longer has vec rows. A later reactivation then looked already-embedded, soqmd embedskipped it and the document was silently unsearchable by vector.Supersedes #766 (same fix, rebased onto post-#851
main).Test plan
test/: 976 pass, 73 skiptest/: 976 pass, 80 skip