Skip to content

tools: an empty or non-integer list argument is a usage error, not a traceback (BUILD-519) - #3323

Open
AGVibecoder wants to merge 1 commit into
ItsNotRexed:mainfrom
AGVibecoder:build-519-fuzzer-list-args
Open

AGVibecoder wants to merge 1 commit into
ItsNotRexed:mainfrom
AGVibecoder:build-519-fuzzer-list-args

Conversation

@AGVibecoder

Copy link
Copy Markdown
Contributor

Item: BUILD-519 (claimed in #3232).

What

  • tools/image_fuzz.py --formats "" (or ","), tools/f32_fuzz.py --ops "," and tools/f16_trans_sweep.py --waves x stopped with a ZeroDivisionError, an IndexError and a ValueError traceback.
  • An empty --ops, --modes or --waves for f16_trans_sweep.py passed its check and swept nothing.
  • All of these now exit 2 with a one-line usage error before any oracle or GPU is opened, like the other fuzzers' list arguments. f16_trans_sweep.py still runs its --json path check after the list checks.

Why
A typo in a list argument should give a usage message, not a traceback or a silent empty run that looks like a pass.

Tested (Windows 11, Python 3.12; no GPU needed)

  • python -I tests/test_f16_trans_sweep.py: OK (2 hardware tests skipped)
  • python -I tests/test_f32_fuzz.py: OK (1 hardware test skipped)
  • python -m pytest -q tests/test_image_fuzz.py: 57 passed (the file already imports pytest on main)
  • python -m compileall -q tools tests
  • Rebased onto f847748. The conflict in f16_trans_sweep.py and its test (main's new --json validation) was resolved by keeping both.

Not covered

  • The on-hardware sweeps themselves, which need an AMD GPU and the oracle. The changed code runs before the oracle is opened.

Game files: none.

AI-assisted. Tested on Windows only; no GPU was used.

— Claude Opus 5.5 (high effort), AI-assisted

🤖 Generated with Claude Code

…traceback

image_fuzz.py --formats "" (or ","), f32_fuzz.py --ops "," and f16_trans_sweep.py --waves x stopped with a
ZeroDivisionError, an IndexError and a ValueError. An empty --ops, --modes or --waves of f16_trans_sweep.py passed
its check and swept nothing. All of them now exit 2 with one line, like the other fuzzers' list arguments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kotorvr

kotorvr commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested a412a56 on Windows 11 (Python 3.13.7, CPU only, no game files, no oracle): pass

  • At the head: python -I tests/test_f16_trans_sweep.py 16 tests OK (2 skipped); python -I tests/test_f32_fuzz.py 27 tests OK (1 skipped); python -m pytest -q tests/test_image_fuzz.py 57 passed; python -m compileall -q make_game.py tools tests clean.
  • Same test files on the merge base f847748 (tools from main): each new test fails — test_bad_or_empty_lists_are_a_usage_error_before_the_oracle, test_an_empty_op_list_is_a_usage_error, and the three test_an_empty_format_list_is_a_usage_error cases (3 failed, 54 passed).
  • 17 CLI cases, head vs base. At the head all exit 2 with one line and no traceback. On the base:
    • f16_trans_sweep.py --waves x: ValueError traceback; --waves "", --ops , and all three lists empty: exit 77 with no message.
    • f32_fuzz.py --ops , and --ops " , ,": IndexError traceback; image_fuzz.py --formats "" and ,: ZeroDivisionError traceback.
    • Unknown names (--ops nope, --formats nope, --waves 32,48, --waves -32) are exit 2 on both.
  • Two behaviours that change besides the tracebacks: f32_fuzz.py --ops "" ran the default op set and exited 0 on the base and is now exit 2 (--ops names no op); f16_trans_sweep.py --waves 064 was accepted on the base (exit 77 here, no oracle) and is now unknown: 064.
  • Reject empty image fuzzer format selections #3221 (open) adds the same empty --formats check to tools/image_fuzz.py; git merge-tree of this head with Reject empty image fuzzer format selections #3221's head is clean.

Not run: the on-hardware sweeps (no AMD oracle here). AI-assisted check (Claude Code).

@kapitche

Copy link
Copy Markdown
Contributor

Tested a412a56 merged with main f847748 (clean) on Linux (WSL2 Ubuntu), Python 3.12.16: pass.
tests/test_f16_trans_sweep.py 16 ok (2 skipped, hardware), tests/test_f32_fuzz.py 27 ok (1 skipped), tests/test_image_fuzz.py 57 passed via pytest (3 new parametrized cases).
Negative control (the three tools/ files restored to main): the f16 and f32 tests fail (1 each) and the 3 new image_fuzz cases fail. The tests run the real CLIs as subprocesses. Read the diff: checks happen before int() and before the oracle; whitespace-only lists are covered. No concern.

@Maraco91

Copy link
Copy Markdown

Tested a412a56 on Windows 11, Python 3.12.6 (pytest 9.2.0 for the image test): pass

  • python -I tests/test_f16_trans_sweep.py: 16 tests OK (2 hardware tests skipped).
  • python -I tests/test_f32_fuzz.py: 27 tests OK (1 hardware test skipped).
  • python -m pytest -q tests/test_image_fuzz.py: 57 passed.
  • Negative control: with the three tools restored to main, each new test fails (test_bad_or_empty_lists_are_a_usage_error_before_the_oracle, test_an_empty_op_list_is_a_usage_error, and the three test_an_empty_format_list_is_a_usage_error cases, which show the traceback).

One small inconsistency, not a blocker: f16_trans_sweep.py and f32_fuzz.py report through ap.error, so the message comes with the usage line and the prog: error: prefix, while image_fuzz.py prints the bare line and returns 2. That follows what image_fuzz.py already does for an unknown format two lines below, so it is consistent inside that file; mentioning it only because the description says "like the other fuzzers' list arguments".

No GPU or oracle here either, so the on-hardware sweeps are not covered by this check.

AI-assisted (Claude Code); no game files or GPU.

@memorypressure

Copy link
Copy Markdown

Verified on Linux: the f16_trans_sweep half of this is already on main (5ffb5e3/9eb217719, reject empty selections) and the two implementations conflict as tests, not just text — main's test requires --waves 32,nope to name --waves in stderr, this PR's new test requires the offending value to appear; neither message satisfies both. As merged, that half cannot stay. The f32_fuzz --ops and image_fuzz --formats halves are still new and pass here (test_f32_fuzz OK, test_image_fuzz 57 passed under pytest, test_f16_trans_sweep OK at the head). Suggest rebasing on main, dropping the f16_trans_sweep hunks and its test, keeping the other two; #4087 touches the same image_fuzz lines, worth coordinating. The base-era llvm-mc CI red is unrelated. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants