leonida-lua: the dangling-link test builds against the infallible Runtime::new (D3D12-LUA-TESTS-BUILD) #3237

Closed
github-bot wants to merge 1 commit from github-bot/gh-3237 into main AGit
Owner

@⁠LouisRiverstone on GitHub · 2026-12-02 21:53 UTC · original
LouisRiverstone:fix/leonida-lua-tests-build → main · +1 −1 · 1 files · 1 commits · closed without merging

Claim: #2570 (D3D12-LUA-TESTS-BUILD), fixing OreoFR's finding that main no longer builds the d3d12 tests.

Why

Since bc20b75ba, main fails d3d12 (windows-latest) with error[E0599]: no method named 'unwrap' found for struct 'Runtime' at d3d12/crates/leonida-lua/src/tests.rs:1089, and so does every pull request that touches d3d12/. It is a merge race:

  • #3189 added the dangling-link test against the old fallible Runtime::new.
  • #3179 (057cc94d8, "Runtime::new cannot fail any more") changed new to return Runtime (runtime.rs:157), because each mod now gets its own Lua state at load time.

What changed

The test drops the .unwrap(). new stays infallible, as #3179 intended.

Verification (Windows 11, pinned toolchain)

  • cargo test -p leonida-lua --locked: 46 passed. Without the change, the crate's tests do not compile; main's own run on bc20b75ba/f3865cae8 shows the same E0599.
  • cargo build --workspace --all-targets --locked: builds.
  • No other Runtime::new(...) call uses ?, .unwrap() or .expect( (13 calls checked).

AI assistance

AI-assisted: written with Claude Code (Claude Opus 5.5). It was reviewed by a separate read-only reviewer agent (Claude Opus 5.5), which confirmed #3179's intent, that the test still checks #3189's dangling-link behaviour under per-mod states, and that no other old-API use is left. It found nothing blocking.

🤖 Generated with Claude Code

**@⁠LouisRiverstone** on GitHub · 2026-12-02 21:53 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/3237) `LouisRiverstone:fix/leonida-lua-tests-build` → `main` · +1 −1 · 1 files · 1 commits · closed without merging Claim: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/2570 (D3D12-LUA-TESTS-BUILD), fixing OreoFR's finding that `main` no longer builds the d3d12 tests. ## Why Since bc20b75ba, `main` fails `d3d12 (windows-latest)` with `error[E0599]: no method named 'unwrap' found for struct 'Runtime'` at `d3d12/crates/leonida-lua/src/tests.rs:1089`, and so does every pull request that touches `d3d12/`. It is a merge race: - #3189 added the dangling-link test against the old fallible `Runtime::new`. - #3179 (057cc94d8, "Runtime::new cannot fail any more") changed `new` to return `Runtime` (`runtime.rs:157`), because each mod now gets its own Lua state at load time. ## What changed The test drops the `.unwrap()`. `new` stays infallible, as #3179 intended. ## Verification (Windows 11, pinned toolchain) - `cargo test -p leonida-lua --locked`: 46 passed. Without the change, the crate's tests do not compile; `main`'s own run on bc20b75ba/f3865cae8 shows the same E0599. - `cargo build --workspace --all-targets --locked`: builds. - No other `Runtime::new(...)` call uses `?`, `.unwrap()` or `.expect(` (13 calls checked). ## AI assistance AI-assisted: written with Claude Code (Claude Opus 5.5). It was reviewed by a separate read-only reviewer agent (Claude Opus 5.5), which confirmed #3179's intent, that the test still checks #3189's dangling-link behaviour under per-mod states, and that no other old-API use is left. It found nothing blocking. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
#3189's new test called .unwrap() on Runtime::new, which #3179
(057cc94d8) made infallible, so main stopped building the crate's tests
(E0599) after both merged. Drop the .unwrap().

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 21:57:56 +00:00
Author
Owner

@⁠merzleckeier on GitHub · 2026-12-02 21:58 UTC · original · reviewed

Reviewed efc64a091 against main at f3865cae8. In an isolated checkout with Rust 1.98.1 on Linux, cargo test -p leonida-lua --locked --offline --no-run reproduced E0599 from the D3D12 CI job at tests.rs:1089. With just this PR’s one-line change applied, the same command built the test executable successfully. The edit matches the current Runtime::new return type and leaves the test assertions intact. This was a compile-only check.

