fix(launcher): refresh local installations and keep upgrades connected #321

Merged
HumanBean merged 4 commits from HumanBean/LongshotLauncher:fix/installation-library into main 2026-11-28 00:14:10 +00:00
Owner

A playable build could disappear from Versions when its directory was renamed or its registry entry was retired. Upgrading could also leave a large obsolete build and a stale Steam shortcut, while opening a folder could block the launcher until the file manager returned.

  • Scan the configured library for playable releases. Read the nightly label from the builder metadata, retain independent copies, and refresh the list when the library changes. A missing directory disappears from Versions.
  • Refresh visible versions, profiles, saves, installed mods and NFC tags after external changes. Check file metadata on a background thread and defer refresh while the user is editing or reviewing a dialog.
  • After a successful upgrade, reclaim unchanged outputs listed in the retired build's manifest. Transfer per-build settings, logs and reports to the upgraded instance. Remove stale per-build cache and empty directories. Preserve unrecognized files and conflicting reports on the same volume. Defer cleanup while builds or games are using the library.
  • Give each new install a random 16-character hexadecimal directory ID. Stage and verify upgrades before replacing the build inside the selected directory. Keep its original path and ownership record and restore its files if registration fails.
  • Point Steam directly at the instance builder with its profile, configured cache, per-instance upscalers, and disabled self-update. After an owned instance is renamed, synchronize its shortcut from the live library scan. Upgrading keeps the shortcut target and Steam app ID stable.
  • Open folders independently of the launcher and make local paths clickable in Settings, Storage and the build dialogs. Keep each notice and its Dismiss action together on wide screens.

Verification

A Linux window test displayed all three playable fixture copies, including one with a renamed directory. Clicking the original game, Longshot data, and cache paths produced three file-manager calls with the expected directories. Resetting the fixture cache displayed the compact “Folder updated.” notice. Screenshots below use synthetic data.

Regression tests cover preservation of an extra file during cleanup, a rename within the library, a move out of it, and the original Steam shortcut targeting the same executable path after its contents change. Steam shortcut behavior was tested using a local shortcuts.vdf fixture. Windows desktop interaction and launching a retail game through the Steam client remain unverified.

The native window picked up a fourth fixture installation added on disk. After clicking Open folder, the Saves page opened while the simulated file manager was still running. Locked Clippy, formatting, launcher core and shared release checks passed.

Review follow-up: an upgrade or rebuild of a discovered, unowned copy now stops before download and offers Add version for a separate managed copy. Local build mods carry forward, and cache cleanup preserves unrecognized files. The broader handling of modified build outputs at their original paths belongs to the separate layout change.

A playable build could disappear from Versions when its directory was renamed or its registry entry was retired. Upgrading could also leave a large obsolete build and a stale Steam shortcut, while opening a folder could block the launcher until the file manager returned. - Scan the configured library for playable releases. Read the nightly label from the builder metadata, retain independent copies, and refresh the list when the library changes. A missing directory disappears from Versions. - Refresh visible versions, profiles, saves, installed mods and NFC tags after external changes. Check file metadata on a background thread and defer refresh while the user is editing or reviewing a dialog. - After a successful upgrade, reclaim unchanged outputs listed in the retired build's manifest. Transfer per-build settings, logs and reports to the upgraded instance. Remove stale per-build cache and empty directories. Preserve unrecognized files and conflicting reports on the same volume. Defer cleanup while builds or games are using the library. - Give each new install a random 16-character hexadecimal directory ID. Stage and verify upgrades before replacing the build inside the selected directory. Keep its original path and ownership record and restore its files if registration fails. - Point Steam directly at the instance builder with its profile, configured cache, per-instance upscalers, and disabled self-update. After an owned instance is renamed, synchronize its shortcut from the live library scan. Upgrading keeps the shortcut target and Steam app ID stable. - Open folders independently of the launcher and make local paths clickable in Settings, Storage and the build dialogs. Keep each notice and its Dismiss action together on wide screens. ### Verification A Linux window test displayed all three playable fixture copies, including one with a renamed directory. Clicking the original game, Longshot data, and cache paths produced three file-manager calls with the expected directories. Resetting the fixture cache displayed the compact “Folder updated.” notice. Screenshots below use synthetic data. Regression tests cover preservation of an extra file during cleanup, a rename within the library, a move out of it, and the original Steam shortcut targeting the same executable path after its contents change. Steam shortcut behavior was tested using a local shortcuts.vdf fixture. Windows desktop interaction and launching a retail game through the Steam client remain unverified. The native window picked up a fourth fixture installation added on disk. After clicking Open folder, the Saves page opened while the simulated file manager was still running. Locked Clippy, formatting, launcher core and shared release checks passed. Review follow-up: an upgrade or rebuild of a discovered, unowned copy now stops before download and offers Add version for a separate managed copy. Local build mods carry forward, and cache cleanup preserves unrecognized files. The broader handling of modified build outputs at their original paths belongs to the separate layout change.
fix(launcher): refresh the local library and keep upgrades connected
Some checks failed
CI / What the change needs (pull_request) Successful in 8s
PR title / Conventional Commit title (pull_request) Successful in 9s
CI / Lint (actionlint, ShellCheck, gitleaks) (pull_request) Successful in 14s
CI / Rust formatting, lint and tests (pull_request) Has been cancelled
CI / Release packages and stable upgrades (pull_request) Has been cancelled
a61cd7942b
Author
Owner

