Skip to content
Source
Sign inSign up
TanStack/db

fix(sqlite): compile boolean predicates with safe prefiltering #1997

MergedKyleAMathews(GitHub profile, opens in a new tab)merged 15 commits intomain fromrefs/pull/1997/headmerged by KyleAMathews(GitHub profile, opens in a new tab)

Showing 6 changed files with 153 additions and 0 deletions (loading 3).

x
0 of 6 viewed, 6 left
5 additions and 0 deletions.changeset/fix-sqlite-predicate-prefilter.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/db-sqlite-persistence-core': patch
+---
+​
+Preserve live-query results when SQLite predicate semantics differ from the row evaluator. Handle empty and single-argument boolean predicates with their expected identities.
75 additions and 0 deletionsdocs/contributing/oracle-coverage.mdModified
View file
@@ -684,6 +684,81 @@
[review record](oracle-reviews/issue-1754-live-electric-hydration-straddle.md)
preserves the live-host and mutant evidence.
​
+### SQLite boolean predicate arity and row work
+​
+`packages/db-sqlite-persistence-core/tests/sqlite-boolean-arity-oracle.test.ts`
+is the primary executable owner for bounded `and`/`or` predicate arity at
+`SQLiteCorePersistenceAdapter.loadSubset` return. Its independent three-valued
+model compares public keys while a `node:sqlite` driver records SQL and raw row
+work. The 960-case matrix and paired fixed and unseeded campaigns cover root
+arity 0–3, one nested operator, boolean and nonboolean operands, safe selective
+predicates, and sound candidate supersets for unsafe predicates. Eight direct cases challenge Unicode `ilike`
+and `like` patterns, tagged `NaN` comparison, lone-surrogate equality, and
+null-vs-missing under `not`. Paired- and lone-surrogate equality controls
+retain SQL row-work reduction.
+An empty-IN control and two-SELECT cursor composition check zero-row work.