fix(tools): preserve main sync reports on limited encodings #5818
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5818"
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 NumberGuan on 2026-10-14T12:17:33Z.
What
check_main_sync.pycrashes while printing a report if a changed path contains characters stdout cannot encode. With a clean merge involvingsp ace é 測 🚀.txt, ASCII or CP1252 output raisesUnicodeEncodeError, leaves stdout empty and returns 1 instead of the normal success status. Conflict reports also disappear.Set stdout's error handler to
backslashreplacebefore printing. Keep its selected encoding: CP1252 still printsé, unencodable characters appear as\x/\u/\Uescapes, and UTF-8 keeps the complete filename. Python's TextIOWrapper.reconfigure documentation specifies that omitted settings stay unchanged. Git inspection and merge/strict exit rules remain the same.Add two regressions using real temporary Git repositories, Unicode filenames and merge commits. Nine CLI scenarios cover ASCII, CP1252 and UTF-8, clean merges in normal and strict mode, and conflicts. Each checks the expected exit status, file listing and merged PR reference, with no traceback. No other open PR covers this utility; no dependency.
Tested
Windows x64, Python 3.12.14 and Git; CMake 4.3.1/Ninja relinker-only configuration for test registration. Based on upstream
e736e5bdb; contributionb5007fb7c.Before the fix, the new CLI regressions fail with
UnicodeEncodeErroron both ASCII and CP1252. After the two-line fix, all nine unit tests pass. The four registered CTest groups passed in 12.94 seconds;check_main_synctook 12.39 seconds. After rebasing onmainatc8e3039, all nine unit tests passed in 11.94 seconds and the four CTest groups passed in 11.97 seconds. After rebasing onmainat96dd647, the four CTest groups passed again in 10.68 seconds, includingcheck_main_sync. Registration, conventions (including this title and body) and whitespace checks pass.git range-diffconfirms the patch is unchanged after rebasing over upstream changes.Hosted relinker CI passed on Windows, Linux and macOS for
090b8e0a1, including the registered Python regression. Hosted conventions and intake also passed. The full system-library builds and unrelated register-context/write-watch jobs were skipped by the workflow.C++ targets and system libraries were not built locally for this Python-only change. No game or PS5 hardware test; the console cases use redirected stdout with explicit encodings.
Revalidated on current main
Rebased onto
63fb0cd92. The registeredcheck_main_syncCTest passed in 11.05 s. Test registration, conventions and whitespace checks passed. Hosted relinker CI passed on Windows, Linux and macOS; hosted conventions also passed. This is a Python-only change; no title or PS5 hardware test was run.Checklist
main; no other open PR implements the same functionsImported from boykopovar/AnyPS5. Originally posted by ideabsassistenza on 2026-10-14T12:45:13Z.
Independent Windows validation of head
b5007fb7cb693ffc66846d0ae833430843098c14, CPython 3.12.14 on Windows 11 Pro, i7-8700.test_check_main_sync.pytests pass, no skips. The two new methods exercise nine CLI scenarios: ASCII, CP1252 and UTF-8; clean normal/strict reports and conflict reports.e736e5bdb18e72ed717014c02c62c616701a7cf8gives six failed subcases and no test errors. ASCII/CP1252 lose the report; the three UTF-8 controls pass. With this head, report contents and exit statuses pass, including the merged PR reference and CP1252's preserved accented character.Only the exact tool and test files were extracted from Git into an isolated local directory. The contribution checkout and its branch remained unchanged. No CMake/CTest registration, native build/runtime, game, GPU or composition with current main was tested;
windows_fixed_baseremained excluded.AI-assisted: yes (Codex); source diff, baseline failures and both passing Windows logs reviewed in this session.
Imported from boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-14T16:36:13Z.
With
PYTHONIOENCODING=utf-8set, the existingtest_paths_with_spaces_and_unicode_are_reported_verbatimstill fails with this change: the tool writes UTF-8, whilerun_tooldecodes with the locale code page (text=True), soéarrives asé. The shell Claude Code starts on Windows hasPYTHONIOENCODING=utf-8:surrogateescapeset; thecheck_main_synccode-page failure mentioned in #5804 may be the same.Windows 11 26200, Python 3.13.3, code page 1252, this head
969a8bfa7merged intomaine34c47921,python tools/tests/test_check_main_sync.py:PYTHONIOENCODINGutf-8test_paths_with_spaces_and_unicode_are_reported_verbatimutf-8:surrogateescapePinning the encoding in
run_tool, as your new tests do, fixes it:With that, the 9 tests pass with
PYTHONIOENCODINGunset,utf-8,utf-8:surrogateescapeandcp1252. Not tested: Linux and macOS.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-15T13:25:16Z.
Independent Windows recheck of the encoding follow-up at
d4cce869eb12c4dc52537bf2a6cbb0b76e4f57f8(AI-assisted). Thanks for carrying the suggestedrun_toolencoding fix.PYTHONIOENCODING=utf-8: 9/9 pass, no skips, 33.497 s.test_paths_with_spaces_and_unicode_are_reported_verbatimalso passes separately with parentPYTHONIOENCODING=utf-8:surrogateescape,cp1252, and unset (3.770 / 3.642 / 3.574 s). These are focused runs, not three more full-suite runs.969a8bfa7681f82700d55d4e1fed2e3f9ca5d01e, paired with the same current production tool and parentPYTHONIOENCODING=utf-8, fails that Unicode assertion (one failure, no errors; 3.403 s). This isolates the harness fix from a production-tool change.The test now pins both ends to UTF-8, so the inherited parent encoding no longer corrupts the captured path in this case. The full suite still took over 30 s on this host; that is a direct Python run, not a CTest timeout or hosted CI failure. No current-main merge/composition, full repository/CTest/native build, Linux/macOS, game or GPU execution tested. No source edit, new patch or separate PR from me.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T13:32:26Z.
Checked on the PR merged onto main: build and ctest green (47 tests, including
check_main_sync); without thecheck_main_sync.pychange the new tests fail, with it they pass. Third-party Windows runs confirm 9/9. Relinker CI is green on all three OSes; merging.