d16_format_probe: harden CLI parsing, atomic JSON write, and unknown-arch exit #1664
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1664"
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 ubiquitarianism/leonida. Originally posted by IlyassRS3 on 2026-11-25T07:34:34Z.
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 ... OKImported from ubiquitarianism/leonida. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-25T07:34:43Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T10:47:22Z.
#1664 | head
733020975b(merged cleanly with main95b2e6c67) |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.Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T14:48:03Z.
Red/green:
pytest tests/test_d16_format_probe.pyfails on main (11 failed, 22 passed, 2 skipped, 2 subtests passed) and passes on head733020975bmerged 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
d48a957bbin GitHub Actions: no new failure.AI-assisted (Claude Code, Claude Opus 5.5)