Skip to content

Formancy Report's example draws its sample's own Swiss QR Code, encoded as Report encodes it (0244) - #361

Merged
sharkysan merged 1 commit into
mainfrom
feat/the-report-example-draws-the-swiss-qr-code
Nov 26, 2026
Merged

sharkysan merged 1 commit into
mainfrom
feat/the-report-example-draws-the-swiss-qr-code

Conversation

@sharkysan

Copy link
Copy Markdown
Owner

The paid-modules card on the landing page and /products/report/ both drew an empty square with only the Swiss cross where the Swiss QR Code belongs (0242). It read as unfinished, and the owner asked: "there is no qr code on the sample invoice?" Report's own published sample, invoice-en.png, already carries the real code. Its data is harmless: SIX's example QR-IBAN, which no bank books, on an invented firm's bill.

What changes

  • The code itself. swiss-qr-code.tsx encodes PAYLOAD with uqr pinned at exactly 0.1.3, using the options Report's swissSymbol uses (level M, no quiet zone, no boost, version 25 at most). It draws the code as Report's swissCodeContent does: one path of runs and SIX's cross over the centre, as inline SVG with no style attribute.
    • PAYLOAD is the text Report's runtime writes for invoice-en, read from Report's main (81405cb) on 2026-11-26. It is 31 lines; the code is version 11, 61×61 modules.
  • Its size. Each module is 0.125rem, so 2 CSS px at the default text size, on both the card and the page. That is a whole number of screen pixels at a device pixel ratio of 1 or 2.
  • The page's slip. It now prints what the code carries:
    • receipt: account and creditor, reference, debtor, currency and amount, and the acceptance point;
    • payment part: the same, plus the additional information;
    • above the slip, SIX's "Separate before paying in" (IG 3.7).
    • The payment part's words stay beside the code down to a stage width of 22rem.
  • Captions. They say this is the code Report's sample carries, drawn with the encoder Report uses, that the firm and the customer are invented, and that the account is SIX's example QR-IBAN, which no bank books.
  • Share card. Report's og.png was taken again the way docs/images/README.md describes.
  • Docs. New record 0244. 0242 is marked superseded in part. The index, the arc42 building blocks, verification and risks sections, and CHANGELOG are updated, and the unreleased 0242 entry no longer says the code is left undrawn.

How it is held

  • site.test.tsx:
    • the drawn modules equal uqr's encoding of PAYLOAD, in black;
    • a reader in src/testing/read-qr.ts that shares no code with uqr reads them back to PAYLOAD at level M;
    • version 11, mask 2 and an FNV-1a fingerprint of the 3,600 modules outside the cross. These were taken from Report's published PNG with ZXing, so a uqr that encodes the text differently fails even though every uqr-derived test passes;
    • the white cross: 7 mm of the 46, at the centre.
  • product-page.test.tsx:
    • the card and the page draw the same SVG;
    • every printed slip value is derived from PAYLOAD;
    • the separation notice, the parts' titles and the acceptance point are there.
  • Browser gate: every module is at least 1.5 CSS px and a whole number of pixels, and nothing comes within SIX's 5 mm quiet zone. Checked at five widths on both pages.

Each new guard was seen to fail on a planted fault, and each file was put back byte for byte. 0244 lists the failure messages.

Cost

Measured 2026-11-26, gzip at level 9:

HTML JS
Landing page +3,499 +536
/products/report/ +3,490 +4,410

The landing page's JS grows so little because uqr was already there through @formancy/react. Committing a generated module instead would have cost about 1 kB more JS on the landing page and about 2.8 kB less on Report's page.

Not covered by any gate

  • Nobody has scanned the code with a phone. ZXing read Chromium screenshots at DPR 1 (card and page at 320, 560 and 1280 px, plus the share card) as the payload. No gate repeats that reading.
  • Nothing re-reads Report's repository, so if Report's sample changes, the drawing goes stale and nothing fails.

…ed as Report encodes it (0244)

The landing page's Report card and /products/report/ drew an empty square with only the Swiss cross where the
QR-bill's code goes, which read as unfinished. They now draw the code Report's sample carries: the payload
Report's runtime writes for invoice-en, encoded with uqr pinned at exactly 0.1.3 using Report's options and drawn
as Report's renderer draws it, at 2 CSS pixels a module. Report's page prints on its slip what the code carries,
under SIX's notice to separate it before paying in. The tests hold the drawing to the payload, to a reader that
shares no code with uqr, and to a fingerprint of Report's published picture. The slip's words are held to the
payload, and the browser gate checks the module size and the quiet zone. The share card was taken again.
0242 is superseded in part.
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 86.52482% with 19 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
apps/site/src/testing/read-qr.ts 81.9% 8 Missing and 11 partials ⚠️

📢 Thoughts on this report? Let us know!

@sharkysan
sharkysan merged commit eb37d80 into main Nov 26, 2026
15 checks passed
@sharkysan
sharkysan deleted the feat/the-report-example-draws-the-swiss-qr-code branch November 26, 2026 19:58
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.

2 participants