fix(tools): report sanitizer summary write failures #12096

Merged
malekaifa merged 1 commit from upstream-pr/12096 into main 2026-10-28 16:06:03 +00:00
malekaifa commented 2026-10-27 20:24:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by malekaifa on 2026-10-27T20:24:30Z.


What

tools/sanitizer_report.py currently prints a successful report to stdout before attempting to append the same report to --summary. If the summary path cannot be written, the write escapes the controlled error boundary as an unhandled traceback after success-looking stdout has already been emitted.

Move the optional summary append into the existing controlled OSError / XML / value-error boundary and perform it before stdout publication. A summary-write failure now returns 2, writes no successful report to stdout, and reports the filesystem error on stderr without a traceback.

Tested

  • Current-main negative control: a passing one-test JUnit file plus a --summary path with a missing parent exits 1 after emitting success-looking stdout, then leaks FileNotFoundError traceback.
  • Windows 11, Python 3.12: py -3 -m unittest tools.tests.test_sanitizer_report - 22/22 passed.
  • Windows 11, Python 3.9: py -3.9 -m unittest tools.tests.test_sanitizer_report - 22/22 passed.
  • WSL Ubuntu, Python 3.12: python3 -m unittest tools.tests.test_sanitizer_report - 22/22 passed.
  • Focused probes cover missing-parent, directory-as-summary, write-time OSError, malformed XML/known-file precedence, successful append, and no-summary behavior.
  • py -3 tools/check_conventions.py --base origin/main - passed.
  • git diff --check origin/main...HEAD - passed.
  • python -m compileall on both changed files - passed.
  • Independent exact-patch review: PASS, no P0/P1/P2 findings.
  • Exact published fork SHA f25c397e16b8f4ef891f778d021deb373ad8d6cd: GPT-6 High metadata/rebase-equivalence confirmation PASS, no P0/P1/P2; parent/tree/blob/patch identity verified.
  • Latest-main merge preview is clean and neither touched file changed since the reviewed parent.

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: #12072
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (OpenAI Codex / ChatGPT)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5040595934 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12096). Originally posted by [malekaifa](https://github.com/malekaifa) on 2026-10-27T20:24:30Z. --- ### What `tools/sanitizer_report.py` currently prints a successful report to stdout before attempting to append the same report to `--summary`. If the summary path cannot be written, the write escapes the controlled error boundary as an unhandled traceback after success-looking stdout has already been emitted. Move the optional summary append into the existing controlled `OSError` / XML / value-error boundary and perform it before stdout publication. A summary-write failure now returns 2, writes no successful report to stdout, and reports the filesystem error on stderr without a traceback. ### Tested - Current-main negative control: a passing one-test JUnit file plus a `--summary` path with a missing parent exits 1 after emitting success-looking stdout, then leaks `FileNotFoundError` traceback. - Windows 11, Python 3.12: `py -3 -m unittest tools.tests.test_sanitizer_report` - 22/22 passed. - Windows 11, Python 3.9: `py -3.9 -m unittest tools.tests.test_sanitizer_report` - 22/22 passed. - WSL Ubuntu, Python 3.12: `python3 -m unittest tools.tests.test_sanitizer_report` - 22/22 passed. - Focused probes cover missing-parent, directory-as-summary, write-time `OSError`, malformed XML/known-file precedence, successful append, and no-summary behavior. - `py -3 tools/check_conventions.py --base origin/main` - passed. - `git diff --check origin/main...HEAD` - passed. - `python -m compileall` on both changed files - passed. - Independent exact-patch review: PASS, no P0/P1/P2 findings. - Exact published fork SHA `f25c397e16b8f4ef891f778d021deb373ad8d6cd`: GPT-6 High metadata/rebase-equivalence confirmation PASS, no P0/P1/P2; parent/tree/blob/patch identity verified. - Latest-main merge preview is clean and neither touched file changed since the reviewed parent. ### 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 - [x] Fixes: #12072 - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes (OpenAI Codex / ChatGPT)
copilot-pull-request-reviewer[bot] commented 2026-10-27 20:26:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-10-27T20:26:04Z.

Review: COMMENTED


No active review issues block approval of the summary-file error-handling change.

No open issues 🎉

What changed in this PR

Fixes #12072 by handling optional summary-file write failures through the sanitizer reporting tool’s existing controlled error path, before emitting a report to stdout.

Changes:

  • Moves summary publication inside the error-handling block so failures return code 2 with a diagnostic instead of a traceback.
  • Adds a regression test for a missing summary directory, checking empty stdout and diagnostic stderr.
File Description
tools/​tests/​test_sanitizer_report.py Adds regression coverage for summary publication failure.
tools/​sanitizer_report.py Handles summary I/O errors before writing the stdout report.

Review effort: Balanced

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5673819456 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12096#pullrequestreview-5673819456). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-10-27T20:26:04Z. **Review:** COMMENTED --- <!-- ccr-overview-v2 --> ### 🟢 Approval recommended No active review issues block approval of the summary-file error-handling change. **No open issues** 🎉 <details> <summary><strong>What changed in this PR</strong></summary> Fixes #12072 by handling optional summary-file write failures through the sanitizer reporting tool’s existing controlled error path, before emitting a report to stdout. **Changes:** - Moves summary publication inside the error-handling block so failures return code 2 with a diagnostic instead of a traceback. - Adds a regression test for a missing summary directory, checking empty stdout and diagnostic stderr. | File | Description | | ---- | ----------- | | `tools/​tests/​test_sanitizer_report.py` | Adds regression coverage for summary publication failure. | | `tools/​sanitizer_report.py` | Handles summary I/O errors before writing the stdout report. | </details> <sub>Review effort: Balanced</sub>
MarcZX10 commented 2026-10-27 20:38:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T20:38:40Z.

Review: APPROVED


Reviewed exact head 8623056345b746a080a689cc41a00b073906d9a6 and independently ran from that exact tree: 22/22 passed. The summary append now shares the existing OSError handling boundary and occurs before stdout publication, so an append failure returns 2 without a success-looking report. The regression test verifies the missing-parent case, empty stdout, diagnostic prefix, and no traceback. The exact head merges cleanly with current upstream/main. Ubuntu and Windows relinker checks plus relinker-asan passed; the two macOS jobs were still queued at review time, while the platform-specific library build jobs were skipped. I found no blocking issue in the diff.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5673990055 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12096#pullrequestreview-5673990055). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T20:38:40Z. **Review:** APPROVED --- Reviewed exact head 8623056345b746a080a689cc41a00b073906d9a6 and independently ran from that exact tree: 22/22 passed. The summary append now shares the existing OSError handling boundary and occurs before stdout publication, so an append failure returns 2 without a success-looking report. The regression test verifies the missing-parent case, empty stdout, diagnostic prefix, and no traceback. The exact head merges cleanly with current upstream/main. Ubuntu and Windows relinker checks plus relinker-asan passed; the two macOS jobs were still queued at review time, while the platform-specific library build jobs were skipped. I found no blocking issue in the diff.
MarcZX10 commented 2026-10-27 20:38:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T20:38:44Z.

Review: APPROVED


Reviewed exact head 8623056345b746a080a689cc41a00b073906d9a6 and independently ran python3 tools/tests/test_sanitizer_report.py from that exact tree: 22/22 passed. The summary append now shares the existing OSError handling boundary and occurs before stdout publication, so an append failure returns 2 without a success-looking report. The regression test verifies the missing-parent case, empty stdout, diagnostic prefix, and no traceback. The exact head merges cleanly with current upstream/main. Ubuntu and Windows relinker checks plus relinker-asan passed; the two macOS jobs were still queued at review time, while the platform-specific library build jobs were skipped. I found no blocking issue in the diff.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5673991232 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12096#pullrequestreview-5673991232). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T20:38:44Z. **Review:** APPROVED --- Reviewed exact head 8623056345b746a080a689cc41a00b073906d9a6 and independently ran python3 tools/tests/test_sanitizer_report.py from that exact tree: 22/22 passed. The summary append now shares the existing OSError handling boundary and occurs before stdout publication, so an append failure returns 2 without a success-looking report. The regression test verifies the missing-parent case, empty stdout, diagnostic prefix, and no traceback. The exact head merges cleanly with current upstream/main. Ubuntu and Windows relinker checks plus relinker-asan passed; the two macOS jobs were still queued at review time, while the platform-specific library build jobs were skipped. I found no blocking issue in the diff.
MarcZX10 commented 2026-10-27 20:53:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T20:53:41Z.

Review: APPROVED


Re-reviewed exact head f25c397e16b8f4ef891f778d021deb373ad8d6cd. The parent changed in the rebase, but I compared the stable patch IDs against the previously reviewed head and they are identical. I reran python3 tools/tests/test_sanitizer_report.py from this exact tree: 22/22 passed. git diff --check and the merge-tree preview against current main are clean. The existing behavior is still correct: write the optional summary before publishing success on stdout, and route write failures through the controlled error path. Hosted conventions and policy checks pass; remaining macOS relinker jobs are queued and do not execute this Python tool. Approved on this exact head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5674170823 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12096#pullrequestreview-5674170823). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T20:53:41Z. **Review:** APPROVED --- Re-reviewed exact head `f25c397e16b8f4ef891f778d021deb373ad8d6cd`. The parent changed in the rebase, but I compared the stable patch IDs against the previously reviewed head and they are identical. I reran `python3 tools/tests/test_sanitizer_report.py` from this exact tree: 22/22 passed. `git diff --check` and the merge-tree preview against current `main` are clean. The existing behavior is still correct: write the optional summary before publishing success on stdout, and route write failures through the controlled error path. Hosted conventions and policy checks pass; remaining macOS relinker jobs are queued and do not execute this Python tool. Approved on this exact head.
THEMANnt commented 2026-10-28 04:26:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-28T04:26:35Z.

Review: APPROVED


Reviewed f25c397e16b8f4ef891f778d021deb373ad8d6cd — approve. Summary-file open/write failures are caught before a success summary is printed to stdout.

Windows/Python 3.11: head 22 passed (22 total); author base 21 passed (21 total). Three injected summary failures escape old production and follow the exit-2 diagnostic path on head. Existing sanitizer pass/fail accounting is retained. No sanitizer-instrumented product execution was performed locally.

The inspected hosted Windows relinker job merged this exact head and completed successfully. This is not a full product or game build.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5677783393 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12096#pullrequestreview-5677783393). Originally posted by [THEMANnt](https://github.com/THEMANnt) on 2026-10-28T04:26:35Z. **Review:** APPROVED --- Reviewed `f25c397e16b8f4ef891f778d021deb373ad8d6cd` — approve. Summary-file open/write failures are caught before a success summary is printed to stdout. Windows/Python 3.11: head 22 passed (22 total); author base 21 passed (21 total). Three injected summary failures escape old production and follow the exit-2 diagnostic path on head. Existing sanitizer pass/fail accounting is retained. No sanitizer-instrumented product execution was performed locally. The inspected hosted Windows relinker job merged this exact head and completed successfully. This is not a full product or game build.
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!12096
No description provided.