Repository navigation
fix: remediate KOT and tax-bill printing regressions - #615
Merged
Merged
Conversation
…nd warning assertion
Contributor
Greptile SummaryThe PR localizes KOT order types and tax-bill output while preserving completed-item filtering and refusing unsupported financial rows before thermal transport.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| main/printers/document-kot.ts | Filters completed KOT items and renders localized, capability-safe header metadata without leaving the previously reported omission reachable. |
| frontend/src/lib/printer/kot-encoder.ts | Localizes WebUSB KOT order types and preserves unsupported dynamic metadata with an ASCII-safe placeholder. |
| frontend/src/lib/printer/kot-web-print.ts | Adds escaped station metadata and localized order types to browser KOT output. |
| frontend/src/lib/printer/tax-bill-encoder.ts | Localizes raw dates and preflights complete amount-bearing rows so unsupported financial text triggers refusal before printing. |
| frontend/src/hooks/usePrinter.ts | Propagates resolved languages, KOT item subsets, and station metadata consistently across print transports. |
| main/routes/printers.ts | Filters completed items before explicit-station or automatically routed backend KOT dispatch. |
| shared/print/document.ts | Resolves localized KOT order-type concepts while retaining the raw code for thermal fallback. |
| tests/phase3-print-regressions.test.ts | Adds focused regression coverage for localization, filtering, metadata fallbacks, date handling, and financial-row refusal. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Print request] --> B{Document type}
B -->|KOT| C[Resolve KOT language]
C --> D[Exclude ready and served items]
D --> E{Transport}
E -->|Backend ESC/POS| F[Render localized headers]
E -->|WebUSB| G[Encode localized ticket]
E -->|Browser| H[Generate localized HTML]
F --> I[Use ASCII-safe metadata placeholder when required]
G --> I
B -->|Tax bill| J[Resolve receipt language]
J --> K[Localize raw date with safe fallback]
K --> L[Preflight complete financial rows]
L --> M{Unsupported financial text?}
M -->|Yes| N[Refuse before transport]
M -->|No| O[Send receipt]
Reviews (4): Last reviewed commit: "no-mistakes(document): Clarified KOT the..." | Re-trigger Greptile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Implement and ship the FloCafe Phase 3 remediation for the PR #560 KOT and tax-bill regressions. Preserve KOT order metadata, filtering, visibility, and localized order types across browser, backend thermal-safe, and WebUSB paths for en, es, de, tr, fil, fr, pt, and fa. Preserve tax-bill localized headers and raw dates while refusing unsupported amount-bearing rows before thermal transport, with no partial financial receipts. Keep this scope narrow: do not alter service charges, country packs, timezone architecture, currency precision, raster support, printer capability architecture, or unrelated UI. Captain decisions and constraints are part of the intent: generic non-shaping thermal KOT order types retain an explicit ASCII-safe fallback; dynamic non-ASCII KOT station, table, customer, and order identifiers must remain visible with explicit ASCII [UNSUPPORTED] placeholders rather than being silently omitted; synthetic print-test hardware must use the local encoder and explicit Kitchen labeling so it cannot print database order 1; broader automatic cross-transport station routing is reverted to the minimal station fix; browser/system receipts retain active UI-language behavior. This is a follow-up on PR #615 after its branch was updated to current main: preserve all existing pipeline commits, address the Greptile metadata finding, use the supported no-mistakes rebase/sync flow for the current PR, and do not hand-rebase, force-push, discard history, or merge until validation and review requirements are satisfied. After this PR is merged, pause before starting any other work.
What Changed
Risk Assessment
🚨 High: Two changed paths contradict explicit acceptance criteria and require human-approved behavior decisions before merge.
Testing
Installed locked dependencies temporarily, exercised KOT behavior across all eight locales and browser/backend/WebUSB paths, validated tax-bill localization and financial refusal before transport, checked printer/routing/API/document contracts, captured and visually inspected rendered receipt artifacts, then removed disposable node_modules. All targeted checks passed; no linters or full-suite tests were run.
~/.no-mistakes/evidence/01M1JHBKKADANRVMFZVVX1BFF0/browser-receipts/01_persian_receipt_rial_persian_digits.png)~/.no-mistakes/evidence/01M1JHBKKADANRVMFZVVX1BFF0/browser-receipts/04_persian_receipt_reprint_tax_persian.png)Evidence: Rendered receipt HTML
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
main/printers/document-kot.ts:126- WitharabicShapingenabled, unsupported non-Arabic metadata is not replaced. For example, stationCaféremainsStation: Café, thenbuildEscPosrejects the line and emits no[UNSUPPORTED]placeholder. The frontend helper has the same issue. Shaping should allow only supported Arabic-only lines; other unsupported metadata must retain visibility via the ASCII placeholder.frontend/src/hooks/usePrinter.ts:395- A normal POS call without an explicit station, such asprintKot(order, { items: order.items }), getsKitchenin browser output but no station line over WebUSB: the browser branch defaults at line 395 while the WebUSB branch forwards onlyopts?.stationNameat line 370. Decide whether the minimal station fix should apply the same fallback to both transports.🔧 Fix: Fix shaped KOT metadata placeholders; focused test unavailable
2 errors still open:
frontend/src/hooks/usePrinter.ts:135-usePrinter.ts:135and the tax-browser fallback at line 272 pass the fixed receipt policy toprintWebBill, so browser receipts can ignore the active UI language. This contradicts the required criterion that browser/system receipts retain active UI-language behavior.frontend/src/app/(dashboard)/print-test/page.tsx:95- The synthetic KOT test still calls the generalprintKotpath. With hardware configured, it poststestOrder.id(hardcoded to 1) to the backend, which can print real database order 1. This contradicts the requirement that synthetic print-test hardware use the local encoder and explicit Kitchen labeling.✅ **Test** - passed
✅ No issues found.
npm run test:print-labelsnpm run test:print-paritynpm run test:bills-print-apinpm run test:issue-134-routingnpm run test:printernpm run test:browser-receiptsnpm run test:receipt-printingnpm run test:print-documentVisual inspection of Persian receipt PNG evidencegit diff --checkand finalgit status --short --branch✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.