fix(tools): reconfigure streams with backslashreplace in progress_history #10218
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10218"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by emirplus on 2026-10-23T14:22:04Z.
What
Reconfigure
sys.stdoutandsys.stderrwithencoding="utf-8"anderrors="backslashreplace"at the entrypoint ofmain()intools/progress_history.py. This preventsUnicodeEncodeErrorwhen writing summaries or diagnostics on Windows consoles configured with legacy code pages.Tested
Unit test
test_main_reconfigures_streamsverifies both standard streams are reconfigured with the expected encoding and error handler. Reported by @THEMANnt on Windows, Python 3.11.9, including a negative control.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-23T16:46:06Z.
Review: CHANGES_REQUESTED
Review: PR #10218
Head:
6da812a2346a2277605388fdc3cd174d1ae00c0aEnvironment: Windows (win32), Python 3.11.9, Git 2.52.0.windows.1
Code Review
The implementation is correct. The stream reconfiguration loop in
main()properly guards withhasattrand applies UTF-8 encoding withbackslashreplaceerrors before any output. The new testtest_main_reconfigures_streamscorrectly verifies this behavior, and the negative control confirms it exercises the new code path.Blocking Issue
The conventions check fails because the PR body is missing required template sections:
Please update the PR description to include these sections before requesting re-review.
Test Results
Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-11-16T09:26:23Z.
Review: COMMENTED
Reviewed
6da812a234merged withmainatdcf3d15978. I found one merge blocker: the PR description still leavesAI-assistedblank. The What, Tested, and Checklist sections now pass. Please fill inAI-assistedwithyesornoso the conventions check can pass. Conventions logI found no code issues. On Windows with Python 3.11.9, 36 progress-history tests passed and 5 were skipped. With strict CP1252 stderr, the PR printed a Unicode diagnostic in UTF-8 and exited with the expected status. The same probe raised
UnicodeEncodeErroronmain, and the new regression test failed when I restored themainimplementation.Imported from boykopovar/AnyPS5. Originally posted by catminou4 on 2026-11-25T05:21:51Z.
Review: COMMENTED
Reviewed
6da812a234merged ontomain7df43031f4(clean merge), Ubuntu 22.04, Python 3.12.16.python3 tools/tests/test_progress_history.py: 49 tests OK (1 skipped).tools/progress_history.pyfrommain,test_main_reconfigures_streamsfails; restoring the PR source passes again.mainalready uses incheck_skips.pyandlibrary_oracle.py.Code is mergeable; the only remaining blocker is the
AI-assistedline of the PR body, which the conventions check still flags.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T05:35:54Z.
Review: APPROVED
Reviewed — looks good
The stream reconfiguration is guarded for streams without
reconfigure, and the test checks both streams receive UTF-8 withbackslashreplace.What I ran
Reviewed head
6da812a2346a2277605388fdc3cd174d1ae00c0a. No test command or merged-preview check was run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Runtime behavior on Windows consoles and the author-reported unit test were not independently verified. Both files listed as reviewed were read:
tools/progress_history.pyandtools/tests/test_progress_history.py. No files were excluded.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T11:21:15Z.
Review: COMMENTED
Ran the submitted progress-history suite on Linux. All 10 tests passed. The added case checks that the command configures its output streams with
backslashreplace.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.