fix(builder): keep the Windows executable out of its link key #2872

Merged
HumanBean merged 2 commits from futondestroyer/Longshot:codex/fix-windows-builder-relink into main 2026-12-01 00:41:16 +00:00
Member

Summary

When a Windows profile build reaches the link check with its working directory on the same drive as longshot.exe, Builder can relink after an unchanged build. Its option parser splits the drive colon in the output argument. The remaining rooted path resolves to the same executable, so the key includes the bytes of its previous output.

link_inputs now skips the known output argument before parsing option values. It still tracks actual inputs, including files passed through an option, and the cache still checks the linked outputs separately. The Windows regression uses a drive-qualified output and a real /order input.

The reviewed branch was built from main ae32c0dd. Main advanced to 28cb22b9 with a renderer fix. The integration preview is clean and the Builder source, Cargo manifests, lockfiles, and developer guidance are unchanged between those main revisions.

Testing

Tested: Two same-drive Windows profile builds on the reproducing fork revision f5a30063 each cached all 928 native units and relinked. The trace found 51 matching linker arguments and exactly one changing key input, the preceding executable. The source of link.rs at that revision matches official main ae32c0dd. The same fix hunk in the diagnostic Builder removed that input. After one link to replace the old record, both unchanged profile builds cached all 928 units, matched the new key and skipped the link.

The Windows regression failed on test-only commit f45ea82c with the output alias present. It passed on dd1bc038 from a fresh Cargo target directory, along with both existing link input tests. The full build-compile --lib run had 57 passes and two toolchain fixture failures also observed with the baseline binary in this environment. the_builder_s_llvm_comes_before_emsdk_and_the_path picked the installed clang.exe instead of the fixture's extensionless compiler. a_windows_link_of_the_same_inputs_makes_the_same_bytes stopped when Clang could not execute the linker for the fixture's MSVC target. Independent cold source review of the exact base and candidate found no blockers.

Forgejo run 58276 passed six jobs. The Linux Rust workspace tests and synthetic end-to-end test passed inside the Rust job. Its red status comes from two existing Clippy diagnostics in exe_resources for needless borrows of the ICO paths. Exact main and the head have the same source at those lines. Current main reproduced the Guide screenshot source drift and the Website's missing Simulated turf visibility condition. CI run

Across the two Linux game-free jobs, 34 failures have matching normalized first diagnostics on #2865, #2866 and #2872. The five additional #2872 fixtures are test_blocks_at_start.py, test_image_reaper_threads.py, test_readback_timeout_reuse.py, test_target_retention.py, and test_vram_compact.py. Their diagnostics concern the newer renderer allocator and eviction source. #2865 run · #2866 run

The full Windows strict suite used the same command and tool setup on current main 28cb22b9 and exact head dd1bc038, with separate Cargo target and scratch directories. Main had 811 passes, 56 failures and 48 skips. The PR had 813 passes, 54 failures and 48 skips. All 54 PR failures also failed on main with the same normalized diagnostic, and the skip sets matched. Two checks failed on main only, test_longshot_ctl.py and test_memtour.py. The separate Rust formatting preflight had the same existing toolchain.rs diff on both. Debug and release Builder preflights completed on both. All five additional fixtures from the Linux CI comparison also failed on this shared Windows main control, with matching failures on the Windows candidate.

54 matching Windows failures
  • tests/test_auto_handheld.py
  • tests/test_blocks_at_start.py
  • tests/test_bug_report.py
  • tests/test_builder_channel.py
  • tests/test_control_picture.py
  • tests/test_coverage_run.py
  • tests/test_crash_record.py
  • tests/test_crt_options.py
  • tests/test_dev_ab.py
  • tests/test_dev_build.py
  • tests/test_dev_migrate.py
  • tests/test_dev_packs.py
  • tests/test_dev_update.py
  • tests/test_framegen_hdr.py
  • tests/test_framegen_resources.py
  • tests/test_fs_path_utf8.py
  • tests/test_game_boundary.py
  • tests/test_image_reaper_threads.py
  • tests/test_image_view_retry.py
  • tests/test_input_background.py
  • tests/test_keyboard_menu_option.py
  • tests/test_keyboard_option.py
  • tests/test_lifter.py
  • tests/test_linux_pressure.py
  • tests/test_loaded_modules_drop.py
  • tests/test_log_batch.py
  • tests/test_log_levels.py
  • tests/test_menu_keys.py
  • tests/test_mods_list.py
  • tests/test_oot_menu_mouse.py
  • tests/test_oot_state_tap.py
  • tests/test_option_ids.py
  • tests/test_parity_gates.py
  • tests/test_perf_send.py
  • tests/test_present_source_crop.py
  • tests/test_profile_symbols.py
  • tests/test_program_cache_cleanup.py
  • tests/test_program_cache_one_variant.py
  • tests/test_program_cache_store_record.py
  • tests/test_readback_timeout_reuse.py
  • tests/test_run_all_mingw.py
  • tests/test_screensaver.py
  • tests/test_switch_table.py
  • tests/test_target_retention.py
  • tests/test_temporal_present_bandwidth.py
  • tests/test_text_keyboard_policy.py
  • tests/test_upscaler_round_trip.py
  • tests/test_vcore_video_acquire.py
  • tests/test_video_catchup.py
  • tests/test_video_hold_early.py
  • tests/test_video_input_limit.py
  • tests/test_vram_compact.py
  • tests/test_windows_display_startup.py
  • tests/test_windows_on_linux.py

