Skip to content

CI-CRASH-MONITOR-ENCODING: test_crash_monitor reads its text files as UTF-8 - #2616

Merged
MoonEyes merged 2 commits into
ProjectLeonida:mainfrom
Bloh09:fix/ci-crash-monitor-encoding
Nov 29, 2026
Merged

MoonEyes merged 2 commits into
ProjectLeonida:mainfrom
Bloh09:fix/ci-crash-monitor-encoding

Conversation

@Bloh09

@Bloh09 Bloh09 commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: CI-CRASH-MONITOR-ENCODING (#2570 (comment))

Depends on: none

What and why

test_every_text_file_call_pins_its_encoding is red on main: scripts/windows-boot/test_crash_monitor.py (1b9e496) calls read_text() without encoding= at lines 37 and 90. Both now pass encoding="utf-8".

Tested

python3 -m unittest tests.test_text_encoding fails on main, passes here. test_crash_monitor.py still runs (all 10 skip on Linux, Windows-only). python3 -I scripts/check_no_game_data.py passed.

GPUs tested: none (CPU/Linux only)

AI-assisted: yes (Grok Bot), reviewed by me.

Skipped/risky: crash monitor tests not run on Windows here; stack.txt is ASCII so UTF-8 is safe.

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.

@merzleckeier

Copy link
Copy Markdown
Contributor

I checked 6d5a3ba against 0bc6e21a with Windows Python 3.12.10 under Wine 11.22, using code page 1252 with Python UTF-8 mode off. The monitor and its synthetic child were built from the unchanged base. The relevant files are identical on upstream 4364a4fa.

The encoding guard reports the two unpinned reads on the base and passes both tests with this PR. I also ran both versions of CrashMonitorTest.check_artifacts on each of these reports.

Report Base PR
Monitor output from the ASCII-named synthetic child Pass Pass
Same output with a UTF-8 Łódź marker appended to stack.txt Decode error at byte 81 Pass, marker preserved
Monitor output from the same child renamed to módulo-fixture.exe, with no changes to the report Pass UTF-8 decode error at byte f3

The third report contains the raw byte sequence m\xf3dulo in a stack frame. Under Wine, the narrow DbgHelp module name reaches stack.txt in the active code page. Could this change or a follow-up make the writer emit UTF-8 explicitly? The wide DbgHelp APIs followed by conversion to UTF-8 would give the reader a defined encoding for module and symbol names.

Seven of nine unmodified non-PowerShell cases pass on each revision. The two abnormal-exit cases produce no crash.dmp on either revision under this Wine setup. I did not run the PowerShell entry-point case or native Windows.

AI-assisted with OpenAI Codex (GPT-6).

@Bloh09

Bloh09 commented Nov 29, 2026

Copy link
Copy Markdown
Contributor Author

f569782 reads stack.txt with errors=replace so a code-page module name no longer breaks the test. Making the writer emit UTF-8 via the wide DbgHelp APIs is a separate topic, leaving it for a follow-up.

@fiestorra

Copy link
Copy Markdown
Contributor

Independent verification, since this is the check that has kept check, stdlib-tests-linux and macos-python red on main.

Fetched the head (f56978233) and ran the test that fails on main:

python -I tests/test_text_encoding.py   ->   OK   (main: FAILED (failures=1), naming lines 37 and 90)

The change is what the title says, and the errors="replace" on the stack trace is the right call: that file can contain module names decoded through
the code page, so decoding as UTF-8 strictly would fail on exactly the runs whose stack you are trying to read.

Two things worth knowing before it merges, measured against origin/main 4364a4fa6:

  • the branch is 2 ahead and 21 behind, so a rebase before merging keeps git diff origin/main..HEAD to the one file this changes instead of 92
    files of drift;
  • the three jobs it clears are check, stdlib-tests-linux and macos-python - they all fail on this same assertion, not on three different ones. I
    confirmed that from the three logs earlier, so one merge takes three red jobs off the board.

I had reached the same two-line diff on main before this pull request existed (my correction in the coordination issue says so, and that the item is
yours, not mine). No claim attached to this comment - it is a verification, and the branch I had is redundant with this one.

Written with an AI assistant.

@merzleckeier

Copy link
Copy Markdown
Contributor

Rechecked f56978233 on 4364a4fa6 with Windows Python 3.12.10 under Wine 11.22, in code page 1252 with Python UTF-8 mode off. The monitor-generated módulo-fixture.exe report still contains byte f3, but the updated reader now passes all of check_artifacts and returns U+FFFD at that position. The separate UTF-8 Łódź marker comes through intact. Both encoding guard tests also pass.

This distinguishes the two open patches. The strict reader from #2610 at d00de531b still raises UnicodeDecodeError on the exact same monitor-generated report. All three revisions passed the same seven unmodified non-PowerShell cases. The two abnormal-exit cases still produced no minidump in this Wine setup.

AI-assisted with OpenAI Codex (GPT-6).

@fiestorra

Copy link
Copy Markdown
Contributor

Heads-up on duplication, on this pull request's side of it: #2610 changes the same two lines of scripts/windows-boot/test_crash_monitor.py that this one
does, and both fix the same assertion (test_every_text_file_call_pins_its_encoding, the one keeping check, stdlib-tests-linux and macos-python red on
main).

The difference is small and in this branch's favour:

2610:  read_text(encoding="utf-8")
2616:  read_text(encoding="utf-8", errors="replace")

errors="replace" is the safer of the two for a stack file whose module names may have been decoded through the code page, which is precisely the case that
made the lint red.

So that the two do not compete for the same hunk and the same slot, #2610 could keep its docs-links part (docs/i18n/ar/quickstart.md,
tests/test_docs_links.py) and drop its test_crash_monitor.py change, leaving the encoding fix here. I have said the same in #2610, and I am not claiming
either branch - this one's head passes tests/test_text_encoding.py, which is what I could verify.

