mirror of
https://github.com/rehan-remade/universal-modder.git
synced 2026-11-05 01:37:40 +00:00
[PR #124] [MERGED] fix(backup): preserve snapshots created in the same second #142
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
rehan-remade/universal-modder#142
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/rehan-remade/universal-modder/pull/124
Author: @Milbaxter
Created: 10/6/2026
Status: ✅ Merged
Merged: 10/6/2026
Merged by: @rehan-remade
Base:
main← Head:fix/preserve-same-second-backups📝 Commits (1)
c55e422fix(backup): preserve snapshots created in the same second📊 Changes
2 files changed (+113 additions, -6 deletions)
View changed files
📝
tests/test_um.py(+89 -0)📝
um/backup.py(+24 -6)📄 Description
What: Prevent save backups from silently overwriting each other when created within the same second.
create()currently uses a second-resolution filename and opens it in ZIP write mode. Creating another backup with the same name in that second replaces the first archive. Repeated restores can likewise overwrite the automatic pre-restore backups that are meant to make restores undoable.Reserve filenames with exclusive creation, retrying collisions with numbered suffixes. The suffixes preserve existing filename sorting and skip gaps so default diff/restore still selects the newest snapshot. Failed or interrupted writes remove only the newly allocated archive.
Regression tests cover twelve distinct snapshots at a fixed timestamp, latest selection after deleted snapshots, concurrent creators, failed/interrupted writes, and preserving both undo snapshots across repeated restores. The original implementation failed the rapid-create, concurrent-create, and repeated-restore regressions.
Validation
uv run --with pytest pytest -q tests— 72 passed, 1 skipped (Git Bash-only hook)../bin/um kb check --index— PASS: 59 notes checked../bin/um publish check .— 0 failures; one existing absolute-user-path warning in the Project Zomboid field note.git diff --checkpassed.Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.