D3D12-PLAYER-SCHEDULE-FLOAT-DURATION: validate float delays and durations in player and player_find #2983
Open
github-bot
wants to merge 3 commits from
github-bot/gh-2983 into main
AGit
pull from: github-bot/gh-2983
merge into: github:main
github:main
github:perf/darner-title-priority-ceiling
github:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
github:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
github:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
github:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
github:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
github:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
github:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
github:fix/runtime-test-conservative-fixtures
github:ci/shard-semantic-linux
github:docs/fg-limit-fps-switch
github:fix/runtime-test-fixture-paths
github:fix/runtime-test-fixture-readers
github:fix/read-file-hard-link
github:fix/book-slot-heap-never-read
github:fix/depth-resolve-spv-path
github:fix/indirect-unused-batched
github:gh-pr/3358/base
github:fix/xmem-refusal-diagnostics
github:gh-pr/3357/base
github:ci/shorten-ci-time
github:fix/alias-later-queued-submissions
github:claude/gallant-sagan-aamatr
github:gh-pr/3342/base
github:gh-pr/3341/base
github:d3d12/agility-sdk-621
github:gh-pr/3293/base
github:gh-pr/3319/base
github:gh-pr/3318/base
github:gh-pr/3315/base
github:gh-pr/3313/base
github:gh-pr/3314/base
github:claude/fervent-curie-m19lnr
github:gh-pr/3216/base
github:gh-pr/3272/base
github:gh-pr/3276/base
github:gh-pr/3279/base
github:gh-pr/3257/base
github:gh-pr/3258/base
github:gh-pr/3271/base
github:codex/skip-no-hit-ray-passes
github:gh-pr/3230/base
github:gh-pr/3266/base
github:gh-pr/3247/base
github:gh-pr/3246/base
github:gh-pr/3244/base
github:claude/sharp-sagan-1jqnp3
github:t3/preserve-fsr-sdk-restart-path
github:t3/propagate-host-failure-hresult
github:t3/launcher-custom-parameters
github:t3/series-x-2160-startup
github:codex/d3d12-uncapped-simulation
github:ci/less-to-run
github:perf/native-compute-shader-forms
github:claude/blissful-franklin-ukp7ag
github:codex/full-precompile-default
github:gh-pr/3166/base
github:gh-pr/3148/base
github:gh-pr/3138/base
github:gh-pr/3106/base
github:gh-pr/3057/base
github:gh-pr/2756/base
github:gh-pr/2812/base
github:gh-pr/3032/base
github:gh-pr/2992/base
github:notes/card-time-and-plant-flicker
github:gh-pr/2986/base
github:gh-pr/3000/base
github:gh-pr/2966/base
github:gh-pr/2924/base
github:gh-pr/726/base
github:gh-pr/2761/base
github:gh-pr/2663/base
github:gh-pr/2861/base
github:gh-pr/2862/base
github:gh-pr/2820/base
github:gh-pr/2811/base
github:gh-pr/2803/base
github:rt-call-trace
github:gh-pr/2802/base
github:gh-pr/2766/base
github:perf/ahead-split
github:gh-pr/2589/base
github:gh-pr/2699/base
github:gh-pr/2696/base
github:docs/readme-runtime-proposal
github:gh-pr/1346/base
github:codex/coord-claim-check-20261124-7e48
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
area: ci
.github/ workflows and settings
area: d3d12
The D3D12 runtime in d3d12/ (Rust: leonida.exe and its crates)
area: docs
Documentation
area: launcher
The launcher (launcher/)
area: runtime (legacy)
The earlier Vulkan runtime in runtime/
area: shader translator
The shader translator (leonida-shader, tools/rdna2spirv) and its tests
area: tools
tools/ and scripts/
area: viewer
The map viewer (viewer/)
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
missing claim
Needs a claim in #14
needs in-game run
Changes the code a frame runs through: needs the 300 s in-game gate (docs/game_gate.md)
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
wontfix
This will not be worked on
No labels
accessibility
area: ci
area: d3d12
area: docs
area: launcher
area: runtime (legacy)
area: shader translator
area: tools
area: viewer
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs in-game run
needs rebase
needs-triage
question
ready-for-agent
submodules
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
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!2983
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2983"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@bobcatchris on GitHub · 2026-12-01 22:26 UTC · original
bobcatchris:fix/d3d12-player-schedule-float-duration→main· +123 −20 · 2 files · 3 commits · openSummary
Claimed in the coordination issue as:
D3D12-PLAYER-SCHEDULE-FLOAT-DURATION(#2570).Guards floating-point delay, duration, and schedule env parsing against
NaN,inf,-inf, and out-of-range values ind3d12/apps/leonida/src/:player.rs(parse_teleport): replaces rawDuration::from_secs_f32(delay)/ unvalidated floats forLEONIDA_TELEPORTwith finite checks andDuration::try_from_secs_f32(n[0].max(0.0))(rejecting non-finite coordinates orholdvalues too).player.rs+player_find.rs(parse_find_schedule,parse_probe_at):LEONIDA_FIND_PLAYERuses positional parsing withis_finite()+Duration::try_from_secs_f64fordelayandis_finite() && *s >= 0.0andDuration::try_from_secs_f64forseconds(preventing bothDurationpanics oninf/1e30and unbounded1e30/1e308/NaN/infsampling timeouts).LEONIDA_PLAYER_PROBEstoresOption<Duration>viaparse_probe_atand computesat.saturating_sub(config.started.elapsed()), preventingDuration::from_secs_f64panics oninf/1e30.parse_find_schedule/parse_probe_atunder#[cfg(any(feature = "diagnostics", test))]soplayer::testsexercises all three parsers in CI's defaultcargo test --workspacerun as well as--features diagnostics.Tests & Verification
parse_teleportandparse_probe_attoDuration::from_secs_f32/f64: 2/2 new tests FAIL (RED_BOTH_EXIT=101).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 on GitHub · 2026-12-01 22:30 UTC · original
Two remaining edge cases in parse_teleport at
e74ca4752. I compiled the exact parse_numbers and parse_teleport functions into a standalone Rust harness: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 on GitHub · 2026-12-01 22:45 UTC · original
Updated in fast-forward commit
8278ef1b9to address both edge cases inparse_teleportfrom @andrew-ai:parse_teleportnow parses every field directly (splitting by,/;when present or whitespace otherwise) and requires4..=5finite floats instead of delegating toparse_numbers'sfilter_map, so5,1,typo,3,500and5,1,,3,500are rejected (None) rather than shifting coordinates/hold whileparse_numbersremains unchanged for its other callers.f64::from(h) <= f64::from(u32::MAX)before converting tou32, rejecting values such as1e30(andu32::MAX as f32which rounds up to2^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 on GitHub · 2026-12-01 22:50 UTC · original
Rechecked
e74ca4752and8278ef1b9with 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 on GitHub · 2026-12-01 22:58 UTC · original
The finder still accepts finite sampling lengths that cannot fit in a Duration.
I compiled the exact
parse_find_schedulefrom8278ef1b9integrated into002bd88f8, and compared it with the original argument parsing on that main.5,NaNand5,infnow fall back to(5 s, 240 s), which is the intended improvement.5,1e30and5,1e308still return(5 s, 1e30 s)and(5 s, 1e308 s). Both values failDuration::try_from_secs_f64. The finder compares floating-point elapsed seconds withconfig.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 controls5,2.5,5,0, and1e30,30give(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 on GitHub · 2026-12-02 05:17 UTC · original
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
leonidabinary 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 aDuration(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 currentmain(8422def7), merge base66c79286, 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_PLAYERandLEONIDA_PLAYER_PROBEare parsed withf32::parse/f64::parse, which acceptnan,infand1e30, and the results went straight intoDuration::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:
parse_find_schedulefalls back to the defaults (90 s, 240 s) for a delay or a duration that is not finite or not in range, andparse_probe_atanswersNonefor one.Config::probe_atbecomes aDurationinstead of anf64, and the probe waitsat.saturating_sub(elapsed)instead of subtracting twof64s.2. The new test checks the property that matters
Two unit tests in
player::tests:parse_teleport_rejects_non_finite_and_out_of_range_durationsandfind_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):
So on the base:
LEONIDA_TELEPORT=1e30,1,2,3panics in the teleport thread (the teleport never happens),LEONIDA_TELEPORT=5,1,2,3,1e30holds the key for 49.7 days (f32 as u32saturates), andLEONIDA_FIND_PLAYER=1e30panics in the finder thread the same way (player_find.rs:241on 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-gpuand therefore theleonidaapp do not compile on Linux (6 errors inleonida-gpu), so the crate was cross-compiled forx86_64-pc-windows-gnuand its tests were run under Wine 11.21.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,600was 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
LEONIDA_TELEPORTis 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.mingw64GNU toolchain, not MSVC: the crate is Windows-only, so this is the closest thing to the CI'swindows-latestrun available here; the numbers above are from the cross-compiled build.@MoonEyes on GitHub · 2026-12-02 12:34 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:mainSHA it was merged onto;mainalone 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 18:02 UTC · original
Code review only, not built (Windows-only
leonidaapp). Ready, with one small follow-up.8278ef1b9, merge base66c79286f, 342 behind currentmain45dc41f95. A trial merge is clean. CI on the head: all 6 checks pass.Review of
d3d12/apps/leonida/src/player.rsandplayer_find.rs:parse_teleport,parse_find_scheduleandparse_probe_atare pulled out and made total, sonan,infand out-of-range values no longer reachDuration::from_secs_f*, which panics on them, or the title's memory.probe_at: Option<Duration>withsaturating_subremoves the float subtraction.parse_teleportnow requires 4 to 5 finite fields and a hold that fits inu32, checked inf64becauseu32::MAX as f32rounds to 2^32.Follow-up, open since merzleckeier's comment:
parse_find_schedule("5, 1e30")still returns a sampling length of1e30s (likewise1e308). It does not panic, because the finder comparesf64seconds, so this is unchanged frommain. But the elapsed-time stop never fires. Applying the sameDuration::try_from_secs_f64representability check tosecondsas to the delay, with the suggestedassert_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
@MoonEyes on GitHub · 2026-12-02 18:21 UTC · original
RUN (in game, batch of seventeen render-path pull requests), each head merged with
git merge --no-ffonto main3c106eb2f, in one build: #311115b579756, #29485284c6eae, #26981f188c4f7, #294644bf554fe, #3001d924cbb65, #28320c861595a, #291558e8535cf, #2822d359a2f85, #2896c9c6b103d, #29838278ef1b9, #3115ba5121192, #2945d2c08c14f, #297574512d658, #295126da88e8e, #2800b6ebcedd4, #28937c7e99b48, #3113fa1460b6b(and #30970d7a451ab, 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.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 on GitHub · 2026-12-02 21:03 UTC · original
@andrew-ai @merzleckeier @MoonEyes Updated in fast-forward commit
0c06251a0to address all three remaining points:u32::MAX& fractional truncation inparse_teleport(d3d12/apps/leonida/src/player.rs): Parse fields0..4as finitef32and the optional 5thholdfield directly asf64(finite,<= f64::from(u32::MAX)) with truncation (h.max(0.0) as u32), so4294967295returnsSome(..., u32::MAX),4294967296returnsNone, and1.9truncates to1(addressing@andrew-ai).parse_find_schedule: RequireDuration::try_from_secs_f64(*s).is_ok()onsecondsso5, 1e30and5, 1e308fall back to240.0(matching the doc comment and addressing@merzleckeier/@MoonEyes).4294967295,4294967296,1.9,-inf, and5, 1e30/5, 1e308.Note for
@MoonEyes: new commit0c06251a0advances the head past8278ef1b9, so#2983will 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 failedcargo clippy --locked --no-deps -p leonida --all-targets -- -D warnings: 0 warnings, exit 0python -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 0APPROVEAI-assisted: Gemini 4 Neon
@fiestorra on GitHub · 2026-12-03 05:08 UTC · original
VERIFY-2983 — 115 líneas en
player.rsy 1 test en todo el binario, que es el número que quiero mirarEl 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
floatde 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
NaNdentro, 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 cubreNaNy deja el otro caso abierto.@merzleckeier on GitHub · 2026-12-03 05:17 UTC · original
Rechecked
0c06251amerged cleanly ontod9b618f10. I cross-built the Windows MSVCleonidatest binary and ranplayer::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 theinfand-infcases, the1e30/1e308sampling lengths from my earlier review, the exactu32::MAXhold boundary, and fractional hold truncation.main.rsincludes theplayermodule 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.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.