Repository navigation
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
PR Summary by QodoAdd 76mm impact printing and capability-based printer onboarding
AI Description
Diagram
High-Level Assessment
Files changed (50)
|
Code Review by Qodo
1.
|
…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`)
Fixes #1481
Intent
Implement native 76mm impact printer support (
EPSON TM-U220D, BixolonSRP-275, XprinterXP-76, etc.) and capability-based printer onboarding across FloCafe:escpos-impact-76printer profile (cols-32,LATIN_THERMAL_CAPABILITIES,raster.enabled: false,cutMode: 'partial',fontAColumns: 32,fontBColumns: 40,printWidthMm: 64) beforeepson-tm-seriesinmain/printers/profiles.ts, and updateepson-tm-seriesaliases soTM-U*impact,TM-L*label, and EcoTank printers are never hijacked as 48-column thermal raster printers.normalizeThermalText(shared/print/thermal-capabilities.ts) when no native codepage can represent the text: keep existingLATIN_ASCII_MAPentries byte-identical, then apply multi-char/stroke Latin foldings (Æ/æ -> AE/ae,Œ/œ -> OE/oe,Ø/ø -> O/o,Ł/ł -> L/l,Đ/đ -> D/d,Þ/þ -> TH/th,Ğ/ğ -> G/g,İ/ı -> I/i,Ş/ş -> S/s) followed by Unicode NFD combining-mark stripping (\p{Diacritic}) on Latin-script characters.GS v 0logo ({RAW_BYTES:...}) andGS ( kQR code emissions withrasterCapabilityEnabled(capabilities)inmain/printers/document-classic.ts,main/printers/document-compact.ts,frontend/src/lib/printer/receipt-encoder.ts, andmain/printers/thermal.ts(printPaymentTicket), while keeping the centeredFLOCAFE-TICKET:<order_number>text line.main/printers/thermal.ts(getMacOSPrinterDetailsanddetectWindowsMakeModel) sotm-u/u220maps tomake: 'Epson', model: 'TM-U Series'(cols-32) and non-TM Epson printers (EcoTank,ET-,L3,L4,WorkForce,WF-,Stylus) are not classified asTM Seriesthermal; addcompatibility: 'escpos_thermal' | 'escpos_impact' | 'driver_only'toPrinterInfoviaclassifyDetectedPrinterCompatibility(info)(keepingdriver_onlyqueues visible in Settings -> Printers with a warning badge and a 1-click switch to Browser print, including StarTSP100/TSP143/SP700/mC-Print, Inkjet/Laser, Label, and PDF queues).125(add_printer_profile_id) inmain/db.ts(profile_id TEXT DEFAULT NULLonprinters), persist and validateprofile_idinmain/routes/printers.ts(POST /api/printersandPUT /api/printers/:id, returningconfigured_profile_idalongside resolvedprofile_id), add the Printer Type / Profile selector anddriver_onlywarning badge + 1-click Browser switch infrontend/src/components/settings/PrintersSettingsTab.tsx, add the translation keys across all 24 locale files andmessages.d.ts, updatedocs/architecture/printing.mdanddocs/guides/testing-printers.md, updatetests/receipt-column-oracle.test.ts+ golden fixture, and addtests/impact-printer-support.test.tswired intopackage.json.What Changed
escpos-impact-7632-column printer profile (raster.enabled: false,cutMode: 'partial',printWidthMm: 64) inmain/printers/profiles.ts, refineepson-tm-seriesaliases and OS printer detection inmain/printers/thermal.tssoTM-U*impact,TM-L*label, and non-TM Epson queues are not misclassified as 48-column thermal raster printers, and classify detected queues asescpos_thermal,escpos_impact, ordriver_only.GS v 0raster logo andGS ( kQR code emissions withrasterCapabilityEnabled(capabilities)across backend and frontend receipt/ticket encoders while preserving the text ticket fallback, and expandnormalizeThermalTextinshared/print/thermal-capabilities.tswith extended Latin stroke/ligature foldings and Unicode NFD diacritic stripping when no native codepage can encode the text and raster fallback does not intercept it.125(add_printer_profile_id) andprofile_idvalidation/persistence inmain/routes/printers.ts, add the printer profile selector plusdriver_onlywarning badge and one-click Browser print switch infrontend/src/components/settings/PrintersSettingsTab.tsxwith translations across all 24 locales, and update documentation and test suites.Risk Assessment
✅ Low: The changes cleanly introduce the escpos-impact-76 printer profile, extend Latin fallback transliteration for non-raster profiles without altering native codepage representability or raster-capable thermal behavior, guard GS v 0 logos and GS ( k payment-ticket QR codes on rasterCapabilityEnabled, classify detected OS printers by ESC/POS compatibility, and persist/validate printers.profile_id via additive migration v125 with comprehensive unit, upgrade-path, oracle, and E2E test coverage.
Testing
Ran targeted backend tests (
test:impact-printer,test:receipt-column-oracle,test:script-coverage,test:upgrade-path,test:backup,test:raster), translation and documentation verifiers (i18n:check,docs:check), and the live Playwright Chromium E2E suite (frontend/e2e/qa-settings-receipts-printers.spec.ts), capturing 7 screenshots and 1 rendered receipt HTML artifact in the evidence directory; all checks and live scenarios passed.npm run test:impact-printerandnpm run test:receipt-column-oraclenpm run test:impact-printernpm run test:impact-printerandnpm run test:rasternpm run test:impact-printer,01_detected_printers_impact_and_driver_only.png, and02_switched_to_browser_print.pngnpm run test:impact-printer,npm run test:upgrade-path,npm run test:backup,03_add_printer_impact_profile_form.png, and04_configured_impact_printer_card.pngEvidence: Live rendered Browser Print HTML popup for 58mm receipt
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.
npm run test:impact-printerandnpm run test:receipt-column-oraclenpm run test:impact-printernpm run test:impact-printerandnpm run test:rasternpm run test:impact-printer,01_detected_printers_impact_and_driver_only.png, and02_switched_to_browser_print.pngnpm run test:impact-printer,npm run test:upgrade-path,npm run test:backup,03_add_printer_impact_profile_form.png, and04_configured_impact_printer_card.pngnpm run test:impact-printernpm run test:receipt-column-oraclenpm run test:script-coveragenpm run i18n:checknpm run docs:checknpm run test:upgrade-pathnpm run test:backupnpm run test:rasternpm run build:frontend && EVIDENCE_DIR=~/.no-mistakes/evidence/01M6VJVXH3SYD30JNV7HFR80BE npx --prefix frontend playwright test --config=frontend/playwright.config.ts --project=chromium frontend/e2e/qa-settings-receipts-printers.spec.ts✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.