Skip to content

test(printing): establish cross-renderer receipt parity and regression contract - #451

Merged
khaira777 merged 2 commits into
mainfrom
fm/flocafe-439-parity
Aug 22, 2026
Merged

khaira777 merged 2 commits into
mainfrom
fm/flocafe-439-parity

Conversation

@khaira777

Copy link
Copy Markdown
Contributor

Intent

Land the salvaged printing parity-contract work as a PR resolving issue #439, the first merge of epic #438. The work was pre-written by the captain as commit 28970f8 on local branch test/printing-parity-contract (exists nowhere else) and is already committed on feature branch fm/flocafe-439-parity, rebased onto origin/main (origin/main equals the branch base a14323c, so no drift; the #450 printing changes are not yet merged). The change adds tests/print-parity.test.ts - a semantic (not byte-level) cross-renderer receipt parity and regression contract covering all three renderers: backend ESC/POS formatReceipt, frontend WebUSB receipt encoders, and browser web-print HTML, across classic/compact templates at 32/42/48 columns - with LEGACY markers documenting today's skip-with-warning handling of unsupported scripts for the multilingual print epic, plus exported shared fixtures for later epic issues; package.json gains test:print-parity wired into the test chain after test:printer-migrations. Local validation: npm run test:print-parity green (208 assertions, 0 failed), npm run lint clean except one pre-existing unrelated warning in frontend/src/lib/api.ts. Delivery requirements: PR title 'test(printing): cross-renderer receipt parity contract'; PR body references Fixes #439 and Refs #438; never push to the default branch; never merge the PR; when CI green open the PR if the pipeline has not, then post exactly ONE concise comment on issue #439 linking the PR and describing coverage (captain authorized that single issue update); no other public comments.

What Changed

Final changed paths and statuses:

M	package.json
A	tests/print-parity.test.ts

Risk Assessment

✅ Low: Test-only change adding a parity contract that exercises real renderer APIs across all three print paths; no production code modified, no runtime behavior changed.

Testing

Installed frontend npm dependencies (required for @point-of-sale/receipt-printer-encoder used by frontend receipt-encoder module), then ran npm run test:print-parity which exercised all renderer × template × column-width combinations (backend 12 combos, WebUSB 9 combos, browser HTML 4 combos) totaling 208 semantic assertions with 0 failures. Also verified the exported buildParityFixtures function is importable and returns correct fixture data, and confirmed test:print-parity is correctly positioned after test:printer-migrations in the test chain.

Evidence: test:print-parity full output (208 assertions, 0 failed)

> [email protected] test:print-parity
> ts-node --transpile-only -P tests/tsconfig.json tests/print-parity.test.ts


▶ Backend classic @ 32 cols
[Printer] formatReceipt - template: classic
[Printer] formatReceipt - order: ORD-PARITY-001 bill: INV-PARITY-001
[Printer] formatReceipt - items count: 3 cols: 32

▶ Backend classic @ 32 cols — reprint
[Printer] formatReceipt - template: classic
[Printer] formatReceipt - order: ORD-PARITY-001 bill: INV-PARITY-001
[Printer] formatReceipt - items count: 3 cols: 32

▶ Backend classic @ 42 cols
[Printer] formatReceipt - template: classic
[Printer] formatReceipt - order: ORD-PARITY-001 bill: INV-PARITY-001
[Printer] formatReceipt - items count: 3 cols: 42

▶ Backend classic @ 42 cols — reprint
[Printer] formatReceipt - template: classic
[Printer] formatReceipt - order: ORD-PARITY-001 bill: INV-PARITY-001
[Printer] formatReceipt - items count: 3 cols: 42

▶ Backend classic @ 48 cols
[Printer] formatReceipt - template: classic
[Printer] formatReceipt - order: ORD-PARITY-001 bill: INV-PARITY-001
[Printer] formatReceipt - items count: 3 cols: 48

▶ Backend classic @ 48 cols — reprint
[Printer] formatReceipt - template: classic
[Printer] formatReceipt - order: ORD-PARITY-001 bill: INV-PARITY-001
[Printer] formatReceipt - items count: 3 cols: 48

▶ Backend compact @ 32 cols
[Printer] formatReceipt - template: compact
[Printer] formatReceipt - order: ORD-PARITY-001 bill: INV-PARITY-001
[Printer] formatReceipt - items count: 3 cols: 32

▶ Backend compact @ 32 cols — reprint
[Printer] formatReceipt - template: compact
[Printer] formatReceipt - order: ORD-PARITY-001 bill: INV-PARITY-001
[Printer] formatReceipt - items count: 3 cols: 32

