Repository navigation
feat(save): add local auto-backup snapshots, corruption recovery, and restore UI - #330
Merged
chattymin merged 4 commits intoSep 25, 2026
Merged
Conversation
chattymin
requested changes
Sep 24, 2026
chattymin
left a comment
Owner
There was a problem hiding this comment.
Please fix the 10-snapshot restore boundary. When exactly 10 snapshots exist and the user restores the oldest one, creating the pre-restore snapshot prunes the selected file before it is read. Read and validate the selected snapshot into memory before creating/pruning the safety snapshot, then restore from that data. Please add a regression test for restoring the oldest entry at the retention limit.
KillianHzr
force-pushed
the
feat/local-auto-backup-snapshots
branch
from
September 24, 2026 06:36
cc4a75d to
c1e8b65
Compare
At the 10-snapshot retention limit, the pre-restore safety snapshot pruned the oldest file before it was read, so restoring the oldest entry failed. Load and validate the selection first, then restore from memory.
KillianHzr
force-pushed
the
feat/local-auto-backup-snapshots
branch
from
September 24, 2026 07:02
c1e8b65 to
572a923
Compare
Contributor
Author
|
@chattymin Fixed: the selected snapshot is now read before the safety snapshot is created. Added a regression test for restoring the oldest one at the 10-snapshot limit. Also rebased on main. |
chattymin
approved these changes
Sep 25, 2026
Owner
|
Thank you for your contribution! |
LuceteYang
added a commit
to LuceteYang/PikaTokenBar
that referenced
this pull request
Sep 25, 2026
- New usage recap shots (en/ko/ja) rendered from the production RecapCard in ScreenshotGenTests, with Gen 1 graduates, plus a tour row in each README (chattymin#332). - Pace-marker shots pick bar and percent colors with PaceTier like quotaRow does (chattymin#349); the pace row explains the six tiers. - Settings shots gain automatic backup snapshots under Backup & Transfer (chattymin#330) and a per-account session key row under Advanced (chattymin#346); footer bumped to 1.9.0. - "Also in the box" lists Pokedex search/filters (chattymin#329, chattymin#343) and save backups. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Strongorange
added a commit
to Strongorange/PokeTokenBar-windows
that referenced
this pull request
Oct 19, 2026
… restore UI Port macOS chattymin#330: snapshots of the save state live under <stateDir>/.snapshots/<stateFileName>/ in the save-transfer envelope format, keep the newest ten, and gate automatic snapshots to one per 12 hours (only once the save has progress). A state file that no longer decodes is moved to .corrupt and the newest valid snapshot is restored in its place on the next launch. The restore flow validates the chosen envelope BEFORE taking the pre-restore safety snapshot — at the retention limit that extra file prunes the oldest entry, which may be the one being restored (upstream regression). Settings gains an automatic-backups section with create/restore and a history that starts collapsed (upstream chattymin#446).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces an automated local snapshot backup and recovery mechanism for
CompanionStatewithout modifying the core state schema or depending on external cloud providers.Key enhancements:
<stateDir>/snapshots/at an interval of at least 12 hours during regular play and saves. Retains the newest 10 snapshots automatically and prunes older ones.companion-state.jsonis corrupted or fails to decode at startup, the app preserves the corrupted file as.corruptand automatically restores from the latest valid snapshot instead of starting from a blank state.Backup & Transfergroup:Localization.swiftacross all 7 supported languages (ko,en,ja,es,fr,pt,de), without Hangul string literals in UI sources.CompanionStatestored properties remain unmodified, strictly preservingSaveTransferTestsfield classification.Type of change
UI changes
Backup & Transfersection only provided manual "Export save" and "Import save" buttons requiring manual JSON file management via system file dialogs.Backup & Transfersection now includes an "Automatic Backups (Snapshots)" panel with a "Create snapshot" button and a scrollable list of recent restore points showing companion thumbnails, timestamp, Pokédex count, token count, and a 1-click "Restore" button with safety confirmation.Checklist
swift buildandswift testpass locally