pub fn rollback(paths: &BackupPaths) -> Result<()>Expand description
Roll back a partially-applied rotation. Used when the
in-memory mutation step fails (or its post-write parse
fails). Restores the on-disk state to what it was
before rotate ran:
- The workload itself wasn’t touched by
rotate(we copied, didn’t move), so it’s already correct. <workload>.bakwas overwritten by the copy from the workload — that’s a no-op semantically (the bak now matches the workload, same as it would after a clean commit on the same content). To preserve the “.bak holds the pre-edit content” invariant strictly, we restore the previous .bakfrom.bak.prev(which was the prior pre-edit content before the rotate).<workload>.bak.previs restored to whatever it was before the rotate — but we don’t have that; the rotation overwrote it. Best effort: leave the current.bak.prevas the recovery point.
In short: roll back the bak↔bak.prev swap so the
invariant “