You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
driver-turso: a remote url plus syncUrl is classified replica and handed a :memory: Knex connection, so every write lands in process memory and never reaches the remote #19893
Filing gate: ① a defect with a named landing site, TursoDriver.detectMode / toKnexConfig in packages/drivers/driver-turso/src/turso-driver.ts. Finding class (a). Derived from #19845's round (PR #19891); ⛔ that PR does not touch it.
Filed by the domain:engine execution seat 1 (session_01TEhopqrWQYBycZzyJHpAZr) from the out-of-scope findings of its #19845 dev (report on #19845). The seat's isolated contract reviewer read the code independently on PR #19891 (record 5797857806, flag ③-2: 「REAL … the most serious of the four; FILE SEPARATELY with priority」). ⛔ Filed bare: routing and grading are triage's. ⛔ Not a claim.
What happens
detectMode: a libsql://, https://, http://, wss:// or ws://url WITH a syncUrl returns replica. A code comment asserts @libsql/client "operates in embedded replica mode with an in-memory local cache".
toKnexConfig's last arm hands that mode better-sqlite3 on connection: { filename: ':memory:' }.
On a non-remote driver, connect() calls super.connect() (Knex) and builds a libsql client that only sync() uses. Every CRUD and schema call takes the inherited Knex path.
⇒ Writes land in a process-local in-memory SQLite database and vanish when the process exits. sync() moves nothing out of Knex's :memory:, so nothing reaches the remote through the driver's data path, whether or not the client accepts the pair.
Reproduction (the #19845 dev, on the libsql SQLite double)
url: 'libsql://r.turso.io', syncUrl set, client stub, sync.onConnect: false: initObjects plus create, then find returned the row, while the libsql client's database held no tables. The contract reviewer confirmed the path by code reading; it did not re-measure.
Reach
It looks like a supported configuration:
TursoDriverConfigSchema (packages/spec, turso.zod.ts) accepts syncUrl beside any url; its only refinement is sync without syncUrl.
turso-driver-factory.ts forwards syncUrl from a declared datasource.
The driver's own comment claims the pair works.
Not reachable through OS_DATABASE_URL: standalone-stack passes no syncUrl. The README's mode table lists only file: plus syncUrl. A deployment that declares this datasource gets silent data loss that looks normal from outside: reads return what was written, until a restart.
Suggested shape (⛔ not a ruling)
Refuse a remote url beside syncUrl at construction (or classify it remote), with the matching refinement on TursoDriverConfigSchema, loudly, naming the supported replica spelling (url: 'file:…' plus syncUrl). Measure first whether any real deployment or example declares the pair.
Filing-gate answers
Class: ① (defect, named landing site); finding class (a), reproduced by the dev and confirmed by code reading by the seat's reviewer.
Acting reader: the seat that owns packages/drivers/driver-turso after triage routes it (the domain table: domain:engine); a spec refinement half, if taken, is domain:spec's.
Filing gate: ① a defect with a named landing site,
TursoDriver.detectMode/toKnexConfiginpackages/drivers/driver-turso/src/turso-driver.ts. Finding class (a). Derived from #19845's round (PR #19891); ⛔ that PR does not touch it.Filed by the
domain:engineexecution seat 1 (session_01TEhopqrWQYBycZzyJHpAZr) from the out-of-scope findings of its #19845 dev (report on #19845). The seat's isolated contract reviewer read the code independently on PR #19891 (record 5797857806, flag ③-2: 「REAL … the most serious of the four; FILE SEPARATELY with priority」). ⛔ Filed bare: routing and grading are triage's. ⛔ Not a claim.What happens
detectMode: alibsql://,https://,http://,wss://orws://urlWITH asyncUrlreturnsreplica. A code comment asserts@libsql/client"operates in embedded replica mode with an in-memory local cache".toKnexConfig's last arm hands that modebetter-sqlite3onconnection: { filename: ':memory:' }.connect()callssuper.connect()(Knex) and builds a libsql client that onlysync()uses. Every CRUD and schema call takes the inherited Knex path.⇒ Writes land in a process-local in-memory SQLite database and vanish when the process exits.
sync()moves nothing out of Knex's:memory:, so nothing reaches the remote through the driver's data path, whether or not the client accepts the pair.Reproduction (the #19845 dev, on the libsql SQLite double)
url: 'libsql://r.turso.io',syncUrlset, client stub,sync.onConnect: false:initObjectspluscreate, thenfindreturned the row, while the libsql client's database held no tables. The contract reviewer confirmed the path by code reading; it did not re-measure.Reach
It looks like a supported configuration:
TursoDriverConfigSchema(packages/spec,turso.zod.ts) acceptssyncUrlbeside anyurl; its only refinement issyncwithoutsyncUrl.turso-driver-factory.tsforwardssyncUrlfrom a declared datasource.Not reachable through
OS_DATABASE_URL:standalone-stackpasses nosyncUrl. The README's mode table lists onlyfile:plussyncUrl. A deployment that declares this datasource gets silent data loss that looks normal from outside: reads return what was written, until a restart.Suggested shape (⛔ not a ruling)
Refuse a remote
urlbesidesyncUrlat construction (or classify itremote), with the matching refinement onTursoDriverConfigSchema, loudly, naming the supported replica spelling (url: 'file:…'plussyncUrl). Measure first whether any real deployment or example declares the pair.Filing-gate answers
packages/drivers/driver-tursoafter triage routes it (the domain table:domain:engine); a spec refinement half, if taken, isdomain:spec's.closedincluded:turso replica remote url syncUrl memory knex writes lost embedded replica mode→ 7 hits: driver-turso remotedetectManagedDrift()diffs against the dummy:memory:Knex connection remote mode is given — drift is always empty, so the artifact boot migration gate reads a remote Turso database as never drifted #19845, driver-turso remotesyncSchemasBatch— the engine boot door — skips read-coercion registration, managed-object recording and the canonical backfill: a remote boolean can read back as 1, JSON as a string #19844, driver-turso remote mode ignores deferred DDL —os migrate planagainst a remote Turso datasource performs the DDL and the canonical backfill it was meant to preview, and prints no pending work #19823 (the remote-face siblings of this round), drivers(turso): the remote face dropsuniqueentirely — a declared-unique column takes duplicates, and an upsert onconflictKeysdies with a raw SqliteError #8413, Turso remote:带 id/conflictKeys 但没匹配上的 upsert 仍会静默写入 NULL 自增号(#6944 拒绝闸门覆盖不到的那条腿) #7099, drivers(turso): remote 模式没有继承 #5146 的$notNULL-safe —— 同一个 TursoDriver,local 返回 NULL 行、remote 不返回(实测,origin/main) #5903, drivers(turso): remote 模式补 canonical backfill 通道(@libsql/client,分批、可恢复、完成标记)—— cloud#1005 移交,维护者已裁方案 1 #5770 (closed, other remote-face gaps). None is this defect.Dedupe words:
turso replica remote url syncUrl memory·embedded replica knex memory writes lost·turso replica mode libsql url syncUrlGenerated by Claude Code