fix(tools): handle symlink loop resolution failures in sanitizer_report #12437

Merged
pushkarreddyy merged 1 commit from upstream-pr/12437 into main 2026-10-30 06:24:02 +00:00
pushkarreddyy commented 2026-10-28 13:34:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-28T13:34:39Z.


What

tools/sanitizer_report.py validates that --summary does not alias args.junit or args.known by resolving both paths. On Python 3.11+, Path.resolve() raises RuntimeError when given a cyclic symlink loop (a -> b -> a). Because RuntimeError was not included in the caught exception tuple, a symlink loop leaked an unhandled traceback instead of exiting cleanly with code 2.

  • Expanded exception handling in main() to catch RuntimeError alongside (OSError, ET.ParseError, ValueError) so resolution failures cleanly output sanitizer_report: <error> to stderr and return exit code 2.
  • Added regression test test_summary_symlink_loop_resolution_failure_exits_with_2 in tools/tests/test_sanitizer_report.py covering both mock RuntimeError and real cyclic symlink resolution failures.

Tested

  • Ran python -m unittest tools/tests/test_sanitizer_report.py (28 passed).
  • Verified python tools/check_conventions.py --base origin/main (0 findings).

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: #12349
  • Fixes: #12433
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5051381671 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12437). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-28T13:34:39Z. --- ### What `tools/sanitizer_report.py` validates that `--summary` does not alias `args.junit` or `args.known` by resolving both paths. On Python 3.11+, `Path.resolve()` raises `RuntimeError` when given a cyclic symlink loop (`a -> b -> a`). Because `RuntimeError` was not included in the caught exception tuple, a symlink loop leaked an unhandled traceback instead of exiting cleanly with code 2. - Expanded exception handling in `main()` to catch `RuntimeError` alongside `(OSError, ET.ParseError, ValueError)` so resolution failures cleanly output `sanitizer_report: <error>` to stderr and return exit code 2. - Added regression test `test_summary_symlink_loop_resolution_failure_exits_with_2` in `tools/tests/test_sanitizer_report.py` covering both mock `RuntimeError` and real cyclic symlink resolution failures. ### Tested - Ran `python -m unittest tools/tests/test_sanitizer_report.py` (28 passed). - Verified `python tools/check_conventions.py --base origin/main` (0 findings). ### 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: #12349 - [x] Fixes: #12433 - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-28 13:37:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T13:37:08Z.

Review: CHANGES_REQUESTED


Reviewed exact head aff36c360ce0. The new alias-preflight path can still leak an uncaught exception for a malformed summary destination:

RuntimeError: Symlink loop from '/tmp/.../summary-a'

I reproduced this on Python 3.11 by creating summary-a -> summary-b and summary-b -> summary-a, then invoking main([report.xml, "--summary", summary-a]). Path.resolve() raises RuntimeError in the preflight before execution enters the existing try, so the CLI prints a traceback/raises instead of returning 2 with a sanitizer_report: message. Before this change, the open("a") failure was inside the caught OSError path, so this is a regression in the new guard.

Please handle resolution failures in the same clean CLI error path (or avoid resolving through symlink loops) and add a regression test. The exact-head unit suite otherwise passes locally: 23/23 after extracting the repository's known-failures file; git diff --check and current-main conventions also pass. Hosted checks were still pending when checked.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5683510409 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12437#pullrequestreview-5683510409). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T13:37:08Z. **Review:** CHANGES_REQUESTED --- Reviewed exact head `aff36c360ce0`. The new alias-preflight path can still leak an uncaught exception for a malformed summary destination: ```text RuntimeError: Symlink loop from '/tmp/.../summary-a' ``` I reproduced this on Python 3.11 by creating `summary-a -> summary-b` and `summary-b -> summary-a`, then invoking `main([report.xml, "--summary", summary-a])`. `Path.resolve()` raises `RuntimeError` in the preflight before execution enters the existing `try`, so the CLI prints a traceback/raises instead of returning 2 with a `sanitizer_report:` message. Before this change, the `open("a")` failure was inside the caught `OSError` path, so this is a regression in the new guard. Please handle resolution failures in the same clean CLI error path (or avoid resolving through symlink loops) and add a regression test. The exact-head unit suite otherwise passes locally: 23/23 after extracting the repository's known-failures file; `git diff --check` and current-main conventions also pass. Hosted checks were still pending when checked.
adriadam10 commented 2026-10-28 13:40:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-28T13:40:27Z.

Review: CHANGES_REQUESTED


Thanks, the approach is right. One thing to fix:

  • tools/sanitizer_report.py:125: the alias preflight calls Path.resolve() outside the try. A --summary that is a symlink loop (a -> b -> a) raises RuntimeError, which is uncaught, so the CLI prints a traceback instead of returning 2 with sanitizer_report: .... This is a regression: before the change open("a") failed inside the caught OSError path (reported by @MarcZX10 as well). Move the preflight into the existing error handling (catching RuntimeError too, or avoiding resolve()) and add a regression test with a symlink loop.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5683564628 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12437#pullrequestreview-5683564628). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-28T13:40:27Z. **Review:** CHANGES_REQUESTED --- Thanks, the approach is right. One thing to fix: - `tools/sanitizer_report.py:125`: the alias preflight calls `Path.resolve()` outside the `try`. A `--summary` that is a symlink loop (`a -> b -> a`) raises `RuntimeError`, which is uncaught, so the CLI prints a traceback instead of returning 2 with `sanitizer_report: ...`. This is a regression: before the change `open("a")` failed inside the caught `OSError` path (reported by @MarcZX10 as well). Move the preflight into the existing error handling (catching `RuntimeError` too, or avoiding `resolve()`) and add a regression test with a symlink loop.
MarcZX10 commented 2026-10-28 13:45:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T13:45:55Z.

Review: COMMENTED


Follow-up on exact head 76773191d2a1: the resolution check is now inside the caught error path, RuntimeError is converted to the standard sanitizer_report: exit-2 response, and the added test covers both a mocked resolution failure and a real symlink loop. I reran the exact-head tools/tests/test_sanitizer_report.py suite: 24/24 pass. git diff --check and current-main conventions pass.

Please update the Tested section from 23 to 24 passing tests. Hosted conventions and eligibility are pending, so I am leaving a comment rather than approving while they finish.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5683646430 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12437#pullrequestreview-5683646430). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T13:45:55Z. **Review:** COMMENTED --- Follow-up on exact head `76773191d2a1`: the resolution check is now inside the caught error path, `RuntimeError` is converted to the standard `sanitizer_report:` exit-2 response, and the added test covers both a mocked resolution failure and a real symlink loop. I reran the exact-head `tools/tests/test_sanitizer_report.py` suite: 24/24 pass. `git diff --check` and current-main conventions pass. Please update the `Tested` section from 23 to 24 passing tests. Hosted conventions and eligibility are pending, so I am leaving a comment rather than approving while they finish.
MarcZX10 commented 2026-10-28 14:55:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T14:55:53Z.

Review: APPROVED


Approved at exact head 76773191d2a1. The prior symlink-loop finding is fixed: alias resolution and appending are inside the caught error path, and RuntimeError is converted to the CLI's exit-2 diagnostic. The regression tests cover both a mocked resolution failure and a real symlink loop, as well as path failures and input aliases. I reran python -m unittest tools/tests/test_sanitizer_report.py (24/24 passed), git diff --check, and python3 tools/check_conventions.py --base upstream/main (passed). The PR body now reports 24 tests. Hosted eligibility, conventions, labels, Linux/Windows relinker, and ASan checks pass; macOS relinker checks remain queued and are not specific to this Python-only change.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5684722770 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12437#pullrequestreview-5684722770). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T14:55:53Z. **Review:** APPROVED --- Approved at exact head `76773191d2a1`. The prior symlink-loop finding is fixed: alias resolution and appending are inside the caught error path, and `RuntimeError` is converted to the CLI's exit-2 diagnostic. The regression tests cover both a mocked resolution failure and a real symlink loop, as well as path failures and input aliases. I reran `python -m unittest tools/tests/test_sanitizer_report.py` (24/24 passed), `git diff --check`, and `python3 tools/check_conventions.py --base upstream/main` (passed). The PR body now reports 24 tests. Hosted eligibility, conventions, labels, Linux/Windows relinker, and ASan checks pass; macOS relinker checks remain queued and are not specific to this Python-only change.
MarcZX10 commented 2026-10-28 16:21:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T16:21:23Z.

Review: CHANGES_REQUESTED


I rechecked the current head f83f8ad7ed97 against the current upstream/main 6793a7247560. Although the PR previously reported a rebase, it is based on the older 750cf6cf48 history. Current main has since merged f25c397e16 (“report sanitizer summary write failures”), which moves the --summary append into the caught error block. An exact git merge-tree --write-tree upstream/main refs/review/pr12437-current reports content conflicts in both tools/sanitizer_report.py and tools/tests/test_sanitizer_report.py; GitHub also reports the PR DIRTY.

Please rebase onto current main and resolve the conflict while retaining the distinct input/output alias rejection and symlink-loop handling. Preserve the summary-write error handling already on main, and rerun the focused suite plus conventions/registration on the resulting head. The previous approval was for the earlier head before this current-base conflict, so I am changing it to request changes until the branch is mergeable and the tests pass on the rebased result.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5686031127 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12437#pullrequestreview-5686031127). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T16:21:23Z. **Review:** CHANGES_REQUESTED --- I rechecked the current head `f83f8ad7ed97` against the current `upstream/main` `6793a7247560`. Although the PR previously reported a rebase, it is based on the older `750cf6cf48` history. Current `main` has since merged `f25c397e16` (“report sanitizer summary write failures”), which moves the `--summary` append into the caught error block. An exact `git merge-tree --write-tree upstream/main refs/review/pr12437-current` reports content conflicts in both `tools/sanitizer_report.py` and `tools/tests/test_sanitizer_report.py`; GitHub also reports the PR `DIRTY`. Please rebase onto current `main` and resolve the conflict while retaining the distinct input/output alias rejection and symlink-loop handling. Preserve the summary-write error handling already on `main`, and rerun the focused suite plus conventions/registration on the resulting head. The previous approval was for the earlier head before this current-base conflict, so I am changing it to request changes until the branch is mergeable and the tests pass on the rebased result.
MarcZX10 commented 2026-10-28 20:17:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T20:17:35Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The updated branch passes its focused suite when combined with current main, but its source change conflicts with open PR #12349 and the required integration order is not recorded.

What I ran

Reviewed exact head 58bd51e0a1221ca05c0ca091a0bec2e908f21d11 against current main 319621ba2e578bd053b0baba2877fe70520e0737.

Environment: Linux x86_64, Python 3.11.2, Git. The current-main merge tree was clean. I also checked the pairwise merge with #12349 at 474b9c3eb555dcd4fdd8d36f7bb422c1e9be5ec8.

Commands:

git fetch https://github.com/boykopovar/AnyPS5.git refs/pull/12437/head:refs/review/pr-12437-current
git fetch https://github.com/boykopovar/AnyPS5.git refs/pull/12349/head:refs/review/pr-12349-current
git merge-tree --write-tree 319621ba2e578bd053b0baba2877fe70520e0737 refs/review/pr-12437-current
git merge-tree --write-tree refs/review/pr-12349-current refs/review/pr-12437-current
git diff --check 319621ba2e578bd053b0baba2877fe70520e0737...refs/review/pr-12437-current
python3 tools/check_conventions.py --base 319621ba2e578bd053b0baba2877fe70520e0737 --head refs/review/pr-12437-current --title 'fix(tools): handle unwritable summary destinations and reject aliased inputs in sanitizer_report' --body /tmp/pr12437-body.md
git archive a957b43df3fa2c725c760c837a28fdda8d064fcf | tar -x -C /dev/shm/AnyPS5-review-12437-combined
(cd /dev/shm/AnyPS5-review-12437-combined && python3 -m unittest tools.tests.test_sanitizer_report)
gh pr checks 12437 --repo boykopovar/AnyPS5

The unit suite ran on the clean merge tree of current main and this PR, preserving main's summary-write handling.

Results

Check Result
PR head merged with current main Clean (a957b43df3fa2c725c760c837a28fdda8d064fcf)
Combined merge with #12349 Content conflict in tools/sanitizer_report.py
git diff --check Pass; no output
tools/check_conventions.py Pass
tools.tests.test_sanitizer_report on combined tree 24 tests passed
Hosted Ubuntu/Windows relinker, ASan, conventions, eligibility, labels Pass
Hosted macOS relinker jobs Pending
Hosted product Linux/Windows, register-context, write-watch Skipped
Unedited command output

Current-main merge:

a957b43df3fa2c725c760c837a28fdda8d064fcf

Pairwise merge with #12349:

ed5c053a20bfc1d65a1415f3538795930121afd3
100644 9c98bcb9e060727ad3abda05f1b5ae05417cba6c 1	tools/sanitizer_report.py
100644 8f8329b2befcf67cfaca5a9c131ffe2cbca73a77 2	tools/sanitizer_report.py
100644 e772b7ec4b7ec8a47e0bfacc67efd04e6cdeb09e 3	tools/sanitizer_report.py

Auto-merging tools/sanitizer_report.py
CONFLICT (content): Merge conflict in tools/sanitizer_report.py
Auto-merging tools/tests/test_sanitizer_report.py

Focused tests on the current-main merge tree:

........................
----------------------------------------------------------------------
Ran 24 tests in 0.028s

OK

Conventions:

All conventions checks passed.

git diff --check emitted no output.

Hosted checks:

relinker (ubuntu-latest, g++)	pass	4m29s
relinker (windows-latest, g++)	pass	6m36s
relinker-asan	pass	2m39s
linux	skipping	0
register-context	skipping	0
windows	skipping	0
write-watch	skipping	0
relinker (macos-latest, clang++)	pending	0
relinker (macos-latest, clang++, x86_64)	pending	0
conventions	pass	17s
eligibility	pass	5s
labels	pass	9s

Findings

Blocking

  • Coordinate the overlapping change with #12349 and record the order. Both PRs edit the same preflight block in tools/sanitizer_report.py; their pairwise merge conflicts in that file. The current #12437 checklist says Depends on: none, and I found no recorded agreement with #12349's author. The repository rule asks authors of overlapping PRs to agree which lands first and declare it under Depends on. Please coordinate that order and update the checklist, then rebase/restack and rerun the focused suite on the integrated result.

Non-blocking

  • I found no separate defect in the current change. The 24 focused tests pass on the merge of this head with current main, including the already-merged summary-write error handling.

Sources

Not verified

  • I did not run the negative-control implementation or Windows/macOS runtime tests locally.
  • I did not run the test suite on the unmerged PR head; the focused suite ran on the exact clean merge tree with current main.
  • Product-specific Linux, Windows, register-context and write-watch hosted jobs were skipped; macOS relinker checks remain pending.

To get this to a good state

Agree and declare the landing order with #12349, update Depends on, and rebase/restack against current main. I will repeat the merge preview, conventions check and focused suite on that exact integrated head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5689114141 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12437#pullrequestreview-5689114141). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T20:17:35Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The updated branch passes its focused suite when combined with current `main`, but its source change conflicts with open PR #12349 and the required integration order is not recorded. ## What I ran Reviewed exact head `58bd51e0a1221ca05c0ca091a0bec2e908f21d11` against current `main` `319621ba2e578bd053b0baba2877fe70520e0737`. Environment: Linux x86_64, Python 3.11.2, Git. The current-main merge tree was clean. I also checked the pairwise merge with #12349 at `474b9c3eb555dcd4fdd8d36f7bb422c1e9be5ec8`. Commands: ```sh git fetch https://github.com/boykopovar/AnyPS5.git refs/pull/12437/head:refs/review/pr-12437-current git fetch https://github.com/boykopovar/AnyPS5.git refs/pull/12349/head:refs/review/pr-12349-current git merge-tree --write-tree 319621ba2e578bd053b0baba2877fe70520e0737 refs/review/pr-12437-current git merge-tree --write-tree refs/review/pr-12349-current refs/review/pr-12437-current git diff --check 319621ba2e578bd053b0baba2877fe70520e0737...refs/review/pr-12437-current python3 tools/check_conventions.py --base 319621ba2e578bd053b0baba2877fe70520e0737 --head refs/review/pr-12437-current --title 'fix(tools): handle unwritable summary destinations and reject aliased inputs in sanitizer_report' --body /tmp/pr12437-body.md git archive a957b43df3fa2c725c760c837a28fdda8d064fcf | tar -x -C /dev/shm/AnyPS5-review-12437-combined (cd /dev/shm/AnyPS5-review-12437-combined && python3 -m unittest tools.tests.test_sanitizer_report) gh pr checks 12437 --repo boykopovar/AnyPS5 ``` The unit suite ran on the clean merge tree of current `main` and this PR, preserving main's summary-write handling. ## Results | Check | Result | |---|---| | PR head merged with current `main` | Clean (`a957b43df3fa2c725c760c837a28fdda8d064fcf`) | | Combined merge with #12349 | Content conflict in `tools/sanitizer_report.py` | | `git diff --check` | Pass; no output | | `tools/check_conventions.py` | Pass | | `tools.tests.test_sanitizer_report` on combined tree | 24 tests passed | | Hosted Ubuntu/Windows relinker, ASan, conventions, eligibility, labels | Pass | | Hosted macOS relinker jobs | Pending | | Hosted product Linux/Windows, register-context, write-watch | Skipped | <details> <summary>Unedited command output</summary> Current-main merge: ```text a957b43df3fa2c725c760c837a28fdda8d064fcf ``` Pairwise merge with #12349: ```text ed5c053a20bfc1d65a1415f3538795930121afd3 100644 9c98bcb9e060727ad3abda05f1b5ae05417cba6c 1 tools/sanitizer_report.py 100644 8f8329b2befcf67cfaca5a9c131ffe2cbca73a77 2 tools/sanitizer_report.py 100644 e772b7ec4b7ec8a47e0bfacc67efd04e6cdeb09e 3 tools/sanitizer_report.py Auto-merging tools/sanitizer_report.py CONFLICT (content): Merge conflict in tools/sanitizer_report.py Auto-merging tools/tests/test_sanitizer_report.py ``` Focused tests on the current-main merge tree: ```text ........................ ---------------------------------------------------------------------- Ran 24 tests in 0.028s OK ``` Conventions: ```text All conventions checks passed. ``` `git diff --check` emitted no output. Hosted checks: ```text relinker (ubuntu-latest, g++) pass 4m29s relinker (windows-latest, g++) pass 6m36s relinker-asan pass 2m39s linux skipping 0 register-context skipping 0 windows skipping 0 write-watch skipping 0 relinker (macos-latest, clang++) pending 0 relinker (macos-latest, clang++, x86_64) pending 0 conventions pass 17s eligibility pass 5s labels pass 9s ``` </details> ## Findings ### Blocking - **Coordinate the overlapping change with #12349 and record the order.** Both PRs edit the same preflight block in `tools/sanitizer_report.py`; their pairwise merge conflicts in that file. The current #12437 checklist says `Depends on: none`, and I found no recorded agreement with #12349's author. The repository rule asks authors of overlapping PRs to agree which lands first and declare it under `Depends on`. Please coordinate that order and update the checklist, then rebase/restack and rerun the focused suite on the integrated result. ### Non-blocking - I found no separate defect in the current change. The 24 focused tests pass on the merge of this head with current `main`, including the already-merged summary-write error handling. ## Sources - [#12437 implementation at reviewed head](https://github.com/boykopovar/AnyPS5/blob/58bd51e0a1221ca05c0ca091a0bec2e908f21d11/tools/sanitizer_report.py) - [#12437 tests at reviewed head](https://github.com/boykopovar/AnyPS5/blob/58bd51e0a1221ca05c0ca091a0bec2e908f21d11/tools/tests/test_sanitizer_report.py) - [#12349 overlapping implementation](https://github.com/boykopovar/AnyPS5/blob/474b9c3eb555dcd4fdd8d36f7bb422c1e9be5ec8/tools/sanitizer_report.py) - [Contribution rule for overlapping PRs](https://github.com/boykopovar/AnyPS5/blob/319621ba2e578bd053b0baba2877fe70520e0737/CONTRIBUTING.md#L67) ## Not verified - I did not run the negative-control implementation or Windows/macOS runtime tests locally. - I did not run the test suite on the unmerged PR head; the focused suite ran on the exact clean merge tree with current `main`. - Product-specific Linux, Windows, register-context and write-watch hosted jobs were skipped; macOS relinker checks remain pending. ## To get this to a good state Agree and declare the landing order with #12349, update `Depends on`, and rebase/restack against current `main`. I will repeat the merge preview, conventions check and focused suite on that exact integrated head.
adriadam10 commented 2026-10-28 20:20:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-28T20:20:58Z.

