fix(test): the JUnit report drops every character XML forbids - #874
Open
thegoodengineer wants to merge 1 commit into
Open
fix(test): the JUnit report drops every character XML forbids#874thegoodengineer wants to merge 1 commit into
thegoodengineer wants to merge 1 commit into
Conversation
`stripXmlIllegal` cites XML 1.0 section 2.2 and then enforces only the lower
bound of its `Char` production:
#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
That leaves the two upper holes open: the surrogate block, and the
noncharacters U+FFFE and U+FFFF.
U+FFFF is the one that actually breaks a reader. A `<testcase name="...">`
carrying it is rejected by a real parser with "disallowed character", which is
precisely the outcome this function exists to prevent: the function's own
comment says an unparseable document means "CI shows nothing instead of showing
the failure". A lone surrogate is the milder half, since writing the file as
UTF-8 turns it into U+FFFD, but it is illegal by the same clause and dropping it
keeps the rule one thing rather than two.
The check is now the whole production, still stated as codes rather than a regex
character class for the reason the original comment gives. Astral characters,
U+FFFD itself, tabs, newlines and carriage returns are untouched, and a valid
surrogate PAIR is unaffected because iteration has already resolved it to one
astral code point.
Signed-off-by: Abhijeet Sharma <meetabhijeet05@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
stripXmlIllegalcites XML 1.0 section 2.2 and then enforces only the lower bound of itsCharproduction:That leaves the two upper holes open: the surrogate block, and the noncharacters U+FFFE and U+FFFF.
U+FFFF is the one that actually breaks a reader. A
<testcase name="...">carrying it is rejected outright by a real parser:which is precisely the outcome this function exists to prevent. Its own comment says an unparseable document means "CI shows nothing instead of showing the failure", and that is what happens: the run looks empty rather than red.
A lone surrogate is the milder half. Writing the file as UTF-8 turns it into U+FFFD, so it corrupts a character rather than killing the parse. I checked that rather than assuming, and I am not claiming it as a parse failure. It is illegal by the same clause though, and dropping it keeps the rule one thing rather than two.
No issue filed; found while reading
packages/test.How it was verified
packages/test/src/junit.char-range.test.ts, written RED first. Four cases fail onmain(U+FFFF, U+FFFE, and a lone surrogate either side), and the rest pin what must not change:The existing
junit.test.tspasses unchanged.The check stays stated as codes rather than a regex character class, for the reason the original comment gives: a class covering control characters trips
no-control-regexand needs the rule turned off to read.Gates run
pnpm lint && pnpm typecheck && pnpm test:unitpnpm test:e2epnpm gate:installpnpm test:e2e:desktopOne pure function in the CI reporter: no tool surface, no wire contract, no observer, nothing an install runs.
format:check,build,lintandtypecheckare green, andpackages/testis 18/18 files passing.Checklist
any, no free strings, no non-null!console.logor internal tracking codesCHANGELOG.mdupdated under[Unreleased]