Skip to content

tests: guest scene launch failure decodes a localized OS error (TEST-GSR-LOCALE) - #586

Merged
aslan2142 merged 1 commit into
ProjectLeonida:mainfrom
kawaii-shakal:test-gsr-locale
Nov 24, 2026
Merged

aslan2142 merged 1 commit into
ProjectLeonida:mainfrom
kawaii-shakal:test-gsr-locale

Conversation

@kawaii-shakal

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: TEST-GSR-LOCALE (claim)

Depends on: #320 — no code dependency, but both change test_launch_failure_preserves_run_record_and_logs on adjacent lines, so git merge-tree reports a textual conflict; whichever lands second needs a one-line rebase.

What and why

tests/test_guest_scene_reference.py::test_launch_failure_preserves_run_record_and_logs fails on a Windows host whose ANSI code page is not UTF-8 (1251 on a Russian install).

scripts/run_guest_scene.py reports the failed launch as FAIL: full: could not launch <loader>: [WinError 216] ..., and Windows localizes that OS error text. The child writes it to the pipe in the ANSI code page, while the test decoded the output as strict UTF-8 (encoding="utf-8" with no errors=). The decode fails in subprocess's reader thread, result.stdout comes back as None, and the next line (result.stdout + result.stderr in the assertion message) raises TypeError before any of the test's real assertions run. pytest also reports a PytestUnhandledThreadExceptionWarning with UnicodeDecodeError: 'utf-8' codec can't decode byte 0xdd.

The fix decodes with errors="replace", as the output-directory case in the same file (line 95) already does. Stdout is only used for the failure message here; the test's assertions read report.json and logs/full.json, which the runner writes as UTF-8. No tool change.

Tested

Windows 11 Pro 26300, ANSI code page 1251, Python 3.13.13, pytest 9.2.0 from tests/requirements.txt:

GPUs tested: n/a (no GPU or game files involved)

AI-assisted: yes

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: no translator change)

🤖 Generated with Claude Code

…GSR-LOCALE)

On a Windows host whose ANSI code page is not UTF-8 (1251 on a Russian
install), run_guest_scene.py prints the "could not launch" line with the
localized [WinError 216] text in that code page. The test decoded the
child's output as strict UTF-8, so subprocess.run left result.stdout as
None and the next line failed with a TypeError before any real assertion
ran. Decode with errors="replace", as the output-directory case in the
same file already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@lixonik lixonik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent verification of 0667ec1 with a synthetic Windows fixture: I ran test_launch_failure_preserves_run_record_and_logs with the temporary directory under a path containing a non-ASCII character. On the comparison base the subprocess reader raised UnicodeDecodeError, then the assertion message raised TypeError. On the PR head the same case passed. The ordinary test file passed all six tests on both revisions.

This exercises the same decoder failure through a non-ASCII path in the launch diagnostic. AI-assisted testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants