valu_fuzz: prevent oracle leak, validate CLI options upfront, and add stdlib tests #2270
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2270"
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 kirigayakazima on 2026-11-26T11:55:33Z.
Claimed in the coordination issue as: VALU-FUZZ-ORACLE-LEAK-CLI-VALIDATION-AND-TESTS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7191306204)
What and why
tools/valu_fuzz.pypreviously:main()with noargvparameter and openedrunner.open_oracle()before validating--show, while also omittingtry/finallyoracle cleanup acrosshw_family_skip_reason,--gfx10-word3, andshow().--keepand--negative-controlunder--model-only, and accepted empty--keep ""or a regular file path for--keep.subprocess.run(..., text=True)intranslate()andrun_gpu()withoutencoding="utf-8", errors="replace", and readindex.jsonwithout"utf-8-sig".This validates
--show,--keep, and--negative-controlupfront before opening the hardware oracle, wraps all post-open oracle usage in onetry/finallysooracle.close()always runs, uses UTF-8 (errors="replace"/utf-8-sig) intranslate()andrun_gpu(), and adds stdlibunittestCLI coverage intests/test_valu_fuzz_cli.py.Tested
python -I tests/test_valu_fuzz_cli.py -v(5 passed)upstream/mainbaseline negative control: failed withtests/test_valu_fuzz_cli.pybefore the fixpython -I tests/test_ci_registration.py,python -I tests/test_text_write_line_endings.py,python -I scripts/check_no_game_data.py,python -I -m compileall -q, andgit diff --cached --checkGPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.Imported from ubiquitarianism/leonida. Originally posted by real-rusher on 2026-11-26T12:23:26Z.
Verified on main
a73a57e1(Ubuntu 24.04 x86-64, Python 3.13, no GPU). Merges cleanly. With this PR, python -I tests/test_valu_fuzz_cli.py: 5 tests OK. The same file against main's tool: 5 errors, so it fails on main and passes with the change. compileall clean.AI-assisted: yes (Claude Code)
Imported from ubiquitarianism/leonida. Originally posted by DeadlyChirp on 2026-11-26T12:52:12Z.
Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main.
tests/test_valu_fuzz_cli.py: 5 passed.(AI-assisted test run; output checked by hand.)
Imported from ubiquitarianism/leonida. Originally posted by tiguan26 on 2026-11-27T04:37:46Z.
Review: APPROVED
Approving
2c0ed64ae.The leak fix holds: the hardware oracle is now opened only after every argument check, including
--show, and every exit after it (family skip, the GFX12 word-3 refusal,--show,--model-only, the runs) goes through the onefinallythat closes it; before, a bad--showreturned with the oracle open.--keep/--negative-controlwith--model-onlyor without the hardware oracle are refused up front, and subprocess output is decoded as UTF-8.Merged onto
maind1dff7949in one batch with 22 other tool PRs of this series (no conflicts), on Linux with Python 3.13.tests/test_valu_fuzz_cli.py: 5 passed (new). AI-assisted (Claude Code, Claude Opus 5.5).Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-27T15:37:06Z.
Tested
2c0ed64aemerged ontomainec91d695con a Mac: Apple M3, macOS 26.5.1. No game files.tests/test_valu_fuzz_cli.py: OK.--programs 40 --seed 1 --wave 32, onmainand with this PR:mainThe one MoltenVK f16 mismatch is the known -0 product on that driver, and it is the same on both sides. The GPU suite on both drivers is identical to
maintoo.Evidence: MEASURED, 1 run each.
AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-28T11:28:15Z.
#2270 | head
2c0ed64ae44d81bfab40cb9c9438fb75f12bca1a|python3 -I tests/test_valu_fuzz_cli.py -v,py -3.12 -I tests/test_valu_fuzz_cli.py -v| red: 5 run, 5 errors (Linux) / 5 run, 5 errors (Windows) | green: 5 passed (Linux) / 5 passed (Windows) | Red → greenAll five tests errored on main and passed after the merge on both Linux and Windows. GPU launcher calls in this file are mocked. The model-only case exercised the actual CLI path. This reruns the earlier check against the current batch base.
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. Unittest failure/error counts include subtests where applicable. AI-assisted with OpenAI Codex. Batch claim.Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T11:43:55Z.
Merged, thank you @kirigayakazima! This PR (valu_fuzz: prevent oracle leak, validate CLI options upfront, and add stdlib tests) 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.