← board

reportlab mimic: fidelity against the real oracle

The gap

The mimic's acceptance was "output matching the reportlab output". What was demonstrated is that a reportlab-using nilpy program compiles, runs, and writes a %PDF-1.3 whose text pdftotext extracts.

Validity is not agreement. A PDF can be structurally valid and still place text at the wrong baseline, pick a different font metric, or lay out a wrapped paragraph differently. Nothing has compared our bytes, or our rendering, to what real reportlab produces from the same script.

Shape

Same pattern as the other differential probes (devdocs/dev/differential-probes.md): one script, two implementations, compare.

Start with the cases the parallel-canvas work already exercised, since the screen-vs-PDF fidelity fixes there (baseline anchor, PIXEL font sizes, per-word placement) are exactly the class of divergence this would catch.

Why it is worth doing rather than assuming

The mimic implements a drawing API by reimplementation, not by wrapping — every metric, default and coordinate convention is an independent guess that happens to look right. Those are silent-divergence conditions, and this repo's experience is that plausible-looking output is where the expensive bugs live.

Gate

A differential harness exists and runs; a documented set of scripts agrees with the reportlab oracle on extracted text and glyph positions within a stated tolerance; divergences are either fixed or ticketed with the measurement.