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
{{ message }}
Repository navigation
[data-safety] Snapshot the local database before a release's migrations run (no data loss on update) #1887
A prospective client is evaluating NodeSpace and their stated blocker is data loss / backup on release. We need a concrete guarantee that installing a new release cannot lose a user's existing data.
Existing guarantees
The local store lives in ~/.nodespace/ (daemon-pro-db / database/nodespace.db), outside the .app bundle — replacing/reinstalling the app never touches it.
Migrations are versioned (PRAGMA user_version) and each runs in its own transaction — a crash mid-migration leaves a consistent, re-resumable database.
Gap
The transactional safety covers a crash mid-migration, not a committed migration that is semantically destructive or buggy (a risk that grows as future releases add non-additive migrations). There is no pre-release snapshot to recover from.
Fix
Before any pending migration runs (user_version in (0, LATEST_VERSION)), snapshot the DB file — WAL-checkpointed for a consistent single-file copy — into a backups/ sibling directory, pruned to the last few. Best-effort: a backup failure is logged and never blocks startup (today's migrations are additive; this is defense in depth for future ones). Wired into SqliteStore::new.
This is the data-safety half of the auto-update manager (the notification half is #1321). Restore for v1 is copying the .bak back; restore tooling is a follow-up.
Resolved in #1889 (merged). SqliteStore::new now takes a VACUUM INTO consistent snapshot of the DB before any pending migration runs (gated on real data; nanos+pid filenames; pruned to 5; best-effort). Live-validated on a real 185-node v2 profile: the daemon snapshotted (v2/185) then migrated the live db to v3. Three-layer guarantee complete: data outside the bundle + transactional migrations + pre-release snapshot. v1 restore = copy the .bak back (valid standalone SQLite db); restore tooling is a follow-up.
Activity
Auto-update manager: update-available banner + pre-migration DB backup (
Auto-update manager: update-available banner + pre-migration DB backup (
mstomar125 commentedon Aug 1, 2026
Resolved in #1889 (merged).
SqliteStore::newnow takes a VACUUM INTO consistent snapshot of the DB before any pending migration runs (gated on real data; nanos+pid filenames; pruned to 5; best-effort). Live-validated on a real 185-node v2 profile: the daemon snapshotted (v2/185) then migrated the live db to v3. Three-layer guarantee complete: data outside the bundle + transactional migrations + pre-release snapshot. v1 restore = copy the.bakback (valid standalone SQLite db); restore tooling is a follow-up.