test(tools): pin timeline CLI encoding #15340

Merged
DonRyuzaki merged 1 commit from upstream-pr/15340 into main 2026-11-12 01:52:25 +00:00
DonRyuzaki commented 2026-11-03 00:39:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DonRyuzaki on 2026-11-03T00:39:22Z.


What

Use an explicit UTF-8 subprocess transport in the timeline CLI tests. A child inheriting PYTHONIOENCODING=utf-8 emits UTF-8, while subprocess.run(text=True) decodes using the host code page. On CP1252 Windows, an output path containing é therefore becomes é and the existing directory-validation assertion fails.

Copy the child environment with PYTHONIOENCODING=utf-8 and decode both captured streams as UTF-8. Add a real CLI regression checking Unicode path diagnostics with inherited UTF-8 and CP1252 settings. The production tool and its CLI behavior are unchanged.

Related to the Python Unicode-TEMP failures reported in #13083; this does not close that issue's broader C++ temporary-stream report. Compared the actual patch of open #9258 at e62a0f26040d95b8fb35200348ef4e8bfc5c01e0: its JSON BOM support and two separate tests do not implement or change this subprocess helper.

Tested

Windows x86-64 / Python 3.12, host code page CP1252. Local commit 197cd5cfd218be3db4443ab3f29b90e10b014d99, tree 870ed64a499db6134cac679a36eb29c76529c405, based on live-verified upstream main 7feb37ee3e30e10139b483fb4df689d5b5b69ab8. Published head a9c2ae754c37a646ac6a45ce3779a6206ed13226 has exactly this validated tree.

  • Before the change, the existing test_output_directory_validation fails by assertion on pinned main with Unicode TEMP and a UTF-8 child stream: the captured path is mojibake.
  • Full tools.tests.test_pad_timeline suite under normal TEMP / inherited CP1252: 25 tests, 24 passed, one existing POSIX-permissions skip; no failures or errors.
  • The same full suite under Unicode TEMP containing é / inherited UTF-8: 25 tests, 24 passed, the same platform skip; no failures or errors. Both runs exercise the real subprocess and preserve existing alias/error/output checks.
  • Negative control: restoring only main's previous subprocess helper while retaining the new regression causes an assertion failure. The fixed file was restored byte-for-byte afterwards.
  • Official pr_overlap.py comparison used the shared public REST snapshot and verified all 1,726 exact open PR heads against the live upstream base. The one shared-file candidate merges cleanly; no overlap or unverified branch was reported.
  • Current-main conventions and whitespace checks passed.

