Skip to content

fix(render): name the QR error-correction level - #651

Open
LKSNDRTMLKV wants to merge 1 commit into
mainfrom
fix/474-qr-error-correction
Open

LKSNDRTMLKV wants to merge 1 commit into
mainfrom
fix/474-qr-error-correction

Conversation

@LKSNDRTMLKV

Copy link
Copy Markdown
Member

Closes #474.

Both carrier renderers called QrCode::new, which in qrcode 0.14 encodes at error-correction level M. Nobody chose M here; it was the library default, so a dependency update could have changed it with nothing noticing. The quiet zone had the same history until QR_QUIET_ZONE_MODULES gave it one home.

What changes

  • QR_ERROR_CORRECTION, set to EcLevel::M, sits beside QR_QUIET_ZONE_MODULES in crates/dpp-render/src/carrier.rs and is re-exported the same way. Its doc comment explains the choice: M survives roughly 15% of the symbol's codewords being damaged, which suits a URL on a clean label.
  • Both renderers pass the constant to QrCode::with_error_correction_level. They are the passport page's SVG (build_qr_svg) and the resolver's PNG route (qr_png). Neither calls QrCode::new any more.
  • The level was already M, so a printed label does not change.
  • Two doc comments said "QR/Data Matrix", but no Data Matrix is rendered anywhere. They are carrier_uri and the publish-side carrier URL builder, and both now say QR.

Whether a label that can be scuffed, such as a battery or a care label, needs Q or H, and whether a second symbology is needed, both wait for EN 18220 (#434).

Tests

Each renderer has a geometry test, in the same style as the quiet-zone tests:

  • the_svg_symbol_is_drawn_at_the_level_m_width (crates/dpp-render/src/page.rs);
  • the_png_symbol_is_drawn_at_the_level_m_width (crates/dpp-resolver/src/handlers/resolve_qr.rs).

Both use a 77-byte GS1 Digital Link carrying AI 10 and 21. At L, M and Q its symbol is version 4, 5 and 6 respectively, so each level draws a different width. Each test first asserts that premise and then checks that the rendered size frames M's width. The existing quiet-zone test builds its expected symbol through the constant.

Checked

  • The gate: just check green on this branch: 1931 tests passed, 3 skipped, audit included.
  • The two crates on their own: dpp-render 65 tests passed, dpp-resolver 174.
  • Bite tests. Each renderer was set to L and then to Q, and its test failed every time:
    • the SVG viewBox came out 164 or 196 against M's 180;
    • the PNG came out 328 or 392 px against 360.

@LKSNDRTMLKV LKSNDRTMLKV added this to the v0.17.0 milestone Nov 19, 2026
@LKSNDRTMLKV LKSNDRTMLKV added type/defect Something published or encoded here is wrong or unbackable now urgency/backlog Owed, unscheduled surface/registry Moves EU registry enrolment or the unique product identifier epic/public-surfaces What a reader sees: resolver, public reads, data carriers, public page review-ready Opt this PR into a CodeRabbit review labels Nov 19, 2026
@coderabbitai

coderabbitai Bot commented Nov 19, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 39 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between d41f31d and 32a562b.

Files selected for processing: 6

  • CHANGELOG.md
  • crates/dpp-render/src/carrier.rs
  • crates/dpp-render/src/lib.rs
  • crates/dpp-render/src/page.rs
  • crates/dpp-resolver/src/handlers/resolve_qr.rs
  • crates/dpp-vault/src/domain/service/publish.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

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

Labels

epic/public-surfaces What a reader sees: resolver, public reads, data carriers, public page review-ready Opt this PR into a CodeRabbit review surface/registry Moves EU registry enrolment or the unique product identifier type/defect Something published or encoded here is wrong or unbackable now urgency/backlog Owed, unscheduled

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The QR error-correction level is the library default, and a doc comment promises a Data Matrix nothing renders

1 participant