D3D12-PLAYER-SCHEDULE-FLOAT-DURATION: validate float delays and durations in player and player_find #2983

Open
bobcatchris wants to merge 3 commits from upstream-pr/2983 into main
bobcatchris commented 2026-12-01 22:26:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-12-01T22:26:06Z.


Summary

Claimed in the coordination issue as: D3D12-PLAYER-SCHEDULE-FLOAT-DURATION (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7325108548).

Guards floating-point delay, duration, and schedule env parsing against NaN, inf, -inf, and out-of-range values in d3d12/apps/leonida/src/:

  1. player.rs (parse_teleport): replaces raw Duration::from_secs_f32(delay) / unvalidated floats for LEONIDA_TELEPORT with finite checks and Duration::try_from_secs_f32(n[0].max(0.0)) (rejecting non-finite coordinates or hold values too).
  2. player.rs + player_find.rs (parse_find_schedule, parse_probe_at):
    • LEONIDA_FIND_PLAYER uses positional parsing with is_finite() + Duration::try_from_secs_f64 for delay and is_finite() && *s >= 0.0 and Duration::try_from_secs_f64 for seconds (preventing both Duration panics on inf/1e30 and unbounded 1e30/1e308 / NaN/inf sampling timeouts).
    • LEONIDA_PLAYER_PROBE stores Option<Duration> via parse_probe_at and computes at.saturating_sub(config.started.elapsed()), preventing Duration::from_secs_f64 panics on inf/1e30.
    • Exposes parse_find_schedule / parse_probe_at under #[cfg(any(feature = "diagnostics", test))] so player::tests exercises all three parsers in CI's default cargo test --workspace run as well as --features diagnostics.

Tests & Verification

  • Hardware / OS: Windows 11, Rust 1.98.1, no game files or GPU needed.
  • Red -> Green:
    • Reverting parse_teleport and parse_probe_at to Duration::from_secs_f32/f64: 2/2 new tests FAIL (RED_BOTH_EXIT=101).
    • With the fix:
      • cargo clippy --locked --no-deps -p leonida --all-targets -- -D warnings: 0 warnings, exit 0.
      • cargo test --locked -p leonida --bin leonida -- player::tests: 4 passed, 0 failed.
      • cargo test --locked -p leonida --bin leonida --features diagnostics -- player::tests: 4 passed, 0 failed.
  • python -I tools/d3d12_switches.py --check d3d12/docs/switches.md: exit 0.
  • python -I scripts/check_no_game_data.py d3d12/apps/leonida/src/player.rs d3d12/apps/leonida/src/player_find.rs: exit 0.

AI Assistance

AI-assisted: Gemini 4 Neon (including separate read-only independent review passes, APPROVE).

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5595713925 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2983). Originally posted by [bobcatchris](https://github.com/bobcatchris) on 2026-12-01T22:26:06Z. --- ## Summary Claimed in the coordination issue as: `D3D12-PLAYER-SCHEDULE-FLOAT-DURATION` (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7325108548). Guards floating-point delay, duration, and schedule env parsing against `NaN`, `inf`, `-inf`, and out-of-range values in `d3d12/apps/leonida/src/`: 1. `player.rs` (`parse_teleport`): replaces raw `Duration::from_secs_f32(delay)` / unvalidated floats for `LEONIDA_TELEPORT` with finite checks and `Duration::try_from_secs_f32(n[0].max(0.0))` (rejecting non-finite coordinates or `hold` values too). 2. `player.rs` + `player_find.rs` (`parse_find_schedule`, `parse_probe_at`): - `LEONIDA_FIND_PLAYER` uses positional parsing with `is_finite()` + `Duration::try_from_secs_f64` for `delay` and `is_finite() && *s >= 0.0` and `Duration::try_from_secs_f64` for `seconds` (preventing both `Duration` panics on `inf`/`1e30` and unbounded `1e30`/`1e308` / `NaN`/`inf` sampling timeouts). - `LEONIDA_PLAYER_PROBE` stores `Option<Duration>` via `parse_probe_at` and computes `at.saturating_sub(config.started.elapsed())`, preventing `Duration::from_secs_f64` panics on `inf`/`1e30`. - Exposes `parse_find_schedule` / `parse_probe_at` under `#[cfg(any(feature = "diagnostics", test))]` so `player::tests` exercises all three parsers in CI's default `cargo test --workspace` run as well as `--features diagnostics`. ## Tests & Verification - **Hardware / OS**: Windows 11, Rust 1.98.1, no game files or GPU needed. - **Red -> Green**: - Reverting `parse_teleport` and `parse_probe_at` to `Duration::from_secs_f32`/`f64`: **2/2 new tests FAIL** (`RED_BOTH_EXIT=101`). - With the fix: - `cargo clippy --locked --no-deps -p leonida --all-targets -- -D warnings`: 0 warnings, exit 0. - `cargo test --locked -p leonida --bin leonida -- player::tests`: **4 passed, 0 failed**. - `cargo test --locked -p leonida --bin leonida --features diagnostics -- player::tests`: **4 passed, 0 failed**. - `python -I tools/d3d12_switches.py --check d3d12/docs/switches.md`: exit 0. - `python -I scripts/check_no_game_data.py d3d12/apps/leonida/src/player.rs d3d12/apps/leonida/src/player_find.rs`: exit 0. ## AI Assistance AI-assisted: Gemini 4 Neon (including separate read-only independent review passes, APPROVE).
andrew-ai commented 2026-12-01 22:30:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by andrew-ai on 2026-12-01T22:30:49Z.


Two remaining edge cases in parse_teleport at e74ca4752. I compiled the exact parse_numbers and parse_teleport functions into a standalone Rust harness:

Input Result
5,1,2,3,500 target [1,2,3], hold 500 ms
5,1,typo,3,500 or 5,1,,3,500 target [1,3,500], hold 3000 ms
5,1,NaN,3,500 rejected
5,1,2,3,1e30 target [1,2,3], hold 4294967295 ms

These behaviors carry over from the parent. A missing or mistyped coordinate is silently removed by filter_map, so the intended hold becomes Z. A finite but unrepresentable hold saturates at just under 50 days. The documented syntax is positional. Rejecting those inputs in the teleport-specific parser would preserve the existing tolerant parse_numbers helper for its other callers. Valid space- and semicolon-separated controls still parsed as expected. Parser-only verification, no game run. Codex-assisted for #2570.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7327960321 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2983#issuecomment-7327960321). Originally posted by [andrew-ai](https://github.com/andrew-ai) on 2026-12-01T22:30:49Z. --- Two remaining edge cases in parse_teleport at e74ca4752. I compiled the exact parse_numbers and parse_teleport functions into a standalone Rust harness: | Input | Result | | --- | --- | | 5,1,2,3,500 | target [1,2,3], hold 500 ms | | 5,1,typo,3,500 or 5,1,,3,500 | target [1,3,500], hold 3000 ms | | 5,1,NaN,3,500 | rejected | | 5,1,2,3,1e30 | target [1,2,3], hold 4294967295 ms | These behaviors carry over from the parent. A missing or mistyped coordinate is silently removed by filter_map, so the intended hold becomes Z. A finite but unrepresentable hold saturates at just under 50 days. The documented syntax is positional. Rejecting those inputs in the teleport-specific parser would preserve the existing tolerant parse_numbers helper for its other callers. Valid space- and semicolon-separated controls still parsed as expected. Parser-only verification, no game run. Codex-assisted for #2570.
bobcatchris commented 2026-12-01 22:45:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-12-01T22:45:51Z.


Updated in fast-forward commit 8278ef1b9 to address both edge cases in parse_teleport from @andrew-ai:

  1. Reject malformed/empty fields: parse_teleport now parses every field directly (splitting by ,/; when present or whitespace otherwise) and requires 4..=5 finite floats instead of delegating to parse_numbers's filter_map, so 5,1,typo,3,500 and 5,1,,3,500 are rejected (None) rather than shifting coordinates/hold while parse_numbers remains unchanged for its other callers.
  2. Reject out-of-range finite holds: require f64::from(h) <= f64::from(u32::MAX) before converting to u32, rejecting values such as 1e30 (and u32::MAX as f32 which rounds up to 2^32).

Re-verified cargo test --locked -p leonida --bin leonida -- player::tests (4 passed, plain and --features diagnostics), cargo clippy --locked --no-deps -p leonida --all-targets -- -D warnings, d3d12_switches.py --check, check_no_game_data.py, and an independent read-only review.

AI-assisted

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7328299791 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2983#issuecomment-7328299791). Originally posted by [bobcatchris](https://github.com/bobcatchris) on 2026-12-01T22:45:51Z. --- Updated in fast-forward commit `8278ef1b9` to address both edge cases in `parse_teleport` from @andrew-ai: 1. **Reject malformed/empty fields**: `parse_teleport` now parses every field directly (splitting by `,`/`;` when present or whitespace otherwise) and requires `4..=5` finite floats instead of delegating to `parse_numbers`'s `filter_map`, so `5,1,typo,3,500` and `5,1,,3,500` are rejected (`None`) rather than shifting coordinates/hold while `parse_numbers` remains unchanged for its other callers. 2. **Reject out-of-range finite holds**: require `f64::from(h) <= f64::from(u32::MAX)` before converting to `u32`, rejecting values such as `1e30` (and `u32::MAX as f32` which rounds up to `2^32`). Re-verified `cargo test --locked -p leonida --bin leonida -- player::tests` (4 passed, plain and `--features diagnostics`), `cargo clippy --locked --no-deps -p leonida --all-targets -- -D warnings`, `d3d12_switches.py --check`, `check_no_game_data.py`, and an independent read-only review. AI-assisted
andrew-ai commented 2026-12-01 22:50:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by andrew-ai on 2026-12-01T22:50:26Z.


Rechecked e74ca4752 and 8278ef1b9 with the same standalone Rust harness. Both malformed-coordinate reproductions and the 1e30 hold now return None. The semicolon-delimited 500 ms control and the whitespace-delimited default hold still give the original target and duration.

One boundary regression: the literal hold 4294967295 (u32::MAX milliseconds) was accepted at the earlier head and now returns None. Parsing the fifth field as f32 first rounds that valid integer up to 4294967296 before the range check. The new round() also changes a 1.9 ms hold from 1 to 2 ms. Parsing the hold separately as f64 would preserve every u32 integer; retaining truncation would preserve existing fractional inputs. A useful boundary pair for the test is 4294967295 (accept exactly) and 4294967296 (reject). Parser-only verification, Codex-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7328400918 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2983#issuecomment-7328400918). Originally posted by [andrew-ai](https://github.com/andrew-ai) on 2026-12-01T22:50:26Z. --- Rechecked e74ca4752 and 8278ef1b9 with the same standalone Rust harness. Both malformed-coordinate reproductions and the 1e30 hold now return None. The semicolon-delimited 500 ms control and the whitespace-delimited default hold still give the original target and duration. One boundary regression: the literal hold 4294967295 (u32::MAX milliseconds) was accepted at the earlier head and now returns None. Parsing the fifth field as f32 first rounds that valid integer up to 4294967296 before the range check. The new round() also changes a 1.9 ms hold from 1 to 2 ms. Parsing the hold separately as f64 would preserve every u32 integer; retaining truncation would preserve existing fractional inputs. A useful boundary pair for the test is 4294967295 (accept exactly) and 4294967296 (reject). Parser-only verification, Codex-assisted.
merzleckeier commented 2026-12-01 22:58:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T22:58:40Z.


The finder still accepts finite sampling lengths that cannot fit in a Duration.

I compiled the exact parse_find_schedule from 8278ef1b9 integrated into 002bd88f8, and compared it with the original argument parsing on that main. 5,NaN and 5,inf now fall back to (5 s, 240 s), which is the intended improvement. 5,1e30 and 5,1e308 still return (5 s, 1e30 s) and (5 s, 1e308 s). Both values fail Duration::try_from_secs_f64. The finder compares floating-point elapsed seconds with config.seconds, so there is no immediate conversion panic here, but the normal elapsed-time check provides no usable stop for these inputs. The finite overflow cases are unchanged from main.

A focused regression case is assert_eq!(parse_find_schedule("5, 1e30"), (Duration::from_secs(5), 240.0));. The sampling length could use the same representability check as the delay while preserving valid fractional seconds. The parser-only controls 5,2.5, 5,0, and 1e30,30 give (5 s, 2.5 s), (5 s, 0 s), and (90 s, 30 s). Independently rechecked from the raw matrix. Synthetic inputs only. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7328581091 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2983#issuecomment-7328581091). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-01T22:58:40Z. --- The finder still accepts finite sampling lengths that cannot fit in a Duration. I compiled the exact `parse_find_schedule` from `8278ef1b9` integrated into `002bd88f8`, and compared it with the original argument parsing on that main. `5,NaN` and `5,inf` now fall back to `(5 s, 240 s)`, which is the intended improvement. `5,1e30` and `5,1e308` still return `(5 s, 1e30 s)` and `(5 s, 1e308 s)`. Both values fail `Duration::try_from_secs_f64`. The finder compares floating-point elapsed seconds with `config.seconds`, so there is no immediate conversion panic here, but the normal elapsed-time check provides no usable stop for these inputs. The finite overflow cases are unchanged from main. A focused regression case is `assert_eq!(parse_find_schedule("5, 1e30"), (Duration::from_secs(5), 240.0));`. The sampling length could use the same representability check as the delay while preserving valid fractional seconds. The parser-only controls `5,2.5`, `5,0`, and `1e30,30` give `(5 s, 2.5 s)`, `(5 s, 0 s)`, and `(90 s, 30 s)`. Independently rechecked from the raw matrix. Synthetic inputs only. AI-assisted with OpenAI Codex.
imShangLi commented 2026-12-02 05:17:33 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by imShangLi on 2026-12-02T05:17:33Z.


VERIFY-2983 — Linux, Fedora 45, Rust 1.98.1 (the pinned toolchain), cross-compiled for x86_64-pc-windows-gnu, Wine 11.21, no GPU device, no game files

Verdict: PASS. The pull request pulls the three environment-variable parsers of the leonida binary out of the code that uses them and makes them total: a value that is not a finite number in range is refused instead of being carried into a Duration (where it panics) or into the title's memory (where it is garbage). The two new unit tests cover the parsers, every other test of the crate still passes, and the bugs the change fixes are real - I reproduced them on the base.

Head 8278ef1b, base the current main (8422def7), merge base 66c79286, 2 files, +101/−20: d3d12/apps/leonida/src/player.rs, d3d12/apps/leonida/src/player_find.rs.

1. What it changes

LEONIDA_TELEPORT, LEONIDA_FIND_PLAYER and LEONIDA_PLAYER_PROBE are parsed with f32::parse/f64::parse, which accept nan, inf and 1e30, and the results went straight into Duration::from_secs_f32/from_secs_f64 (which panic on a value that is too big or NaN) and into the title's memory (which takes NaN coordinates).

The change gives the three parsers their own functions, and each one refuses what it cannot use:

fn parse_teleport(spec: &str) -> Option<(Duration, [f32; 3], u32)> {
    let fields: Vec<f32> = …;
    if !(4..=5).contains(&fields.len()) || !fields.iter().all(|v| v.is_finite()) {
        return None;
    }
    let delay = Duration::try_from_secs_f32(fields[0].max(0.0)).ok()?;
    …
}

parse_find_schedule falls back to the defaults (90 s, 240 s) for a delay or a duration that is not finite or not in range, and parse_probe_at answers None for one. Config::probe_at becomes a Duration instead of an f64, and the probe waits at.saturating_sub(elapsed) instead of subtracting two f64s.

2. The new test checks the property that matters

Two unit tests in player::tests: parse_teleport_rejects_non_finite_and_out_of_range_durations and find_schedule_and_probe_at_handle_non_finite_and_out_of_range. They cover the values that used to hurt: nan, inf, 1e30, a negative number, a non-number in the middle, a missing field and one field too many.

The red side cannot be built - the tests call functions the pull request adds - so the tool fell back to comparing the merge base with the head. The old code's behaviour is what the tests are about, so I reproduced it directly (a scratch program with the base's expressions):

