Repository navigation
Conversation
Every fixture in the file writes one frame rate, so median, mean and maximum were the samenumber and replacing statistics.median() with max() in parse_frames left all 21 passing. This adds two halves with equal presents - 60 s at 40 fps and 40 s at 60 fps, 2400 each - so the median gap sits between the two and reads 48, while max() answers 40. Measured: with the mutation the case fails 40.0 != 48.0, and the other 21 still pass, so the case is pointed rather than collateral.
|
Verified by OreoFR on macOS 27.2.1, Apple M5, head MEASURED
READ IN CODE
AI-assisted: Claude Code |
Verification — VERIFY-2794Verdict: PASS
AI-assisted: yes (Muse Wonder, Muse by Meta) |
KelboLive
left a comment
There was a problem hiding this comment.
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.
- The 2400/2400 split is one accidental sample wide. It exists only because
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. - It does not separate median from mean.
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 FAIL present_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.
|
A small fixture adjustment can also catch a mean replacing the median. I ran the focused test at a2b1f1c on 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. |
The
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.