Skip to content

backups: a pre-restore snapshot sorts as "newest" forever, masking copy failures #105

Closed

Description

@TusanHomichi

Existing issue check

  • I searched open and closed issues for this work.

Problem or outcome

backup::snapshots_in orders snapshots by file name. restore sets the old database aside as consolebook-prerestore-<stamp>.db. Because p sorts after 2, that file sorts after every consolebook-<stamp>.db, whatever its time. After any restore, every consumer of "the newest snapshot" picks the pre-restore file:

  • backup_copy::catch_up copies the pre-restore database to the off-server share. It is the one the operator just replaced.
  • /api/backups/status and the administrator's home report the copy as current while the share holds that file, even when every later daily copy fails. That hides exactly the failure ADR 0024 exists to surface.
  • prune_in treats the pre-restore file as the newest, so retention removes real daily backups ahead of it.
  • doctor names it as the latest snapshot.

Observed in the #94 upgrade drill on 0.1.0: after restore, doctor printed backups 3 snapshot(s), latest consolebook-prerestore-20261014T214629Z.db. The two daily snapshots were newer by content but older by name.

Scope

In scope:

  • Order snapshots by the UTC stamp in their name, falling back to the name.
  • Tests covering a pre-restore snapshot older than a later daily backup, for listing, copy status, catch-up, and retention.

Out of scope:

  • Renaming existing files.

Acceptance criteria

  • After a restore and a later backup, the later backup is the newest everywhere, and copy status reflects whether that one was copied.
  • Retention removes the chronologically oldest snapshots.

Expected proof

  • cargo test --workspace with the new ordering tests, plus a negative control on the old ordering.

Execution record

Related roadmap, decisions, or issues

Activity

  1. added a commit that references this issue on Oct 14, 2026
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions