WIP: fix(game): longshot-game's integration tests link on Windows: the version text goes through host-sys like every host call #2844

Draft
llun wants to merge 1 commit from llun/Longshot:fix/mod-api-win-version-link into mod-api
Member

Summary

For #2822 (into mod-api). On Windows, cargo test -p longshot-game stops before its integration tests run: tests/startup_layout.rs does not link, with ld.lld: error: undefined symbol: hos_version.

The cause: version_text (game/crates/longshot-game/src/host.rs) was the crate's one direct host call. It called host_sys::ffi::hos_version and used a stand-in only under cfg(test). That covers the crate's unit tests, not its integration tests, which build the library as the game does, against host-sys's fake host. There the real call stayed. On Windows the exported hos_perf_info (perf.rs) returns it, so it stays in the link, and the test program has no host to link against. Every other host call goes through host-sys, whose fake feature swaps it for a stand-in in any test build.

This adds host_sys::info::version_c, the host's static text, or a static stand-in in the fake host, beside version(), and version_text calls it. The game's own build calls hos_version as before.

To see it on mod-api: on Windows, cargo test -p longshot-game --target x86_64-pc-windows-gnullvm --tests with llvm-mingw.

Read first: version_c in game/crates/host-sys/src/info.rs.

Testing

Tested: Windows 11, RTX 5080, NVIDIA 621.40, the game confined through longshot-builder game, run 80 s with performance statistics on in that runtime only (config/longshot_perf.ini send=1, RX_VK_PERF_INTERVAL=60). Its longshot_version.txt has no perf_reports=, so the summaries stayed in perf_pending, as the log said. Both summaries say "version": "v3.2.0-152-g27818733b", the host's text through hos_perf_info → version_text → version_c → hos_version, not the stand-in. The run is on mod-api with #2726's save-folder fix and its broker change applied locally, beneath this PR: on plain mod-api a confined Windows start with a profile stops at the save folder. The summaries were deleted after.

Checks, on Windows (--target x86_64-pc-windows-gnullvm with llvm-mingw):

  • The test that fails on mod-api is the crate's own integration tests. On mod-api they do not link: undefined symbol: hos_version, could not compile longshot-game (test "startup_layout"). Here tests/registry.rs (2) and tests/startup_layout.rs (1) link and pass.
  • cargo test -p host-sys: 24 pass. cargo test -p longshot-game --lib: 165 pass. The three that fail fail the same way on mod-api: mod_tests::…a_folder_of_mods_tests_each_of_its_folders, runtime::…a_mods_profile_sits_inside_the_launchers_save_folder and runtime::…a_separate_mod_moves_the_saves_into_its_profile_and_records_it. They are Windows-only test fixtures with Unix paths, for a PR of their own.
  • cargo fmt --check and cargo clippy -p host-sys -p longshot-game --all-targets --no-deps -- -D warnings (Windows target) pass, and so does mise run lint.

Still to test:

  • Linux: cargo test -p host-sys -p longshot-game (CI)

Measurements

Verdict: fixed. longshot-game's integration tests link and run on Windows.

