Skip to content

spec: TursoConfigSchema accepts turso configs the driver refuses or ignores — a remote url beside syncUrl or a forced replica/local mode, a non-file: replica, syncUrl/sync under mode: remote #19977

Description

@objectstack-fleet

Filing gate: ① a defect with a named landing site: the superRefine of TursoConfigSchema in packages/spec/src/data/driver/turso.zod.ts, and its driver-local copy packages/drivers/driver-turso/src/spec/turso.zod.ts. Finding class (b), with one class-(c) arm folded in (same schema, same refinement).

Seam: spec:TursoConfigSchema.url / .syncUrl / .sync / .mode → runtime: TursoDriver constructor (turso-driver.ts), reached through buildTursoDriverConfig from packages/runtime/src/turso-driver-factory.ts and packages/services/service-datasource/src/default-datasource-driver-factory.ts

Filed by the domain:engine execution seat 1 (session_01Bvd69VPa6puiNzzPUroDBx) from the out-of-scope findings of its #19893 dev (report comment 5815469979 on #19893). ⛔ Filed bare: routing and grading are triage's. ⛔ Not a claim.

The contract the schema already states

The spec's own TSDoc on syncUrl reads: "Remote sync endpoint that turns a local file into an embedded replica". Yet the schema's only refinement is sync without syncUrl. It accepts syncUrl beside any url, and mode: 'replica' or mode: 'local' beside a remote url.

Arm 1, class (b): configurations the runtime refuses at construction once PR #19971 lands

PR #19971 (#19893, in flight) makes new TursoDriver(...) refuse with VALIDATION_ERROR / 400:

  • a remote url beside syncUrl, or under a forced mode: 'replica' / mode: 'local';
  • a replica whose url is not a local file: path.

Before it lands, these configurations silently lose every write to a :memory: engine (#19893). Either way, authoring accepts a datasource that cannot work: after the PR it fails at connect, and before it, it loses data. The dev measured where the schema is parsed: validateDriverConfig via DatasourceSchema (datasource.zod.ts) and DatasourceAdminService (datasource-admin-service.ts). Neither runtime factory parses a schema, so today the constructor is the only gate.

Arm 2, class (c): syncUrl / sync under mode: 'remote' are silently inert

The dev measured this on the built dist at PR #19971's head 5fb95579: new TursoDriver({ url: 'libsql://r.turso.io', mode: 'remote', syncUrl, sync: { intervalSeconds: 60 } }) constructs.

  • After connect(), isSyncEnabled() answers true.
  • sync() rejects SYNC_NOT_SUPPORTED.
  • createRemoteClient forwards no syncUrl (grep 0), and the remote connect arm starts no interval.

A stored datasource config (producer: the Studio datasource form / DatasourceAdminService, forwarded by buildTursoDriverConfig) can therefore declare syncing that never happens, while the driver reports it as enabled.

Suggested shape (⛔ not a ruling)

Refine both schema copies to refuse, at authoring, what the runtime refuses or cannot honour, and name the supported spelling in the message (url: 'file:…' beside syncUrl for a replica; the remote url alone for a remote database). Decide in the same card whether the constructor should also refuse syncUrl / sync under mode: 'remote' (arm 2's runtime half), so isSyncEnabled() never answers true for a sync that cannot run.

Filing-gate answers

Dedupe words: turso syncUrl remote url schema refinement · TursoConfigSchema syncUrl file replica refine · turso syncUrl remote mode ignored · isSyncEnabled remote mode syncUrl


Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions