fix(build): a failure after the game linked keeps the translation and the game's objects; only the renderer's go #1080

Merged
HumanBean merged 2 commits from HumanBean/Longshot:fix/keep-lift-after-renderer-link into main 2026-11-16 06:52:03 +00:00
Owner

Type: fix · Risk: low · Tested on: nothing yet (not built or run) · Needs: Linux, any GPU (a build with a renderer link error); Windows, any GPU

Why

When a build fails after the game itself has linked (for example, the renderer longshot_vk.so has an unresolved symbol from a mistake in gpu/vk), the next build translates and compiles the whole game again, as if nothing of the failed one could be trusted. That guard was added for Hookshot's #1197, where a stale cached object broke the game's link. But it fires on any failure after the compile, including ones that only involve the repository's renderer code. A one-line renderer mistake then costs a full lift and compile, which is up to an hour on a small PC. Reported by foolfool on Discord.

How to reproduce

Seen on: Linux, RX 6750 XT (the reporter)
Settings and switches: defaults
Steps: in gpu/vk, write an extern of one of the renderer's own functions inside an anonymous namespace (or call a host function that isn't weak), then build with nx2/make_game.py.
Expected: the build fails with longshot_vk.so has N unresolved symbol(s); after the fix, the next build skips translating and recompiles only the renderer.
Actual: the build failed: the next one translates and compiles the game again (nothing of this one is reused).

What changed

make_game.py now notices when build.py reports that the game itself linked. A failure after that point can only come from the renderer's link or from its symbol check. In that case only the renderer's objects are forgotten; the translation and the game's objects are kept. A failure of the game's own link still forgets everything, as for #1197.

  • build: compile_line in nx2/make_game.py matches build.py's linked <...>/longshot[.exe]: N MB ( line, which build.py prints before the renderer's link. It passes the result to forget_failed_build(..., game_linked).
  • build: the new forget_renderer_objects() removes sa/build/obj/vk_* (nx2/build.py's vk_jobs). It also removes their cached objects in objcache/ under the keys in their .sha1 stamps, plus their copies in the LONGSHOT_OBJ_STORE store. A stale cached renderer object can then never fail the link twice.
  • test: in tests/test_failed_compile_keeps_objects.py, test_after_the_game_linked_only_the_renderer_is_forgotten and test_the_game_linked_is_told_by_build_pys_line check the cleanup and the line match. The match covers Linux and Windows paths with spaces, and doesn't match longshot_vk.so or longshot_vk.dll.

Measurements

Verdict: nothing measured. This changes which build outputs survive a failed build, not the game. The time saved is the lift plus the game's compile on the next try.

Flags and settings

None

Testing

Tested: nothing yet. The game-free checks haven't been run on my PC, and I haven't built the game with this change.

Not tested: the build in practice, on either platform, and whether the two new checks fail on main and pass here.

Must be tested:

  • Linux, any GPU: in a source checkout, add an unresolved symbol to gpu/vk (e.g. namespace { extern int x_missing; } used from a function), then run a build. Expect the build failed after the game linked, in the renderer: .... Remove the error and build again. Expect the game was translated with these tools before (no lift) and only vk_* files compiled (Test Farm: @Beanstalk linux, a build with a deliberate renderer link error, then a fixed build).
  • Windows, any GPU: the same with a renderer link error (longshot_vk.dll link FAILED), expecting the same (Test Farm: windows).
  • python -I -B tests/run_all.py passes, and the two new checks fail on main.

Risks

What could break: if a failure after the game linked were really caused by the translation, the next build would fail the same way again instead of re-translating. Nothing after that line reads the translated code, so this shouldn't happen.

Turning it off: revert the commit.

Compatibility: nothing changes for a player after updating.

Issues

Fixes #1076

Checklist

Everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description) of the status line's type.
  • Why gives the reason plainly and links the issues that fit (the tracker searched).
  • Measurements has a verdict, or one line saying why there is nothing to measure.
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main.
  • python -I -B tests/run_all.py passes (any failure that also fails on main is named). Not run on my PC; still to run.
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

When it applies

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • A game-free test added for the fix, failing on main and passing here. Added (its own commit before the fix); whether it fails on main and passes here hasn't been run yet.
  • A check under tests/ that reads changed source updated in this PR, not weakened.

🤖 Generated with Claude Code

