Skip to content

fix(print): reflow pack receipt columns for XL - #1381

Merged
khaira777 merged 3 commits into
mainfrom
fm/flocafe-thermal-xl-column-reflow
Oct 26, 2026
Merged

khaira777 merged 3 commits into
mainfrom
fm/flocafe-thermal-xl-column-reflow

Conversation

@khaira777

@khaira777 khaira777 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1368

Intent

Fix the P1 release-readiness regression from PR #1358 (#1358) at main/printers/thermal.ts:2216: reflow pack columns before halving receipt width. Extra-large text halves the layout width while retaining the pack's original column widths, and the renderer then truncates entire financial columns with no warning (reproduced: quantity 2, item amount $24.68, and VAT $1.23 disappear). Recalculate configured column widths before rendering, and extend tests beyond profile selection to render the resulting receipt and verify those values appear intact.

What Changed

  • Reflow tax-pack template lineItems and taxSummary column widths in selectTemplateRenderProfile() when enlarged text narrows the target column count below the selected profile width.
  • Rebalance per-row item and summary column widths in pluginItemRows(), pluginLineItemColumns(), and pluginSummaryRow() so right-aligned quantities, rates, and amounts fit without truncating financial values.
  • Export renderPluginReceipt(), document extra-large tax-pack column reflow in docs/architecture/printing.md, and extend tests/printer-text-size.test.ts to verify rendered receipt output preserves item quantities, rates, amounts, and tax summary values across all text sizes.

Risk Assessment

✅ Low: The change cleanly reflows pack line-item and tax-summary column widths when extra-large text halves the receipt layout width, preserving normal/large layouts and verifying rendered ESC/POS output across all text sizes.

Testing

Ran the printer text-size, receipt column oracle, receipt column width, receipt printing, and bills print API suites plus a full backend build, then stood up the live Express API server with an isolated SQLite database and a local TCP ESC/POS thermal printer listener to drive preview and live network printing across 80mm (48-col) and 58mm (32-col) country-pack receipts at normal, large, and extra_large text sizes; this backend thermal ESC/POS change has no browser UI changes, and the decoded ESC/POS transcripts and cell-width measurements were captured in the evidence artifact with all checks passing.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Operator configures an 80mm (48-column) network thermal printer with extra-large text size and an installed country-pack receipt template, then previews and prints a bill via POST /api/printers/print-… ✅ pass live ~/.no-mistakes/evidence/01M5WHHH2Y93RD33GRCZY09K3C/live-pack-receipt-reflow-evidence.txt
Operator configures the 80mm (48-column) network thermal printer with normal and large text sizes and prints the same country-pack receipt via POST /api/printers/print-bill; the original 48-column pac… ✅ pass live ~/.no-mistakes/evidence/01M5WHHH2Y93RD33GRCZY09K3C/live-pack-receipt-reflow-evidence.txt
Adversarial narrow-width boundary: operator configures a 58mm (32-column) network thermal printer with extra-large text size (16 layout columns) and prints a country-pack bill containing a long wrappi… ✅ pass live ~/.no-mistakes/evidence/01M5WHHH2Y93RD33GRCZY09K3C/live-pack-receipt-reflow-evidence.txt
Evidence: Live Express server and TCP network thermal printer ESC/POS receipt reflow verification transcript

=== Scenario 1: 80mm (cols-48) Pack Receipt with text_size=extra_large (halved to 24 layout cols) === API Preview Response: status=200, columns=24, warnings=[] API Live Print Response: status=200, success=true, warnings=[] TCP ESC/POS Payload: 649 bytes, measured maxCells=48/48, unconsumedControlBytes=0 Item Row: "Coffee 2 $12.34 $24.68" VAT Row: "VAT @5% $1.23" --- Full Decoded Receipt --- FLO TEST CAFE === TAX INVOICE === Invoice #: INV-20260421-0002 Date: 4/21/2026 Time: 6:30:00 AM ------------------------ ITEM QTY RATE AMOUNT ------------------------ Coffee 2 $12.34 $24.68 ------------------------ Subtotal $30.00 VAT @5% $1.23 === TOTAL $31.23 ------------------------ Cash $31.23 === Thank you! === Scenario 3 (Adversarial): 58mm (cols-32) Pack Receipt with text_size=extra_large (16 layout cols) & Long Wrapping Item + $124.68 Amount === API Preview Response: status=200, columns=16, warnings=[] API Live Print Response: status=200, success=true, warnings=[] TCP ESC/POS Payload: 710 bytes, measured maxCells=32/32, unconsumedControlBytes=0 Item First Row: "Artis 2 $124.68" VAT Row: "VAT @5% $6.23"

=== Scenario 1: 80mm (cols-48) Pack Receipt with text_size=extra_large (halved to 24 layout cols) ===
API Preview Response: status=200, columns=24, warnings=[]
API Live Print Response: status=200, success=true, warnings=[]
TCP ESC/POS Payload: 649 bytes, measured maxCells=48/48, unconsumedControlBytes=0
Item Row: "Coffee   2 $12.34 $24.68"
VAT Row:  "VAT @5%            $1.23"
--- Full Decoded Receipt ---
FLO TEST CAFE
========================
TAX INVOICE
========================
Invoice #: INV-20260421-0002
Date: 4/21/2026
Time: 6:30:00 AM
------------------------
ITEM   QTY   RATE AMOUNT
------------------------
Coffee   2 $12.34 $24.68
------------------------
Subtotal          $30.00
VAT @5%            $1.23
========================
TOTAL             $31.23
------------------------
Cash              $31.23
========================
Thank you!


