fix(build): a translation with a zero byte is made again in the same build #2300
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!2300
Loading…
Reference in a new issue
No description provided.
Delete branch "pepe999/Longshot:fix/lift-zero-bytes"
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
A player's build stopped in Compile with 17 translated files refused for a zero byte (#2296), and an earlier one with a single one (#2150). The translation never writes one: the PC's memory or the drive changed the files.
make_game.pyalready checks the translation before the compile and makes it again once, but only by each file's last two bytes (lifted_cut_short). A zero byte inside a file is found only in the compile, where the build can only stop: the player has to start it again, and the error names one file with no count. WithLONGSHOT_LIFT_STORE(development) such a translation is also saved for the other work folders and taken from there at every try, so "Build again: the file is made again" isn't true there.Now the translation this build made or copied, and an older retained translation without a record of this check, is also looked through for zero bytes:
A retained translation with a record of a successful check isn't read again. An older retained translation without that record is checked once. The compile's refusal stays for a file damaged later.
It doesn't repair the PC: with memory as bad as #2296's log suggests, the second translation is likely damaged too, and what the player gets is the count and what to check. It also can't see a byte that changed into something other than zero.
Seen on
main: zero one byte inside acode_*.cafter the lift; the build goes on to the compile and stops there. Read first:lifted_zero_bytesandtranslate()innx2/make_game.py.See #2296.
Testing
Tested: Linux, no game run (this is the build; the compiled game is unchanged).
make_game.py's owntranslate()with the reallift.pyon the real game, one byte of 17 of its 88 files zeroed after the translation: zeroed once, it is translated again, comes out whole and the next build keeps it; zeroed twice, it stops with "damaged twice: 17 of 88 files have a zero byte" and the next build doesn't keep it.split_hot.pyand the compile were not part of it.tests/test_lift_zero_bytes.py(game-free: the realtranslate()and store, a stand-in lift) previously failed 6 of its 9 cases onmain(3 are behaviour that stays) and passed here; six broken versions of the fix each failed it. The updated test includes a case for older retained translations; its run is pending.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: 873 passed, 13 failed, 72 skipped. The same 13 fail onmain: nx2/test_mesh_first_types, test_audio_source, test_builtin_compute_unoptimized, test_dev_packs, test_discover, test_image_view_retry, test_lift_lookups, test_link_skip, test_make_game_cache, test_mise_build, test_pipeline_state_computes, test_thinlto_tls, test_walk. Four of them only lack Python packages there (test_discover, test_lift_lookups, test_make_game_cache, test_walk) and pass here and onmainwith a Python that has them.Still to test:
Measurements
Verdict: the check costs 0.2-0.3 s of a 100 s translation; nothing else changes.
Setup: Linux, the real game's translation (88 files, 1,483 MB), the times the two runs above printed; the PC was not reserved for timing.
753fb5afdff34314A build that skips the translation reads it if it has no record of a successful zero-byte check. The game's frame rate and memory can't change: nothing the game runs does.
Risks
A file the lift wrote a zero byte into on purpose would now be translated twice and refused: none exists (0 in 1,483 MB), and the compile refuses one already. Each file is read whole, one at a time (24 MB at most). A revert is enough. Players notice nothing unless a file is damaged.
Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). The run on the updated change is pending.main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here. The updated test run is pending.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
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. A translation kept from a build before this change can bypass the new check, so a damaged translation can still reach compile without the promised same-build retry. A Windows launcher build is also outstanding. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.
The build scans newly made or restored translated C for zero bytes, retries a damaged translation once, and reports a count and hardware checks if it is damaged again. This improves recovery at the cost of reading the translated files; the reported Linux scan took 0.21–0.27 seconds.
Should fix (1): not blocking, but worth doing before merging.
nx2/make_game.py:3258: A retained translation is assumed to have passed the new zero-byte check, even when it was made by an older builder that had no such check. (more on the line) Do: Record that a translation passed the new check and scan retained translations that lack that record before treating them as checked. Add a test starting with a keyed translation created without the record.Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
@fixcan do L1.Checks: Still running: 9 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes for the tested fresh-translation case: the author reports that one injected zero byte in each of 17 files caused a retry and a whole translation, while damage on both attempts stopped with the count. The game-free test is reported to fail on main and pass here. Existing translations from before this change are an exception.
Other systems: The change affects the build on Windows and Linux and the optional shared translation store, not the compiled game. Linux fresh translation and store behavior are covered by the reported runs and tests; a Windows launcher build remains untested.
Switches: No switches added, changed, or removed. The existing LONGSHOT_LIFT_STORE remains off by default; its restore and save paths now check for damage.
Reviewed:
dff343147bagainst753fb5af68: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the pull request template, both commits, the full diff, nx2/lift_store.py and tests/test_lift_zero_bytes.py. Read the changed portions of nx2/make_game.py and the lift-key, retained-translation and compiler paths; the full make_game.py output was truncated, so the rest was not fully reviewed. docs/review-checklist.md and ../Tooling/AGENTS.md were absent. No recorded runs, translations, or generated files were included in the diff.; nothing run (a code review).Checked and fine:
Testing: Read-only review; no code, scripts, builds, or tests were run. CI is still running; the author reports two strict-suite failures that also occur on main.
Overlaps and merge order: Not checked; network access is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@ -3230,2 +3255,4 @@for _ in range(2):kept = Falseif lifted_before(work, key): # (never on the second pass: its key was taken away below)kept = TrueL1 (should fix): A retained translation is assumed to have passed the new zero-byte check, even when it was made by an older builder that had no such check.
When: If a pre-update build wrote a zero-containing translation and its key, then stopped before compile removed that key, the updated builder accepts the unchanged key and skips the zero-byte scan. Compile then stops on the damaged file instead of retrying translation in the same build.
Do: Record that a translation passed the new check and scan retained translations that lack that record before treating them as checked. Add a test starting with a keyed translation created without the record.
@fix
dff343147b714854920cRecommendation: Approve. The code is ready: only testing is left. The reported Linux run shows the retry working, and the retained-translation fix preserves it. The Windows launcher build remains untested. Recommend approval; not approved on the forge.
What
@fixchangedI changed this pull request: the new head is
714854920c. I rebased it ontomain(6acae6aa87). I edited its description to match the change.Changed
Nothing was built or run: the checks run again on the new head.
The builder checks translated C for zero bytes and retries a damaged translation once, reporting repeated damage and avoiding a damaged shared-store copy. Older retained translations are checked once; the scan adds a reported 0.21–0.27 seconds on the tested Linux PC.
Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
Checks: they run again on this head; a failure shows on the pull request.
Also noticed (3; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes: the reported Linux run retried successfully after 17 of 88 files were damaged once and stopped with the count when they were damaged twice. The updated retained-translation test has not yet been run.
Other systems: The change affects Linux and Windows builds and the optional shared translation store, not game execution. Windows launcher behavior remains unverified.
Switches: No switches added, changed or removed; the existing LONGSHOT_LIFT_STORE path is checked for damaged translations.
Reviewed:
714854920cagainst6acae6aa87: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the fix diff, the affected translation and key-handling paths, and tests/test_lift_zero_bytes.py. Skimmed the base diff and lift-store changes; the full large base diff and all changed files were not read. The review checklist and adjacent Tooling AGENTS.md were unavailable.; nothing run (a code review).Checked and fine:
Testing: No commands from the project were run. The author reports Linux translation tests and identifies baseline test failures; CI has not run on this head.
Overlaps and merge order: Not checked; the network is closed.
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): a translation with a zero byte is made again in the same buildto fix(build): a translation with a zero byte is made again in the same buildJer9 referenced this pull request2026-11-23 16:17:47 +00:00