stage_timeline: set errors='replace' on stdout like the other tools (TOOL-STAGE-TIMELINE-STDOUT) #2111

Closed
Tauwni wants to merge 1 commit from upstream-pr/2111 into main
Tauwni commented 2026-11-25 21:07:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-25T21:07:36Z.


Claimed in the coordination issue as: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7173443163

What and why

tests/test_tool_stdout_encoding.py fails on main for three tools whose __main__ block doesn't set errors='replace' on stdout. Under python -I, a redirected stdout is the strict ANSI code page on Windows, so one character it can't encode ends the tool. #1673 handles tools/compute_heap_layout_census.py and #1837 tools/game_run_summary.py. This PR handles the third, tools/stage_timeline.py (from ba626820e), with the same guarded sys.stdout.reconfigure(errors="replace") the other tools use.

Tested

  • python -I tests/test_tool_stdout_encoding.py: tools/stage_timeline.py is no longer listed. Only the two files #1673 and #1837 fix remain, and the test passes with all three merged.
  • python -I tools/stage_timeline.py --help and a run on a log without peek lines behave as before.
  • The standard-library loop and the pytest files: the same results as main (no new failure).

GPUs tested: n/a

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • No game data, keys or decryption.
  • No translator rule.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5499194809 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2111). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-25T21:07:36Z. --- Claimed in the coordination issue as: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7173443163 ### What and why `tests/test_tool_stdout_encoding.py` fails on `main` for three tools whose `__main__` block doesn't set `errors='replace'` on stdout. Under `python -I`, a redirected stdout is the strict ANSI code page on Windows, so one character it can't encode ends the tool. #1673 handles `tools/compute_heap_layout_census.py` and #1837 `tools/game_run_summary.py`. This PR handles the third, `tools/stage_timeline.py` (from `ba626820e`), with the same guarded `sys.stdout.reconfigure(errors="replace")` the other tools use. ### Tested - `python -I tests/test_tool_stdout_encoding.py`: `tools/stage_timeline.py` is no longer listed. Only the two files #1673 and #1837 fix remain, and the test passes with all three merged. - `python -I tools/stage_timeline.py --help` and a run on a log without peek lines behave as before. - The standard-library loop and the pytest files: the same results as `main` (no new failure). GPUs tested: n/a AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic. - [x] No game data, keys or decryption. - [x] No translator rule. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Tauwni commented 2026-11-26 11:20:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-26T11:20:21Z.


Closing: main already has this change. 4b10cbe91 ("game_run_summary, stage_timeline: set errors="replace" on stdout") sets it in tools/stage_timeline.py, so this branch no longer differs from main. tests/test_tool_stdout_encoding.py passes on main a73a57e13.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7190597911 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2111#issuecomment-7190597911). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-26T11:20:21Z. --- Closing: `main` already has this change. `4b10cbe91` ("game_run_summary, stage_timeline: set errors=\"replace\" on stdout") sets it in `tools/stage_timeline.py`, so this branch no longer differs from `main`. `tests/test_tool_stdout_encoding.py` passes on `main` `a73a57e13`. AI-assisted (Claude Code).

Pull request closed

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!2111
No description provided.