tests: a game_gate case where the median is not the fastest half #2794
Open
github-bot
wants to merge 3 commits from
github-bot/gh-2794 into main
AGit
pull from: github-bot/gh-2794
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!2794
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2794"
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?
@fiestorra on GitHub · 2026-11-30 21:35 UTC · original
fiestorra:game-gate-varying-rate→main· +29 −0 · 1 files · 3 commits · openThe
game_gatesuite cannot currently tell a median from a maximum. This adds the case that can, and it is one test.The gap, found by mutation on #2782 before it merged: replacing
statistics.median()withmax()inparse_frames(both sites,tools/game_gate.py:291and:311) left all 20 tests passing. The reason is in the fixtures: every case writes one frame rate, so for each of themmedian == mean == max, andassertAlmostEqual(s["fps"]["median"], 50.0)is satisfied by any of the three.That is now in
main, since #2782 merged - so the assertion that reads "median" is not testing a median.The case added:
The windows are unequal on purpose and the presents are equal: 60 s at 40 fps and 40 s at 60 fps both give 2400 gaps, so the median gap is the mean of 16.67 and 25 ms - 48 fps - while
max()answers1000 / 25= 40. Equal durations would not have worked: the 60 fps half contributes 9000 presents to 6000, the median lands on 16.67, and the case reads 60 for both implementations. I tried that first and it passed the mutation.Measured, both arms:
So the mutation now fails on this case and the other 21 still pass - the case is pointed, which is what a regression test for a statistic should be.
p5is asserted too, because it is the other place a rate statistic is derived and it was equally indistinguishable:percentile(counted, 95)reads the slow half (40 fps) here.One file,
+16/-0, no tool code touched.AI-assisted: yes - DeepSeek v4.1 (flash). Found while reviewing #2782, whose author merged with the note on record; this closes it rather than re-litigating it.
Written with an AI assistant.
@OreoFR on GitHub · 2026-11-30 21:39 UTC · original
Verified by OreoFR on macOS 27.2.1, Apple M5, head
a2b1f1c93, main0b6e0e3bc. CPU only, no game files.MEASURED
tests/test_game_gate.pygives 22 passed on main + this test, and 22 passed on main + the PR (merge-tree).statistics.median(intools/game_gate.py(lines 279, 291, 296, 312, 315) replaced withmax(gives 1 failed, 21 passed. The only failure is the newtest_the_median_is_not_the_fastest_half(40.0 != 48.0 within 1.0 delta). That matches your result, and it also holds when all five sites are mutated, not just the two inparse_frames.READ IN CODE
AI-assisted: Claude Code
@aegish-zagi on GitHub · 2026-12-01 04:52 UTC · original
Verification — VERIFY-2794
Verdict: PASS
a2b1f1c9380ecba5dd086f7231dfef1721806602| merge state vs main: clean merge with current main5dd6d444fin a scratch worktree (merge commitbcd396bd1), no conflicts. Diff: test-only,tests/test_game_gate.py+16 lines, no production code touched.python -I tests/test_game_gate.pystatistics.median(withmax(intools/game_gate.py(all 5 sites; the PR describes the 2 fps sites at :291/:311).40.0 != 48.0 … the median of two equal halves is between them, not the slowest one.parse_framesdoes usestatistics.median.AI-assisted: yes (Muse Wonder, Muse by Meta)
@KelboLive on GitHub · 2026-12-01 05:40 UTC · original · reviewed
Confirmed here: 22 tests pass, and
max()at both median sites now fails only this case (40.0 != 48.0). So the assertion pins "median of intervals, then invert" and rejects max, mean-of-rates and median-of-rates.Two problems, though.
Fake.framesaccumulatest += gap: the 50 fps loop lands at 129.999…,frames(130, …)starts at 130.0, two presents stamp as18:02:10.000000, and the parser counts a 0.0 ms gap. Remove that one sample and the remaining 4,799 gaps have median 25 ms → 40.0 fps, exactlymax(), and the mutation passes with no warning. It also means a per-sample1000/gimplementation raisesZeroDivisionErrorinstead of failing an assertion. Generate the presents at exact timestamps (or slice a known 4,800-gap list) and assertfps.frames == 4800, so the case cannot drift.statistics.fmean(counted)gives 48.008 and passes — with equal halves that is unavoidable, but it is worth saying out loud, since the only thing keeping "median of rates" out (50.0) is a 2 fps margin.Nits: the comment says the halves are "equal in length" — they are 60 s and 40 s (the body has it right); "the a that gets read as a median" is garbled; and a blank line is missing before the next
def. Also note this fixture's run verdict is FAILpresent_gap(longest_present_gap_s = 200.017) because presents stop at 230 while the run ends at 430 — harmless for a statistics test, but not a run shape you would want copied elsewhere.@andrew-ai on GitHub · 2026-12-02 00:42 UTC · original
A small fixture adjustment can also catch a mean replacing the median. I ran the focused test at
a2b1f1c93on Windows, changing only the aggregation of counted present gaps. The current fixture passed with both statistics.median and statistics.fmean and failed with max, as expected for two equal-sized groups. Extending the 60 fps segment from t=230 to t=250 and expecting 60 fps made all three outcomes distinct: median passed, fmean reported 50.01 fps, and max reported 40.00 fps. The fifth-percentile assertion still passed with the production implementation. This gives the same test coverage for one additional realistic regression, with no runtime changes. Codex-assisted.@imShangLi on GitHub · 2026-12-02 05:57 UTC · original
VERIFY-2794 — Linux, Fedora 45, no GPU device, no game files, no title
Verdict: PASS. A pure test-coverage pull request: the new case is correct, it genuinely catches the regression it is written for, and nothing else in the repository is touched.
Head
a2b1f1c9, base the currentmain(0ae5a266), merge base0b6e0e3b, 1 file, +16/−0:tests/test_game_gate.py.1. What it changes
One new test method,
Measures.test_the_median_is_not_the_fastest_half, added totests/test_game_gate.pybetweentest_percentiles_come_from_the_presentsandtest_a_dip_on_arrival_is_not_the_first_second_under_2. It builds a synthetic run with two equal halves (40 fps then 60 fps, 2400 presents each) and asserts that the fpsmedianis 48 (between the two) and that the 5th percentile is 40 (the slow half). No source file changes.2. The claims it makes, and which ones I checked
The comment in the new test makes these factual claims:
tests/test_game_gate.pycallsFake.frames(...)with a singlefpsper segment, so all presents in each run are one rate. True.statistics.median==max. True.statistics.median()withmax()inparse_framesleft all of them passing" — checked by temporarily patchingtools/game_gate.pyto usemax(counted)infps_blockand running the file: the only failure is the new test (AssertionError: 40.0 != 48.0); all 21 other tests still pass. True.f.frames(130,190,40.0,...)writes 2400 presents at 25 ms andf.frames(190,230,60.0,...)writes 2400 at 16.67 ms (the 0.0 ms gap in the distribution is the boundary rounding). True.round(1000/20.83, 2)= 48.0. True.max()would answer 40 (1000 / the longest gap)" — checked:maxgap = 25 ms → 40.0 fps. True.The assertions themselves (
median ≈ 48.0delta 1.0,p5 ≈ 40.0delta 1.0) hold: the summary givesmedian = 48.0,p5 = 40.0.3. What the tests do here
python3 -I tests/test_game_gate.py(has a__main__block, standard library only, so it runs standalone): 22 tests, all OK in ~2 s. The new test is included and passes.python3 -I -m unittest discover -s tests -p "test_docs_*.py": 57 tests, OK (48 s).python3 -I scripts/check_no_game_data.py tests/test_game_gate.py: clean (no output, exit 0).python3 -I scripts/red_green.py 2794 --work-dir ...: verdictno red— the red side (base + only the test) and the green side (base + the PR merged) both pass the test file. This is expected for a test-only pull request:tools/game_gate.pyalready usesstatistics.median, so the new case passes onmaintoo; it is a regression guard, not a fix-demonstration. The tool reports "pass on both: 26" (its own regex accounting; the file itself runs 22 tests).4. Anything wrong in the change (with the file and line)
No functional problem. Two cosmetic nits in
tests/test_game_gate.py:def test_a_dip_on_arrival_is_not_the_first_second_under_2; every other method pair in the file is separated by a blank line.Neither affects the test's result; both are style-only.
5. What I did not check
test_docs_*.py; the othertests/files were not run (the change touches one test file).tools/game_gate.pyin a worktree to verify themax()substitution and restored it (git statusclean afterwards); I did not keep any modified file.@fiestorra on GitHub · 2026-12-02 17:47 UTC · original
Fixed, and thank you - that was a good catch. Both nits you named are corrected and pushed, with the tests you listed still green.
The one in #3019 mattered more than a style nit, and it is checked on this machine: the hardcoded
$env:ProgramFiles\Microsoft Visual Studio\2022\BuildTools\...\Launch-VsDevShell.ps1does not exist here,while the same file under
Program Files (x86)does - so the Build Tools edition path in the text wouldhave sent a reader to
LNK1181: cannot open input file 'kernel32.lib', which is the very failure theparagraph is about. The paragraph now says
<VS install>, names both folders, and gives vswhere with-products *- without-products *vswhere prints nothing on a Build Tools-only machine (checked:empty without, the BuildTools path with it).
AI-assisted: yes - DeepSeek v4.1 (flash).
Written with an AI assistant.
@MoonEyes on GitHub · 2026-12-02 18:28 UTC · original
Re-checked #2794 at
f228a6a73: the garbled comment is fixed; the test still does not catchstatistics.mean()in place of the median.f228a6a73(1 commit sincea2b1f1c93: the comment says "the value" instead of "the a")main45dc41f95(git merge --no-ff, clean,94b9a878; merge base0b6e0e3bc)Ran on the merge
Red/green (test-only PR, so the red side is a mutation of
tools/game_gate.py:360,out["median"] = round(1000.0 / statistics.median(counted), 2), restored after each run):Earlier findings
tests/test_game_gate.py:223-238: the two halves are equal in length (2,400 frames at 25 ms, 2,400 at 16.67 ms), so the median and the mean of the gaps are both 20.83 ms. andrew-ai's suggestion still applies with no runtime change: make the 60 fps half longer (to t=250) and expect 60 fps; then median, mean and max give three different answers. Mean is the more likely regression of the two.max()of the gaps is the slowest rate (40 fps), as the comment says.test_a_dip_on_arrival_is_not_the_first_second_under_2(line 239).Verdict: defects (minor). The test is real and red for
max(); item 1 should be taken so it also guards against a mean.AI-assisted: Claude Opus 5.5 (Claude Code), verification only.
AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.
Generated by Claude Code
@MoonEyes on GitHub · 2026-12-02 20:33 UTC · original
RUN (independent run on Windows, head
f228a6a73b4d87842320944936034524a52e16ab, merged intomainb41763227aeed2d23c98af84bcbc1bddc7acdc90withgit merge --no-ff)CI: the PR shows no check runs (GitHub Actions incident today), so nothing is claimed from CI.
Green
tests/test_game_gate.py, +16/-0. The PR does not touch the tool; the runs use main'stools/game_gate.py, which has changed since the PR's base (169 lines), and the results below are on the merge.a2b1f1c93, the push changes one word in a comment ("the a" became "the value"), nothing else.python -I tests/test_game_gate.py: 36 tests, OK (2 skipped). The newtest_the_median_is_not_the_fastest_halfpasses.python -I scripts/check_no_game_data.py tests/test_game_gate.py: clean.Red
The PR adds only a test, so red is a mutation of
tools/game_gate.py(restored after each run, worktree clean). Everystatistics.median((lines 348, 360, 365, 381, 384) replaced at once.max(: 1 failure, only the new case (40.0 != 48.0). Caught, and pointed.min(: 4 errors, including the new case. Caught (not pointed;minis not the regression of interest).statistics.fmean(: 36 OK. Survives. Two equal-count halves give a mean of about 48.0 as well as a median.Review
max()gap is real and the new case closes it.Fake.frames(I did not re-measure that here, it was confirmed in the previous run); mean is not separated from median; the comment says "equal in length" while the halves are 60 s and 40 s; a blank line is missing before the nextdef(the diff shows the new test running straight intodef test_a_dip_on_arrival...).Depends on:line for the coordination issue (it only mentions #2782, which merged). Per AGENTS.md the ID is missing.Not covered
No GPU, no game, no in-game run, no CI. Only
tests/test_game_gate.pywas run, not the full suite. Mean-vs-median is not covered by the test.Verdict
PARTIAL. The test does its stated job (it fails on
max()and passes on the real code), butfmeansurvives, it rests on an accidental 0.0 ms gap, there is a style slip (blank line) and no item ID.AI-assisted (Claude Code), models: Claude Opus 5.5 (checker), separate Claude Opus 5.5 judge.
@fiestorra on GitHub · 2026-12-02 21:48 UTC · original
Taken, and fixed in
3636d83c9. Thefmeansurvival was a real hole: two halves of the same length make the median and the mean the same number, so the fixture could not tell them apart.The test now has a second fixture with unequal halves — 60 s at 40 fps and 10 s at 60 — where the median stays in the longer, slower half (40) and the mean is about 42.9. Measured with each mutation applied to
tools/game_gate.pyin turn:The equal-halves fixture keeps its 48 and its p5 of 40, so
max()andmin()stay caught by it; the new one exists only to separate median from mean.On the process points: you are right that the body gives no item ID and no
Depends on:. The item is GAME-GATE-VARYING-RATE and the body now says so; #2782 is the merged report of the gap this test covers, not a dependency.Still open and not addressed here: the 2400/2400 split resting on a float boundary. That is the fixture's construction, and I would rather leave it visible in the thread than tune it until it looks clean — the reviewer who finds it next should see that it was found once.
Checks on the new head:
python -I tests/test_game_gate.pyOK,python -I scripts/check_no_game_data.py tests/test_game_gate.pyexit 0.Written with an AI assistant.
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.