fix: implement SQLite partial unique indexes to prevent session_id co… - #32
Merged
Conversation
Benchmark comparisonThreshold: ±25% (informational, does not block merge)
|
…llision during node updates
Tharickv75
force-pushed
the
fix/sqlite-partial-unique-index
branch
from
July 31, 2026 19:37
c438cf7 to
f70046f
Compare
Benchmark comparisonThreshold: ±25% (informational, does not block merge)
|
Benchmark comparisonThreshold: ±25% (informational, does not block merge)
|
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.
Type of Change
What type of change does this PR introduce? Mark all that apply:
Summary
What does this PR address?
This PR implements SQLite support for partial unique indexes and auto-repairing existing non-partial unique indexes on
session_id. It preventsINSERT OR REPLACEoperations from accidentally deletingInteractionrows when they share acontext.session_idwith aConversationnode.Description
Bug Fixes:
Interactionrows to be deleted when sharingcontext.session_idwithConversationnodes (resulting in empty orchestrator history on SQLite).SQLiteDB.create_indexignored Mongo-stylepartialFilterExpression/partial_filter_expressionkwargs, creating global unique indexes across sharednodecollections instead of scoped/partial ones.$eq,$gt,$exists) into SQLiteWHEREclauses._repair_non_partial_unique_indexes) that automatically drops legacy non-partial unique indexes onsession_idmissing aWHEREclause so they can be recreated properly on subsequentensure_indexescalls.ValueErrorrather than silently falling back to a global unique index.Refactor Request:
jvspatial/db/sqlite.pyandjvspatial/db/_sqlite_translate.py.WARNINGtoINFOto reduce one-shot migration noise. Addressedruff(SIM110) andmypytype-narrowing warnings. Updated.pre-commit-config.yamlhooks (pre-commit-hookstov6.0.0).Changes Made
High-Level Summary:
translate_partial_filter_expressionin_sqlite_translate.pyto translate supported filter shapes into SQLiteWHEREclauses._repair_non_partial_unique_indexeson SQLite database initialization to automatically clean up legacy global unique indexes oncontext.session_id.create_indexto drop and rebuild existing indexes lacking a requiredWHEREclause and raise errors on untranslatable expressions.CHANGELOG.mdwith fix details and updated.pre-commit-config.yaml.Checklist
Mark all that apply:
Steps to Test
Provide a clear set of steps for testing the changes introduced in this PR: