tools/ab_control_flow: handle UTF-8-SIG/CRLF inputs, subprocess encoding and atomic outcomes.tsv #1853
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1853"
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-25T13:11:04Z.
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).Imported from ubiquitarianism/leonida. Originally posted by madvillain91 on 2026-11-25T13:31:16Z.
Review: COMMENTED
Independent Windows 11 26H2 (26300.9711) check at
3a84ae7aaagainst main384abe5b0(PR base98c2f7777), using CPython 3.12.3 (python -I) and Git for Windows 2.56.0.windows.2. Passed test_ab_control_flow.py (69 passed, 1 skipped on Windows mode-000 test, 3.226s) and test_text_write_line_endings.py (3/3 in 19.435s), with check_no_game_data.py and compileall clean. Verified UTF-8-SIG/CRLF handling for names files and index.json, encoding="utf-8", errors="replace" on subprocess.run calls under Windows python -I, and atomic outcomes.tsv publishing via replace_retry with staging cleanup on failure. LGTM.Imported from ubiquitarianism/leonida. Originally posted by GeorgiyDemo on 2026-11-25T14:21:35Z.
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.
Imported from ubiquitarianism/leonida. Originally posted by DeadlyChirp on 2026-11-25T15:37:39Z.
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.)
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T17:31:42Z.
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).