regen_fixtures: guard flags/paths, strip UTF-8 BOM, and write atomically #2265
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2265"
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:47:19Z.
Claimed in the coordination issue as: REGEN-FIXTURES-UNKNOWN-FLAGS-BOM-TRAVERSAL-AND-ATOMIC-IO (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7191130679)
What and why
tests/semantic/regen_fixtures.pypreviously:-...CLI options and--help, treating unrecognized flags as ignored rather than usage errors.../escapeorsub/name) without checking single-segment basename safety..asmand.sfiles with"utf-8"instead of"utf-8-sig", leaving a UTF-8 BOM attached to line 1 inmarked_names(),generated_names(),render(),mark(), and--check..asmmarks and.sfixtures in place via directopen(..., "w").This rejects unknown flags (
-h/--helpreturn 0,--ends options), validates plain shader stems upfront, opens files withutf-8-sig, stages and publishes writes atomically viatempfile+file_mode.published_mode+replace_retry.replace, handlesOSError/UnicodeDecodeErrorcleanly, and adds unit coverage intests/test_regen_fixtures.py.Tested
python -I tests/test_regen_fixtures.py -v(11 passed)python -I tests/semantic/regen_fixtures.py --checkupstream/mainbaseline negative control: failed with the new 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.Imported from ubiquitarianism/leonida. Originally posted by real-rusher on 2026-11-26T12:23:32Z.
Verified on main
a73a57e1(Ubuntu 24.04 x86-64, Python 3.13, no GPU). Merges cleanly. With this PR, python -I tests/test_regen_fixtures.py: 11 tests OK. The PR's test file against main's tool: 3 failures and 1 error, so the new tests fail on main and pass with the change. compileall clean.AI-assisted: yes (Claude Code)
Imported from ubiquitarianism/leonida. Originally posted by tiguan26 on 2026-11-27T04:37:17Z.
Review: APPROVED
Approving
942872e11.Generated fixtures are written through a temp file and
replace_retrywith the destination's mode, sources are read BOM-tolerant, and a shader name with a separator or a traversal segment is refused.Merged onto
maind1dff7949in one batch with 22 other tool PRs of this series (no conflicts), on Linux with Python 3.13.tests/test_regen_fixtures.py: 11 passed (main: 7). AI-assisted (Claude Code, Claude Opus 5.5).Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-28T10:45:08Z.
#2265 | head
942872e11e73e0786885259af86434c383e45a7e|python3 -I tests/test_regen_fixtures.py -v| red: 11 run, 3 failures, 1 error | green: 11 passed | Red → greenThe fixture regenerator being tested lives under tests/semantic/. I copied only test_regen_fixtures.py to clean main. Its flag, path and BOM assertions failed and the atomic-write case raised an error. All 11 passed after the merge.
Base
3bd936ecd98995bca3e1da83d5e28d2343001aefwas merged into the recorded PR head for the second run. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Counts include unittest subtest events where applicable. AI-assisted with OpenAI Codex. Batch claim.Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T11:53:46Z.
Merged, thank you @kirigayakazima! This translator PR (regen_fixtures: guard flags/paths, strip UTF-8 BOM, and write atomically) passed its own tests with main merged in during sodove's verification of this batch, so it went in with the batch.
AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.