Skip to content

Refactor Electron raw print IPC#615

Open
kilbot wants to merge 1 commit into
nextfrom
codex/raw-print-unification
Open

Refactor Electron raw print IPC#615
kilbot wants to merge 1 commit into
nextfrom
codex/raw-print-unification

Conversation

@kilbot

@kilbot kilbot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a shared Electron renderer ipc-print.electron helper for IPC lookup, Uint8Arraynumber[] conversion, the 30s renderer timeout, and timer cleanup.
  • Refactor serial, USB, and network Electron adapters to delegate raw ESC/POS IPC sends to the shared helper.
  • Point apps/electron at the companion Electron PR commit that centralizes main-process raw-print delivery.

Design decisions (preserve through rebases)

  • IPC channel names and payload shapes are unchanged — renderer adapters still call print-raw-serial / print-raw-usb with { device, data } and print-raw-tcp with { host, port, data }.
  • Renderer timeout remains 30s — the main process keeps shorter transport-specific timeouts so native errors win first.
  • The shared IPC lookup intentionally supports both window.ipcRenderer and window.electronAPI?.ipcRenderer, fixing the network adapter fallback gap without changing the preload contract.

Companion PRs / cross-repo

Test plan

  • From apps/electron: pnpm ts:check
  • From apps/electron: pnpm lint (passes with pre-existing warnings only)
  • From apps/electron: pnpm run test:serial-printer
  • From apps/electron: pnpm run test:winspool-printer
  • From apps/electron: pnpm run test:printer-discovery
  • From apps/electron: pnpm run test:raw-print
  • From apps/electron: pnpm test
  • From packages/printer: npx tsc --noEmit -p tsconfig.json
  • From packages/printer: pnpm exec vitest run src/transport/__tests__/serial-adapter.electron.test.ts

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@kilbot, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 56 minutes and 28 seconds. Learn how PR review limits work.

To continue reviewing without waiting, enable usage-based billing in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 426b80f0-fad8-4aef-a453-f79f460b099b

📥 Commits

Reviewing files that changed from the base of the PR and between e7fc7a1 and 76f3063.

📒 Files selected for processing (5)
  • apps/electron
  • packages/printer/src/transport/ipc-print.electron.ts
  • packages/printer/src/transport/network-adapter.electron.ts
  • packages/printer/src/transport/serial-adapter.electron.ts
  • packages/printer/src/transport/usb-adapter.electron.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/raw-print-unification

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown
Contributor

📊 Test Coverage Report

Package Statements Branches Functions Lines
@wcpos/core 🔴 23.1% 🔴 26.9% 🔴 22.3% 🔴 22.6%
@wcpos/components 🔴 24.6% 🔴 27.3% 🔴 16.8% 🔴 24.3%
@wcpos/database 🟡 60.2% 🔴 55.0% 🟡 62.7% 🔴 59.7%
@wcpos/hooks 🔴 52.4% 🔴 50.1% 🔴 45.0% 🔴 52.4%
@wcpos/utils 🔴 55.9% 🟡 61.5% 🟡 71.4% 🔴 53.8%
@wcpos/query 🟢 83.9% 🟡 76.9% 🟡 77.7% 🟢 84.0%
Average 🔴 50.0% 🔴 49.6% 🔴 49.3% 🔴 49.5%
Coverage Legend
  • 🟢 Good (≥80%)
  • 🟡 Moderate (60-79%)
  • 🔴 Needs improvement (<60%)
  • ⚪ No coverage data
--- 🤖 Updated by GitHub Actions • [View full report](https://github.com/wcpos/monorepo/actions/runs/27710954255)

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Deployment Summary

Item Status
Preview URL https://wcpos--e0lhkvgn5w.expo.app
E2E Tests ❌ Failed
Commit 1fe6590

🔗 Quick Links

❌ Failed Tests (4 total)

pos-checkout.spec.ts

  • [free-authenticated] should open checkout modal

    Error: �[2mexpect(�[22m�[31mlocator�[39m�[2m).�[22mtoBeVisible�[2m(�[22m�[2m)�[22m failed

  • [free-authenticated] should show order total in checkout

    Error: �[2mexpect(�[22m�[31mlocator�[39m�[2m).�[22mtoBeVisible�[2m(�[22m�[2m)�[22m failed

  • [free-authenticated] should cancel checkout and return to cart

    Error: �[2mexpect(�[22m�[31mlocator�[39m�[2m).�[22mtoBeVisible�[2m(�[22m�[2m)�[22m failed
    ...and 1 more in this file

📋 Full error details (first 5)

pos-checkout.spec.ts - should open checkout modal

Project: free-authenticated

Error: �[2mexpect(�[22m�[31mlocator�[39m�[2m).�[22mtoBeVisible�[2m(�[22m�[2m)�[22m failed

Locator: getByTestId('process-payment-button')
Expected: visible
Timeout: 10000ms
Error: element(s) not found

Call log:
�[2m  - Expect "toBeVisible" with timeout 10000ms�[22m
�[2m  - waiting for getByTestId('process-payment-button')�[22m

pos-checkout.spec.ts - should show order total in checkout

Project: free-authenticated

Error: �[2mexpect(�[22m�[31mlocator�[39m�[2m).�[22mtoBeVisible�[2m(�[22m�[2m)�[22m failed

Locator: getByTestId('process-payment-button')
Expected: visible
Timeout: 10000ms
Error: element(s) not found

Call log:
�[2m  - Expect "toBeVisible" with timeout 10000ms�[22m
�[2m  - waiting for getByTestId('process-payment-button')�[22m

pos-checkout.spec.ts - should cancel checkout and return to cart

Project: free-authenticated

Error: �[2mexpect(�[22m�[31mlocator�[39m�[2m).�[22mtoBeVisible�[2m(�[22m�[2m)�[22m failed

Locator: getByTestId('process-payment-button')
Expected: visible
Timeout: 10000ms
Error: element(s) not found

Call log:
�[2m  - Expect "toBeVisible" with timeout 10000ms�[22m
�[2m  - waiting for getByTestId('process-payment-button')�[22m

pos-checkout.spec.ts - should complete an order

Project: free-authenticated

Error: �[2mexpect(�[22m�[31mlocator�[39m�[2m).�[22mtoBeVisible�[2m(�[22m�[2m)�[22m failed

Locator: getByTestId('process-payment-button')
Expected: visible
Timeout: 10000ms
Error: element(s) not found

Call log:
�[2m  - Expect "toBeVisible" with timeout 10000ms�[22m
�[2m  - waiting for getByTestId('process-payment-button')�[22m

📸 Failure Screenshots

📷 pos checkout uses the lega 2abdd when supports checkout true free authenticated

pos checkout uses the lega 2abdd when supports checkout true free authenticated

📷 pos checkout POS Checkout should complete an order free authenticated

pos checkout POS Checkout should complete an order free authenticated

📷 pos checkout POS Checkout 99656 how order total in checkout free authenticated

pos checkout POS Checkout  99656 how order total in checkout free authenticated

📷 pos checkout POS Checkout should complete an order free authenticated

pos checkout POS Checkout should complete an order free authenticated

📷 pos checkout POS Checkout should open checkout modal free authenticated

pos checkout POS Checkout should open checkout modal free authenticated

📷 pos checkout POS Checkout should open checkout modal free authenticated

pos checkout POS Checkout should open checkout modal free authenticated

🔗 Debug Links


🤖 Updated by GitHub Actions

@kilbot kilbot changed the base branch from main to next June 17, 2026 22:05
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.

1 participant