Repository navigation
fix(print): incremental KOT & 58mm legibility - #1451
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
PR Summary by QodoFix incremental KOTs, companion print gating, and thermal legibility
AI Description
Diagram
High-Level Assessment
Files changed (12)
|
Code Review by Qodo
1.
|
…epping test assertions
…nd and Server App bill printing
34d52de to
64b8096
Compare
Intent
Fix the three high-priority printing and tableside ordering issues reported by merchants before the next release:
KOT print failedtoast on HTTP 403 and must not print an Order Slip or pop up the browser print dialog even if the user logged into the companion app is an owner or manager.XP-58): increase the item/amount font size and contrast onthermal58andthermal80browser-printed receipts and order slips (#000solid black ink, 12px/13px item rows, full-width tax/payment tables, no gray background shading) so 203-DPI Windows GDI thermal drivers print crisp, readable item rows and amounts.What Changed
added_item_idsandadded_itemsfromPOST /api/orders/:id/items, includeditemson active table orders inmain/routes/tables.ts, and forwardedorder.itemsinusePrinterStore.printKotso appending items from the POS or Orders screen prints an incremental KOT containing only the newly added items.KOT print failedtoast on HTTP403in the Server Companion App (frontend/src/app/server-standalone/page.tsx) and gatedPOST /api/printers/print-billinmain/server-app.tsonisServerBillPrintingEnabled()so disabled KOT or Server App bill printing no longer triggers false errors or unwanted order slip print dialogs.thermal58andthermal80browser print styles infrontend/src/lib/printer/web-print.tsandfrontend/src/lib/printer/order-slip-web-print.tsto use#000text and borders, transparent table headers,12px/13pxitem row font sizes, and full-width tax/payment tables, along with API reference updates and regression coverage intests/issue-1442-kot-and-58mm-print.test.ts.Risk Assessment
✅ Low: All three merchant printing and tableside ordering fixes, along with the prior review round's addon contrast and behavioral test updates, are well-bounded and verified against the codebase contracts.
Testing
Built the backend and frontend, ran
npm run test:issue-1442,npm run test:script-coverage, and the Playwrightkot-append-only-print.spec.tstest, and drove all three user-intent scenarios live in Chromium against the running Main API (:3001) and Server Companion App (:3003) with visual screenshot and JSON payload evidence; all checks and live scenarios passed.Evidence: Captured incremental /api/printers/print-kot payloads from POS floor map and Orders screen
{ "orderId": 1, "orderNumber": "ORD-20261104-0001", "initialOrderItem": { "id": 1, "product_name": "E2E Coffee" }, "posFloorMapAppendKotPayload": { "orderId": 1, "items": [{ "id": 2, "product_name": "E2E Croissant", "quantity": 1 }] }, "ordersScreenAppendKotPayload": { "orderId": 1, "items": [{ "id": 3, "product_name": "E2E Matcha Latte", "quantity": 1 }] } }Evidence: Server Companion App HTTP 403 responses across Owner, Manager, and Server roles
[ { "role": "owner", "url": "/api/printers/print-kot", "status": 403, "body": { "error": "KOT printing is disabled for this business" } }, { "role": "owner", "url": "/api/printers/print-bill", "status": 403, "body": { "error": "Bill printing is disabled for the Server Companion App. An owner or manager can enable it in Settings." } }, { "role": "manager", "url": "/api/printers/print-kot", "status": 403, "body": { "error": "KOT printing is disabled for this business" } }, { "role": "manager", "url": "/api/printers/print-bill", "status": 403, "body": { "error": "Bill printing is disabled for the Server Companion App. An owner or manager can enable it in Settings." } }, { "role": "server", "url": "/api/printers/print-kot", "status": 403, "body": { "error": "KOT printing is disabled for this business" } }, { "role": "server", "url": "/api/printers/print-bill", "status": 403, "body": { "error": "Bill printing is disabled for the Server Companion App. An owner or manager can enable it in Settings." } } ]Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 2 issues found → auto-fixed ✅
frontend/src/lib/printer/order-slip-web-print.ts:59-frontend/src/lib/printer/order-slip-web-print.ts:59still styles addon rows withcolor:#444;instead of inheriting#000solid black ink from.order-slip(frontend/src/lib/printer/order-slip-web-print.ts:72), leaving order-slip addon lines and prices gray on 203-DPI thermal drivers in contrast toweb-print.ts:584,598which sets.text-muted, .text-italic { color: #000; }. Removecolor:#444;on line 59 so addon rows render in solid#000.tests/issue-1442-kot-and-58mm-print.test.ts:286-tests/issue-1442-kot-and-58mm-print.test.ts:286-321usesfs.readFileSyncto regex/substring-match implementation source files (frontend/src/app/(dashboard)/pos/page.tsx,frontend/src/app/(dashboard)/orders/page.tsx, andfrontend/src/app/server-standalone/page.tsx) fordata.added_items,printKot, andif (status === 403) return;, violating the repository Test-quality rule against source-content-only assertions. Remove thosefs.readFileSyncsource-grepping assertions and replace them with executable behavioral assertions (for example, invokingusePrinterStore.getState().printKotor/api/printers/print-kotwithappendRes.data.added_itemsto verify only the newly added items are sent/printed, and testingPOST /api/printers/print-kotthrough the Server App whenkot_printing_enabledis'false'across roles).🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
npm run test:issue-1442npm run test:script-coveragecd frontend && npx playwright test e2e/kot-append-only-print.spec.ts --config=playwright.config.ts --project=chromium -g "adding an item to an occupied table only prints the newly appended item on KOT"Live Chromium E2E validation of POS floor map append (handleAddCartToOrderandhandlePlaceOrder) and Orders screenAdd Itemsmodal incremental KOT printing (/api/printers/print-kotpayload inspection + screenshots)Live Chromium E2E validation of Server Companion App (:3003/server-standalone) acrossowner,manager, andserverroles withkot_printing_enabled=falseandserver_app_bill_printing_enabled=falseLive Chromium rendering and computed-style verification ofthermal58andthermal80browser-printed receipts and 58mm/80mm Order Slips✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
Fixes #1442