@crvouga/sqlite-mem 1.7.0 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,7 +13,7 @@ Reference SQLite compile options:
13
13
  Full list: `bun run inventory`
14
14
 
15
15
  sqlite-mem version:
16
- 0.1.0
16
+ 0.0.0-development (package.json; publish via semantic-release)
17
17
 
18
18
  Scope:
19
19
  Scope 3 — every oracle-exposed SQL builtin/module is in-scope except
@@ -35,7 +35,8 @@ SQL grammar / operators / expressions:
35
35
  VERIFIED — contracts + row-value comparisons + ->/->> precedence
36
36
 
37
37
  Types / affinity / NULL:
38
- VERIFIED
38
+ VERIFIED — affinity matrix, typeof/REAL (incl. unary ± float literals),
39
+ truthiness/3VL, JS-leak bind probes (differential + documented divergences)
39
40
 
40
41
  Functions (oracle surface):
41
42
  VERIFIED — inventory missingOracleFunctions = 0 (163 names covered)
@@ -44,13 +45,15 @@ JSON / JSONB:
44
45
  VERIFIED
45
46
 
46
47
  Aggregates / windows:
47
- VERIFIED — includes string_agg, ntile, cume_dist, percent_rank, EXCLUDE
48
+ VERIFIED — includes string_agg, ntile, cume_dist, percent_rank, EXCLUDE;
49
+ unaliased aggregate column names (`sum(v)`, `count(*)`) match oracle
48
50
 
49
51
  CTEs / transactions / savepoints / constraints / FK / triggers:
50
- VERIFIED (deferred FK + composite FK)
52
+ VERIFIED (deferred FK + composite FK + MATCH SIMPLE/FULL + statement ABORT)
51
53
 
52
54
  Indexes / views / generated / STRICT / WITHOUT ROWID:
53
- VERIFIED — partial/expression indexes, STRICT tables, leftmost prefix
55
+ VERIFIED — partial/expression indexes, STRICT tables, leftmost prefix;
56
+ WITHOUT ROWID UPSERT; generated STORED/VIRTUAL WHERE/ORDER BY
54
57
 
55
58
  PRAGMAs:
56
59
  PARTIALLY VERIFIED — schema/FK; storage pragmas N/A or :memory: no-op
@@ -66,20 +69,30 @@ ANALYZE / REINDEX / VACUUM:
66
69
  VERIFIED (:memory: observable parity)
67
70
 
68
71
  Prepared statements / errors / snapshot:
69
- VERIFIED — schema invalidation re-prepares; SQLM logical round-trip VERIFIED
72
+ VERIFIED — schema invalidation re-prepares; SQLM logical round-trip VERIFIED;
73
+ post-restore A/B lockstep + dumpLogicalState vs oracle
70
74
 
71
- Differential tests:
72
- Total: 872 under `bun test` (contract + fuzz + harness) after hardening pass
73
- Passed: 872
75
+ Differential tests (2026-08-21 audit refresh):
76
+ Total: 1912 under `bun test` / `bun run test:sqlite-compat`
77
+ (contract + fuzz + harness; Bun 1.4.0, SQLite 3.51.0)
78
+ Passed: 1912
74
79
  Failed: 0
80
+ expect() calls: 7314
75
81
 
76
82
  Stateful / fuzz:
77
83
  Seeds: 0x5a17e0e1 (+ SQLITE_MEM_FUZZ_SEED override)
78
84
  Combination fuzz: tests/fuzz/combinations-scope3.test.ts
79
85
  FTS fuzz: tests/fuzz/fts.test.ts
80
- Collate / window / CTE+DML / JSON subtype fuzz extended
86
+ Long deterministic scripts: tests/contract/transactions/stateful.test.ts
87
+ Collate / window / CTE+DML / JSON subtype / affinity / conflicts fuzz
81
88
  Mismatches: 0
82
89
 
90
+ Harness integrity (Phase 1):
91
+ RealSqliteAdapter DML via prepare().run() with live changes/lastInsertRowid
92
+ sequenceParity compares DML counters; DDL/txn/PRAGMA allowlist neutralized
93
+ errorParity via deepCompareResults; dumpLogicalState + compareFinalState
94
+ Comparator meta-tests: tests/harness/normalize.test.ts
95
+
83
96
  Hardening pass (2026-08-19) — incompatibilities found & fixed:
84
97
  1. Comparison affinity (INTEGER/TEXT/NUMERIC column vs literal) missing
85
98
  2. WITH on UPDATE/DELETE/INSERT VALUES dispatched as SELECT only
