d16_image_probe: validate --json upfront, write reports atomically, and harden --formats/--waves (D16-IMAGE-PROBE-JSON-AND-CLI) #1614
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!1614
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/d16-image-probe-json-and-cli"
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 ID:
D16-IMAGE-PROBE-JSON-AND-CLI(unlisted; coordination issue #14 is at GitHub's 2,500-comment cap with no open successor at submission time, and no open PR touchestools/d16_image_probe.py).What changed
--jsonupfront before opening the hardware oracle (tools/d16_image_probe.py,validate_json_path): reject empty/whitespace paths (previously--json ""was silently ignored and--json " "wrote a literal whitespace file), NUL bytes, directories / trailing separators, and non-directory parent ancestors with exit code2before launching any GPU sweep.--jsonreports atomically and handleOSErrorcleanly (write_json_report): create missing parent directories, resolve symlinks to update targets in place, write non-regular targets (/dev/null) directly, checkO_WRONLYon existing regular files before staging, stage withfile_mode.published_mode+replace_retry.replace, enforceallow_nan=Falseand trailing\n, clean up staging files on failure, and return exit2instead of an unhandled traceback.--formatsand--wavesparsing (main): reject empty comma tokens (e.g.--formats "",--formats unorm8,,--waves 32,) with the right option name (previously--formats ""reported--frac must be in (0, 1)), strip whitespace around tokens, and deduplicate repeated formats/waves so--waves 32,32does not run wave32 twice or emit spurious self-comparisonwaves_differentries.tests/test_d16_image_probe.py): 3 new tests plus expandedtest_bad_arguments_are_a_usage_errorcovering all of the above (no game files, no GPU).Verification
KernelsandOnHardwareskipped without AMD clang / GFX10 GPU)python3 -W error -I tests/test_d16_image_probe.py -v: 14 passed, 2 skippedpython3 -W error -I tests/test_text_write_line_endings.py: passedpython3 -I scripts/check_no_game_data.py tools/d16_image_probe.py tests/test_d16_image_probe.py: cleanpython3 -m compileall -q tools/d16_image_probe.py tests/test_d16_image_probe.py: cleanClisuite oftests/test_d16_image_probe.pyagainst unpatchedmain:tools/d16_image_probe.py): 9 failures, 2 errors across the 5 CLI tests.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)