test: guard the layered template surface against PDFBox and engine leaks#290
Merged
Conversation
The layered template packages (templates.core / cv / coverletter / invoice / proposal / data) compose against the canonical DSL and are backend-neutral by construction, but nothing enforced it — the PDFBox-isolation and engine-leak guards both scanned the rest of the public surface while skipping templates. That gap is what let the old CanonicalTemplateComposerPdfBoundaryTest (which only covered the removed templates.support composers) disappear with no replacement. Add document/templates as a scanned root to both existing guards: PdfBackendIsolationGuardTest (no org.apache.pdfbox references) and PublicApiNoEngineLeakTest (no com.demcha.compose.engine imports). The surface is clean today, so both pass; a preset or component that reached for a PDFBox or engine type would now fail the build, naming the file. Tests: ./mvnw verify -pl . — 1378 tests, 0 failures. Verified negatively by injecting a PDFBox reference into a preset and watching the guard fail.
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 layered template packages (
templates.{core,cv,coverletter,invoice,proposal,data}) are backend-neutral and engine-clean by construction — but nothing enforced it. Both architectural guards scanned the rest of the public surface while skippingdocument.templates, which is exactly how the oldCanonicalTemplateComposerPdfBoundaryTest(it only covered the now-removedtemplates.supportcomposers, #278) vanished with no replacement.What
Extend the two existing guards with
document/templatesas a scanned root (no new near-duplicate test):PdfBackendIsolationGuardTest— noorg.apache.pdfbox.*imports or references. Javadoc updated to name the template surface.PublicApiNoEngineLeakTest— noimport com.demcha.compose.engine.*.The surface is clean today, so both pass. A preset or component that reached for a PDFBox or engine type would now fail the build, naming the offending file.
Tests
./mvnw verify -pl .— 1378 tests, 0 failures. Negatively verified: injectingorg.apache.pdfbox.*intoModernInvoicemakesPdfBackendIsolationGuardTestfail and report the file; reverted.