Baseline: mod-api (#2822's head), the branch this PR goes into. Nothing to time: the game makes the same host call.

Before: mod-api @ c5e5b676 After: this PR @ 5f3c7ea5
cargo test -p longshot-game --tests on Windows does not link (undefined symbol: hos_version) registry 2 pass, startup_layout 1 pass
The game's version text (performance summary) the host's the host's (v3.2.0-152-g27818733b)

Risks

The sandbox: not touched. The game makes the same hos_version call, a static string in its own image. The stand-in is behind host-sys's fake feature, which only test builds turn on: it is a dev-dependency feature everywhere but modtool, and the game is built alone (build-compile's cargo build -p longshot-rs, a manifest of the game's crates only), so the fake host never reaches the game.

If a build had the fake host, the version would read 0.0.0 (source test), as host-sys's other stand-ins already do. A revert is enough.

Checklist

Ready for review

  • One topic, on current mod-api (#2822's head); the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named). (The checks this change reaches pass, as above. mod-api's whole suite has failures on Windows that this PR doesn't change: #2825 and #2826 fix eight of them.)
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here. (The crate's integration tests, which fail to link on mod-api on Windows.)
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary For [#2822](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2822) (into `mod-api`). On Windows, `cargo test -p longshot-game` stops before its integration tests run: `tests/startup_layout.rs` does not link, with `ld.lld: error: undefined symbol: hos_version`. The cause: `version_text` (`game/crates/longshot-game/src/host.rs`) was the crate's one direct host call. It called `host_sys::ffi::hos_version` and used a stand-in only under `cfg(test)`. That covers the crate's unit tests, not its integration tests, which build the library as the game does, against host-sys's fake host. There the real call stayed. On Windows the exported `hos_perf_info` (`perf.rs`) returns it, so it stays in the link, and the test program has no host to link against. Every other host call goes through host-sys, whose `fake` feature swaps it for a stand-in in any test build. This adds `host_sys::info::version_c`, the host's static text, or a static stand-in in the fake host, beside `version()`, and `version_text` calls it. The game's own build calls `hos_version` as before. **To see it on `mod-api`:** on Windows, `cargo test -p longshot-game --target x86_64-pc-windows-gnullvm --tests` with llvm-mingw. Read first: `version_c` in `game/crates/host-sys/src/info.rs`. ## Testing **Tested:** Windows 11, RTX 5080, NVIDIA 621.40, the game confined through `longshot-builder game`, run 80 s with performance statistics on in that runtime only (`config/longshot_perf.ini` `send=1`, `RX_VK_PERF_INTERVAL=60`). Its `longshot_version.txt` has no `perf_reports=`, so the summaries stayed in `perf_pending`, as the log said. Both summaries say `"version": "v3.2.0-152-g27818733b"`, the host's text through `hos_perf_info` → `version_text` → `version_c` → `hos_version`, not the stand-in. The run is on `mod-api` with [#2726](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2726)'s save-folder fix and its broker change applied locally, beneath this PR: on plain `mod-api` a confined Windows start with a profile stops at the save folder. The summaries were deleted after. Checks, on Windows (`--target x86_64-pc-windows-gnullvm` with llvm-mingw): - The test that fails on `mod-api` is the crate's own integration tests. On `mod-api` they do not link: `undefined symbol: hos_version`, `could not compile longshot-game (test "startup_layout")`. Here `tests/registry.rs` (2) and `tests/startup_layout.rs` (1) link and pass. - `cargo test -p host-sys`: 24 pass. `cargo test -p longshot-game --lib`: 165 pass. The three that fail fail the same way on `mod-api`: `mod_tests::…a_folder_of_mods_tests_each_of_its_folders`, `runtime::…a_mods_profile_sits_inside_the_launchers_save_folder` and `runtime::…a_separate_mod_moves_the_saves_into_its_profile_and_records_it`. They are Windows-only test fixtures with Unix paths, for a PR of their own. - `cargo fmt --check` and `cargo clippy -p host-sys -p longshot-game --all-targets --no-deps -- -D warnings` (Windows target) pass, and so does `mise run lint`. **Still to test:** - Linux: `cargo test -p host-sys -p longshot-game` (CI) ## Measurements **Verdict:** fixed. `longshot-game`'s integration tests link and run on Windows. Baseline: `mod-api` (#2822's head), the branch this PR goes into. Nothing to time: the game makes the same host call. | | Before: mod-api @ c5e5b676 | After: this PR @ 5f3c7ea5 | |---|---|---| | `cargo test -p longshot-game --tests` on Windows | does not link (`undefined symbol: hos_version`) | registry 2 pass, startup_layout 1 pass | | The game's version text (performance summary) | the host's | the host's (`v3.2.0-152-g27818733b`) | ## Risks **The sandbox:** not touched. The game makes the same `hos_version` call, a static string in its own image. The stand-in is behind host-sys's `fake` feature, which only test builds turn on: it is a dev-dependency feature everywhere but `modtool`, and the game is built alone (`build-compile`'s `cargo build -p longshot-rs`, a manifest of the game's crates only), so the fake host never reaches the game. If a build had the fake host, the version would read `0.0.0 (source test)`, as host-sys's other stand-ins already do. A revert is enough. ## Checklist ### Ready for review - [x] One topic, on current `mod-api` (#2822's head); the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [ ] `mise run test` passes (any failure that also fails on `main` is named). (The checks this change reaches pass, as above. `mod-api`'s whole suite has failures on Windows that this PR doesn't change: [#2825](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2825) and [#2826](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2826) fix eight of them.) - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. (The crate's integration tests, which fail to link on `mod-api` on Windows.) - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(game): longshot-game's integration tests link on Windows: the version text goes through host-sys like every host call
All checks were successful
PR description / Title and description (pull_request_target) Successful in 6s
5f3c7ea5f7
version_text called hos_version itself, with a stand-in only under cfg(test): the crate's unit tests, not its
integration tests (tests/startup_layout.rs, tests/registry.rs), which build the library as the game does. There the
real call stayed, and on Windows, where the exported hos_perf_info that returns it keeps it in the link,
cargo test -p longshot-game could not link: "undefined symbol: hos_version". host_sys::info::version_c is the host's
static text, or a static stand-in in host-sys's fake host, which every test build of the crate has; the game's own build
calls the host as before.

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

Tested in the game: Windows 11, RTX 5080, NVIDIA 621.40, confined through longshot-builder game, 80 s with performance statistics on in that runtime only (no perf_reports=, so nothing was sent). Both performance summaries say "version": "v3.2.0-152-g27818733b": the host's text through hos_perf_info -> version_text -> host_sys::info::version_c -> hos_version, not the tests' stand-in. On mod-api with #2726's save-folder fix and its broker change applied locally, beneath this PR.

Tested in the game: Windows 11, RTX 5080, NVIDIA 621.40, confined through `longshot-builder game`, 80 s with performance statistics on in that runtime only (no `perf_reports=`, so nothing was sent). Both performance summaries say `"version": "v3.2.0-152-g27818733b"`: the host's text through `hos_perf_info` -> `version_text` -> `host_sys::info::version_c` -> `hos_version`, not the tests' stand-in. On `mod-api` with #2726's save-folder fix and its broker change applied locally, beneath this PR.
All checks were successful
PR description / Title and description (pull_request_target) Successful in 6s
This pull request is marked as a work in progress.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'fix/mod-api-win-version-link:llun-fix/mod-api-win-version-link'
git switch 'llun-fix/mod-api-win-version-link'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'mod-api'
git merge --no-ff 'llun-fix/mod-api-win-version-link'
git switch 'llun-fix/mod-api-win-version-link'
git rebase 'mod-api'
git switch 'mod-api'
git merge --ff-only 'llun-fix/mod-api-win-version-link'
git switch 'llun-fix/mod-api-win-version-link'
git rebase 'mod-api'
git switch 'mod-api'
git merge --no-ff 'llun-fix/mod-api-win-version-link'
git switch 'mod-api'
git merge --squash 'llun-fix/mod-api-win-version-link'
git switch 'mod-api'
git merge --ff-only 'llun-fix/mod-api-win-version-link'
git switch 'mod-api'
git merge 'llun-fix/mod-api-win-version-link'
git push origin 'mod-api'
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!2844
No description provided.