WIP: feat(tools): a builder that owns its build tools gets them itself; install from an offline builder #257

Closed
HumanBean wants to merge 4 commits from HumanBean/LongshotLauncher:feat/builder-owns-tools into main
Owner

Summary

The Launcher side of Longshot's #2295, where the builder
now owns its build tools
. Up to now the Launcher installed every tools.lock tool itself and rebuilt the builder's
environment by hand, so each tool change needed a matching Launcher change. Now:

  • The path choice (Core/BuilderTools.cs): a builder with builder.json ({"tools": "builder", "protocol": 1})
    beside its tools.lock owns its tools.
    • The Launcher installs only the builder: the Windows zip, or the extracted AppImage.
    • It runs make_game.py --tools-only with LONGSHOT_TOOLS_STORE=<home>/tools, a store shared by every version. Its
      @@stage, @@progress and lines drive the wizard's bar.
    • It records make_game.py --stamps in toolchain.json.
    • Every older release goes the old way, unchanged.
  • Builds and checks of such a version get no tool variable, neither the PC's nor the Launcher's, only the store
    (Core/MakeGameCommand.cs).
  • Shader caches of such a version are keyed by its compiler and translator stamps (Core/ShaderCaches.cs). An old
    version and a new one never share a key, so the first update across the change prepares the programs once more.
  • Pruning runs the newest such builder's tools_store.py gc --keep <each installed version's tools.lock>.
  • Install from an offline builder… (the home screen, beside "Add a build folder…"):
    • It takes LongshotBuilder-<v>-windows-x64-offline.zip or Longshot-<v>-offline-x86_64.AppImage, with the
      release's SHA256SUMS and SHA256SUMS.sig beside it.
    • Core/OfflineBuilder.cs checks the signature against the Launcher's release keys, then the file's SHA-256 against the
      signed list, which also gives the version.
    • It then installs it as above. Its tools are carried inside it, so nothing is downloaded.
  • For older releases (llvm): a Linux version with usr/lib/longshot/llvm is given LONGSHOT_LLVM; one with emsdk
    still gets EMSDK.

Replaces #256.

Read first: Core/BuilderTools.cs, Core/Toolchains.cs (Prepare, CollectStoreAsync, the two path choices),
Core/MakeGameCommand.cs, Core/OfflineBuilder.cs.

Testing

Tested: dotnet build LongshotLauncher.slnx (0 warnings) and the core checks compiled, on Linux (CachyOS). Not run:
no checks run on this PC (the maintainer's rule), and the app hasn't been started. Longshot's side ran on this PC: the
tools stage installs into an empty store and finds them with no connection the second time, and the offline AppImage's
--tools-only downloads nothing.

Still to test:

  • Linux, by hand, once #2295's first nightly exists:
    • install it with a new store, expecting the tools stage's progress on the wizard's bar, and the build to play;
    • an update to the next nightly, expecting nothing downloaded and the shader caches kept;
    • an older release still installing the old way.
  • Windows, by hand: the same.
  • Both systems, by hand: install from an offline builder with the network off, expecting no download and a build that
    plays.

Risks

  • The first update from an older version to one that owns its tools prepares the shader programs once more.
  • Tools an older install already downloaded are not reused by the new store. Each is downloaded once more, then
    shared by every later version.
  • The new texts are in English until translated.
  • A revert is enough: older releases go the old way regardless.

🤖 Generated with Claude Code

## Summary The Launcher side of Longshot's [#2295](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2295), where **the builder now owns its build tools**. Up to now the Launcher installed every `tools.lock` tool itself and rebuilt the builder's environment by hand, so each tool change needed a matching Launcher change. Now: - **The path choice** (`Core/BuilderTools.cs`): a builder with `builder.json` (`{"tools": "builder", "protocol": 1}`) beside its `tools.lock` owns its tools. - The Launcher installs only the builder: the Windows zip, or the extracted AppImage. - It runs `make_game.py --tools-only` with `LONGSHOT_TOOLS_STORE=<home>/tools`, a store shared by every version. Its `@@stage`, `@@progress` and lines drive the wizard's bar. - It records `make_game.py --stamps` in `toolchain.json`. - Every older release goes the old way, unchanged. - **Builds and checks** of such a version get no tool variable, neither the PC's nor the Launcher's, only the store (`Core/MakeGameCommand.cs`). - **Shader caches** of such a version are keyed by its compiler and translator stamps (`Core/ShaderCaches.cs`). An old version and a new one never share a key, so the first update across the change prepares the programs once more. - **Pruning** runs the newest such builder's `tools_store.py gc --keep <each installed version's tools.lock>`. - **Install from an offline builder…** (the home screen, beside "Add a build folder…"): - It takes `LongshotBuilder-<v>-windows-x64-offline.zip` or `Longshot-<v>-offline-x86_64.AppImage`, with the release's `SHA256SUMS` and `SHA256SUMS.sig` beside it. - `Core/OfflineBuilder.cs` checks the signature against the Launcher's release keys, then the file's SHA-256 against the signed list, which also gives the version. - It then installs it as above. Its tools are carried inside it, so nothing is downloaded. - **For older releases** (llvm): a Linux version with `usr/lib/longshot/llvm` is given `LONGSHOT_LLVM`; one with emsdk still gets `EMSDK`. Replaces [#256](https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/256). Read first: `Core/BuilderTools.cs`, `Core/Toolchains.cs` (`Prepare`, `CollectStoreAsync`, the two path choices), `Core/MakeGameCommand.cs`, `Core/OfflineBuilder.cs`. ## Testing **Tested:** `dotnet build LongshotLauncher.slnx` (0 warnings) and the core checks compiled, on Linux (CachyOS). Not run: no checks run on this PC (the maintainer's rule), and the app hasn't been started. Longshot's side ran on this PC: the tools stage installs into an empty store and finds them with no connection the second time, and the offline AppImage's `--tools-only` downloads nothing. **Still to test:** - Linux, by hand, once #2295's first nightly exists: - install it with a new store, expecting the tools stage's progress on the wizard's bar, and the build to play; - an update to the next nightly, expecting nothing downloaded and the shader caches kept; - an older release still installing the old way. - Windows, by hand: the same. - Both systems, by hand: install from an offline builder with the network off, expecting no download and a build that plays. ## Risks - The first update from an older version to one that owns its tools prepares the shader programs once more. - Tools an older install already downloaded are not reused by the new store. Each is downloaded once more, then shared by every later version. - The new texts are in English until translated. - A revert is enough: older releases go the old way regardless. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Longshot's Linux compiler tool is now llvm (usr/lib/longshot/llvm, an LLVM
release's layout), read from LONGSHOT_LLVM; released versions keep emsdk.
MakeGameCommand gives the build whichever the version has and takes the
other out. ShaderCaches keys a version with llvm on it (LinuxCompiler) and
one with emsdk as before (LinuxEmsdkCompiler), so older versions keep
sharing their caches; the --longshot contract check takes either list.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(versions): install a version from a release's offline builder, with nothing downloaded
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 6s
6600cde55a
A PC with no connection could not install Longshot: each release now has an
offline builder with every build tool inside, and the launcher imports it.
Home's Install from an offline builder... picks the file; the release's
SHA256SUMS and SHA256SUMS.sig must be beside it. The list's signature is
checked with the launcher's keys and the file's SHA-256 must be the one the
list gives an offline builder's name for this system, which names the
version (Core/OfflineBuilder.cs). The wizard then installs that version as a
download would (ToolsSource, Toolchains), each part read from the file and
checked again: Windows, the zip without its tools/ and each tool from its
tools/<sha256>.zip against the tools.lock inside the checked zip; Linux, the
AppImage copied and checked, unpacked with the tools it carries, which are
recorded as their tools.lock parts for reuse and the shader caches' key.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(tools): a builder that owns its build tools gets them itself; the launcher installs only the builder
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
7ae3df4cd8
Longshot's builders now find or install their own build tools (make_game.py's
tools stage, scripts/tools_store.py) and say so in builder.json. After
unpacking a builder the launcher reads it (Core/BuilderTools.cs): with
{"tools": "builder", "protocol": 1} it installs no tools.lock part, runs
make_game.py --tools-only with LONGSHOT_TOOLS_STORE=<home>/tools before the
version counts as installed (its lines on the wizard's bar), keeps
make_game.py --stamps in toolchain.json for the shader caches' key, gives
builds the store and no tool variable, and has the store collected by the
newest such builder's tools_store.py gc after pruning. A builder without it,
every release before, is installed exactly as before. A pull request over
such a nightly may bring its own tools.lock; its tools stage and stamps run
again. Offline builders now carry their tools at their dests and are
installed as such a builder; the tools/<sha256>.zip handling is gone. The
store counts with the builders in Storage.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner
@review
BeanBot left a comment

Recommendation: Request changes. A pull request’s builder can be recorded as installed before its tools are ready, and choosing an offline builder can still join an online download. The new installation paths also need end-to-end runs on both supported platforms.

The launcher delegates tool installation to compatible builders, shares their tools, and adds an offline-builder import. This removes launcher-specific tool installation work, but adds a preparation lifecycle and a second source for installs that need stronger coordination.

Blocking (1): must change before merging.

  1. L2 App/LauncherService.cs:204: Registering the selected offline builder does not replace a prefetch already running for that version. (more on the line) Do: Cancel and replace the matching online prefetch when an offline builder is selected, and wait for its staging cleanup before starting the offline install.

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

  • L1 Core/PullRequestSource.cs:50: The pull request is published as an installed toolchain before its tools stage finishes. (more on the line) Do: Keep the mirrored pull request in staging until preparation and record writing succeed, then publish it atomically.
  • L3 App/ViewModels/HomeViewModel.cs:762: Checking an offline builder leaves the other build commands enabled, and its completion unconditionally opens another wizard. (more on the line) Do: Include the import in the shared build-start busy state, or discard its completion if the player has navigated to another workflow.
  • L4: The pull request changes the home screen but does not include a screenshot. When: Reviewers cannot see the placement and presentation of the new import action from the description, as the repository requests for visible changes. Do: Add a screenshot showing the new home-screen action.

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

  • L5: The Windows installation and build paths have not been exercised with a real compatible release. When: The new Windows path runs the packaged Python and relies on the builder’s tool and stamp protocol; the checks substitute a fake runner, so a packaging or protocol mismatch would prevent installation or building. Do: On Windows, install a compatible nightly with an empty store, build and play, update to a second nightly, install an older release, and repeat with the offline builder and network disabled.
  • L6: The Linux launcher installation and build paths have not been exercised end to end. When: The reported Linux runs exercised Longshot’s tools stage directly, not the launcher’s extraction, environment, cache reuse, offline import, and subsequent playable build. Do: On Linux, install a compatible nightly with an empty store, build and play, update to a second nightly, install an older release, and repeat with the offline AppImage and network disabled.

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

Questions (1) (not confirmed from the code; they don't hold the recommendation)

  • Will the matching changes to the shared docs/releases.md and RELEASING.md be merged in Longshot as required by the repository rules?
More: does it help, other systems, switches, what was read

Does it help: Unproven. The description reports a successful Linux builder tools stage and offline AppImage tools stage, but no launcher install or playable build was run on either platform.

Other systems: The change affects Windows and Linux installations, pull-request builds, shader-cache reuse, pruning, and offline builds. The new core checks use simulated builders; they do not demonstrate those paths with released builders or a playable game.

Switches: LONGSHOT_TOOLS_STORE is newly set to /tools for compatible builders and builds. Tool-specific environment variables are removed for those builders; Linux legacy builds now select LONGSHOT_LLVM when the llvm directory exists, otherwise EMSDK. The store default is consistent with the intended shared installation, but its behavior with real builders remains unverified.

Reviewed: 7ae3df4cd8 against 6887d57c4f: Read the repository rules and commit messages, the changed core installation paths, the new builder and offline checks, and the diff. Read relevant portions of the surrounding launcher, prefetch, command, release and cache code; the larger changed app and test files were skimmed rather than read in full. No review checklist or pull-request template was present at the named paths.; nothing run (a code review).

Checked and fine:

  • The commits include AI co-author trailers.
  • The offline import verifies the signed checksum list and checks the file again during installation.
  • The new test fixtures use authored stand-ins rather than game-derived files.

Testing: No commands from the project or tests were run, as requested. The pull request reports a Linux solution build and direct Longshot tools-stage checks.

Overlaps and merge order: Longshot #2295 supplies the builder protocol and offline packages; its compatible release needs to be available before end-to-end validation.


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

**Recommendation: Request changes.** A pull request’s builder can be recorded as installed before its tools are ready, and choosing an offline builder can still join an online download. The new installation paths also need end-to-end runs on both supported platforms. The launcher delegates tool installation to compatible builders, shares their tools, and adds an offline-builder import. This removes launcher-specific tool installation work, but adds a preparation lifecycle and a second source for installs that need stronger coordination. **Blocking (1)**: must change before merging. 1. **L2** `App/LauncherService.cs:204`: Registering the selected offline builder does not replace a prefetch already running for that version. (more on the line) **Do:** Cancel and replace the matching online prefetch when an offline builder is selected, and wait for its staging cleanup before starting the offline install. **Should fix (3)**: not blocking, but worth doing before merging. - **L1** `Core/PullRequestSource.cs:50`: The pull request is published as an installed toolchain before its tools stage finishes. (more on the line) **Do:** Keep the mirrored pull request in staging until preparation and record writing succeed, then publish it atomically. - **L3** `App/ViewModels/HomeViewModel.cs:762`: Checking an offline builder leaves the other build commands enabled, and its completion unconditionally opens another wizard. (more on the line) **Do:** Include the import in the shared build-start busy state, or discard its completion if the player has navigated to another workflow. - **L4**: The pull request changes the home screen but does not include a screenshot. *When:* Reviewers cannot see the placement and presentation of the new import action from the description, as the repository requests for visible changes. **Do:** Add a screenshot showing the new home-screen action. **Testing before merging (2)** (runs on the systems it can change; it doesn't hold the recommendation) - **L5**: The Windows installation and build paths have not been exercised with a real compatible release. *When:* The new Windows path runs the packaged Python and relies on the builder’s tool and stamp protocol; the checks substitute a fake runner, so a packaging or protocol mismatch would prevent installation or building. **Do:** On Windows, install a compatible nightly with an empty store, build and play, update to a second nightly, install an older release, and repeat with the offline builder and network disabled. - **L6**: The Linux launcher installation and build paths have not been exercised end to end. *When:* The reported Linux runs exercised Longshot’s tools stage directly, not the launcher’s extraction, environment, cache reuse, offline import, and subsequent playable build. **Do:** On Linux, install a compatible nightly with an empty store, build and play, update to a second nightly, install an older release, and repeat with the offline AppImage and network disabled. `@fix` can do L1, L2, L3 and L4. **Questions (1)** (not confirmed from the code; they don't hold the recommendation) - Will the matching changes to the shared docs/releases.md and RELEASING.md be merged in Longshot as required by the repository rules? <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven. The description reports a successful Linux builder tools stage and offline AppImage tools stage, but no launcher install or playable build was run on either platform. **Other systems:** The change affects Windows and Linux installations, pull-request builds, shader-cache reuse, pruning, and offline builds. The new core checks use simulated builders; they do not demonstrate those paths with released builders or a playable game. **Switches:** LONGSHOT_TOOLS_STORE is newly set to <launcher home>/tools for compatible builders and builds. Tool-specific environment variables are removed for those builders; Linux legacy builds now select LONGSHOT_LLVM when the llvm directory exists, otherwise EMSDK. The store default is consistent with the intended shared installation, but its behavior with real builders remains unverified. **Reviewed:** 7ae3df4cd846 against 6887d57c4f11: Read the repository rules and commit messages, the changed core installation paths, the new builder and offline checks, and the diff. Read relevant portions of the surrounding launcher, prefetch, command, release and cache code; the larger changed app and test files were skimmed rather than read in full. No review checklist or pull-request template was present at the named paths.; nothing run (a code review). **Checked and fine:** - The commits include AI co-author trailers. - The offline import verifies the signed checksum list and checks the file again during installation. - The new test fixtures use authored stand-ins rather than game-derived files. **Testing:** No commands from the project or tests were run, as requested. The pull request reports a Linux solution build and direct Longshot tools-stage checks. **Overlaps and merge order:** Longshot #2295 supplies the builder protocol and offline packages; its compatible release needs to be available before end-to-end validation. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -194,0 +201,4 @@
public async Task<OfflineBuilder> ImportOfflineAsync(string file, CancellationToken cancel = default)
{
var builder = await Task.Run(() => OfflineBuilder.OpenAsync(file, Platform, ReleaseKeys.Current(), cancel), cancel).ConfigureAwait(false);
offline[builder.Tag] = builder;
Member

L2 (blocking): Registering the selected offline builder does not replace a prefetch already running for that version.

When: If the automatic online prefetch for the same tag is still running when the player selects the offline file, the wizard joins that existing fetch. It continues using the online source and can fail when the connection is unavailable, despite the verified offline builder being present.

Do: Cancel and replace the matching online prefetch when an offline builder is selected, and wait for its staging cleanup before starting the offline install.

**L2** (blocking): Registering the selected offline builder does not replace a prefetch already running for that version. *When:* If the automatic online prefetch for the same tag is still running when the player selects the offline file, the wizard joins that existing fetch. It continues using the online source and can fail when the connection is unavailable, despite the verified offline builder being present. **Do:** Cancel and replace the matching online prefetch when an offline builder is selected, and wait for its staging cleanup before starting the offline install.
@ -746,0 +759,4 @@
if (await host.PickFileAsync(Tr.F("The offline builder, {0} (with SHA256SUMS and SHA256SUMS.sig beside it)",
OfflineBuilder.FileName("<version>", Service.Platform)),
windows ? new[] { "*.zip" } : new[] { "*.AppImage" }) is not { } picked) return;
importingOffline = true;
Member

L3 (should fix): Checking an offline builder leaves the other build commands enabled, and its completion unconditionally opens another wizard.

When: While a large builder is being hashed, a player can start a different build; when hashing finishes, StartWizard navigates away from that wizard and replaces it.

Do: Include the import in the shared build-start busy state, or discard its completion if the player has navigated to another workflow.

**L3** (should fix): Checking an offline builder leaves the other build commands enabled, and its completion unconditionally opens another wizard. *When:* While a large builder is being hashed, a player can start a different build; when hashing finishes, StartWizard navigates away from that wizard and replaces it. **Do:** Include the import in the shared build-start busy state, or discard its completion if the player has navigated to another workflow.
@ -48,6 +48,21 @@ public static class PullRequestSource
var archive = await ReleaseManifest.FetchUncheckedAsync(chains.Fetcher, ArchiveUrl(pr.Head), MaxArchive, cancel).ConfigureAwait(false);
var files = Files(archive, pr.Head);
var made = await Task.Run(() => chains.InstallPullRequest(tag, tools, files, releases.Platform, cancel), cancel).ConfigureAwait(false);
Member

L1 (should fix): The pull request is published as an installed toolchain before its tools stage finishes.

When: If the launcher or PC stops after InstallPullRequest moves the folder into place but before PrepareAsync finishes, the catch cannot remove it. On the next attempt Find accepts its toolchain.json and skips preparation, so a build can need downloads unexpectedly and the recorded shader stamps remain absent.

Do: Keep the mirrored pull request in staging until preparation and record writing succeed, then publish it atomically.

**L1** (should fix): The pull request is published as an installed toolchain before its tools stage finishes. *When:* If the launcher or PC stops after InstallPullRequest moves the folder into place but before PrepareAsync finishes, the catch cannot remove it. On the next attempt Find accepts its toolchain.json and skips preparation, so a build can need downloads unexpectedly and the recorded shader stamps remain absent. **Do:** Keep the mirrored pull request in staging until preparation and record writing succeed, then publish it atomically.
Author
Owner

Thanks. Fixed in 573ba98a:

  • L2 Core/ToolsPrefetch.cs StopAsync, App/LauncherService.cs ImportOfflineAsync: picking an offline builder cancels that version's running online fetch and waits for its staging cleanup. The next fetch installs from the file.
  • L1 Core/Toolchains.cs InstallPullRequestAsync: a pull request's builder runs --tools-only and --stamps in its staging folder, before toolchain.json is written and the folder is moved into place. A failure or a stop leaves nothing installed.
  • L3 App/ViewModels/HomeViewModel.cs: the import is part of CanStartBuild's busy state. If the player has left Home by the time it finishes, a notice says so and no wizard opens.
  • L4: no screenshot yet. The app hasn't been started on this PC; it comes with the hand tests in Testing.

Checks: tests/launcher_core/BuilderToolsChecks.cs (L1, L2) and tests/launcher_app/Program.cs (L3), compiled, not run here. The "player moved on" branch has no deterministic check: the hash finishes before a check could navigate away.

Thanks. Fixed in 573ba98a: - **L2** `Core/ToolsPrefetch.cs` `StopAsync`, `App/LauncherService.cs` `ImportOfflineAsync`: picking an offline builder cancels that version's running online fetch and waits for its staging cleanup. The next fetch installs from the file. - **L1** `Core/Toolchains.cs` `InstallPullRequestAsync`: a pull request's builder runs `--tools-only` and `--stamps` in its staging folder, before `toolchain.json` is written and the folder is moved into place. A failure or a stop leaves nothing installed. - **L3** `App/ViewModels/HomeViewModel.cs`: the import is part of `CanStartBuild`'s busy state. If the player has left Home by the time it finishes, a notice says so and no wizard opens. - **L4**: no screenshot yet. The app hasn't been started on this PC; it comes with the hand tests in Testing. Checks: `tests/launcher_core/BuilderToolsChecks.cs` (L1, L2) and `tests/launcher_app/Program.cs` (L3), compiled, not run here. The "player moved on" branch has no deterministic check: the hash finishes before a check could navigate away.
fix(tools): an offline pick stops the same version's download; a pull request is made ready before it is installed; the import holds every build's start
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 3s
573ba98ada
Picking an offline builder while the update check's prefetch downloads the
same version joined that download: ToolsPrefetch.StopAsync stops it and waits
for its staging cleanup, so the wizard's fetch installs from the file.
A pull request over a nightly that owns its tools was moved into place before
its tools stage and stamps ran, so a stop in between left it looking
installed: InstallPullRequestAsync runs them in its staging folder first.
While the offline file is checked, CanStartBuild is off for every build's
start, and a player who left Home meanwhile gets a toast, not a wizard.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

Superseded by #259, the launcher's side of Longshot #2286: longshot-builder installs its own tools, so the launcher no longer does. Closing in its favour.

Superseded by [#259](https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/259), the launcher's side of [Longshot #2286](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2286): longshot-builder installs its own tools, so the launcher no longer does. Closing in its favour.
HumanBean closed this pull request 2026-11-24 03:11:39 +00:00
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 3s

Pull request closed

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!257
No description provided.