Skip to content

feat(print): add 76mm impact printer support - #1502

Merged
khaira777 merged 10 commits into
mainfrom
fm/flocafe-impact-printer-support
Nov 7, 2026
Merged

khaira777 merged 10 commits into
mainfrom
fm/flocafe-impact-printer-support

Conversation

@khaira777

@khaira777 khaira777 commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Implement native 76mm impact printer support (escpos-impact-76, cols-32, raster.enabled: false, partial cut, 64mm printable width), extended Latin fallback transliteration, raster capability guards for receipt logos and QR codes, OS printer compatibility classification, database migration 125 (printers.profile_id), and Settings -> Printers profile onboarding across all 32 supported locales.

Fixes #1481

What Changed

  • Added the escpos-impact-76 32-column printer profile (raster.enabled: false, cutMode: 'partial', 64mm printable width) and narrowed epson-tm-series matching so TM-U* impact, TM-L* label, and non-TM Epson queues are not misclassified as 48-column thermal raster printers.
  • Guarded GS v 0 raster logo and GS ( k QR code emissions behind rasterCapabilityEnabled(capabilities) across receipt, merchant copy, payment ticket, and browser/WebUSB encoders, and expanded normalizeThermalText fallback transliteration with extended Latin foldings and Unicode NFD diacritic stripping on Latin characters.
  • Added database migration 125 (printers.profile_id), backend profile validation/resolution and OS printer compatibility classification (escpos_thermal | escpos_impact | driver_only), and Settings -> Printers UI for explicit profile selection, driver-only warnings with 1-click Browser print switching, and localized strings across all 32 supported locales.

Risk Assessment

✅ Low: The 76mm impact printer profile, Latin fallback transliteration, logo/QR capability guards (including WebUSB, preview, and native extended-Latin wrapping paths), OS printer compatibility classification, database migration 125, settings UI onboarding, translations, documentation, and tests are well-bounded and conform to the stated intent without regressions.

Testing

Exercised the focused impact-printer test suite, receipt column oracle, database upgrade-path migration 125 checks, script-coverage, i18n parity across all locales, documentation checks, and the live Playwright Chromium E2E flow for Settings -> Printers (e2e/qa-settings-receipts-printers.spec.ts), capturing visual screenshots of detected impact and driver_only printers, the 1-click Browser Print switch, the 76mm impact profile form, and the configured impact printer card alongside live API and ESC/POS byte verification artifacts. All checks and live scenarios passed.

  • Live validation: ✅ go - 6 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Open Settings -> Printers and expand Installed on this computer to inspect detected 76mm impact (EPSON TM-U220) and driver_only queues (Star TSP100/TSP143, EPSON EcoTank L3250, PDFwriter) with compati… ✅ pass live ~/.no-mistakes/evidence/01M6VT1Y5MB9ZNKQCZ97QEQYD4/01_detected_printers_impact_and_driver_only.png
Click Use Browser Print on a detected driver_only printer in Settings -> Printers and verify Print Method switches to Browser Print and persists across navigation without requiring a separate Save cli… ✅ pass live ~/.no-mistakes/evidence/01M6VT1Y5MB9ZNKQCZ97QEQYD4/02_switched_to_browser_print.png
Select the 76mm Impact / Dot-Matrix (escpos-impact-76) profile in the Add Printer form and save the printer, confirming Printable Columns auto-defaults to cols-32, impact guidance appears, and GET /ap… ✅ pass live ~/.no-mistakes/evidence/01M6VT1Y5MB9ZNKQCZ97QEQYD4/03_add_printer_impact_profile_form.png
Adversarial API guard: submit an unsupported profile_id to POST /api/printers and PUT /api/printers/:id and verify the backend rejects both with HTTP 400 and error message 'profile_id must be a suppor… ✅ pass live ~/.no-mistakes/evidence/01M6VT1Y5MB9ZNKQCZ97QEQYD4/05_live_api_and_escpos_verification.json
Adversarial alias & compatibility boundary: verify Epson TM-U220D/Bixolon SRP-275/Xprinter XP-76 resolve to escpos-impact-76 (cols-32, raster.enabled=false) before epson-tm-series, and non-TM Epson qu… ✅ pass live ~/.no-mistakes/evidence/01M6VT1Y5MB9ZNKQCZ97QEQYD4/05_live_api_and_escpos_verification.json
Generate receipt and payment ticket ESC/POS bytes for an escpos-impact-76 printer with a configured store logo and multilingual Latin items (German/Albanian, Polish, Turkish, Vietnamese horned vowels)… ✅ pass live ~/.no-mistakes/evidence/01M6VT1Y5MB9ZNKQCZ97QEQYD4/05_live_api_and_escpos_verification.json

Settings -> Printers: Detected 76mm impact printer badge and driver_only printers (Star TSP100/TSP143, EPSON EcoTank L3250) with warning and 1-click Use Browser Print button
Settings -> Printers: 1-click Use Browser Print switch updates Print Method to Browser Print and persists immediately
Settings -> Printers: Add Printer form with 76mm Impact / Dot-Matrix profile selected, auto-defaulting Printable Columns to 32 columns and showing impact hint
Settings -> Printers: Configured EPSON TM-U220D Kitchen printer card displaying 32 columns and Epson TM-U220 / 76mm Impact profile name

Evidence: Live API & ESC/POS verification payload (POST/PUT /api/printers profile_id persistence + 400 validation, /api/printers/detect compatibility classification, and 76mm impact receipt/payment-ticket ESC/POS byte verification)
{
  "postPrinterStatus": 201,
  "createdPrinter": {
    "id": "58e96312-4f67-4001-99f2-9b57acf57ecf",
    "name": "EPSON TM-U220D Live",
    "connection_type": "usb",
    "ip_address": null,
    "port": 9100,
    "is_default": 1,
    "cash_drawer_pulse_enabled": 0,
    "paper_width": "cols-32",
    "text_size": "normal",
    "created_at": "2026-11-07 22:21:23",
    "updated_at": "2026-11-07 22:21:23",
    "configured_profile_id": "escpos-impact-76",
    "profile_id": "escpos-impact-76",
    "profile_name": "Epson TM-U220 / 76mm Impact",
    "capabilities": {
      "encoding": {
        "codePages": [
          "cp437",
          "cp850",
          "cp858",
          "windows1252",
          "ascii"
        ],
        "preferredCodePage": "cp437"
      },
      "shaping": {
        "arabic": false
      },
      "representability": {
        "scripts": [
          "ascii",
          "latin"
        ]
      },
      "transliteration": {
        "enabled": true
      },
      "warnings": {
        "unsupportedText": "skip",
        "financialText": "refuse",
        "orderTypeFallback": "ascii"
      },
      "raster": {
        "enabled": false,
        "widthDots": 0,
        "maxBandHeight": 0,
        "modes": []
      },
      "textSize": "normal"
    }
  },
  "adversarialInvalidPost": {
    "status": 400,
    "body": {
      "error": "profile_id must be a supported printer profile ID"
    }
  },
  "adversarialInvalidPut": {
    "status": 400,
    "body": {
      "error": "profile_id must be a supported printer profile ID"
    }
  },
  "detectEndpointStatus": 200,
  "detectedPrinters": [
    {
      "name": "EPSON_TM_T20II",
      "make": "Epson",
      "model": "TM-T20",
      "connectionType": "usb",
      "deviceUri": "usb://EPSON/TM-T20II?serial=544336594580510000",
      "status": "idle",
      "isDefault": true,
      "paperWidth": "cols-48",
      "profileId": "epson-tm-series",
      "compatibility": "escpos_thermal"
    },
    {
      "name": "PDFwriter",
      "make": "Unknown",
      "model": "Thermal Printer",
      "connectionType": "usb",
      "deviceUri": "pdfwriter:/",
      "status": "idle",
      "isDefault": false,
      "paperWidth": "cols-42",
      "compatibility": "driver_only"
    }
  ],
  "impactReceipt": {
    "hasGsV0Logo": false,
    "warnings": [],
    "decodedText": "Flo Impact Cafe\n--------------------------------\nInvoice #: INV-LIVE-76\n11/7/2026 4:50:00 PM\n--------------------------------\nItem              Qty     Amount\n--------------------------------\nKäsewürstchen     1        $0.00\nGröße\nCom Suon Nuong &  1        $0.00\nLodz Dak\nMercimek Corbasi  1        $0.00\n& Iskender\n--------------------------------\nSubtotal                  $31.50\nTOTAL                     $31.50\n--------------------------------\nUlica Swietokrzyska 123,\nWarszawa 00-001\n\n\nPowered by FloPOS (flopos.com)"
  },
  "impactPaymentTicket": {
    "ok": true,
    "hasGsKQr": false,
    "decodedText": "Flo Impact Cafe\nPAYMENT TICKET\nTicket #: ORD-LIVE-76\n--------------------------------\nType: Takeaway\nDate: 11/7/2026, 4:50:00 PM\n--------------------------------\n1x Käsewürstchen Größe     $8.50\n1x Com Suon Nuong &       $12.00\n   Lodz Dak\n1x Mercimek Corbasi &     $11.00\n   Iskender\n--------------------------------\nTotal:                    $31.50\nBalance Due:              $31.50\n--------------------------------\nPlease pay at the payment counte\nScan or enter ticket number to p\nFLOCAFE-TICKET:ORD-LIVE-76"
  }
}

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found → auto-fixed (2) ✅
  • 🚨 main/printers/thermal.ts:2560 - Gating {RAW_BYTES:...} logo emission on rasterCapabilityEnabled(capabilities) in main/printers/document-classic.ts:529, main/printers/document-compact.ts:243, and frontend/src/lib/printer/receipt-encoder.ts:640,1170 causes nativeFallbackCapabilities(...) (which clones a thermal printer's capabilities with raster.enabled: false to force text transliteration) to strip the GS v 0 logo in the pre-raster native pass. rasterizeReceiptIfEnabled (main/printers/thermal.ts:2560) was updated to check result.rasterSelected || document.lines.some((line) => line.startsWith('{RAW_BYTES:')), but its sibling paths still drop the logo on raster-capable thermal printers:
  1. main/printers/thermal.ts:2444 (rasterizePrintDocumentForWebUsb): returns rasterSelected: result.rasterSelected without || lines.some((line) => line.startsWith('{RAW_BYTES:')). When frontend/src/hooks/usePrinter.ts:498-569 prints a bill with a logo via WebUSB in Electron (useElectronRaster === true) and all text lines are representable in the printer's native codepage (result.rasterSelected === false), buildClassicReceiptBytes / buildCompactReceiptBytes (frontend/src/lib/printer/receipt-encoder.ts:640,1170) runs with nativeFallbackCapabilities(webusbCapabilities) (raster.enabled: false) and omits the logo from bytes, and usePrinter.ts:561 discards rasterResult.data because rasterResult.rasterSelected is false, sending a logo-less receipt to the WebUSB thermal printer.
  2. main/printers/thermal.ts:2106 (prepareReceipt, consumed by POST /api/printers/print-bill with preview: true at main/routes/printers.ts:1169 and as the fallback at main/printers/thermal.ts:2558): passes nativeCapabilities (raster.enabled: false) to formatReceipt, omitting {RAW_BYTES:...} logo bands from prepared.data even when the resolved printer profile has capabilities.raster.enabled === true. Update rasterizePrintDocumentForWebUsb (main/printers/thermal.ts:2444) to include || lines.some((line) => line.startsWith('{RAW_BYTES:')) in rasterSelected.

🔧 Fix applied.
3 issues (2 errors, 1 warning) still open:

  • 🚨 main/printers/thermal.ts:2560 - Gating {RAW_BYTES:...} logo emission on rasterCapabilityEnabled(capabilities) in main/printers/document-classic.ts:529, main/printers/document-compact.ts:243, and frontend/src/lib/printer/receipt-encoder.ts:640,1170 causes nativeFallbackCapabilities(...) (which clones a thermal printer's capabilities with raster.enabled: false to force text transliteration) to strip the GS v 0 logo in the pre-raster native pass. rasterizeReceiptIfEnabled (main/printers/thermal.ts:2560) was updated to check result.rasterSelected || document.lines.some((line) => line.startsWith('{RAW_BYTES:')), but its sibling paths still drop the logo on raster-capable thermal printers:
  1. main/printers/thermal.ts:2444 (rasterizePrintDocumentForWebUsb): returns rasterSelected: result.rasterSelected without || lines.some((line) => line.startsWith('{RAW_BYTES:')). When frontend/src/hooks/usePrinter.ts:498-569 prints a bill with a logo via WebUSB in Electron (useElectronRaster === true) and all text lines are representable in the printer's native codepage (result.rasterSelected === false), buildClassicReceiptBytes / buildCompactReceiptBytes (frontend/src/lib/printer/receipt-encoder.ts:640,1170) runs with nativeFallbackCapabilities(webusbCapabilities) (raster.enabled: false) and omits the logo from bytes, and usePrinter.ts:561 discards rasterResult.data because rasterResult.rasterSelected is false, sending a logo-less receipt to the WebUSB thermal printer.
  2. main/printers/thermal.ts:2106 (prepareReceipt, consumed by POST /api/printers/print-bill with preview: true at main/routes/printers.ts:1169 and as the fallback at main/printers/thermal.ts:2558): passes nativeCapabilities (raster.enabled: false) to formatReceipt, omitting {RAW_BYTES:...} logo bands from prepared.data even when the resolved printer profile has capabilities.raster.enabled === true. Update rasterizePrintDocumentForWebUsb (main/printers/thermal.ts:2444) to include || lines.some((line) => line.startsWith('{RAW_BYTES:')) in rasterSelected.
  • 🚨 tests/impact-printer-support.test.ts:698 - In tests/impact-printer-support.test.ts:698 and tests/impact-printer-support.test.ts:717, .run(insertedPrinter.lastInsertRowid) references insertedPrinter, which was removed when the preceding payment-ticket test was switched to targetPrinter in commit 6c8cc76b, causing ReferenceError: insertedPrinter is not defined at runtime. In addition, tests/impact-printer-support.test.ts:444-447 calls rasterizePrintDocumentForWebUsb(webUsbDocument, 'epson-tm-series', 'classic', ...), swapping the second parameter (template: 'classic' | 'compact') and third parameter (profileId: string) of rasterizePrintDocumentForWebUsb (main/printers/thermal.ts:2366-2370), so resolvePrinterProfile({ profile_id: 'classic' }) falls back to generic-escpos-80 instead of testing epson-tm-series.
  • ⚠️ main/printers/thermal.ts:2106 - In main/printers/thermal.ts:2103-2120, prepareReceipt was changed in commit 6c8cc76b to pass capabilities (raster.enabled: true on thermal profiles) directly to formatReceipt instead of nativeFallbackCapabilities(capabilities) so {RAW_BYTES:...} store logos would be retained. However, formatReceipt is a synchronous native ESC/POS formatter that calls buildEscPos without renderUnsupportedRasterLines (rasterUnits is undefined). When capabilities.raster.enabled === true, normalizeThermalText (shared/print/thermal-capabilities.ts:154) and the receipt layout helpers (pushWrapped at main/printers/formatting-helpers.ts:479, pushCenteredWrapped at main/printers/formatting-helpers.ts:498, truncate at main/printers/formatting-helpers.ts:418, classicItemHeader at main/printers/document-classic.ts:317, compactItemHeader at main/printers/document-compact.ts:130) skip fallback Latin transliteration (LATIN_EXTENDED_ASCII_MAP and NFD diacritic stripping) and skip line wrapping (wrapText) for any text containing extended Latin characters (e.g. Ł/ł, Đ/đ, Ğ/ğ, İ/ı, Ş/ş, Ơ/ơ, Ư/ư, č, ř, š, ž), assuming Chromium rasterization will render the full line. buildEscPos (main/printers/formatting-helpers.ts:726-731,806) then folds the unwrapped line with raster.enabled: false and hard-slices it at resolvedColumns via fitThermalLine, silently truncating multi-line addresses or item names when prepareReceipt runs (such as WebUSB fallback when rasterizeReceiptIfEnabled fails or preview mode).

🔧 Fix applied.
✅ Re-checked - no issues remain.

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 5 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Selecting the 76mm Impact / Dot-Matrix (escpos-impact-76) profile in Settings > Printers auto-defaults printable columns to cols-32, disables raster capabilities, and prevents TM-U*, TM-L*, and EcoTan… ✅ pass live ~/.no-mistakes/evidence/01M6VT1Y5MB9ZNKQCZ97QEQYD4/03_add_printer_impact_profile_form.png, ~/.no-mistakes/evidence/01M6VT1Y5MB9ZNKQCZ97QEQYD4/04_configured_impa…
Printing receipts and payment tickets on escpos-impact-76 preserves existing German/Albanian LATIN_ASCII_MAP foldings byte-identically while folding extended Latin (Æ/Œ/Ø/Ł/Đ/Þ/Ğ/İ/ı/Ş), Vietnamese ho… ✅ pass live ~/.no-mistakes/evidence/01M6VT1Y5MB9ZNKQCZ97QEQYD4/05_live_api_and_escpos_verification.json and npm run test:impact-printer
Classic and compact receipt renderers, frontend receipt encoders, and payment tickets omit GS v 0 (1d 76 30) logo bitmaps and GS ( k (1d 28 6b) QR graphics when raster.enabled is false while retaining… ✅ pass live ~/.no-mistakes/evidence/01M6VT1Y5MB9ZNKQCZ97QEQYD4/05_live_api_and_escpos_verification.json and npm run test:impact-printer
OS printer detection classifies TM-U220 as escpos_impact (Epson TM-U Series, cols-32) and Star TSP/SP700/mC-Print, Epson EcoTank/Inkjet, Label, and PDF/PDFwriter queues as driver_only, displaying a wa… ✅ pass live ~/.no-mistakes/evidence/01M6VT1Y5MB9ZNKQCZ97QEQYD4/01_detected_printers_impact_and_driver_only.png, ~/.no-mistakes/evidence/01M6VT1Y5MB9ZNKQCZ97QEQYD4/02_switch…
Adversarial: POST /api/printers and PUT /api/printers/:id persist valid profile_id values via migration 125 (returning configured_profile_id alongside resolved profile_id) and reject unrecognized prof… ✅ pass live ~/.no-mistakes/evidence/01M6VT1Y5MB9ZNKQCZ97QEQYD4/05_live_api_and_escpos_verification.json, npm run test:upgrade-path, and `npx playwright test e2e/qa-settings-receipts-printers…
  • npm run test:impact-printer
  • npm run test:receipt-column-oracle
  • npm run test:upgrade-path
  • npm run test:script-coverage
  • npm run test:raster
  • npm run test:thermal-capabilities
  • npm run test:printer
  • node tests/run-electron-node-test.cjs tests/backup-restore-production.test.ts
  • npm run i18n:check
  • cd frontend && EVIDENCE_DIR=~/.no-mistakes/evidence/01M6VT1Y5MB9ZNKQCZ97QEQYD4 npx playwright test --config=playwright.config.ts --project=chromium --retries=0 e2e/qa-settings-receipts-printers.spec.ts e2e/database-export-import.spec.ts

✅ No issues found.

  • Live validation: ✅ go - 6 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Open Settings -> Printers and expand Installed on this computer to inspect detected 76mm impact (EPSON TM-U220) and driver_only queues (Star TSP100/TSP143, EPSON EcoTank L3250, PDFwriter) with compati… ✅ pass live ~/.no-mistakes/evidence/01M6VT1Y5MB9ZNKQCZ97QEQYD4/01_detected_printers_impact_and_driver_only.png
Click Use Browser Print on a detected driver_only printer in Settings -> Printers and verify Print Method switches to Browser Print and persists across navigation without requiring a separate Save cli… ✅ pass live ~/.no-mistakes/evidence/01M6VT1Y5MB9ZNKQCZ97QEQYD4/02_switched_to_browser_print.png
Select the 76mm Impact / Dot-Matrix (escpos-impact-76) profile in the Add Printer form and save the printer, confirming Printable Columns auto-defaults to cols-32, impact guidance appears, and GET /ap… ✅ pass live ~/.no-mistakes/evidence/01M6VT1Y5MB9ZNKQCZ97QEQYD4/03_add_printer_impact_profile_form.png
Adversarial API guard: submit an unsupported profile_id to POST /api/printers and PUT /api/printers/:id and verify the backend rejects both with HTTP 400 and error message 'profile_id must be a suppor… ✅ pass live ~/.no-mistakes/evidence/01M6VT1Y5MB9ZNKQCZ97QEQYD4/05_live_api_and_escpos_verification.json
Adversarial alias & compatibility boundary: verify Epson TM-U220D/Bixolon SRP-275/Xprinter XP-76 resolve to escpos-impact-76 (cols-32, raster.enabled=false) before epson-tm-series, and non-TM Epson qu… ✅ pass live ~/.no-mistakes/evidence/01M6VT1Y5MB9ZNKQCZ97QEQYD4/05_live_api_and_escpos_verification.json
Generate receipt and payment ticket ESC/POS bytes for an escpos-impact-76 printer with a configured store logo and multilingual Latin items (German/Albanian, Polish, Turkish, Vietnamese horned vowels)… ✅ pass live ~/.no-mistakes/evidence/01M6VT1Y5MB9ZNKQCZ97QEQYD4/05_live_api_and_escpos_verification.json
  • npm run test:impact-printer
  • npm run test:receipt-column-oracle
  • npm run test:upgrade-path
  • npm run test:script-coverage
  • npm run i18n:check
  • npm run docs:check
  • cd frontend && EVIDENCE_DIR=~/.no-mistakes/evidence/01M6VT1Y5MB9ZNKQCZ97QEQYD4 npx playwright test e2e/qa-settings-receipts-printers.spec.ts --config=playwright.config.ts --project=chromium --retries=0
✅ **Document** - passed

✅ No issues found.

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

✅ No issues found.

@coderabbitai

coderabbitai Bot commented Nov 7, 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

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Add 76mm impact printing and capability-based printer onboarding

✨ Enhancement 🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Support 76mm impact printers with 32-column text and no unsupported raster graphics.
Diagram

graph TD
  OS["OS Queues"] --> Classifier["Compatibility Classification"] --> Settings["Printer Settings"] --> API["Printer API"] --> DB[("Printer Records")]
  DB --> Profiles["Capability Profiles"] --> Renderers["Receipt Renderers"]
  Settings --> Browser["Browser Print"]
Loading
High-Level Assessment

Use the existing profile and capability system with an explicit override: it carries impact constraints through established print paths without introducing a separate renderer. Probing unknown OS queues with raw commands was considered less safe than identifying driver-only devices and offering Browser Print.

Files changed (50) +1887 / -219

Enhancement (9) +451 / -116
PrintersSettingsTab.tsxAdd profile selection and compatibility guidance +99/-5

Add profile selection and compatibility guidance

• Adds explicit profile selection with width defaults, preserves manual width choices, and shows impact and driver-only guidance for detected queues. Driver-only queues offer a Browser Print switch rather than quick-add.

frontend/src/components/settings/PrintersSettingsTab.tsx

usePrinter.tsExpose configured profile on printer type +1/-0

Expose configured profile on printer type

• Adds the optional configured_profile_id field to the frontend hardware-printer contract.

frontend/src/hooks/usePrinter.ts

en.jsonDefine English printer onboarding messages +14/-1

Define English printer onboarding messages

• Adds profile names, impact guidance, compatibility labels, warnings, and Browser Print action text.

frontend/src/lib/i18n/messages/en.json

electron.d.tsExpose printer profile fields in Electron types +2/-0

Expose printer profile fields in Electron types

• Adds optional resolved and configured profile identifiers to the Electron printer interface.

frontend/src/types/electron.d.ts

db.tsPersist optional printer profile overrides +10/-0

Persist optional printer profile overrides

• Migration 125 adds printers.profile_id to existing databases, and the fresh schema includes the nullable column.

main/db.ts

profiles.tsIntroduce the 76mm impact profile +99/-13

Introduce the 76mm impact profile

• Adds a 32-column, partial-cut impact profile with raster disabled and narrows thermal-model aliases to avoid matching impact and non-receipt Epson printers. Also exposes profile-ID validation.

main/printers/profiles.ts

thermal.tsClassify OS queues and respect ticket capabilities +157/-91

Classify OS queues and respect ticket capabilities

• Improves macOS and Windows make/model detection, annotates detected queues as thermal, impact, or driver-only, and gives impact queues a 32-column width. Payment tickets omit native QR bytes without raster capability while retaining the ticket text.

main/printers/thermal.ts

printers.tsValidate and return configured printer profiles +31/-4

Validate and return configured printer profiles

• Create and update routes validate and persist optional profile IDs; responses distinguish the configured ID from the resolved profile. New printers can inherit the selected profile's paper width.

main/routes/printers.ts

thermal-capabilities.tsExpand Latin fallback transliteration +38/-2

Expand Latin fallback transliteration

• Preserves existing ASCII mappings while adding Latin ligature and stroke substitutions followed by diacritic stripping when no native code page represents the text.

shared/print/thermal-capabilities.ts

Bug fix (3) +19 / -5
receipt-encoder.tsSuppress unsupported frontend receipt logos +9/-3

Suppress unsupported frontend receipt logos

• Classic and compact receipt encoders omit raster logos when supplied printer capabilities disable raster output.

frontend/src/lib/printer/receipt-encoder.ts

document-classic.tsGuard classic bill raster logos +5/-1

Guard classic bill raster logos

• Skips raw logo bitmap commands when the printer's supplied capabilities disable raster output.

main/printers/document-classic.ts

document-compact.tsGuard compact bill raster logos +5/-1

Guard compact bill raster logos

• Skips raw logo bitmap commands when the printer's supplied capabilities disable raster output.

main/printers/document-compact.ts

Tests (6) +965 / -4
qa-settings-receipts-printers.spec.tsExercise impact and driver-only setup in Settings +203/-2

Exercise impact and driver-only setup in Settings

• Adjusts form selectors and adds an onboarding scenario covering detection badges, the Browser Print switch, profile defaults, persistence, and invalid IDs.

frontend/e2e/qa-settings-receipts-printers.spec.ts

package.jsonRegister impact printer regression tests +2/-1

Register impact printer regression tests

• Adds a dedicated impact-printer test command and includes it in the full test suite.

package.json

impact-printer-support.test.tsCover impact printing across the stack +693/-0

Cover impact printing across the stack

• Tests profile matching, transliteration, raster and QR suppression, OS compatibility, migration registration, and profile-ID API validation and persistence.

tests/impact-printer-support.test.ts

raster-printing.test.tsAccount for non-raster impact capability +5/-1

Account for non-raster impact capability

• Updates profile capability expectations so the impact profile must disable raster while thermal profiles retain it.

tests/raster-printing.test.ts

receipt-column-oracle.test.tsInclude impact profile in column oracle +1/-0

Include impact profile in column oracle

• Registers the impact profile's 32-column width in receipt column expectations.

tests/receipt-column-oracle.test.ts

upgrade-path.test.tsVerify the v125 printer migration +61/-0

Verify the v125 printer migration

• Upgrades a v124-style printer row and checks that profile_id is added as NULL without losing the row or introducing schema-health findings.

tests/upgrade-path.test.ts

Documentation (32) +452 / -94
printing.mdDocument impact capabilities and profile resolution +29/-15

Document impact capabilities and profile resolution

• Describes the fifth printer profile, persisted profile overrides, compatibility classification, and capability-gated logos and payment-ticket QR codes.

docs/architecture/printing.md

testing-printers.mdClarify how to verify resolved profiles +9/-11

Clarify how to verify resolved profiles

• Directs testers to the profile reference and explains how configured and resolved profile IDs relate.

docs/guides/testing-printers.md

printers.mdExplain impact setup and driver-only onboarding +15/-21

Explain impact setup and driver-only onboarding

• Documents the profile selector, 32-column impact behavior, and Browser Print guidance for incompatible OS queues.

docs/printers.md

api.mdDocument printer profile API fields +3/-3

Document printer profile API fields

• Adds profile_id to printer create and update requests and notes that payment-ticket QR output depends on raster capability.

docs/reference/api.md

translation-terminology.mdDocument Latin fallback transliteration +18/-17

Document Latin fallback transliteration

• Distinguishes generic ASCII folding from Latin-profile native code pages and expanded fallback transliteration.

docs/reference/translation-terminology.md

ar.jsonTranslate printer onboarding into Arabic +14/-1

Translate printer onboarding into Arabic

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/ar.json

bn.jsonTranslate printer onboarding into Bengali +14/-1

Translate printer onboarding into Bengali

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/bn.json

de.jsonTranslate printer onboarding into German +14/-1

Translate printer onboarding into German

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/de.json

es.jsonTranslate printer onboarding into Spanish +14/-1

Translate printer onboarding into Spanish

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/es.json

fa.jsonTranslate printer onboarding into Persian +14/-1

Translate printer onboarding into Persian

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/fa.json

fil.jsonTranslate printer onboarding into Filipino +14/-1

Translate printer onboarding into Filipino

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/fil.json

fr.jsonTranslate printer onboarding into French +14/-1

Translate printer onboarding into French

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/fr.json

ha.jsonTranslate printer onboarding into Hausa +14/-1

Translate printer onboarding into Hausa

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/ha.json

hi.jsonTranslate printer onboarding into Hindi +14/-1

Translate printer onboarding into Hindi

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/hi.json

id.jsonTranslate printer onboarding into Indonesian +14/-1

Translate printer onboarding into Indonesian

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/id.json

it.jsonTranslate printer onboarding into Italian +14/-1

Translate printer onboarding into Italian

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/it.json

ja.jsonTranslate printer onboarding into Japanese +14/-1

Translate printer onboarding into Japanese

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/ja.json

jv.jsonTranslate printer onboarding into Javanese +14/-1

Translate printer onboarding into Javanese

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/jv.json

ko.jsonTranslate printer onboarding into Korean +14/-1

Translate printer onboarding into Korean

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/ko.json

mr.jsonTranslate printer onboarding into Marathi +14/-1

Translate printer onboarding into Marathi

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/mr.json

ne.jsonTranslate printer onboarding into Nepali +14/-1

Translate printer onboarding into Nepali

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/ne.json

nl.jsonTranslate printer onboarding into Dutch +14/-1

Translate printer onboarding into Dutch

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/nl.json

pt.jsonTranslate printer onboarding into Portuguese +14/-1

Translate printer onboarding into Portuguese

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/pt.json

ru.jsonTranslate printer onboarding into Russian +14/-1

Translate printer onboarding into Russian

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/ru.json

sq.jsonTranslate printer onboarding into Albanian +14/-1

Translate printer onboarding into Albanian

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/sq.json

sw.jsonTranslate printer onboarding into Swahili +14/-1

Translate printer onboarding into Swahili

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/sw.json

th.jsonTranslate printer onboarding into Thai +14/-1

Translate printer onboarding into Thai

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/th.json

tr.jsonTranslate printer onboarding into Turkish +14/-1

Translate printer onboarding into Turkish

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/tr.json

ur.jsonTranslate printer onboarding into Urdu +14/-1

Translate printer onboarding into Urdu

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/ur.json

vi.jsonTranslate printer onboarding into Vietnamese +14/-1

Translate printer onboarding into Vietnamese

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/vi.json

zh-tw.jsonTranslate printer onboarding into Traditional Chinese +14/-1

Translate printer onboarding into Traditional Chinese

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/zh-tw.json

zh.jsonTranslate printer onboarding into Simplified Chinese +14/-1

Translate printer onboarding into Simplified Chinese

• Adds localized profile options, impact guidance, compatibility labels, and Browser Print actions.

frontend/src/lib/i18n/messages/zh.json

@qodo-code-review

qodo-code-review Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Thermal receipts lose Vietnamese/Turkish accents ✓ Resolved

Resolving commit: 0f8a899

Resolution reason
The commit restructures shared/print/thermal-capabilities.ts: transliterateThermalText now returns
text unchanged when transliteration is disabled or when a native code page can represent the Latin
text. A new normalizeThermalText returns the text untouched when raster.enabled is true and the text
is not representable, so raster-capable printers keep raster rendering for strings like Tiếng Việt.
The extended map additions (Ơ/ơ/Ư/ư) remain, but the raster-capable path is preserved. A test
asserts Tiếng Việt and Đơn vị are non-representable and preserved on epson-tm-series. The approach
differs from the suggested fix (gating on raster inside the fold) but addresses the same regression.
Description
transliterateThermalText now folds every Latin string that no single native code page can
represent (extended map plus NFD \p{Diacritic} stripping). The fold runs for every profile using
LATIN_THERMAL_CAPABILITIES, not only the impact profile, and isThermalTextRepresentable calls
the same function. So on raster-enabled Epson TM and Xprinter thermal printers, strings like `Đơn
vị, Tiếng Việt, ş or ł are now judged representable and printed as ASCII text (Don vi`),
when before they were sent to the raster band and printed with correct diacritics.


Remediation recommended

2. Existing Epson TM printers fall back to generic ✓ Resolved

Resolving commit: 0f8a899

Resolution reason
Restored broad 'epson tm' and spaced/model-specific aliases for epson-tm-series, added
TM-T100/TM-H600/TM-H6000 aliases, excluded TM-U and non-TM Epson (EcoTank, WorkForce, Stylus,
L-series) from name matching, widened thermal detection and model extraction for TM variants, and
added regression tests for both resolution and classification.
Description
The epson-tm-series aliases replace the broad 'epson tm' token with model-specific tokens that
miss names such as EPSON TM Receipt, space-separated EPSON TM T88V, EPSON TM-H6000IV,
TM-T100, and detected strings such as TM Series or TM-H600. When an existing printer has no
explicit profile_id, resolvePrinterProfile falls back to generic-escpos-80, changing its
encoding, cut mode, and default width; detection also classifies some of these queues as
driver-only.

3. Impact setup guide omits 76 mm ✗ Dismissed
Description
FloCafe adds the escpos-impact-76 profile with a 32-column default, but the docs.flopos.com
operator guide still tells users to choose only 58 mm or 80 mm paper. Operators following that guide
when adding a TM-U220 or SRP-275 are not directed to the new profile and may select the wrong width.

4. Vietnamese impact tickets fail to print ✓ Resolved

Resolving commit: 0f8a899

Resolution reason
In shared/print/thermal-capabilities.ts, LATIN_EXTENDED_ASCII_MAP gained explicit foldings Ơ→O, ơ→o,
Ư→U, ư→u (the suggested fix's explicit mapping). The transliteration path was restructured so the
Latin fallback runs before the representability check, and a new normalizeThermalText path is used.
A new test in tests/impact-printer-support.test.ts asserts 'Cơm Sườn Nướng & Phở Bò Ơi Ướp' folds to
ASCII on escpos-impact-76, and that a priced Vietnamese item 'Cơm Sườn Nướng' appears folded on the
impact payment ticket. This addresses the finding with the same explicit-mapping approach, though
the file restructuring differs from the suggested prompt's wording.
Description
The new Latin fallback strips combining marks but does not fold horned vowels Ơ/ơ and Ư/ư, which
NFD leaves as horned vowels. On the new raster-disabled impact profile, a priced item such as Sườn
remains unrepresentable; its payment-ticket line is marked financial, so the print is refused rather
than falling back to graphics.

View medium (1)
5. Browser print stays off after switching ✓ Resolved

Resolving commit: 0f8a899

Resolution reason
The Use Browser Print handler now updates the printer store and calls a new onPersistPrintMethod
callback (wired in settings/page.tsx to update saved printing state) before showing the success
toast. An e2e test asserts the browser method is persisted to localStorage and survives navigating
away and back.
Description
The Use Browser Print handler changes only printingForm but immediately shows a success toast
saying the print method was switched. Until the separate printing-settings save runs, printing still
uses the previously persisted method, and leaving the page discards the apparent one-click switch.

Grey Divider

Context sources
✅ Compliance rules (platform): 5 rules
✅ Cross-repo context — repo relationships
  Explored: repo: FreeOpenSourcePOS/docs.flopos.com (sha: abe7cff3) — View relationship
Review mode: Auto: 🧠 Deep: Many independent logic paths: profiles, detection, encoders, migration, API validation, transliteration.

Grey Divider

Tip of the day
💡 Did you know, you can hide the parts of a finding you never read, like the evidence or the agent prompt

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread shared/print/thermal-capabilities.ts Resolved
Comment thread shared/print/thermal-capabilities.ts Resolved
Comment thread main/printers/profiles.ts Resolved
Comment thread main/printers/profiles.ts Resolved
khaira777 added a commit that referenced this pull request Nov 7, 2026
…1502: 1. **Core Test Suite (Shard 1/4) - `test:print-labels`**: - **Invariant**: `isThermalTextRepresentable`, `selectThermalCodePage`, and `thermalTextFallback` must evaluate native codepage representability (plus single-diacritic `LATIN_ASCII_MAP` fallback when no native codepage encodes the string), while extended Latin fallback folding (`LATIN_EXTENDED_ASCII_MAP` and Unicode NFD `\p{Diacritic}` stripping on `\p{Script=Latin}\p{Mark}*`) must only run inside `normalizeThermalText` when raster fallback does not intercept the text and no native codepage can encode it. - **Fix**: Kept `transliterateThermalText` in `shared/print/thermal-capabilities.ts` scoped to native codepage checks and `LATIN_ASCII_MAP`, updated `thermalTextFallback` to check `transliterateThermalText` so explicit English/ASCII financial fallbacks (e.g. `'Tổng cộng'` -> `'TOTAL'`) and raster triggers on thermal profiles are preserved, and applied extended Latin / NFD diacritic folding in `normalizeThermalText`. Updated the post-normalization `isThermalTextRepresentable` assertions in `tests/impact-printer-support.test.ts`. 2. **Core Test Suite (Shard 4/4) - `test:backup`, Playwright E2E (Shard 1/4), End-to-End Playwright Tests, and Required Checks Gate**: - **Invariant**: Every test fixture and assertion expecting the current latest database schema version must match `getCurrentSchemaVersion()` (`125` after migration `125` `add_printer_profile_id`). - **Fix**: Updated `tests/backup-restore-production.test.ts` (expected migrated schema version `124` -> `125`) and `frontend/e2e/database-export-import.spec.ts` (`contaminatedPayload` `schema_version` `'124'` -> `'125'` so `/api/db/import` does not flag a version mismatch requiring a Master PIN). Verified locally with `npm run test:print-labels`, `npm run test:impact-printer`, `npm run test:thermal-capabilities`, `npm run test:receipt-column-oracle`, `npm run test:backup`, `npm run test:release-regressions`, `npm run test:upgrade-path`, `npm run test:schema-health`, `npm run test:migration-registry`, `npm run lint`, `npm run build`, `npm run build:frontend`, and Playwright E2E (`e2e/database-export-import.spec.ts` and `e2e/qa-settings-receipts-printers.spec.ts`)
@khaira777 khaira777 changed the title feat: add 76mm impact printer support and capability-based printer onboarding feat(print): add 76mm impact printer support Nov 7, 2026
@khaira777 khaira777 changed the title feat(print): add 76mm impact printer support feat: add 76mm impact printer support and printer profile onboarding Nov 7, 2026
@khaira777 khaira777 changed the title feat: add 76mm impact printer support and printer profile onboarding feat(print): add 76mm impact printer support Nov 7, 2026
@khaira777 khaira777 changed the title feat(print): add 76mm impact printer support feat: add 76mm impact printer support and capability-based printer onboarding Nov 7, 2026
…1502: 1. **Core Test Suite (Shard 1/4) - `test:print-labels`**: - **Invariant**: `isThermalTextRepresentable`, `selectThermalCodePage`, and `thermalTextFallback` must evaluate native codepage representability (plus single-diacritic `LATIN_ASCII_MAP` fallback when no native codepage encodes the string), while extended Latin fallback folding (`LATIN_EXTENDED_ASCII_MAP` and Unicode NFD `\p{Diacritic}` stripping on `\p{Script=Latin}\p{Mark}*`) must only run inside `normalizeThermalText` when raster fallback does not intercept the text and no native codepage can encode it. - **Fix**: Kept `transliterateThermalText` in `shared/print/thermal-capabilities.ts` scoped to native codepage checks and `LATIN_ASCII_MAP`, updated `thermalTextFallback` to check `transliterateThermalText` so explicit English/ASCII financial fallbacks (e.g. `'Tổng cộng'` -> `'TOTAL'`) and raster triggers on thermal profiles are preserved, and applied extended Latin / NFD diacritic folding in `normalizeThermalText`. Updated the post-normalization `isThermalTextRepresentable` assertions in `tests/impact-printer-support.test.ts`. 2. **Core Test Suite (Shard 4/4) - `test:backup`, Playwright E2E (Shard 1/4), End-to-End Playwright Tests, and Required Checks Gate**: - **Invariant**: Every test fixture and assertion expecting the current latest database schema version must match `getCurrentSchemaVersion()` (`125` after migration `125` `add_printer_profile_id`). - **Fix**: Updated `tests/backup-restore-production.test.ts` (expected migrated schema version `124` -> `125`) and `frontend/e2e/database-export-import.spec.ts` (`contaminatedPayload` `schema_version` `'124'` -> `'125'` so `/api/db/import` does not flag a version mismatch requiring a Master PIN). Verified locally with `npm run test:print-labels`, `npm run test:impact-printer`, `npm run test:thermal-capabilities`, `npm run test:receipt-column-oracle`, `npm run test:backup`, `npm run test:release-regressions`, `npm run test:upgrade-path`, `npm run test:schema-health`, `npm run test:migration-registry`, `npm run lint`, `npm run build`, `npm run build:frontend`, and Playwright E2E (`e2e/database-export-import.spec.ts` and `e2e/qa-settings-receipts-printers.spec.ts`)
@khaira777
khaira777 force-pushed the fm/flocafe-impact-printer-support branch from 1af4228 to b2e2528 Compare November 7, 2026 22:23
@khaira777 khaira777 changed the title feat: add 76mm impact printer support and capability-based printer onboarding feat(print): add 76mm impact printer support Nov 7, 2026
@khaira777
khaira777 merged commit 7726206 into main Nov 7, 2026
23 checks passed
@khaira777
khaira777 deleted the fm/flocafe-impact-printer-support branch November 7, 2026 22:35
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.

feat(print): add native 76mm impact printer support and capability-based printer onboarding

1 participant