Skip to content

Reconnect canonical template layout snapshots to an active assertion #675

Description

@DemchaAV

What

qa/src/test/resources/layout-snapshots/canonical-templates/cv-v2/*.json (and the
coverletter-v2/ siblings) exist and are committed, but nothing reads them.
TemplateTestSupport.assertCanonicalSnapshot(...) — both overloads, at
qa/src/test/java/com/demcha/compose/document/templates/TemplateTestSupport.java:131
and :139 — has zero callers.

So those exact layout snapshots currently provide no regression protection at all.

Why it matters

The only gate left on canonical template geometry is pixel parity, and its budget is
large on purpose: CvV2VisualParityTest.PIXEL_DIFF_BUDGET = 50_000 mismatched pixels
at per-channel tolerance 8, sized for cross-platform PDFBox font rendering drift
between Windows-recorded baselines and Linux CI.

A budget that wide cannot substitute for an exact layout assertion. It is calibrated
for rendering noise, so a real geometry regression of a few points can sit inside it
and go unreported.

This was noticed while reviewing the letter-spacing work: the spaced-caps migration
moved nine CV presets and eight cover letters, and the full reactor gate stayed green
throughout. The deltas turned out to be 0.40%–1.83% of the page, comfortably inside
the budget — which is the point. Had the change been wrong rather than intended,
nothing would have said so.

Suggested shape

Give the canonical-template suites an exact layout-snapshot assertion alongside the
pixel one, so the pair works the way it does elsewhere in the repo: the snapshot
catches geometry exactly, and the pixel budget covers what the snapshot cannot see
(fills, colours, glyph rasterisation). Either wire the existing JSON files back into
a test, or delete them if the coverage is genuinely meant to live elsewhere — leaving
committed fixtures nothing asserts against is the worst of the three options.

Not blocking

Pre-existing, and unrelated to any one change. Deliberately left out of the
letter-spacing PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions