fix(release): the Windows zip carries tools/version.txt, so a release's game and builder know their version #149

Merged
HumanBean merged 1 commit from d4nkn3ss/Longshot:fix/release-tools-version into main 2026-11-13 09:06:02 +00:00
Contributor

Why

A Windows release's game doesn't know which release it is: nightly-34-545618fc's game logs longshot unknown as the first line of longshot_log.txt (the line CONTRIBUTING.md asks players to report), writes no longshot_version.txt into the game folder, and its Builder has no version to show or to compare for updates.

What changed

  • release: make_zip() in scripts/builder_package.py writes the release into LongshotBuilder/tools/version.txt as well as the top-level VERSION. nx2/version.py's release() and the Builder's Runner.Version (builder/LongshotBuilder/Runner.cs) read that file; nothing has written it since the Windows zip moved to builder_package.py (#13, #99).
  • release: scripts/check_windows_files.py requires LongshotBuilder/tools/version.txt in the zip and checks it matches VERSION, so CI catches it if it goes missing again.
  • tests: tests/test_recomplauncher_json.py's zip test lists the file and checks its content.

Flags and settings

None

Measurements

main: 39647e1a (2026-11-12)
this PR: fix/release-tools-version @ edd30a7a
Hardware: Windows 11, RTX 3080 10 GB, NVIDIA 621.14; Python 3.12
Scene: the release nightly-34-545618fc installed as a player would (the zip's LongshotBuilder.exe --cli --nup <file> --out <folder>), then a headless run of the game it built
How to reproduce: unpack LongshotBuilder-nightly-34-545618fc-windows-x64.zip, run its setup with --cli, start the game; read the first line of longshot_log.txt and look for longshot_version.txt in the game folder

main @ 39647e1a this PR @ edd30a7a
tests/test_recomplauncher_json.py (the zip test, now checking tools/version.txt) FAILED (failures=1) OK
nightly-34's zip: LongshotBuilder/tools/version.txt absent (only VERSION at the top) written by make_zip
nightly-34's game: first line of longshot_log.txt longshot unknown (source 40b30d78) not measured: needs a release built from this
nightly-34's game folder: longshot_version.txt absent not measured: needs a release built from this
[hos host] longshot unknown (source 40b30d78)
frame 5481  fps 59.7  state play  draws 1513  window 1920x1080  map HyruleField_Adult (adult)  unknown (source 40b30d78)

Testing

Tested: the zip test on both sides; tests/test_setup_tool_merge.py (unpacks a fake builder zip from make_zip) and tests/test_windows_on_linux.py pass. The nightly-34 install and run above, which showed the bug.

Full suite: python -I -B tests/run_all.py on this branch @ edd30a7a, Windows 11: 500 passed, 3 failed, 35 skipped, the same three as main @ 39647e1a: tests/test_check_third_party.py (#80), tests/test_setup_runtime.py (#118) and tests/test_release.py (#119, #144, #145).

Not tested: a release built with this change, end to end: it needs the release workflow. The next nightly will show it: its game's first log line should name the nightly, and the game folder should get longshot_version.txt.

Needs other testers: None

Screenshots

Nothing on screen

Risk and rollback

One more small file in the zip; reverting the commit is enough. If a package folder ever carried its own tools/version.txt, the walk would put that one in instead (as before for any file it carries).

Issues

None

Checklist

For everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description).
  • Rebased on current main.
  • python -I -B tests/run_all.py run and passing (any failure that also fails on main is named above).
  • Tested in the game, or what wasn't is named under Testing.
  • Testing filled in: what was tested, what wasn't, and what needs other testers (with test requests).
  • Measured: main and this PR at named commits, on the same PC, scene and settings, at least 2 interleaved runs each, the median reported. (A packaging fix: the zip test and the release's own log line, not a timing.)
  • 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.

If applicable

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • A game-free test added for the fix, failing on main and passing here. (The zip test, extended.)
  • A check under tests/ that reads changed source updated in this PR, not weakened.

🤖 Generated with Claude Code

## Why A Windows release's game doesn't know which release it is: nightly-34-545618fc's game logs `longshot unknown` as the first line of `longshot_log.txt` (the line CONTRIBUTING.md asks players to report), writes no `longshot_version.txt` into the game folder, and its Builder has no version to show or to compare for updates. ## What changed - release: `make_zip()` in `scripts/builder_package.py` writes the release into `LongshotBuilder/tools/version.txt` as well as the top-level `VERSION`. `nx2/version.py`'s `release()` and the Builder's `Runner.Version` (`builder/LongshotBuilder/Runner.cs`) read that file; nothing has written it since the Windows zip moved to `builder_package.py` (#13, #99). - release: `scripts/check_windows_files.py` requires `LongshotBuilder/tools/version.txt` in the zip and checks it matches `VERSION`, so CI catches it if it goes missing again. - tests: `tests/test_recomplauncher_json.py`'s zip test lists the file and checks its content. ## Flags and settings None ## Measurements main: 39647e1a (2026-11-12) this PR: fix/release-tools-version @ edd30a7a Hardware: Windows 11, RTX 3080 10 GB, NVIDIA 621.14; Python 3.12 Scene: the release nightly-34-545618fc installed as a player would (the zip's `LongshotBuilder.exe --cli --nup <file> --out <folder>`), then a headless run of the game it built How to reproduce: unpack `LongshotBuilder-nightly-34-545618fc-windows-x64.zip`, run its setup with `--cli`, start the game; read the first line of `longshot_log.txt` and look for `longshot_version.txt` in the game folder | | main @ 39647e1a | this PR @ edd30a7a | |---|---|---| | `tests/test_recomplauncher_json.py` (the zip test, now checking `tools/version.txt`) | FAILED (failures=1) | OK | | nightly-34's zip: `LongshotBuilder/tools/version.txt` | absent (only `VERSION` at the top) | written by `make_zip` | | nightly-34's game: first line of `longshot_log.txt` | `longshot unknown (source 40b30d78)` | not measured: needs a release built from this | | nightly-34's game folder: `longshot_version.txt` | absent | not measured: needs a release built from this | ``` [hos host] longshot unknown (source 40b30d78) frame 5481 fps 59.7 state play draws 1513 window 1920x1080 map HyruleField_Adult (adult) unknown (source 40b30d78) ``` ## Testing **Tested:** the zip test on both sides; `tests/test_setup_tool_merge.py` (unpacks a fake builder zip from `make_zip`) and `tests/test_windows_on_linux.py` pass. The nightly-34 install and run above, which showed the bug. **Full suite:** `python -I -B tests/run_all.py` on this branch @ edd30a7a, Windows 11: 500 passed, 3 failed, 35 skipped, the same three as main @ 39647e1a: `tests/test_check_third_party.py` (#80), `tests/test_setup_runtime.py` (#118) and `tests/test_release.py` (#119, #144, #145). **Not tested:** a release built with this change, end to end: it needs the release workflow. The next nightly will show it: its game's first log line should name the nightly, and the game folder should get `longshot_version.txt`. **Needs other testers:** None ## Screenshots Nothing on screen ## Risk and rollback One more small file in the zip; reverting the commit is enough. If a package folder ever carried its own `tools/version.txt`, the walk would put that one in instead (as before for any file it carries). ## Issues None ## Checklist ### For everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`). - [x] Rebased on current `main`. - [x] `python -I -B tests/run_all.py` run and passing (any failure that also fails on `main` is named above). - [x] Tested in the game, or what wasn't is named under Testing. - [x] Testing filled in: what was tested, what wasn't, and what needs other testers (with test requests). - [x] Measured: main and this PR at named commits, on the same PC, scene and settings, at least 2 interleaved runs each, the median reported. (A packaging fix: the zip test and the release's own log line, not a timing.) - [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. ### If applicable - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [x] A game-free test added for the fix, failing on `main` and passing here. (The zip test, extended.) - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(release): the Windows zip carries tools/version.txt, so a release's game and builder know their version
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 3s
edd30a7a54
nightly-34's game logged "longshot unknown", wrote no longshot_version.txt into the game folder, and its builder
didn't know its release: nx2/version.py and Runner.cs read tools/version.txt, which nothing has written since the
Windows zip moved to builder_package.py (#13, #99); the zip had VERSION only at its top. make_zip now writes the
release into LongshotBuilder/tools/version.txt too, check_windows_files.py requires it to match VERSION, and
test_recomplauncher_json checks it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HumanBean approved these changes 2026-11-13 09:05:20 +00:00
HumanBean left a comment

Reviewed by reading the code (not built or run here). Looks right.

  • Path: the zip puts it at LongshotBuilder/tools/version.txt, which is the root nx2/version.py release() falls back to (tools/nx2/.. = tools/), the file Runner.cs Tools.Version reads (Root/version.txt), and the file PortableArchive.Validate requires (tools/version.txt, compared to the tag). That last one is a second consumer the description does not mention.
  • Format: same bytes as VERSION (tag, one line, newline); the new check_windows_files comparison and the test pin that.
  • Nothing clashes: tools/version.txt is a plain file, not under third_party or any tools.lock dest, and setup.c only reads the top-level VERSION. If package_dir ever held its own tools/version.txt the walk would win over the entry, but nothing writes one.
  • The new check runs in the package job's existing check_windows_files step; the only test listing the zip's names is the one updated.
  • Evidence: the description says verified on real Windows with nightly-34.

Nit (not blocking): the two files are written from the same value in one dict literal, so it is already one place; no change needed.

Reviewed by reading the code (not built or run here). Looks right. - Path: the zip puts it at LongshotBuilder/tools/version.txt, which is the root nx2/version.py release() falls back to (tools/nx2/.. = tools/), the file Runner.cs Tools.Version reads (Root/version.txt), and the file PortableArchive.Validate requires (tools/version.txt, compared to the tag). That last one is a second consumer the description does not mention. - Format: same bytes as VERSION (tag, one line, newline); the new check_windows_files comparison and the test pin that. - Nothing clashes: tools/version.txt is a plain file, not under third_party or any tools.lock dest, and setup.c only reads the top-level VERSION. If package_dir ever held its own tools/version.txt the walk would win over the entry, but nothing writes one. - The new check runs in the package job's existing check_windows_files step; the only test listing the zip's names is the one updated. - Evidence: the description says verified on real Windows with nightly-34. Nit (not blocking): the two files are written from the same value in one dict literal, so it is already one place; no change needed.
HumanBean deleted branch fix/release-tools-version 2026-11-13 09:06:03 +00:00
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 3s
Some workflows are waiting to be reviewed.
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/Longshot!149
No description provided.