Skip to content

test: guard the layered template surface against PDFBox and engine leaks#290

Merged
DemchaAV merged 1 commit into
2.0-devfrom
test/2.0-template-pdfbox-boundary
Jul 3, 2026
Merged

test: guard the layered template surface against PDFBox and engine leaks#290
DemchaAV merged 1 commit into
2.0-devfrom
test/2.0-template-pdfbox-boundary

Conversation

@DemchaAV

@DemchaAV DemchaAV commented Jul 3, 2026

Copy link
Copy Markdown
Owner

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 skipping document.templates, which is exactly how the old CanonicalTemplateComposerPdfBoundaryTest (it only covered the now-removed templates.support composers, #278) vanished with no replacement.

What

Extend the two existing guards with document/templates as a scanned root (no new near-duplicate test):

  • PdfBackendIsolationGuardTest — no org.apache.pdfbox.* imports or references. Javadoc updated to name the template surface.
  • PublicApiNoEngineLeakTest — no import 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: injecting org.apache.pdfbox.* into ModernInvoice makes PdfBackendIsolationGuardTest fail and report the file; reverted.

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.
@DemchaAV DemchaAV merged commit 66956ff into 2.0-dev Jul 3, 2026
11 checks passed
@DemchaAV DemchaAV deleted the test/2.0-template-pdfbox-boundary branch July 3, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant