wave_trace: validate select_case and --out upfront, harden render_report, unlink partial output (WAVE-TRACE-VALIDATION-AND-WRITE-CLEANUP) #1590
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!1590
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/wave-trace-validation-and-write-cleanup"
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?
Pull request successfully merged and closed
Item:
WAVE-TRACE-VALIDATION-AND-WRITE-CLEANUP(unclaimed — coordination issue #14 is at GitHub's 2,500-comment cap with no successor open issue yet, and 0 open PRs touchtools/wave_trace.py).Summary
case_index(type is int,>= 0) andmax_ops(type is int,>= 1) inselect_case()so negativecase_indexraisesValueErrorinstead ofUnboundLocalErrorand booleans are rejected.render_report()by verifying the<!-- WAVE_TRACE_DATA -->placeholder exists inwave_trace.html, passingallow_nan=Falsetojson.dumps(), and escaping>(\u003e) alongside<(\u003c).--outbefore runninginspect_case()(reject empty/whitespace strings, trailing directory separators, existing paths viaos.path.lexists(), and missing parent directories) instead of silently acceptingPath("")as.or wasting simulation work before failing.open("x")) so existing files are never overwritten, and close and unlink the newly created file ifstream.write()fails mid-write so no partial HTML report is left behind.Verification
python3 -W error -I tests/test_wave_trace.py -v: 10/10 passed.python3 -I tests/test_text_write_line_endings.py: 3/3 passed.python3 -I scripts/check_no_game_data.py tools/wave_trace.py tests/test_wave_trace.py: passed.python3 -m compileall -q tools/wave_trace.py tests/test_wave_trace.py: passed.tests/test_wave_trace.pyagainst unpatchedmain:tools/wave_trace.py):failures=9, errors=1across all 4 new regression tests.AI-assisted: yes
GPUs tested: none (CPU-only Python interpreter/report tool; synthetic wave32 cases only, no game data)
Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18).
Targeted batch of 18 PRs (their tests, the tests importing the changed modules, the docs tests) on main 3ca0707: no new failure, Linux / Python 3.13.
AI-assisted (Claude Code, Claude Opus 5.5)