fix(saves): Restore from a backup says a backup the save editor made is one #194

Merged
HumanBean merged 2 commits from mooki/LongshotLauncher:fix/edit-backups-label into main 2026-11-17 22:58:51 +00:00
Member

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

  • Who it helps: players who edit a slot in Progress (#186) and want to undo it from Restore from a backup (#182): they now see what each such backup is.
  • What was wrong: SaveBackups.KindOf knows the copies' commands, gather and delete, and gives anything else Other, whose row text is the raw folder name (App/ViewModels/SavesViewModel.cs:750). The save editor (Longshot#1401) writes edit-<first 16 characters of the profile id>-<yyyyMMdd-HHmmss>[-n] there.
  • What changes: a new kind Edit; its row reads "Before an edit in Progress" (one new text, English only for now, like the Progress texts).
  • What does not change: restoring such a backup (it already put the pre-edit slots back and backed the live save up first); the order, time, slots and size of the row; any other kind; the editor.
  • How it was checked: a check written first that fails on main (two editor backups, in the same second, are listed as 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 own BackupsViewModel, on main and on the branch.
  • What is still open: translations (the text is English until a catalog adds it); a Windows run; a real backup from the real editor (a build with Longshot#1401's tools).
  • Risk: low. A label for a kind of folder; restoring is unchanged.

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's backup() (Longshot#1401, scripts/longshot_save_editor.py) makes edit-<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, but KindOf (:32-40) has no edit, so the kind is Other and the row's text is Path.GetFileName(b.Folder) (App/ViewModels/SavesViewModel.cs:750). I checked it through the window's own view model code: the row reads exactly edit-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 as restore-backup-<stamp>. Only the label is missing.

What changed

  • Core/SaveBackups.cs (+2 / -1 and a doc line): BackupKind.Edit, and "edit" => BackupKind.Edit in KindOf.
  • App/ViewModels/SavesViewModel.cs (+1): BackupKind.Edit => Tr.T("Before an edit in Progress") in BackupsViewModel.What.
  • docs/saves.md (+2 / -1): the list names it.
  • tests/launcher_core/EditBackupsChecks.cs (new) and one registration line in tests/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.json was changed in scratch copies for the runs and is not in the branch), 17 Nov 2026, base f2e40a0 (launcher main), head 9c307d1, load average 30 to 60 from other jobs on the PC (correctness checks only, nothing timed).

  1. Reading first. The merged pull request this follows (#186) and its comments and review threads, and the code it changed, at launcher main f2e40a0; the neighbouring code the fix relies on; the existing checks for the area, to see what they do and do not cover.
  2. The bug on main, by hand. A throwaway program (not in the branch) that references the launcher's App project. In a made-up Longshot user folder on Linux make a backup folder edit-5a3c9e1f0b7d2468-20261117-153000 in the backups folder holding a profile (account.sav, slot_00 and slot_01 saying BEFORE-EDIT), and a live save (the game's profile, slot_00 saying AFTER-EDIT). Call SaveBackups.List(env) and read the row through BackupsViewModel.Row and BackupsViewModel.What, then SaveBackups.Restore(row, env). On main: the row is kind Other, its text is exactly edit-5a3c9e1f0b7d2468-20261117-153000, the confirmation names its source the same way, and Restore put BEFORE-EDIT back into the live slot_00 and backed the live save up as restore-backup-<stamp> ("Before a backup was restored").
  3. The check first. Commit 5be0f0a adds only tests/launcher_core/EditBackupsChecks.cs and its registration. It makes two such backups, in the same second (...-153000 and ...-153000-2, which is how the editor names two in one second), a live save, and expects both listed as Edit with 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:
    Unhandled exception. System.Exception: A backup the save editor made is listed as an edit's, with its time from its name, twice in the same second: Other edit-5a3c9e1f0b7d2468-20261117-153000, Other edit-5a3c9e1f0b7d2468-20261117-153000-2
    
  4. The fix and the same check. Commit 9c307d1 is the fix: python -I tests/test_launcher_core.py --dotnet dotnet ends launcher core: 1,996 checks passed (main with the switch below: 1,994); dotnet build LongshotLauncher.slnx --configuration Release builds the app (the new row text) with 0 warnings and 0 errors.
  5. The same steps on the branch. The same program on 9c307d1: the row is kind Edit, its text is Before an edit in Progress, and Restore still puts BEFORE-EDIT back and backs the live save up first.
  6. The release tests and the whole solution. 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.
  7. The six branches together. I merged the six branches (fix/zip-import-aside, fix/zip-import-lock, fix/zip-damaged-entry, fix/zip-export-empty, fix/editor-game-profile and fix/edit-backups-label) into one scratch branch from f2e40a0, 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.
  8. The one inherited Linux check. On this PC the core suite stops on plain main (f2e40a0, and earlier mains) at tests/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 an OperatingSystem.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.
  9. Not run: a Windows PC (NTFS renames, junctions, Explorer's and 7-Zip's zips, the Save As dialog), the game, a real save, a click-through of the window, the GPU, and CI's compile-and-test (it is started by hand on this forge, and was not started). A backup made by the real editor (a build whose tools carry Longshot#1401's script), and the window itself (the row text was read through the view model code, not drawn).

To rerun it: python -I tests/test_launcher_core.py --dotnet dotnet and python -I tests/test_release.py in 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, then git checkout 9c307d1.

Risks

  • A new text that the 12 catalogs do not have yet shows in English, as the Progress texts do; the translations test says so and does not fail.
  • A folder a player named edit-... by hand, matching the pattern, is labelled as an editor backup; it is listed anyway, and restores as before.

Overlaps

  • The other five branches (my small fixes for the saves stack, opened together): it edits Core/SaveBackups.cs (the enum and KindOf) and What in App/ViewModels/SavesViewModel.cs; fix/editor-game-profile edits another line of that view model, the four zip branches edit Core/SaveArchive.cs. I merged all six: no conflict.
  • #183 (one slot at a time, WIP, on hold): replaying #183's two own commits on top of this branch also conflicts in Core/SaveBackups.cs: #183 adds three kinds (SlotCopy, SlotRestore, SlotDelete) to the same enum line as this Edit; keep all of them.
  • #55 (player profiles and progress previews, open): it already conflicts with main in App/ViewModels/SavesViewModel.cs and docs/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.

**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 - **Who it helps:** players who edit a slot in Progress ([#186](https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/186)) and want to undo it from Restore from a backup ([#182](https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/182)): they now see what each such backup is. - **What was wrong:** `SaveBackups.KindOf` knows the copies' commands, gather and delete, and gives anything else `Other`, whose row text is the raw folder name (`App/ViewModels/SavesViewModel.cs:750`). The save editor (Longshot#1401) writes `edit-<first 16 characters of the profile id>-<yyyyMMdd-HHmmss>[-n]` there. - **What changes:** a new kind `Edit`; its row reads "Before an edit in Progress" (one new text, English only for now, like the Progress texts). - **What does not change:** restoring such a backup (it already put the pre-edit slots back and backed the live save up first); the order, time, slots and size of the row; any other kind; the editor. - **How it was checked:** a check written first that fails on main (two editor backups, in the same second, are listed as `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 own `BackupsViewModel`, on main and on the branch. - **What is still open:** translations (the text is English until a catalog adds it); a Windows run; a real backup from the real editor (a build with Longshot#1401's tools). - **Risk:** low. A label for a kind of folder; restoring is unchanged. ## Why [#182](https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/182) added Restore from a backup, which lists every save in the backups folder with what made it, from the folder's name. [#186](https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/186) added the Progress view, which runs Longshot's save editor with the launcher's backups folder as `--backup-dir`; the editor's `backup()` (Longshot#1401, `scripts/longshot_save_editor.py`) makes `edit-<first 16 characters of the profile id>-<yyyyMMdd-HHmmss>[-n]` there, holding the profile folder itself. My post-merge comment on #182 (https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/182#issuecomment-46013) 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, but `KindOf` (`:32-40`) has no `edit`, so the kind is `Other` and the row's text is `Path.GetFileName(b.Folder)` (`App/ViewModels/SavesViewModel.cs:750`). I checked it through the window's own view model code: the row reads exactly `edit-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 as `restore-backup-<stamp>`. Only the label is missing. ## What changed - `Core/SaveBackups.cs` (+2 / -1 and a doc line): `BackupKind.Edit`, and `"edit" => BackupKind.Edit` in `KindOf`. - `App/ViewModels/SavesViewModel.cs` (+1): `BackupKind.Edit => Tr.T("Before an edit in Progress")` in `BackupsViewModel.What`. - `docs/saves.md` (+2 / -1): the list names it. - `tests/launcher_core/EditBackupsChecks.cs` (new) and one registration line in `tests/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.json` was changed in scratch copies for the runs and is not in the branch), 17 Nov 2026, base `f2e40a0` (launcher main), head `9c307d1`, load average 30 to 60 from other jobs on the PC (correctness checks only, nothing timed). 1. **Reading first.** The merged pull request this follows ([#186](https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/186)) and its comments and review threads, and the code it changed, at launcher main `f2e40a0`; the neighbouring code the fix relies on; the existing checks for the area, to see what they do and do not cover. 2. **The bug on main, by hand.** A throwaway program (not in the branch) that references the launcher's `App` project. In a made-up Longshot user folder on Linux make a backup folder `edit-5a3c9e1f0b7d2468-20261117-153000` in the backups folder holding a profile (`account.sav`, `slot_00` and `slot_01` saying BEFORE-EDIT), and a live save (the game's profile, slot_00 saying AFTER-EDIT). Call `SaveBackups.List(env)` and read the row through `BackupsViewModel.Row` and `BackupsViewModel.What`, then `SaveBackups.Restore(row, env)`. On main: the row is kind `Other`, its text is exactly `edit-5a3c9e1f0b7d2468-20261117-153000`, the confirmation names its source the same way, and `Restore` put BEFORE-EDIT back into the live slot_00 and backed the live save up as `restore-backup-<stamp>` ("Before a backup was restored"). 3. **The check first.** Commit `5be0f0a` adds only `tests/launcher_core/EditBackupsChecks.cs` and its registration. It makes two such backups, in the same second (`...-153000` and `...-153000-2`, which is how the editor names two in one second), a live save, and expects both listed as `Edit` with 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: ``` Unhandled exception. System.Exception: A backup the save editor made is listed as an edit's, with its time from its name, twice in the same second: Other edit-5a3c9e1f0b7d2468-20261117-153000, Other edit-5a3c9e1f0b7d2468-20261117-153000-2 ``` 4. **The fix and the same check.** Commit `9c307d1` is the fix: `python -I tests/test_launcher_core.py --dotnet dotnet` ends `launcher core: 1,996 checks passed` (main with the switch below: 1,994); `dotnet build LongshotLauncher.slnx --configuration Release` builds the app (the new row text) with 0 warnings and 0 errors. 5. **The same steps on the branch.** The same program on `9c307d1`: the row is kind `Edit`, its text is `Before an edit in Progress`, and `Restore` still puts BEFORE-EDIT back and backs the live save up first. 6. **The release tests and the whole solution.** `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. 7. **The six branches together.** I merged the six branches (`fix/zip-import-aside`, `fix/zip-import-lock`, `fix/zip-damaged-entry`, `fix/zip-export-empty`, `fix/editor-game-profile` and `fix/edit-backups-label`) into one scratch branch from `f2e40a0`, 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. 8. **The one inherited Linux check.** On this PC the core suite stops on plain main (`f2e40a0`, and earlier mains) at `tests/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 an `OperatingSystem.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. 9. **Not run:** a Windows PC (NTFS renames, junctions, Explorer's and 7-Zip's zips, the Save As dialog), the game, a real save, a click-through of the window, the GPU, and CI's compile-and-test (it is started by hand on this forge, and was not started). A backup made by the real editor (a build whose tools carry Longshot#1401's script), and the window itself (the row text was read through the view model code, not drawn). To rerun it: `python -I tests/test_launcher_core.py --dotnet dotnet` and `python -I tests/test_release.py` in 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, then `git checkout 9c307d1`. ## Risks - A new text that the 12 catalogs do not have yet shows in English, as the Progress texts do; the translations test says so and does not fail. - A folder a player named `edit-...` by hand, matching the pattern, is labelled as an editor backup; it is listed anyway, and restores as before. ## Overlaps - **The other five branches** (my small fixes for the saves stack, opened together): it edits `Core/SaveBackups.cs` (the enum and `KindOf`) and `What` in `App/ViewModels/SavesViewModel.cs`; `fix/editor-game-profile` edits another line of that view model, the four zip branches edit `Core/SaveArchive.cs`. I merged all six: no conflict. - **[#183](https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/183)** (one slot at a time, WIP, on hold): replaying #183's two own commits on top of this branch also conflicts in `Core/SaveBackups.cs`: #183 adds three kinds (`SlotCopy`, `SlotRestore`, `SlotDelete`) to the same enum line as this `Edit`; keep all of them. - **[#55](https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/55)** (player profiles and progress previews, open): it already conflicts with main in `App/ViewModels/SavesViewModel.cs` and `docs/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.
The save editor (Progress) makes edit-<first 16 characters of the profile id>-<yyyyMMdd-HHmmss>[-n] in the backups folder. Restore from
a backup listed it as an unknown kind (Other) under its raw folder name, edit-5a3c9e1f0b7d2468-20261117-153000. Restoring it worked (it
undoes the edit, and the save as it is now is backed up first), only the row was not labelled.

This check fails on main: both backups are listed as Other.

Assisted-by: Claude Sonnet 5.5
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
fix(saves): Restore from a backup says a backup the save editor made is one
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 4s
9c307d1fce
KindOf knew the copies' commands, gather and delete, and listed the save editor's edit-<profile>-<stamp> as Other under its raw folder name.
It is now an Edit, and its row reads "Before an edit in Progress" (English only for now, like Progress's own texts). Restoring it was
already right, so nothing else changes. docs/saves.md says it.

Checks: core tests 1,985 pass (main 1,983 with one Linux-only check of main's own switched off); the whole solution builds, 0 warnings.

Assisted-by: Claude Sonnet 5.5
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
HumanBean deleted branch fix/edit-backups-label 2026-11-17 22:58:52 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/LongshotLauncher!194
No description provided.