▶ Backend compact @ 42 cols
[Printer] formatReceipt - template: compact
[Printer] formatReceipt - order: ORD-PARITY-001 bill: INV-PARITY-001
[Printer] formatReceipt - items count: 3 cols: 42

▶ Backend compact @ 42 cols — reprint
[Printer] formatReceipt - template: compact
[Printer] formatReceipt - order: ORD-PARITY-001 bill: INV-PARITY-001
[Printer] formatReceipt - items count: 3 cols: 42

▶ Backend compact @ 48 cols
[Printer] formatReceipt - template: compact
[Printer] formatReceipt - order: ORD-PARITY-001 bill: INV-PARITY-001
[Printer] formatReceipt - items count: 3 cols: 48

▶ Backend compact @ 48 cols — reprint
[Printer] formatReceipt - template: compact
[Printer] formatReceipt - order: ORD-PARITY-001 bill: INV-PARITY-001
[Printer] formatReceipt - items count: 3 cols: 48

▶ WebUSB classic @ 58mm

▶ WebUSB classic @ 80mm

▶ WebUSB compact @ 58mm

▶ WebUSB compact @ 80mm

▶ WebUSB reprint banner

▶ Browser HTML @ thermal58

▶ Browser HTML @ thermal80

▶ Browser HTML reprint banner

========================================================
Parity contract: 208 assertions passed, 0 failed

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • npm run test:print-parity
  • ts-node --transpile-only -P tests/tsconfig.json -e "const { buildParityFixtures } = require('./tests/print-parity.test'); ..." (export verification)
  • grep test:printer-migrations.*test:print-parity package.json (ordering check)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@greptile-apps

greptile-apps Bot commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds a semantic receipt-parity test suite across the backend, WebUSB, and browser-print renderers and wires it into the root test chain.

  • Covers classic and compact receipt templates across supported printer widths.
  • Adds shared parity fixtures and regression coverage for normal and reprint receipts.
  • Declares the receipt encoder at the root so the suite works after a root-only install.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
tests/print-parity.test.ts Adds shared receipt fixtures and semantic parity coverage for backend, WebUSB, and browser HTML rendering.
package.json Registers the parity suite in the root test chain and adds the encoder dependency required by its frontend imports.
package-lock.json Locks the newly declared receipt encoder and its transitive dependencies.

Reviews (3): Last reviewed commit: "test(printing): root dep for parity suit..." | Re-trigger Greptile

Comment thread package.json Resolved
Comment thread tests/print-parity.test.ts Resolved
@khaira777 khaira777 changed the title chore: update pull request test(printing): establish cross-renderer receipt parity and regression contract Aug 22, 2026
khaira777 added a commit that referenced this pull request Aug 22, 2026
…ertions

- Declare @point-of-sale/receipt-printer-encoder at the repo root so a
  root-only npm ci && npm test resolves test:print-parity without needing
  frontend/node_modules (greptile P1).
- Scope every amount assertion in tests/print-parity.test.ts to its own
  labeled row (Subtotal/Discount/TOTAL) so unrelated digits elsewhere in
  the receipt cannot satisfy them (greptile P2).

Fixes review findings on PR #451.
Adds tests/print-parity.test.ts, a semantic (not byte-level) contract
covering all three receipt renderers: desktop ESC/POS formatReceipt,
WebUSB receipt encoders, and browser web-print HTML. Asserts items,
totals, discount, payments, reprint banners and business headers across
classic/compact templates at 32/42/48 columns.

Documents current skip-with-warning behavior for unsupported scripts as
LEGACY markers for the multilingual print epic (#438), including the
WebUSB quirk where '…'-truncated long names are dropped whole.

Shared fixtures are exported for reuse by later epic issues.
…ertions

- Declare @point-of-sale/receipt-printer-encoder at the repo root so a
  root-only npm ci && npm test resolves test:print-parity without needing
  frontend/node_modules (greptile P1).
- Scope every amount assertion in tests/print-parity.test.ts to its own
  labeled row (Subtotal/Discount/TOTAL) so unrelated digits elsewhere in
  the receipt cannot satisfy them (greptile P2).

Fixes review findings on PR #451.
@khaira777
khaira777 force-pushed the fm/flocafe-439-parity branch from 293df1c to 01fcdd2 Compare August 22, 2026 05:29
@khaira777
khaira777 merged commit 00506da into main Aug 22, 2026
13 checks passed
@khaira777
khaira777 deleted the fm/flocafe-439-parity branch August 22, 2026 05:40
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.

test(printing): establish cross-renderer receipt parity and regression contract

1 participant