tooling: pin window arithmetic and refusals in startup_audio_timeline_check #1835
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1842"
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 R0Y00/Xbox2Windows. Originally posted by Asimmimx on 2026-11-24T19:22:09Z.
Change
tests/startup_audio_timeline_check.pydrivestools/startup_audio_timeline.py(added in #1763) with one fixture. That fixture uses a symmetric window (--before 0.1 --after 0.1), the default sample rate, packets already in time order with no overlap, and only fully covered or fully empty windows with audio. It never feeds an invalid row or option. So several documented behaviors could change without the check failing.I applied single-point mutants to the tool by hand, ran the check after each one, then reverted the tool:
flagsrefusalframes < 1->frames < 0(accept zero-frame packets)rms <= peakfrom the level checkflags & 4->flags & 2sorted(...)of packetsmax(cursor, packet.start)->packet.startmax(cursor, packet.start)->max(start, packet.start)(count overlap twice)cursor = lastflags & 1-> any nonzero flagcount += 1(packetsfield)--afterinstead of--before--sample-rate(always 48,000 Hz)packet_peakkeeps the last packet instead of the maximumpacket.start >= end->>endhas no overlap and is skipped)The new cases:
test_unsorted_overlap_and_asymmetric_windowruns at--sample-rate 1000with--before 0.2 --after 0.1, so 200 frames last 0.2 s and an event at QPC 101.2 has the window 101.0..101.3. The CSV lists a later packet first. A silent packet (flag 2) covers 101.0..101.2, and a discontinuity packet (flag 1, RMS 0.6, peak 0.9) covers 101.1..101.3. The overlap counts once, so coverage is 1 and the RMS issqrt(0.6^2 * 0.1 / 0.3), with 2 packets, 1 discontinuity and peak 0.9. A second event at 103.2 is covered only by 103.0..103.1 at RMS 0.5. Coverage is 1/3 and the RMS estimate stays 0.5, because the docs average over covered time only.test_invalid_rows_and_options_are_refusedchecks that the CLI exits with status 2 and names the reason for: negative flags, zero frames, RMS above peak, a non-string action, and--before 0 --after 0.Verification
Based on
origin/main813045b3(merge of #1763). Windows 11 Pro 26300.9974, Python 3.12.10.The mutation table above comes from a local probe script (not committed). It rewrites one line of
tools/startup_audio_timeline.py, runspython -B tests/startup_audio_timeline_check.py, records a nonzero exit as "killed" and restores the tool. I ran it against the check at813045b3and again against this branch.Evidence and follow-up
startup_audio_timeline_checkinCMakeLists.txtor.github/workflows/, so it runs only when someone invokes it directly. I left registration out of this PR so it stays a test-only change.Checklist
AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T19:35:36Z.
Review: COMMENTED
Reviewed head
f3363374fd85bb06b8440b6e60ee7b5dd02a3585in a clean Linux worktree.git diff --check origin/main...HEAD: clean (rc 0)python -B tests/bidi_controls_check.py: rc 0python -B tests/startup_audio_timeline_check.py: rc 0Local mutations on
tools/startup_audio_timeline.py(each restored withgit checkout -- .).startup_audio_timeline_check.pyfailed (rc 1) when I:cursor = last)The unsorted, overlapping and asymmetric-window cases and the refusal cases test real logic with exact expected values.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T19:30:47Z.
Thanks for writing these thorough edge-case checks across the test suite (#1824–#1842) — the test cases themselves are clean and well-scoped.
Quick friendly workflow suggestion for future batches: because each separate PR triggers a full Windows CI build (and another main-branch CI run on merge), grouping related 10–30 line test additions by area into 2–3 PRs instead of ~19 individual PRs helps keep GitHub Actions runners and the open PR queue much lighter for everyone.
AI-assisted.