scripts/corpus_watch: strip BOM JSON, check --out/--game collisions, validate args, enforce UTF-8 #2256
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!2256
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/corpus-watch-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: CORPUS-WATCH-CLI-ENCODING-COLLISION-AND-BOM-SAFETY (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7189698488)
What and why
dxbc/index.json,spirv/index.json, and--resultsJSONL withencoding="utf-8-sig"inscripts/corpus_watch.pyand validate parsed container root types (list/dictfor carved index,dictforspirv/index.json).outputs_collide()(keeping 4-argument default compatibility) to check--outand--gamealongsidework,report,results, andlog.main(argv=None)to reject non-finite or negative--interval, non-positive--jobs, and directory/trailing-separator--resultsor--logpaths viaap.error(...)before tool checks or runningmake_game.py.--resultsand--logare created once prerequisites pass, and passencoding="utf-8", errors="replace"to bothsubprocess.run()invocations.tests/test_corpus_watch.pywith tests covering BOM indexes, malformed roots,--out/--gamecollision checks, CLI argument validation, nested parent folder creation, and subprocess encoding.Tested
python -I tests/test_corpus_watch.py -v->Ran 7 tests in 0.149s(OK).upstream/maina73a57e1with updatedtests/test_corpus_watch.pycopied into detached worktree):Ran 7 tests in 0.101s(FAILED (errors=10)).python -I tests/test_ci_registration.py(Ran 16 tests in 5.514s,OK),python -I tests/test_text_write_line_endings.py(Ran 3 tests in 13.118s,OK),python -I scripts/check_no_game_data.py(exit 0),python -I -m compileall -q(exit 0),git diff --check(exit 0).GPUs tested: n/a (mocked subprocess calls and corpus-counting unit tests)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.Approving fa4d7ae12.
Outputs are now checked against the game folder as well as the work folder (and
--outamong them),--interval/--jobs/--results/--logare validated, the JSON inputs must be the expected shapes, and llvm-mc 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_corpus_watch.py: 7 passed (main: 4). AI-assisted (Claude Code, Claude Opus 5.5).#2256 | head
199c8c17e0e23ed4326c47404e66ad9d9e2f5821|python3 -I tests/test_corpus_watch.py -v| red: 8 tests, 15 errors | green: 8 passed | Exceptions on main → passBaseline errors included BOM decoding and incompatible call signatures. The merged tests exercised those paths successfully. Failure and error counts include subtest events.
Pinned main
4938673668d807bf365b61284bf22b1ff8d02cc4, merged into the PR head. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Full suite: not run. AI-assisted: OpenAI Codex. Batch claim.Native Windows 11 NTFS Verification (
199c8c17e0)Verified
199c8c17e0e23ed4326c47404e66ad9d9e2f5821merged cleanly ontoorigin/main(c7753ed98a56677f10e34078b37eab0540e190ec,git merge-tree --write-treerc=0) on native Windows 11 (26200) + NTFS:origin/mainc7753ed98a):python -I tests/test_corpus_watch.pyfailed (FAILED (errors=15)across8tests).origin/main + 199c8c17e0):python -I tests/test_corpus_watch.py:8/8 OK(utf-8-sigBOM handling ondxbc/spirvindexes andresults,--out/--game/corpus-index collision guards,--intervalfinite/nonnegative and--jobs >= 1CLI validation, parent folder creation, and explicitencoding="utf-8", errors="replace"subprocess calls).os.link) toshaders\dxbc\index.jsonand confirmedcorpus_watch.outputs_colliderejects it (True).AI-assisted.
Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, main c8bf0e7b6, PR head 199c8c17e : red 15 errors / green 8 OK
python3.12 -I tests/test_corpus_watch.py(8 tests):git merge-tree).test_cli_validation_parent_creation_and_subprocess_encoding(interval nan / inf / -1, jobs 0 / -2, results/log pointing at a directory; main'smain()takes no argv yet),test_outputs_collide_checks_out_and_game,test_outputs_collide_rejects_work_corpus_indexes(4 index.json paths),test_utf8_bom_indexes_and_malformed_root_types.git merge --no-ff): 8/8 OK, skipped 0.test_tool_startupsamepsin_dialoguefailure on main and merge, unrelated.outputs_collidenow also compares out vs game and the 4 work-dir index.json files (still plain path equality, so an output placed inside the work dir is not caught); interval finite and >= 0, jobs >= 1; parents of results/log created; subprocess output read as utf-8 witherrors=replace. No game data.Verdict: READY
AI-assisted: Claude Code
Merging, thank you @kirigayakazima! OreoFR's agent verified this head merged with current main: the test fails on main and passes with the PR (https://github.com/ProjectLeonida/mandy/pull/2256#issuecomment-7249981480), and it still merges cleanly.
AI-assisted (Claude Code, Claude Opus 5.5), on behalf of DadaCap.