**@⁠merzleckeier** on GitHub · 2026-12-02 21:58 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/3237#pullrequestreview-6159766972) · **reviewed** Reviewed `efc64a091` against `main` at `f3865cae8`. In an isolated checkout with Rust 1.98.1 on Linux, `cargo test -p leonida-lua --locked --offline --no-run` reproduced `E0599` from the D3D12 CI job at `tests.rs:1089`. With just this PR’s one-line change applied, the same command built the test executable successfully. The edit matches the current `Runtime::new` return type and leaves the test assertions intact. This was a compile-only check.
Author
Owner

@⁠MoonEyes on GitHub · 2026-12-02 21:59 UTC · original

This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists).

Could you, or anyone with a working setup, post a run report on the current head merged onto current main:

  • the head SHA and the main SHA it was merged onto;
  • GPU, driver and OS;
  • at least 300 s in the world after loading;
  • device lost / crashes (count), and rendered fps (median) if you have them;
  • the same run on main alone for comparison, if you can.

Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough.

AI-assisted (Claude Code).

**@⁠MoonEyes** on GitHub · 2026-12-02 21:59 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/3237#issuecomment-7360075297) This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists). Could you, or anyone with a working setup, post a run report on the **current head** merged onto current `main`: - the head SHA and the `main` SHA it was merged onto; - GPU, driver and OS; - at least 300 s in the world after loading; - device lost / crashes (count), and rendered fps (median) if you have them; - the same run on `main` alone for comparison, if you can. Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough. AI-assisted (Claude Code).
Author
Owner

@⁠merzleckeier on GitHub · 2026-12-02 22:02 UTC · original

Update from the Windows D3D12 job on efc64a091: the workspace gets past compilation and runs the Lua suite. That suite reports 45 passed and one failure, a_scan_without_a_size_reaches_the_end_of_the_image. This is the separate #3193 case already claimed in #2570. The build fix here changes only the test call to Runtime::new.

**@⁠merzleckeier** on GitHub · 2026-12-02 22:02 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/3237#issuecomment-7360138787) Update from the [Windows D3D12 job on `efc64a091`](https://github.com/ProjectLeonida/mandy/actions/runs/46979209594/job/143815202183): the workspace gets past compilation and runs the Lua suite. That suite reports 45 passed and one failure, `a_scan_without_a_size_reaches_the_end_of_the_image`. This is the separate #3193 case already [claimed in #2570](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/2570). The build fix here changes only the test call to `Runtime::new`.
a_scan_without_a_size_reaches_the_end_of_the_image failed on CI
(tail 1 0) and passed locally. The fake image was a 4096-byte Vec at a
heap address. A scan from base - 100 cannot read its range whole, so
memory::scan reads by pages aligned to absolute addresses (as the real
lua_read can only fail per page). The page straddling base was then
refused whole, and with base 1-99 bytes past a page boundary it held the
marker. A probe gave found 0 at skews 50 and 99, and 1 at 0, 100, 200
and 2048. The fake image is now page-aligned, so the result no longer
depends on where the heap puts the buffer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠LouisRiverstone on GitHub · 2026-12-02 22:07 UTC · original

Second commit: with the build fixed, CI reached tests::a_scan_without_a_size_reaches_the_end_of_the_image, which failed (tail 1 0), although it passes locally. Its result depended on where the heap put the fake image:

  • A scan from base - 100 cannot be read whole, so memory::scan falls back to pages aligned to absolute addresses. That matches the real lua_read (leonida-gpu/src/host.rs), which only fails per page.
  • The fake image was a heap Vec, so the page straddling base was refused whole. When base % 4096 is 1–99, that page holds the marker.
  • A temporary probe of memory::scan gave found 0 at skews 50 and 99, and found 1 at 0, 100, 200 and 2048.

The fake image is now a page-aligned Box<Image> (#[repr(C, align(4096))], which derefs to [u8]), as real memory regions are. cargo test -p leonida-lua --locked passes (46) and clippy is clean. A separate read-only reviewer (Claude Opus 5.5) confirmed that the allocation is sound, that every use of the fake still works, that real reads are page-granular, and that no other test depends on where the base lands.

**@⁠LouisRiverstone** on GitHub · 2026-12-02 22:07 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/3237#issuecomment-7360265215) Second commit: with the build fixed, CI reached `tests::a_scan_without_a_size_reaches_the_end_of_the_image`, which failed (`tail 1 0`), although it passes locally. Its result depended on where the heap put the fake image: - A scan from `base - 100` cannot be read whole, so `memory::scan` falls back to pages aligned to absolute addresses. That matches the real `lua_read` (`leonida-gpu/src/host.rs`), which only fails per page. - The fake image was a heap `Vec`, so the page straddling `base` was refused whole. When `base % 4096` is 1–99, that page holds the marker. - A temporary probe of `memory::scan` gave `found 0` at skews 50 and 99, and `found 1` at 0, 100, 200 and 2048. The fake image is now a page-aligned `Box<Image>` (`#[repr(C, align(4096))]`, which derefs to `[u8]`), as real memory regions are. `cargo test -p leonida-lua --locked` passes (46) and clippy is clean. A separate read-only reviewer (Claude Opus 5.5) confirmed that the allocation is sound, that every use of the fake still works, that real reads are page-granular, and that no other test depends on where the base lands.
This reverts commit d75748c2c. The flake is #3193. MoonEyes claimed it
first and fixes it in #3244 (the same page-aligned fake, plus a test
that pins it), so this pull request stays the one-line build fix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠LouisRiverstone on GitHub · 2026-12-02 22:12 UTC · original

Reverted my second commit. The a_scan_without_a_size_reaches_the_end_of_the_image flake is #3193. MoonEyes claimed it before I pushed, and #3244 makes the same page-aligned fake plus a test that pins it. This pull request is back to the one-line build fix (git diff origin/main touches only tests.rs:1089).

Until #3244 merges, the d3d12 job here may hit that flake about one run in twenty (fiestorra's count in #3193). It is not caused by this change.

**@⁠LouisRiverstone** on GitHub · 2026-12-02 22:12 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/3237#issuecomment-7360363210) Reverted my second commit. The `a_scan_without_a_size_reaches_the_end_of_the_image` flake is #3193. MoonEyes claimed it before I pushed, and #3244 makes the same page-aligned fake plus a test that pins it. This pull request is back to the one-line build fix (`git diff origin/main` touches only `tests.rs:1089`). Until #3244 merges, the d3d12 job here may hit that flake about one run in twenty (fiestorra's count in #3193). It is not caused by this change.
github-bot force-pushed github-bot/gh-3237 from f69dd5036d to 2a5338d79d 2026-12-02 22:28:28 +00:00 Compare
Author
Owner

@⁠LouisRiverstone on GitHub · 2026-12-02 22:24 UTC · original

Squashed into one commit, 2a5338d79, with no co-author trailer. The net diff is unchanged: the single line at tests.rs:1089. As merzleckeier noted, the remaining D3D12-job failure is #3193's flake, which #3244 handles. @⁠MoonEyes this is a test-only, one-line Rust change with nothing on the render path, so I don't think the in-game gate applies.

**@⁠LouisRiverstone** on GitHub · 2026-12-02 22:24 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/3237#issuecomment-7360639613) Squashed into one commit, `2a5338d79`, with no co-author trailer. The net diff is unchanged: the single line at `tests.rs:1089`. As merzleckeier noted, the remaining D3D12-job failure is #3193's flake, which #3244 handles. @⁠MoonEyes this is a test-only, one-line Rust change with nothing on the render path, so I don't think the in-game gate applies.
Author
Owner

@⁠fiestorra on GitHub · 2026-12-02 23:06 UTC · original

VERIFY-3237 — Windows nativo: es el arreglo que main necesita, y lo verifiqué entero

Own commit 2a5338d79 — d3d12/crates/leonida-lua/src/tests.rs, +1/−1

The change, in full:

-    let mut rt = Runtime::new(fake.clone(), Config::default()).unwrap();
+    let mut rt = Runtime::new(fake.clone(), Config::default());

Ran at the head

cargo test -p leonida-lua     46 passed; 0 failed

And on main (ef35d683e) the same command does not even compile:

error[E0599]: no method named `unwrap` found for struct `Runtime` in the current scope
  --> crates/leonida-lua/src/tests.rs:1089
error: could not compile `leonida-lua` (lib test) due to 1 previous error

So this one line is the difference between main compiling its tests and not, which is why every pull request in this repository is red on d3d12 (windows-latest) at the Build step — mine included, and #3178 merged on top of it earlier tonight (I left the evidence in #2570).

Please merge this one first. Nothing else in the queue can be judged by CI until it lands: a red Build on a broken main is indistinguishable from a red Build caused by the change being reviewed, and I have spent tonight explaining that to reviewers who had no way to know.

What I could not test: the other crates' suites under this change — only leonida-lua, which is the one the line touches.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-12-02 23:06 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/3237#issuecomment-7361578028) ## VERIFY-3237 — Windows nativo: es **el arreglo que `main` necesita**, y lo verifiqué entero | | | |---|---| | Own commit | `2a5338d79` — `d3d12/crates/leonida-lua/src/tests.rs`, `+1/−1` | **The change, in full**: ```diff - let mut rt = Runtime::new(fake.clone(), Config::default()).unwrap(); + let mut rt = Runtime::new(fake.clone(), Config::default()); ``` **Ran at the head** ``` cargo test -p leonida-lua 46 passed; 0 failed ``` **And on `main` (`ef35d683e`) the same command does not even compile**: ``` error[E0599]: no method named `unwrap` found for struct `Runtime` in the current scope --> crates/leonida-lua/src/tests.rs:1089 error: could not compile `leonida-lua` (lib test) due to 1 previous error ``` **So this one line is the difference between `main` compiling its tests and not**, which is why **every pull request in this repository is red on `d3d12 (windows-latest)` at the Build step** — mine included, and #3178 merged on top of it earlier tonight (I left the evidence in #2570). **Please merge this one first.** Nothing else in the queue can be judged by CI until it lands: a red Build on a broken `main` is indistinguishable from a red Build caused by the change being reviewed, and I have spent tonight explaining that to reviewers who had no way to know. **What I could not test**: the other crates' suites under this change — **only `leonida-lua`**, which is the one the line touches. Written with an AI assistant.
Author
Owner

@⁠fiestorra on GitHub · 2026-12-02 23:25 UTC · original

main is fixed — and this pull request no longer has anything to do.

origin/main is now 81efe4566 (the merge of #3244), and the line this pull request changes is already there: tests.rs has three Runtime::new call sites and none unwraps. a22fa26d6 (LEONIDA-LUA-SCAN-END-3193, the fake image starting on a page) carried the .unwrap() removal with it.

Checked on 81efe4566:

cargo test -p leonida-lua     47 passed; 0 failed

where the same command did not compile an hour ago. So: close this one rather than merge it — the fix is in, and a second branch changing the same line is a conflict waiting to be resolved for nothing.

Thank you for having it ready anyway: I asked for it to go first because every PR in the repository was red at Build, and having the one-line fix written down in a PR with a proper item name (D3D12-LUA-TESTS-BUILD) is what made it easy to point at.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-12-02 23:25 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/3237#issuecomment-7361970933) **`main` is fixed — and this pull request no longer has anything to do.** `origin/main` is now `81efe4566` (the merge of #3244), and the line this pull request changes is already there: `tests.rs` has three `Runtime::new` call sites and none unwraps. `a22fa26d6` (`LEONIDA-LUA-SCAN-END-3193`, the fake image starting on a page) carried the `.unwrap()` removal with it. **Checked on `81efe4566`**: ``` cargo test -p leonida-lua 47 passed; 0 failed ``` where the same command did not compile an hour ago. **So: close this one rather than merge it** — the fix is in, and a second branch changing the same line is a conflict waiting to be resolved for nothing. **Thank you for having it ready anyway**: I asked for it to go first because every PR in the repository was red at Build, and having the one-line fix written down in a PR with a proper item name (`D3D12-LUA-TESTS-BUILD`) is what made it easy to point at. Written with an AI assistant.
github-bot closed this pull request 2026-12-03 02:06:21 +00:00
Author
Owner

@⁠LouisRiverstone on GitHub · 2026-12-03 02:05 UTC · original

Closing: #3244 (a22fa26d6, merged as 81efe4566) carried the same one-line .unwrap() removal, so main builds leonida-lua's tests again and this change has nothing left to do. Thanks @⁠fiestorra for checking it on 81efe4566 (47 passed).

**@⁠LouisRiverstone** on GitHub · 2026-12-03 02:05 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/3237#issuecomment-7365070369) Closing: #3244 (`a22fa26d6`, merged as `81efe4566`) carried the same one-line `.unwrap()` removal, so `main` builds `leonida-lua`'s tests again and this change has nothing left to do. Thanks @⁠fiestorra for checking it on `81efe4566` (47 passed).

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/ubiquitarianism--leonida!3237
No description provided.