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

Closed
LouisRiverstone wants to merge 1 commit from upstream-pr/3237 into main
LouisRiverstone commented 2026-12-02 21:53:23 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by LouisRiverstone on 2026-12-02T21:53:23Z.


Claim: https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7359838199 (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

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5615368012 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3237). Originally posted by [LouisRiverstone](https://github.com/LouisRiverstone) on 2026-12-02T21:53:23Z. --- Claim: https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7359838199 (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)
merzleckeier commented 2026-12-02 21:58:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T21:58:58Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6159766972 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3237#pullrequestreview-6159766972). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-02T21:58:58Z. **Review:** COMMENTED --- 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.
MoonEyes commented 2026-12-02 21:59:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T21:59:45Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7360075297 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3237#issuecomment-7360075297). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T21:59:45Z. --- 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).
merzleckeier commented 2026-12-02 22:02:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T22:02:26Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7360138787 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3237#issuecomment-7360138787). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-02T22:02:26Z. --- 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://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7360052872). The build fix here changes only the test call to `Runtime::new`.
LouisRiverstone commented 2026-12-02 22:07:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by LouisRiverstone on 2026-12-02T22:07:49Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7360265215 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3237#issuecomment-7360265215). Originally posted by [LouisRiverstone](https://github.com/LouisRiverstone) on 2026-12-02T22:07:49Z. --- 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 commented 2026-12-02 22:12:02 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by LouisRiverstone on 2026-12-02T22:12:02Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7360363210 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3237#issuecomment-7360363210). Originally posted by [LouisRiverstone](https://github.com/LouisRiverstone) on 2026-12-02T22:12:02Z. --- 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 commented 2026-12-02 22:24:02 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by LouisRiverstone on 2026-12-02T22:24:02Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7360639613 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3237#issuecomment-7360639613). Originally posted by [LouisRiverstone](https://github.com/LouisRiverstone) on 2026-12-02T22:24:02Z. --- 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.
fiestorra commented 2026-12-02 23:06:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T23:06:44Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7361578028 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3237#issuecomment-7361578028). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T23:06:44Z. --- ## 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.
fiestorra commented 2026-12-02 23:25:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T23:25:12Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7361970933 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3237#issuecomment-7361970933). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T23:25:12Z. --- **`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.
LouisRiverstone commented 2026-12-03 02:05:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by LouisRiverstone on 2026-12-03T02:05:14Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7365070369 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3237#issuecomment-7365070369). Originally posted by [LouisRiverstone](https://github.com/LouisRiverstone) on 2026-12-03T02:05:14Z. --- 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

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!3237
No description provided.