buffer_format_fuzz: reject a negative --budget #1623

Merged
leonida/mandy
xel1uz merged 1 commit from fix/buffer-arg-guards into main 2026-11-29 18:28:12 +00:00

Pull request successfully merged and closed

xel1uz commented 2026-11-25 06:11:37 +00:00

Item ID: BUFFER-BUDGET-NEGATIVE (new item; the coordination issue #14 is at GitHub's 2,500-comment cap, so the claim lives here)

Claimed as: BUFFER-BUDGET-NEGATIVE - a negative --budget is silently the run of 0, and --self-test ignores the value entirely. Reproduced on 42537e7b.

What and why

--budget went straight into range(budget), so -1, -100 and -1000000 produced exactly the run of 0 (1026 instead of 1106 elements for 8_8_8_8_UNORM) while every format still printed ok; --self-test builds its patterns with a hardcoded 2 and so ignores the option completely, making --budget -100 and --budget 1000000 identical in the same 1.4 s. A negative value is now ap.error("--budget cannot be negative") (exit 2, usage line), checked before --self-test and before the oracle opens, so it also wins over the exit-77 'hardware oracle unavailable'. 0 stays legal (sweeps only) and the help says so.

Found but left alone to keep this focused: --budget never reaches run_stores, so --mode store --budget N is a silent no-op.

Tested

  • New tests/test_buffer_format_fuzz.py (7 tests, CPU only, hw oracle stubbed): against the tool at 42537e7b 3 failed, 4 passed; with this branch 7 passed, and the 15 buffer-format tests together pass.

  • CLI: --self-test --budget -1 exits 2 with the message (was self-test: ok), --self-test --budget 0 still exits 0.

  • git diff --check clean; python3 -I scripts/check_no_game_data.py clean on the changed files.

GPUs tested: n/a - CPU only, no Vulkan device involved.

AI-assisted: Yes.

Checklist

  • Based on current main (42537e7b) and merges cleanly.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption; synthetic inputs only.
  • A new translator rule in the contract table of docs/design.md - not applicable, no translator change.
Item ID: `BUFFER-BUDGET-NEGATIVE` (new item; the coordination issue #14 is at GitHub's 2,500-comment cap, so the claim lives here) Claimed as: `BUFFER-BUDGET-NEGATIVE` - a negative `--budget` is silently the run of `0`, and `--self-test` ignores the value entirely. Reproduced on 42537e7b. ### What and why `--budget` went straight into `range(budget)`, so `-1`, `-100` and `-1000000` produced exactly the run of `0` (1026 instead of 1106 elements for `8_8_8_8_UNORM`) while every format still printed `ok`; `--self-test` builds its patterns with a hardcoded 2 and so ignores the option completely, making `--budget -100` and `--budget 1000000` identical in the same 1.4 s. A negative value is now `ap.error("--budget cannot be negative")` (exit 2, usage line), checked before `--self-test` and before the oracle opens, so it also wins over the exit-77 'hardware oracle unavailable'. `0` stays legal (sweeps only) and the help says so. Found but left alone to keep this focused: `--budget` never reaches `run_stores`, so `--mode store --budget N` is a silent no-op. ### Tested - New `tests/test_buffer_format_fuzz.py` (7 tests, CPU only, hw oracle stubbed): against the tool at 42537e7b **3 failed, 4 passed**; with this branch **7 passed**, and the 15 buffer-format tests together pass. - CLI: `--self-test --budget -1` exits 2 with the message (was `self-test: ok`), `--self-test --budget 0` still exits 0. - `git diff --check` clean; `python3 -I scripts/check_no_game_data.py` clean on the changed files. GPUs tested: n/a - CPU only, no Vulkan device involved. AI-assisted: Yes. ### Checklist - [x] Based on current `main` (42537e7b) and merges cleanly. - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption; synthetic inputs only. - [ ] A new translator rule in the contract table of `docs/design.md` - not applicable, no translator change.
PierreEbele commented 2026-11-25 17:28:06 +00:00

Reviewed 0294aed: ran python -I tests/test_buffer_format_fuzz.py - 7/7 pass with the PR; copied onto main, the 3 negative-budget tests fail, so they genuinely pin the fix. A 12-case CLI probe on both trees shows main accepting --budget -1 (exit 0, "self-test: ok") while the PR refuses it with exit 2 before the oracle is opened; budget 0, -0, positive and unrelated options are unchanged. compileall and check_no_game_data.py are clean on the new files. No findings.

AI-assisted review.

Recommendation: Merge

Reviewed 0294aed: ran `python -I tests/test_buffer_format_fuzz.py` - 7/7 pass with the PR; copied onto main, the 3 negative-budget tests fail, so they genuinely pin the fix. A 12-case CLI probe on both trees shows main accepting `--budget -1` (exit 0, "self-test: ok") while the PR refuses it with exit 2 before the oracle is opened; budget 0, -0, positive and unrelated options are unchanged. compileall and check_no_game_data.py are clean on the new files. No findings. AI-assisted review. **Recommendation:** Merge
MoonEyes commented 2026-11-28 03:03:06 +00:00

Hi @xel1uz, thanks for this pull request.

CONTRIBUTING.md asks contributors to claim their work in the coordination issue ("Coordinating who works on what", currently #1608) before opening a pull request: post claiming: <ID> there, or a one-line description if the item is not listed yet, and put the ID in the pull request. I could not find a claim from you for this one.

The claim matters because "it is claimed in the coordination issue by the pull request's author" is the first item on the maintainers' checklist for a mergeable pull request, and because it lets others see that the work is taken before they write it a second time.

Could you post the claim in #1608 and put its ID (or a link to it) on the pull request's "Claimed in the coordination issue as:" line? If you already claimed it in another form, a link to your comment is enough.

AI-assisted (Claude Code, Claude Opus 5.5).

Hi @xel1uz, thanks for this pull request. CONTRIBUTING.md asks contributors to claim their work in the coordination issue ("Coordinating who works on what", currently #1608) before opening a pull request: post `claiming: <ID>` there, or a one-line description if the item is not listed yet, and put the ID in the pull request. I could not find a claim from you for this one. The claim matters because "it is claimed in the coordination issue by the pull request's author" is the first item on the maintainers' checklist for a mergeable pull request, and because it lets others see that the work is taken before they write it a second time. Could you post the claim in #1608 and put its ID (or a link to it) on the pull request's "Claimed in the coordination issue as:" line? If you already claimed it in another form, a link to your comment is enough. AI-assisted (Claude Code, Claude Opus 5.5).
zmasi commented 2026-11-28 20:31:02 +00:00

#1623 | head 0294aed3ddc263d8698f46c9c9c2c225d5ab07a6 (merged cleanly with main 1bc055e6c2) | python -I tests/test_buffer_format_fuzz.py | red on main: FAILED (failures=3) (--self-test --budget -1 and -1000000 exited 0 printing self-test: ok, and --oracle hw --budget -3 proceeded past CLI validation instead of exiting 2) | green on PR+main: 7 tests OK | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes

Audited tools/buffer_format_fuzz.py and tests/test_buffer_format_fuzz.py on Windows 11, verifying a.budget < 0 raises ap.error("--budget cannot be negative") (exit 2) before --self-test or --oracle hw runs while keeping --budget 0 legal for deterministic sweep-only runs. Also verified tests/test_ci_registration.py (18 OK), tests/test_text_write_line_endings.py (3 OK), and scripts/check_no_game_data.py.

#1623 | head 0294aed3ddc263d8698f46c9c9c2c225d5ab07a6 (merged cleanly with main 1bc055e6c2) | `python -I tests/test_buffer_format_fuzz.py` | red on main: `FAILED (failures=3)` (`--self-test --budget -1` and `-1000000` exited `0` printing `self-test: ok`, and `--oracle hw --budget -3` proceeded past CLI validation instead of exiting `2`) | green on PR+main: `7 tests OK` | Windows 11 (`10.0.26200.9974`), Python 3.12.10 | AI-assisted: yes Audited `tools/buffer_format_fuzz.py` and `tests/test_buffer_format_fuzz.py` on Windows 11, verifying `a.budget < 0` raises `ap.error("--budget cannot be negative")` (exit `2`) before `--self-test` or `--oracle hw` runs while keeping `--budget 0` legal for deterministic sweep-only runs. Also verified `tests/test_ci_registration.py` (`18 OK`), `tests/test_text_write_line_endings.py` (`3 OK`), and `scripts/check_no_game_data.py`.
TheGeogeo commented 2026-11-29 00:17:01 +00:00

Tested 0294aed3d merged (no commit) with main 829530dbd: Python 3.12.4, Windows 11 10.0.26300, CPU only. check_no_game_data.py is clean.

  • Green: tests/test_buffer_format_fuzz.py, 7 tests pass.
  • Red: with tools/buffer_format_fuzz.py back to main, 3 failures (SystemExit not raised).

No blocker from my side.

AI-assisted (Claude Code).

Tested `0294aed3d` merged (no commit) with `main` `829530dbd`: Python 3.12.4, Windows 11 10.0.26300, CPU only. `check_no_game_data.py` is clean. - Green: `tests/test_buffer_format_fuzz.py`, 7 tests pass. - Red: with `tools/buffer_format_fuzz.py` back to `main`, 3 failures (`SystemExit not raised`). No blocker from my side. AI-assisted (Claude Code).
TheGeogeo commented 2026-11-29 11:51:52 +00:00

Tested green here earlier on this same head (see my comment above). The only thing missing for a merge is your claim in the coordination issue #2570.

AI-assisted (Claude Code).

Tested green here earlier on this same head (see my comment above). The only thing missing for a merge is your claim in the coordination issue #2570. AI-assisted (Claude Code).
OreoFR commented 2026-11-29 17:11:15 +00:00

Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, main 4364a4fa6, PR head 0294aed3d : red 3 failures / green 7 OK

Re-check on the current main (earlier runs by zmasi and TheGeogeo were on older mains).

  • Merge: clean (git merge-tree). Reviews: none. No game data in the diff. Skipped on the merge: none.
  • (MEASURED n=3) each red failure reruns alone 3/3.
  • Red: 7 tests, 3 failures: test_absurdly_negative_budget_fails_too, test_negative_budget_fails_the_self_test_with_2, test_negative_budget_is_refused_before_the_oracle_is_opened.
  • Green: 7/7 OK. Neighbours (test_buffer_format_fuzz_cli, test_gfx11_skip, semantic/test_buffer_formats_all): 25 passed on main and merge.
  • Diff: --budget < 0 refused via ap.error. OK.

Verdict: READY

AI-assisted: Claude Code

Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, main 4364a4fa6, PR head 0294aed3d : red 3 failures / green 7 OK Re-check on the current main (earlier runs by zmasi and TheGeogeo were on older mains). - Merge: clean (`git merge-tree`). Reviews: none. No game data in the diff. Skipped on the merge: none. - (MEASURED n=3) each red failure reruns alone 3/3. - **Red**: 7 tests, 3 failures: `test_absurdly_negative_budget_fails_too`, `test_negative_budget_fails_the_self_test_with_2`, `test_negative_budget_is_refused_before_the_oracle_is_opened`. - **Green**: 7/7 OK. Neighbours (`test_buffer_format_fuzz_cli`, `test_gfx11_skip`, `semantic/test_buffer_formats_all`): 25 passed on main and merge. - Diff: `--budget < 0` refused via `ap.error`. OK. **Verdict: READY** AI-assisted: Claude Code
DadaCap commented 2026-11-29 18:28:15 +00:00

Thank you! Merged into main with a merge commit. It was verified ready on its current head (0294aed3d) by OreoFR's Mac agent (macOS, red/green on main + PR); see the verification comment above. (AI-assisted, posted for DadaCap.)

Thank you! Merged into `main` with a merge commit. It was verified ready on its current head (0294aed3d) by OreoFR's Mac agent (macOS, red/green on main + PR); see the verification comment above. (AI-assisted, posted for DadaCap.)
Sign in to join this conversation.
No description provided.