Skip to content

feat(backups): WS-1 1.2 - db layer, models, backup agent command enqueue - #383

Merged
vsilent merged 1 commit into
devfrom
feature/backup-agent-queue
Nov 25, 2026
Merged

vsilent merged 1 commit into
devfrom
feature/backup-agent-queue

Conversation

@vsilent

@vsilent vsilent commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

Stacker side of the backup dump/restore executor (WS-1 step 1.2). Builds on the backup-core crate (typed DumpPlan/RestorePlan) and the existing agent command queue.

  • Models (src/models/backup.rs): BackupDestination, BackupJob, BackupRun.
  • DB layer (src/db/backup.rs): destination/job/run CRUD and run lifecycle (pending → running → uploaded / failed / pruned), finished-run listing for retention.
  • Service (src/services/backup.rs): builds a typed execution plan via backup-core and queues a backup agent command ({action, run_id, plan}).

Security

The command payload references the per-run bearer token only by environment-variable name (BACKUP_TOKEN) — no secret value is stored in the command queue or logged. Destination credentials live only in Vault under vault_path.

Testing

  • src/services/backup unit tests (4): plan building, command shape (no secrets), source validation.
  • tests/backup_db.rs: runtime validation of the SQL against the schema (destination/job/run lifecycle).
  • Full suite green (2410 passed / 6 skipped), cargo fmt / cargo clippy clean.

Next (rest of 1.2)

Agent-side native backup command (Status Panel, status/ repo) that executes the plan and streams to storage. Then 1.3 (storage connector), 1.4 (scheduler), 1.5 (REST/CLI/events), 1.6 (restore e2e).

…enqueue

Stacker side of the backup dump/restore executor (WS-1 1.2):

- Models (src/models/backup.rs): BackupDestination, BackupJob, BackupRun.
- DB layer (src/db/backup.rs): destination/job/run CRUD and run lifecycle
  (pending -> running -> uploaded/failed/pruned), finished-run listing for
  retention.
- Service (src/services/backup.rs): builds a typed DumpPlan/RestorePlan via
  backup-core and queues a 'backup' agent command ({action, run_id, plan}).
  The command references the per-run token only by env name (BACKUP_TOKEN) -
  no secret is stored in the command queue.

Tests: src/services/backup unit tests (4) + tests/backup_db.rs runtime
validation of the SQL against the schema. Full suite green (2410 passed).

Agent-side native 'backup' command (Status Panel, status/ repo) executes the
plan and streams to storage - the remaining half of 1.2.
@vsilent
vsilent merged commit c599cfd into dev Nov 25, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants