fix(saves): bringing the builds' saves together merges them slot by slot, never over a kept slot #175

Merged
HumanBean merged 2 commits from madebyjordan/LongshotLauncher:fix/gather-slot-by-slot into main 2026-11-17 15:58:13 +00:00
Member

Likely cause of #146 ("Updating to v3.0.0-rc.5 deleted all saves without a prompt"). On Windows a game started outside the launcher (Explorer, a taskbar pin, Steam) saves into its own folder's user\save, while the launcher starts every build on the shared %APPDATA%\Longshot. At each start Saves.Gather kept the ONE save folder with the newest progress.sav and made it the shared save whole: one newer slot replaced the player's whole adventure, the other slots surviving only in the gather backup, and the player was told afterwards, never asked. Now the gather merges slot by slot and never writes over a slot it keeps.

What changes

  • The anchor: the shared save, or when there is none yet (the first gather after an upgrade) the save played last. Its slots are never replaced; a write over an existing slot is refused outright.
  • Each slot the anchor lacks takes the newest copy from the other folders. Every other copy that differs from what is kept goes to a free slot_00–slot_05 of its profile, or, with none free, stays only in the backup and the notice says so. A copy identical to anything kept is dropped silently (a folder whose earlier rename was refused isn't brought in twice). An empty or missing progress.sav never wins.
  • account.sav and option.sav stay the shared save's whenever one exists, so a quick new game started outside the launcher can't swap the player's options either. They come from the save played last only when there is no shared save yet, and the notice says so then.
  • The notice is built from what happened (SaveGathered.Slots): which slots came in from where, which older copies that differ are only in the backup, the profile when there is more than one, and the backup's path. List items join with a catalog text ("{0}, {1}", 、 in ja and zh). The texts are in all 12 full catalogs.
  • Unchanged: every side is backed up whole first; the swap goes through staging and aside folders with its recovery; old folders are renamed save.moved-<stamp>.
  • Main's leftover .save.longshot-old, left when a gather was cut short and every copy then tied, is now backed up and removed.
  • docs/saves.md updated.

Testing

Windows 11, .NET SDK 10.0.404; TEMP on its long path (with the short 8.3 one, a few checks on main itself fail on Windows).

  • python -I tests/test_launcher_core.py: the check commit 2a45f37 fails on main: Merged slot by slot: every slot of both sides is in the shared save (has: slot_00 slot_01 slot_04). With the fix, 1462 checks passed. Merged with the delete PR, 1484.
  • Checks cover: the #146 case (shared slots 0-2; an old folder with a newer, different slot 1 and a new slot 4), the shared save newest overall, no shared save yet with conflicting slots, two old folders (sharing a profile, a tie, the same newer copy using one free slot), no free slot, an identical copy, a copy kept elsewhere never reported as backup-only, empty or missing progress.sav, a profile only one folder has, the leftover aside folder, and a fault during the merge copies leaving the shared save as it was. The old g2 and g4 checks encoded the overwrite and were changed.
  • Mutations tried, all caught: the changed test, the dedupe of identical copies, the tie order, dropping the losing copies, hiding the older ones.
  • Reviewed cold by three separate agents in turn; every blocking point they found is fixed here.

Must be tested with the real game: a slot merged in from another folder loading next to the shared save's account.sav. Longshot's saves-script.md says a lone slot folder loads and the game rebuilds account.sav itself, but nobody has tried a slot beside another save's.

Not checked: how many slots the game accepts; moved slots stay within slot_00–slot_05, the six the launcher shows.

πŸ€– Generated with Claude Code

Likely cause of #146 ("Updating to v3.0.0-rc.5 deleted all saves without a prompt"). On Windows a game started outside the launcher (Explorer, a taskbar pin, Steam) saves into its own folder's `user\save`, while the launcher starts every build on the shared `%APPDATA%\Longshot`. At each start `Saves.Gather` kept the ONE save folder with the newest `progress.sav` and made it the shared save whole: one newer slot replaced the player's whole adventure, the other slots surviving only in the gather backup, and the player was told afterwards, never asked. Now the gather merges slot by slot and never writes over a slot it keeps. ## What changes - **The anchor**: the shared save, or when there is none yet (the first gather after an upgrade) the save played last. Its slots are never replaced; a write over an existing slot is refused outright. - **Each slot the anchor lacks** takes the newest copy from the other folders. Every other copy that differs from what is kept goes to a free `slot_00`–`slot_05` of its profile, or, with none free, stays only in the backup and the notice says so. A copy identical to anything kept is dropped silently (a folder whose earlier rename was refused isn't brought in twice). An empty or missing `progress.sav` never wins. - **`account.sav` and `option.sav`** stay the shared save's whenever one exists, so a quick new game started outside the launcher can't swap the player's options either. They come from the save played last only when there is no shared save yet, and the notice says so then. - **The notice** is built from what happened (`SaveGathered.Slots`): which slots came in from where, which older copies that differ are only in the backup, the profile when there is more than one, and the backup's path. List items join with a catalog text (`"{0}, {1}"`, `、` in ja and zh). The texts are in all 12 full catalogs. - Unchanged: every side is backed up whole first; the swap goes through staging and aside folders with its recovery; old folders are renamed `save.moved-<stamp>`. - Main's leftover `.save.longshot-old`, left when a gather was cut short and every copy then tied, is now backed up and removed. - `docs/saves.md` updated. ## Testing Windows 11, .NET SDK 10.0.404; TEMP on its long path (with the short 8.3 one, a few checks on main itself fail on Windows). - `python -I tests/test_launcher_core.py`: the check commit `2a45f37` fails on main: `Merged slot by slot: every slot of both sides is in the shared save (has: slot_00 slot_01 slot_04).` With the fix, 1462 checks passed. Merged with the delete PR, 1484. - Checks cover: the #146 case (shared slots 0-2; an old folder with a newer, different slot 1 and a new slot 4), the shared save newest overall, no shared save yet with conflicting slots, two old folders (sharing a profile, a tie, the same newer copy using one free slot), no free slot, an identical copy, a copy kept elsewhere never reported as backup-only, empty or missing `progress.sav`, a profile only one folder has, the leftover aside folder, and a fault during the merge copies leaving the shared save as it was. The old g2 and g4 checks encoded the overwrite and were changed. - Mutations tried, all caught: the `changed` test, the dedupe of identical copies, the tie order, dropping the losing copies, hiding the older ones. - Reviewed cold by three separate agents in turn; every blocking point they found is fixed here. **Must be tested with the real game:** a slot merged in from another folder loading next to the shared save's `account.sav`. Longshot's saves-script.md says a lone slot folder loads and the game rebuilds `account.sav` itself, but nobody has tried a slot beside another save's. Not checked: how many slots the game accepts; moved slots stay within `slot_00`–`slot_05`, the six the launcher shows. πŸ€– Generated with [Claude Code](https://claude.com/claude-code)
Saves.Gather keeps the one save folder with the newest progress.sav and
sets the others aside, so an old build's folder with one newer slot
replaced the whole shared adventure: the shared save's other slots
survived only in the backup (likely issue #146, "Updating deleted all
saves without a prompt"). The designer chose to merge slot by slot; a
copy of a slot saved elsewhere may be a different adventure (an old
build started on its own, a new game in that slot), so it must never
go over a slot that is kept.

The checks: the shared save has slots 1-3; an old folder has a slot 2
saved later, a slot 5 the shared one lacks and a slot 1 saved at the
same time. The shared slots and account/option files must stay, the
newer slot 2 go to the first free slot (4), slot 5 come over, the
older different slot 1 be named as kept in the backup only, both sides
be backed up whole, and the notice say where each went. And with no
shared save yet (the first gather after an update), a later slot 1 of
another adventure must go to a free slot rather than replace the slot 1
of the save played last. Both fail on main: the shared slot 3 is gone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(saves): bringing the builds' saves together merges them slot by slot, never over a kept slot
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 3s
4319545545
Saves.Gather kept the one save folder with the newest progress.sav and
set the others aside, so an old build's folder with one newer slot
replaced the whole shared adventure: the shared save's other slots were
left only in the backup, with a notice that said "the newest" (likely
issue #146, "Updating deleted all saves without a prompt").

Now one save is kept as the base: the shared one, or with none yet the
one played last. Its slots and its account.sav and option.sav stay as
they are. A slot it lacks comes from the copy saved last (an empty or
missing progress.sav counts as the oldest; a tie keeps the first
folder's). Every other copy that differs, byte for byte, from all the
slots kept may be another adventure (an old build started on its own, a
new game begun in that slot) or the same one played on: it goes to the
first free slot_00..slot_05 of that profile, newest first (a tie: the
first folder's), and with none free it stays in the backup only. A copy
older than the kept save's own different slot stays in the backup only
too. A copy the same as one already kept is the same save, so a folder
that could not be renamed is not taken in twice.

Everything is still backed up first, the old folders renamed
save.moved-<stamp>, and the merge built beside the shared save and
swapped in by two renames (a failed copy or swap changes nothing; a
write over an existing slot is refused outright). When nothing changes,
what a cut-short gather left aside (.save.longshot-old, backed up) now
goes too. SaveGathered lists what became of every copy, and the home
names the slots brought in and where they went, those left in the
backup and why, each profile when there are several, and the options'
source when there was no shared save; list items are joined by a
catalog text.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HumanBean deleted branch fix/gather-slot-by-slot 2026-11-17 15:58:16 +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!175
No description provided.