Skip to content

The shop's own words reach the bottom of its own bill - #847

Merged
sridharkalaibala merged 3 commits into
developfrom
fix/the-shop-footer-reaches-the-bill
Sep 17, 2026
Merged

sridharkalaibala merged 3 commits into
developfrom
fix/the-shop-footer-reaches-the-bill

Conversation

@sridharkalaibala

Copy link
Copy Markdown
Contributor

Found while checking a live restaurant's print settings before a handover.

footer_print is a box on the printing settings screen. That shop had "Thanking You / Visit Again" saved in it, and every bill it handed a guest said "Thank you, please visit again" — the generic line the renderer falls back to.

Nothing had failed. escpos-receipt reads sale.footer and always has. bill-payload never set it: the word "footer" did not appear in that file at all. A setting written, stored, offered on a screen, and read by nobody.

That is the fourth of this exact shape found today, after the module packaged where nothing could require it (#830), the guard whose regex could never match (#831), and the settings save that never moved its watermark (#838).

The fix

One field, trimmed, empty lines dropped, capped at four lines of sixty-four characters. It is free text on a document a customer keeps, printed on a roll that does not stop, so a paste accident should cost a line rather than a roll of paper. CRLF from a Windows textarea is handled without caring which arrived.

The test that would have caught it

7 tests, and the last is the important one: it reads every sale.<field> out of the renderer and asks the payload for each one, because the gap between those two files is where this keeps happening.

It immediately found six more the renderer reads and nothing feeds: cashier, branch, payments, change, itemCount, totalWeight. They are named in the test rather than quietly allowed, because a named gap is the opposite of this bug. Two are honestly conditional — a BILL is unpaid, so payments and change have nothing to say. The other four are branches waiting for a caller.

The comment on that list says: shrink it, never grow it.

api 11,113 pass. Desktop 2842 pass.

footer_print is a box on the printing settings screen. A restaurant had
"Thanking You / Visit Again" saved in it and handed every guest a bill
saying "Thank you, please visit again" - the generic line the renderer
falls back to.

Nothing had failed. escpos-receipt reads sale.footer and always has.
bill-payload never set it; the word "footer" did not appear in that file
at all. A setting written, stored, offered on a screen, and read by
nobody. The fourth of this shape found today.

Trimmed, empty lines dropped, and capped at four lines of sixty-four
characters: it is free text on a document a customer keeps, printed on a
roll that does not stop, so a paste accident should cost a line rather
than a roll of paper. CRLF from a Windows textarea is handled without
caring which arrived.

7 tests, and the last one is the one that matters: it reads every
sale.<field> out of the renderer and asks the payload for each. That
sweep is what would have caught this. It found six more the renderer
reads and nothing feeds - cashier, branch, payments, change, itemCount,
totalWeight - and they are NAMED in the test rather than quietly
allowed, because a named gap is the opposite of this bug. Two are
honestly conditional (a BILL is unpaid, so payments and change have
nothing to say); four are branches waiting for a caller. Shrink that
list, never grow it.
@sridharkalaibala
sridharkalaibala merged commit dcd6f89 into develop Sep 17, 2026
9 checks passed
@github-actions github-actions Bot added the ready for QA Merged to develop and live on develop.posnic.io - anyone can test it label Sep 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Merged to develop. Anyone can test this - you do not need write access.

Try it at https://develop.posnic.io, or run it yourself:

git fetch origin develop && git checkout develop
npm install && npm --prefix api install
npm run dev   # then http://localhost:3000

When you have tested it, say what you did and what happened, and set
QA passed or QA failed. If you cannot set labels, just comment -
a maintainer will.

Reporting that something is broken is as useful as fixing it. It is
better found here than by a shopkeeper.

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

Labels

ready for QA Merged to develop and live on develop.posnic.io - anyone can test it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant