fix(home): a game whose row went is listed again, and a portable launcher's builds folder is looked in (#141) #187

Merged
HumanBean merged 2 commits from madebyjordan/LongshotLauncher:fix/relist-unlisted-141 into main 2026-11-17 21:56:36 +00:00
Member

A portable launcher could lose every row of its list while its games were still in its own builds folder, and then asked for a first build: a dump and an hour (#141). Nothing ever listed those games again, and for a portable launcher the old-versions offer and #125's lost-update fix never looked in its builds folder at all.

Fixes #141

Why the reporter's builds vanished

Before #153 (rows follow a renamed portable folder), renaming the folder above a portable launcher made every row's path wrong, and ForgetGone dropped them all as "deleted outside the launcher". The games stayed in LongshotLauncher-data\builds (rc, v3.0.0-rc5). #153 stops new losses; this lists the lost ones again, and any game whose row went some other way (a lost builds.json).

A second bug kept every existing rescue away from a portable launcher: Leftovers.Find and Leftovers.LostUpdate left out any folder inside the launcher's home, and a portable launcher's builds folder is inside its home. So its old versions were never offered for deletion, and a lost update was never given back.

What changes

  • Leftovers.Relist, at the home's start, after the lost updates and before the old-versions offer. A game folder directly in the builds folder is listed again when:

    • it plays, and has a release's or a nightly's version;
    • it is no listed build's folder, holds none and is in none, and does not hold the launcher's home;
    • the player did not choose Keep for it when it was offered for deletion;
    • it is the newest of its channel that no listed build plays (the rule Find already uses to never offer it for deletion), and no row of its channel has a version as new, its game there or not (a row on an unplugged drive never brings an older game back beside it).

    Of two on one channel, only the newer; the older stays an old version and is offered for deletion as before. Stable first, then release candidates, then nightlies, so the default of an empty list is a release. It goes on the channel its folder is named after (rc, stable, nightly) when its version is on that channel, else on its version's.

  • The home check goes one way: Find, LostUpdate and Relist leave out a folder that holds the launcher's home, no longer one that is in it. Deleting already worked that way (MayDelete).

  • LauncherService.Relist runs the lost updates, then the games listed again: one save, one tools prune after both.

  • On the home: the existing toast "{0} was found in its own folder and is listed again." (already translated); several found at once share one toast, a new text in all 12 catalogs. The launcher's log names each.

No screen changes beyond the toast.

Testing

Windows 11, .NET SDK 10.0.404, TEMP on its long path.

  • python -I tests/test_launcher_core.py: the check commit fails on main with Each channel's newest game whose row went is listed again, from a portable launcher's own builds folder too, and nothing else (got: ). With the fix, 1737 checks passed. The check commit adds Relist with main's behaviour (it lists nothing) and gives LostUpdate the home apart as main used it, so the failure is the bug's, not a missing function.
  • UnlistedChecks: the reporter's layout (builds folder inside the portable home), the default, listed once only, the older one then offered, a no-version and a no-game folder, a folder holding the home, a kept folder, the folder-name channel both ways, a listed newer build, a row whose game is missing, and a portable launcher's lost update.
  • Mutations, each failing a check: the home checked both ways again, the folder-name channel dropped or not checked against the version, the kept folders ignored, the version filter removed, the missing-game row rule removed.
  • Two cold reviews by a second agent (code only). The first found the home check above, which made the first version of this do nothing for the reporter. The second approved; its suggestions are in.
  • python -I tests/test_release.py has 9 errors on this PC on this branch and without it (signing tools); this PR doesn't touch release code.

Not tested: a real portable launcher on the reporter's folder layout in a window, and Linux (the checks use the Linux game layout, but ran on Windows).

Known, not changed here:

  • A game listed again has no dump on its row (Nup/Romfs/Exefs), so its next update asks for the dump.
  • A game made by hand with make_game.py in the builds folder is listed at every start. The only way to drop that row is Delete, which deletes the folder.
  • Two launchers sharing one builds folder (a dev launcher with LONGSHOT_LAUNCHER_HOME) each list the other's builds.

🤖 Generated with Claude Code

A portable launcher could lose every row of its list while its games were still in its own builds folder, and then asked for a first build: a dump and an hour (#141). Nothing ever listed those games again, and for a portable launcher the old-versions offer and #125's lost-update fix never looked in its builds folder at all. Fixes #141 ## Why the reporter's builds vanished Before #153 (rows follow a renamed portable folder), renaming the folder above a portable launcher made every row's path wrong, and `ForgetGone` dropped them all as "deleted outside the launcher". The games stayed in `LongshotLauncher-data\builds` (`rc`, `v3.0.0-rc5`). #153 stops new losses; this lists the lost ones again, and any game whose row went some other way (a lost `builds.json`). A second bug kept every existing rescue away from a portable launcher: `Leftovers.Find` and `Leftovers.LostUpdate` left out any folder **inside** the launcher's home, and a portable launcher's builds folder is inside its home. So its old versions were never offered for deletion, and a lost update was never given back. ## What changes - **`Leftovers.Relist`**, at the home's start, after the lost updates and before the old-versions offer. A game folder directly in the builds folder is listed again when: - it plays, and has a release's or a nightly's version; - it is no listed build's folder, holds none and is in none, and does not hold the launcher's home; - the player did not choose Keep for it when it was offered for deletion; - it is the newest of its channel that no listed build plays (the rule `Find` already uses to never offer it for deletion), and no row of its channel has a version as new, its game there or not (a row on an unplugged drive never brings an older game back beside it). Of two on one channel, only the newer; the older stays an old version and is offered for deletion as before. Stable first, then release candidates, then nightlies, so the default of an empty list is a release. It goes on the channel its folder is named after (`rc`, `stable`, `nightly`) when its version is on that channel, else on its version's. - **The home check goes one way**: `Find`, `LostUpdate` and `Relist` leave out a folder that **holds** the launcher's home, no longer one that is **in** it. Deleting already worked that way (`MayDelete`). - **`LauncherService.Relist`** runs the lost updates, then the games listed again: one save, one tools prune after both. - **On the home**: the existing toast "{0} was found in its own folder and is listed again." (already translated); several found at once share one toast, a new text in all 12 catalogs. The launcher's log names each. No screen changes beyond the toast. ## Testing Windows 11, .NET SDK 10.0.404, TEMP on its long path. - `python -I tests/test_launcher_core.py`: the check commit fails on main with `Each channel's newest game whose row went is listed again, from a portable launcher's own builds folder too, and nothing else (got: ).` With the fix, 1737 checks passed. The check commit adds `Relist` with main's behaviour (it lists nothing) and gives `LostUpdate` the home apart as main used it, so the failure is the bug's, not a missing function. - `UnlistedChecks`: the reporter's layout (builds folder inside the portable home), the default, listed once only, the older one then offered, a no-version and a no-game folder, a folder holding the home, a kept folder, the folder-name channel both ways, a listed newer build, a row whose game is missing, and a portable launcher's lost update. - Mutations, each failing a check: the home checked both ways again, the folder-name channel dropped or not checked against the version, the kept folders ignored, the version filter removed, the missing-game row rule removed. - Two cold reviews by a second agent (code only). The first found the home check above, which made the first version of this do nothing for the reporter. The second approved; its suggestions are in. - `python -I tests/test_release.py` has 9 errors on this PC on this branch and without it (signing tools); this PR doesn't touch release code. Not tested: a real portable launcher on the reporter's folder layout in a window, and Linux (the checks use the Linux game layout, but ran on Windows). Known, not changed here: - A game listed again has no dump on its row (`Nup`/`Romfs`/`Exefs`), so its next update asks for the dump. - A game made by hand with `make_game.py` in the builds folder is listed at every start. The only way to drop that row is Delete, which deletes the folder. - Two launchers sharing one builds folder (a dev launcher with `LONGSHOT_LAUNCHER_HOME`) each list the other's builds. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A portable launcher's rows went (before #153, ForgetGone dropped every row whose folder's path no longer was, after the
launcher's folder was renamed) while its games stayed in its builds folder, LongshotLauncher-data\builds; the home asked for a
first build. The check, on that layout: each channel's newest game no listed build plays is listed again, on its channel, the
first one the default; nothing else (no version of nothing, no folder holding the launcher's home, none the player kept), and
only once; an older one stays an old version, which the leftovers offer finds in a portable launcher's builds folder too, and
a row that lost its update's game takes it back from there.

Leftovers.Relist is added with main's behaviour (it lists nothing), and LostUpdate takes the launcher's home apart (keep) as
main treats it (both ways), so the checks fail for the bug, not for a missing function.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(home): a game folder whose row went is listed again, and a portable launcher's builds folder is looked in (#141)
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 2s
4cf5013945
A portable launcher's rows could go while its games stayed in its builds folder: before #153 made them follow a renamed
folder, ForgetGone dropped every row whose path no longer was. The home then asked for a first build (a dump, and an hour),
and nothing listed the games again. Worse, for a portable launcher the leftovers offer and #125's lost update never looked in
its builds folder at all: they left out any folder in the launcher's home or holding it, and a portable launcher's builds
folder is in its home (LongshotLauncher-data\builds).

- Leftovers.Relist lists each such game again, at the home's start after the lost updates and before the leftovers: one that
  plays, with a release's or a nightly's version, in no listed build's folder and holding none, holding not the launcher's
  home, not kept by the player when it was offered for deletion, and the newest of its channel that no listed build plays
  (Find's own rule), nor any row of its channel has, its game there or not (a row on an unplugged drive never brings an
  older game back beside it). Of two on one channel the newer; the older stays an old version, offered as before. Stable first, then
  release candidates, then nightlies, so the default of an empty list is a release. On the channel its folder is named after
  (rc, stable, nightly) when its version is on it, else its version's.
- Find, LostUpdate and Relist leave out a folder that holds the launcher's home, no longer one that is in it.
- LauncherService.Relist does the lost updates, then the games listed again: one save, and the tools pruned once after both
  (not before a game listed again could keep its tools). The home says it as it does for a lost update ("{0} was found in its
  own folder and is listed again.", translated already); several in one toast (a new text, in every
  catalog); the launcher's log names each.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HumanBean deleted branch fix/relist-unlisted-141 2026-11-17 21:56:37 +00:00
Member

Review after merge, from reading the diff (4cf5013 against 0e96947). Nothing here was run, so treat each point as something to confirm. File and line refer to that head.

Most serious

  1. A deleted instance comes back (Core/Leftovers.cs:134). Relist runs at every start and can't tell a row lost by accident from one the player deleted. Example: the player deletes their rc row at v3.0.0-rc.5 because they want no rc build. An older unlisted folder v3.0.0-rc.3 is still there (it holds a save or mods, so Find never offered it, or the player never answered). At the next start Relist sees it as the rc channel's newest unlisted game and shows "v3.0.0-rc.3 was found in its own folder and is listed again." The delete is undone, and this repeats for every older folder.
  2. It can overwrite a builds list it couldn't read (App/LauncherService.cs:385). Relist adds rows and calls Registry.Save() even when Registry.Problem != null. Example: the player switches to an older launcher and builds.json has Format 2, so Load returns an empty list with Problem set. Relist adds the channel-newest folders and saves a Format 1 list over the newer launcher's. Back on the newer launcher, its list survives only in builds.json.broken, which it never reads. Before this PR nothing wrote the file until the player acted.

Wrong channel or wrong folder

  1. Duplicates resolved by folder name (Core/Leftovers.cs:129). Duplicates are ranked by the version's track, and ties go to CompareOrdinal on the folder name, not to the channel the row goes on. With builds/rc and builds/stable both at v3.0.0 and both rows gone, rc sorts first, is listed on the rc channel and becomes the default. For stable, NewestOfItsChannel sees the listed rc folder at v3.0.0 and skips it, and Find then offers the player's stable folder for deletion.
  2. Rows on other channels block re-listing (Core/Leftovers.cs:137). The check uses OnChannel(rv, TrackOf(version)) and ignores each row's own b.Channel. A stable row (or a stable folder just re-listed) at v3.0.0 stops a lost rc folder at v3.0.0-rc.5 from being re-listed, and Find then offers that rc build for deletion as an old version, though it was the only build on that channel.
  3. The channel comes only from exact folder names (Core/Leftovers.cs:139). Only rc, stable and nightly count, but LauncherSettings.FolderFor names a channel's second build rc (2), nightly (2). Example: a second rc build in rc (2) that was updated to stable v3.0.0 (rc follows stable) is re-listed on the stable channel and stops getting release candidates, while rc at the same version gets the rc channel.
  4. The result depends on how many times the launcher was opened (App/ViewModels/HomeViewModel.cs:712). Service.Relist() runs before Refresh() calls ForgetGone. If the player deletes builds/rc (rc.6) by hand while v3.0.0-rc.5 is still there: on start 1, the stale rc.6 row blocks re-listing and Refresh then drops it ("deleted outside the launcher"). On start 2, rc.5 reappears.

Design and performance

  1. Re-listing at every start works around a one-time loss at the wrong level (Core/Leftovers.cs:105). The rows #141 lost were lost once (from before #153, or a lost builds.json). Scanning at every start is what reverts every later deliberate removal (points 1, 4 and 6). Running Relist only when the list is new or empty (!Registry.Existed), or once as a migration behind a settings flag, would fix #141 without second-guessing the player.
  2. Slow drives can freeze the home (Core/Leftovers.cs:134). For each candidate, NewestOfItsChannel checks IsBuilt and reads the stamp of every listed folder again. The builds folder is now scanned three times at start (LostUpdate per row, Relist, Find), all on the UI thread in Open(). With a row on a disconnected share or a slow USB drive, each File.Exists can block for seconds. Reading the listed versions once per channel and sharing one directory scan would avoid it.
  3. Copied code (Core/Leftovers.cs:117, :127). The scan loop (enumerate, link check, IsBuilt, Taken, IOException) is a third near-copy of Find's and LostUpdate's; one helper returning the unlisted (folder, version) pairs would keep the three consistent. Rank repeats Versions.Channels' order (Versions.Channels.IndexOf(TrackOf(v))), and the sort comparator repeats Versions.Compare.

#184 (the builds// layout) adapts Relist to the nested folders, as you asked on #184. That keeps this behaviour as it is, including point 1, so the fixes above are better as their own follow-up than folded into #184.

Review after merge, from reading the diff (4cf5013 against 0e96947). Nothing here was run, so treat each point as something to confirm. File and line refer to that head. ## Most serious 1. **A deleted instance comes back** (`Core/Leftovers.cs:134`). `Relist` runs at every start and can't tell a row lost by accident from one the player deleted. Example: the player deletes their rc row at v3.0.0-rc.5 because they want no rc build. An older unlisted folder `v3.0.0-rc.3` is still there (it holds a save or mods, so `Find` never offered it, or the player never answered). At the next start `Relist` sees it as the rc channel's newest unlisted game and shows "v3.0.0-rc.3 was found in its own folder and is listed again." The delete is undone, and this repeats for every older folder. 2. **It can overwrite a builds list it couldn't read** (`App/LauncherService.cs:385`). `Relist` adds rows and calls `Registry.Save()` even when `Registry.Problem != null`. Example: the player switches to an older launcher and `builds.json` has Format 2, so `Load` returns an empty list with `Problem` set. `Relist` adds the channel-newest folders and saves a Format 1 list over the newer launcher's. Back on the newer launcher, its list survives only in `builds.json.broken`, which it never reads. Before this PR nothing wrote the file until the player acted. ## Wrong channel or wrong folder 3. **Duplicates resolved by folder name** (`Core/Leftovers.cs:129`). Duplicates are ranked by the version's track, and ties go to `CompareOrdinal` on the folder name, not to the channel the row goes on. With `builds/rc` and `builds/stable` both at v3.0.0 and both rows gone, `rc` sorts first, is listed on the rc channel and becomes the default. For stable, `NewestOfItsChannel` sees the listed rc folder at v3.0.0 and skips it, and `Find` then offers the player's stable folder for deletion. 4. **Rows on other channels block re-listing** (`Core/Leftovers.cs:137`). The check uses `OnChannel(rv, TrackOf(version))` and ignores each row's own `b.Channel`. A stable row (or a stable folder just re-listed) at v3.0.0 stops a lost `rc` folder at v3.0.0-rc.5 from being re-listed, and `Find` then offers that rc build for deletion as an old version, though it was the only build on that channel. 5. **The channel comes only from exact folder names** (`Core/Leftovers.cs:139`). Only `rc`, `stable` and `nightly` count, but `LauncherSettings.FolderFor` names a channel's second build `rc (2)`, `nightly (2)`. Example: a second rc build in `rc (2)` that was updated to stable v3.0.0 (rc follows stable) is re-listed on the stable channel and stops getting release candidates, while `rc` at the same version gets the rc channel. 6. **The result depends on how many times the launcher was opened** (`App/ViewModels/HomeViewModel.cs:712`). `Service.Relist()` runs before `Refresh()` calls `ForgetGone`. If the player deletes `builds/rc` (rc.6) by hand while `v3.0.0-rc.5` is still there: on start 1, the stale rc.6 row blocks re-listing and `Refresh` then drops it ("deleted outside the launcher"). On start 2, rc.5 reappears. ## Design and performance 7. **Re-listing at every start works around a one-time loss at the wrong level** (`Core/Leftovers.cs:105`). The rows #141 lost were lost once (from before #153, or a lost `builds.json`). Scanning at every start is what reverts every later deliberate removal (points 1, 4 and 6). Running `Relist` only when the list is new or empty (`!Registry.Existed`), or once as a migration behind a settings flag, would fix #141 without second-guessing the player. 8. **Slow drives can freeze the home** (`Core/Leftovers.cs:134`). For each candidate, `NewestOfItsChannel` checks `IsBuilt` and reads the stamp of every listed folder again. The builds folder is now scanned three times at start (`LostUpdate` per row, `Relist`, `Find`), all on the UI thread in `Open()`. With a row on a disconnected share or a slow USB drive, each `File.Exists` can block for seconds. Reading the listed versions once per channel and sharing one directory scan would avoid it. 9. **Copied code** (`Core/Leftovers.cs:117`, `:127`). The scan loop (enumerate, link check, `IsBuilt`, `Taken`, `IOException`) is a third near-copy of `Find`'s and `LostUpdate`'s; one helper returning the unlisted (folder, version) pairs would keep the three consistent. `Rank` repeats `Versions.Channels`' order (`Versions.Channels.IndexOf(TrackOf(v))`), and the sort comparator repeats `Versions.Compare`. ## Related #184 (the builds/<track>/<version> layout) adapts `Relist` to the nested folders, as you asked on #184. That keeps this behaviour as it is, including point 1, so the fixes above are better as their own follow-up than folded into #184.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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!187
No description provided.