Review: CHANGES_REQUESTED


This overlaps #12349, which was opened earlier, has three approvals and adds the same summary/input alias preflight in the same block of tools/sanitizer_report.py (the two merge with a content conflict).

  • What #12349 does not cover is catching RuntimeError from resolve() (symlink loop) and the test for it. Once #12349 is merged, please rebase and reduce this PR to that: the RuntimeError in the except tuple and test_summary_symlink_loop_resolution_failure_exits_with_2, dropping the duplicate alias check and test_summary_cannot_alias_input_reports.
  • Set Depends on: #12349 in the PR body and update the title to describe the remaining change.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5689157221 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12437#pullrequestreview-5689157221). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-28T20:20:58Z. **Review:** CHANGES_REQUESTED --- This overlaps #12349, which was opened earlier, has three approvals and adds the same summary/input alias preflight in the same block of `tools/sanitizer_report.py` (the two merge with a content conflict). - What #12349 does not cover is catching `RuntimeError` from `resolve()` (symlink loop) and the test for it. Once #12349 is merged, please rebase and reduce this PR to that: the `RuntimeError` in the `except` tuple and `test_summary_symlink_loop_resolution_failure_exits_with_2`, dropping the duplicate alias check and `test_summary_cannot_alias_input_reports`. - Set `Depends on: #12349` in the PR body and update the title to describe the remaining change.
MarcZX10 commented 2026-10-29 04:18:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T04:18:37Z.

Review: APPROVED


Reviewed — looks good

I reviewed exact head 9ea3744981e8b97b634468192f160c9700a6a947 composed with current main b433c40f2f46aa2e59e19806010a839ac8572d64; the merge preview is clean, the focused 28-test suite passes, and removing the new exception handling makes the regression fail as intended.

What I ran

Environment: Linux x86_64, Debian kernel 6.1.0-54-amd64, Python 3.11.2, GitHub CLI 2.23.0.

git fetch upstream main
git fetch upstream refs/pull/12437/head:refs/remotes/review/12437-current
git merge-tree --write-tree upstream/main refs/remotes/review/12437-current
git diff --check upstream/main...refs/remotes/review/12437-current
python3 tools/check_conventions.py --base upstream/main --head refs/remotes/review/12437-current --title 'fix(tools): handle symlink loop resolution failures in sanitizer_report' --body /tmp/anyps5-review-12437-body.md
git archive a347cdba1553ff968ee9e5d5efada79f547abe34 | tar -x -C /tmp/anyps5-review-12437-merged
(cd /tmp/anyps5-review-12437-merged && python3 -m unittest tools.tests.test_sanitizer_report)
gh pr checks 12437 --repo boykopovar/AnyPS5

The focused suite ran from an archive of the exact merge-tree result. For the negative control, I copied that archive to a separate temporary directory, removed RuntimeError from the caught exception tuple, and ran only the new regression test there.

Results

Check Result
PR head with current main Clean merge preview; merge tree a347cdba1553ff968ee9e5d5efada79f547abe34
Diff check Passed; no output
Conventions Passed
tools.tests.test_sanitizer_report on exact merge-tree archive 28 passed
Negative control without RuntimeError handling New regression failed with the expected uncaught RuntimeError
Hosted checks Windows, conventions, eligibility, labels, Ubuntu/Windows/macOS relinker, and ASan pass; macOS relinker checks pending; product Linux/Windows and specialized jobs skipped
Raw merge, diff, convention, and focused-test output
Merge base:
3a2b91981651569163768854a1fcdc7193b6667b