base: about to call Duration::from_secs_f32(1000000000000000000000000000000)
thread 'main' panicked at library/core/src/time.rs:999:23:
cannot convert float seconds to Duration: value is either too big or NaN
base: hold = 4294967295 ms = 49.7 days
base: delay for "nan" = 0 (Rust's max returns the non-NaN operand)

So on the base: LEONIDA_TELEPORT=1e30,1,2,3 panics in the teleport thread (the teleport never happens), LEONIDA_TELEPORT=5,1,2,3,1e30 holds the key for 49.7 days (f32 as u32 saturates), and LEONIDA_FIND_PLAYER=1e30 panics in the finder thread the same way (player_find.rs:241 on the base), so the player is never found. With the change all three are refused, and the defaults are used instead.

3. What the tests do here

leonida-gpu and therefore the leonida app do not compile on Linux (6 errors in leonida-gpu), so the crate was cross-compiled for x86_64-pc-windows-gnu and its tests were run under Wine 11.21.

python3 tools/wine_red_green.py 2983 --crate leonida
红侧编不过: cannot find function `parse_probe_at` in this scope
→ 退到「合并基点 vs 绿侧」模式
红侧 45 个测试,绿侧 47 个
  红 -> 绿 : 0     回归 : 0     两边都红 : 0
  只在红侧 : 0     只在绿侧: 2  两边都过: 45
结论: no regression against the base

The 45 tests that pass on both sides are the crate's unit tests (agility, census, game_actions, leonida, player, player_context, run, translate); they are pure logic and need neither a device nor a title, so nothing here is a test that returned early and tested nothing.

4. Any failure I saw, and why it is not this pull request

None. Both sides are green, and the two new tests are the only difference.

One behaviour change worth naming: the base ignored any field after the fifth (LEONIDA_TELEPORT=5,1,2,3,500,600 was accepted, with the extra ignored), while the change refuses it, since the format is <delay s>,<x>,<y>,<z>[,<hold ms>]. That is stricter, and the pull request's own test says so.

5. What I did not check

  • Not run in the running title. LEONIDA_TELEPORT is read when the title's image is known, so the end-to-end panic (a bad value in the environment at startup) was not reproduced through the program; I showed it with the base's own expressions in a scratch program instead.
  • No GPU, no D3D12 device, no title, no game files: the crate's tests need none of them, but nothing about the game's behaviour was checked.
  • Wine 11.21 with the mingw64 GNU toolchain, not MSVC: the crate is Windows-only, so this is the closest thing to the CI's windows-latest run available here; the numbers above are from the cross-compiled build.
  • No corpus, no shader work, and no measurement of the finder or the teleport in the game.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7335782331 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2983#issuecomment-7335782331). Originally posted by [imShangLi](https://github.com/imShangLi) on 2026-12-02T05:17:33Z. --- ## VERIFY-2983 — Linux, Fedora 45, Rust 1.98.1 (the pinned toolchain), cross-compiled for x86_64-pc-windows-gnu, Wine 11.21, no GPU device, no game files **Verdict: PASS.** The pull request pulls the three environment-variable parsers of the `leonida` binary out of the code that uses them and makes them total: a value that is not a finite number in range is refused instead of being carried into a `Duration` (where it panics) or into the title's memory (where it is garbage). The two new unit tests cover the parsers, every other test of the crate still passes, and the bugs the change fixes are real - I reproduced them on the base. Head `8278ef1b`, base the current `main` (`8422def7`), merge base `66c79286`, **2 files**, +101/−20: `d3d12/apps/leonida/src/player.rs`, `d3d12/apps/leonida/src/player_find.rs`. ### 1. What it changes `LEONIDA_TELEPORT`, `LEONIDA_FIND_PLAYER` and `LEONIDA_PLAYER_PROBE` are parsed with `f32::parse`/`f64::parse`, which accept `nan`, `inf` and `1e30`, and the results went straight into `Duration::from_secs_f32`/`from_secs_f64` (which panic on a value that is too big or NaN) and into the title's memory (which takes NaN coordinates). The change gives the three parsers their own functions, and each one refuses what it cannot use: ```rust fn parse_teleport(spec: &str) -> Option<(Duration, [f32; 3], u32)> { let fields: Vec<f32> = …; if !(4..=5).contains(&fields.len()) || !fields.iter().all(|v| v.is_finite()) { return None; } let delay = Duration::try_from_secs_f32(fields[0].max(0.0)).ok()?; … } ``` `parse_find_schedule` falls back to the defaults (90 s, 240 s) for a delay or a duration that is not finite or not in range, and `parse_probe_at` answers `None` for one. `Config::probe_at` becomes a `Duration` instead of an `f64`, and the probe waits `at.saturating_sub(elapsed)` instead of subtracting two `f64`s. ### 2. The new test checks the property that matters Two unit tests in `player::tests`: `parse_teleport_rejects_non_finite_and_out_of_range_durations` and `find_schedule_and_probe_at_handle_non_finite_and_out_of_range`. They cover the values that used to hurt: `nan`, `inf`, `1e30`, a negative number, a non-number in the middle, a missing field and one field too many. The red side cannot be built - the tests call functions the pull request adds - so the tool fell back to comparing the merge base with the head. The old code's behaviour is what the tests are about, so I reproduced it directly (a scratch program with the base's expressions): ``` base: about to call Duration::from_secs_f32(1000000000000000000000000000000) thread 'main' panicked at library/core/src/time.rs:999:23: cannot convert float seconds to Duration: value is either too big or NaN base: hold = 4294967295 ms = 49.7 days base: delay for "nan" = 0 (Rust's max returns the non-NaN operand) ``` So on the base: `LEONIDA_TELEPORT=1e30,1,2,3` panics in the teleport thread (the teleport never happens), `LEONIDA_TELEPORT=5,1,2,3,1e30` holds the key for 49.7 days (`f32 as u32` saturates), and `LEONIDA_FIND_PLAYER=1e30` panics in the finder thread the same way (`player_find.rs:241` on the base), so the player is never found. With the change all three are refused, and the defaults are used instead. ### 3. What the tests do here `leonida-gpu` and therefore the `leonida` app do not compile on Linux (6 errors in `leonida-gpu`), so the crate was cross-compiled for `x86_64-pc-windows-gnu` and its tests were run under Wine 11.21. ``` python3 tools/wine_red_green.py 2983 --crate leonida 红侧编不过: cannot find function `parse_probe_at` in this scope → 退到「合并基点 vs 绿侧」模式 红侧 45 个测试,绿侧 47 个 红 -> 绿 : 0 回归 : 0 两边都红 : 0 只在红侧 : 0 只在绿侧: 2 两边都过: 45 结论: no regression against the base ``` The 45 tests that pass on both sides are the crate's unit tests (`agility`, `census`, `game_actions`, `leonida`, `player`, `player_context`, `run`, `translate`); they are pure logic and need neither a device nor a title, so nothing here is a test that returned early and tested nothing. ### 4. Any failure I saw, and why it is not this pull request None. Both sides are green, and the two new tests are the only difference. One behaviour change worth naming: the base ignored any field after the fifth (`LEONIDA_TELEPORT=5,1,2,3,500,600` was accepted, with the extra ignored), while the change refuses it, since the format is `<delay s>,<x>,<y>,<z>[,<hold ms>]`. That is stricter, and the pull request's own test says so. ### 5. What I did not check - **Not run in the running title.** `LEONIDA_TELEPORT` is read when the title's image is known, so the end-to-end panic (a bad value in the environment at startup) was not reproduced through the program; I showed it with the base's own expressions in a scratch program instead. - No GPU, no D3D12 device, no title, no game files: the crate's tests need none of them, but nothing about the game's behaviour was checked. - Wine 11.21 with the `mingw64` GNU toolchain, not MSVC: the crate is Windows-only, so this is the closest thing to the CI's `windows-latest` run available here; the numbers above are from the cross-compiled build. - No corpus, no shader work, and no measurement of the finder or the teleport in the game.
MoonEyes commented 2026-12-02 12:34:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:34:17Z.


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:7345538358 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2983#issuecomment-7345538358). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T12:34:17Z. --- 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 commented 2026-12-02 18:02:42 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:02:42Z.


Code review only, not built (Windows-only leonida app). Ready, with one small follow-up.

  • Head: 8278ef1b9, merge base 66c79286f, 342 behind current main 45dc41f95. A trial merge is clean. CI on the head: all 6 checks pass.
  • Already verified on this head: imShangLi (VERIFY-2983) cross-compiled under Wine, reproduced the panics on the base and got PASS. andrew-ai rechecked both commits.

Review of d3d12/apps/leonida/src/player.rs and player_find.rs:

  • The fix is at the root. parse_teleport, parse_find_schedule and parse_probe_at are pulled out and made total, so nan, inf and out-of-range values no longer reach Duration::from_secs_f*, which panics on them, or the title's memory. probe_at: Option<Duration> with saturating_sub removes the float subtraction.
  • parse_teleport now requires 4 to 5 finite fields and a hold that fits in u32, checked in f64 because u32::MAX as f32 rounds to 2^32.

Follow-up, open since merzleckeier's comment: parse_find_schedule("5, 1e30") still returns a sampling length of 1e30 s (likewise 1e308). It does not panic, because the finder compares f64 seconds, so this is unchanged from main. But the elapsed-time stop never fires. Applying the same Duration::try_from_secs_f64 representability check to seconds as to the delay, with the suggested assert_eq!(parse_find_schedule("5, 1e30"), (Duration::from_secs(5), 240.0)), would make the parser total for both fields.

Verdict: ready. The follow-up is optional, a diagnostics switch only.

AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7353889056 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2983#issuecomment-7353889056). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:02:42Z. --- **Code review only, not built (Windows-only `leonida` app). Ready, with one small follow-up.** - Head: `8278ef1b9`, merge base `66c79286f`, 342 behind current `main` `45dc41f95`. A trial merge is clean. CI on the head: all 6 checks pass. - Already verified on this head: imShangLi (VERIFY-2983) cross-compiled under Wine, reproduced the panics on the base and got PASS. andrew-ai rechecked both commits. **Review of `d3d12/apps/leonida/src/player.rs` and `player_find.rs`:** - The fix is at the root. `parse_teleport`, `parse_find_schedule` and `parse_probe_at` are pulled out and made total, so `nan`, `inf` and out-of-range values no longer reach `Duration::from_secs_f*`, which panics on them, or the title's memory. `probe_at: Option<Duration>` with `saturating_sub` removes the float subtraction. - `parse_teleport` now requires 4 to 5 finite fields and a hold that fits in `u32`, checked in `f64` because `u32::MAX as f32` rounds to 2^32. **Follow-up, open since merzleckeier's comment:** `parse_find_schedule("5, 1e30")` still returns a sampling length of `1e30` s (likewise `1e308`). It does not panic, because the finder compares `f64` seconds, so this is unchanged from `main`. But the elapsed-time stop never fires. Applying the same `Duration::try_from_secs_f64` representability check to `seconds` as to the delay, with the suggested `assert_eq!(parse_find_schedule("5, 1e30"), (Duration::from_secs(5), 240.0))`, would make the parser total for both fields. Verdict: **ready**. The follow-up is optional, a diagnostics switch only. AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
MoonEyes commented 2026-12-02 18:21:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:21:29Z.


RUN (in game, batch of seventeen render-path pull requests), each head merged with git merge --no-ff onto main 3c106eb2f, in one build: #3111 15b579756, #2948 5284c6eae, #2698 1f188c4f7, #2946 44bf554fe, #3001 d924cbb65, #2832 0c861595a, #2915 58e8535cf, #2822 d359a2f85, #2896 c9c6b103d, #2983 8278ef1b9, #3115 ba5121192, #2945 d2c08c14f, #2975 74512d658, #2951 26da88e8e, #2800 b6ebcedd4, #2893 7c7e99b48, #3113 fa1460b6b (and #3097 0d7a451ab, merged since). RTX 4060 8 GB, driver 610.88, Windows 11. Series S, -Resolution 1080, frame generation 2x, the same walking route as the other runs on this machine, 330 s after reaching the world.

What Result
Device lost / device removed 0
Exceptions, panics, hang watchdog, GPU stall, title suspended 0
Process alive at the end yes, stopped by the time limit
Rendered fps, last 240 s (43 samples) median 14.6, mean 12.7
Rendered fps, last 120 s median 13.7
Time under 5 fps in the world 13 % (short drops, lowest sample 0.3 fps)

The drops under 5 fps line up with shaders being translated while walking (about 500 translations in the last 330 s): this batch changes the shader translation, so the shader cache built by earlier runs did not apply and the pipeline precompile alone took about 45 minutes. The batch-5 run on the same machine and route had no sample under 5 fps (median 16.4). I read this as cold-cache stutter, not as a regression of a single pull request, but this run cannot tell them apart.

Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this batch, on the heads listed above. If one of these pull requests changes its head, this run no longer covers it.

Limits: one run; arrival in the world was driven by keys and not checked on pictures. A first attempt of this batch is not counted: the run script gave up waiting for the game window after 40 minutes of precompile.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7354438131 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2983#issuecomment-7354438131). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:21:29Z. --- RUN (in game, batch of seventeen render-path pull requests), each head merged with `git merge --no-ff` onto main `3c106eb2f`, in one build: #3111 `15b579756`, #2948 `5284c6eae`, #2698 `1f188c4f7`, #2946 `44bf554fe`, #3001 `d924cbb65`, #2832 `0c861595a`, #2915 `58e8535cf`, #2822 `d359a2f85`, #2896 `c9c6b103d`, #2983 `8278ef1b9`, #3115 `ba5121192`, #2945 `d2c08c14f`, #2975 `74512d658`, #2951 `26da88e8e`, #2800 `b6ebcedd4`, #2893 `7c7e99b48`, #3113 `fa1460b6b` (and #3097 `0d7a451ab`, merged since). RTX 4060 8 GB, driver 610.88, Windows 11. Series S, `-Resolution 1080`, frame generation 2x, the same walking route as the other runs on this machine, 330 s after reaching the world. | What | Result | |---|---| | Device lost / device removed | 0 | | Exceptions, panics, hang watchdog, GPU stall, title suspended | 0 | | Process alive at the end | yes, stopped by the time limit | | Rendered fps, last 240 s (43 samples) | median 14.6, mean 12.7 | | Rendered fps, last 120 s | median 13.7 | | Time under 5 fps in the world | 13 % (short drops, lowest sample 0.3 fps) | The drops under 5 fps line up with shaders being translated while walking (about 500 translations in the last 330 s): this batch changes the shader translation, so the shader cache built by earlier runs did not apply and the pipeline precompile alone took about 45 minutes. The batch-5 run on the same machine and route had no sample under 5 fps (median 16.4). I read this as cold-cache stutter, not as a regression of a single pull request, but this run cannot tell them apart. Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this batch, on the heads listed above. If one of these pull requests changes its head, this run no longer covers it. Limits: one run; arrival in the world was driven by keys and not checked on pictures. A first attempt of this batch is not counted: the run script gave up waiting for the game window after 40 minutes of precompile. AI-assisted (Claude Code).
bobcatchris commented 2026-12-02 21:03:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-12-02T21:03:57Z.


@andrew-ai @merzleckeier @MoonEyes Updated in fast-forward commit 0c06251a0 to address all three remaining points:

  1. Exact u32::MAX & fractional truncation in parse_teleport (d3d12/apps/leonida/src/player.rs): Parse fields 0..4 as finite f32 and the optional 5th hold field directly as f64 (finite, <= f64::from(u32::MAX)) with truncation (h.max(0.0) as u32), so 4294967295 returns Some(..., u32::MAX), 4294967296 returns None, and 1.9 truncates to 1 (addressing @andrew-ai).
  2. Bounded sampling length in parse_find_schedule: Require Duration::try_from_secs_f64(*s).is_ok() on seconds so 5, 1e30 and 5, 1e308 fall back to 240.0 (matching the doc comment and addressing @merzleckeier / @MoonEyes).
  3. Tests: Added boundary cases for 4294967295, 4294967296, 1.9, -inf, and 5, 1e30 / 5, 1e308.

Note for @MoonEyes: new commit 0c06251a0 advances the head past 8278ef1b9, so #2983 will need re-inclusion in a batch in-game run.

Verified on Windows 11 (Rust 1.98.1):

  • cargo test --locked -p leonida --bin leonida -- player::tests (default and --features diagnostics): 4 passed, 0 failed
  • cargo clippy --locked --no-deps -p leonida --all-targets -- -D warnings: 0 warnings, exit 0
  • python -I tools/d3d12_switches.py --check d3d12/docs/switches.md & python -I scripts/check_no_game_data.py d3d12/apps/leonida/src/player.rs: exit 0
  • Independent read-only review pass: APPROVE

AI-assisted: Gemini 4 Neon

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7358738877 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2983#issuecomment-7358738877). Originally posted by [bobcatchris](https://github.com/bobcatchris) on 2026-12-02T21:03:57Z. --- @andrew-ai @merzleckeier @MoonEyes Updated in fast-forward commit `0c06251a0` to address all three remaining points: 1. **Exact `u32::MAX` & fractional truncation in `parse_teleport` (`d3d12/apps/leonida/src/player.rs`)**: Parse fields `0..4` as finite `f32` and the optional 5th `hold` field directly as `f64` (finite, `<= f64::from(u32::MAX)`) with truncation (`h.max(0.0) as u32`), so `4294967295` returns `Some(..., u32::MAX)`, `4294967296` returns `None`, and `1.9` truncates to `1` (addressing `@andrew-ai`). 2. **Bounded sampling length in `parse_find_schedule`**: Require `Duration::try_from_secs_f64(*s).is_ok()` on `seconds` so `5, 1e30` and `5, 1e308` fall back to `240.0` (matching the doc comment and addressing `@merzleckeier` / `@MoonEyes`). 3. **Tests**: Added boundary cases for `4294967295`, `4294967296`, `1.9`, `-inf`, and `5, 1e30` / `5, 1e308`. Note for `@MoonEyes`: new commit `0c06251a0` advances the head past `8278ef1b9`, so `#2983` will need re-inclusion in a batch in-game run. Verified on Windows 11 (Rust 1.98.1): - `cargo test --locked -p leonida --bin leonida -- player::tests` (default and `--features diagnostics`): **4 passed, 0 failed** - `cargo clippy --locked --no-deps -p leonida --all-targets -- -D warnings`: 0 warnings, exit 0 - `python -I tools/d3d12_switches.py --check d3d12/docs/switches.md` & `python -I scripts/check_no_game_data.py d3d12/apps/leonida/src/player.rs`: exit 0 - Independent read-only review pass: `APPROVE` AI-assisted: Gemini 4 Neon
fiestorra commented 2026-12-03 05:08:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T05:08:31Z.


VERIFY-2983 — 115 líneas en player.rs y 1 test en todo el binario, que es el número que quiero mirar

d3d12/apps/leonida/src/player.rs       | 115 ++++++++++++++++++++++++++++++++--
d3d12/apps/leonida/src/player_find.rs  |  28 ++++-----
2 files changed, 123 insertions(+), 20 deletions(-)

cargo test -p leonida    1 passed; 0 failed     ← el binario entero

El título: D3D12-PLAYER-SCHEDULE-FLOAT-DURATION: validate float delays and du… — validar retrasos en coma flotante y duraciones.

Y el cambio es de los que se prueban solos: un jugador de grabación que recibe un float de un fichero y lo usa como espera — NaN, inf, negativo, cero, o un valor absurdo. Eso es una función pura sobre un número, y se prueba con cinco valores.

El binario entero tiene un test. No digo que este PR deba traer la suite; digo que con 115 líneas de validación de un valor, el caso que el PR arregla es exactamente el que no está en ese único test.

Lo que verifiqué: el binario compila y su único test pasa — lo cual, para un cambio de validación de entrada, no dice casi nada.
Lo que no puedo verificar: un fichero de jugador con un NaN dentro, porque eso requiere el título y una grabación; pero la función que lo valida no.
Y la pregunta, en una línea: ¿qué hace el jugador con inf? Si la respuesta es «lo que hiciera antes», el cambio cubre NaN y deja el otro caso abierto.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7368418307 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2983#issuecomment-7368418307). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T05:08:31Z. --- ## VERIFY-2983 — 115 líneas en `player.rs` y **1 test** en todo el binario, que es el número que quiero mirar ``` d3d12/apps/leonida/src/player.rs | 115 ++++++++++++++++++++++++++++++++-- d3d12/apps/leonida/src/player_find.rs | 28 ++++----- 2 files changed, 123 insertions(+), 20 deletions(-) cargo test -p leonida 1 passed; 0 failed ← el binario entero ``` **El título**: **`D3D12-PLAYER-SCHEDULE-FLOAT-DURATION: validate float delays and du…`** — **validar retrasos en coma flotante y duraciones.** **Y el cambio es de los que se prueban solos**: **un jugador de grabación que recibe un `float` de un fichero y lo usa como espera** — **`NaN`, `inf`, negativo, cero, o un valor absurdo.** **Eso es una función pura sobre un número, y se prueba con cinco valores.** **El binario entero tiene *un* test.** **No digo que este PR deba traer la suite; digo que con 115 líneas de validación de un valor, el caso que el PR arregla es exactamente el que no está en ese único test.** **Lo que verifiqué**: **el binario compila y su único test pasa** — **lo cual, para un cambio de validación de entrada, no dice casi nada.** **Lo que no puedo verificar**: **un fichero de jugador con un `NaN` dentro**, **porque eso requiere el título y una grabación; pero la función que lo valida no.** **Y la pregunta, en una línea**: **¿qué hace el jugador con `inf`?** **Si la respuesta es «lo que hiciera antes», el cambio cubre `NaN` y deja el otro caso abierto.**
merzleckeier commented 2026-12-03 05:17:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T05:17:17Z.


Rechecked 0c06251a merged cleanly onto d9b618f10. I cross-built the Windows MSVC leonida test binary and ran player::tests:: under Wine, both with the default features and with --features diagnostics. Each run executed all four tests, with zero skips or failures. The tests cover the inf and -inf cases, the 1e30/1e308 sampling lengths from my earlier review, the exact u32::MAX hold boundary, and fractional hold truncation.

main.rs includes the player module only for Windows targets, so Windows-target output is the relevant test count for the parser. This verifies the current head’s parser follow-up using synthetic inputs. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7368576966 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2983#issuecomment-7368576966). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T05:17:17Z. --- Rechecked `0c06251a` merged cleanly onto `d9b618f10`. I cross-built the Windows MSVC `leonida` test binary and ran `player::tests::` under Wine, both with the default features and with `--features diagnostics`. Each run executed all four tests, with zero skips or failures. The tests cover the `inf` and `-inf` cases, the `1e30`/`1e308` sampling lengths from my earlier review, the exact `u32::MAX` hold boundary, and fractional hold truncation. `main.rs` includes the `player` module only for Windows targets, so Windows-target output is the relevant test count for the parser. This verifies the current head’s parser follow-up using synthetic inputs. AI-assisted with OpenAI Codex.
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/2983:upstream-pr/2983'
git switch 'upstream-pr/2983'

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/2983'
git switch 'upstream-pr/2983'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2983'
git switch 'upstream-pr/2983'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2983'
git switch 'main'
git merge --squash 'upstream-pr/2983'
git switch 'main'
git merge --ff-only 'upstream-pr/2983'
git switch 'main'
git merge 'upstream-pr/2983'
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!2983
No description provided.