Repository navigation
build(docx): count render-docx in the coverage aggregate and gate its Stable API with japicmp - #1020
Merged
Merged
Conversation
… Stable API with japicmp render-docx ran its tests without the JaCoCo agent and was outside the coverage aggregate, and japicmp did not diff it, so the Stable members of DocxSemanticBackend could break in a 2.x minor with every check green. Coverage: the module's pom runs prepare-agent at the pinned JaCoCo version, and coverage/pom.xml depends on it, unpacks its classes and merges its exec. The module measures 96.90% instructions and 85.00% branches; the aggregate rises from 93.99% / 77.52% to 94.88% / 81.37%; the floors are unchanged. VersionConsistencyGuardTest holds the agent version and, in a new test, each measured module to its dependency, unpacked classes, merged exec and agent. japicmp: one execution against the 2.x floor, 2.0.0, as the engine's gate does, excluding only @internal and failing on a baseline it cannot resolve. The pull-request job (also run on render-docx/src/** and its pom), the publish workflow and cut-release.ps1 Step 5b diff it beside core and templates; in cut-release.ps1 only Step 5b's -pl, report and baseline lists change. BinaryCompatibilityGateGuardTest and VersionConsistencyGuardTest hold the wiring and the pin, and the guard now also checks Step 5b's baseline list. docs/api-stability.md says a member that becomes Stable after 2.0.0 is not held by a floor-only diff.
The Step 5b baseline check requires each gated module's entry to read its own pom's pin property; the coverage guard requires compile scope on each measured dependency and the qa suites' exec in the merge. api-stability.md says "every pin", and names graduating the DOCX @beta API to Stable (ROADMAP.md) instead of a stage name no public doc defines.
CodeQL read the AssertJ not-null checks as no check at all and flagged the dereference after them. An explicit AssertionError says which execution coverage/pom.xml lost, and no path reaches a null.
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
graph-compose-render-docxwas invisible to both release guards:graph-compose-coveragedid not list it, so the Word export had no coverage figure and its classes were outside the ratchet.docs/api-stability.mdpromises that constructingDocxSemanticBackendand callingsession.export(backend, path)"stays the Stable path", but nothing checked it, so the class, its no-argument constructor,name()andexport(...)could break in a 2.x minor with CI green.Measured before choosing the gate's shape: render-docx 2.5.0-SNAPSHOT against the published 2.0.0 and 2.4.1 reports additions only. With
@Betaexcluded, both read "No changes". Its public API did not change between 2.0.0 and 2.4.1, and everything added in 2.5 is@Beta. So no Stable signature is broken today, and a diff against the 2.x floor holds exactly the Stable surface.What changed
Coverage aggregate
render-docx/pom.xmlrunsjacoco-maven-pluginprepare-agentat the pinnedjacoco.plugin.version, as render-pdf and templates do.coverage/pom.xmldepends on render-docx, unpacks its classes for the check, and mergesrender-docx/target/jacoco.exec. Floors stay 0.875 / 0.68.VersionConsistencyGuardTest.jacocoPluginVersionAgreesAcrossModulesnow holds render-docx's agent version too.VersionConsistencyGuardTest.coverageAggregateReadsEveryMeasuredModuleholds each measured module (core, render-pdf, render-docx, templates) to all four inputs: its dependency, its unpacked classes, its merged exec, and the agent in its own pom. All four are read from the parsed pom, so a commented-out line counts as missing. It also requires compile scope on each measured dependency (report-aggregateskips a test-scope one) and the qa suites' exec in the merge. None of the four fails when it is missing. JaCoCo's merge skips an absent exec, and a module dropped from every list is simply not reported while the aggregate still clears its floors.japicmp gate for render-docx
japicmpprofile inrender-docx/pom.xml: one execution,japicmp-against-baseline, againstjapicmp.baseline=2.0.0, like the engine's gate. It excludes only the@Internalmarker, setsignoreMissingOldVersion=false, and fails on binary breaks; source breaks are report-only.ci.yml, thebinary-compatjob:render_docxpath filter (render-docx/src/**,render-docx/pom.xml) in its condition;graph-compose-render-docxbefore resolving;:graph-compose-render-pdf,:graph-compose-render-docxto-pl. render-pdf is there only because render-docx compiles against it; it has no profile;test -sfor the new report, and uploads it.publish.yml: the same cache drop,-pland report check.scripts/cut-release.ps1: only Step 5b's three lists change —-pl,$japicmpReportsand$japicmpBaselines(the 2.0.0 pin) — plus the one line that readsrender-docx/pom.xmlfor that pin, and Step 5b's header comment, which now names render-docx.BinaryCompatibilityGateGuardTestfinds every pom with ajapicmpprofile and requires the release-time run to diff it, check its report and drop its cached baseline, so the cut checks render-docx before the tag as it checks core. The guard now also checks the baseline list, which it did not before: each gated module's entry must read its own pom's pin property. Step 3a and theUpdate-Japicmp*pin-moving functions are untouched: the floor does not move inside 2.x.BinaryCompatibilityGateGuardTest:REQUIRED_EXECUTIONSandCACHED_ARTIFACTS;@Internal. They are renamedtheTemplatesAndDocxGates….VersionConsistencyGuardTest: render-docx'sjapicmp.versionlockstep and its pin inJAPICMP_BASELINE_PINS, so the pin cannot name the version being built.docs/api-stability.md(Binary-compatibility enforcement): render-docx is gated against the floor; the four Stable members are named. Like the engine's floor pin, this one will need a decision when 3.0 opens. It also says that a member that becomes Stable after 2.0.0 is not held by a floor-only diff, and that guarding one with a previous-release baseline belongs to graduating the DOCX@BetaAPI to Stable, whichROADMAP.mdlists as still open after 2.5.docs/contributing/release-process.md(Step 5b),CONTRIBUTING.md,CHANGELOG.md(Build), and comments inci.yml,coverage/pom.xml,templates/pom.xmland the post-2.0 roadmap's coverage section are updated to match. Thecoverage/pom.xmlcomment now says the floors trail the aggregate, and leaves raising them to a separate ratchet step.No public API changes, so the knowledge pack is unchanged.
Verification
clean verifyover core … coverage): BUILD SUCCESS, "All coverage checks have been met" over 1227 classes (1073 before)../mvnw -B -ntp -DskipTests -P japicmp clean verify -pl :graph-compose-core,:graph-compose-templates,:graph-compose-render-pdf,:graph-compose-render-docxgave BUILD SUCCESS in 48 s. All four reports were written, includingrender-docx/target/japicmp/japicmp-against-baseline.xml.DocxSemanticBackend()package-private fails the same command with tests skipped (-Dmaven.test.skip=true). japicmp itself fails it: "There is at least one incompatibility: … DocxSemanticBackend():CONSTRUCTOR_LESS_ACCESSIBLE". File restored byte-identical.BinaryCompatibilityGateGuardTest7,VersionConsistencyGuardTest24,CiGateCoverageGuardTest3,CiGuardListGuardTest1,PublishTrainGuardTest7 — 0 failures.-pl, condition, report check and cache drop; publish-pland report check;cut-release.ps1-pl, render-docx baseline entry removed, that entry reading the core pom, and the templates previous-release entry removed;ignoreMissingOldVersion=true; an extra package exclude; report-only (breakBuild…=false); baseline set to the working version;japicmp.versiondrift.GATE PASS— reactorclean verify(core 843, render-pdf 339, render-docx 2545, templates 128, qa 1910; 0 failures; coverage ratchet met), the four knowledge checks, core javadoc, install and the examples tests (93). The last commit changes only the null checks incoverageAggregateReadsEveryMeasuredModule(CodeQL); that test class was re-run, 24/0.cut-release.ps1itself, by instruction;release-script-check.ymlcovers it on CI.