fix(diagnostics): open VideoOut telemetry and sampler files under any Unicode path on Windows #12996

Merged
JJenkx merged 2 commits from upstream-pr/12996 into main 2026-10-30 09:55:46 +00:00
JJenkx commented 2026-10-29 19:42:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-29T19:42:09Z.


What

Four diagnostic paths were read with getenv and opened with the narrow fopen/ofstream: APS5_VIDEOOUT_TELEMETRY_DIR in VideoOut, and APS5_SAMPLE_THREADS, APS5_SAMPLE_WORKER and APS5_SAMPLE_COMMITTER in the AGC worker sampler. On Windows both sides use the ANSI code page, so these worked only for characters in it. A directory such as C:\x\東京テスト on a code-page-1252 system could not be opened. Their tests also fail whenever %TEMP% is not ASCII, because they pass a UTF-8 std::filesystem::path::string() into those APIs (follow-up to #12993, which fixes the pure test bugs).

The other diagnostic directories already read the wide environment and use std::filesystem::path: ANYPS5_SCREENSHOTS, APS5_DUMP_SUBMITS, APS5_DUMP_COMPUTE_PIPELINES, APS5_PAD_INPUT_FILE and APS5_TRACE_CALLS_FILE. This makes these four match:

  • VideoOut telemetry: Instance() takes the directory from _wgetenv(L"APS5_VIDEOOUT_TELEMETRY_DIR") as UTF-8 (getenv elsewhere). Writer opens videoout.jsonl through std::filesystem::path(u8 directory). Its std::string directory is UTF-8 on every host, so the existing test, which passes directory.string(), now works unchanged.
  • Worker sampler (Windows-only code): each variable is read with _wgetenv(L"…") and kept as a UTF-8 std::string, and the three output files, including the collapsed-stacks temporary, are opened with _wfopen through std::filesystem::path, and the temporary is published with MoveFileExW (was MoveFileExA, found in review). Its test now sets the variables with _wputenv_s and reads the files through std::filesystem::path, instead of narrow strings that the C runtime would read as ANSI. In the worker modes it also checks the published .collapsed.txt header and that its .tmp is gone.

Nothing changes for an ASCII path.

Tested

Windows 11 Enterprise 10.0.22621 (code page 1252), WinLibs GCC 15.2.0 UCRT r7, Ninja, Release, BUILD_TESTING=ON, no Vulkan driver visible, this head (ec7d2f5b85) on main 58b2753d74.

TEMP main 184afa49ad this PR
C:\x\tëmpünï 4 of 4 fail 4 of 4 pass, 3 of 3 runs each
C:\x\東京テスト (outside code page 1252) 4 of 4 fail 4 of 4 pass, 3 of 3 runs each
normal profile TEMP pass 4 of 4 pass, 3 of 3 runs each

The four tests are video_out_telemetry, agc_worker_sampler_default, agc_worker_sampler_selected and agc_worker_sampler_process (ctest --repeat until-fail:3). The full build succeeded at the first head (74ec7311f1); the review fix touches only WorkerSampler.cpp and its test, whose targets build at this head. With the previous MoveFileExA and the new test, agc_worker_sampler_default and _selected fail under both non-ASCII TEMP values, so the test covers the publication step.

  • python tools/check_conventions.py --base origin/main: all checks passed. Each variable is still read by a literal _wgetenv(L"…") call, so the docs/dev/ENVIRONMENT.md reference check keeps finding them.
  • Not run here: Linux and macOS. The sampler change is inside its _WIN32 block. Telemetry there now opens through std::filesystem::path of the same bytes and still reads getenv.

Independent Windows validation, reported by bunbeans2-arch for topic ec7d2f5b85ffa83dc05d71051ba824177c1d7531 against main f7f03daf52: Windows 11 Pro 22631, i9-9900K, MSYS2 UCRT64 GCC 16.1, Release. Four telemetry/sampler tests pass 3/3 for each of the é and outside-code-page Ж temporary paths, while main fails 3/3; normal-profile controls pass. The separately reported host std::tmpfile() failures concern #13083/#13104. This is the contributor's run, not a new local Windows execution.

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 (agreed merge order: #12996 first, then #7622 retains its Libc::StartHostJThread wrapper and this PR’s [path = *path] capture; author confirmation)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5074470543 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12996). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-29T19:42:09Z. --- ### What Four diagnostic paths were read with `getenv` and opened with the narrow `fopen`/`ofstream`: `APS5_VIDEOOUT_TELEMETRY_DIR` in VideoOut, and `APS5_SAMPLE_THREADS`, `APS5_SAMPLE_WORKER` and `APS5_SAMPLE_COMMITTER` in the AGC worker sampler. On Windows both sides use the ANSI code page, so these worked only for characters in it. A directory such as `C:\x\東京テスト` on a code-page-1252 system could not be opened. Their tests also fail whenever `%TEMP%` is not ASCII, because they pass a UTF-8 `std::filesystem::path::string()` into those APIs (follow-up to #12993, which fixes the pure test bugs). The other diagnostic directories already read the wide environment and use `std::filesystem::path`: `ANYPS5_SCREENSHOTS`, `APS5_DUMP_SUBMITS`, `APS5_DUMP_COMPUTE_PIPELINES`, `APS5_PAD_INPUT_FILE` and `APS5_TRACE_CALLS_FILE`. This makes these four match: - VideoOut telemetry: `Instance()` takes the directory from `_wgetenv(L"APS5_VIDEOOUT_TELEMETRY_DIR")` as UTF-8 (`getenv` elsewhere). `Writer` opens `videoout.jsonl` through `std::filesystem::path(u8 directory)`. Its `std::string` directory is UTF-8 on every host, so the existing test, which passes `directory.string()`, now works unchanged. - Worker sampler (Windows-only code): each variable is read with `_wgetenv(L"…")` and kept as a UTF-8 `std::string`, and the three output files, including the collapsed-stacks temporary, are opened with `_wfopen` through `std::filesystem::path`, and the temporary is published with `MoveFileExW` (was `MoveFileExA`, found in review). Its test now sets the variables with `_wputenv_s` and reads the files through `std::filesystem::path`, instead of narrow strings that the C runtime would read as ANSI. In the worker modes it also checks the published `.collapsed.txt` header and that its `.tmp` is gone. Nothing changes for an ASCII path. ### Tested Windows 11 Enterprise 10.0.22621 (code page 1252), WinLibs GCC 15.2.0 UCRT r7, Ninja, Release, `BUILD_TESTING=ON`, no Vulkan driver visible, this head (`ec7d2f5b85`) on `main` `58b2753d74`. | `TEMP` | `main` `184afa49ad` | this PR | |---|---|---| | `C:\x\tëmpünï` | 4 of 4 fail | 4 of 4 pass, 3 of 3 runs each | | `C:\x\東京テスト` (outside code page 1252) | 4 of 4 fail | 4 of 4 pass, 3 of 3 runs each | | normal profile `TEMP` | pass | 4 of 4 pass, 3 of 3 runs each | The four tests are `video_out_telemetry`, `agc_worker_sampler_default`, `agc_worker_sampler_selected` and `agc_worker_sampler_process` (`ctest --repeat until-fail:3`). The full build succeeded at the first head (`74ec7311f1`); the review fix touches only `WorkerSampler.cpp` and its test, whose targets build at this head. With the previous `MoveFileExA` and the new test, `agc_worker_sampler_default` and `_selected` fail under both non-ASCII `TEMP` values, so the test covers the publication step. - `python tools/check_conventions.py --base origin/main`: all checks passed. Each variable is still read by a literal `_wgetenv(L"…")` call, so the `docs/dev/ENVIRONMENT.md` reference check keeps finding them. - Not run here: Linux and macOS. The sampler change is inside its `_WIN32` block. Telemetry there now opens through `std::filesystem::path` of the same bytes and still reads `getenv`. Independent Windows validation, reported by [bunbeans2-arch](https://github.com/boykopovar/AnyPS5/pull/12996#issuecomment-6517264214) for topic `ec7d2f5b85ffa83dc05d71051ba824177c1d7531` against main `f7f03daf52`: Windows 11 Pro 22631, i9-9900K, MSYS2 UCRT64 GCC 16.1, Release. Four telemetry/sampler tests pass 3/3 for each of the `é` and outside-code-page `Ж` temporary paths, while main fails 3/3; normal-profile controls pass. The separately reported host `std::tmpfile()` failures concern #13083/#13104. This is the contributor's run, not a new local Windows execution. ### Checklist - [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 (agreed merge order: #12996 first, then #7622 retains its `Libc::StartHostJThread` wrapper and this PR’s `[path = *path]` capture; [author confirmation](https://github.com/boykopovar/AnyPS5/pull/12996#issuecomment-6514620762)) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes (Claude Code)
MarcZX10 commented 2026-10-29 21:58:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T21:58:11Z.

Review: CHANGES_REQUESTED


Re-checked — new head, changes requested

The Unicode-path fix and current-main merge check look sound, but this branch conflicts with open #7622 and its checklist still says Depends on: none.

What I ran

  • PR head: ec7d2f5b85ffa83dc05d71051ba824177c1d7531.
  • Base: upstream/main at d820fef1827f27247cd28da7b4eec7891904bae5; current-main merge preview was clean (b79f05d677514ef6af50495a011eaa8e6eb8334a). No touched paths changed on main after the reported comparison base 58b2753d74.
  • Environment: Linux x86_64; no local build or platform tests run.
git diff --check upstream/main...refs/review/pr-12996-head
git merge-tree --write-tree upstream/main refs/review/pr-12996-head
python tools/check_conventions.py --base upstream/main --head refs/review/pr-12996-head
git merge-tree --write-tree refs/review/pr-12996-head refs/review/pr-7622-head
git diff --name-only 58b2753d74...upstream/main -- core/libs/prx/libSceAgcDriver/Execution/src/WorkerSampler.cpp core/libs/prx/libSceAgcDriver/tests/WorkerSampler.cpp core/libs/prx/libSceVideoOut/src/Telemetry.cpp

Results

Check Result
Patch whitespace Pass; command exited 0 with no output.
Current-main merge preview Pass; clean tree b79f05d677514ef6af50495a011eaa8e6eb8334a.
Repository conventions Pass.
Pairwise integration with #7622 Conflict in core/libs/prx/libSceAgcDriver/Execution/src/WorkerSampler.cpp; both PRs remain open.
Hosted CI Windows product, eligibility, conventions, labels, and report checks passed; Linux and specialized jobs were skipped.
Platform tests The PR reports Windows non-ASCII TEMP tests passing 4/4 in three runs, including the collapsed-file publication check. It also reports the Linux telemetry test passing. These results are author-reported, not independently reproduced here.
Unedited local command output

python tools/check_conventions.py --base upstream/main --head refs/review/pr-12996-head

All conventions checks passed.

git merge-tree --write-tree upstream/main refs/review/pr-12996-head

b79f05d677514ef6af50495a011eaa8e6eb8334a

git diff --check upstream/main...refs/review/pr-12996-head exited 0 with no output. The comparison of changed paths since 58b2753d74 also produced no output.

The pairwise merge preview exited 1 and reported:

CONFLICT (content): Merge conflict in core/libs/prx/libSceAgcDriver/Execution/src/WorkerSampler.cpp

Findings

Blocking

  • Undeclared overlap with #7622: The pairwise merge preview conflicts in WorkerSampler.cpp, while this PR says Depends on: none. The current repository rule requires authors to agree which overlapping PR goes first and record that order with Depends on (pinned contribution rule). Please coordinate the order with #7622's author and update the dependency line; then I can recheck the combined merge.

Non-blocking

  • No additional blocker found in the source-level review. The reported Windows and Linux test runs were not independently reproduced here.

Not verified

  • I did not build or run platform tests locally. Linux and specialized hosted jobs were skipped.

To get this to a good state

Please record the agreed order for the overlapping PRs in Depends on. I will rerun the merge checks and review the updated head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5705519410 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12996#pullrequestreview-5705519410). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T21:58:11Z. **Review:** CHANGES_REQUESTED --- # Re-checked — new head, changes requested The Unicode-path fix and current-main merge check look sound, but this branch conflicts with open #7622 and its checklist still says `Depends on: none`. ## What I ran - PR head: `ec7d2f5b85ffa83dc05d71051ba824177c1d7531`. - Base: `upstream/main` at `d820fef1827f27247cd28da7b4eec7891904bae5`; current-main merge preview was clean (`b79f05d677514ef6af50495a011eaa8e6eb8334a`). No touched paths changed on `main` after the reported comparison base `58b2753d74`. - Environment: Linux x86_64; no local build or platform tests run. ```sh git diff --check upstream/main...refs/review/pr-12996-head git merge-tree --write-tree upstream/main refs/review/pr-12996-head python tools/check_conventions.py --base upstream/main --head refs/review/pr-12996-head git merge-tree --write-tree refs/review/pr-12996-head refs/review/pr-7622-head git diff --name-only 58b2753d74...upstream/main -- core/libs/prx/libSceAgcDriver/Execution/src/WorkerSampler.cpp core/libs/prx/libSceAgcDriver/tests/WorkerSampler.cpp core/libs/prx/libSceVideoOut/src/Telemetry.cpp ``` ## Results | Check | Result | |---|---| | Patch whitespace | Pass; command exited 0 with no output. | | Current-main merge preview | Pass; clean tree `b79f05d677514ef6af50495a011eaa8e6eb8334a`. | | Repository conventions | Pass. | | Pairwise integration with #7622 | Conflict in `core/libs/prx/libSceAgcDriver/Execution/src/WorkerSampler.cpp`; both PRs remain open. | | Hosted CI | Windows product, eligibility, conventions, labels, and report checks passed; Linux and specialized jobs were skipped. | | Platform tests | The PR reports Windows non-ASCII `TEMP` tests passing 4/4 in three runs, including the collapsed-file publication check. It also reports the Linux telemetry test passing. These results are author-reported, not independently reproduced here. | <details> <summary>Unedited local command output</summary> `python tools/check_conventions.py --base upstream/main --head refs/review/pr-12996-head` ```text All conventions checks passed. ``` `git merge-tree --write-tree upstream/main refs/review/pr-12996-head` ```text b79f05d677514ef6af50495a011eaa8e6eb8334a ``` `git diff --check upstream/main...refs/review/pr-12996-head` exited 0 with no output. The comparison of changed paths since `58b2753d74` also produced no output. The pairwise merge preview exited 1 and reported: ```text CONFLICT (content): Merge conflict in core/libs/prx/libSceAgcDriver/Execution/src/WorkerSampler.cpp ``` </details> ## Findings ### Blocking - **Undeclared overlap with #7622:** The pairwise merge preview conflicts in `WorkerSampler.cpp`, while this PR says `Depends on: none`. The current repository rule requires authors to agree which overlapping PR goes first and record that order with `Depends on` ([pinned contribution rule](https://github.com/boykopovar/AnyPS5/blob/d820fef1827f27247cd28da7b4eec7891904bae5/CONTRIBUTING.md#L69)). Please coordinate the order with #7622's author and update the dependency line; then I can recheck the combined merge. ### Non-blocking - No additional blocker found in the source-level review. The reported Windows and Linux test runs were not independently reproduced here. ## Not verified - I did not build or run platform tests locally. Linux and specialized hosted jobs were skipped. ## To get this to a good state Please record the agreed order for the overlapping PRs in `Depends on`. I will rerun the merge checks and review the updated head.
MarcZX10 commented 2026-10-30 03:59:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-30T03:59:57Z.

Review: APPROVED


Re-checked — new head, looks good

The Windows path publication fix and regression are present, the proposed overlap order is now agreed, and the current-main preview and non-build checks pass.

What I ran

  • Exact PR head: ec7d2f5b85ffa83dc05d71051ba824177c1d7531; PR base: 184afa49adce16e298c47d136706fd2356198852.
  • Compared against current main 5ecef095b61e7a406b279c97896f3a8a6fbd6353; the preview merged cleanly as tree 76a793b90747a855c7490f47727855dd0b8a7793.
  • Environment: Linux x86_64; no compiler or local build/test run.
git merge-tree --write-tree upstream/main refs/review/pr-12996-current
git diff --check upstream/main...refs/review/pr-12996-current
python tools/check_conventions.py --base upstream/main --head refs/review/pr-12996-current
git diff --name-status 58b2753d74...upstream/main -- core/libs/prx/libSceAgcDriver/Execution/src/WorkerSampler.cpp core/libs/prx/libSceAgcDriver/tests/WorkerSampler.cpp core/libs/prx/libSceVideoOut/src/Telemetry.cpp

Results

Check Result
Current-main merge preview Clean; tree 76a793b90747a855c7490f47727855dd0b8a7793
git diff --check Passed; no output
Repository conventions Passed
Changed paths since reported comparison base None in the three relevant paths
Hosted Windows job Passed on exact head
Hosted Linux product job Skipped
Focused Windows and Linux tests Author reports the Windows Unicode-TEMP cases and Linux telemetry test passed on exact head; I did not independently run them.
Overlap coordination I agreed in the PR thread to #12996 first, then #7622; this is merge order only.
Unedited local command output
$ git merge-tree --write-tree upstream/main refs/review/pr-12996-current
76a793b90747a855c7490f47727855dd0b8a7793
$ python tools/check_conventions.py --base upstream/main --head refs/review/pr-12996-current
All conventions checks passed.

git diff --check and the changed-path comparison exited 0 with no output.

Findings

Blocking

None found. The publication path now uses MoveFileExW with native wide paths, and the Windows regression checks the collapsed file and temporary-file removal under Unicode temporary paths.

Non-blocking

Linux product CI is skipped. The focused Linux test result is author-reported, not independently run here.

Not verified

I did not run local builds or tests, and did not test on macOS or console hardware.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5707917967 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12996#pullrequestreview-5707917967). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-30T03:59:57Z. **Review:** APPROVED --- # Re-checked — new head, looks good The Windows path publication fix and regression are present, the proposed overlap order is now agreed, and the current-main preview and non-build checks pass. ## What I ran - Exact PR head: `ec7d2f5b85ffa83dc05d71051ba824177c1d7531`; PR base: `184afa49adce16e298c47d136706fd2356198852`. - Compared against current `main` `5ecef095b61e7a406b279c97896f3a8a6fbd6353`; the preview merged cleanly as tree `76a793b90747a855c7490f47727855dd0b8a7793`. - Environment: Linux x86_64; no compiler or local build/test run. ```sh git merge-tree --write-tree upstream/main refs/review/pr-12996-current git diff --check upstream/main...refs/review/pr-12996-current python tools/check_conventions.py --base upstream/main --head refs/review/pr-12996-current git diff --name-status 58b2753d74...upstream/main -- core/libs/prx/libSceAgcDriver/Execution/src/WorkerSampler.cpp core/libs/prx/libSceAgcDriver/tests/WorkerSampler.cpp core/libs/prx/libSceVideoOut/src/Telemetry.cpp ``` ## Results | Check | Result | |---|---| | Current-main merge preview | Clean; tree `76a793b90747a855c7490f47727855dd0b8a7793` | | `git diff --check` | Passed; no output | | Repository conventions | Passed | | Changed paths since reported comparison base | None in the three relevant paths | | Hosted Windows job | Passed on exact head | | Hosted Linux product job | Skipped | | Focused Windows and Linux tests | Author reports the Windows Unicode-`TEMP` cases and Linux telemetry test passed on exact head; I did not independently run them. | | Overlap coordination | I agreed in the PR thread to #12996 first, then #7622; this is merge order only. | <details> <summary>Unedited local command output</summary> ```text $ git merge-tree --write-tree upstream/main refs/review/pr-12996-current 76a793b90747a855c7490f47727855dd0b8a7793 $ python tools/check_conventions.py --base upstream/main --head refs/review/pr-12996-current All conventions checks passed. ``` `git diff --check` and the changed-path comparison exited 0 with no output. </details> ## Findings ### Blocking None found. The publication path now uses `MoveFileExW` with native wide paths, and the Windows regression checks the collapsed file and temporary-file removal under Unicode temporary paths. ### Non-blocking Linux product CI is skipped. The focused Linux test result is author-reported, not independently run here. ## Not verified I did not run local builds or tests, and did not test on macOS or console hardware.
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!12996
No description provided.