Repository navigation
Closed
Description
Problem or outcome
The validated VACUUM INTO backup mechanism (#2) exists but only runs when an operator remembers to run it, nothing prunes old snapshots, and restore is undocumented manual file surgery. Milestone 1 requires automatic validated backups with a tested restore path, and ADR 0003 promised the mechanics.
Scope
In scope:
- Automatic backups from
serve: a background task takes a validated snapshot on a fixed interval (default daily), including once shortly after startup when the newest snapshot is older than the interval - Retention: keep the newest N snapshots (default 14), pruning only after a new snapshot validates; never prune the last remaining snapshot
consolebook restore <snapshot>: validates the snapshot as its own database, refuses while the server holds the database, sets aside the current database as a pre-restore snapshot, moves the validated snapshot into place, and verifies invariants and integrity afterwardbackupcommand applies the same retention pruning- Audit events for backup and restore (the domain model lists both as audited actions)
doctorwarns when the newest snapshot is older than the interval- Configuration via CLI flags / env (interval hours, retention count), consistent with existing flags
- Integration tests: scheduling decision logic, retention pruning edge cases, full restore round-trip, refusal paths
Out of scope:
- Off-host backup replication (operator's job via the backups/ directory)
- In-app notices for backup failures (arrives with the notices slice, which will use this slice's outcome reporting)
- Backup encryption (needs its own decision)
Acceptance criteria
- A running server produces validated snapshots on schedule with no operator action
- Retention keeps exactly the configured count and never deletes the only snapshot
- A destroyed database is recoverable end-to-end with
consolebook restoreand the result passesdoctor - Backup and restore actions appear in the audit record
- All repository gates pass
Expected proof
cargo fmt --check && cargo clippy --workspace --all-targets -- -D warnings && cargo test --workspace- A scripted destroy-and-restore run against the real binary
Related roadmap, decisions, or issues
docs/roadmap.mdMilestone 1;docs/architecture.mdBackups; ADR 0003- Builds on Adopt the ConaryLabs house repo contract and PR gate #2; precedes the in-app notices slice
Metadata
Metadata
Assignees
Labels
No labels
Activity
backup(schedule): automatic backups, retention, and a proven restore …