fix(build): translated files the PC changed are found, named and compiled again #2305
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2305
Loading…
Reference in a new issue
No description provided.
Delete branch "pepe999/Longshot:fix/damaged-translation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Players' builds stop in Compile on one-character typos in the generated C, in other files at each build:
uint65_t(#1414),_src[4]$_dst[4](#985), an undeclaredx, then_p1(#1762), and #990 and #1441 look the same. A bit changed by the PC's memory or processor, as the answers in #985 found; but all the player gets is the compiler's error, which reads like a Longshot bug, and building again gives another one.The translation is the same each time for the same inputs, byte for byte. So when every final compile failure is in a translated file and has a compiler error at a source location,
make_game.pynow translates the game again and compares:main.It isn't done for a compiler that ran out of memory, for a source of the repository, or when the lift key is no longer the one this build translated with (a translator edited since).
What it doesn't do: it can't repair a PC; it can't see a changed byte in a build where everything compiles; with
LONGSHOT_LIFT_STORE(development) the translation it compares with is the stored one.Seen on
main: change auint64_tinside acode_*.ctouint65_tafter the lift; the build stops with the compiler's error. Read first:changed_lift,refused_liftandlift_changedinnx2/make_game.py;run()gainsagain.See #1762. #2300 finds zero bytes before the compile and touches other lines of the same file; neither needs the other.
Testing
Tested: Linux, no game run and no shaders prepared (this is the build; what the game runs is unchanged).
make_game.pywhole, on the real game, with its own lift, clang and link, two files changed on purpose after the translation (auint65_t, and anx[8]tox[9]that compiles):The real translation made twice in one work folder (
lift.pyandsplit_hot.py): 95 of 95 files the same.tests/test_damaged_translation.py(game-free: the compile step cut frommain(), the realrun(), a stand-inbuild.py) fails 7 of its 10 cases onmain(3 are behaviour that stays) and passes here; eleven broken versions of the fix each fail it.test_failed_compile_keeps_objects.pyreads the changed call, and its text follows it.tests/run_all.py --strict, whatmise run testruns, in a container asci.ymlsets its job up (Ubuntu 24.04, clang 18.1.3, g++ 13.3, glslang 16.6.0, spirv-val, .NET 8; no network): 938 passed, 2 failed, 18 skipped. The 2 fail onmaintoo (test_dev_packs, test_pipeline_state_computes; #2311 is for them).On this PC,
tests/run_all.py, not--strict: 887 passed, 9 failed, 62 skipped. The 9 fail onmaintoo: nx2/test_mesh_first_types, test_audio_source, test_builtin_compute_unoptimized, test_dev_packs, test_image_view_retry, test_link_skip, test_mise_build, test_pipeline_state_computes, test_thinlto_tls.Still to test:
Measurements
Verdict: a build that works does nothing more; one the PC damaged finishes, for a second translation and the changed files' compile.
Setup: Linux, 28 threads, the real game, the times the runs above printed; the PC was not reserved for timing.
753fb5af1f7bd765The 51 s are 165 of 592 files: the two changed, and host and renderer files a failed compile leaves to be compiled again, as on
main. The game's frame rate and memory can't change: nothing the game runs does.Risks
A lifter change that writes C the compiler refuses pays one more translation before the error, unless the lift store has it. Were the translation ever different from the same inputs (on another OS or Python), a refused compile would be blamed on the PC: only then, and the compiler's error is still printed above. A revert is enough. Players notice nothing unless a build is refused.
Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
Fails on main: a compile that refuses translated files stops the build with the compiler's error whatever the cause, so a player whose memory flips bits in the generated C ("uint65_t") gets what reads like a Longshot bug. Assisted-by: Claude Code Co-Authored-By: Claude Opus 5.5 <[email protected]>tests/run_all.py --strictran in a container set up asci.yml's job: 938 passed, 2 failed, 18 skipped; the 2 fail onmaintoo (937, 2, 18) and #2311 is for them.@review
Recommendation: Approve. The Linux build demonstrates recovery from deliberately damaged translated files, but the recovery path and its byte-for-byte comparison still need a Windows run before merge. A minor error-classification issue can also send an out-of-memory failure through the recovery path. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.
After a compiler rejects translated files, the build translates them again, identifies changed files and retries compilation once. This can complete a build that previously stopped, at the cost of another translation and compile attempt after an eligible failure.
Should fix (1): not blocking, but worth doing before merging.
nx2/make_game.py:3400: Compiler errors from the initial parallel attempts are retained even when those files succeed on their standalone retry, so they can classify a different final failure as a source error. (more on the line) Do: Associate diagnostics with the final FAILED attempts and only classify the final failures using their own diagnostics.Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
nx2/make_game.py:3418: The Windows build and recovery path has not been exercised. (more on the line) Do: Run a Windows launcher build with a deliberately damaged translated file and a second unchanged translation; verify recovery, linking and byte-for-byte determinism.@fixcan do L1.Checks: Still running: 9 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes on the tested Linux case: the author reports that main stopped 423 seconds into compilation, while this PR recovered and linked after another 76 seconds translating and 51 seconds compiling. The game-free test also reportedly fails on main and passes here. Windows recovery and determinism remain untested.
Other systems: The change affects build recovery on Windows and Linux, including cached translations and object reuse; it does not change game runtime code. Linux was exercised with the real game. Windows has not yet been exercised, and the development lift store substitutes its stored translation for a fresh one.
Switches: None added, changed or removed.
Reviewed:
1f7bd76554against753fb5af68: Read the repository rules, pull request template, standards, commits, complete diffs and both changed test files. Read the changed portions and surrounding translation, compile, cache and cleanup paths in nx2/make_game.py, and relevant portions of nx2/build.py and nx2/lift_store.py; the rest of the large make_game.py file was skimmed. docs/review-checklist.md and ../Tooling/AGENTS.md were not present. The supplied CI results and author’s recorded runs were reviewed; no generated files or translations changed.; nothing run (a code review).Checked and fine:
Testing: Read-only review; no project code, scripts or tests were run. The supplied CI checks are still running.
Overlaps and merge order: The description identifies #2300 as touching nearby code but says neither change depends on the other; no independent overlap check was available.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@ -3362,2 +3397,4 @@def compile_line(line):if COMPILE_ERROR.match(line):errors.append(line)if re.match(r"compiled in \d+s, 0 failed$", line):L1 (should fix): Compiler errors from the initial parallel attempts are retained even when those files succeed on their standalone retry, so they can classify a different final failure as a source error.
When: If one parallel compile emits a source error but succeeds alone, while a lifted file ultimately fails alone because its compiler is killed for lack of memory, errors remains nonempty and failed contains only the lifted file. refused_lift then starts another translation and may blame the PC's hardware instead of preserving the memory failure.
Do: Associate diagnostics with the final FAILED attempts and only classify the final failures using their own diagnostics.
@ -3371,0 +3415,4 @@# (a compile that refuses translated files: they are made again, and compiled again when they come out different, changed_lift.# The lift key as it was: another translator, edited since, or other settings make other files, and no PC is at fault then)def lift_changed():if not refused_lift(gen_dir, failed, errors) or lift_key(exefs, work, env) != key:L2 (should fix): The Windows build and recovery path has not been exercised.
When: On Windows, the recovery relies on a second translation producing identical bytes for unchanged inputs and on the launcher accepting the retry and final result. The supplied runs establish this only on Linux.
Do: Run a Windows launcher build with a deliberately damaged translated file and a second unchanged translation; verify recovery, linking and byte-for-byte determinism.
@fix
1f7bd76554f7728748beRecommendation: Approve. The code is ready: only testing is left. The reported Linux build recovered from deliberately damaged translated files, but the Windows launcher build and recovery path remain untested. The fix preserves the retry while restricting it to final failures with source diagnostics. Recommend approval; not approved on the forge.
What
@fixchangedI changed this pull request: the new head is
f7728748be. I rebased it ontomain(f6913dd55f). I edited its description to match the change.Changed
Nothing was built or run: the checks run again on the new head.
The build compares translated files after a qualifying compile failure and retries changed files once, helping players distinguish damaged output from a reproducible compiler error. Recovery costs another translation and recompilation.
Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
nx2/make_game.py:3418: The Windows build and recovery path has not been exercised. When: On Windows, the recovery relies on a second translation producing identical bytes for unchanged inputs and on the launcher accepting the retry and final result. The supplied runs establish this only on Linux. Do: Run a Windows launcher build with a deliberately damaged translated file and a second unchanged translation; verify recovery, linking and byte-for-byte determinism.Checks: they run again on this head; a failure shows on the pull request.
Also noticed (1; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes on the reported Linux case: main stopped during compilation, while the changed build finished after a 76-second translation and 51-second compile. Windows recovery remains unproven.
Other systems: The change affects Linux and Windows build workflows, including launcher builds and the development lift store. Linux recovery was reported; Windows build, recovery, and translation determinism have not been reported.
Switches: No switches were changed by BeanBot's fix. The supplied base diff also adds RX_VK_DLSS_FAIL_CREATE, default off, and changes RX_VK_RECORDER Auto's recorder threshold from six to four physical cores; those unrelated changes were not reviewed in depth.
Reviewed:
f7728748beagainstf6913dd55f: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the two changed build tests, the fix diff, and the changed make_game.py paths with build.py's compile-result output. Skimmed standards and the remaining make_game.py and base-diff changes; the full base diff includes unrelated merged commits. Tooling's AGENTS.md and docs/review-checklist.md were unavailable.; nothing run (a code review).Checked and fine:
Testing: No commands that execute project code or tests were run. The reported Linux tests predate BeanBot's fix, and CI has not run on this head.
Overlaps and merge order: #2300 touches other lines in make_game.py; the description says neither change depends on the other.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.
WIP: fix(build): translated files the PC changed are found, named and compiled againto fix(build): translated files the PC changed are found, named and compiled againJer9 referenced this pull request2026-11-23 16:17:47 +00:00