Versions and Settings on Linux, using a synthetic library.

longshot-pr-versions.png

longshot-pr-notice.png

Versions and Settings on Linux, using a synthetic library. ![longshot-pr-versions.png](https://git.magicbean.dev/attachments/d69f6024-7c38-4c44-89b0-8596455991cf) ![longshot-pr-notice.png](https://git.magicbean.dev/attachments/928ee5d6-fe04-4232-823a-d845f2423bff)
Member

Possibly related, for context:

  • PR #317 feat(versions): show previous launcher builds and remove one in one action — Overlaps version listing and build-folder cleanup UI
  • issue #240 Launcher: Update fails after renaming .longshot_exefs and build folder — Renamed build directory breaks update paths; refresh/upgrade path may address it
  • issue #237 Launcher: Build another version unavailable when Stable and Nightly both show Not found — Version discovery reports existing builds missing
Possibly related, for context: - PR #317 feat(versions): show previous launcher builds and remove one in one action — Overlaps version listing and build-folder cleanup UI - issue #240 Launcher: Update fails after renaming .longshot_exefs and build folder — Renamed build directory breaks update paths; refresh/upgrade path may address it - issue #237 Launcher: Build another version unavailable when Stable and Nightly both show Not found — Version discovery reports existing builds missing
fix(launcher): keep instance executable paths stable across upgrades
Some checks failed
CI / What the change needs (pull_request) Successful in 9s
CI / Lint (actionlint, ShellCheck, gitleaks) (pull_request) Successful in 16s
PR title / Conventional Commit title (pull_request) Successful in 5s
CI / Rust formatting, lint and tests (pull_request) Has been cancelled
CI / Release packages and stable upgrades (pull_request) Has been cancelled
ff26d1f6de
Author
Owner

Each new installation now gets a permanent 16-character hexadecimal folder name. An upgrade replaces the build in that folder and Steam targets its executable directly. The regression fixtures cover two copies, rollback, retired build cleanup, and an unchanged Steam shortcut.

Each new installation now gets a permanent 16-character hexadecimal folder name. An upgrade replaces the build in that folder and Steam targets its executable directly. The regression fixtures cover two copies, rollback, retired build cleanup, and an unchanged Steam shortcut.
Author
Owner
@review
BeanBot left a comment

Recommendation: Request changes. Steam shortcuts now bypass launcher preparation and trust checks, and upgrades fail for discovered copies that the launcher does not own. Upgrades also move existing build-local files away from their expected paths.

The change discovers and refreshes local installations, stages upgrades, cleans retired outputs, and makes paths clickable. Stable executable paths are useful, but the new Steam and upgrade paths introduce player-facing regressions.

Blocking (3): must change before merging.

  1. L1 src/game/steam/library.rs:513: The direct Steam target bypasses the launcher's game preparation and mod trust checks. (more on the line) Do: Keep Steam launching through the launcher, or provide an equivalent stable entry point that performs the same trust checks and launch preparation before starting the builder.
  2. L2 src/game/wizard.rs:627: Discovered installations can be selected for upgrade, but replacement requires launcher ownership that discovery explicitly does not grant. (more on the line) Do: Handle unowned discovered copies explicitly before starting the build, with a safe upgrade path or a clear choice to install a separate managed copy.
  3. L3 src/game/wizard.rs:656: Replacing the entire builds directory removes additional and modified files from the active installation's paths. (more on the line) Do: Carry non-generated and modified files into their corresponding active build paths, resolving collisions safely, instead of moving them away with the retired outputs.

Should fix (1): not blocking, but worth doing before merging.

  • L4 src/live.rs:170: A live rename reconnects the registry but does not reconnect existing Steam shortcuts. (more on the line) Do: Retarget affected shortcuts after a successful live reconnection, with the same ownership and ambiguity checks used at startup.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L5 src/game/steam/library.rs:513: The changed launch path needs a real Steam client check on supported platforms. (more on the line) Do: Exercise an install, upgrade and Steam launch with a retail game on Windows and Linux, including a selected profile and enabled mods.

@fix can do L1, L2, L3 and L4.

Checks: Still running: CI / Rust formatting, lint and tests (pull_request), CI / Release packages and stable upgrades (pull_request).

More: does it help, other systems, switches, what was read

Does it help: Unproven overall. The description reports a Linux window test with three fixture copies and a fourth added on disk, plus a Steam VDF fixture; it says Windows desktop interaction and a retail game launch through Steam were not verified.

Other systems: Steam launches bypass launcher-provided environment, mod trust, sharing, cache and upscaler preparation on both operating systems. Upgrade replacement affects build-local files and discovered copies. Windows file operations and real Steam launches remain unverified.

Switches: No switches added, changed or removed.

Reviewed: ff26d1f6de against df3d1dc174: Read AGENTS.md, CONTRIBUTING.md, docs/pull-requests.md, the commit messages, the diff, and the principal changed Rust paths and their callers. Skimmed the Slint changes and reported fixture runs; did not read every changed code file in full. No review checklist or pull request template was found.; nothing run (a code review).

Checked and fine:

  • The added fixtures shown in the diff use synthetic data.
  • The reported Linux window test covers discovery and detached folder opening.

Testing: No commands that build, run tests, or execute project code were run. The reported locked checks passed locally; both Forgejo CI checks are still running.

Overlaps and merge order: Not checked; the network is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** Steam shortcuts now bypass launcher preparation and trust checks, and upgrades fail for discovered copies that the launcher does not own. Upgrades also move existing build-local files away from their expected paths. The change discovers and refreshes local installations, stages upgrades, cleans retired outputs, and makes paths clickable. Stable executable paths are useful, but the new Steam and upgrade paths introduce player-facing regressions. **Blocking (3)**: must change before merging. 1. **L1** `src/game/steam/library.rs:513`: The direct Steam target bypasses the launcher's game preparation and mod trust checks. (more on the line) **Do:** Keep Steam launching through the launcher, or provide an equivalent stable entry point that performs the same trust checks and launch preparation before starting the builder. 2. **L2** `src/game/wizard.rs:627`: Discovered installations can be selected for upgrade, but replacement requires launcher ownership that discovery explicitly does not grant. (more on the line) **Do:** Handle unowned discovered copies explicitly before starting the build, with a safe upgrade path or a clear choice to install a separate managed copy. 3. **L3** `src/game/wizard.rs:656`: Replacing the entire builds directory removes additional and modified files from the active installation's paths. (more on the line) **Do:** Carry non-generated and modified files into their corresponding active build paths, resolving collisions safely, instead of moving them away with the retired outputs. **Should fix (1)**: not blocking, but worth doing before merging. - **L4** `src/live.rs:170`: A live rename reconnects the registry but does not reconnect existing Steam shortcuts. (more on the line) **Do:** Retarget affected shortcuts after a successful live reconnection, with the same ownership and ambiguity checks used at startup. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L5** `src/game/steam/library.rs:513`: The changed launch path needs a real Steam client check on supported platforms. (more on the line) **Do:** Exercise an install, upgrade and Steam launch with a retail game on Windows and Linux, including a selected profile and enabled mods. `@fix` can do L1, L2, L3 and L4. **Checks:** Still running: `CI / Rust formatting, lint and tests (pull_request)`, `CI / Release packages and stable upgrades (pull_request)`. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven overall. The description reports a Linux window test with three fixture copies and a fourth added on disk, plus a Steam VDF fixture; it says Windows desktop interaction and a retail game launch through Steam were not verified. **Other systems:** Steam launches bypass launcher-provided environment, mod trust, sharing, cache and upscaler preparation on both operating systems. Upgrade replacement affects build-local files and discovered copies. Windows file operations and real Steam launches remain unverified. **Switches:** No switches added, changed or removed. **Reviewed:** ff26d1f6de31 against df3d1dc17445: Read AGENTS.md, CONTRIBUTING.md, docs/pull-requests.md, the commit messages, the diff, and the principal changed Rust paths and their callers. Skimmed the Slint changes and reported fixture runs; did not read every changed code file in full. No review checklist or pull request template was found.; nothing run (a code review). **Checked and fine:** - The added fixtures shown in the diff use synthetic data. - The reported Linux window test covers discovery and detached folder opening. **Testing:** No commands that build, run tests, or execute project code were run. The reported locked checks passed locally; both Forgejo CI checks are still running. **Overlaps and merge order:** Not checked; the network is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -432,0 +510,4 @@
profile: &Path,
home: &Path,
) -> Result<()> {
let exe = argument(target_builder)?;
Member

L1 (blocking): The direct Steam target bypasses the launcher's game preparation and mod trust checks.

When: Starting a migrated shortcut invokes the builder directly with only the profile argument. It never enters versions::play or start_for, so newly added mod permissions are not reviewed and launcher settings such as the profile's HOS_MODS path, configured cache, gamescope and upscalers are not applied.

Do: Keep Steam launching through the launcher, or provide an equivalent stable entry point that performs the same trust checks and launch preparation before starting the builder.

**L1** (blocking): The direct Steam target bypasses the launcher's game preparation and mod trust checks. *When:* Starting a migrated shortcut invokes the builder directly with only the profile argument. It never enters versions::play or start_for, so newly added mod permissions are not reviewed and launcher settings such as the profile's HOS_MODS path, configured cache, gamescope and upscalers are not applied. **Do:** Keep Steam launching through the launcher, or provide an equivalent stable entry point that performs the same trust checks and launch preparation before starting the builder.
Member

L5 (should fix): The changed launch path needs a real Steam client check on supported platforms.

When: The VDF fixture verifies the stored target and arguments, but the description says a retail game has not been launched through Steam and Windows desktop interaction remains unverified.

Do: Exercise an install, upgrade and Steam launch with a retail game on Windows and Linux, including a selected profile and enabled mods.

**L5** (should fix): The changed launch path needs a real Steam client check on supported platforms. *When:* The VDF fixture verifies the stored target and arguments, but the description says a retail game has not been launched through Steam and Windows desktop interaction remains unverified. **Do:** Exercise an install, upgrade and Steam launch with a retail game on Windows and Linux, including a selected profile and enabled mods.
@ -607,0 +624,4 @@
register: impl FnOnce() -> Result<()>,
) -> Result<()> {
use std::fs;
ensure!(
Member

L2 (blocking): Discovered installations can be selected for upgrade, but replacement requires launcher ownership that discovery explicitly does not grant.

When: A playable copy in a custom library has no ownership record. It appears in Versions and the update wizard builds a replacement, but replace_instance rejects the old folder after the build has completed.

Do: Handle unowned discovered copies explicitly before starting the build, with a safe upgrade path or a clear choice to install a separate managed copy.

**L2** (blocking): Discovered installations can be selected for upgrade, but replacement requires launcher ownership that discovery explicitly does not grant. *When:* A playable copy in a custom library has no ownership record. It appears in Versions and the update wizard builds a replacement, but replace_instance rejects the old folder after the build has completed. **Do:** Handle unowned discovered copies explicitly before starting the build, with a safe upgrade path or a clear choice to install a separate managed copy.
@ -607,0 +653,4 @@
for entry in fs::read_dir(active)? {
let entry = entry?;
let name = entry.file_name();
if name != ".longshot-launcher-owner"
Member

L3 (blocking): Replacing the entire builds directory removes additional and modified files from the active installation's paths.

When: A player has a local mods or cache directory under builds/default. Upgrade moves it into the retired staging directory; cleanup then moves residuals to a randomly named preserved-files directory, leaving the upgraded game without those files at their original paths.

Do: Carry non-generated and modified files into their corresponding active build paths, resolving collisions safely, instead of moving them away with the retired outputs.

**L3** (blocking): Replacing the entire builds directory removes additional and modified files from the active installation's paths. *When:* A player has a local mods or cache directory under builds/default. Upgrade moves it into the retired staging directory; cleanup then moves residuals to a randomly named preserved-files directory, leaving the upgraded game without those files at their original paths. **Do:** Carry non-generated and modified files into their corresponding active build paths, resolving collisions safely, instead of moving them away with the retired outputs.
@ -0,0 +167,4 @@
let _ = crate::preferences::refresh(&ui, &root);
}
}
if (previous.versions != now.versions || people_changed)
Member

L4 (should fix): A live rename reconnects the registry but does not reconnect existing Steam shortcuts.

When: While the launcher is open, a player renames an owned installation in the library. The watcher updates its registry row, but shortcut migration only runs during binding, so the Steam shortcut keeps pointing at the missing old path until the launcher is restarted.

Do: Retarget affected shortcuts after a successful live reconnection, with the same ownership and ambiguity checks used at startup.

**L4** (should fix): A live rename reconnects the registry but does not reconnect existing Steam shortcuts. *When:* While the launcher is open, a player renames an owned installation in the library. The watcher updates its registry row, but shortcut migration only runs during binding, so the Steam shortcut keeps pointing at the missing old path until the launcher is restarted. **Do:** Retarget affected shortcuts after a successful live reconnection, with the same ownership and ambiguity checks used at startup.
fix(launcher): carry runtime settings into upgraded builds
Some checks failed
CI / What the change needs (pull_request) Successful in 5s
PR title / Conventional Commit title (pull_request) Successful in 7s
CI / Lint (actionlint, ShellCheck, gitleaks) (pull_request) Successful in 9s
CI / Rust formatting, lint and tests (pull_request) Has been cancelled
CI / Release packages and stable upgrades (pull_request) Has been cancelled
422d298969
Author
Owner

Upgrades now carry settings and local reports into the matching build and remove obsolete cache. The regression fixture includes language, custom options, a pending report, an empty log directory and a stale prompt cache. It verifies that upgrading these creates no preserved-files directory and that a failed registration restores the original settings.

Upgrades now carry settings and local reports into the matching build and remove obsolete cache. The regression fixture includes language, custom options, a pending report, an empty log directory and a stale prompt cache. It verifies that upgrading these creates no preserved-files directory and that a failed registration restores the original settings.
fix(launcher): guard discovered upgrades and reconnect Steam entries
Some checks failed
CI / What the change needs (pull_request) Successful in 8s
CI / Lint (actionlint, ShellCheck, gitleaks) (pull_request) Successful in 14s
PR title / Conventional Commit title (pull_request) Successful in 5s
CI / Rust formatting, lint and tests (pull_request) Successful in 10m32s
CI / Release packages and stable upgrades (pull_request) Failing after 1h0m5s
26994f0017
Author
Owner

Pushed 26994f0017. L2 and L4 now have regression fixtures for unowned-copy handling before a build starts and direct shortcut repair after a live rename. L3 now carries build-local mods and protects unknown cache files. Generic collision handling for locally modified build outputs remains for the separate layout change. For L1, the Steam target remains the instance builder as requested. At nightly 857 its play command prepares the profile, checks for a stale build and starts the game. The shortcut now passes the configured cache, per-instance upscalers and --no-self-update. The separate launcher approval dialog and environment setup do not run on a direct builder launch. The fixture verifies the direct target, arguments, preserved app ID and profile isolation. L5 retail Steam launches with mods on Linux and Windows remain unverified. Local formatting, locked Clippy, 186 launcher tests, shared release checks and the desktop build passed.

Pushed 26994f0017f0. L2 and L4 now have regression fixtures for unowned-copy handling before a build starts and direct shortcut repair after a live rename. L3 now carries build-local mods and protects unknown cache files. Generic collision handling for locally modified build outputs remains for the separate layout change. For L1, the Steam target remains the instance builder as requested. At nightly 857 its play command prepares the profile, checks for a stale build and starts the game. The shortcut now passes the configured cache, per-instance upscalers and --no-self-update. The separate launcher approval dialog and environment setup do not run on a direct builder launch. The fixture verifies the direct target, arguments, preserved app ID and profile isolation. L5 retail Steam launches with mods on Linux and Windows remain unverified. Local formatting, locked Clippy, 186 launcher tests, shared release checks and the desktop build passed.
HumanBean deleted branch fix/installation-library 2026-11-28 00:14:10 +00:00
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!321
No description provided.