You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8c431f9
Browse filesBrowse the repository at this point in the historyBrowse files
Address branch-review observations on the previous commit:
1. The test previously named CleanupFailureSurfacesError did not
actually exercise the Phase 5 cleanup path. Staging a directory
at the backup destination triggers Phase 0 refusal (os.Stat
returns nil error for directories), not a Phase 3 rename failure
or a Phase 5 os.Remove failure. Renamed to
RefusesWhenDirectoryBlocksBackupPath to match what it actually
pins. Comment now explicitly states the Phase 5 path is not
reachable through public-API fault injection — the contract
there is documented in the function docstring.
2. The Phase 3 rollback rename (between failing-encrypted-rename
and the error return) silently swallowed its own error. If the
rollback failed the operator was left with keyBackup but no
keyFile, and the caller-facing error said only 'failed to back
up encrypted file' without flagging the partial state. Apply
the same pattern as the restore() closure in Phase 4 — capture
the rollback rename's error and include it in the wrapped
message with manual-recovery instructions if non-nil.
Signed-off-by: Aleksei Sviridkin <[email protected]>
returnfmt.Errorf("failed to back up encrypted file before rotation: %w; AND rollback of key-file rename failed: %v — manual recovery: rename %q -> %q", err, rbErr, keyBackup, keyFile)
586
+
}
587
+
returnfmt.Errorf("failed to back up encrypted file before rotation: %w (key file rename rolled back)", err)
581
588
}
582
589
583
590
// restore is a recovery helper used when any later step fails:
0 commit comments