Test-harness-only validation. No runtime build, title, GPU or hosted CI qualification is claimed.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5129771458 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15340). Originally posted by [DonRyuzaki](https://github.com/DonRyuzaki) on 2026-11-03T00:39:22Z. --- ### What Use an explicit UTF-8 subprocess transport in the timeline CLI tests. A child inheriting `PYTHONIOENCODING=utf-8` emits UTF-8, while `subprocess.run(text=True)` decodes using the host code page. On CP1252 Windows, an output path containing `é` therefore becomes `é` and the existing directory-validation assertion fails. Copy the child environment with `PYTHONIOENCODING=utf-8` and decode both captured streams as UTF-8. Add a real CLI regression checking Unicode path diagnostics with inherited UTF-8 and CP1252 settings. The production tool and its CLI behavior are unchanged. Related to the Python Unicode-TEMP failures reported in #13083; this does not close that issue's broader C++ temporary-stream report. Compared the actual patch of open #9258 at `e62a0f26040d95b8fb35200348ef4e8bfc5c01e0`: its JSON BOM support and two separate tests do not implement or change this subprocess helper. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows x86-64 / Python 3.12, host code page CP1252. Local commit `197cd5cfd218be3db4443ab3f29b90e10b014d99`, tree `870ed64a499db6134cac679a36eb29c76529c405`, based on live-verified upstream main `7feb37ee3e30e10139b483fb4df689d5b5b69ab8`. Published head `a9c2ae754c37a646ac6a45ce3779a6206ed13226` has exactly this validated tree. - Before the change, the existing `test_output_directory_validation` fails by assertion on pinned main with Unicode `TEMP` and a UTF-8 child stream: the captured path is mojibake. - Full `tools.tests.test_pad_timeline` suite under normal `TEMP` / inherited CP1252: 25 tests, 24 passed, one existing POSIX-permissions skip; no failures or errors. - The same full suite under Unicode `TEMP` containing `é` / inherited UTF-8: 25 tests, 24 passed, the same platform skip; no failures or errors. Both runs exercise the real subprocess and preserve existing alias/error/output checks. - Negative control: restoring only main's previous subprocess helper while retaining the new regression causes an assertion failure. The fixed file was restored byte-for-byte afterwards. - Official `pr_overlap.py` comparison used the shared public REST snapshot and verified all 1,726 exact open PR heads against the live upstream base. The one shared-file candidate merges cleanly; no overlap or unverified branch was reported. - Current-main conventions and whitespace checks passed. Test-harness-only validation. No runtime build, title, GPU or hosted CI qualification is claimed. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no -->
MarcZX10 commented 2026-11-03 00:47:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-03T00:47:11Z.

Review: COMMENTED


Reviewed — no blocking findings

The exact-head test change passes its focused suite on Linux; the CP1252-specific failure is not reproduced here because this host's preferred encoding is UTF-8.

What I ran

Reviewed the one-file diff at head a9c2ae754c37a646ac6a45ce3779a6206ed13226, based on 7feb37ee3e30e10139b483fb4df689d5b5b69ab8. The current-base merge preview was clean. Environment: Debian Linux x86_64, Python 3.11.2, locale encoding UTF-8. The exact-head no-build precheck ran the full 25-test timeline suite and Python test-registration check. I did not build or compile.

The author reports separate Windows x86-64 / Python 3.12 runs with CP1252, including a pre-change failure and a negative control; those results are not independent runs by me.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 15340 --output-dir /tmp/anyps5-pr-precheck/15340-session-20261103
python3 -c 'import locale; print(locale.getpreferredencoding(False))'
locale charmap
gh pr checks 15340 --repo boykopovar/AnyPS5

Results

Check Result Note
Diff and conventions passed Exact-head checks passed.
Timeline Python suite passed 25 tests passed on the PR head.
Python test registration passed The suite is registered.
Current-base merge preview passed Clean against the reviewed base.
Base negative control failed The same suite passed on base under this UTF-8 locale.
No-build precheck failed Its negative control did not discriminate here; its optional test-quality helper is absent from the isolated snapshot.
Hosted checks not run Four current jobs were pending at final refresh.
Build not applicable The change is limited to Python test code.
Precheck table and unedited output
Check Status Command / reason
build_and_compile not_applicable The precheck deliberately does not configure, build, or compile AnyPS5.
diff_check passed git diff --check 7feb37ee3e30e10139b483fb4df689d5b5b69ab8...a9c2ae754c37a646ac6a45ce3779a6206ed13226
conventions_and_pr_template passed /usr/bin/python3 tools/check_conventions.py --base 7feb37ee3e30e10139b483fb4df689d5b5b69ab8 --head a9c2ae754c37a646ac6a45ce3779a6206ed13226 --title test(tools): pin timeline CLI encoding --body /tmp/anyps5-pr-precheck/15340-session-20261103/pr-body.md
changed_export_abi_audit not_applicable No changed source or public header under core/libs/prx.
python_syntax not_applicable No changed Python implementation files.
unit:tools/tests/test_pad_timeline.py passed /usr/bin/python3 -m unittest tools.tests.test_pad_timeline
python_test_registration passed /usr/bin/python3 tools/check_test_registration.py --scripts
live_dependency_and_mergeability_check passed /usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 15340 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/15340-session-20261103/stack
build_dependent_cpp_tests not_applicable No C/C++ implementation or test files changed.
test_quality_heuristics failed /usr/bin/python3 /tmp/anyps5-pr-precheck/15340-session-20261103/head-a9c2ae754c37-ab1e31a3/tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/15340-session-20261103/head-a9c2ae754c37-ab1e31a3 --json tools/tests/test_pad_timeline.py
negative_controls failed A pass means every candidate failed by assertion on base; a failure means at least one did not discriminate or could not run. See per-test results.

Exact-head unit-test output:

.........................
----------------------------------------------------------------------
Ran 25 tests in 0.562s

OK

Base negative-control output:

.........................
----------------------------------------------------------------------
Ran 25 tests in 0.545s

OK

The precheck recorded:

tools/tests/test_pad_timeline.py: did_not_fail_on_base
/usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/15340-session-20261103/head-a9c2ae754c37-ab1e31a3/tools/pr_test_quality.py': [Errno 2] No such file or directory

Convention output:

All conventions checks passed.

Test-registration output:

251 test script(s), each run by an add_test or a workflow

Locale output:

UTF-8
UTF-8

Hosted-check output:

conventions	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/41554402612/job/125649643477
eligibility	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/41554407629/job/125649655934
intake	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/41554402630/job/125649641800
labels	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/41554402641/job/125649645505

Negative control

Assertion Change under test Did it fail?
Unicode output-directory diagnostic contains the exact path Ran the changed test file against the base test helper No; all 25 tests passed on this UTF-8 Linux host.

The base run does not exercise the reported CP1252 Windows mismatch. The author reports that the regression fails on Windows before this change; I did not reproduce that platform-specific result.

Findings

Blocking

None found in the reviewed test change.

Non-blocking

The negative control did not distinguish the change on this Linux UTF-8 host. The changed test explicitly normalizes the child encoding and captured decoding to UTF-8, and checks that the Unicode path survives in the diagnostic.

Sources

Not verified

I did not reproduce the Windows CP1252 failure or run the author's Windows test suite. Four hosted checks were pending at the final refresh.

To get this to a good state

No code change is requested from this review. I will recheck the exact head after the pending hosted checks complete; the Windows CP1252 result remains author-reported.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5745505187 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15340#pullrequestreview-5745505187). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-03T00:47:11Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The exact-head test change passes its focused suite on Linux; the CP1252-specific failure is not reproduced here because this host's preferred encoding is UTF-8. ## What I ran Reviewed the one-file diff at head `a9c2ae754c37a646ac6a45ce3779a6206ed13226`, based on `7feb37ee3e30e10139b483fb4df689d5b5b69ab8`. The current-base merge preview was clean. Environment: Debian Linux x86_64, Python 3.11.2, locale encoding UTF-8. The exact-head no-build precheck ran the full 25-test timeline suite and Python test-registration check. I did not build or compile. The author reports separate Windows x86-64 / Python 3.12 runs with CP1252, including a pre-change failure and a negative control; those results are not independent runs by me. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 15340 --output-dir /tmp/anyps5-pr-precheck/15340-session-20261103 python3 -c 'import locale; print(locale.getpreferredencoding(False))' locale charmap gh pr checks 15340 --repo boykopovar/AnyPS5 ``` ## Results | Check | Result | Note | |---|---|---| | Diff and conventions | passed | Exact-head checks passed. | | Timeline Python suite | passed | 25 tests passed on the PR head. | | Python test registration | passed | The suite is registered. | | Current-base merge preview | passed | Clean against the reviewed base. | | Base negative control | failed | The same suite passed on base under this UTF-8 locale. | | No-build precheck | failed | Its negative control did not discriminate here; its optional test-quality helper is absent from the isolated snapshot. | | Hosted checks | not run | Four current jobs were pending at final refresh. | | Build | not applicable | The change is limited to Python test code. | <details><summary>Precheck table and unedited output</summary> | Check | Status | Command / reason | |---|---|---| | build_and_compile | not_applicable | `The precheck deliberately does not configure, build, or compile AnyPS5.` | | diff_check | passed | `git diff --check 7feb37ee3e30e10139b483fb4df689d5b5b69ab8...a9c2ae754c37a646ac6a45ce3779a6206ed13226` | | conventions_and_pr_template | passed | `/usr/bin/python3 tools/check_conventions.py --base 7feb37ee3e30e10139b483fb4df689d5b5b69ab8 --head a9c2ae754c37a646ac6a45ce3779a6206ed13226 --title test(tools): pin timeline CLI encoding --body /tmp/anyps5-pr-precheck/15340-session-20261103/pr-body.md` | | changed_export_abi_audit | not_applicable | `No changed source or public header under core/libs/prx.` | | python_syntax | not_applicable | `No changed Python implementation files.` | | unit:tools/tests/test_pad_timeline.py | passed | `/usr/bin/python3 -m unittest tools.tests.test_pad_timeline` | | python_test_registration | passed | `/usr/bin/python3 tools/check_test_registration.py --scripts` | | live_dependency_and_mergeability_check | passed | `/usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 15340 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/15340-session-20261103/stack` | | build_dependent_cpp_tests | not_applicable | `No C/C++ implementation or test files changed.` | | test_quality_heuristics | failed | `/usr/bin/python3 /tmp/anyps5-pr-precheck/15340-session-20261103/head-a9c2ae754c37-ab1e31a3/tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/15340-session-20261103/head-a9c2ae754c37-ab1e31a3 --json tools/tests/test_pad_timeline.py` | | negative_controls | failed | `A pass means every candidate failed by assertion on base; a failure means at least one did not discriminate or could not run. See per-test results.` | Exact-head unit-test output: ```text ......................... ---------------------------------------------------------------------- Ran 25 tests in 0.562s OK ``` Base negative-control output: ```text ......................... ---------------------------------------------------------------------- Ran 25 tests in 0.545s OK ``` The precheck recorded: ```text tools/tests/test_pad_timeline.py: did_not_fail_on_base /usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/15340-session-20261103/head-a9c2ae754c37-ab1e31a3/tools/pr_test_quality.py': [Errno 2] No such file or directory ``` Convention output: ```text All conventions checks passed. ``` Test-registration output: ```text 251 test script(s), each run by an add_test or a workflow ``` Locale output: ```text UTF-8 UTF-8 ``` Hosted-check output: ```text conventions pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41554402612/job/125649643477 eligibility pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41554407629/job/125649655934 intake pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41554402630/job/125649641800 labels pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41554402641/job/125649645505 ``` </details> ## Negative control | Assertion | Change under test | Did it fail? | |---|---|---| | Unicode output-directory diagnostic contains the exact path | Ran the changed test file against the base test helper | No; all 25 tests passed on this UTF-8 Linux host. | The base run does not exercise the reported CP1252 Windows mismatch. The author reports that the regression fails on Windows before this change; I did not reproduce that platform-specific result. ## Findings ### Blocking None found in the reviewed test change. ### Non-blocking The negative control did not distinguish the change on this Linux UTF-8 host. The changed test explicitly normalizes the child encoding and captured decoding to UTF-8, and checks that the Unicode path survives in the diagnostic. ## Sources - [Base test helper uses locale-default text decoding](https://github.com/boykopovar/AnyPS5/blob/7feb37ee3e30e10139b483fb4df689d5b5b69ab8/tools/tests/test_pad_timeline.py#L149-L151) - [Exact-head test helper pins child and captured-stream encoding](https://github.com/boykopovar/AnyPS5/blob/a9c2ae754c37a646ac6a45ce3779a6206ed13226/tools/tests/test_pad_timeline.py#L149-L152) - [Unicode-path regression assertion at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/a9c2ae754c37a646ac6a45ce3779a6206ed13226/tools/tests/test_pad_timeline.py#L259-L269) ## Not verified I did not reproduce the Windows CP1252 failure or run the author's Windows test suite. Four hosted checks were pending at the final refresh. ## To get this to a good state No code change is requested from this review. I will recheck the exact head after the pending hosted checks complete; the Windows CP1252 result remains author-reported.
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
boykopovar/AnyPS5!15340
No description provided.