Use the same Cargo lookup for play, build and the game gate #3263

Open
merzleckeier wants to merge 5 commits from upstream-pr/3263 into main
merzleckeier commented 2026-12-02 23:13:22 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T23:13:22Z.


Claimed in the coordination issue as LAUNCHER-DIRECT-CARGO-HOME.

Depends on: #3187

Overlaps #3220 in the direct launcher’s build preflight. If #3220 lands first, the rebase also needs to copy the shared lookup into its synthetic checkout.

What and why

A Rust installation in CARGO_HOME/bin or the default .cargo/bin can be unavailable on an already-open shell’s PATH. #3187 teaches the build script to find it. The direct launcher was still checking PATH alone, so it could stop before the first build or skip a needed DLSS rebuild.

Share the lookup between the direct launcher, the build script and the game gate. The gate can then reject a rebuild before recording the executable’s hash and features. The probe preserves PATH and the build keeps its existing preference for Cargo already on PATH.

This draft includes #3187 for integration testing against main. The follow-up itself is commit 2d0fc7240.

Tested

  • In Linux PowerShell 7, the direct first-build test and the DLSS preview test both failed with the old launcher and passed with the fix. The game-gate test failed with its old preflight and passed with the shared lookup. Its -NoDlss case verifies that PATH stays unchanged.
  • test_build_nvidia_cargo.py passed five tests with two Windows-only skips. test_game_gate.py passed 35. test_win_launchers.py passed four with five Windows-only skips. The independent read-only review was rerun after incorporating its gate finding.
  • git diff --check and the clean-room scan passed. No runtime, game, or GPU was used for the local tests.
  • Hosted CI passed all six checks on 9c2e340b. The Windows check ran all seven Cargo build-preflight tests, all 16 menu-choice tests and all nine Windows-launcher tests. The D3D12 Windows job also passed.

GPUs tested: n/a

AI-assisted: OpenAI Codex (GPT-6 family) and a separate read-only Codex reviewer.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5616406939 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3263). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-02T23:13:22Z. --- Claimed in the coordination issue as [LAUNCHER-DIRECT-CARGO-HOME](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7361566968). Depends on: #3187 Overlaps #3220 in the direct launcher’s build preflight. If #3220 lands first, the rebase also needs to copy the shared lookup into its synthetic checkout. ### What and why A Rust installation in `CARGO_HOME/bin` or the default `.cargo/bin` can be unavailable on an already-open shell’s `PATH`. #3187 teaches the build script to find it. The direct launcher was still checking `PATH` alone, so it could stop before the first build or skip a needed DLSS rebuild. Share the lookup between the direct launcher, the build script and the game gate. The gate can then reject a rebuild before recording the executable’s hash and features. The probe preserves `PATH` and the build keeps its existing preference for Cargo already on `PATH`. This draft includes #3187 for integration testing against `main`. The follow-up itself is commit `2d0fc7240`. ### Tested - In Linux PowerShell 7, the direct first-build test and the DLSS preview test both failed with the old launcher and passed with the fix. The game-gate test failed with its old preflight and passed with the shared lookup. Its `-NoDlss` case verifies that `PATH` stays unchanged. - `test_build_nvidia_cargo.py` passed five tests with two Windows-only skips. `test_game_gate.py` passed 35. `test_win_launchers.py` passed four with five Windows-only skips. The independent read-only review was rerun after incorporating its gate finding. - `git diff --check` and the clean-room scan passed. No runtime, game, or GPU was used for the local tests. - Hosted CI passed all six checks on `9c2e340b`. The [Windows check](https://github.com/ProjectLeonida/mandy/actions/runs/46994375438/job/143869896728) ran all seven Cargo build-preflight tests, all 16 menu-choice tests and all nine Windows-launcher tests. The [D3D12 Windows job](https://github.com/ProjectLeonida/mandy/actions/runs/46994375133/job/143869657528) also passed. GPUs tested: n/a AI-assisted: OpenAI Codex (GPT-6 family) and a separate read-only Codex reviewer.
merzleckeier commented 2026-12-02 23:47:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T23:47:00Z.


