d16_format_probe: harden CLI parsing, atomic JSON write, and unknown-arch exit #1664
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!1664
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/d16-format-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-FORMAT-PROBE-JSON-AND-CLI(claimed in https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7155954875)Summary
tools/d16_format_probe.py):--hw-archand--jsonvalues with argparse exit code2.--formatsand--wavesentries, reject empty/trailing-comma tokens (unorm8,,,64), and deduplicate repeated formats/waves while preserving order so the GPU sweep does not execute duplicate work.--jsonvalidation & atomic report writing:validate_report_path()and called it before opening the hardware oracle so a blocked parent path (e.g. a regular file ancestor) fails fast withERROR: cannot write ...(exit2) without running the GPU sweep, while preserving the existingap.errordirectory check.write_report()to serialize strictly (allow_nan=False) with a trailing, support non-regular targets like/dev/null, preserve symlink targets and existing file mode viafile_mode.published_mode(), fsync temp files, and atomically replace viareplace_retry.replace().ValueErrorfromasm.family(oracle.arch)inside thetry/finallyblock so unknown architectures close the oracle cleanly and exit77instead of raising an unhandled traceback.tests/test_d16_format_probe.py):--jsonparent fail-fast before opening the oracle, empty/malformed CLI tokens & deduplication & unknown-arch exit77, and atomic write behavior (symlink/mode preservation, trailing LF,/dev/null, andNaNrejection without clobbering existing output).Checklist & Verification
python3 -I scripts/check_no_game_data.py tools/d16_format_probe.py tests/test_d16_format_probe.pypassed)python3 -W error -I tests/test_d16_format_probe.py:Ran 26 tests ... OK (skipped=2)tests/test_d16_format_probe.pyagainst unpatchedmaintools/d16_format_probe.py):Ran 26 tests ... FAILED (failures=10, errors=1, skipped=2)python3 -m compileall -q make_game.py tools tests: passedpython3 -I tests/test_text_write_line_endings.py:Ran 3 tests ... OK#1664 | head 733020975bee187f6822c0e5cf9fa6b2a3678124 (merged cleanly with main 95b2e6c67) |
python -I tests/test_d16_format_probe.py| red on main:FAILED (failures=10, errors=1, skipped=2)(malformed--formats/--waves/--hw-arch/--jsoninputs not rejected,open_oraclecalled before blocked--jsonparent check, uncaughtValueErroron unknown archgfx900, andNaNJSON written) | green on PR+main:27 tests OK (skipped=2)| Windows 11, Python 3.12.10 | AI-assisted: yesAudited
validate_report_path,write_report(allow_nan=False, non-regular/device direct write,mkstemp+fsync+published_mode+replace_retry),--formats/--wavesdeduplication, andasm.familyValueError -> exit 77intools/d16_format_probe.py. Also passedtests/test_ci_registration.py(18 OK),tests/test_text_write_line_endings.py(3 OK),tests/test_runner_calls_all_tests.py(3 OK), andscripts/check_no_game_data.py.Red/green:
pytest tests/test_d16_format_probe.pyfails on main (11 failed, 22 passed, 2 skipped, 2 subtests passed) and passes on head 733020975bee merged with main (26 passed, 2 skipped, 10 subtests passed).Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure.
AI-assisted (Claude Code, Claude Opus 5.5)