d3d12: an in-game gate: one command, one run folder, one summary.json (D3D12-GAME-GATE) #2782
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2782"
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?
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-30T19:40:25Z.
Claimed in the coordination issue as: D3D12-GAME-GATE (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7288010093)
What and why
In-game gates and A/Bs were run by hand on five machines (MoonEyes, OreoFR, enlighted, DadaCap, mine), each with its own launcher wrapper and log parsers. Runs were lost to agent consoles and to key files read while written. The precompile lines were never kept. Verdicts were written in free text.
This adds one command and one result format. The format was circulated on the bridge as a draft first, and the testers' answers are folded in.
scripts/game-gate.ps1 run|start|stoprunsleonida.exethrough this checkout'sscripts/play-d3d12.ps1, so a run is what players run, and writes one folder per run under-RunRoot:run.json,launch.ps1, the-DryRunsettings, and the F1 settings file when there is one;launcher.txt, the precompile lines;leonida.log, the runtime's log with one line per present;events.jsonl, what the gate did and saw;data\, a copy of the tester's data template, so their own saves are never touched;summary.json.WM_SYSCOMMAND/SC_CLOSEonce-WorldSeconds(300) were spent in the world, on a STOP file (stop), or after-MaxMinutes. That is the runtime's own end: the title is suspended and the pipeline cache saved. A plainWM_CLOSEdoes not end the title. It kills the game only 60 s later.startruns the same thing detached, created through CIM, so the end of an agent's or a console's job does not end the run. Asupervisor.logkeeps its output.tools/game_gate.py(standard library) turns the folder intosummary.json(leonida-gate-summary/1, described indocs/game_gate.md). It has:settingsline, #2775, so no paths), precompile counts;Not in this one: a Lua driver for the menus, an ABBA runner, a time series, VRAM peaks, a "memory rising" warning, and the Vulkan runtime.
Tested
On Windows 11 Pro 10.0.26300:
tests/test_game_gate.py, 20 tests, all passing:They run in the standard-library CI loop.
test_docs_design_rows.py,test_ci_registration.py,check_no_game_data.pyandgit diff --checkare clean.In game, RTX 3080 10 GB, driver 32.0.16.2140, Series S profile,
main8f41d7d01:present_gap(11.4 s without a frame during the compile storm), as intended for a cold run. This run found the variable trap, which is now fixed and tested.start, 300 s target: world at 85 s, 304 s in the world. Stopped with SC_CLOSE: exit 0 in 6 s, cache saved, title suspended. 26.9 fps median, p5 22.9, longest gap 0.39 s, no crash. PASS.stop35 s into the world: ERRORstopped_early, with a clean stop (exit 0, cache saved).GPUs tested: NVIDIA GeForce RTX 3080 10 GB, driver 32.0.16.2140, Windows 11 Pro 10.0.26300.
AI-assisted: yes
Checklist
mainand merges cleanly.docs/design.md, with how it was confirmed. (Not applicable: no translator change.)Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-30T19:45:34Z.
Verified by OreoFR on macOS 27.2.1, Apple M5, Python 3.12.16,
main51dbc5b58merged with headb535fb0dc.tests/test_game_gate.py20 passed;python -I tests/test_game_gate.pyOK. Red (main+ only the test): 1 error at import, as expected for a new tool.python -I scripts/check_no_game_data.pyontools/game_gate.py,tests/test_game_gate.py,docs/game_gate.md: clean.main:tests/test_docs_*.py57 passed there):tests/test_docs_cli_flags.py::DocsCliFlags::test_fenced_commands_use_the_flags_of_their_tool,('docs/game_gate.md:19', 'scripts/game-gate.ps1', '-NoFrameGen'). Line 19 shows-PlayArgs '-SeriesS -NoFrameGen': those are the game's flags inside a string, but the checker reads-NoFrameGenas a flag ofgame-gate.ps1, which has no such parameter. Thecheckjob should hit the same failure. Possible fixes: show the game flags outside the fenced command (in the prose or a separate block), or a placeholder such as-PlayArgs '<game flags>'.scripts/game-gate.ps1itself (needs PowerShell and the game).AI-assisted: Claude Code
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-30T19:52:11Z.
Thanks, OreoFR. Confirmed and fixed in the new head of this pull request.
tests/test_docs_cli_flags.pyread the-SeriesS -NoFrameGeninside-PlayArgs '...'in the fenced command ofdocs/game_gate.mdas flags ofgame-gate.ps1. The block now shows-PlayArgs '<play-d3d12.ps1 switches>', and the text gives-SeriesS -NoFrameGenas the example.test_docs_cli_flags.py,test_game_gate.py(20) andtest_docs_design_rows.pypass. Onlydocs/game_gate.mdchanged.Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-30T19:57:59Z.
Re-checked by OreoFR on the new head
22e096e47merged withmain0f86bd594(macOS 27.2.1, Apple M5, Python 3.12.16):tests/test_game_gate.py20 passed;tests/test_docs_*.py57 passed, 134 subtests passed (thetest_docs_cli_flagsfailure is gone);check_no_game_data.pyon the three changed files: clean.scripts/game-gate.ps1itself is not covered here (needs PowerShell and the game).AI-assisted: Claude Code
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-30T20:30:04Z.
CI
checkandlinux-python-and-viewerfailed ontests/test_tool_stdout_encoding.py:tools/game_gate.py's__main__block did not seterrors="replace"on stdout (that test came tomainafter this branch). Fixed inbe96bdadewith the same guard astools/d3d12_run_fps.py. On Windows:test_tool_stdout_encoding.pyOK,test_game_gate.py20 OK, merge with currentmainclean.Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-30T20:34:36Z.
Re-checked by OreoFR on the new head
be96bdademerged withmaind8ca18240(macOS 27.2.1, Apple M5, Python 3.12.16):tests/test_game_gate.py20 passed;tests/test_tool_stdout_encoding.py4 passed (the new stdout guard);tests/test_docs_*.py57 passed.AI-assisted: Claude Code
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-30T20:47:58Z.
Verified on Windows, and one thing the suite cannot currently tell apart: replacing
statistics.median()withmax()inparse_framesleaves all 20 tests passing.What was run, at
d60df1525cherry-picked ontomaind8ca18240in a clean worktree, Python 3.13.14:Control, compile level: with
tools/game_gate.pyremoved the suite does not collect (ImportErroron the test module), so the tests are bound to the tool.Control, behaviour level, and this is the finding:
Why it passes: every case writes frames at one constant rate, so for each fixture
median == max == mean.assertEqual(s["fps"]["median"], 50.0)is satisfied by any of the three, andmedian(L291, L311) is therefore not tested as a median.The smallest change that closes it: one case with a varying rate - say alternating 40 and 60 fps, or an even number of 40s and 60s - asserting
median == 50while the maximum is 60. That single case makes the mutation above fail, and it is the case a real run produces anyway, since a title does not hold one frame rate.The other numbers I checked are not affected -
world_at_s == 70.0,fps.source == "presents", the exit code,cache_savedandcrash.kindall moved when I mutated what feeds them, so the gap is specific to the rate statistics.Two things I could not test here: the
game-gate.ps1launcher (it drives a real run folder and this is not the machine for it) and anything that needs game data - both are outside theno-game-databoundary this suite is built for.AI-assisted: yes - DeepSeek v4.1 (flash). The mutation is the point of the comment, not a verdict on the PR: the tool and its 20 passing tests are a solid addition.
Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-30T20:53:43Z.
RUN (independent run on Windows, #2782 head
be96bdade, tested as it is; it merges cleanly into maind8ca18240pergit merge-tree --write-tree. CI onbe96bdade: change-scope, check, linux-gpu-tools, linux-python-and-viewer, no-game-data, semantic-tests and windows pass; wine skipped. Sinceb535fb0dc, the first head I tested, onlydocs/game_gate.md(one line) and the stdout guard intools/game_gate.py's__main__block (4 lines) changed;scripts/game-gate.ps1is identical.)Commands, from the repository root,
python -I(Python 3.13.12), at low priority:python -I -m unittest discover -s tests -p test_game_gate.pyonbe96bdade: 20 tests OK (the synthetic logs, plus the contract test that the runtime still writes the lines the parser reads).python -I -m unittest discover -s tests -p test_tool_stdout_encoding.pyonbe96bdade: 4 tests OK.ImportError, nogame_gate).b535fb0dc; the gap mutant again onbe96bdade). Each one fails tests:GAP_FAIL_S:test_a_run_frozen_on_a_compile_fails_though_alivefails;world_s < 0):test_too_little_world_time_at_the_time_limit_failsandtest_a_stop_file_before_the_world_time_is_an_errorfail;test_a_lost_device_fails_by_its_exit_code_and_its_reportandtest_an_out_of_memory_list_close_counts_as_a_lost_devicefail;test_a_panic_fails_even_with_the_title_alivefails;test_dying_before_the_stop_failsfails.scripts/game-gate.ps1parses with no error in Windows PowerShell 5.1 and in PowerShell 7 ([System.Management.Automation.Language.Parser]::ParseFile).docs/README.mdchanges:test_i18n_index.py9 OK andtest_docs_design_rows.py5 OK.In-game run on the RTX 3090: #2613's gate (head
c6a8f7164) run withscripts/game-gate.ps1 -WorldSeconds 600 -MaxMinutes 20,-SeriesS -NoDlss -NoFrameGen, Enter through a keys file until the world. The tool gave PASS, no device loss, no crash, exit 0x0 'clean', stopped by the window close (no kill, cache saved), save copied into the run folder. Against my own sampler on the same run: seconds in the world 607.9 vs 608; device loss, crash and exit code agree; fps median 11.2 (tool, presents after world+60 s) vs 10.1 (runtime fps lines from the world on), consistent given the different bases. (That run used22e096e47;game-gate.ps1is the same there, andgame_gate.pydiffers only by the 4-line stdout guard.)Review notes (not blocking):
run.jsonsaiddirty: falsewhile two untracked files had been copied into the worktree. The script usesgit status --porcelain --untracked-files=no(game-gate.ps1line 122), so untracked files are left out on purpose or by accident. Worth a word indocs/game_gate.md, or a separate field.world_at_scounts from the start of the run, precompile included: 347 s in that run, about 276 s of it precompile. So it is not the game's own time to the world. Worth documenting, or a second field from the game's start.under_2_at_scame out at 356 s, 9 s after arrival, on a loading dip. The scan starts at the second the world is reached (fps_block, fromint(world)), not atwarm_at_sor at world+60 s like the median. Counting it fromwarm_at_swould say more. The longest present gap is also measured from the world on, so a long load hitch right after arrival can fail a run onpresent_gap.Machine: Windows 11 Pro 26300, i9-13900K, 64 GB, RTX 3090 24 GB, NVIDIA 621.40.
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-30T20:58:47Z.
Thanks for the run and the mutants. The four notes, in
46ea66693:dirtystays "a tracked file changed".run.jsonand the summary now carryuntracked, the number of files git does not track.docs/game_gate.mdsays both.world_at_s. It counts from the gate's start, like every time in the summary, so the precompile is in it. The docs say so now, and give the precompile's own seconds (precompile.shaders_s,precompile.made_s). I did not add a derived field: the two bases are already there.under_2_at_s. It now counts from 60 s in the world, the base the median already uses, so an arrival dip is no longer the run's. New testtest_a_dip_on_arrival_is_not_the_first_second_under_2: it fails with the previousgame_gate.py(it found 70 s) and passes now (300 s).The longest gap between presents stays measured from the world on, on purpose. A freeze on pipeline compiles comes right after arrival (DadaCap's case), and 10 s with no frame is what a player sees. The docs give that reason.
On Windows:
test_game_gate.py21 OK (with the previousgame_gate.py, the two changed tests fail). The docs tests andtest_tool_stdout_encoding.pypass.check_no_game_data.pyis clean, the script parses in PowerShell 7, and the merge with currentmainis clean.Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-30T21:04:57Z.
Verified by MoonEyes (another person than the author) on head
46ea66693merged withmaind8ca18240: Windows 11, Python 3.14.tests/test_game_gate.pyOK. Docs andtest_tool_stdout_encodingOK. Red: the test does not import without the new tool. No game run from me (#2782 was run by enlight3d on an RTX 3090).AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-30T21:09:54Z.
Native Windows CLI handoff check with the merged A/B comparator from #2783. Tested
46ea66693merged ontoa596adfac(treeb7cc594c8). I generated synthetic gate logs with menu and world presents, real timestamp parsing, and a known 5 ms B improvement plus 0.5 ms of drift per run. The Windows paths contained spaces, an apostrophe, and an ampersand.game_gate.py summarywrote all ten summaries.d3d12_ab_compare.py abbaconsumed them directly. It used the four balanced pairs, excluded the pair containing the device-loss fixture, and reported B faster, −4.999 ms, with a 95% interval of −5.913 to −4.085 ms. The discarded run was labeledgate FAIL. All 21 game-gate tests and 13 comparator tests also passed.Synthetic logs only. This verifies the handoff and comparison arithmetic. AI-assisted with OpenAI Codex (GPT-6.2 Sol).
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-30T21:11:40Z.
Re-checked by OreoFR on the new head
46ea66693merged withmaina596adfac(macOS 27.2.1, Apple M5, Python 3.12.16):tests/test_game_gate.py21 passed;tests/test_tool_stdout_encoding.py4 passed;tests/test_docs_*.py57 passed.AI-assisted: Claude Code
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-30T21:21:30Z.
Merging. Head
46ea66693merges cleanly withmaina596adfacand does not force a rebase of #2566. CI is green on this head. Checked on it by OreoFR (macOS), ecox982745 and me (Windows); the notes of enlight3d's RTX 3090 run are addressed in this head. Tooling, tests and docs only. Merged by MoonEyes.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-30T21:53:42Z.
Follow-up on #2782 head
46ea66693, after my RUN onbe96bdade. It merges cleanly into main407f71a23. CI on46ea66693: all checks pass (wine skipped).The delta be96bdade..46ea66693 is one commit, and only the review points:
run.jsongets anuntrackedcount (git status --porcelain --untracked-files=normal, the??lines) besidedirty, andsummary.jsoncarries it.under_2_at_sis now scanned from 60 s in the world, like the median (second = int(begin)instead ofint(world)), with a new test.docs/game_gate.mddocumentsworld_at_sand the rest.Commands, from the repository root,
python -I(Python 3.13.12), at low priority:python -I -m unittest discover -s tests -p test_game_gate.pyon46ea66693: 21 tests OK.tools/game_gate.pyand the new tests, 2 tests fail.test_a_dip_on_arrival_is_not_the_first_second_under_2gets 70.0 for 300.0: the old scan stops on the arrival dip.test_a_clean_run_in_the_world_passesfails withKeyError: 'untracked'. With 46ea66693's tool, both pass.python -I -m unittest discover -s tests -p test_tool_stdout_encoding.py: 4 tests OK.scripts/game-gate.ps1parses with no error in Windows PowerShell 5.1 and in PowerShell 7.Machine: Windows 11 Pro 26300, i9-13900K, 64 GB, RTX 3090 24 GB, NVIDIA 621.40.