Skip to content

Storage: periodic on-disk backup of tcode.db #605

Description

@Tryanks

Since #594 and #601 the only copy of every thread is ~/.tcode/tcode.db; the JSONL originals are deleted once the store opens. Turso is pre-1.0 and the blast radius of a corruption is now the whole store, with the sqlite3 CLI (.recover) as the only fallback.

Proposal: a periodic backup owned by the store, run off the host loop when idle or at startup once per day, using VACUUM INTO '<data dir>/backups/tcode-<date>.db' (supported by Turso 0.8.1; the SQLite backup API is not). Keep the last N copies (3?), verify each with PRAGMA quick_check on the copy, and delete older ones. A 10 GB store copies in tens of seconds; it must not block the UI and must be skipped while a migration is running. Restore is manual for now: stop Tcode, replace tcode.db, remove tcode.db-wal.

Decisions for the maintainer: cadence, how many copies, whether to expose it in Settings, and whether a failed backup should be surfaced in the UI.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions