feat(build): a completely cold build, for a build that keeps failing #179

Merged
HumanBean merged 1 commit from dyst/LongshotLauncher:feat/cold-build into main 2026-11-17 21:12:59 +00:00
Member

Players whose build keeps failing, or whose game misbehaves after a build, had no way to rule out something left over from an earlier build. A completely cold build starts from nothing earlier builds kept.

Builds on #178 (Free up space says what it deletes), now merged; it reuses its deletion code.

What changed

  • Step 2's Advanced has a "Completely cold build" switch, for that build only (BuildJob.Cold). It works for a first build, a rebuild, an update or going back.

    • It says what it deletes and what it costs: as long as a first build, and switching to other versions is slower afterwards.
    • When it's on, the closed Advanced row says so.
  • The problem page after a failed build offers Try a completely cold build (unless the build was already cold). It opens step 2 with the switch on and Advanced open, so the player reads what it deletes before starting.

  • Before make_game.py starts, a cold build (ColdBuild.Clear):

    • deletes the build files and both stores, reusing #178's code;
    • deletes the build folder's shader caches, including their pipeline notes (make_game.py writes the notes again);
    • takes no caches from the build it replaces (Seed says so in the log);
    • takes no game files from another build (LONGSHOT_ROMFS_FROM not set), so the .nup is read again.

    The build page shows "Deleting what earlier builds kept" on its first row meanwhile, and the log says how much went.

  • Never while Longshot runs. Step 2 refuses with a toast. If the game starts in between, the build stops on the problem page and nothing is deleted.

  • Saves, settings and mods are never touched.

  • The bug report's settings line ends with , cold build. It's fixed text, no free text. I put it there rather than in the report's kind, which says what was built (first build, update, go back, rebuild), not how.

  • README describes it.

Screenshots

New scenes build-failed and settings-cold in tools/screenshots: attached in the first comment. Before and after, against main: #179 (comment)

Tested

  • python -I tests/test_launcher_core.py: 1543 checks passed. New checks: a cold build deletes nothing while Longshot runs; otherwise it deletes the build files, stores, caches and notes and keeps the player's own files in both folders.
  • python -I tests/test_release.py: 37 tests OK.
  • dotnet build App -c Release: 0 warnings, 0 errors.
  • Not run as a real build: there's no game dump on this PC, so no cold build ran end to end. The screens were drawn with the screenshot tool.

Not done

  • Translations: the new texts are English only. The catalogs already lack texts on main, and the check only lists them.
  • Rest of the game folder: a cold build doesn't delete the game folder's other files. make_game.py writes the game over them as in any rebuild, and on Windows the folder can hold saves.
  • mise run ci:smoke: mise isn't installed on this PC.
Players whose build keeps failing, or whose game misbehaves after a build, had no way to rule out something left over from an earlier build. A completely cold build starts from nothing earlier builds kept. Builds on #178 (Free up space says what it deletes), now merged; it reuses its deletion code. ## What changed - **Step 2's Advanced has a "Completely cold build" switch**, for that build only (`BuildJob.Cold`). It works for a first build, a rebuild, an update or going back. - It says what it deletes and what it costs: as long as a first build, and switching to other versions is slower afterwards. - When it's on, the closed Advanced row says so. - **The problem page after a failed build** offers *Try a completely cold build* (unless the build was already cold). It opens step 2 with the switch on and Advanced open, so the player reads what it deletes before starting. - **Before make_game.py starts**, a cold build (`ColdBuild.Clear`): - deletes the build files and both stores, reusing #178's code; - deletes the build folder's shader caches, including their pipeline notes (make_game.py writes the notes again); - takes no caches from the build it replaces (`Seed` says so in the log); - takes no game files from another build (`LONGSHOT_ROMFS_FROM` not set), so the .nup is read again. The build page shows "Deleting what earlier builds kept" on its first row meanwhile, and the log says how much went. - **Never while Longshot runs.** Step 2 refuses with a toast. If the game starts in between, the build stops on the problem page and nothing is deleted. - Saves, settings and mods are never touched. - **The bug report's settings line ends with `, cold build`.** It's fixed text, no free text. I put it there rather than in the report's `kind`, which says what was built (first build, update, go back, rebuild), not how. - README describes it. ## Screenshots New scenes `build-failed` and `settings-cold` in `tools/screenshots`: attached in the first comment. Before and after, against `main`: https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/179#issuecomment-43539 ## Tested - `python -I tests/test_launcher_core.py`: 1543 checks passed. New checks: a cold build deletes nothing while Longshot runs; otherwise it deletes the build files, stores, caches and notes and keeps the player's own files in both folders. - `python -I tests/test_release.py`: 37 tests OK. - `dotnet build App -c Release`: 0 warnings, 0 errors. - **Not run as a real build:** there's no game dump on this PC, so no cold build ran end to end. The screens were drawn with the screenshot tool. ## Not done - **Translations:** the new texts are English only. The catalogs already lack texts on `main`, and the check only lists them. - **Rest of the game folder:** a cold build doesn't delete the game folder's other files. make_game.py writes the game over them as in any rebuild, and on Windows the folder can hold saves. - **`mise run ci:smoke`:** mise isn't installed on this PC.
feat(settings): Free up space says what it deletes, and can clear shader caches
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 5s
6e38c4136c
Free up space now asks first: each part of the build files folder in plain
words, with its size and what it was kept for, and what the next build costs.
An unticked option also clears every version's shader caches (never the
shipped pipeline list, never while Longshot runs). The settings say what is
kept and why.

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(build): a completely cold build, for a build that keeps failing
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 8s
639fc820a5
Step 2's Advanced gets a completely cold build, for that build only, and the
problem page after a failed build offers it (Try a completely cold build opens
step 2 with it ticked). Before make_game.py starts it deletes the build files,
both stores and the build's shader caches with their pipeline notes; it takes
no caches from the build it replaces and no game files from another build.
Never while Longshot runs. The bug report's settings line says cold build.

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Member

Screenshots (tools/screenshots: build-failed, settings-cold): the problem page offering a completely cold build, and step 2's Advanced with it on.

build-failed.png

settings-cold.png

Screenshots (tools/screenshots: build-failed, settings-cold): the problem page offering a completely cold build, and step 2's Advanced with it on. ![build-failed.png](https://git.magicbean.dev/attachments/c184dc99-9bb0-42dd-aec4-8ef309346017) ![settings-cold.png](https://git.magicbean.dev/attachments/d60539fb-210e-4f04-9db8-af91ce363a85)
Collaborator

Possibly related, for context:

  • issue #143 Idea: Update build-time estimates for faster builds and detect cold vs. warm builds — Cold-versus-warm build estimate idea may complement this option
Possibly related, for context: - issue #143 Idea: Update build-time estimates for faster builds and detect cold vs. warm builds — Cold-versus-warm build estimate idea may complement this option
Author
Member

Screenshots: before and after

Drawn with tools/screenshots (headless, the same scene and window on both sides): before from main @ 321a9e1, after from this branch. main has no scene for either screen, so the before shots use temporary copies of this PR's two scenes without the cold build (build-failed, and step 2 with Advanced open), not committed.

The problem page after a failed build

Before

before: build-failed, main

After: Try a completely cold build, beside Build again.

after: build-failed, this PR

Step 2: Advanced

Before

before: step 2 with Advanced open, main

After: the completely cold build switch, ticked, with what it deletes and what it costs.

after: settings-cold, this PR

## Screenshots: before and after Drawn with `tools/screenshots` (headless, the same scene and window on both sides): before from `main` @ 321a9e1, after from this branch. `main` has no scene for either screen, so the before shots use temporary copies of this PR's two scenes without the cold build (`build-failed`, and step 2 with Advanced open), not committed. ### The problem page after a failed build **Before** ![before: build-failed, main](https://git.magicbean.dev/attachments/dca13ee3-2962-42e0-bc08-4bd74ca1ebd0) **After**: Try a completely cold build, beside Build again. ![after: build-failed, this PR](https://git.magicbean.dev/attachments/c184dc99-9bb0-42dd-aec4-8ef309346017) ### Step 2: Advanced **Before** ![before: step 2 with Advanced open, main](https://git.magicbean.dev/attachments/36b6d2b8-3b26-44dc-9216-5a7354b668d4) **After**: the completely cold build switch, ticked, with what it deletes and what it costs. ![after: settings-cold, this PR](https://git.magicbean.dev/attachments/d60539fb-210e-4f04-9db8-af91ce363a85)
Author
Member

Before and after screenshots added.

Before and after screenshots added.
dyst changed title from WIP: feat(build): a completely cold build, for a build that keeps failing to feat(build): a completely cold build, for a build that keeps failing 2026-11-17 19:08:11 +00:00
Author
Member

Rebased onto main (7a4a61e), now that #178 is merged: this PR is its own commit only. Launcher checks (1614) and release tests pass; the app builds with 0 warnings.

Rebased onto main (7a4a61e), now that #178 is merged: this PR is its own commit only. Launcher checks (1614) and release tests pass; the app builds with 0 warnings.
dyst force-pushed feat/cold-build from 639fc820a5
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 8s
to 24d97059c9
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
2026-11-17 20:39:06 +00:00
Compare
HumanBean deleted branch feat/cold-build 2026-11-17 21:13:00 +00:00
Owner

A code review, posted as a comment: the PR merged before it, and Forgejo reviews only open PRs.

Verdict: Request changes. The PR is already merged, so these need a follow-up before the next stable. Two things go wrong for exactly the players this is for. "Build again" after a failed cold build quietly runs another cold build, which throws away everything the failed attempt built. And a cold update or rebuild deletes the installed version's shader caches and pipeline notes before it starts, with no way to get them back if that build then fails or is stopped.

For a player whose build keeps failing, this gives a one-build "start from nothing" switch, offered from the problem page. That's a real gain and a small, well-placed change: it reuses Free up space's deletion, and the deletion itself is tight. The two gaps are in what happens around the deletion, not in what it deletes.

Reviewed: 24d97059 against 7a4a61e7 (the merge base): Core/ColdBuild.cs, App/ViewModels/BuildStepViewModel.cs (Run, Seed, ClearForCold, Stop, Fail, ProblemViewModel), SettingsStepViewModel.cs, WizardViewModel.cs, ProblemView.axaml, SettingsStepView.axaml and the new check in ShaderCacheChecks.cs, all read in full where they changed. Also read what they rely on: Disk.FreeWork/WorkBytes/WorkParts, ShaderCaches.Clearable/Clear, BuildRegistry.FolderOf, the single-instance lock in App/Program.cs, and the home's build start after 180. I only skimmed the README paragraph and the screenshot scenes. Nothing was run (a code review). The squash on main (8594b470) has the same code as the PR head.
Fixed in this review: nothing.
Checked and fine:

  • It deletes only Disk.WorkParts. The build files folder itself and the player's own files in it stay. A link is removed, never followed.
  • In the game folder it deletes only cache/ files named as caches. A linked cache/ is skipped, and user/save stays (the new check covers this).
  • It never touches toolchains, the game dump (it only stops passing LONGSHOT_ROMFS_FROM), other versions' game folders, or the launcher's settings.
  • "Longshot runs" is checked in step 2 and again inside ColdBuild.Clear, before anything is deleted.
  • One launcher per home (InstanceLock), and one build job at a time, so a second launcher or a parallel build can't have its files deleted from under it.
  • Seed is skipped, so no caches move from the replaced build.
  • Paths go through Path.Combine and DeleteTree, so Windows and Linux are the same.
  • The bug report's , cold build is fixed text.
  • The squash merged cleanly on top of 180, and the two don't overlap in behaviour (see the last line).

Blocking (for a follow-up before stable)

  1. App/ViewModels/BuildStepViewModel.cs:819: Build again repeats the cold build. BuildJob.Cold is never cleared, and RetryCommand starts a new BuildStepViewModel on the same job. So after a cold build fails at, say, 70% compiling, "Build again" deletes objcache, sa and both stores again and starts from zero. That's another first-build-length run, with no step 2 text in front of the player, and it contradicts the same page's "Then build again: what was built so far is kept, so it starts where it stopped." "For this build only" should mean the clearing happens once. A fix: once ClearForCold has succeeded, mark the job as cleared (keep Cold for the report line and the Seed/romfs skip), and skip the clearing on a retry. A check should cover a retry after a failed cold build.
  2. Core/ColdBuild.cs:17: The playable version loses its caches and notes when the cold build doesn't finish. Updates, going back and rebuilds go into the build's own folder (BuildRegistry.FolderOf), so ShaderCaches.Clear(job.InstallDir, notes: true) deletes the caches and pipeline notes of the version the player still has listed and plays. And it does so before make_game.py starts. If the cold build then fails (likely, since it's offered for builds that keep failing) or is stopped, that version prepares all its shaders again at its next start. It also stays without the shipped pipeline list until some build succeeds. Your own Clearable comment says that means it prepares less ahead until then. The warm update protects exactly this with Seed/Undo, and the cold path bypasses it. Neither the switch's text ("Your saves and settings stay") nor the problem page ("Your other versions … are not touched") says so. A fix: move the caches and notes aside rather than deleting them, put them back when the build doesn't finish (as ShaderCaches.Undo does), and delete them once it does. At least, say in ColdDesc that the version you play now loses its prepared shaders even if the build doesn't finish.

Suggestions

  • SettingsStepViewModel.cs:386: say how much goes, as Free up space does (Disk.WorkBytes(work) plus ShaderCaches.ClearableBytes(game, notes: true)), e.g. "Deletes 14 GB". Right now the player doesn't know what they lose until it's in the log.
  • BuildStepViewModel.cs:339: Stop during "Deleting what earlier builds kept" sends the player home, but the deletion carries on. If it then fails, Fail navigates to the problem page anyway, and Summarize runs a second time (cancelled, then failed). Check cancel.IsCancellationRequested before failing.
  • Step 2's free-space check runs before the clearing. A cold build that would free tens of GB from the same drive can be refused for room it is about to free. This is minor and errs on the safe side.
  • The new texts are English only (said in the PR).

Testing: ColdBuild.Clear has a game-free check (it deletes nothing while Longshot runs, and otherwise keeps the player's files). Nothing checks BuildJob.Cold through the view models: retry, the Seed skip, the romfs skip. The author ran the launcher checks and the release tests, and built the app. No cold build ran end to end (no game dump), and CI's compile-and-test job was skipped (manual dispatch). For the follow-up, one real cold update that is stopped partway would show both blocking points.
Overlaps and merge order: 180 (the home's one button) merged first, and this one was squashed after it with no conflict. 180's button still goes through StartWizard, so step 2 and its Advanced, where this switch lives, are unchanged. The two don't touch the same UI.

*A code review, posted as a comment: the PR merged before it, and Forgejo reviews only open PRs.* **Verdict: Request changes.** The PR is already merged, so these need a follow-up before the next stable. Two things go wrong for exactly the players this is for. "Build again" after a failed cold build quietly runs another cold build, which throws away everything the failed attempt built. And a cold update or rebuild deletes the installed version's shader caches and pipeline notes before it starts, with no way to get them back if that build then fails or is stopped. For a player whose build keeps failing, this gives a one-build "start from nothing" switch, offered from the problem page. That's a real gain and a small, well-placed change: it reuses Free up space's deletion, and the deletion itself is tight. The two gaps are in what happens around the deletion, not in what it deletes. **Reviewed:** 24d97059 against 7a4a61e7 (the merge base): `Core/ColdBuild.cs`, `App/ViewModels/BuildStepViewModel.cs` (Run, Seed, ClearForCold, Stop, Fail, ProblemViewModel), `SettingsStepViewModel.cs`, `WizardViewModel.cs`, `ProblemView.axaml`, `SettingsStepView.axaml` and the new check in `ShaderCacheChecks.cs`, all read in full where they changed. Also read what they rely on: `Disk.FreeWork`/`WorkBytes`/`WorkParts`, `ShaderCaches.Clearable`/`Clear`, `BuildRegistry.FolderOf`, the single-instance lock in `App/Program.cs`, and the home's build start after [180](https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/180). I only skimmed the README paragraph and the screenshot scenes. Nothing was run (a code review). The squash on `main` (8594b470) has the same code as the PR head. **Fixed in this review:** nothing. **Checked and fine:** - It deletes only `Disk.WorkParts`. The build files folder itself and the player's own files in it stay. A link is removed, never followed. - In the game folder it deletes only `cache/` files named as caches. A linked `cache/` is skipped, and `user/save` stays (the new check covers this). - It never touches toolchains, the game dump (it only stops passing `LONGSHOT_ROMFS_FROM`), other versions' game folders, or the launcher's settings. - "Longshot runs" is checked in step 2 and again inside `ColdBuild.Clear`, before anything is deleted. - One launcher per home (`InstanceLock`), and one build job at a time, so a second launcher or a parallel build can't have its files deleted from under it. - `Seed` is skipped, so no caches move from the replaced build. - Paths go through `Path.Combine` and `DeleteTree`, so Windows and Linux are the same. - The bug report's `, cold build` is fixed text. - The squash merged cleanly on top of [180](https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/180), and the two don't overlap in behaviour (see the last line). **Blocking** (for a follow-up before stable) 1. `App/ViewModels/BuildStepViewModel.cs:819`: **Build again repeats the cold build.** `BuildJob.Cold` is never cleared, and `RetryCommand` starts a new `BuildStepViewModel` on the same job. So after a cold build fails at, say, 70% compiling, "Build again" deletes `objcache`, `sa` and both stores again and starts from zero. That's another first-build-length run, with no step 2 text in front of the player, and it contradicts the same page's "Then build again: what was built so far is kept, so it starts where it stopped." "For this build only" should mean the clearing happens once. A fix: once `ClearForCold` has succeeded, mark the job as cleared (keep `Cold` for the report line and the `Seed`/romfs skip), and skip the clearing on a retry. A check should cover a retry after a failed cold build. 2. `Core/ColdBuild.cs:17`: **The playable version loses its caches and notes when the cold build doesn't finish.** Updates, going back and rebuilds go into the build's own folder (`BuildRegistry.FolderOf`), so `ShaderCaches.Clear(job.InstallDir, notes: true)` deletes the caches and pipeline notes of the version the player still has listed and plays. And it does so before make_game.py starts. If the cold build then fails (likely, since it's offered for builds that keep failing) or is stopped, that version prepares all its shaders again at its next start. It also stays without the shipped pipeline list until some build succeeds. Your own `Clearable` comment says that means it prepares less ahead until then. The warm update protects exactly this with `Seed`/`Undo`, and the cold path bypasses it. Neither the switch's text ("Your saves and settings stay") nor the problem page ("Your other versions … are not touched") says so. A fix: move the caches and notes aside rather than deleting them, put them back when the build doesn't finish (as `ShaderCaches.Undo` does), and delete them once it does. At least, say in `ColdDesc` that the version you play now loses its prepared shaders even if the build doesn't finish. **Suggestions** - `SettingsStepViewModel.cs:386`: say how much goes, as Free up space does (`Disk.WorkBytes(work)` plus `ShaderCaches.ClearableBytes(game, notes: true)`), e.g. "Deletes 14 GB". Right now the player doesn't know what they lose until it's in the log. - `BuildStepViewModel.cs:339`: Stop during "Deleting what earlier builds kept" sends the player home, but the deletion carries on. If it then fails, `Fail` navigates to the problem page anyway, and `Summarize` runs a second time (cancelled, then failed). Check `cancel.IsCancellationRequested` before failing. - Step 2's free-space check runs before the clearing. A cold build that would free tens of GB from the same drive can be refused for room it is about to free. This is minor and errs on the safe side. - The new texts are English only (said in the PR). **Testing:** `ColdBuild.Clear` has a game-free check (it deletes nothing while Longshot runs, and otherwise keeps the player's files). Nothing checks `BuildJob.Cold` through the view models: retry, the `Seed` skip, the romfs skip. The author ran the launcher checks and the release tests, and built the app. No cold build ran end to end (no game dump), and CI's compile-and-test job was skipped (manual dispatch). For the follow-up, one real cold update that is stopped partway would show both blocking points. **Overlaps and merge order:** [180](https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/180) (the home's one button) merged first, and this one was squashed after it with no conflict. 180's button still goes through `StartWizard`, so step 2 and its Advanced, where this switch lives, are unchanged. The two don't touch the same UI.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 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!179
No description provided.