Skip to content

feat(diagrams): add raster fixtures for pixel-only recovery - #3

Open
MannXo wants to merge 1 commit into
xberg-io:mainfrom
MannXo:feat/diagram-raster-fixtures
Open

feat(diagrams): add raster fixtures for pixel-only recovery#3
MannXo wants to merge 1 commit into
xberg-io:mainfrom
MannXo:feat/diagram-raster-fixtures

Conversation

@MannXo

@MannXo MannXo commented Aug 11, 2026

Copy link
Copy Markdown

Twelve raster fixtures. Ten redraw a graph that also ships as SVG, against the same ground truth,
so SVG, vector PDF and raster can be scored apart.

Raster is the container that keeps least. A vector PDF still holds path operators and positioned
glyphs; a PNG holds pixels, so the shapes and the text both have to be recovered before a graph
can be inferred at all.

Built by scripts/build_diagram_rasters.py, which mirrors build_diagram_pdfs.py and has the
same --check. Determinism comes free here. Neither engine writes a tIME chunk or anything
else derived from the clock, so two runs agree byte for byte with no normalisation step.

Two engines, named in each filename because the engine and not the source decides the pixels.
Mermaid cannot go through cairo for the reason you already documented for the PDF set. That
failure is silent, since the file is valid and only the text is missing, so
test_diagram_manifest.py now asserts that a fixture drawn from a <foreignObject> source is
built by Skia rather than leaving it to whoever edits the recipe next.

graphviz_cjk ships here. A PNG holds an image of text rather than the outlines that drew it, so
no font is redistributed and the fsType question does not arise, which recovers CJK, Hebrew and
Arabic coverage for the one container that had lost it. Flagging rather than assuming, since the
call is yours.

Everything is drawn at 2x. A caption set around 12px sits near the floor of what OCR reads
reliably at 1:1, and a benchmark should not be measuring a resampling artefact.

PNGs are bucket-managed and still need publishing. corpus.lock.json is unchanged, so the twelve
pin assertions fail exactly as the ten PDF ones already do on main. Files ready to hand over.

Twelve PNG fixtures built by a recorded, byte-reproducible command. Ten
redraw a graph that also ships as SVG, against the same ground truth, so
SVG, vector PDF and raster can be scored apart.

Raster is where nothing is left. Vector PDF still holds path operators
and positioned glyphs; a PNG holds pixels, so shapes and text both have
to be recovered before a graph can be inferred at all.

Two engines, named in each filename because the engine and not the source
decides the pixels. Mermaid cannot go through cairo for the same reason
it cannot in the PDF set: librsvg does not render <foreignObject>, so a
cairo copy carries the whole drawing and none of its labels. That failure
is silent, since the file is valid and only the text is missing, so a
test asserts any fixture drawn from a <foreignObject> source is built by
Skia rather than leaving it to whoever edits the recipe next.

Determinism comes free here. Neither engine writes a tIME chunk or
anything else clock-derived, so unlike the PDFs there is no
normalisation step and --check compares raw bytes.

No font is redistributed: a PNG holds an image of text rather than the
outlines that drew it, so the fsType question the PDF builder answers
does not arise. That is why graphviz_cjk ships as raster while it cannot
ship as PDF, which recovers CJK, Hebrew and Arabic coverage for the one
container that had lost it.

Everything is drawn at 2x, since a caption set around 12px sits near the
floor of what OCR reads reliably at 1:1.

PNGs are bucket-managed and still need publishing; corpus.lock.json is
unchanged, so the twelve pin assertions fail until that lands, exactly as
the ten PDF assertions do.
@MannXo

MannXo commented Aug 11, 2026

Copy link
Copy Markdown
Author

the ci failures are not related to this PR, all failures stem from test_should_index_a_corpus_binary_that_the_lock_file_pins

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