tools/game_run_summary: guard stdout encoding, BOM ints, OSError and RecursionError (reprend #1837) #2746

Merged
OreoFR merged 4 commits from upstream-pr/2746 into main 2026-11-30 16:03:00 +00:00
OreoFR commented 2026-11-30 14:38:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-30T14:38:32Z.


Takes over #1837 (kirigayakazima), whose author has not answered since the request on 2026-11-29 to merge the current main. The original commit e76cabc17 is kept as is, with its author.

What

  • #1837's change to tools/game_run_summary.py: guard the stdout encoding, ints with a BOM, OSError and RecursionError (unchanged).
  • main merged in. After #2028, a run that reached its time limit says so with the seconds at the limit, so the test that expected 45 seconds now writes and expects 60 (tests/test_game_run_summary.py). That is the only new change.

Tests

  • macOS 27.2.1, Apple M5, Python 3.12.16, main b17b22d33 merged: tests/test_game_run_summary.py 12 passed, 15 subtests passed.
  • python -I scripts/check_no_game_data.py on both changed files: clean.
  • Earlier red/green on #1837 itself: see the verification comment there (red 5 failures on main before the fix).

Co-authored with kirigayakazima (original commit kept).

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5567406540 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2746). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-30T14:38:32Z. --- Takes over #1837 (kirigayakazima), whose author has not answered since the request on 2026-11-29 to merge the current `main`. The original commit `e76cabc17` is kept as is, with its author. ## What - #1837's change to `tools/game_run_summary.py`: guard the stdout encoding, ints with a BOM, `OSError` and `RecursionError` (unchanged). - `main` merged in. After #2028, a run that reached its time limit says so with the seconds at the limit, so the test that expected 45 seconds now writes and expects 60 (`tests/test_game_run_summary.py`). That is the only new change. ## Tests - macOS 27.2.1, Apple M5, Python 3.12.16, `main` `b17b22d33` merged: `tests/test_game_run_summary.py` 12 passed, 15 subtests passed. - `python -I scripts/check_no_game_data.py` on both changed files: clean. - Earlier red/green on #1837 itself: see the verification comment there (red 5 failures on `main` before the fix). Co-authored with kirigayakazima (original commit kept). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
merzleckeier commented 2026-11-30 14:48:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T14:48:29Z.


Independent Linux red/green and CLI timing-boundary check

CachyOS x86-64, Python 3.14.10. I merged a70a976cd onto main b17b22d33 (tree ee6a7553d) and ran the carry's tests/test_game_run_summary.py against both versions of the tool.

  • MEASURED, unit suite. The PR passed all 12 tests. On main, there were three assertion failures (BOM metadata and two invalid-limit subtests) and two errors (the mocked failed reopen and nested JSON cases).
  • MEASURED, actual python -I CLI. I exercised exit codes 124 and 137 at elapsed times 59, 60 and 61 seconds with a 60-second limit. Each metadata file independently used plain UTF-8 or UTF-8 with BOM. main passed 6/24 cases, all with plain UTF-8. The PR passed 24/24. With a BOM in seconds alone and an exit at 59 s, main reported a timeout for both codes. The PR retained the recorded guest exit at 59 s and reported a timeout at and above 60 s.
  • MEASURED, controls. Both negative or zero limits now return usage status 2 (previously status 0). Redirected text with a synthetic Unicode method name worked on both revisions under strict ASCII and UTF-8. The pre-existing stdout guard therefore also works on this main.

A second agent recomputed the CLI results from independent synthetic inputs. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7281961203 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2746#issuecomment-7281961203). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-30T14:48:29Z. --- **Independent Linux red/green and CLI timing-boundary check** CachyOS x86-64, Python 3.14.10. I merged `a70a976cd` onto `main` `b17b22d33` (tree `ee6a7553d`) and ran the carry's `tests/test_game_run_summary.py` against both versions of the tool. - **MEASURED, unit suite.** The PR passed all 12 tests. On `main`, there were three assertion failures (BOM metadata and two invalid-limit subtests) and two errors (the mocked failed reopen and nested JSON cases). - **MEASURED, actual `python -I` CLI.** I exercised exit codes 124 and 137 at elapsed times 59, 60 and 61 seconds with a 60-second limit. Each metadata file independently used plain UTF-8 or UTF-8 with BOM. `main` passed 6/24 cases, all with plain UTF-8. The PR passed 24/24. With a BOM in `seconds` alone and an exit at 59 s, `main` reported a timeout for both codes. The PR retained the recorded guest exit at 59 s and reported a timeout at and above 60 s. - **MEASURED, controls.** Both negative or zero limits now return usage status 2 (previously status 0). Redirected text with a synthetic Unicode method name worked on both revisions under strict ASCII and UTF-8. The pre-existing stdout guard therefore also works on this `main`. A second agent recomputed the CLI results from independent synthetic inputs. AI-assisted with OpenAI Codex.
KelboLive commented 2026-11-30 15:03:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-11-30T15:03:26Z.


Independent check on Windows (not the author), at a70a976cd.

  • python -I tests/test_game_run_summary.py: 12 tests passed in 0.08 s.

The change is tool-only; the new guard cases (stdout encoding, BOM integers, OSError, RecursionError) run under the standard library on Python 3.12.10. No game files needed.

Environment: Windows 11 Pro 10.0.26200.9711, Python 3.12.10.

AI-assisted: yes (opencode).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7282358872 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2746#issuecomment-7282358872). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-30T15:03:26Z. --- Independent check on Windows (not the author), at `a70a976cd`. - `python -I tests/test_game_run_summary.py`: **12 tests passed** in 0.08 s. The change is tool-only; the new guard cases (stdout encoding, BOM integers, OSError, RecursionError) run under the standard library on Python 3.12.10. No game files needed. Environment: Windows 11 Pro 10.0.26200.9711, Python 3.12.10. AI-assisted: yes (opencode).
MoonEyes commented 2026-11-30 15:43:54 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-30T15:43:54Z.


Verified by MoonEyes (another owner than OreoFR) on head a70a976cd merged with main b17b22d33: Windows 11, Python 3.14.

  • Green: tests/test_game_run_summary.py 12 OK; test_tool_stdout_encoding, test_text_write_line_endings and test_ci_registration OK.
  • Red, tools/game_run_summary.py of main with this test file: 3 failures and 2 errors. The non-ASCII stdout test passes on main already.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7283485130 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2746#issuecomment-7283485130). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-30T15:43:54Z. --- Verified by MoonEyes (another owner than OreoFR) on head `a70a976cd` merged with `main` `b17b22d33`: Windows 11, Python 3.14. - Green: `tests/test_game_run_summary.py` 12 OK; `test_tool_stdout_encoding`, `test_text_write_line_endings` and `test_ci_registration` OK. - Red, `tools/game_run_summary.py` of `main` with this test file: 3 failures and 2 errors. The non-ASCII stdout test passes on `main` already. AI-assisted (Claude Code).
MoonEyes commented 2026-11-30 16:02:56 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-30T16:02:56Z.


Merging. Head a70a976cd merges cleanly with main e324ad55e and does not force a rebase of #2566. Red/green on Windows 11 and Linux by two other people. Merged by MoonEyes.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7284030438 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2746#issuecomment-7284030438). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-30T16:02:56Z. --- Merging. Head `a70a976cd` merges cleanly with `main` `e324ad55e` and does not force a rebase of #2566. Red/green on Windows 11 and Linux by two other people. Merged by MoonEyes. AI-assisted (Claude Code).
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!2746
No description provided.