feat: undo a restore from the safety copy it took
- POST /refresh-runs accepts undo_of: restores the safety copy of a completed restore back onto the same target through the normal run engine (checks, countdown, progress, and a new safety copy so the undo can be undone); refused when something was restored after it or the copy is gone - a safety copy is accepted as a source only for the target it was taken from (hub and agent both check) - run views carry undo and undo_available; audited as refresh.undo_started - the modal offers Undo last restore and, after a restore, Undo this restore - proven with a real agent and PostgreSQL: restore, undo back to the original contents, undo of the undo Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -378,12 +378,22 @@ orbit's); otherwise the answer is `422 snapshot_unusable` and nothing is started
|
||||
everything else is the same: one run per target at a time, idempotency, cancelling until the target is overwritten, and
|
||||
the authorisation checks right before overwriting. The same snapshot can be restored to several targets, and again later.
|
||||
|
||||
A completed restore can be undone: `undo_of` (the id of that run) restores the safety copy the restore took of its target
|
||||
back onto the same target, through the same checks, countdown, progress and a new safety copy, so the undo can itself be
|
||||
undone. It is refused with `422 nothing_to_undo` when the run is not a completed restore of this relation, when something
|
||||
was restored onto the target after it (only the newest restore of a target can be undone), or when the safety copy has
|
||||
been removed. A safety copy is only ever accepted as a source for the target it was taken from, whether it arrives through
|
||||
`undo_of` or `snapshot_id`; the check is made by the hub, and again by the agent (its restore artifact carries
|
||||
`rollback`). Run views say `undo` and `undo_available`, never where the copy is. The run is audited as
|
||||
`refresh.undo_started`. Undoing needs the same permission as restoring.
|
||||
|
||||
In the web UI there is no separate Refresh screen. Restoring lives in the Vault: pick an orbit, capture it if you want the
|
||||
latest data (or click a snapshot that is already there), and in the snapshot detail press **Restore**. The button is
|
||||
disabled with "No restore point" when no relation has been set up for the orbit. The modal offers the restore points
|
||||
(Development and/or Staging) that the person may use, shows what will be overwritten, and after **Begin restore** counts
|
||||
ten seconds in the browser, during which **Abort** sends nothing. Then it follows four steps (Checking, Safety copy,
|
||||
Applying, Completed) from the run, and Abort still works until Applying starts. Safety copies are not listed with the
|
||||
Applying, Completed) from the run, and Abort still works until Applying starts. A finished restore offers **Undo this restore**, and the modal offers
|
||||
**Undo last restore** for the chosen restore point while that is still possible. Safety copies are not listed with the
|
||||
backups. A person needs to see the orbit's snapshots (for example the viewer role on the orbit) and a relation grant;
|
||||
administrators can also restore to any other registered target from the same modal.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user