pk_int16_clamp_probe: harden --ops/--waves, upfront atomic JSON writes, and result count guard #1642
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!1642
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/pk-int16-clamp-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:
PK-INT16-CLAMP-PROBE-JSON-AND-CLIClaim: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7155187060
Summary
Harden CLI argument parsing, JSON report writing, and harness error handling in
tools/pk_int16_clamp_probe.py:--ops/--waves/--hw-archguards: reject empty/trailing comma tokens (32,,,v_pk_mul_lo_u16,32,,64), deduplicate repeated ops/waves so kernels andtotal_casesare not double-counted, and reject empty/whitespace--hw-arch.--jsonvalidation: reject empty/whitespace paths, trailing separators, directories, non-directory parent blockers, and unwritable existing targets before openinghw_oracle.write_report(): serialize upfront withallow_nan=Falseand LF endings, handle non-regular targets like/dev/nulldirectly, resolve symlinks before staging to preserve symlink targets, applyfile_mode.published_mode, and publish viareplace_retry.replace.harness_errorsentry whenlen(raw_results) != len(meta)inevaluate_results()(preventingKeyErrorafterzip()truncation), and catchValueErrorfromasm.family(oracle.arch)cleanly (exit77).tests/test_pk_int16_clamp_probe.py): added 3 test methods covering malformed/duplicate--ops/--waves, empty--hw-arch/--json, upfront blocker/trailing-sep rejection, atomic/symlink/NaN//dev/nullwrites, result count mismatch, and unknown arch family.Verification
python3 -W error -I tests/test_pk_int16_clamp_probe.py -v: 9 passed, 1 skipped (AMD clang absent)main:ran=10 failures=1 errors=11 (skipped=1)python3 -I tests/test_text_write_line_endings.py: 3/3 passedpython3 -I scripts/check_no_game_data.py tools/pk_int16_clamp_probe.py tests/test_pk_int16_clamp_probe.py: passedpython3 -m compileall -q tools/pk_int16_clamp_probe.py tests/test_pk_int16_clamp_probe.py: passedIndependent verification (Windows, Python 3.11.9
-I -W error):--ops/--waves/--hw-arch/--jsonguards + dedup, blocked-parent--jsonrejected upfront, atomic write_report,asm.familyValueError->77, evaluate_results count-mismatch schema identical to normal return — all match claims.test_pk_int16_clamp_probe.py10 OK (1 hw skip, matches body);--self-testok (26 cases); bad-CLI probes all exit 2; compileall + line-endings + check_no_game_data clean. AI-assisted verification.#1642 | head
a15c1d762f64ba549d5c78ef2bf2b1deb815fb66|python3 -I tests/test_pk_int16_clamp_probe.py -v,py -3.12 -I tests/test_pk_int16_clamp_probe.py -v| red: 10 run, 1 failure, 11 errors, 1 skipped (Linux) / 10 run, 1 failure, 11 errors (Windows) | green: 9 passed, 1 skipped (Linux) / 10 passed (Windows) | Red → green. Live Radeon case passed on both treesThe full file covers CLI validation, reports and malformed oracle responses. Its live packed-integer clamp test passed on the physical gfx1036 Radeon on both trees in wave32 and wave64. The baseline failures were in other tests.
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. Native Windows used Python 3.12.10. Windows HIP used AMD Radeon(TM) Graphics, gfx1036, driver 32.0.21045.29003. The WSL run skipped the optional native-hardware case. Unittest failure/error counts include subtests where applicable. AI-assisted with OpenAI Codex. Batch claim.Merged, thank you @IlyassRS3! This PR (pk_int16_clamp_probe: harden --ops/--waves, upfront atomic JSON writes, and result count guard) 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.