Still to test:

  • Resolve the Linux CI comparison. The current-main Actions status links point to run 58267, whose logs are unavailable (by hand).

Measurements

Verdict: Two repeated links became zero. Both sides compiled zero native units.

Setup: The same warmed Windows profile on the same drive as Builder's working directory. The diagnostic replay used the identical link.rs blob from f5a30063 and main, then applied the PR's fix hunk.

Windows profile builds after warming the link record Before: main @ ae32c0dd After: this PR @ dd1bc038
Game executable links across two unchanged builds 2 0
Native units compiled across two unchanged builds 0 0

Instrumented runs are unsuitable for comparing elapsed time.

Risks

A previously affected record can miss once because its old key included the executable. The link then writes the new key. Output metadata and every actual linker input remain checked.

Checklist

Ready for review

  • One topic, on current main; 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).
  • 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.
  • AI assistance recorded with Assisted-by: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested.
  • 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.
## Summary When a Windows profile build reaches the link check with its working directory on the same drive as `longshot.exe`, Builder can relink after an unchanged build. Its option parser splits the drive colon in the output argument. The remaining rooted path resolves to the same executable, so the key includes the bytes of its previous output. `link_inputs` now skips the known output argument before parsing option values. It still tracks actual inputs, including files passed through an option, and the cache still checks the linked outputs separately. The Windows regression uses a drive-qualified output and a real `/order` input. The reviewed branch was built from main `ae32c0dd`. Main advanced to `28cb22b9` with a renderer fix. The integration preview is clean and the Builder source, Cargo manifests, lockfiles, and developer guidance are unchanged between those main revisions. ## Testing **Tested:** Two same-drive Windows profile builds on the reproducing fork revision `f5a30063` each cached all 928 native units and relinked. The trace found 51 matching linker arguments and exactly one changing key input, the preceding executable. The source of `link.rs` at that revision matches official main `ae32c0dd`. The same fix hunk in the diagnostic Builder removed that input. After one link to replace the old record, both unchanged profile builds cached all 928 units, matched the new key and skipped the link. The Windows regression failed on test-only commit `f45ea82c` with the output alias present. It passed on `dd1bc038` from a fresh Cargo target directory, along with both existing link input tests. The full `build-compile --lib` run had 57 passes and two toolchain fixture failures also observed with the baseline binary in this environment. `the_builder_s_llvm_comes_before_emsdk_and_the_path` picked the installed `clang.exe` instead of the fixture's extensionless compiler. `a_windows_link_of_the_same_inputs_makes_the_same_bytes` stopped when Clang could not execute the linker for the fixture's MSVC target. Independent cold source review of the exact base and candidate found no blockers. Forgejo run 58276 passed six jobs. The Linux Rust workspace tests and synthetic end-to-end test passed inside the Rust job. Its red status comes from two existing Clippy diagnostics in `exe_resources` for needless borrows of the ICO paths. Exact main and the head have the same source at those lines. Current main reproduced the Guide screenshot source drift and the Website's missing Simulated turf visibility condition. [CI run](https://git.magicbean.dev/MagicBeanDev/Longshot/actions/runs/58276) Across the two Linux game-free jobs, 34 failures have matching normalized first diagnostics on #2865, #2866 and #2872. The five additional #2872 fixtures are `test_blocks_at_start.py`, `test_image_reaper_threads.py`, `test_readback_timeout_reuse.py`, `test_target_retention.py`, and `test_vram_compact.py`. Their diagnostics concern the newer renderer allocator and eviction source. [#2865 run](https://git.magicbean.dev/MagicBeanDev/Longshot/actions/runs/58215) · [#2866 run](https://git.magicbean.dev/MagicBeanDev/Longshot/actions/runs/58217) The full Windows strict suite used the same command and tool setup on current main `28cb22b9` and exact head `dd1bc038`, with separate Cargo target and scratch directories. Main had 811 passes, 56 failures and 48 skips. The PR had 813 passes, 54 failures and 48 skips. All 54 PR failures also failed on main with the same normalized diagnostic, and the skip sets matched. Two checks failed on main only, `test_longshot_ctl.py` and `test_memtour.py`. The separate Rust formatting preflight had the same existing `toolchain.rs` diff on both. Debug and release Builder preflights completed on both. All five additional fixtures from the Linux CI comparison also failed on this shared Windows main control, with matching failures on the Windows candidate. <details> <summary>54 matching Windows failures</summary> - `tests/test_auto_handheld.py` - `tests/test_blocks_at_start.py` - `tests/test_bug_report.py` - `tests/test_builder_channel.py` - `tests/test_control_picture.py` - `tests/test_coverage_run.py` - `tests/test_crash_record.py` - `tests/test_crt_options.py` - `tests/test_dev_ab.py` - `tests/test_dev_build.py` - `tests/test_dev_migrate.py` - `tests/test_dev_packs.py` - `tests/test_dev_update.py` - `tests/test_framegen_hdr.py` - `tests/test_framegen_resources.py` - `tests/test_fs_path_utf8.py` - `tests/test_game_boundary.py` - `tests/test_image_reaper_threads.py` - `tests/test_image_view_retry.py` - `tests/test_input_background.py` - `tests/test_keyboard_menu_option.py` - `tests/test_keyboard_option.py` - `tests/test_lifter.py` - `tests/test_linux_pressure.py` - `tests/test_loaded_modules_drop.py` - `tests/test_log_batch.py` - `tests/test_log_levels.py` - `tests/test_menu_keys.py` - `tests/test_mods_list.py` - `tests/test_oot_menu_mouse.py` - `tests/test_oot_state_tap.py` - `tests/test_option_ids.py` - `tests/test_parity_gates.py` - `tests/test_perf_send.py` - `tests/test_present_source_crop.py` - `tests/test_profile_symbols.py` - `tests/test_program_cache_cleanup.py` - `tests/test_program_cache_one_variant.py` - `tests/test_program_cache_store_record.py` - `tests/test_readback_timeout_reuse.py` - `tests/test_run_all_mingw.py` - `tests/test_screensaver.py` - `tests/test_switch_table.py` - `tests/test_target_retention.py` - `tests/test_temporal_present_bandwidth.py` - `tests/test_text_keyboard_policy.py` - `tests/test_upscaler_round_trip.py` - `tests/test_vcore_video_acquire.py` - `tests/test_video_catchup.py` - `tests/test_video_hold_early.py` - `tests/test_video_input_limit.py` - `tests/test_vram_compact.py` - `tests/test_windows_display_startup.py` - `tests/test_windows_on_linux.py` </details> **Still to test:** - Resolve the Linux CI comparison. The current-main Actions status links point to run 58267, whose logs are unavailable (by hand). ## Measurements **Verdict:** Two repeated links became zero. Both sides compiled zero native units. Setup: The same warmed Windows profile on the same drive as Builder's working directory. The diagnostic replay used the identical `link.rs` blob from `f5a30063` and main, then applied the PR's fix hunk. | Windows profile builds after warming the link record | Before: main @ ae32c0dd | After: this PR @ dd1bc038 | |---|---:|---:| | Game executable links across two unchanged builds | 2 | 0 | | Native units compiled across two unchanged builds | 0 | 0 | Instrumented runs are unsuitable for comparing elapsed time. ## Risks A previously affected record can miss once because its old key included the executable. The link then writes the new key. Output metadata and every actual linker input remain checked. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [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. - [x] AI assistance recorded with `Assisted-by:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested. - [ ] 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.
Assisted-by: Codex (GPT-6)
fix(builder): exclude the Windows link output before parsing options
Some checks failed
CI / What the change needs (pull_request) Successful in 9s
CI / Third-party parts and guide screenshots (pull_request) Failing after 13s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 12s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 3m52s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m25s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 4m19s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 3m55s
CI / Website build and checks (pull_request) Failing after 32s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 22m17s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 36m48s
PR description / Title and description (pull_request_target) Failing after 6s
dd1bc0382b
Assisted-by: Codex (GPT-6)
Author
Member

Windows verification at dd1bc038: the regression failed on f45ea82c for the output alias and passed in a fresh Cargo target on the candidate. The crate had 57 passes and the same two toolchain fixture failures seen with the baseline binary. In the corrected same-drive profile replay, one link replaced the old record and both warmed repeats skipped the link with zero objects compiled.

Windows verification at dd1bc038: the regression failed on f45ea82c for the output alias and passed in a fresh Cargo target on the candidate. The crate had 57 passes and the same two toolchain fixture failures seen with the baseline binary. In the corrected same-drive profile replay, one link replaced the old record and both warmed repeats skipped the link with zero objects compiled.
Author
Member

Current main 28cb22b9 integrates cleanly with dd1bc038 and leaves all tested Builder paths identical. CI logs match 34 Linux game-free failures across #2865, #2866 and #2872. Five additional #2872 fixtures fail in the newer renderer allocator and eviction code. Exact main reproduces the Guide source drift and the Simulated turf Website check. The local full Windows suite and one shared exact-main control are running. Main Actions run 58267 has pending statuses and no downloadable job logs.

Current main 28cb22b9 integrates cleanly with dd1bc038 and leaves all tested Builder paths identical. CI logs match 34 Linux game-free failures across #2865, #2866 and #2872. Five additional #2872 fixtures fail in the newer renderer allocator and eviction code. Exact main reproduces the Guide source drift and the Simulated turf Website check. The local full Windows suite and one shared exact-main control are running. Main Actions run 58267 has pending statuses and no downloadable job logs.
Author
Member

