test(tools): preserve loop coverage without symlink privileges #15652

Merged
Matt10n3 merged 1 commit from upstream-pr/15652 into main 2026-11-07 23:41:25 +00:00
Matt10n3 commented 2026-11-03 23:59:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Matt10n3 on 2026-11-03T23:59:04Z.


What

On Windows without symbolic-link privilege, the registration and missing-command recovery loop regressions fail during fixture setup with WinError 1314. Add deterministic Path.resolve loop fixtures that run without privileges, while retaining real directory-symlink-cycle integration cases on capable hosts. Only unsupported link setup (NotImplementedError or Windows error 1314) produces an explicit integration-test skip; scanner errors and other OSErrors still fail.

Visit the loop before the valid sibling, so both regressions detect stopping the scan early as well as failing to suppress a loop exception. No production code, PS5 behavior, dependency or OS security-policy changes.

This branch is based directly on main and contains no AppContent overflow changes.

Tested

  • Windows / Python 3.12.8: test_test_registration.py -v ran 78 tests: 77 passed and one real-symlink integration case skipped for WinError 1314. test_select_tests.py MissingCommandTests -v ran four tests: three passed and one such case skipped. Both mocked loop regressions executed.
  • Windows relinker-only build: cmake --build C:\temp\anyps5-registration\build --parallel 8 succeeded. Full CTest: 677/677 passed in 93.73 s, including the registration and missing-command cases.
  • A separate full-runtime CTest attempt in the existing AppContent build stopped at unchanged guest_libc_cnd_timed_wait (abort 0xc0000409, reproduced in isolation): 807 passed, one skipped, one failed and 2,911 not run. This tools-only change did not affect that run, and the full-runtime suite was not rerun on this base.
  • Linux Ubuntu 24.04 / Python 3.12.3: earlier run passed registration 65/65 and missing-command recovery 4/4 with no skips, including real filesystem symlink loops.
  • Mutation checks confirmed both regressions fail if RuntimeError loop handling is removed or if traversal stops after the loop instead of continuing.
  • check_conventions.py --base origin/main passed. pr_overlap.py checked 1,816 open PRs and reported no overlap.
  • AI assistance was used for implementation, tests, review and this description.

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:5146410549 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15652). Originally posted by [Matt10n3](https://github.com/Matt10n3) on 2026-11-03T23:59:04Z. --- ### What On Windows without symbolic-link privilege, the registration and missing-command recovery loop regressions fail during fixture setup with WinError 1314. Add deterministic Path.resolve loop fixtures that run without privileges, while retaining real directory-symlink-cycle integration cases on capable hosts. Only unsupported link setup (NotImplementedError or Windows error 1314) produces an explicit integration-test skip; scanner errors and other OSErrors still fail. Visit the loop before the valid sibling, so both regressions detect stopping the scan early as well as failing to suppress a loop exception. No production code, PS5 behavior, dependency or OS security-policy changes. This branch is based directly on main and contains no AppContent overflow changes. ### 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 / Python 3.12.8: `test_test_registration.py -v` ran 78 tests: 77 passed and one real-symlink integration case skipped for WinError 1314. `test_select_tests.py MissingCommandTests -v` ran four tests: three passed and one such case skipped. Both mocked loop regressions executed. - Windows relinker-only build: `cmake --build C:\temp\anyps5-registration\build --parallel 8` succeeded. Full CTest: 677/677 passed in 93.73 s, including the registration and missing-command cases. - A separate full-runtime CTest attempt in the existing AppContent build stopped at unchanged `guest_libc_cnd_timed_wait` (abort `0xc0000409`, reproduced in isolation): 807 passed, one skipped, one failed and 2,911 not run. This tools-only change did not affect that run, and the full-runtime suite was not rerun on this base. - Linux Ubuntu 24.04 / Python 3.12.3: earlier run passed registration 65/65 and missing-command recovery 4/4 with no skips, including real filesystem symlink loops. - Mutation checks confirmed both regressions fail if RuntimeError loop handling is removed or if traversal stops after the loop instead of continuing. - `check_conventions.py --base origin/main` passed. `pr_overlap.py` checked 1,816 open PRs and reported no overlap. - AI assistance was used for implementation, tests, review and this description. ### 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 -->
BunnyFl commented 2026-11-04 01:24:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-04T01:24:52Z.

Review: APPROVED


@Matt10n3 thanks, this fixes a failure I see on this machine. Without the symlink privilege, main's test_looping_subdirectory_is_skipped errors with [WinError 1314] A required privilege is not held by the client in fixture setup. The mocked fixtures reach the except RuntimeError: continue in both tools (tools/check_test_registration.py:165, tools/select_tests.py:115). With subdirs("nested" "first"), pending.pop() (tools/check_test_registration.py:164, tools/select_tests.py:114) takes the loop first, so stopping the scan early would be caught as well.

What I ran: head c0d7bc2eca merged onto main 1c8c0efc8c, Windows 11, Python 3.14.7, no symlink privilege:

  • main: test_test_registration.py 77 tests, FAILED (errors=1); test_select_tests.py MissingCommandTests 3 tests, FAILED (errors=1), both WinError 1314;
  • the merge: test_test_registration.py 78 tests, OK (skipped=1); test_select_tests.py 50 tests, OK (skipped=1). The skips are the two real-symlink cases, for WinError 1314;
  • mutation, except RuntimeError: changed to except ZeroDivisionError: in both tools: test_test_registration.py FAILED (errors=2, skipped=1) and MissingCommandTests FAILED (errors=2, skipped=1), both from the new mocked tests' two subtests;
  • tools/check_conventions.py --base upstream/main: all checks passed.
  • tools/pr_overlap.py --branch on the head against the 1,829 open pull requests: "No overlap with open pull requests."

Optional, not for this PR: since Python 3.13, Path.resolve() no longer raises RuntimeError on a symlink loop: it raises OSError in strict mode and nothing otherwise (pathlib docs, "Changed in version 3.13"). On 3.13+ the except RuntimeError in both tools is reached only through the mock, and a real loop is presumably handled by the visited set instead. I haven't checked that on a host with the privilege.

Approving.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5761898081 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15652#pullrequestreview-5761898081). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-04T01:24:52Z. **Review:** APPROVED --- @Matt10n3 thanks, this fixes a failure I see on this machine. Without the symlink privilege, `main`'s `test_looping_subdirectory_is_skipped` errors with `[WinError 1314] A required privilege is not held by the client` in fixture setup. The mocked fixtures reach the `except RuntimeError: continue` in both tools (`tools/check_test_registration.py:165`, `tools/select_tests.py:115`). With `subdirs("nested" "first")`, `pending.pop()` (`tools/check_test_registration.py:164`, `tools/select_tests.py:114`) takes the loop first, so stopping the scan early would be caught as well. **What I ran:** head `c0d7bc2eca` merged onto `main` `1c8c0efc8c`, Windows 11, Python 3.14.7, no symlink privilege: - `main`: `test_test_registration.py` 77 tests, `FAILED (errors=1)`; `test_select_tests.py MissingCommandTests` 3 tests, `FAILED (errors=1)`, both WinError 1314; - the merge: `test_test_registration.py` 78 tests, OK (skipped=1); `test_select_tests.py` 50 tests, OK (skipped=1). The skips are the two real-symlink cases, for WinError 1314; - mutation, `except RuntimeError:` changed to `except ZeroDivisionError:` in both tools: `test_test_registration.py` `FAILED (errors=2, skipped=1)` and `MissingCommandTests` `FAILED (errors=2, skipped=1)`, both from the new mocked tests' two subtests; - `tools/check_conventions.py --base upstream/main`: all checks passed. - `tools/pr_overlap.py --branch` on the head against the 1,829 open pull requests: "No overlap with open pull requests." **Optional, not for this PR:** since Python 3.13, `Path.resolve()` no longer raises `RuntimeError` on a symlink loop: it raises `OSError` in strict mode and nothing otherwise ([pathlib docs](https://docs.python.org/3/library/pathlib.html#pathlib.Path.resolve), "Changed in version 3.13"). On 3.13+ the `except RuntimeError` in both tools is reached only through the mock, and a real loop is presumably handled by the `visited` set instead. I haven't checked that on a host with the privilege. Approving.
Superseabas commented 2026-11-04 16:52:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Superseabas on 2026-11-04T16:52:53Z.

Review: APPROVED


Second Windows machine without the symbolic-link privilege (standard user, Developer Mode off). Head c0d7bc2eca merged onto current main b11c7bf84f (clean merge, local only), Python 3.13, ctest, 3 runs each:

Test main this PR
test_registration 0 of 3 ([WinError 1314] at os.symlink) 3 of 3
select_tests_MissingCommandTests 0 of 3 (same) 3 of 3

Verbose, on the merge: test_looping_subdirectory_is_skipped and test_looping_subdirectory_is_skipped_when_recovering_commands run and pass with the mocked loop. The two ..._where_supported cases skip with symbolic link privilege is unavailable: [WinError 1314] …. test_test_registration ran 78 tests (OK, skipped=1) and MissingCommandTests ran 4 tests (OK, skipped=1). check_conventions.py --base main passes.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5772287784 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15652#pullrequestreview-5772287784). Originally posted by [Superseabas](https://github.com/Superseabas) on 2026-11-04T16:52:53Z. **Review:** APPROVED --- Second Windows machine without the symbolic-link privilege (standard user, Developer Mode off). Head `c0d7bc2eca` merged onto current `main` `b11c7bf84f` (clean merge, local only), Python 3.13, `ctest`, 3 runs each: | Test | `main` | this PR | |---|---|---| | `test_registration` | 0 of 3 (`[WinError 1314]` at `os.symlink`) | 3 of 3 | | `select_tests_MissingCommandTests` | 0 of 3 (same) | 3 of 3 | Verbose, on the merge: `test_looping_subdirectory_is_skipped` and `test_looping_subdirectory_is_skipped_when_recovering_commands` run and pass with the mocked loop. The two `..._where_supported` cases skip with `symbolic link privilege is unavailable: [WinError 1314] …`. `test_test_registration` ran 78 tests (OK, skipped=1) and `MissingCommandTests` ran 4 tests (OK, skipped=1). `check_conventions.py --base main` passes. AI-assisted: yes (Claude Code)
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!15652
No description provided.