test(qa): hold every template's DOCX export to a Word baseline - #808
Merged
Merged
Conversation
…red through a private Word instance
…t names, and fail an unknown fidelity mode
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.
Why
The DOCX fidelity gate (#805, #807) holds the export to LibreOffice's setting of it. Word is the editor the export answers to, and it sets text differently from LibreOffice: a sidebar CV LibreOffice sets 3pt off throughout stands where the page puts it in Word. CI cannot run Word, so nothing held the export to Word's setting.
What changed
DocxFidelityCorpusTesthas two more modes,exportandword, besideslibreoffice.exportwrites each preset's PDF and DOCX, and stops.wordmeasures Word's PDFs intarget/docx-fidelity/wordagainstword-windows.tsv. It first re-exports every document, and measures a document only when the SHA-256 its conversion recorded is that of the DOCX this tree exports (WordConversion). A conversion left from another tree fails and names the documents that changed; it is not measured in the new tree's place. A missingconversion.json, or one naming no Word build, is refused.libreofficeandexportclearengine/first, so a preset no longer in the corpus leaves no DOCX behind.scripts/docx-visual/word-fidelity.ps1runs the three steps:export;convert-with-word.ps1, through a private hidden Word instance that records its version;word, with-Updateto rewrite the baseline.Run it from PowerShell (pwsh). Word driven through COM from a process Git Bash started has stalled on its first document, so Word is not driven from the build.
convert-with-word.ps1records each DOCX's SHA-256 beside its PDF, and repaginates before it exports, as Word settles pagination on screen.word-windows.tsv/-lines.tsv: the Word baseline, taken with Word 16.0 (16.0.20430). It holds 4,154 of the corpus's 4,328 lines; 322 drift past 2pt.OrangeOpsis set on 2 pages against the page's 1.Docs.
CONTRIBUTING.mdsays to run the script before a DOCX export change is opened.CHANGELOG.mdhas a Tests entry.Verification
DocxFidelityGateTest(18 tests, +2). A conversion record written asconvert-with-word.ps1writes it (UTF-8 with a BOM, an upper-case digest) reads back its build. It matches the DOCX exported again, and not one with a byte changed or a document it never converted. A missing record, or one with no build, is refused.export, thenwordwith no new conversion, fails on the document Word converted from other DOCX:["cv-navy_sidebar"].cv-navy_sidebar: 2 lines are no longer found ("increased website traffic…", "strategy.").libreofficemode still passes against its baseline. With no mode set, the corpus test is skipped;-Dgraphcompose.docxFidelity=Wordfails../mvnw -B -ntp clean verify -pl :graph-compose-core,:graph-compose-render-pdf,:graph-compose-render-docx,:graph-compose-render-pptx,:graph-compose-templates,:graph-compose-testing,:graph-compose-qa,:graph-compose-coverage -amgives BUILD SUCCESS (qa 1811).Known limits
OrangeOpsis barely held. Word sets it on 2 pages and finds 6 of its 108 lines: 102 of the 174 lines the baseline does not hold.Lane: test (qa) and scripts.