**Type:** fix · **Risk:** low · **Tested on:** nothing yet (not built or run) · **Needs:** Linux, any GPU (a build with a renderer link error); Windows, any GPU ## Why When a build fails after the game itself has linked (for example, the renderer `longshot_vk.so` has an unresolved symbol from a mistake in `gpu/vk`), the next build translates and compiles the whole game again, as if nothing of the failed one could be trusted. That guard was added for Hookshot's #1197, where a stale cached object broke the **game's** link. But it fires on any failure after the compile, including ones that only involve the repository's renderer code. A one-line renderer mistake then costs a full lift and compile, which is up to an hour on a small PC. Reported by foolfool on Discord. ## How to reproduce **Seen on:** Linux, RX 6750 XT (the reporter) **Settings and switches:** defaults **Steps:** in `gpu/vk`, write an `extern` of one of the renderer's own functions inside an anonymous namespace (or call a host function that isn't `weak`), then build with `nx2/make_game.py`. **Expected:** the build fails with `longshot_vk.so has N unresolved symbol(s)`; after the fix, the next build skips translating and recompiles only the renderer. **Actual:** `the build failed: the next one translates and compiles the game again (nothing of this one is reused)`. ## What changed `make_game.py` now notices when `build.py` reports that the game itself linked. A failure after that point can only come from the renderer's link or from its symbol check. In that case only the renderer's objects are forgotten; the translation and the game's objects are kept. A failure of the game's own link still forgets everything, as for #1197. - build: `compile_line` in `nx2/make_game.py` matches build.py's `linked <...>/longshot[.exe]: N MB (` line, which build.py prints before the renderer's link. It passes the result to `forget_failed_build(..., game_linked)`. - build: the new `forget_renderer_objects()` removes `sa/build/obj/vk_*` (nx2/build.py's `vk_jobs`). It also removes their cached objects in `objcache/` under the keys in their `.sha1` stamps, plus their copies in the `LONGSHOT_OBJ_STORE` store. A stale cached renderer object can then never fail the link twice. - test: in `tests/test_failed_compile_keeps_objects.py`, `test_after_the_game_linked_only_the_renderer_is_forgotten` and `test_the_game_linked_is_told_by_build_pys_line` check the cleanup and the line match. The match covers Linux and Windows paths with spaces, and doesn't match `longshot_vk.so` or `longshot_vk.dll`. ## Measurements **Verdict:** nothing measured. This changes which build outputs survive a failed build, not the game. The time saved is the lift plus the game's compile on the next try. ### Flags and settings None ## Testing **Tested:** nothing yet. The game-free checks haven't been run on my PC, and I haven't built the game with this change. **Not tested:** the build in practice, on either platform, and whether the two new checks fail on `main` and pass here. **Must be tested:** - Linux, any GPU: in a source checkout, add an unresolved symbol to `gpu/vk` (e.g. `namespace { extern int x_missing; }` used from a function), then run a build. Expect `the build failed after the game linked, in the renderer: ...`. Remove the error and build again. Expect `the game was translated with these tools before` (no lift) and only `vk_*` files compiled (Test Farm: `@Beanstalk` linux, a build with a deliberate renderer link error, then a fixed build). - Windows, any GPU: the same with a renderer link error (`longshot_vk.dll link FAILED`), expecting the same (Test Farm: windows). - `python -I -B tests/run_all.py` passes, and the two new checks fail on `main`. ## Risks **What could break:** if a failure after the game linked were really caused by the translation, the next build would fail the same way again instead of re-translating. Nothing after that line reads the translated code, so this shouldn't happen. **Turning it off:** revert the commit. **Compatibility:** nothing changes for a player after updating. ## Issues Fixes #1076 ## Checklist ### Everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`) of the status line's type. - [x] Why gives the reason plainly and links the issues that fit (the tracker searched). - [x] Measurements has a verdict, or one line saying why there is nothing to measure. - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [x] Rebased on current `main`. - [ ] `python -I -B tests/run_all.py` passes (any failure that also fails on `main` is named). Not run on my PC; still to run. - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### When it applies - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [ ] A game-free test added for the fix, failing on `main` and passing here. Added (its own commit before the fix); whether it fails on `main` and passes here hasn't been run yet. - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(build): a failure after the game linked keeps the translation and the game's objects; only the renderer's go (#1076)
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 6s
Website / Website on Cloudflare (pull_request_target) Has been skipped
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 11s
CI / Workflow lint (actionlint) (pull_request) Successful in 12s
Third-party parts / As their notes say (pull_request) Successful in 15s
PR description / Description follows the template (pull_request_target) Failing after 5s
f173d0998c
The renderer's link and its unresolved-symbol check (check_vk_symbols) run after the game's own link, and they read only
gpu/vk and its libraries. Before, any failure after the compile forgot the lift and every object (the issue 1197 guard), so an
extern in an anonymous namespace in gpu/vk cost a whole lift and compile. make_game now reads build.py's "linked <exe>: N MB"
line: after it, only sa/build/obj/vk_* and their cached keys (work folder and LONGSHOT_OBJ_STORE) are forgotten. A failure of
the game's own link still forgets everything, as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HumanBean changed title from WIP: fix(build): a failure after the game linked keeps the translation and the game's objects; only the renderer's go to fix(build): a failure after the game linked keeps the translation and the game's objects; only the renderer's go 2026-11-16 06:51:59 +00:00
HumanBean deleted branch fix/keep-lift-after-renderer-link 2026-11-16 06:52:03 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
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/Longshot!1080
No description provided.