Repository navigation
Closed
Labels
area:backendArea: backend behavior spanning App and Corearea:tauriArea: Tauri app, commands, app wiring, or bundling
Description
Outcome
A first launch with no existing database creates the native DuckDB database directly and runs on it. No SQLite file is created, and no conversion is involved.
Related to #2090 and required by ADR 0025 (retiring the SQLite conversion path in v2.0.0): the SQLite backend cannot be removed while every new install still begins on it.
Current behavior (verified on develop)
inspect_authorityreturnsSqliteAuthoritativewhen there is no SQLite source, no native file, no marker and no work directory. Its own comment names this "the ordinary state before any conversion, and after a fresh install".- App startup then calls
db::initand applies the SQLite migrations, which createshv-database.db. - The only code that ever writes a native database is finalization, which copies a candidate built from a SQLite snapshot. Nothing creates the stable schema, the native metadata row, the identity table and the authority marker from nothing.
So a user who installs a build with duckdb-archive enabled still starts on SQLite and has to convert later.
Scope and verification
- Core: one operation that creates an empty native database from the App-owned stable schema (
get_native_schema()), with the metadata row alreadyselected, the pinned storage version recorded, the identity high-water marks initialised, and the authority marker written in the same database-first orderselect_native_databaseuses. It refuses to run if a SQLite source, a native file, a marker or a conversion work directory already exists; it never overwrites. - App: the lifecycle owner decides at startup. "Nothing exists" becomes "create native and run on it" instead of
SqliteAuthoritative; every other state keeps its current meaning. SQLite migrations do not run on that path, so no source is created as a side effect. - The result must be indistinguishable from a converted database for every consumer: the dispatch boundary adopts it, producers write to it, a restart reports
NativeAuthoritative, and SQLite retirement finds nothing to rename and does nothing. - Interruption: a crash between creating the file and writing the marker must resolve on the next start without guessing. Reuse the existing
SelectedWithoutMarkerrepair if the database already saysselected; otherwise a half-created file with no history in it may be discarded and recreated, and that is the one case where discarding is safe. State this explicitly in code and tests. - Decide and record when this becomes the default. It must not reach users before investigate(database): qualify production enablement of the duckdb-archive feature #2137 qualifies production enablement, and it changes what
SqliteAuthoritativemeans for a fresh profile, so it should be gated until then. - Tests: fresh creation end to end through the dispatch boundary; refusal when any of the four artifacts exists; restart after creation; the interrupted-creation cases; and the existing differential suites still passing, since a created database and a converted empty one must have the same shape.
Out of scope
- The conversion user flow (feat(database): surface the DuckDB conversion as an explicit user flow #2136) and production enablement (investigate(database): qualify production enablement of the duckdb-archive feature #2137).
- Removing the SQLite backend or the conversion (ADR 0025, v2.0.0).
- Replacing the in-memory SQLite epoch oracle the native writers use.
Metadata
Metadata
Assignees
Labels
area:backendArea: backend behavior spanning App and Corearea:tauriArea: Tauri app, commands, app wiring, or bundling
Type
Projects
- StatusShow more project fieldsDone
Activity
docs(adr): retire the SQLite conversion path in v2.0.0 (#2192)
feat: start fresh installs on native DuckDB database (#2203)