Expanded rows grew hidden non-enumerable positional properties ("0",
"1", ...) in 4c0febfed ("Preserve JS row positional values") to work
around duplicate column names collapsing in object rows. That is a
Turso-only extension: neither better-sqlite3 nor libsql attaches
positional keys to expanded rows, so the conformance suite failed under
PROVIDER=better-sqlite3 and PROVIDER=libsql, and a result column
literally named "0" would collide with the synthetic property.
Remove the positional properties from the native binding's expanded row
mode and the serverless driver's createExpandedRow so expanded rows are
plain objects where duplicate names collapse, exactly like
better-sqlite3 and libsql. Positional access remains available through
raw mode, and the libsql-client compat surface keeps its genuine hybrid
rows built by Session.createRowObject.
The divergence went unnoticed because CI only ran the conformance suite
under PROVIDER=turso; the workflow now also runs it against
better-sqlite3 so drop-in incompatibilities fail in CI.
Tests: rewrote the positional-value tests to assert the collapsing
behavior plus raw-mode access, so they pass identically under the
turso, better-sqlite3, and libsql providers.
Add a conformance test to the JavaScript async and sync suites that stores
i64::MAX, i64::MIN, and 2^53+1 and reads them back with safe integers
enabled, asserting exact BigInt round-trip. Verified against the turso and
better-sqlite3 providers.
Make the JavaScript batch() return an array of ResultSet, one per input
statement, matching the libSQL client contract. Each ResultSet carries
that statement's columns, columnTypes, rows (with both positional and
named access), rowsAffected, and a BigInt lastInsertRowid.
Previously the native Database.batch() returned an aggregate
{ rowsAffected, lastInsertRowid } and discarded rows, while the
libSQL-compat client.batch() ignored statement args and collapsed all
statements into a single result. This reworks every layer:
- Native Database.batch() reads each statement's columns, collects rows
in raw mode, and builds one ResultSet per statement.
- session.batch() requests rows (want_rows) and returns one raw result
per statement, preserving the atomic Hrana condition chain.
- Connection.batch() shapes each result into a libSQL ResultSet.
- compat client.batch() binds args and runs the batch atomically.
Add conformance tests for both the native Database.batch() and the
libSQL-compat client.batch().
I think JS has problems overall. But my guess here is that there is some
positional property that we were not adding.
Closes https://github.com/tursodatabase/turso/issues/7278
Vibed as Im not quite a JS script kiddie
Reviewed-by: Mikaël Francoeur (@LeMikaelF)
Reviewed-by: Pekka Enberg <penberg@iki.fi>
Closes#7285
ava's t.throws()/t.throwsAsync() validate the thrown value with
util.types.isNativeError(), which only returns true for objects whose
internal [[ErrorData]] slot was set by the Error constructor. libsql's
SqliteError uses the legacy `Error.call(this)` subclassing pattern (same
as better-sqlite3, the canonical Node SQLite API it mirrors), so its
instances pass `instanceof Error` but fail isNativeError. Pass
`{ any: true }` to bypass that check rather than diverging from the
canonical libsql/better-sqlite3 error shape.