tests: decode the GPU work-directory error as UTF-8 on non-English Windows (TEST-WINDOWS-ANSI-STDERR) #2112

Merged
MoonEyes merged 3 commits from upstream-pr/2112 into main 2026-11-28 10:52:10 +00:00
MoonEyes commented 2026-11-25 21:10:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-25T21:10:13Z.


Claimed in the coordination issue as: TEST-WINDOWS-ANSI-STDERR (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7174699096)

What and why

WorkDirectory.test_file_blocking_work_directory_is_a_cli_error in tests/test_run_gpu_tests_paths.py runs
scripts/run_gpu_tests.py with -I and asserts on its stderr. That stderr quotes a localized OS error
("Impossible de créer un fichier déjà existant" on a French install). -I ignores PYTHONUTF8, so the child
wrote the message in the ANSI code page (cp1252), while a parent running with PYTHONUTF8=1 decoded the pipe
as UTF-8. The reader thread raised UnicodeDecodeError, result.stderr came back None, and both subtests
(blocked_child='' and 'spirv') failed with a TypeError before their assertions ran.

The child now runs with -X utf8 (which -I keeps) and the parent decodes with encoding="utf-8", so both sides
agree whatever the host locale or PYTHONUTF8 setting. Decoding stays strict, so a real mismatch would still show.
Test-only change; scripts/run_gpu_tests.py is untouched.

Tested

Windows 11 (French, ANSI code page cp1252), Python 3.14.0, python -m pytest tests/test_run_gpu_tests_paths.py:

  • main, PYTHONUTF8=1: 2 subtests fail (UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9, then
    TypeError: argument of type 'NoneType' is not a container or iterable at line 145).
  • main, without PYTHONUTF8: passes.
  • this branch, PYTHONUTF8=1: 21 passed, 7 subtests passed.
  • this branch, without PYTHONUTF8: 21 passed, 7 subtests passed.

GPUs tested: n/a (the test uses stand-in tool files; no GPU runs)

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a)

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5499231164 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2112). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-25T21:10:13Z. --- Claimed in the coordination issue as: TEST-WINDOWS-ANSI-STDERR (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7174699096) ### What and why `WorkDirectory.test_file_blocking_work_directory_is_a_cli_error` in `tests/test_run_gpu_tests_paths.py` runs `scripts/run_gpu_tests.py` with `-I` and asserts on its stderr. That stderr quotes a localized OS error ("Impossible de créer un fichier déjà existant" on a French install). `-I` ignores `PYTHONUTF8`, so the child wrote the message in the ANSI code page (cp1252), while a parent running with `PYTHONUTF8=1` decoded the pipe as UTF-8. The reader thread raised `UnicodeDecodeError`, `result.stderr` came back `None`, and both subtests (`blocked_child=''` and `'spirv'`) failed with a `TypeError` before their assertions ran. The child now runs with `-X utf8` (which `-I` keeps) and the parent decodes with `encoding="utf-8"`, so both sides agree whatever the host locale or `PYTHONUTF8` setting. Decoding stays strict, so a real mismatch would still show. Test-only change; `scripts/run_gpu_tests.py` is untouched. ### Tested Windows 11 (French, ANSI code page cp1252), Python 3.14.0, `python -m pytest tests/test_run_gpu_tests_paths.py`: - main, `PYTHONUTF8=1`: 2 subtests fail (`UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9`, then `TypeError: argument of type 'NoneType' is not a container or iterable` at line 145). - main, without `PYTHONUTF8`: passes. - this branch, `PYTHONUTF8=1`: 21 passed, 7 subtests passed. - this branch, without `PYTHONUTF8`: 21 passed, 7 subtests passed. GPUs tested: n/a (the test uses stand-in tool files; no GPU runs) AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
DeadlyChirp commented 2026-11-26 10:00:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DeadlyChirp on 2026-11-26T10:00:41Z.


Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main.

  • tests/test_run_gpu_tests_paths.py: 21 passed, 7 subtests passed.

(AI-assisted test run; output checked by hand.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7188786295 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2112#issuecomment-7188786295). Originally posted by [DeadlyChirp](https://github.com/DeadlyChirp) on 2026-11-26T10:00:41Z. --- Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main. - `tests/test_run_gpu_tests_paths.py`: 21 passed, 7 subtests passed. (AI-assisted test run; output checked by hand.)
sodove commented 2026-11-28 10:12:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-28T10:12:24Z.


#2112 | head 92465a0847292753c72b10f7e8578236f2ff44cb | python3 -I tests/test_run_gpu_tests_paths.py -v, py -3.12 -I -X utf8 tests/test_run_gpu_tests_paths.py -v | red: Linux 21 passed / Windows 21 passed | green: Linux 21 passed / Windows 21 passed | Green on both trees

I also ran the untouched main file and both prescribed phases on native Windows 11 (English, ANSI cp1252) with a UTF-8 parent. All three passed. This host did not reproduce the localized Windows stderr failure described in the PR.

Pinned main 33db04a7010e81c40a7a6a15624525aa0c4a3a58, merged into this PR head. Ubuntu 26.04.1 (WSL2), Python 3.14.4 and Windows 11 Pro, Python 3.12.10. Full suite: not run. AI-assisted: OpenAI Codex. Batch claim.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7237743485 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2112#issuecomment-7237743485). Originally posted by [sodove](https://github.com/sodove) on 2026-11-28T10:12:24Z. --- #2112 | head `92465a0847292753c72b10f7e8578236f2ff44cb` | `python3 -I tests/test_run_gpu_tests_paths.py -v`, `py -3.12 -I -X utf8 tests/test_run_gpu_tests_paths.py -v` | red: Linux 21 passed / Windows 21 passed | green: Linux 21 passed / Windows 21 passed | **Green on both trees** I also ran the untouched main file and both prescribed phases on native Windows 11 (English, ANSI cp1252) with a UTF-8 parent. All three passed. This host did not reproduce the localized Windows stderr failure described in the PR. Pinned main `33db04a7010e81c40a7a6a15624525aa0c4a3a58`, merged into this PR head. Ubuntu 26.04.1 (WSL2), Python 3.14.4 and Windows 11 Pro, Python 3.12.10. Full suite: not run. AI-assisted: OpenAI Codex. [Batch claim](https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7237628300).
DadaCap commented 2026-11-28 10:52:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T10:52:12Z.


Merged, thank you @MoonEyes!

What it does: fixes tests/test_run_gpu_tests_paths.py on a non-English Windows. The test runs scripts/run_gpu_tests.py with -I and checks its stderr, which quotes a localized OS error ("Impossible de créer un fichier déjà existant" on a French install). -I ignores PYTHONUTF8, so the child wrote that message in the ANSI code page while a UTF-8 parent tried to decode it as UTF-8: the read failed, stderr came back None, and the test died with a TypeError. The child now runs with -X utf8 (which -I keeps) and the parent decodes as UTF-8. Test-only, run_gpu_tests.py is untouched.

How it was checked: sodove ran the test on Linux and on an English Windows 11 at head 92465a084: it passes on main and with the PR there, because an English OS message has no accent to break the decoding. So we rebuilt the bug by hand: a child run with -I writing the French message, read the way the test reads it. With main's setup the parent gets UnicodeDecodeError on byte 0xe9 (the "é") and None for stderr, exactly as described here; with this PR's -I -X utf8 and encoding="utf-8" the French message decodes correctly. We also confirmed that under -I the child is not in UTF-8 mode (stderr in cp1252) and that -X utf8 survives -I.

CI: its red jobs match main's known failures.

Merged as part of the same reviewed batch.

AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7238175135 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2112#issuecomment-7238175135). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-28T10:52:12Z. --- Merged, thank you @MoonEyes! **What it does:** fixes `tests/test_run_gpu_tests_paths.py` on a non-English Windows. The test runs `scripts/run_gpu_tests.py` with `-I` and checks its stderr, which quotes a localized OS error ("Impossible de créer un fichier déjà existant" on a French install). `-I` ignores `PYTHONUTF8`, so the child wrote that message in the ANSI code page while a UTF-8 parent tried to decode it as UTF-8: the read failed, stderr came back `None`, and the test died with a `TypeError`. The child now runs with `-X utf8` (which `-I` keeps) and the parent decodes as UTF-8. Test-only, `run_gpu_tests.py` is untouched. **How it was checked:** sodove ran the test on Linux and on an English Windows 11 at head `92465a084`: it passes on main and with the PR there, because an English OS message has no accent to break the decoding. So we rebuilt the bug by hand: a child run with `-I` writing the French message, read the way the test reads it. With main's setup the parent gets `UnicodeDecodeError` on byte `0xe9` (the "é") and `None` for stderr, exactly as described here; with this PR's `-I -X utf8` and `encoding="utf-8"` the French message decodes correctly. We also confirmed that under `-I` the child is not in UTF-8 mode (stderr in cp1252) and that `-X utf8` survives `-I`. **CI:** its red jobs match main's known failures. Merged as part of the same reviewed batch. AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!2112
No description provided.