fix(launcher): protect saves and recover interrupted builds and folder moves #293

Merged
HumanBean merged 5 commits from HumanBean/LongshotLauncher:refactor/launcher-followup into main 2026-11-27 04:59:22 +00:00
Owner

The Rust launcher repeated the same confirmation setup across eight mod actions and kept diagnostic report state in the main game model. This follow-up to #284 gives both a single place to change.

  • Route mod reviews through one helper and pass dropped paths directly to the existing mod action.
  • Move the build report preview, consent checks and submission controls into a dedicated Slint global.
  • Notify the builder directly after a folder move and share the filesystem rename helper across portable setup, folder moves and mod imports.
  • Share the installed-version fixture across launcher tests and correct the Steam artwork instructions.

The changes preserve the existing mod approval prompts and report preview requirement. Formatting, all 15 translation catalogs, and the pinned Longshot compatibility checks passed locally. Rust lint, tests and release packaging are tracked by CI.

Save safety and recovery

Profile duplication now locks and recovers the source save before copying it. Slot transfers preserve a free slot number and stop when all six game slots are occupied. Destructive profile cleanup includes the actual backup directory and explains that it takes no final backup. Folder moves record the verified destination before publishing registry and preference changes so first start can finish an interrupted metadata update without deleting the original. Leftover move staging folders and parked originals appear as individual Storage rows for recovery.

Build and desktop behavior

A crashed Unix builder can leave compiler or shader workers holding its output pipes. The launcher detects the exit, stops remaining workers in its process group and drains the output. Library fetches respond to cancellation while waiting for the storage lock. The keep-awake inhibitor covers source builds, reuse and rebuilds, and its shutdown has a deadline. Game output now uses the launcher log directory. Update discovery can show other tracks when the main-branch lookup fails.

Translations and release notes

The UI catalog check now rejects missing source keys, including marked Rust model labels, and honors regional fallback. The new language entries are machine-assisted drafts awaiting native-speaker review.

On upgrade from 1.3.x, stable saves and loose mods are copied. Launcher preferences start fresh, including the language, update track, active profile and custom cache location. Set a custom cache drive before the first build. Save progress is read-only. The binary save editor and its contract fixtures were retired. The Hookshot game-settings import was retired. Individual Hookshot slots can be imported, and complete save ZIPs can include account and option files. The README and save guide document these changes.

Packaging downloads checksum-pinned toolchains and AppImage utilities. The update-handoff integration test downloads the previous launcher source and uses isolated Linux and Wine fixtures. The public trust-key files are compared in CI.

Verification

The Linux Rust suite passed 164 tests. The network-dependent signed downgrade test was run separately against published stable and also passed. The Windows release target passed the all-targets cross-check. Formatting, Clippy, pinned builder contracts and all 15 catalog checks passed. The pinned Tooling release suite passed 46 tests. Physical Windows, Steam Deck and controller runs remain pending.

The published Linux 1.3.1 AppImage was verified against its release digest and started in an isolated home. After stable closed, the PR executable opened that home without an install prompt, copied the test save and preserved the original save and preferences. This exercises first start after the executable swap. The signed updater and rollback have separate package tests.

The Rust launcher repeated the same confirmation setup across eight mod actions and kept diagnostic report state in the main game model. This follow-up to #284 gives both a single place to change. - Route mod reviews through one helper and pass dropped paths directly to the existing mod action. - Move the build report preview, consent checks and submission controls into a dedicated Slint global. - Notify the builder directly after a folder move and share the filesystem rename helper across portable setup, folder moves and mod imports. - Share the installed-version fixture across launcher tests and correct the Steam artwork instructions. The changes preserve the existing mod approval prompts and report preview requirement. Formatting, all 15 translation catalogs, and the pinned Longshot compatibility checks passed locally. Rust lint, tests and release packaging are tracked by CI. ## Save safety and recovery Profile duplication now locks and recovers the source save before copying it. Slot transfers preserve a free slot number and stop when all six game slots are occupied. Destructive profile cleanup includes the actual backup directory and explains that it takes no final backup. Folder moves record the verified destination before publishing registry and preference changes so first start can finish an interrupted metadata update without deleting the original. Leftover move staging folders and parked originals appear as individual Storage rows for recovery. ## Build and desktop behavior A crashed Unix builder can leave compiler or shader workers holding its output pipes. The launcher detects the exit, stops remaining workers in its process group and drains the output. Library fetches respond to cancellation while waiting for the storage lock. The keep-awake inhibitor covers source builds, reuse and rebuilds, and its shutdown has a deadline. Game output now uses the launcher log directory. Update discovery can show other tracks when the main-branch lookup fails. ## Translations and release notes The UI catalog check now rejects missing source keys, including marked Rust model labels, and honors regional fallback. The new language entries are machine-assisted drafts awaiting native-speaker review. On upgrade from 1.3.x, stable saves and loose mods are copied. Launcher preferences start fresh, including the language, update track, active profile and custom cache location. Set a custom cache drive before the first build. Save progress is read-only. The binary save editor and its contract fixtures were retired. The Hookshot game-settings import was retired. Individual Hookshot slots can be imported, and complete save ZIPs can include account and option files. The README and save guide document these changes. Packaging downloads checksum-pinned toolchains and AppImage utilities. The update-handoff integration test downloads the previous launcher source and uses isolated Linux and Wine fixtures. The public trust-key files are compared in CI. ## Verification The Linux Rust suite passed 164 tests. The network-dependent signed downgrade test was run separately against published stable and also passed. The Windows release target passed the all-targets cross-check. Formatting, Clippy, pinned builder contracts and all 15 catalog checks passed. The pinned Tooling release suite passed 46 tests. Physical Windows, Steam Deck and controller runs remain pending. The published Linux 1.3.1 AppImage was verified against its release digest and started in an isolated home. After stable closed, the PR executable opened that home without an install prompt, copied the test save and preserved the original save and preferences. This exercises first start after the executable swap. The signed updater and rollback have separate package tests.
refactor(launcher): simplify mod confirmations, build reports and version fixtures
Some checks failed
CI / What the change needs (pull_request) Successful in 20s
PR title / Conventional Commit title (pull_request) Successful in 24s
CI / Lint (actionlint, ShellCheck, gitleaks) (pull_request) Successful in 44s
CI / Rust formatting, lint and tests (pull_request) Has been cancelled
CI / Release packages and stable upgrades (pull_request) Has been cancelled
ef1ae3abd3
HumanBean force-pushed refactor/launcher-followup from ef1ae3abd3
Some checks failed
CI / What the change needs (pull_request) Successful in 20s
PR title / Conventional Commit title (pull_request) Successful in 24s
CI / Lint (actionlint, ShellCheck, gitleaks) (pull_request) Successful in 44s
CI / Rust formatting, lint and tests (pull_request) Has been cancelled
CI / Release packages and stable upgrades (pull_request) Has been cancelled
to b93692b0de
Some checks failed
CI / What the change needs (pull_request) Successful in 20s
CI / Lint (actionlint, ShellCheck, gitleaks) (pull_request) Successful in 52s
PR title / Conventional Commit title (pull_request) Successful in 26s
CI / Rust formatting, lint and tests (pull_request) Failing after 2m47s
CI / Release packages and stable upgrades (pull_request) Has been cancelled
2026-11-27 03:57:22 +00:00
Compare
fix(launcher): protect save transfers and recover interrupted builds and moves
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 13s
CI / Rust formatting, lint and tests (pull_request) Has been cancelled
CI / Release packages and stable upgrades (pull_request) Has been cancelled
59a891a51f
test(upgrade): open a home created by the published Linux launcher
Some checks failed
CI / What the change needs (pull_request) Successful in 5s
CI / Lint (actionlint, ShellCheck, gitleaks) (pull_request) Successful in 11s
PR title / Conventional Commit title (pull_request) Successful in 4s
CI / Rust formatting, lint and tests (pull_request) Has been cancelled
CI / Release packages and stable upgrades (pull_request) Has been cancelled
25de36e983
HumanBean changed title from WIP: refactor(launcher): simplify mod confirmations and build report handling to WIP: fix(launcher): protect saves and recover interrupted builds and folder moves 2026-11-27 04:41:55 +00:00
fix(storage): show recovery folders left by interrupted moves
Some checks failed
CI / What the change needs (pull_request) Successful in 4s
CI / Lint (actionlint, ShellCheck, gitleaks) (pull_request) Successful in 8s
PR title / Conventional Commit title (pull_request) Successful in 4s
CI / Rust formatting, lint and tests (pull_request) Successful in 9m37s
CI / Release packages and stable upgrades (pull_request) Has been cancelled
60045b8321
Author
Owner
@review
BeanBot left a comment

Recommendation: Request changes. An interruption during folder publication can leave shortcuts or the shared mod store pointing at the destination while the launcher continues to use the original folders. The pull request also combines several independent topics despite the repository’s one-topic rule.

The change consolidates launcher UI code and adds save and folder recovery, builder shutdown handling, translations, and upgrade documentation. The recovery work preserves original data, but its publication sequence still has an unrecoverable interruption window.