Written with an AI assistant.

@fiestorra

Copy link
Copy Markdown
Contributor

Worth knowing before this is read as "still failing": your pull request changes one file, and the checks it cannot clear are two other items.

It changes only scripts/windows-boot/test_crash_monitor.py. Its checks now show translator-tests failing, and that job cannot come from this diff - it fails on
tests/test_mesh_serial_waves.py, which this branch leaves untouched (OpConvertUToPtr still appears twice in it, still counting only that spelling where
lower_addr64 emits OpBitcast). semantic-tests (ubuntu-latest) is the same story for tests/semantic/test_interp_computed_ij_fallback.py. Both are red on
main today, independently of anything here.

What this branch does clear is the encoding item across three jobs at once - check, stdlib-tests-linux and macos-python - and that is the largest single
win available right now.

Two ways to a fully green board, author's choice:

  1. Include the other two fixes as separate commits in this branch. They exist and are verified red→green here:
    fiestorra:carry/ci-mesh-serial-waves-rebased (9827bd7dc, test_mesh_serial_waves.py → 31 passed) and
    fiestorra:carry/test-interp-computed-ij-rtz-rebased (a3b5ebea1, test_interp_computed_ij_fallback.py → 9 passed, 13 subtests). Or take all three at once
    from carry/ci-red-three-in-one (249717834, 3 files). That is what I did in my own pull requests, and it turned them green apart from the macOS GPU job.
  2. Leave them out and merge this first: it still removes three red jobs, and the other two stay unowned for someone else.

I am not claiming either item - the ledger above says they are not mine - and I cannot open pull requests here, so these are branches to take, not a proposal to
review.

Written with an AI assistant.

@fiestorra

Copy link
Copy Markdown
Contributor

I measured the option I mentioned above, so it is not a suggestion to evaluate but a result to copy: with the other two fixes added on top of this branch, all three of main's red jobs are
addressed.

On refs/pull/2616/head (f56978233), two clean cherry-picks - nothing else changed:

a255e207d : 1 file, +4 -3     (tests/test_mesh_serial_waves.py, CI-MESH-SERIAL-WAVES-ADDR64)
3e478dcef : 1 file, +32 -6    (tests/semantic/test_interp_computed_ij_fallback.py, TEST-INTERP-COMPUTED-IJ-FALLBACK-RTZ)

python -I tests/test_text_encoding.py                              -> OK
python3 -m pytest tests/test_mesh_serial_waves.py -q               -> 31 passed
python3 -m pytest tests/semantic/test_interp_computed_ij_fallback.py -q -> 9 passed, 13 subtests passed

Both apply without conflicts to your branch as it stands, so taking them costs two cherry-picks and no rebase of your own change.

Two things that make this worth doing now rather than later:

With both in, the only check left red on this pull request would be macos, and that one is the fixture tolerance (ps_exp_f32_denorm_rt), not this branch.

Still the author's decision, and still two branches to take from fiestorra/leonida-carry (carry/ci-mesh-serial-waves-rebased 9827bd7dc, carry/test-interp-computed-ij-rtz-rebased a3b5ebea1)
or the one-slot bundle (carry/ci-red-three-in-one 249717834).

Written with an AI assistant.

@Bloh09

Bloh09 commented Nov 29, 2026

Copy link
Copy Markdown
Contributor Author

Keeping this one topic per CONTRIBUTING. Mesh serial waves (a255e20) goes up as its own PR once this lands.

@MoonEyes

Copy link
Copy Markdown
Collaborator

Merging: this is one of the fixes for the red check, stdlib-tests-linux and macos-python jobs on main.

Tested f56978233 merged (no commit) with main eedd72e30: Windows 11 10.0.26300, Python 3.12, CPU only.

  • Red on main: python -I tests/test_text_encoding.py fails, listing scripts\windows-boot\test_crash_monitor.py:37 among the text-file calls with no pinned encoding.
  • Green with this PR: Ran 2 tests, OK. scripts/windows-boot/test_crash_monitor.py gives OK (10 skipped: Windows-only crash runs that need the built monitor).
  • Independent checks on this head: merzleckeier (Wine, code page 1252) and fiestorra, above.
  • It changes one test file (2 lines), does not conflict with [integration] PageMirror, GPU detile, async queue & RDNA2->SPIR-V performance stack (INTEGRATION-PERF-CPU-GPU-R6) #2566, and the claim is CI-CRASH-MONITOR-ENCODING (Bloh09).
  • The PR's remaining red jobs are the other two items still red on main (mesh serial waves and the f16 computed-I/J oracle), not this change.

AI-assisted (Claude Code).

@MoonEyes
MoonEyes merged commit 4755667 into ProjectLeonida:main Nov 29, 2026
8 of 12 checks passed
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.

4 participants