fix(tools): escape sanitizer report test names #12493

Merged
StoneDC merged 4 commits from upstream-pr/12493 into main 2026-11-10 09:57:53 +00:00
StoneDC commented 2026-10-28 15:54:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by StoneDC on 2026-10-28T15:54:22Z.


What

Render sanitizer test names containing table/Markdown control characters as literal encoded code spans, preserving ordinary names and failure accounting.

Integrate current main after prerequisite #12483 merged. Keep its explicit-failure precedence, summary-input alias protection, symlink-loop error handling and JSON output. No open prerequisite remains; the PR diff changes only the name renderer and its regression tests.

Cover all five summary tables, carriage-return-only names, literal backslashes, Markdown punctuation and ampersands. Add a real CLI regression combining contradictory skipped/failed JUnit entries with special names: JSON keeps the original names, Markdown appends safe literal cells, the source report stays unchanged, and unexpected failures still exit 1.

Tested

Exact tested head: 36bcf0ce9cc2efd9fc6bd47cc58a16d96519476d, including main d0913992db901fcf4cba0bcb7b9a81284080eda6 and merged prerequisite #12483 (53afb7481500f00bc9918fdb45bb2577708e4f06).

Windows 11 / MinGW GCC 15.2 / CMake 4.3.1 / Python 3.12.14 and 3.14.3; WSL Ubuntu 26.04 / GCC 15.2 / CMake 4.2.3 / Python 3.12.16 and 3.14.4. Separate Ninja Release configurations use ANYPS5_RELINKER_ONLY=ON, BUILD_TESTING=ON and each selected interpreter. The relinker builds successfully on both platforms.

  • ctest --test-dir BUILD -R '^(sanitizer_report|tools_sanitizer_json|test_script_registration)$' -V --output-on-failure --no-tests=error: all 3 registered groups pass in each of the four configurations. The two Python suites run 33 test methods; longest group is 2.20 seconds.
  • Linux executes without skips. Windows has two existing symbolic-link privilege subtest skips; the new CLI/name-rendering tests and explicit-failure-precedence tests execute on both platforms. No CTest group is skipped.
  • On Windows and Linux Python 3.14, keep the committed tests and substitute main's production script, remove only the carriage-return trigger, or permit raw punctuation in encoded cells. Each control fails the intended rendering assertions, with no import/setup errors. The committed implementation passes.
  • Python 3.9 grammar parsing, whitespace checks and current-main conventions with this full description pass. Production script registration is checked by the real registered CTest.

These are focused tool and relinker checks. No full system-library build, local macOS runtime, GitHub-renderer exercise, GPU validation or title run is claimed. Hosted CI for the updated head is reported separately after publication.

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:5053503784 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12493). Originally posted by [StoneDC](https://github.com/StoneDC) on 2026-10-28T15:54:22Z. --- ### What Render sanitizer test names containing table/Markdown control characters as literal encoded code spans, preserving ordinary names and failure accounting. Integrate current main after prerequisite #12483 merged. Keep its explicit-failure precedence, summary-input alias protection, symlink-loop error handling and JSON output. No open prerequisite remains; the PR diff changes only the name renderer and its regression tests. Cover all five summary tables, carriage-return-only names, literal backslashes, Markdown punctuation and ampersands. Add a real CLI regression combining contradictory skipped/failed JUnit entries with special names: JSON keeps the original names, Markdown appends safe literal cells, the source report stays unchanged, and unexpected failures still exit 1. ### 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. --> Exact tested head: `36bcf0ce9cc2efd9fc6bd47cc58a16d96519476d`, including main `d0913992db901fcf4cba0bcb7b9a81284080eda6` and merged prerequisite #12483 (`53afb7481500f00bc9918fdb45bb2577708e4f06`). Windows 11 / MinGW GCC 15.2 / CMake 4.3.1 / Python 3.12.14 and 3.14.3; WSL Ubuntu 26.04 / GCC 15.2 / CMake 4.2.3 / Python 3.12.16 and 3.14.4. Separate Ninja Release configurations use `ANYPS5_RELINKER_ONLY=ON`, `BUILD_TESTING=ON` and each selected interpreter. The relinker builds successfully on both platforms. - `ctest --test-dir BUILD -R '^(sanitizer_report|tools_sanitizer_json|test_script_registration)$' -V --output-on-failure --no-tests=error`: all 3 registered groups pass in each of the four configurations. The two Python suites run 33 test methods; longest group is 2.20 seconds. - Linux executes without skips. Windows has two existing symbolic-link privilege subtest skips; the new CLI/name-rendering tests and explicit-failure-precedence tests execute on both platforms. No CTest group is skipped. - On Windows and Linux Python 3.14, keep the committed tests and substitute main's production script, remove only the carriage-return trigger, or permit raw punctuation in encoded cells. Each control fails the intended rendering assertions, with no import/setup errors. The committed implementation passes. - Python 3.9 grammar parsing, whitespace checks and current-main conventions with this full description pass. Production script registration is checked by the real registered CTest. These are focused tool and relinker checks. No full system-library build, local macOS runtime, GitHub-renderer exercise, GPU validation or title run is claimed. Hosted CI for the updated head is reported separately after publication. ### 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: <!-- #PR, or none --> none - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> none - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> n/a - [x] AI-assisted: <!-- yes / no --> yes
MarcZX10 commented 2026-10-28 15:57:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T15:57:12Z.

Review: COMMENTED


I reviewed head f05b0d9608e6 and ran the focused sanitizer report test from a clean detached worktree on Linux/Python 3.11: relinker-only CMake configure succeeded and ctest -R ^sanitizer_report$ passed (1/1). tools/check_conventions.py --base upstream/main and tools/check_test_registration.py --scripts also passed. The helper preserves the existing backtick representation for ordinary names and switches special names to HTML code spans with Markdown-significant punctuation encoded; it is used in all five summary tables. The new test exercises failure, known-failure, recovered, and absent-name rows with pipes, backticks, line breaks, backslashes, angle brackets, ampersands, and Unicode. I found no correctness issue in this focused review. Eligibility passed; hosted conventions/intake/labels and the relinker matrix were still pending at my last check, so this comment is not an approval or a claim that hosted CI passed.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5685673308 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12493#pullrequestreview-5685673308). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T15:57:12Z. **Review:** COMMENTED --- I reviewed head `f05b0d9608e6` and ran the focused sanitizer report test from a clean detached worktree on Linux/Python 3.11: relinker-only CMake configure succeeded and `ctest -R ^sanitizer_report$` passed (1/1). `tools/check_conventions.py --base upstream/main` and `tools/check_test_registration.py --scripts` also passed. The helper preserves the existing backtick representation for ordinary names and switches special names to HTML code spans with Markdown-significant punctuation encoded; it is used in all five summary tables. The new test exercises failure, known-failure, recovered, and absent-name rows with pipes, backticks, line breaks, backslashes, angle brackets, ampersands, and Unicode. I found no correctness issue in this focused review. Eligibility passed; hosted conventions/intake/labels and the relinker matrix were still pending at my last check, so this comment is not an approval or a claim that hosted CI passed.
rooklz commented 2026-10-28 17:55:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-28T17:55:50Z.

Review: APPROVED


Reviewed head f05b0d9608 on macOS 26.2 (arm64). This was the first macOS run. All findings are from the host; no console was used.

  • test_sanitizer_report: OK on Python 3.9.6 and 3.13. 3.14 errors only because of a local Homebrew pyexpat breakage, which is environmental. Main's tools/sanitizer_report.py with the PR test is RED: 20 failures.
  • check_conventions --base upstream/main clean. merge-tree against main e4da19aff0 clean. The exact head also merge-trees cleanly with #12437 (the shared-file pair the bot could not compare). check_test_registration --scripts reports 212.
  • I used GitHub's own renderer (gh api markdown -f mode=gfm) as an oracle on the generated tables. With this head, a|b\|c, x|*em*, only\rcr, p|&lt;q and `t` each render as one <td><code> showing exactly the literal name.

Mutants (8): no-pipe-trigger, no-backtick-trigger and no-CR-escape are killed. Two survive, and the renderer shows that both change visible output:

  1. Dropping \r from the trigger set ("|\n"). only\rcrfalls back to backticks, and GFM splits the row into two table rows (``only / cr``). The test nameline\nnext\rreturnalways trips the\n` branch first, so CR-only names are never exercised.
  2. Leaving backslash/*/& unencoded in the <code> span. a|b\|c renders as a|b&#124;c, because \& becomes a Markdown escape, and x|*em* renders as <em>. html.unescape round-trips these unchanged, so the test can't tell.

The test-only diff below kills both (head OK on 3.9.6/3.13; mutant 1 RED 5, mutant 2 RED 15; main RED 25). It pins the documented "everything except alphanumerics and space is encoded":

-        names = ("one|two", "`fence`", "line\nnext\rreturn", "\\|<script>&中文")
+        names = ("one|two", "`fence`", "line\nnext\rreturn", "carriage\rreturn", "\\|<script>&中文*_")
@@
                     self.assertEqual(html.unescape(encoded), name.replace("\r", r"\r").replace("\n", r"\n"))
+                    self.assertRegex(encoded, r"\A(?:[^\W_]| |&#\d+;)*\Z")

Not blocking. The production code is correct; this only hardens the test. Nit: the local import html inside the test could live at module level.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5687301431 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12493#pullrequestreview-5687301431). Originally posted by [rooklz](https://github.com/rooklz) on 2026-10-28T17:55:50Z. **Review:** APPROVED --- Reviewed head `f05b0d9608` on macOS 26.2 (arm64). This was the first macOS run. All findings are from the host; no console was used. - `test_sanitizer_report`: OK on Python 3.9.6 and 3.13. 3.14 errors only because of a local Homebrew `pyexpat` breakage, which is environmental. Main's `tools/sanitizer_report.py` with the PR test is RED: 20 failures. - `check_conventions --base upstream/main` clean. `merge-tree` against main `e4da19aff0` clean. The exact head also merge-trees cleanly with #12437 (the shared-file pair the bot could not compare). `check_test_registration --scripts` reports 212. - I used GitHub's own renderer (`gh api markdown -f mode=gfm`) as an oracle on the generated tables. With this head, `a|b\|c`, `x|*em*`, `only\rcr`, `p|&lt;q` and `` `t` `` each render as one `<td><code>` showing exactly the literal name. Mutants (8): no-pipe-trigger, no-backtick-trigger and no-CR-escape are killed. Two survive, and the renderer shows that both change visible output: 1. Dropping `\r` from the trigger set (`"|`\n"`). `only\rcr` falls back to backticks, and GFM splits the row into two table rows (`` `only `` / `` cr` ``). The test name `line\nnext\rreturn` always trips the `\n` branch first, so CR-only names are never exercised. 2. Leaving backslash/`*`/`&` unencoded in the `<code>` span. `a|b\|c` renders as `a|b&#124;c`, because `\&` becomes a Markdown escape, and `x|*em*` renders as `<em>`. `html.unescape` round-trips these unchanged, so the test can't tell. The test-only diff below kills both (head OK on 3.9.6/3.13; mutant 1 RED 5, mutant 2 RED 15; main RED 25). It pins the documented "everything except alphanumerics and space is encoded": ```diff - names = ("one|two", "`fence`", "line\nnext\rreturn", "\\|<script>&中文") + names = ("one|two", "`fence`", "line\nnext\rreturn", "carriage\rreturn", "\\|<script>&中文*_") @@ self.assertEqual(html.unescape(encoded), name.replace("\r", r"\r").replace("\n", r"\n")) + self.assertRegex(encoded, r"\A(?:[^\W_]| |&#\d+;)*\Z") ``` Not blocking. The production code is correct; this only hardens the test. Nit: the local `import html` inside the test could live at module level.
THEMANnt commented 2026-10-29 06:45:33 +00:00 (Migrated from github.com)

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

Review: APPROVED


Reviewed 88e0f5154921cf3db0c5ef942f7685f171acd232 against 3a2b91981651569163768854a1fcdc7193b6667b. Markdown test names containing delimiters or line breaks are emitted as encoded code content across failed, known, recovered and absent-test tables. Ordinary names keep their inline-code rendering. The branch also gives explicit JUnit failure/error elements precedence over skip metadata. No actionable finding in this scoped review.

Windows/Python 3.11 validation: head 27 passed, 2 skipped; baseline 25 passed, 2 skipped. The new rendering/contradictory-status assertions fail on old production. Platform symbolic-link cases are skipped. This is report generation from fixture JUnit input, not a sanitizer execution.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5693847038 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12493#pullrequestreview-5693847038). Originally posted by [THEMANnt](https://github.com/THEMANnt) on 2026-10-29T06:45:33Z. **Review:** APPROVED --- Reviewed `88e0f5154921cf3db0c5ef942f7685f171acd232` against `3a2b91981651569163768854a1fcdc7193b6667b`. Markdown test names containing delimiters or line breaks are emitted as encoded code content across failed, known, recovered and absent-test tables. Ordinary names keep their inline-code rendering. The branch also gives explicit JUnit failure/error elements precedence over skip metadata. No actionable finding in this scoped review. Windows/Python 3.11 validation: head 27 passed, 2 skipped; baseline 25 passed, 2 skipped. The new rendering/contradictory-status assertions fail on old production. Platform symbolic-link cases are skipped. This is report generation from fixture JUnit input, not a sanitizer execution.
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!12493
No description provided.