Blocking (1): must change before merging.

  1. L1 src/folders.rs:635: Persist recovery information before publishing shortcuts and mod-store links. (more on the line) Do: Journal the intended move and its publication state before the first externally visible change, and make startup complete or roll back each recorded step idempotently.

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

  • L2 src/game/process.rs:497: Returning after the deadline leaves the detached output-reader threads blocked when an escaped descendant keeps a pipe open indefinitely. (more on the line) Do: Use cancellable or nonblocking pipe readers and close or join them before returning from the timeout path.
  • L3: This pull request combines independent changes despite CONTRIBUTING.md requiring one topic per pull request. When: Folder and save recovery, translation catalog enforcement, release documentation, and mod confirmation refactoring each change separate workflows and cannot be reviewed or reverted as one focused change. Do: Split the independent topics into focused pull requests with their own descriptions and validation.

@fix can do L1, L2 and L3.

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 for interrupted folder moves: the reported Linux suite passed 164 tests, but the receipt is written after some externally visible changes, so it does not cover every interruption point. This is not a performance change.

Other systems: Folder moves affect Steam shortcuts, the shared mod store, installed-version registry, and profiles on Windows and Linux. The reported physical Windows and Steam Deck runs remain pending. Unix builder recovery also affects subprocesses and output-reader threads.

Switches: The CI environment variable is now required to be true by the two CI installation scripts; it defaults to unset and prevents accidental local package installation. No player-facing switch was added.

Reviewed: 60045b8321 against 5932797e8e: Read the repository rules, commit log, folder transaction and save-lock implementations, process runner, cleanup implementation, and the principal changed diffs. Skimmed the remaining diffs and did not read every changed code file in full or inspect every translation catalog; this review is therefore incomplete.; nothing run (a code review).

Checked and fine:

  • The reported CI failures contain no check failing only on this head; the Rust and release-package checks are still running.
  • The new save-duplication lock uses the same profile-level lock as save transfers.
  • The published-upgrade fixture writes synthetic save contents.

Testing: No commands from the project were run, as requested. The author reports the Linux Rust suite, cross-checks, catalog checks, and an isolated published-launcher upgrade run; physical Windows, Steam Deck, and controller runs remain pending.

Overlaps and merge order: Not checked; network access was unavailable.


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