@@ -92,24 +105,36 @@ Hardening pass (2026-08-19) — incompatibilities found & fixed:
92
105
  9. Window GROUPS/RANGE frames, window FILTER, recursive CTE queue edges
93
106
  10. Collation-aware GROUP BY; FTS3 matchinfo format variants; external-content delete
94
107
 
108
+ Audit refresh (2026-08-21) — additional findings & fixes:
109
+ 11. sequenceParity previously ignored all DML write counters (hid divergences)
110
+ 12. Unary +/- on float literals dropped REAL storage class (`typeof(-0.0)`)
111
+ 13. UPDATE OR REPLACE counted conflict deletions in changes() (oracle = 1)
112
+ 14. Empty-result column names + unaliased aggregate headers asserted vs oracle
113
+ 15. JS bind edges: empty TEXT/BLOB, BigInt@MAX_SAFE, intentional Number/BigInt
114
+ bind-class divergences pinned via divergence()
115
+ 16. Snapshot post-restore A/B + state dump vs live oracle
116
+
95
117
  Remaining known differences / intentional:
96
118
  Custom SQLM snapshots; deterministic random()/'now' by default
97
119
  (`random: "os"` / `now: "system"` match SQLite entropy and wall clock);
98
120
  EXPLAIN stubs (shape contracts only); INDEXED BY no-op (documented);
99
121
  ATTACH file path records filename but opens empty in-memory schema;
100
- some PRAGMA storage no-ops; FTS shadow-table changes() diverge;
122
+ some PRAGMA storage no-ops; FTS shadow-table changes()/total_changes diverge
123
+ (sequenceParity neutralizeCounters on FTS maintenance paths);
101
124
  MATERIALIZED/NOT MATERIALIZED stored but both materialize today;
102
125
  compile_options / function_list content is sqlite-mem's;
103
126
  generate_series is sqlite-mem extension (not in bun:sqlite default);
127
+ Number.MAX_SAFE_INTEGER JS bind typeof (mem integer vs bun real);
104
128
  BigInt beyond Number.MAX_SAFE_INTEGER without bun safeIntegers;
105
129
  NOT APPLICABLE C API / on-disk / VFS surfaces; uri.html remapped N/A.
106
130
 
107
131
  Final assessment:
108
- Verified against SQLite 3.51.0 (bun:sqlite). Oracle function/module
109
- inventory is closed (0 missing). Requirements matrix ingested with
110
- zero unknown statuses. Gate: `bun run test:sqlite-compat`.
111
- Hardening pass closed construct-level P0 gaps from docs/PARITY-GAPS.md;
112
- FTS/EXPLAIN remain PARTIALLY VERIFIED honestly.
132
+ Verified against SQLite 3.51.0 (bun:sqlite on Bun 1.4.0). Oracle
133
+ function/module inventory is closed (0 missing). Requirements matrix
134
+ ingested with zero unknown statuses. Gate: `bun run test:sqlite-compat`.
135
+ Harness now compares live DML counters; green means stronger evidence than
136
+ pre-2026-08-21. FTS/EXPLAIN remain PARTIALLY VERIFIED honestly — not
137
+ “fully compatible because green.”
113
138
  ```
114
139
 
115
140
  ---
package/dist/index.js CHANGED
@@ -5788,8 +5788,14 @@ function evalExpr(expr, ctx) {
5788
5788
  return truth === null ? null : booleanValue(!truth);
5789
5789
  }
5790
5790
  if (value === null) return null;
5791
- if (expr.op === "+") return asNumber(numberValue(value));
5792
- if (expr.op === "-") return asNumber(-numberValue(value));
5791
+ if (expr.op === "+") {
5792
+ const n = asNumber(numberValue(value));
5793
+ return storageClassOf(value) === "real" ? asSqlReal(n) : n;
5794
+ }
5795
+ if (expr.op === "-") {
5796
+ const n = asNumber(-numberValue(value));
5797
+ return storageClassOf(value) === "real" ? asSqlReal(n) : n;
5798
+ }
5793
5799
  return ~integerValue(value);
5794
5800
  }
5795
5801
  case "is_bool": {
@@ -12920,7 +12926,6 @@ function executeUpdateCore(stmt, env) {
12920
12926
  if (conflict.rowid === row.rowid) continue;
12921
12927
  removeOne(table, conflict, env);
12922
12928
  table = env.state.getWritableTable(stmt.table);
12923
- changes++;
12924
12929
  }
12925
12930
  }
12926
12931
  const updated = updateOne(table, row, updates, env);