buffer_swizzle_probe: upfront atomic JSON validation, CLI guards, and translator wave parity #1634
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!1634
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/buffer-swizzle-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:
BUFFER-SWIZZLE-PROBE-JSON-AND-CLIClaim: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7154914906
Summary
Harden CLI validation, JSON report writing, and result classification in
tools/buffer_swizzle_probe.py:--jsonvalidation (validate_json_path): reject empty/whitespace paths, directories, trailing path separators, non-directory parent blockers, and unwritable existing files with exit2before running translator or GPU sweeps (previously--json ""was silently ignored,--json " "created a literal whitespace file, and directory/parent failures only errored after running all sweeps).write_json_report): serialize upfront withallow_nan=Falseand LF endings, handle non-regular targets like/dev/nulldirectly, preserve symlink targets by resolving links before staging, applyfile_mode.published_mode, and publish viareplace_retry.replace.--groupand--hw-archupfront (exit2), deduplicate unknown group diagnostics, check string harnessERRORs before wave comparisons so a compile failure in one wave reportsERRORinstead ofWAVE_DIFF, and enforce wave32/64 parity (WAVE_DIFF/WAVE_SAME) in--oracle translatormode as well as hardware mode.tests/test_buffer_swizzle_probe.py): added 4 test methods covering upfront--jsonvalidation, atomic/symlink/NaN//dev/nullwrites, empty--group/--hw-arch, translator wave parity, and error precedence.Verification
python3 -W error -I tests/test_buffer_swizzle_probe.py -v: 12/12 passedmain:ran=12 failures=3 errors=7python3 -I tests/test_text_write_line_endings.py: 3/3 passedpython3 -I scripts/check_no_game_data.py tools/buffer_swizzle_probe.py tests/test_buffer_swizzle_probe.py: passedpython3 -m compileall -q tools/buffer_swizzle_probe.py tests/test_buffer_swizzle_probe.py: passedTested
deae588bcon Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), againstmain42537e7b6(Python GPU probe; hardware oracle not run):tests/test_buffer_swizzle_probe.py: 12 passed, 10 subtests passed at this head.main: 10 failed, 10 passed, 2 subtests — the upfront--jsonvalidation, CLI guards, translator wave parity and atomic-report handling are not there.AI-assisted; synthetic fixtures only, no game data.
Independent verification (Windows, Python 3.11.9
-I -W error): upfront--jsonvalidation rejects bad paths pre-oracle (live-probed), atomic write via mkstemp+published_mode+replace_retry symlink-aware, CLI guards, and the "translator wave parity" claim is real —run_translatorper-wave dicts get WAVE_DIFF/WAVE_SAME when hw waves absent, string harness errors take precedence,hw_refpicks the mismatched wave's result.test_buffer_swizzle_probe.py12 OK;--self-test22 cases ok; live--oracle translatorrun produced valid LF JSON; bad-CLI all exit 2; compileall + line-endings + check_no_game_data clean. AI-assisted verification.#1634 | head
deae588bccf900026bbd7da5678eecf92c682eb0|python3 -I tests/test_buffer_swizzle_probe.py -v| red: 12 run, 3 failures, 7 errors | green: 12 passed | Red → greenThe suite reproduced validation and output/report handling failures on main, then passed all 12 tests, including the translator wave-parity case.
Copied the PR tests onto clean main
4a54aedcb6b66525e0c9f72a6ea10263337c9141for the baseline, then merged that main into the recorded PR head and reran those files. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Unittest failure/error counts include subtests where applicable. AI-assisted with OpenAI Codex. Batch claim.Merged, thank you @IlyassRS3! This PR (buffer_swizzle_probe: upfront atomic JSON validation, CLI guards, and translator wave parity) passed its own tests with main merged in during sodove's verification of this shader batch, so it went in with the batch.
AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.