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.
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ admin/browser. Semua status/data job hanya di scope owner/admin yang berizin.
|
||||
| /api/v1/relations/:id/access | GET,POST | human | relation.manage | admin | grant refresh.run per relasi (user atau grup, expiry); diaudit |
|
||||
| /api/v1/relations/:id/access/:grant | DELETE | human | relation.manage | admin | berlaku pada request berikutnya; diaudit |
|
||||
| /api/v1/refresh-relations | GET | human | refresh.run | relasi yang di-grant | nama dan environment saja; tanpa identity, host, Outpost, application id; 403 bila tanpa grant |
|
||||
| /api/v1/refresh-runs | GET,POST | human | refresh.run | relasi yang di-grant | POST: relation_id + konfirmasi `REFRESH <sumber> TO <target> v<versi>` + kunci idempotensi; `snapshot_id` opsional: restore snapshot yang sudah ada milik orbit sumber relasi itu (bukan safety, bukan orbit lain; 422 `snapshot_unusable`), tanpa itu run mengambil capture baru; tidak memilih target; 404 bila bukan pemegang grant; GET: run milik sendiri atau relasi yang di-grant (admin: semua), tanpa snapshot id dan pemohon untuk non-admin |
|
||||
| /api/v1/refresh-runs | GET,POST | human | refresh.run | relasi yang di-grant | POST: relation_id + konfirmasi `REFRESH <sumber> TO <target> v<versi>` + kunci idempotensi; `undo_of` opsional (id run restore selesai terbaru pada targetnya): kembalikan target dari safety copy restore itu (422 `nothing_to_undo`; safety hanya diterima untuk target asalnya); `snapshot_id` opsional: restore snapshot yang sudah ada milik orbit sumber relasi itu (bukan safety, bukan orbit lain; 422 `snapshot_unusable`), tanpa itu run mengambil capture baru; tidak memilih target; 404 bila bukan pemegang grant; GET: run milik sendiri atau relasi yang di-grant (admin: semua), tanpa snapshot id dan pemohon untuk non-admin |
|
||||
| /api/v1/refresh-runs/:id | GET,DELETE | human | refresh.run | admin, pemohon, atau pemegang grant relasinya | GET 404 bagi yang lain; DELETE hanya pemohon atau admin (pemegang grant lain 403) dan hanya sebelum apply, sesudahnya 409 |
|
||||
| /api/v1/operator/login | POST | public | — | emergency account | cookie opaque dan CSRF; limiter, no-store |
|
||||
| /api/v1/snapshots | GET | human | snapshot.read | orbit | metadata aman terfilter |
|
||||
|
||||
Reference in New Issue
Block a user