lds_fuzz: guard --model-only/--keep/--only flags and enforce UTF-8 subprocess I/O #2269
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!2269
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/lds-fuzz-cli-safety"
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
Claimed in the coordination issue as: LDS-FUZZ-CLI-KEEP-MODEL-ONLY-AND-ENCODING-SAFETY (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7191235314)
What and why
tools/lds_fuzz.pypreviously:main()with noargvparameter and skipped validating--keep/--perturb/--negative-control/--minimizewhenever--model-onlywas also passed.--keep ""or a regular file path for--keep, and ignored negative indices mixed into--only(such as0,-1).subprocess.run(..., text=True)intranslate()andrun_gpu()withoutencoding="utf-8", errors="replace"and readindex.jsonwithout"utf-8-sig".This adds
argv=Nonetomain(), enforces--oracle hw(without--model-only) and directory/non-empty validation for--keep, rejects negative--onlyindices, sets UTF-8 encoding/BOM handling intranslate()andrun_gpu(), and adds unit coverage intests/test_lds_fuzz.py.Tested
python -I tests/test_lds_fuzz.py -v(40 passed)upstream/mainbaseline negative control: failed with the new CLI tests before 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.Verified on main a73a57e1 (Ubuntu 24.04 x86-64, Python 3.13, no GPU). Merges cleanly. With this PR, python -I tests/test_lds_fuzz.py: 40 tests OK. The PR's test file against main's tool: 3 errors, so the new tests fail on main and pass with the change. compileall clean.
AI-assisted: yes (Claude Code)
Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main.
tests/test_lds_fuzz.py: 40 passed (main: 37 passed).(AI-assisted test run; output checked by hand.)
Approving 9a678ef40.
--keepand the other hardware-only flags are refused with--model-onlytoo (an empty--keepcounted as unset before),--onlyrejects empty and negative indexes, and subprocess output is decoded as UTF-8 with the index read BOM-tolerant.Merged onto
maind1dff7949in one batch with 22 other tool PRs of this series (no conflicts), on Linux with Python 3.13.tests/test_lds_fuzz.py: 40 passed (main: 37). AI-assisted (Claude Code, Claude Opus 5.5).Tested
9a678ef40merged (no commit) withmainaa918e5d9: Python 3.12.4, Windows 11 10.0.26300, CPU only.check_no_game_data.pyis clean.tests/test_lds_fuzz.py, 40 tests pass.tools/lds_fuzz.pyback tomain, 3 tests error (Unexpected UTF-8 BOM).No blocker from my side.
AI-assisted (Claude Code).
Merged after TheGeogeo's red/green check (check) (Windows, Python tests, no GPU needed) and a local re-check here. Merged after local re-verification: this PR merged onto
main02a69e602 without conflict, and its test file(s) (tests/test_lds_fuzz.py) pass there. Earlier today the same tests failed onmainwithout the PR (red/green) and a bundle with other open PRs showed no new failures.check_no_game_data.pyis clean. Windows 11, Python 3.14; no GPU needed for these tests.AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.