Matched Windows strict suites completed. Exact main 28cb22b9 returned 811 passed, 56 failed and 48 skipped. Published head dd1bc038 returned 813 passed, 54 failed and 48 skipped. Every head failure has the same normalized diagnostic on main, including the five additional renderer fixtures from the Linux CI comparison. The skip sets match. This clears the local readiness gate. The existing Linux CI findings remain recorded separately.

Matched Windows strict suites completed. Exact main 28cb22b9 returned 811 passed, 56 failed and 48 skipped. Published head dd1bc038 returned 813 passed, 54 failed and 48 skipped. Every head failure has the same normalized diagnostic on main, including the five additional renderer fixtures from the Linux CI comparison. The skip sets match. This clears the local readiness gate. The existing Linux CI findings remain recorded separately.
futondestroyer changed title from WIP: fix(builder): keep the Windows executable out of its link key to fix(builder): keep the Windows executable out of its link key 2026-11-30 14:36:27 +00:00
Owner
@review
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left. The reported Windows reproducer stopped relinking on both unchanged builds, and the regression test exercises the drive-colon failure. The build-time measurements required for a builder cache change are still missing. Recommend approval; not approved on the forge.

Builder skips its known output argument before parsing linker options, so an unchanged Windows profile build can reuse its link record instead of hashing and relinking its own executable. The change is small and retains separate output checks.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L1 builder/crates/build-compile/src/link.rs:58: The required build-time comparison is missing for this cache change. (more on the line) Do: Measure clean, unchanged and one-function-change builds on the same Windows setup against the base, with repeated runs and build sizes, and report the results.

Checks: Failing on this head, which is behind its base, where they pass: CI / Third-party parts and guide screenshots (pull_request), CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request), CI / Website build and checks (pull_request), CI / Game-free checks (run_all.py, part 1/2) (pull_request), CI / Game-free checks (run_all.py, part 2/2) (pull_request), PR description / Title and description (pull_request_target). @rebase (or @fix) brings it up to date and runs them again; not held against it.

More: does it help, other systems, switches, what was read

Does it help: Yes for the reported case: two unchanged Windows profile builds relinked twice before the fix and zero times after it, with zero native units compiled on either side. The PR reports that the regression test failed before the fix and passed after it; elapsed build-time savings were not measured.

Other systems: The same function serves the game, renderer, Windows DLSS forwarder and Linux shader-preparation links. Their callers pass the output as a separate argument and also check output metadata; the change does not alter game runtime, GPU, audio, input or save code. Linux and Windows build-time effects beyond the reported Windows replay are not measured.

Switches: None.

Reviewed: dd1bc0382b against ae32c0dd3c: Read AGENTS.md, CONTRIBUTING.md, the PR template, the changed link.rs in full, its diff and commits, and the link callers and command construction around the change. Read the applicable builder and standards guidance; skimmed the longer build and builder reference pages. docs/review-checklist.md and ../Tooling/AGENTS.md are absent from the checkout. No generated files or translations changed.; nothing run (a code review).

Checked and fine:

  • Both commits record AI assistance with Assisted-by trailers.
  • The Windows test uses existing repository files, checks a real option input as well as the output, and would fail when the added early skip is removed.
  • The diff contains no game-derived files, generated files, API changes or third-party changes.
  • The CI report identifies no check failing only on this head.

Testing: Read-only review; no commands from the project, builds or tests were run. The PR reports a passing Windows regression and two successful unchanged-build replays. Its Linux CI comparison remains listed as still to test.

Overlaps and merge order: Not checked; the network is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The code is ready: only testing is left. The reported Windows reproducer stopped relinking on both unchanged builds, and the regression test exercises the drive-colon failure. The build-time measurements required for a builder cache change are still missing. Recommend approval; not approved on the forge. Builder skips its known output argument before parsing linker options, so an unchanged Windows profile build can reuse its link record instead of hashing and relinking its own executable. The change is small and retains separate output checks. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L1** `builder/crates/build-compile/src/link.rs:58`: The required build-time comparison is missing for this cache change. (more on the line) **Do:** Measure clean, unchanged and one-function-change builds on the same Windows setup against the base, with repeated runs and build sizes, and report the results. **Checks:** Failing on this head, which is behind its base, where they pass: `CI / Third-party parts and guide screenshots (pull_request)`, `CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request)`, `CI / Website build and checks (pull_request)`, `CI / Game-free checks (run_all.py, part 1/2) (pull_request)`, `CI / Game-free checks (run_all.py, part 2/2) (pull_request)`, `PR description / Title and description (pull_request_target)`. `@rebase` (or `@fix`) brings it up to date and runs them again; not held against it. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the reported case: two unchanged Windows profile builds relinked twice before the fix and zero times after it, with zero native units compiled on either side. The PR reports that the regression test failed before the fix and passed after it; elapsed build-time savings were not measured. **Other systems:** The same function serves the game, renderer, Windows DLSS forwarder and Linux shader-preparation links. Their callers pass the output as a separate argument and also check output metadata; the change does not alter game runtime, GPU, audio, input or save code. Linux and Windows build-time effects beyond the reported Windows replay are not measured. **Switches:** None. **Reviewed:** dd1bc0382b5f against ae32c0dd3cd7: Read AGENTS.md, CONTRIBUTING.md, the PR template, the changed link.rs in full, its diff and commits, and the link callers and command construction around the change. Read the applicable builder and standards guidance; skimmed the longer build and builder reference pages. docs/review-checklist.md and ../Tooling/AGENTS.md are absent from the checkout. No generated files or translations changed.; nothing run (a code review). **Checked and fine:** - Both commits record AI assistance with Assisted-by trailers. - The Windows test uses existing repository files, checks a real option input as well as the output, and would fail when the added early skip is removed. - The diff contains no game-derived files, generated files, API changes or third-party changes. - The CI report identifies no check failing only on this head. **Testing:** Read-only review; no commands from the project, builds or tests were run. The PR reports a passing Windows regression and two successful unchanged-build replays. Its Linux CI comparison remains listed as still to test. **Overlaps and merge order:** Not checked; the network is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -55,2 +55,4 @@
let (mut objs, mut others) = (Vec::new(), Vec::new());
for arg in cmd {
// Skip the output before a Windows drive colon can be parsed as an option delimiter.
if Path::new(arg) == output {
Member

L1 (should fix): The required build-time comparison is missing for this cache change.

When: The reported replay counts avoided links but explicitly cannot compare elapsed time, so it does not show the time saved on an unchanged build or the effect on clean and one-function-change builds.

Do: Measure clean, unchanged and one-function-change builds on the same Windows setup against the base, with repeated runs and build sizes, and report the results.

**L1** (should fix): The required build-time comparison is missing for this cache change. *When:* The reported replay counts avoided links but explicitly cannot compare elapsed time, so it does not show the time saved on an unchanged build or the effect on clean and one-function-change builds. **Do:** Measure clean, unchanged and one-function-change builds on the same Windows setup against the base, with repeated runs and build sizes, and report the results.
HumanBean deleted branch codex/fix-windows-builder-relink 2026-12-01 00:41:16 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 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!2872
No description provided.