fix(saves): Restore from a backup says a backup the save editor made is one #194
No reviewers
Labels
No labels
area/build
area/install
area/saves
area/tooling
area/ui
area/updates
ci: approved
good first issue
gpu/amd
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
platform/linux
platform/steam-deck
platform/windows
priority
critical
priority
high
priority
low
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/LongshotLauncher!194
Loading…
Reference in a new issue
No description provided.
Delete branch "mooki/LongshotLauncher:fix/edit-backups-label"
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?
Type: fix · Risk: low · Tested on: Linux (Arch, kernel 7.2.15), .NET SDK 10.0.113: the launcher's core tests, its release tests and a build of the whole solution; no Windows PC, no game · Needs: Windows
TL;DR
The Progress view (#186) backs the save up before every edit, in the same backups folder as the copies, under a name starting "edit-". Restore from a backup (#182) did not know that name, so it listed those backups as an unknown kind under the raw folder name, "edit-5a3c9e1f0b7d2468-20261117-153000". Restoring one already worked and undoes the edit; only the row was unlabelled. Now it reads "Before an edit in Progress".
Breakdown
SaveBackups.KindOfknows the copies' commands, gather and delete, and gives anything elseOther, whose row text is the raw folder name (App/ViewModels/SavesViewModel.cs:750). The save editor (Longshot#1401) writesedit-<first 16 characters of the profile id>-<yyyyMMdd-HHmmss>[-n]there.Edit; its row reads "Before an edit in Progress" (one new text, English only for now, like the Progress texts).Other), passing here (1,996 checks; main 1,994), release tests, the whole solution builds with 0 warnings, and a throwaway program that lists one and reads its row text through the window's ownBackupsViewModel, on main and on the branch.Why
#182 added Restore from a backup, which lists every save in the backups folder with what made it, from the folder's name. #186 added the Progress view, which runs Longshot's save editor with the launcher's backups folder as
--backup-dir; the editor'sbackup()(Longshot#1401,scripts/longshot_save_editor.py) makesedit-<first 16 characters of the profile id>-<yyyyMMdd-HHmmss>[-n]there, holding the profile folder itself. My post-merge comment on #182 (#182 (comment)) says what the merged list does with one.On main
f2e40a0: the name matches the list's pattern (Core/SaveBackups.cs:30) and its time is read from the stamp, butKindOf(:32-40) has noedit, so the kind isOtherand the row's text isPath.GetFileName(b.Folder)(App/ViewModels/SavesViewModel.cs:750). I checked it through the window's own view model code: the row reads exactlyedit-5a3c9e1f0b7d2468-20261117-153000, "today 15:30" beside it, the confirmation page names its source the same way, and the button is Restore… like any row (App/Views/BackupsView.axaml:36). It works: in my run it put the pre-edit slots back and backed the live save up asrestore-backup-<stamp>. Only the label is missing.What changed
Core/SaveBackups.cs(+2 / -1 and a doc line):BackupKind.Edit, and"edit" => BackupKind.EditinKindOf.App/ViewModels/SavesViewModel.cs(+1):BackupKind.Edit => Tr.T("Before an edit in Progress")inBackupsViewModel.What.docs/saves.md(+2 / -1): the list names it.tests/launcher_core/EditBackupsChecks.cs(new) and one registration line intests/launcher_core/Program.cs.Unchanged on purpose: the pattern,
List,Restore, the other kinds; the catalogs (the new text is English only for now, as #186's own texts are, and needs a native speaker's check when it is added).How it was tested
Everything here was run by an AI agent (Claude Sonnet 5.5) working for me; the commands are given so anyone can rerun them. No Windows PC, no game, no GPU and no real save were used: every check is game-free, on Linux, on made-up saves in a temporary folder.
Environment: Arch Linux, kernel 7.2.15, .NET SDK 10.0.113 (the repository pins 10.0.404, which this PC does not have:
global.jsonwas changed in scratch copies for the runs and is not in the branch), 17 Nov 2026, basef2e40a0(launcher main), head9c307d1, load average 30 to 60 from other jobs on the PC (correctness checks only, nothing timed).f2e40a0; the neighbouring code the fix relies on; the existing checks for the area, to see what they do and do not cover.Appproject. In a made-up Longshot user folder on Linux make a backup folderedit-5a3c9e1f0b7d2468-20261117-153000in the backups folder holding a profile (account.sav,slot_00andslot_01saying BEFORE-EDIT), and a live save (the game's profile, slot_00 saying AFTER-EDIT). CallSaveBackups.List(env)and read the row throughBackupsViewModel.RowandBackupsViewModel.What, thenSaveBackups.Restore(row, env). On main: the row is kindOther, its text is exactlyedit-5a3c9e1f0b7d2468-20261117-153000, the confirmation names its source the same way, andRestoreput BEFORE-EDIT back into the live slot_00 and backed the live save up asrestore-backup-<stamp>("Before a backup was restored").5be0f0aadds onlytests/launcher_core/EditBackupsChecks.csand its registration. It makes two such backups, in the same second (...-153000and...-153000-2, which is how the editor names two in one second), a live save, and expects both listed asEditwith the time from the name, the one restored putting the pre-edit save back and backing the live one up first. On main's code:9c307d1is the fix:python -I tests/test_launcher_core.py --dotnet dotnetendslauncher core: 1,996 checks passed(main with the switch below: 1,994);dotnet build LongshotLauncher.slnx --configuration Releasebuilds the app (the new row text) with 0 warnings and 0 errors.9c307d1: the row is kindEdit, its text isBefore an edit in Progress, andRestorestill puts BEFORE-EDIT back and backs the live save up first.python -I tests/test_release.py:Ran 37 tests ... OK, as on main.dotnet build LongshotLauncher.slnx --configuration Release(offline restore, the app and the screenshot tool): 0 warnings, 0 errors, as on main.fix/zip-import-aside,fix/zip-import-lock,fix/zip-damaged-entry,fix/zip-export-empty,fix/editor-game-profileandfix/edit-backups-label) into one scratch branch fromf2e40a0, one after the other: no conflict, 2,019 core checks pass (f2e40a0: 1,994; each branch adds its own), 37 release tests pass, the whole solution builds with 0 warnings.f2e40a0, and earlier mains) attests/launcher_core/BuildReportChecks.cs:69-70:The home folder taken out before a line is cut: no cut leaves part of the user's name.It is main's own check of the build report (not touched here), and the run aborts there, before the saves checks. I switched that one check off with anOperatingSystem.IsWindows()guard in scratch copies only (never committed, so the branch and this description are about code that has no such change), to let the rest of the suite run. With that switch main passes 1,994 checks, the number every count in this description is compared with.To rerun it:
python -I tests/test_launcher_core.py --dotnet dotnetandpython -I tests/test_release.pyin the checkout,dotnet build LongshotLauncher.slnx --configuration Release; to see the check fail first,git checkout 5be0f0a(the commit that adds only the check), run the first command, thengit checkout 9c307d1.Risks
edit-...by hand, matching the pattern, is labelled as an editor backup; it is listed anyway, and restores as before.Overlaps
Core/SaveBackups.cs(the enum andKindOf) andWhatinApp/ViewModels/SavesViewModel.cs;fix/editor-game-profileedits another line of that view model, the four zip branches editCore/SaveArchive.cs. I merged all six: no conflict.Core/SaveBackups.cs: #183 adds three kinds (SlotCopy,SlotRestore,SlotDelete) to the same enum line as thisEdit; keep all of them.App/ViewModels/SavesViewModel.csanddocs/saves.md, which this branch also edits, so #55 rebases either way (I merged this branch with #55's head: the same files conflict as without it). #55 does not touch backups.New on this forge; not opened on GitHub.