Skip to content

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

Merged
oneandonlydean merged 4 commits into
boykopovar:mainfrom
StoneDC:fix/b20-sanitizer-markdown-names
Nov 10, 2026
Merged

oneandonlydean merged 4 commits into
boykopovar:mainfrom
StoneDC:fix/b20-sanitizer-markdown-names

Conversation

@StoneDC

@StoneDC StoneDC commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

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

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@oneandonlydean oneandonlydean self-assigned this Oct 28, 2026

@rooklz rooklz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@JJenkx

JJenkx commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Windows run of this head (88e0f51549), merged onto main 52c09d567d (clean merge, local only). Windows 11 Enterprise 10.0.22621, Python 3.15.1, python -m unittest tools/tests/test_sanitizer_report.py; this machine can create symbolic links.

  • This PR: 29 tests pass, 3 of 3 runs.
  • Negative control: with tools/sanitizer_report.py put back to main's version and this PR's tests kept, the 2 new tests test_explicit_failures_override_skipped_and_disabled_statuses, test_names_remain_literal_in_every_summary_table fail.

AI-assisted: yes (Claude Code).

@THEMANnt THEMANnt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@StoneDC StoneDC mentioned this pull request Oct 29, 2026
12 tasks done
@StoneDC

StoneDC commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Review-fix follow-up for head 88e0f5154921cf3db0c5ef942f7685f171acd232.

Integrated prerequisite #12483 at 53afb74 while retaining both literal-name rendering and explicit-failure precedence, plus main's summary/input alias protection. Strengthened the fixture with a carriage-return-only name and independent encoding assertions for backslashes, Markdown punctuation and ampersands.

Recorded validation at this exact head: the registered sanitizer_report group passes on Windows/Linux (29 Python tests; two existing Windows symlink-privilege skips, none on Linux). Both rendering and contradictory-failure regressions execute. Removing either the carriage-return trigger or the literal-character encoding makes the production-shadow control fail its assertions on both OSes. Conventions, whitespace, registration and skip-policy checks pass. #12483 remains a declared prerequisite; no local GitHub-renderer run is claimed.

The local validation above was recorded for this exact PR head; this comment supplies the missing follow-up summary. Detailed commands and scope remain in the PR description.

Hosted-check snapshot checked on 2026-10-30 for this head: 8 passed, 4 skipped; no failures. Current checks. Skipped checks are excluded from the pass count.

AI-assisted: yes.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 9, 2026
@StoneDC

StoneDC commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor Author

Updated to 36bcf0ce9cc2efd9fc6bd47cc58a16d96519476d with main d0913992db901fcf4cba0bcb7b9a81284080eda6 now that #12483 is merged. The obsolete open prerequisite is removed from the description.

The combined implementation preserves explicit failure precedence, input-alias protection, symlink-loop handling and JSON output. Added a real CLI regression: special JUnit names remain unchanged in JSON, appended Markdown renders literal cells, contradictory skipped/failed cases exit 1, and the input is not modified.

Validation on the exact published head:

  • Windows and Linux relinker builds pass.
  • Python 3.12 and 3.14 on both platforms: all 3 focused CTest groups pass (sanitizer_report, tools_sanitizer_json, test_script_registration), with 33 Python test methods per configuration; slowest group 2.20 s.
  • Linux has no skips. Windows retains two existing symbolic-link privilege subtest skips; the changed regressions run on both platforms.
  • Main-code and two targeted rendering mutants fail the intended assertions on both platforms. Current-main conventions, Python 3.9 grammar and whitespace checks pass.

Please recheck the updated head. Fresh hosted CI is tracked below; historical-head results are not substituted for it.

AI-assisted: yes.

Fresh hosted CI for 36bcf0ce9cc2efd9fc6bd47cc58a16d96519476d is complete: 7 passed checks, 6 intentionally skipped jobs, no failures or pending checks.

Skipped jobs are the unchanged full-runtime/platform-specific jobs excluded by the tools-only change eligibility gate. They are not counted as passes.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 10, 2026
@oneandonlydean
oneandonlydean merged commit 00bbf3e into boykopovar:main Nov 10, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants