tools/ab_control_flow: handle UTF-8-SIG/CRLF inputs, subprocess encoding and atomic outcomes.tsv #1853
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!1853
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/ab-control-flow-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: AB-CONTROL-FLOW-CRLF-BOM-AND-ATOMIC-TSV (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7163364385)
What and why
--namesandindex.jsonintools/ab_control_flow.pywithencoding="utf-8-sig"and parse--nameslines viasplitlines()+.strip()so UTF-8 BOMs and Windows CRLF endings do not corrupt shader names.outcomes.tsvatomically inwrite_outcomes()(tempfile.mkstempbesideos.path.realpath(...),os.fsync,published_mode, andreplace_retry.replace), preserving any existing file and cleaning up staging files on failure.encoding="utf-8", errors="replace"tosubprocess.run(..., capture_output=True, text=True)inrender_targets()andmain()for safe decoding underpython -I.tests/test_ab_control_flow.py.Tested
python -I tests/test_ab_control_flow.py -v->Ran 70 tests in 1.849s,OK (skipped=1)(Windows skipschmod 000test).upstream/main(98c2f777) baseline worktree with updatedtests/test_ab_control_flow.py->Ran 70 tests in 1.733s,FAILED (failures=2, errors=2, skipped=1).python -I tests/test_ci_registration.py->Ran 16 tests in 7.338s,OK.python -I tests/test_text_write_line_endings.py->Ran 3 tests in 14.354s,OK.python -I scripts/check_no_game_data.py tools/ab_control_flow.py tests/test_ab_control_flow.py,python -I -m compileall -q tools/ab_control_flow.py tests/test_ab_control_flow.py, andgit diff --check-> exit0.GPUs tested: n/a (CPU/stdlib Python tests on Windows 11 x64)
AI-assisted: yes
Checklist
needs rebase).Tested
3a84ae7aaon Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), againstmain71a769d7d(Python shader tool; no GPU):tests/test_ab_control_flow.py: 70 passed, 31 subtests passed at this head.main: 4 failed, 66 passed — the UTF-8-SIG/CRLF names reading and the atomic TSV write are the new cases.index.json/--namespair from a translation; the tests build them synthetically.AI-assisted; synthetic fixtures only, no game data.
Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main.
python -m pytest -q tests/test_ab_control_flow.py:mode 000 does not stop root or Windowstest. The new tests pass.(AI-assisted test run; output checked by hand.)
Merged. Thank you, @kirigayakazima. UTF-8-SIG and CRLF inputs and subprocess encodings are handled, and the TSV is written atomically.
mainand pass here; the docs, line-ending and CI/ctest registration checks pass, and so does the game-data check.main863c1616a+3a84ae7aa: the semantic suite passes (490 files, 6,292 tests, 0 files failed);test_ab_control_flowpass; the 15 docs and writer tests pass;check_no_game_data.pyis clean on the 2 changed files.AI-assisted (Claude Code, Claude Opus 5.5).