Hosted CI passed all six checks on 9c2e340b, after syncing main at 81efe4566. The Windows check log shows test_build_nvidia_cargo.py ran all seven tests with no skips. It also shows all 16 menu-choice and nine Windows launcher tests passing. The separate D3D12 job passed, including all 47 Lua tests. This supplies the native Windows coverage that was pending in the draft description. The dependency on #3187 is still open.

Windows launcher tests · D3D12 Windows. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7362419708 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3263#issuecomment-7362419708). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-02T23:47:00Z. --- Hosted CI passed all six checks on `9c2e340b`, after syncing `main` at `81efe4566`. The Windows `check` log shows `test_build_nvidia_cargo.py` ran all seven tests with no skips. It also shows all 16 menu-choice and nine Windows launcher tests passing. The separate D3D12 job passed, including all 47 Lua tests. This supplies the native Windows coverage that was pending in the draft description. The dependency on #3187 is still open. [Windows launcher tests](https://github.com/ProjectLeonida/mandy/actions/runs/46994375438/job/143869896728) · [D3D12 Windows](https://github.com/ProjectLeonida/mandy/actions/runs/46994375133/job/143869657528). AI-assisted.
merzleckeier commented 2026-12-02 23:52:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T23:52:51Z.


I tested the merge order locally on main at 81efe4566, combining this draft (9c2e340b, including #3187) with #3220 (0beb7d26). The one content conflict is in play-nvidia.ps1. Keeping $needsBuild and the shared Cargo lookup from this draft alongside exit 1 from #3220 resolves the launcher hunk.

The new #3220 test auto-merges but its synthetic checkout omits find-cargo.ps1. I reproduced the resulting missing-script error in the no-Cargo case. Copying CARGO_LOOKUP beside the launcher and pointing CARGO_HOME at an empty fixture directory restores the intended diagnostic and status 1.

Linux PowerShell 7.7.0 ran test_win_launchers, test_build_nvidia_cargo and test_game_gate on the combined tree. 45 passed and seven Windows-only cases were skipped. That includes all seven preflight failures, the dry-run preview, and direct first-build discovery with Cargo available only in CARGO_HOME/bin. This was a synthetic local merge. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7362535762 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3263#issuecomment-7362535762). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-02T23:52:51Z. --- I tested the merge order locally on `main` at `81efe4566`, combining this draft (`9c2e340b`, including #3187) with #3220 (`0beb7d26`). The one content conflict is in `play-nvidia.ps1`. Keeping `$needsBuild` and the shared Cargo lookup from this draft alongside `exit 1` from #3220 resolves the launcher hunk. The new #3220 test auto-merges but its synthetic checkout omits `find-cargo.ps1`. I reproduced the resulting missing-script error in the no-Cargo case. Copying `CARGO_LOOKUP` beside the launcher and pointing `CARGO_HOME` at an empty fixture directory restores the intended diagnostic and status 1. Linux PowerShell 7.7.0 ran `test_win_launchers`, `test_build_nvidia_cargo` and `test_game_gate` on the combined tree. 45 passed and seven Windows-only cases were skipped. That includes all seven preflight failures, the dry-run preview, and direct first-build discovery with Cargo available only in `CARGO_HOME/bin`. This was a synthetic local merge. AI-assisted.
fiestorra commented 2026-12-03 00:06:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T00:06:27Z.


VERIFY-3263 — Windows nativo: ejercité el script, con una medida que no es concluyente y lo digo

Own commit 2d0fc7240 — d3d12/scripts/find-cargo.ps1 (new, 15), build-nvidia.ps1 (8 lines)

What it adds: one find-cargo.ps1 shared by play/build/gate — report whether cargo is available even if this shell predates the install, and only a build keeps $CARGO_HOME\bin on PATH after checking (-AddToPath).

Exercised here (pwsh -NoProfile, calling the script by path — dot-sourcing does not work, it has a param block, which is the first thing I got wrong):

con cargo en PATH:        plain=True  · PATH intacto
                          conSwitch=True · PATH intacto

Second run, with PATH cut to system32 only and CARGO_HOME pointed at the real one:

plain=True · plainRestaura=True · conSwitch=True · switchDejaCargo=True

So the two behaviours are real: the plain call restores PATH and -AddToPath leaves it changed — and both find cargo.

Where I have to be careful, and this is the honest part: the same run printed cargoVisibleAntes=True, so my "no cargo on PATH" control was not clean — either PowerShell resolved cargo from somewhere other than PATH, or the early if (Get-Command cargo) { return $true } did not fire and something else made the numbers match. The switchDejaCargo=True says the script did go past the early return, which contradicts my outer measurement — I could not reconcile the two in the time this pass allowed, and I am not going to present it as a clean negative control.

What I can say with confidence: the script is syntactically valid, runs, returns a boolean in both modes, and the PATH restore/save distinction behaves as the comment says — in a shell whose PATH I had already cut. What I miscounted is whether cargo was truly invisible to it.

What I could not test

  • build-nvidia.ps1 consuming it: that needs a build with the title's toolchain.
  • The clean "no cargo anywhere" case: see above.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7362802546 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3263#issuecomment-7362802546). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T00:06:27Z. --- ## VERIFY-3263 — Windows nativo: **ejercité el script**, con una medida que no es concluyente y lo digo | | | |---|---| | Own commit | `2d0fc7240` — `d3d12/scripts/find-cargo.ps1` (new, 15), `build-nvidia.ps1` (8 lines) | **What it adds**: one `find-cargo.ps1` shared by play/build/gate — **report whether `cargo` is available even if this shell predates the install**, and **only a build keeps `$CARGO_HOME\bin` on `PATH` after checking** (`-AddToPath`). **Exercised here** (`pwsh -NoProfile`, calling the script by path — **dot-sourcing does not work, it has a `param` block**, which is the first thing I got wrong): ``` con cargo en PATH: plain=True · PATH intacto conSwitch=True · PATH intacto ``` **Second run, with `PATH` cut to `system32` only and `CARGO_HOME` pointed at the real one**: ``` plain=True · plainRestaura=True · conSwitch=True · switchDejaCargo=True ``` **So the two behaviours are real**: **the plain call restores `PATH`** and **`-AddToPath` leaves it changed** — **and both find cargo.** **Where I have to be careful, and this is the honest part**: the same run printed `cargoVisibleAntes=True`, **so my "no cargo on PATH" control was not clean** — either PowerShell resolved `cargo` from somewhere other than `PATH`, **or the early `if (Get-Command cargo) { return $true }` did not fire and something else made the numbers match.** **The `switchDejaCargo=True` says the script did go past the early return**, **which contradicts my outer measurement** — **I could not reconcile the two in the time this pass allowed, and I am not going to present it as a clean negative control.** **What I can say with confidence**: the script **is syntactically valid, runs, returns a boolean in both modes, and the `PATH` restore/save distinction behaves as the comment says** — **in a shell whose `PATH` I had already cut.** **What I miscounted is whether cargo was truly invisible to it.** ## What I could not test - **`build-nvidia.ps1` consuming it**: that needs a build with the title's toolchain. - **The clean "no cargo anywhere" case**: see above. Written with an AI assistant.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3263:upstream-pr/3263'
git switch 'upstream-pr/3263'

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 'main'
git merge --no-ff 'upstream-pr/3263'
git switch 'upstream-pr/3263'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3263'
git switch 'upstream-pr/3263'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3263'
git switch 'main'
git merge --squash 'upstream-pr/3263'
git switch 'main'
git merge --ff-only 'upstream-pr/3263'
git switch 'main'
git merge 'upstream-pr/3263'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!3263
No description provided.