leonida-lua: the fake image starts on a page, so a scan below it no longer skips the marker (LEONIDA-LUA-SCAN-END-3193) #3244

Manually merged
github merged 1 commit from github-bot/gh-3244 into gh-pr/3244/base 2026-12-02 23:24:41 +00:00 AGit
Owner

@⁠MoonEyes on GitHub · 2026-12-02 22:09 UTC · original
MoonEyes:fix/issue-3193 → main · +47 −3 · 1 files · 1 commits · merged 2026-12-02 23:20 UTC

Claimed in the coordination issue as: LEONIDA-LUA-SCAN-END-3193 (#2570)

Fixes #3193

Depends on: #3237 (the same one-line build fix is included here, identical, so either merge order works)

What and why

a_scan_without_a_size_reaches_the_end_of_the_image failed about one run in twenty. The cause is in the test's fake, not in the scan. The fake title image was a plain 4096-byte Vec<u8> at whatever address the allocator returned. The second scan starts 100 bytes below the image, so its range is not all readable and memory::scan reads it by pages, skipping a page that cannot be read. In the fake a page only partly inside the buffer is unreadable, so when the buffer began within 100 bytes after a page boundary, the first page piece held the marker (at base + size - 100) and was skipped whole: tail 1 0. A real image is made of whole pages, where this cannot happen, so the scan code is right as it is.

The fake's 4096 bytes now start on a page boundary (Image, a window of an over-allocated buffer, deref to [u8] so the other tests are unchanged). the_fake_image_starts_on_a_page_like_a_real_one pins it; the flake itself cannot be pinned directly because it depends on an allocator address.

Also: the dangling-link test called .unwrap() on Runtime::new, which no longer returns a Result (main's tests do not compile on cargo test -p leonida-lua --lib). The one-line fix is identical to #3237.

Tested

Windows 11, no GPU, no game files, on main f3865cae8 plus this branch:

  • Red (new test, with the build fix, without the fake's change): cargo test -p leonida-lua --lib the_fake_image -> test result: FAILED. 0 passed; 1 failed (image at 0x25b6f179cc0, offset 3264 in its page).
  • Green: cargo test -p leonida-lua --lib -> test result: ok. 47 passed; 0 failed.
  • The scan tests (a_scan_) 200 runs of the test binary: 0 failures; rustfmt --check on tests.rs: clean.
  • Not run: the full workspace, CI.

GPUs tested: n/a

AI-assisted: yes (Claude Code). Models: Claude Opus 5.5 (author), separate Claude Opus 5.5 reviewers

Checklist

  • Based on current main and merges cleanly.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md).
  • A new translator rule is in the contract table of docs/design.md. (n/a: test fixture fix, no translator rule)

🤖 Generated with Claude Code

**@⁠MoonEyes** on GitHub · 2026-12-02 22:09 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/3244) `MoonEyes:fix/issue-3193` → `main` · +47 −3 · 1 files · 1 commits · merged 2026-12-02 23:20 UTC Claimed in the coordination issue as: LEONIDA-LUA-SCAN-END-3193 (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/2570) Fixes #3193 Depends on: #3237 (the same one-line build fix is included here, identical, so either merge order works) ### What and why `a_scan_without_a_size_reaches_the_end_of_the_image` failed about one run in twenty. The cause is in the test's fake, not in the scan. The fake title image was a plain 4096-byte `Vec<u8>` at whatever address the allocator returned. The second scan starts 100 bytes below the image, so its range is not all readable and `memory::scan` reads it by pages, skipping a page that cannot be read. In the fake a page only partly inside the buffer is unreadable, so when the buffer began within 100 bytes after a page boundary, the first page piece held the marker (at `base + size - 100`) and was skipped whole: `tail 1 0`. A real image is made of whole pages, where this cannot happen, so the scan code is right as it is. The fake's 4096 bytes now start on a page boundary (`Image`, a window of an over-allocated buffer, deref to `[u8]` so the other tests are unchanged). `the_fake_image_starts_on_a_page_like_a_real_one` pins it; the flake itself cannot be pinned directly because it depends on an allocator address. Also: the dangling-link test called `.unwrap()` on `Runtime::new`, which no longer returns a `Result` (main's tests do not compile on `cargo test -p leonida-lua --lib`). The one-line fix is identical to #3237. ### Tested Windows 11, no GPU, no game files, on `main` `f3865cae8` plus this branch: - Red (new test, with the build fix, without the fake's change): `cargo test -p leonida-lua --lib the_fake_image` -> `test result: FAILED. 0 passed; 1 failed` (image at `0x25b6f179cc0`, offset 3264 in its page). - Green: `cargo test -p leonida-lua --lib` -> `test result: ok. 47 passed; 0 failed`. - The scan tests (`a_scan_`) 200 runs of the test binary: 0 failures; `rustfmt --check` on `tests.rs`: clean. - Not run: the full workspace, CI. GPUs tested: n/a AI-assisted: yes (Claude Code). Models: Claude Opus 5.5 (author), separate Claude Opus 5.5 reviewers ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md). - [ ] A new translator rule is in the contract table of `docs/design.md`. (n/a: test fixture fix, no translator rule) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
a_scan_without_a_size_reaches_the_end_of_the_image failed about one run
in twenty. The fake title image was a plain 4096-byte Vec at whatever
address the allocator gave. A scan whose range is not all readable (the
second scan starts 100 bytes below the image) reads by pages, and a page
only partly inside the buffer is unreadable in the fake, so when the
buffer started within 100 bytes after a page boundary the page holding the
marker was skipped. A real image is whole pages, where that cannot happen.

The fake now keeps its 4096 bytes on a page boundary, and a test pins it.

Also takes the .unwrap() off Runtime::new in the dangling-link test, the
same one-line change as #3237, so the crate's tests build on main.

Fixes #3193

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

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

Resolved on the current heads. After the revert in #3237, git merge-tree --write-tree f69dd5036 a22fa26d6 succeeds with no conflict.

Earlier check for reference: Merge-order update for the Depends on note. Since the original one-line fix, #3237 gained a second commit that also changes the fake image fixture. I fetched both current PR heads and git merge-tree --write-tree d75748c2c a22fa26d6 reports a content conflict in d3d12/crates/leonida-lua/src/tests.rs. Once one lands, the other needs its remaining test changes reconciled with main before a second merge.

**@⁠merzleckeier** on GitHub · 2026-12-02 22:11 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/3244#issuecomment-7360342725) · edited 2026-12-02 22:19 UTC Resolved on the current heads. After [the revert in #3237](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/3237), `git merge-tree --write-tree f69dd5036 a22fa26d6` succeeds with no conflict. Earlier check for reference: Merge-order update for the `Depends on` note. Since the original one-line fix, #3237 gained a second commit that also changes the fake image fixture. I fetched both current PR heads and `git merge-tree --write-tree d75748c2c a22fa26d6` reports a content conflict in `d3d12/crates/leonida-lua/src/tests.rs`. Once one lands, the other needs its remaining test changes reconciled with `main` before a second merge.
Author
Owner

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

Merging (OreoFR's OK). Head a22fa26d64, main ef35d683e: merge-tree clean, all six checks green on this head (d3d12 windows included). Test-only change in d3d12/crates/leonida-lua/src/tests.rs; it also fixes main's d3d12 job (the .unwrap() on Runtime from #3179 and the scan test). Enqueued in the merge queue. (oreofr-agent, AI-assisted)

**@⁠OreoFR** on GitHub · 2026-12-02 23:06 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/3244#issuecomment-7361579762) Merging (OreoFR's OK). Head a22fa26d64acfb736d904c2c23b34d61463e5080, main ef35d683e: merge-tree clean, all six checks green on this head (d3d12 windows included). Test-only change in `d3d12/crates/leonida-lua/src/tests.rs`; it also fixes main's d3d12 job (the `.unwrap()` on `Runtime` from #3179 and the scan test). Enqueued in the merge queue. (oreofr-agent, AI-assisted)
github-bot changed target branch from main to gh-pr/3244/base 2026-12-02 23:23:57 +00:00
github manually merged commit a22fa26d64 into gh-pr/3244/base 2026-12-02 23:24:41 +00:00
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!3244
No description provided.