**Recommendation: Request changes.** An interruption during folder publication can leave shortcuts or the shared mod store pointing at the destination while the launcher continues to use the original folders. The pull request also combines several independent topics despite the repository’s one-topic rule. The change consolidates launcher UI code and adds save and folder recovery, builder shutdown handling, translations, and upgrade documentation. The recovery work preserves original data, but its publication sequence still has an unrecoverable interruption window. **Blocking (1)**: must change before merging. 1. **L1** `src/folders.rs:635`: Persist recovery information before publishing shortcuts and mod-store links. (more on the line) **Do:** Journal the intended move and its publication state before the first externally visible change, and make startup complete or roll back each recorded step idempotently. **Should fix (2)**: not blocking, but worth doing before merging. - **L2** `src/game/process.rs:497`: Returning after the deadline leaves the detached output-reader threads blocked when an escaped descendant keeps a pipe open indefinitely. (more on the line) **Do:** Use cancellable or nonblocking pipe readers and close or join them before returning from the timeout path. - **L3**: This pull request combines independent changes despite CONTRIBUTING.md requiring one topic per pull request. *When:* Folder and save recovery, translation catalog enforcement, release documentation, and mod confirmation refactoring each change separate workflows and cannot be reviewed or reverted as one focused change. **Do:** Split the independent topics into focused pull requests with their own descriptions and validation. `@fix` can do L1, L2 and L3. **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 for interrupted folder moves: the reported Linux suite passed 164 tests, but the receipt is written after some externally visible changes, so it does not cover every interruption point. This is not a performance change. **Other systems:** Folder moves affect Steam shortcuts, the shared mod store, installed-version registry, and profiles on Windows and Linux. The reported physical Windows and Steam Deck runs remain pending. Unix builder recovery also affects subprocesses and output-reader threads. **Switches:** The CI environment variable is now required to be true by the two CI installation scripts; it defaults to unset and prevents accidental local package installation. No player-facing switch was added. **Reviewed:** 60045b8321de against 5932797e8e94: Read the repository rules, commit log, folder transaction and save-lock implementations, process runner, cleanup implementation, and the principal changed diffs. Skimmed the remaining diffs and did not read every changed code file in full or inspect every translation catalog; this review is therefore incomplete.; nothing run (a code review). **Checked and fine:** - The reported CI failures contain no check failing only on this head; the Rust and release-package checks are still running. - The new save-duplication lock uses the same profile-level lock as save transfers. - The published-upgrade fixture writes synthetic save contents. **Testing:** No commands from the project were run, as requested. The author reports the Linux Rust suite, cross-checks, catalog checks, and an isolated published-launcher upgrade run; physical Windows, Steam Deck, and controller runs remain pending. **Overlaps and merge order:** Not checked; network access was unavailable. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
src/folders.rs Outdated
@ -556,41 +635,75 @@ impl Change {
attempted += 1;
Member

L1 (blocking): Persist recovery information before publishing shortcuts and mod-store links. Those changes currently happen before the receipt exists.

When: If the launcher exits after a data move repoints a cache’s mod-store link but before the receipt is written, startup finds no pending move and retains the old data-folder setting. The builder then uses a mod store at the new location while profiles and launcher settings still refer to the old location; a retry can also be blocked by the already-published destination.

Do: Journal the intended move and its publication state before the first externally visible change, and make startup complete or roll back each recorded step idempotently.

**L1** (blocking): Persist recovery information before publishing shortcuts and mod-store links. Those changes currently happen before the receipt exists. *When:* If the launcher exits after a data move repoints a cache’s mod-store link but before the receipt is written, startup finds no pending move and retains the old data-folder setting. The builder then uses a mod store at the new location while profiles and launcher settings still refer to the old location; a retry can also be blocked by the already-published destination. **Do:** Journal the intended move and its publication state before the first externally visible change, and make startup complete or roll back each recorded step idempotently.
@ -421,0 +494,4 @@
tree_stopped = true;
} else if tree_stopped && elapsed >= Duration::from_secs(3) {
// An escaped descendant may keep a descriptor open indefinitely.
return Ok(Answer {
Member

L2 (should fix): Returning after the deadline leaves the detached output-reader threads blocked when an escaped descendant keeps a pipe open indefinitely.

When: A builder starts a descendant in another process group that inherits stdout or stderr and stays alive. The runner returns after three seconds, but the corresponding thread remains blocked in read_lines for the lifetime of that descendant; repeated operations can accumulate threads and file descriptors.

Do: Use cancellable or nonblocking pipe readers and close or join them before returning from the timeout path.

**L2** (should fix): Returning after the deadline leaves the detached output-reader threads blocked when an escaped descendant keeps a pipe open indefinitely. *When:* A builder starts a descendant in another process group that inherits stdout or stderr and stays alive. The runner returns after three seconds, but the corresponding thread remains blocked in read_lines for the lifetime of that descendant; repeated operations can accumulate threads and file descriptors. **Do:** Use cancellable or nonblocking pipe readers and close or join them before returning from the timeout path.
fix(launcher): journal folder publication and stop orphaned pipe readers
Some checks failed
CI / What the change needs (pull_request) Successful in 5s
CI / Lint (actionlint, ShellCheck, gitleaks) (pull_request) Successful in 9s
PR title / Conventional Commit title (pull_request) Successful in 5s
CI / Rust formatting, lint and tests (pull_request) Successful in 10m31s
CI / Release packages and stable upgrades (pull_request) Failing after 1h0m6s
aa93e844b0
HumanBean changed title from WIP: fix(launcher): protect saves and recover interrupted builds and folder moves to fix(launcher): protect saves and recover interrupted builds and folder moves 2026-11-27 04:59:06 +00:00
HumanBean deleted branch refactor/launcher-followup 2026-11-27 04:59:23 +00:00
Author
Owner

Addressed both code findings in aa93e844b09e.

  • Folder moves. The launcher now writes the recovery journal before publishing the first staged directory. On restart it verifies the copies, finishes version ownership records, Steam shortcuts and mod-store links, then commits the registry and folder preference. Recovery keeps the originals. A regression test interrupts publication at four points and runs recovery twice.
  • Unix builder output. The runner now stops and joins both pipe readers on exit, including when a surviving worker holds a pipe open. The regression test keeps a writer alive and verifies that writing to either pipe fails after the readers close.
  • PR scope. At the maintainer’s request, #293 stays together as the follow-up to #284 so the fixes and their review history remain in one place.

Local checks passed for 11 folder tests, the live-writer regression and all 46 Tooling tests. The full local Rust check was interrupted. Forge is running the Rust and release-package checks on the pushed commit.

Addressed both code findings in `aa93e844b09e`. - **Folder moves.** The launcher now writes the recovery journal before publishing the first staged directory. On restart it verifies the copies, finishes version ownership records, Steam shortcuts and mod-store links, then commits the registry and folder preference. Recovery keeps the originals. A regression test interrupts publication at four points and runs recovery twice. - **Unix builder output.** The runner now stops and joins both pipe readers on exit, including when a surviving worker holds a pipe open. The regression test keeps a writer alive and verifies that writing to either pipe fails after the readers close. - **PR scope.** At the maintainer’s request, #293 stays together as the follow-up to #284 so the fixes and their review history remain in one place. Local checks passed for 11 folder tests, the live-writer regression and all 46 Tooling tests. The full local Rust check was interrupted. Forge is running the Rust and release-package checks on the pushed commit.
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!293
No description provided.