fix bugs: stabilize htmlContent by normalizing tableRows whitespace/boundary events#1017
fix bugs: stabilize htmlContent by normalizing tableRows whitespace/boundary events#1017chihyu0917 wants to merge 1 commit into
Conversation
…space/boundary events
c594328 to
5f1344e
Compare
|
I rerun |
|
@chihyu0917 Where exactly does it fail? At least in our CI it succeeds reproducibly: https://github.com/apache/maven-doxia/actions/runs/19250318647... |
|
|
|
I am not comfortable with adding normalization without understanding where these differences stem from. But I can reproduce the issue with The test |
|
DEBUG info from NonDex So this inconsistency comes from Flexmark itself which assumes a specific order being returned by https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Class.html#getFields(). This is meanwhile fixed upstream (vsch/flexmark-java@bcfe84a) but the change is not yet released. |
Motivation
MarkdownParserTest#testHtmlContentwas brittle around HTML tables.Inside
<table><tbody>…</tbody></table>, the event stream intermittently included extra"text"whitespace nodes and"unknown"nodes (tbody boundary markers), which caused order-sensitive assertions to fail (e.g., expecting text but seeingtableRow/tableHeaderCell_). This is environmental/renderer dependent and shows up under different JDKs/runners and with NonDex.Design / Implementation
assertSinkEquals(...)block for this test with a compact normalization loop:tableRows…tableRows_.Scope is only
htmlContent; no production code touched, no new imports or dependencies.Reproduce the error
org.apache.maven.doxia.module.markdown.MarkdownParserTest.htmlContent -- Time elapsed: 0.869 s <<< FAILURE! org.opentest4j.AssertionFailedErrormvn -pl doxia-modules/doxia-module-markdown edu.illinois:nondex-maven-plugin:2.1.7:nondex -Dtest=org.apache.maven.doxia.module.markdown.MarkdownParserTest#htmlContentFollowing this checklist to help us incorporate your
contribution quickly and easily:
Note that commits might be squashed by a maintainer on merge.
This may not always be possible but is a best-practice.
mvn verifyto make sure basic checks pass.A more thorough check will be performed on your pull request automatically.
mvn -Prun-its verify).If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.