Fix #12: roll back mutations when saving fails

This commit is contained in:
Philip Henning 2026-09-04 09:28:37 +02:00
parent 2c5a8d969c
commit d04ab6feaf
9 changed files with 677 additions and 184 deletions

View file

@ -75,8 +75,9 @@ Default Entries represent protected baseline localhost or broadcasthost
mappings. They cannot be changed, deleted, activated, deactivated, or moved.
Successful mutations are saved to `/etc/hosts` immediately. Read the
status message after every action. A message that reports a save failure means
the interface may have changed while the system file did not.
status message after every action. If saving fails, the application restores
the Host Entries, visible selection, and undo/redo history from before the
action.
## Use a DNS Entry
@ -120,13 +121,9 @@ Adding, editing, deleting, moving, activating, deactivating, undoing, redoing,
and successfully refreshing DNS Entries save immediately. `Ctrl+S` explicitly
saves the entire current in-memory Hosts File.
If saving an undo or redo result fails, the application restores the prior
in-memory state and undo/redo history. Reload with `Ctrl+R` to verify the
on-disk state before attempting another change.
Other save failures can leave the interface changed while the file on disk is
unchanged. Reload with `Ctrl+R` to return the interface to the on-disk state
before attempting another change.
If an immediate save fails, the application restores the complete pre-action
in-memory state, visible selection, and undo/redo history. A later mutation
therefore cannot accidentally persist the failed change.
### Locate a Pre-edit Backup