corpus_watch: set errors='replace' on stdout like the other tools (TOOL-CORPUS-WATCH-STDOUT) #2118

Closed
kevincommits wants to merge 1 commit from upstream-pr/2118 into main
kevincommits commented 2026-11-25 21:26:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kevincommits on 2026-11-25T21:26:26Z.


Claimed in the coordination issue as: TOOL-CORPUS-WATCH-STDOUT (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7175070245)

What and why

scripts/corpus_watch.py (added in 5ba7f354) runs sys.exit(main()) without the errors="replace" stdout guard the other programs carry, so tests/test_tool_stdout_encoding.py lists it. This adds the same four-line guard tools/feature_scan.py uses to its __main__ block. Nothing else changes.

The same test also lists tools/compute_heap_layout_census.py, tools/game_run_summary.py and tools/stage_timeline.py on main. Those are covered by #1561, #1673, #1789, #1837, #1866 and #2111, so this pull request leaves them alone and the test stays red until one of those merges.

Tested

On macOS (Apple M5 Pro), Python 3.14.2, at 7b523287:

  • python -I tests/test_tool_stdout_encoding.py: the missing list goes from four entries to three; scripts/corpus_watch.py is no longer in it.
  • python -I tests/test_corpus_watch.py: OK.
  • python -I scripts/corpus_watch.py --help: prints usage.
  • Every standalone tests/test_*.py under python -I: 509 run, 505 pass. The 4 that fail are the same 4 that fail on main without this change (test_mod_pack_output_alias on macOS, test_runner_calls_all_tests, test_runtime_paths, test_tool_stdout_encoding), each with an open pull request.

Not tested on Windows, where the guard matters.

GPUs tested: n/a

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)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5499448811 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2118). Originally posted by [kevincommits](https://github.com/kevincommits) on 2026-11-25T21:26:26Z. --- Claimed in the coordination issue as: TOOL-CORPUS-WATCH-STDOUT (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7175070245) ### What and why `scripts/corpus_watch.py` (added in `5ba7f354`) runs `sys.exit(main())` without the `errors="replace"` stdout guard the other programs carry, so `tests/test_tool_stdout_encoding.py` lists it. This adds the same four-line guard `tools/feature_scan.py` uses to its `__main__` block. Nothing else changes. The same test also lists `tools/compute_heap_layout_census.py`, `tools/game_run_summary.py` and `tools/stage_timeline.py` on `main`. Those are covered by #1561, #1673, #1789, #1837, #1866 and #2111, so this pull request leaves them alone and the test stays red until one of those merges. ### Tested On macOS (Apple M5 Pro), Python 3.14.2, at `7b523287`: - `python -I tests/test_tool_stdout_encoding.py`: the missing list goes from four entries to three; `scripts/corpus_watch.py` is no longer in it. - `python -I tests/test_corpus_watch.py`: OK. - `python -I scripts/corpus_watch.py --help`: prints usage. - Every standalone `tests/test_*.py` under `python -I`: 509 run, 505 pass. The 4 that fail are the same 4 that fail on `main` without this change (`test_mod_pack_output_alias` on macOS, `test_runner_calls_all_tests`, `test_runtime_paths`, `test_tool_stdout_encoding`), each with an open pull request. Not tested on Windows, where the guard matters. GPUs tested: n/a AI-assisted: yes ### 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: no translator change)
kevincommits commented 2026-11-26 01:02:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kevincommits on 2026-11-26T01:02:46Z.


Closing as superseded: d9bb37465 in #1561 ("guard the scripts that landed since") added the same guard to scripts/corpus_watch.py, and that merged as f1afede5e. The file on main is now identical to this branch, and python -I tests/test_tool_stdout_encoding.py passes on main here. Nothing left for this pull request to change. Thanks for the review, @JordanWebDev.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7179374355 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2118#issuecomment-7179374355). Originally posted by [kevincommits](https://github.com/kevincommits) on 2026-11-26T01:02:46Z. --- Closing as superseded: `d9bb37465` in #1561 ("guard the scripts that landed since") added the same guard to `scripts/corpus_watch.py`, and that merged as `f1afede5e`. The file on `main` is now identical to this branch, and `python -I tests/test_tool_stdout_encoding.py` passes on `main` here. Nothing left for this pull request to change. Thanks for the review, @JordanWebDev.

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