Powered by FloPOS
(flopos.com)

=== Scenario 2 (normal): 80mm (cols-48) Pack Receipt with text_size=normal (48 layout cols preserved) ===
API Preview Response: status=200, columns=48, warnings=[]
API Live Print Response: status=200, success=true, warnings=[]
TCP ESC/POS Payload: 979 bytes, measured maxCells=48/48
Item Row: "Coffee                      2  $12.34     $24.68"
VAT Row:  "VAT @5%                                    $1.23"
--- Full Decoded Receipt ---
FLO TEST CAFE
================================================
TAX INVOICE
================================================
Invoice #: INV-20260421-0002
Date: 4/21/2026
Time: 6:30:00 AM
------------------------------------------------
ITEM                      QTY    RATE     AMOUNT
------------------------------------------------
Coffee                      2  $12.34     $24.68
------------------------------------------------
Subtotal                                  $30.00
VAT @5%                                    $1.23
================================================
TOTAL                                     $31.23
------------------------------------------------
Cash                                      $31.23
================================================
Thank you!


Powered by FloPOS (flopos.com)

=== Scenario 2 (large): 80mm (cols-48) Pack Receipt with text_size=large (48 layout cols preserved) ===
API Preview Response: status=200, columns=48, warnings=[]
API Live Print Response: status=200, success=true, warnings=[]
TCP ESC/POS Payload: 979 bytes, measured maxCells=48/48
Item Row: "Coffee                      2  $12.34     $24.68"
VAT Row:  "VAT @5%                                    $1.23"
--- Full Decoded Receipt ---
FLO TEST CAFE
================================================
TAX INVOICE
================================================
Invoice #: INV-20260421-0002
Date: 4/21/2026
Time: 6:30:00 AM
------------------------------------------------
ITEM                      QTY    RATE     AMOUNT
------------------------------------------------
Coffee                      2  $12.34     $24.68
------------------------------------------------
Subtotal                                  $30.00
VAT @5%                                    $1.23
================================================
TOTAL                                     $31.23
------------------------------------------------
Cash                                      $31.23
================================================
Thank you!


Powered by FloPOS (flopos.com)

=== Scenario 3 (Adversarial): 58mm (cols-32) Pack Receipt with text_size=extra_large (16 layout cols) & Long Wrapping Item + $124.68 Amount ===
API Preview Response: status=200, columns=16, warnings=[]
API Live Print Response: status=200, success=true, warnings=[]
TCP ESC/POS Payload: 710 bytes, measured maxCells=32/32, unconsumedControlBytes=0
Item First Row: "Artis  2 $124.68"
VAT Row:        "VAT @5%    $6.23"
--- Full Decoded Receipt ---
FLO TEST CAFE
================
TAX INVOICE
================
Invoice #: INV-20260421-0003
Date: 4/21/2026
Time: 7:00:00 AM
----------------
ITEM  QTY    AMT
----------------
Artis  2 $124.68
anal            
Singl           
e               
Origi           
n               
Pour            
Over            
----------------
Subtotal
$124.68
VAT @5%    $6.23
================
TOTAL    $130.91
----------------
Cash     $130.91
================
Thank you!


Powered by
FloPOS
(flopos.com)

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.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Operator configures an 80mm (48-column) network thermal printer with extra-large text size and an installed country-pack receipt template, then previews and prints a bill via POST /api/printers/print-… ✅ pass live ~/.no-mistakes/evidence/01M5WHHH2Y93RD33GRCZY09K3C/live-pack-receipt-reflow-evidence.txt
Operator configures the 80mm (48-column) network thermal printer with normal and large text sizes and prints the same country-pack receipt via POST /api/printers/print-bill; the original 48-column pac… ✅ pass live ~/.no-mistakes/evidence/01M5WHHH2Y93RD33GRCZY09K3C/live-pack-receipt-reflow-evidence.txt
Adversarial narrow-width boundary: operator configures a 58mm (32-column) network thermal printer with extra-large text size (16 layout columns) and prints a country-pack bill containing a long wrappi… ✅ pass live ~/.no-mistakes/evidence/01M5WHHH2Y93RD33GRCZY09K3C/live-pack-receipt-reflow-evidence.txt
  • npm run test:printer-text-size
  • npm run test:receipt-column-oracle
  • npm run test:receipt-column-width
  • npm run test:receipt-printing
  • npm run test:bills-print-api
  • npm run build
  • Live Express API (POST /api/printers, PUT /api/printers/:id, PUT /api/settings/bill_template, POST /api/printers/print-bill) + TCP ESC/POS thermal printer socket verification across 48-col and 32-col profiles at normal, large, and extra_large text sizes
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Reflow configured line-item and tax-summary column widths in selectTemplateRenderProfile when extra_large text halves the layout width so right-hand financial values stay intact instead of being clipped off the right edge.

Fixes #1368
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • 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

Comment @coderabbitai help to get the list of available commands.

@khaira777 khaira777 changed the title fix(main): reflow tax-pack receipt columns for extra-large text fix(print): reflow pack receipt columns for XL Oct 26, 2026
@khaira777
khaira777 enabled auto-merge (squash) October 26, 2026 19:33
@khaira777
khaira777 merged commit bfbac5d into main Oct 26, 2026
23 checks passed
@khaira777
khaira777 deleted the fm/flocafe-thermal-xl-column-reflow branch October 26, 2026 19:39
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.

fix(printing): extra-large text size truncates tax-pack receipt columns

1 participant