ci: handle UTF-8 failure list encoding (CI-FAILURE-LIST-ENCODING) #652

Manually merged
github merged 1 commit from gh-pr/652/head into gh-pr/652/base 2026-11-26 09:14:00 +00:00
Owner

@⁠promise-ssss on GitHub · 2026-11-24 11:01 UTC · original
promise-ssss:codex/ci-failure-list-encoding → main · +27 −8 · 2 files · 1 commits · merged 2026-11-24 14:37 UTC

Claimed in the coordination issue as: CI-FAILURE-LIST-ENCODING (claim)

What and why

ci_expected_failures.py reads failure lists as UTF-8 with an optional BOM. A BOM used to become part of the first test name and turn an expected failure into a CI error. Invalid UTF-8 now produces a one-line input diagnostic and exit status 2. The regression tests use synthetic lists.

Tested

Windows 11 build 26300, Python 3.12.10.

  • python -I -B tests/test_ci_expected_failures.py — 14 passed. Both new tests failed against the original implementation.
  • python -m compileall -q make_game.py scripts tools tests — passed with a temporary bytecode cache.
  • python -I -B tests/test_text_write_line_endings.py — 3 passed.
  • python -I -B scripts/check_no_game_data.py scripts/ci_expected_failures.py tests/test_ci_expected_failures.py and git diff --check — passed.
  • python -I -B scripts/run_semantic_tests.py tests/semantic --jobs 12 --timeout 300 — 465 files, 6,105 tests reported, 3 failing files. test_sopc_validation and test_unary_f16_validation require spirv-as and spirv-val, which are missing on this machine. test_mutations exceeded 300 seconds. A sequential retry also reached its 600-second limit.
  • python -I -B tests/test_tool_stdout_encoding.py — the same baseline assertion fails for tools/exe_sha.py and tools/pr_conflict_label.py.

GPUs tested: n/a

AI-assisted: yes (OpenAI Codex)

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • No game data, keys or decryption.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (Not applicable.)
**@⁠promise-ssss** on GitHub · 2026-11-24 11:01 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/652) `promise-ssss:codex/ci-failure-list-encoding` → `main` · +27 −8 · 2 files · 1 commits · merged 2026-11-24 14:37 UTC Claimed in the coordination issue as: CI-FAILURE-LIST-ENCODING ([claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)) ### What and why `ci_expected_failures.py` reads failure lists as UTF-8 with an optional BOM. A BOM used to become part of the first test name and turn an expected failure into a CI error. Invalid UTF-8 now produces a one-line input diagnostic and exit status 2. The regression tests use synthetic lists. ### Tested Windows 11 build 26300, Python 3.12.10. - `python -I -B tests/test_ci_expected_failures.py` — 14 passed. Both new tests failed against the original implementation. - `python -m compileall -q make_game.py scripts tools tests` — passed with a temporary bytecode cache. - `python -I -B tests/test_text_write_line_endings.py` — 3 passed. - `python -I -B scripts/check_no_game_data.py scripts/ci_expected_failures.py tests/test_ci_expected_failures.py` and `git diff --check` — passed. - `python -I -B scripts/run_semantic_tests.py tests/semantic --jobs 12 --timeout 300` — 465 files, 6,105 tests reported, 3 failing files. `test_sopc_validation` and `test_unary_f16_validation` require `spirv-as` and `spirv-val`, which are missing on this machine. `test_mutations` exceeded 300 seconds. A sequential retry also reached its 600-second limit. - `python -I -B tests/test_tool_stdout_encoding.py` — the same baseline assertion fails for `tools/exe_sha.py` and `tools/pr_conflict_label.py`. GPUs tested: n/a AI-assisted: yes (OpenAI Codex) ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic. - [x] No game data, keys or decryption. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (Not applicable.)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:13:59 +00:00
github manually merged commit 979e899e65 into gh-pr/652/base 2026-11-26 09:14:00 +00:00
Author
Owner

@⁠kirigayakazima on GitHub · 2026-11-24 11:49 UTC · original

Reviewed on Windows 11 x64 (Python 3.14.7, CPU only, synthetic failure lists only — no game files) against head commit 979e899e652a38ac7dfb6b16e80107cd56dc05f4.

Verdict: Looks good — switching to utf-8-sig and catching UnicodeDecodeError with exit code 2 cleanly prevents a UTF-8 BOM from corrupting the first failure name and keeps malformed input distinct from unexpected test failures.

Checks run locally

  • Clean merge with main (21625bca): git merge-tree --write-tree upstream/main HEAD exited 0; git diff --check upstream/main...HEAD clean.
  • python -I tests/test_ci_expected_failures.py -v: 14 tests, OK.
  • python -I tests/test_ci_registration.py: 15 tests, OK.
  • python -I tests/test_text_write_line_endings.py: 3 tests, OK.
  • python -I scripts/check_no_game_data.py scripts/ci_expected_failures.py tests/test_ci_expected_failures.py and python -m compileall -q scripts tests: exit 0.

Additional Windows edge-case probes

  • UTF-8 BOM + CRLF (b"\xef\xbb\xbfknown\r\nother\r\n"): exited 0 when both are expected (::warning:: lines emitted cleanly).
  • BOM-only / BOM+CRLF-only: exited 0 cleanly on status 0, and exited 1 with the test runner exited with 8 without naming a failed test on status 8 (did not treat the BOM as a failed test name).
  • UTF-16 LE BOM & truncated multi-byte UTF-8: exited 2 cleanly with a single-line 'utf-8' codec can't decode... diagnostic on stderr and no traceback.
  • Concatenated BOM on later lines (b"\xef\xbb\xbfa\n\xef\xbb\xbfb\n"): as expected for utf-8-sig, only a leading BOM is stripped (matching the docstring's "and an optional BOM").
  • Non-ACP characters under redirected Windows ANSI code page (python -I, CP936 here): non-CP936 paths (\u2603) in error diagnostics use stderr's backslashreplace cleanly (exit 2, no UnicodeEncodeError), and non-CP936 test names on stdout degrade cleanly via sys.stdout.reconfigure(errors="replace").

(Note regarding the two missing-SPIRV-Tools semantic test failures mentioned in the PR description: #676 proposes separating those optional spirv-as/spirv-val checks on machines without SPIRV-Tools installed.)

AI-assisted: yes

**@⁠kirigayakazima** on GitHub · 2026-11-24 11:49 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/652#issuecomment-7130599490) Reviewed on Windows 11 x64 (`Python 3.14.7`, CPU only, synthetic failure lists only — no game files) against head commit `979e899e652a38ac7dfb6b16e80107cd56dc05f4`. **Verdict: Looks good** — switching to `utf-8-sig` and catching `UnicodeDecodeError` with exit code `2` cleanly prevents a UTF-8 BOM from corrupting the first failure name and keeps malformed input distinct from unexpected test failures. ### Checks run locally - Clean merge with `main` (`21625bca`): `git merge-tree --write-tree upstream/main HEAD` exited `0`; `git diff --check upstream/main...HEAD` clean. - `python -I tests/test_ci_expected_failures.py -v`: **14 tests, OK**. - `python -I tests/test_ci_registration.py`: **15 tests, OK**. - `python -I tests/test_text_write_line_endings.py`: **3 tests, OK**. - `python -I scripts/check_no_game_data.py scripts/ci_expected_failures.py tests/test_ci_expected_failures.py` and `python -m compileall -q scripts tests`: exit `0`. ### Additional Windows edge-case probes - **UTF-8 BOM + CRLF (`b"\xef\xbb\xbfknown\r\nother\r\n"`)**: exited `0` when both are expected (`::warning::` lines emitted cleanly). - **BOM-only / BOM+CRLF-only**: exited `0` cleanly on status `0`, and exited `1` with `the test runner exited with 8 without naming a failed test` on status `8` (did not treat the BOM as a failed test name). - **UTF-16 LE BOM & truncated multi-byte UTF-8**: exited `2` cleanly with a single-line `'utf-8' codec can't decode...` diagnostic on `stderr` and no traceback. - **Concatenated BOM on later lines (`b"\xef\xbb\xbfa\n\xef\xbb\xbfb\n"`)**: as expected for `utf-8-sig`, only a leading BOM is stripped (matching the docstring's `"and an optional BOM"`). - **Non-ACP characters under redirected Windows ANSI code page (`python -I`, CP936 here)**: non-CP936 paths (`\u2603`) in error diagnostics use `stderr`'s `backslashreplace` cleanly (exit `2`, no `UnicodeEncodeError`), and non-CP936 test names on `stdout` degrade cleanly via `sys.stdout.reconfigure(errors="replace")`. (Note regarding the two missing-SPIRV-Tools semantic test failures mentioned in the PR description: #676 proposes separating those optional `spirv-as`/`spirv-val` checks on machines without SPIRV-Tools installed.) AI-assisted: yes
This discussion has been locked. Commenting is limited to contributors.
No description provided.