Current-main merge preview:
a347cdba1553ff968ee9e5d5efada79f547abe34

Diff check:
(no output)

Conventions:
All conventions checks passed.

Focused tests on the merge-tree archive:
............................
----------------------------------------------------------------------
Ran 28 tests in 0.362s

OK
Raw negative-control output
negative control: removed RuntimeError from the caught exception tuple
E
======================================================================
ERROR: test_summary_symlink_loop_resolution_failure_exits_with_2 (tools.tests.test_sanitizer_report.SanitizerReportTests.test_summary_symlink_loop_resolution_failure_exits_with_2)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/anyps5-review-12437-negative/tools/tests/test_sanitizer_report.py", line 142, in test_summary_symlink_loop_resolution_failure_exits_with_2
    code, stdout, stderr = self.run_main(junit, "--summary", summary)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/anyps5-review-12437-negative/tools/tests/test_sanitizer_report.py", line 39, in run_main
    code = sanitizer_report.main([str(arg) for arg in args])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/anyps5-review-12437-negative/tools/sanitizer_report.py", line 128, in main
    if source is not None and (source.resolve() == args.summary.resolve() or
                               ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/unittest/mock.py", line 1118, in __call__
    return self._mock_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/unittest/mock.py", line 1122, in _mock_call
    return self._execute_mock_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/unittest/mock.py", line 1177, in _execute_mock_call
    raise effect
RuntimeError: Symlink loop from 'summary_mock.md'

----------------------------------------------------------------------
Ran 1 test in 0.006s

FAILED (errors=1)
exit status: 1
Raw hosted-check output
conventions	pass	14s	https://github.com/boykopovar/AnyPS5/actions/runs/40802933696/job/123215030533
labels	pass	8s	https://github.com/boykopovar/AnyPS5/actions/runs/40802933872/job/123215031422
relinker (ubuntu-latest, g++)	pass	3m21s	https://github.com/boykopovar/AnyPS5/actions/runs/40802892862/job/123214944313
relinker (windows-latest, g++)	pass	7m39s	https://github.com/boykopovar/AnyPS5/actions/runs/40802892862/job/123214944393
relinker-asan	pass	2m19s	https://github.com/boykopovar/AnyPS5/actions/runs/40802892862/job/123214944297
relinker (macos-latest, clang++)	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/40802892862/job/123214944435
relinker (macos-latest, clang++, x86_64)	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/40802892862/job/123214944354
linux	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/40802892862/job/123214946228
register-context	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/40802892862/job/123214945410
windows	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/40802892862/job/123214945943
write-watch	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/40802892862/job/123214945803
eligibility	pass	8s	https://github.com/boykopovar/AnyPS5/actions/runs/40802892862/job/123214895097

Negative control

Assertion Change under test Result
Cyclic symlink resolution is reported as a controlled exit-2 error Removed RuntimeError from the caught exception tuple in a temporary copy of the exact merged tree The targeted regression errored with an uncaught RuntimeError, as expected

Findings

Blocking

None found. The tested merge-tree source handles the resolution error and the new regression detects its absence.

Non-blocking

The PR description still says Depends on: #12349, although #12349 is merged. Please update that bookkeeping line to reflect the dependency is satisfied.

Sources

Not verified

I did not run Python tests on Windows or macOS. The PR’s product Windows job and specialized jobs are skipped, and the two hosted macOS relinker checks remain pending. No console or game behavior is relevant to this Python tool change.

To get this to a good state

Update the stale dependency bookkeeping line; no code change is needed based on this review. If a new code head is pushed, I will repeat the merge preview, diff/conventions checks, and focused tests on that exact head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5692803319 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12437#pullrequestreview-5692803319). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T04:18:37Z. **Review:** APPROVED --- # Reviewed — looks good I reviewed exact head `9ea3744981e8b97b634468192f160c9700a6a947` composed with current `main` `b433c40f2f46aa2e59e19806010a839ac8572d64`; the merge preview is clean, the focused 28-test suite passes, and removing the new exception handling makes the regression fail as intended. ## What I ran Environment: Linux x86_64, Debian kernel 6.1.0-54-amd64, Python 3.11.2, GitHub CLI 2.23.0. ~~~sh git fetch upstream main git fetch upstream refs/pull/12437/head:refs/remotes/review/12437-current git merge-tree --write-tree upstream/main refs/remotes/review/12437-current git diff --check upstream/main...refs/remotes/review/12437-current python3 tools/check_conventions.py --base upstream/main --head refs/remotes/review/12437-current --title 'fix(tools): handle symlink loop resolution failures in sanitizer_report' --body /tmp/anyps5-review-12437-body.md git archive a347cdba1553ff968ee9e5d5efada79f547abe34 | tar -x -C /tmp/anyps5-review-12437-merged (cd /tmp/anyps5-review-12437-merged && python3 -m unittest tools.tests.test_sanitizer_report) gh pr checks 12437 --repo boykopovar/AnyPS5 ~~~ The focused suite ran from an archive of the exact merge-tree result. For the negative control, I copied that archive to a separate temporary directory, removed `RuntimeError` from the caught exception tuple, and ran only the new regression test there. ## Results | Check | Result | |---|---| | PR head with current main | Clean merge preview; merge tree `a347cdba1553ff968ee9e5d5efada79f547abe34` | | Diff check | Passed; no output | | Conventions | Passed | | `tools.tests.test_sanitizer_report` on exact merge-tree archive | 28 passed | | Negative control without `RuntimeError` handling | New regression failed with the expected uncaught `RuntimeError` | | Hosted checks | Windows, conventions, eligibility, labels, Ubuntu/Windows/macOS relinker, and ASan pass; macOS relinker checks pending; product Linux/Windows and specialized jobs skipped | <details><summary>Raw merge, diff, convention, and focused-test output</summary> ~~~text Merge base: 3a2b91981651569163768854a1fcdc7193b6667b Current-main merge preview: a347cdba1553ff968ee9e5d5efada79f547abe34 Diff check: (no output) Conventions: All conventions checks passed. Focused tests on the merge-tree archive: ............................ ---------------------------------------------------------------------- Ran 28 tests in 0.362s OK ~~~ </details> <details><summary>Raw negative-control output</summary> ~~~text negative control: removed RuntimeError from the caught exception tuple E ====================================================================== ERROR: test_summary_symlink_loop_resolution_failure_exits_with_2 (tools.tests.test_sanitizer_report.SanitizerReportTests.test_summary_symlink_loop_resolution_failure_exits_with_2) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/anyps5-review-12437-negative/tools/tests/test_sanitizer_report.py", line 142, in test_summary_symlink_loop_resolution_failure_exits_with_2 code, stdout, stderr = self.run_main(junit, "--summary", summary) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/anyps5-review-12437-negative/tools/tests/test_sanitizer_report.py", line 39, in run_main code = sanitizer_report.main([str(arg) for arg in args]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/anyps5-review-12437-negative/tools/sanitizer_report.py", line 128, in main if source is not None and (source.resolve() == args.summary.resolve() or ^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/unittest/mock.py", line 1118, in __call__ return self._mock_call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/unittest/mock.py", line 1122, in _mock_call return self._execute_mock_call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/unittest/mock.py", line 1177, in _execute_mock_call raise effect RuntimeError: Symlink loop from 'summary_mock.md' ---------------------------------------------------------------------- Ran 1 test in 0.006s FAILED (errors=1) exit status: 1 ~~~ </details> <details><summary>Raw hosted-check output</summary> ~~~text conventions pass 14s https://github.com/boykopovar/AnyPS5/actions/runs/40802933696/job/123215030533 labels pass 8s https://github.com/boykopovar/AnyPS5/actions/runs/40802933872/job/123215031422 relinker (ubuntu-latest, g++) pass 3m21s https://github.com/boykopovar/AnyPS5/actions/runs/40802892862/job/123214944313 relinker (windows-latest, g++) pass 7m39s https://github.com/boykopovar/AnyPS5/actions/runs/40802892862/job/123214944393 relinker-asan pass 2m19s https://github.com/boykopovar/AnyPS5/actions/runs/40802892862/job/123214944297 relinker (macos-latest, clang++) pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/40802892862/job/123214944435 relinker (macos-latest, clang++, x86_64) pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/40802892862/job/123214944354 linux skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/40802892862/job/123214946228 register-context skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/40802892862/job/123214945410 windows skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/40802892862/job/123214945943 write-watch skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/40802892862/job/123214945803 eligibility pass 8s https://github.com/boykopovar/AnyPS5/actions/runs/40802892862/job/123214895097 ~~~ </details> ## Negative control | Assertion | Change under test | Result | |---|---|---| | Cyclic symlink resolution is reported as a controlled exit-2 error | Removed `RuntimeError` from the caught exception tuple in a temporary copy of the exact merged tree | The targeted regression errored with an uncaught `RuntimeError`, as expected | ## Findings ### Blocking None found. The tested merge-tree source handles the resolution error and the new regression detects its absence. ### Non-blocking The PR description still says `Depends on: #12349`, although #12349 is merged. Please update that bookkeeping line to reflect the dependency is satisfied. ## Sources - [Implementation at the reviewed PR head](https://github.com/boykopovar/AnyPS5/blob/9ea3744981e8b97b634468192f160c9700a6a947/tools/sanitizer_report.py) - [Regression test at the reviewed PR head](https://github.com/boykopovar/AnyPS5/blob/9ea3744981e8b97b634468192f160c9700a6a947/tools/tests/test_sanitizer_report.py) - [Current main commit used for the merge preview](https://github.com/boykopovar/AnyPS5/commit/b433c40f2f46aa2e59e19806010a839ac8572d64) - [Merged #12349 commit](https://github.com/boykopovar/AnyPS5/commit/27cf3df1bc5fc3ee7f5f5764d4eeb760d815f63f) - [Contribution conventions at current main](https://github.com/boykopovar/AnyPS5/blob/b433c40f2f46aa2e59e19806010a839ac8572d64/CONTRIBUTING.md) ## Not verified I did not run Python tests on Windows or macOS. The PR’s product Windows job and specialized jobs are skipped, and the two hosted macOS relinker checks remain pending. No console or game behavior is relevant to this Python tool change. ## To get this to a good state Update the stale dependency bookkeeping line; no code change is needed based on this review. If a new code head is pushed, I will repeat the merge preview, diff/conventions checks, and focused tests on that exact head.
THEMANnt commented 2026-10-29 06:29:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-29T06:29:48Z.

Review: APPROVED


Reviewed 9ea3744981e8b97b634468192f160c9700a6a947 against 3a2b91981651569163768854a1fcdc7193b6667b. RuntimeError from symbolic-link resolution is converted to the existing sanitizer-report usage-error path. Failed parsing does not append a successful summary or print success output. No actionable finding in this scoped review.

Windows/Python 3.11 validation: head 26 passed, 2 skipped; baseline 25 passed, 2 skipped. The new loop simulations raise uncaught RuntimeError on old production and pass with the fix. Real symbolic-link cases requiring Windows privileges remain skipped.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5693725114 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12437#pullrequestreview-5693725114). Originally posted by [THEMANnt](https://github.com/THEMANnt) on 2026-10-29T06:29:48Z. **Review:** APPROVED --- Reviewed `9ea3744981e8b97b634468192f160c9700a6a947` against `3a2b91981651569163768854a1fcdc7193b6667b`. RuntimeError from symbolic-link resolution is converted to the existing sanitizer-report usage-error path. Failed parsing does not append a successful summary or print success output. No actionable finding in this scoped review. Windows/Python 3.11 validation: head 26 passed, 2 skipped; baseline 25 passed, 2 skipped. The new loop simulations raise uncaught RuntimeError on old production and pass with the fix. Real symbolic-link cases requiring Windows privileges remain skipped.
malekaifa commented 2026-10-29 08:40:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by malekaifa on 2026-10-29T08:40:06Z.

Review: APPROVED


Reviewed exact head dd3f3c5c5b9cbd85726384b31aa35160eb91e342 against current main. The two touched base files are byte-identical between the PR base and current main, so there is no intervening same-file drift. tools/tests/test_sanitizer_report.py passes on Windows Python 3.12 (28 tests, 2 platform skips), Windows Python 3.9 (same), and WSL Python 3.12 (28/28). Removing RuntimeError from the caught exception tuple makes test_summary_symlink_loop_resolution_failure_exits_with_2 fail with the uncaught RuntimeError, so the regression detects the behavior being fixed. git diff --check is clean and hosted checks are green. I found no blocking issue in the current reduced follow-up.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5694921523 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12437#pullrequestreview-5694921523). Originally posted by [malekaifa](https://github.com/malekaifa) on 2026-10-29T08:40:06Z. **Review:** APPROVED --- Reviewed exact head dd3f3c5c5b9cbd85726384b31aa35160eb91e342 against current main. The two touched base files are byte-identical between the PR base and current main, so there is no intervening same-file drift. tools/tests/test_sanitizer_report.py passes on Windows Python 3.12 (28 tests, 2 platform skips), Windows Python 3.9 (same), and WSL Python 3.12 (28/28). Removing RuntimeError from the caught exception tuple makes test_summary_symlink_loop_resolution_failure_exits_with_2 fail with the uncaught RuntimeError, so the regression detects the behavior being fixed. git diff --check is clean and hosted checks are green. I found no blocking issue in the current reduced follow-up.
malekaifa commented 2026-10-30 00:46:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by malekaifa on 2026-10-30T00:46:48Z.

Review: APPROVED


Re-checked current head f8795f97a0. Both touched blobs are byte-identical to the exact head I previously reviewed (tools/sanitizer_report.py blob 05499a247c; test blob 474df62f22), so the rebase did not change the implementation or regression. The hosted Build on this exact head is fully green across Ubuntu, Windows, both macOS relinker lanes and ASan. My prior negative-control and multi-platform validation therefore still applies. No blocking issue found.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5706802391 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12437#pullrequestreview-5706802391). Originally posted by [malekaifa](https://github.com/malekaifa) on 2026-10-30T00:46:48Z. **Review:** APPROVED --- Re-checked current head f8795f97a0d465f339469500a68d9ed6da9ecbb0. Both touched blobs are byte-identical to the exact head I previously reviewed (tools/sanitizer_report.py blob 05499a247c2dc2fa1e2195258917752aeb6e43dc; test blob 474df62f22e74d6f02e699e7b7d7c099848908c4), so the rebase did not change the implementation or regression. The hosted Build on this exact head is fully green across Ubuntu, Windows, both macOS relinker lanes and ASan. My prior negative-control and multi-platform validation therefore still applies. No blocking issue found.
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!12437
No description provided.