Skip to content

fix(printers): surface 409 on sole delete - #1649

Merged
khaira777 merged 4 commits into
mainfrom
fm/flocafe-fix-printer-delete-409
Nov 28, 2026
Merged

khaira777 merged 4 commits into
mainfrom
fm/flocafe-fix-printer-delete-409

Conversation

@khaira777

@khaira777 khaira777 commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Fix the confirmed non-product bug tracked in #1640 where PrintersSettingsTab.deletePrinterHw swallows the backend HTTP 409 error reason when deleting the sole default printer (showing a generic "Failed to delete printer" toast), and main/routes/printers.ts logs expected 4xx errors as [API] Internal error / res.locals.postHogError. Keep the existing 409 policy intact and ship a minimal fix with regression tests via a PR that closes #1640.

What Changed

  • Updated deletePrinterHw in frontend/src/components/settings/PrintersSettingsTab.tsx to format caught errors with printerErrorMessage(err, t('printerDeleteFailed')) so backend error reasons (including HTTP 409 responses) are surfaced in the error toast while preserving the generic fallback.
  • Updated PUT /:id and DELETE /:id in main/routes/printers.ts to return expected 4xx errors (400 <= statusCode < 500) before assigning res.locals.postHogError or logging [API] Internal error:.
  • Added regression tests in tests/printer-api.test.ts and tests/printer-error-toast-clarity.test.ts covering 409 response payloads, telemetry/logging suppression for expected 409s, and delete-error toast rendering in PrintersSettingsTab.

Closes #1640

Risk Assessment

✅ Low: The change is a minimal, well-bounded fix that surfaces backend 409 error reasons in printer deletion toasts, suppresses internal-error logging and PostHog error capture for expected 4xx responses in printer PUT/DELETE routes, and includes targeted regression tests with separate DELETE and PUT log snapshots.

Testing

Ran the targeted backend and frontend printer regression suites (test:printer-api and printer-error-toast-clarity.test.ts), built the backend and static desktop frontend, and drove all four scenarios live in headless Chromium against an isolated FloCafe server instance on localhost ports 13001-13003, capturing UI screenshots and live server logs; all checks and scenarios passed with no issues.

  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Deleting the sole default printer in Settings > Printers surfaces the backend HTTP 409 reason in the error toast and keeps the printer intact ✅ pass live ~/.no-mistakes/evidence/01M8FD2R0BXY62A9NYH1Z6NX19/scenario-1-sole-default-delete-409-toast.png
Expected 409 conflicts on DELETE and PUT /api/printers/:id do not log [API] Internal error or set res.locals.postHogError ✅ pass live ~/.no-mistakes/evidence/01M8FD2R0BXY62A9NYH1Z6NX19/scenario-2-api-409-and-server-logs.txt
Adversarial transport failure without an API error body falls back cleanly to the generic "Failed to delete" toast ✅ pass live ~/.no-mistakes/evidence/01M8FD2R0BXY62A9NYH1Z6NX19/scenario-3-network-error-generic-fallback-toast.png
Deleting a printer when multiple printers exist succeeds with HTTP 200 and removes only the deleted printer ✅ pass live ~/.no-mistakes/evidence/01M8FD2R0BXY62A9NYH1Z6NX19/scenario-4-multi-printer-delete-success.png

Settings > Printers showing 409 error reason toast on sole default printer delete

Evidence: Live Express API 409 responses and stderr verification (no [API] Internal error)

DELETE /api/printers/b41cb87f-4ae9-4763-a238-a85e1c3d17b9 -> HTTP 409 {"error":"Cannot delete the only default printer"} PUT /api/printers/b41cb87f-4ae9-4763-a238-a85e1c3d17b9 {"is_default":false} -> HTTP 409 {"error":"At least one printer must remain default"} Server stderr lines during both 409 requests (0): (none) Contains "[API] Internal error": false

DELETE /api/printers/b41cb87f-4ae9-4763-a238-a85e1c3d17b9 -> HTTP 409 {"error":"Cannot delete the only default printer"}
PUT /api/printers/b41cb87f-4ae9-4763-a238-a85e1c3d17b9 {"is_default":false} -> HTTP 409 {"error":"At least one printer must remain default"}
Server stderr lines during both 409 requests (0):
(none)
Contains "[API] Internal error": false

Settings > Printers falling back to generic "Failed to delete" toast on transport error without API body

Settings > Printers succeeding with "Printer deleted" toast when deleting a non-sole printer

Evidence: Full isolated E2E server stdout/stderr log during live verification
[stdout] [DB] Opening database at: /var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/flo-e2e-lzPKjQ/flo.db
[stdout] [DB] Schema: v0 → v126
[stdout] [DB] Triggering auto-backup before migrating v0 → v126...
[stdout] [DB] Auto-backup before migrating v0 → v126 created at /var/folders/y_/1ltcxtwj0zd_w1dg9jv4jl580000gn/T/flo-e2e-lzPKjQ/backups/flo-backup-2026-11-27T21-25-58-931Z-pre-v0-to-v126.db
[stdout] [DB] Install defaults loaded; first-run setup pending
[stdout] [MIGRATION v23] normalized: 0, unparseable: 0
[stdout] [MIGRATION v23] merged 0 duplicate customer(s)
[stdout] [MIGRATION v23] verification: 0 customers, 0 still non-E.164
[stdout] [MIGRATION v24] normalized: 0, unparseable: 0
[stdout] [MIGRATION v25] backfilled addons for 0 order items (0 unparseable, skipped)
[stdout] [MIGRATION v30] backfilled 0 order_item(s) still missing a normalized addons snapshot
[stdout] [MIGRATION v30] Dropped order_items.addons — order_item_addons is now the only place selected addons live.
[stdout] [MIGRATION v73] normalized 0 merchant template payload(s); 0 already canonical or left untouched
[stdout] [DB] integrity_check: ok
[stdout] [DB] foreign_key_check: clean
[stdout] [Server] Serving frontend from: {run-worktree}/frontend/out
[stdout] [Server] HTTP server running on http://localhost:13001
[stdout] [KDS] WebSocket server setup complete
[stdout] [Server] KDS WebSocket running on ws://localhost:13001/kds
[stdout] [WhatsApp] {"event":"startup_init","enabled":true,"hasCredentials":false,"connectedPhone":null}
[stdout] [WhatsApp] {"event":"socket_start_skipped","reason":"externally_disabled"}
[stdout] [KDS Server] Serving static files from: {run-worktree}/frontend/out
[stdout] [KDS Server] HTTP server running on http://localhost:13002
[stdout] [KDS] WebSocket server setup complete
[stdout] [KDS Server] WebSocket running on ws://localhost:13002/kds
[stdout] [Server App] Serving static files from: {run-worktree}/frontend/out
[stdout] [Server App] HTTP server running on http://localhost:13003
[stdout] [E2E] Main, KDS, and Server App servers ready
[stdout] [Printer] Detected printers: [
[stdout]   {
[stdout]     name: 'EPSON_TM_T20II',
[stdout]     make: 'Epson',
[stdout]     model: 'TM-T20',
[stdout]     connectionType: 'usb',
[stdout]     deviceUri: 'usb://EPSON/TM-T20II?serial=544336594580510000',
[stdout]     status: 'idle',
[stdout]     isDefault: true,
[stdout]     ipAddress: undefined,
[stdout]     port: undefined,
[stdout]     paperWidth: 'cols-48',
[stdout]     profileId: 'epson-tm-series',
[stdout]     compatibility: 'escpos_thermal'
[stdout]   },
[stdout]   {
[stdout]     name: 'PDFwriter',
[stdout]     make: 'Unknown',
[stdout]     model: 'Thermal Printer',
[stdout]     connectionType: 'usb',
[stdout]     deviceUri: 'pdfwriter:/',
[stdout]     status: 'idle',
[stdout]     isDefault: false,
[stdout]     ipAddress: undefined,
[stdout]     port: undefined,
[stdout]     paperWidth: 'cols-42',
[stdout]     compatibility: 'driver_only'
[stdout]   }
[stdout] ]
[stderr] [API] slow request GET /api/printers/detect 200 426ms db=0ms queries=4
[stderr] [API] slow request GET /api/printers/:id/status 200 602ms db=0ms queries=5
[stderr] [API] slow request GET /api/printers/discover 200 2511ms db=0ms queries=4
[stderr] [API] slow request GET /api/printers/:id/status 304 603ms db=0ms queries=5
[stdout] [Printer] Detected printers: [
[stdout]   {
[stdout]     name: 'EPSON_TM_T20II',
[stdout]     make: 'Epson',
[stdout]     model: 'TM-T20',
[stdout]     connectionType: 'usb',
[stdout]     deviceUri: 'usb://EPSON/TM-T20II?serial=544336594580510000',
[stdout]     status: 'idle',
[stdout]     isDefault: true,
[stdout]     ipAddress: undefined,
[stdout]     port: undefined,
[stdout]     paperWidth: 'cols-48',
[stdout]     profileId: 'epson-tm-series',
[stdout]     compatibility: 'escpos_thermal'
[stdout]   },
[stdout]   {
[stdout]     name: 'PDFwriter',
[stdout]     make: 'Unknown',
[stdout]     model: 'Thermal Printer',
[stdout]     connectionType: 'usb',
[stdout]     deviceUri: 'pdfwriter:/',
[stdout]     status: 'idle',
[stdout]     isDefault: false,
[stdout]     ipAddress: undefined,
[stdout]     port: undefined,
[stdout]     paperWidth: 'cols-42',
[stdout]     compatibility: 'driver_only'
[stdout]   }
[stdout] ]
[stderr] [API] slow request GET /api/printers/detect 304 624ms db=0ms queries=4
[stdout] [KDS] New client connection
[stderr] [API] Internal error: Error: Manager PIN required to complete unpaid order
[stderr]     at {run-worktree}/dist/main/routes/orders.js:2690:41
[stderr]     at sqliteTransaction ({run-worktree}/node_modules/better-sqlite3/lib/methods/transaction.js:65:24)
[stderr]     at withTxn ({run-worktree}/dist/main/db.js:2363:30)
[stderr]     at {run-worktree}/dist/main/routes/orders.js:2508:79
[stderr]     at {run-worktree}/dist/main/middleware/async-handler.js:8:56
[stderr]     at process.processTicksAndRejections (node:internal/process/task_queues:104:5) {
[stderr]   statusCode: 400
[stderr] }
[stdout] [KDS] Client disconnected
[stderr] [API] slow request GET /api/printers/discover 304 2511ms db=0ms queries=4
[stderr] [API] slow request GET /api/printers/:id/status 200 602ms db=0ms queries=5
[stderr] [API] slow request GET /api/printers/:id/status 304 605ms db=0ms queries=5
[stdout] [Printer] Detected printers: [
[stdout]   {
[stdout]     name: 'EPSON_TM_T20II',
[stdout]     make: 'Epson',
[stdout]     model: 'TM-T20',
[stdout]     connectionType: 'usb',
[stdout]     deviceUri: 'usb://EPSON/TM-T20II?serial=544336594580510000',
[stdout]     status: 'idle',
[stdout]     isDefault: true,
[stdout]     ipAddress: undefined,
[stdout]     port: undefined,
[stdout]     paperWidth: 'cols-48',
[stdout]     profileId: 'epson-tm-series',
[stdout]     compatibility: 'escpos_thermal'
[stdout]   },
[stdout]   {
[stdout]     name: 'PDFwriter',
[stdout]     make: 'Unknown',
[stdout]     model: 'Thermal Printer',
[stdout]     connectionType: 'usb',
[stdout]     deviceUri: 'pdfwriter:/',
[stdout]     status: 'idle',
[stdout]     isDefault: false,
[stdout]     ipAddress: undefined,
[stdout]     port: undefined,
[stdout]     paperWidth: 'cols-42',
[stdout]     compatibility: 'driver_only'
[stdout]   }
[stdout] ]
[stderr] [API] slow request GET /api/printers/detect 304 743ms db=0ms queries=4
[stderr] [API] slow request GET /api/printers/discover 304 2528ms db=0ms queries=4

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found → auto-fixed ✅
  • 🚨 tests/printer-api.test.ts:341 - In Test 6, loggedErrors.length = 0 at line 341 clears the captured console.error output from the DELETE /api/printers/:id request before line 363 asserts !loggedErrors.some((msg) =&gt; msg.includes(&#39;[API] Internal error&#39;)) for DELETE. As a result, line 363 actually checks the PUT request's logs (identical to line 380), so a regression where DELETE logs [API] Internal error would pass undetected. Snapshot deleteLoggedErrors = [...loggedErrors] before clearing loggedErrors (or use separate arrays for DELETE and PUT) and assert against deleteLoggedErrors at line 363.

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

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Deleting the sole default printer in Settings > Printers surfaces the backend HTTP 409 reason in the error toast and keeps the printer intact ✅ pass live ~/.no-mistakes/evidence/01M8FD2R0BXY62A9NYH1Z6NX19/scenario-1-sole-default-delete-409-toast.png
Expected 409 conflicts on DELETE and PUT /api/printers/:id do not log [API] Internal error or set res.locals.postHogError ✅ pass live ~/.no-mistakes/evidence/01M8FD2R0BXY62A9NYH1Z6NX19/scenario-2-api-409-and-server-logs.txt
Adversarial transport failure without an API error body falls back cleanly to the generic "Failed to delete" toast ✅ pass live ~/.no-mistakes/evidence/01M8FD2R0BXY62A9NYH1Z6NX19/scenario-3-network-error-generic-fallback-toast.png
Deleting a printer when multiple printers exist succeeds with HTTP 200 and removes only the deleted printer ✅ pass live ~/.no-mistakes/evidence/01M8FD2R0BXY62A9NYH1Z6NX19/scenario-4-multi-printer-delete-success.png
  • npm run test:printer-api
  • npx tsx --tsconfig tests/tsconfig.json -r ./tests/register-tsx.cjs tests/printer-error-toast-clarity.test.ts
  • npm run build && npm run build:frontend
  • Live headless Chromium + isolated tests/e2e-server.cjs verification on 127.0.0.1:13001-13003 driving sole-default delete 409 toast, DELETE/PUT 409 server stderr check, aborted-request fallback toast, and multi-printer delete success
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Issues

Closes #1640

Summary by CodeRabbit

  • Bug Fixes
    • Printer deletion failures now display the specific error message when one is provided, with a generic message shown for connection failures.
    • Attempts to delete the only default printer or unset its default status are handled as clear refusals rather than unexpected internal errors.

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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

No actionable comments were generated in the recent review.

Walkthrough

Printer update and delete handlers now return 4xx errors without internal-error tracking. Printer delete failures use the existing error formatter to show backend error text when available, with a generic fallback.

Changes

Printer error handling

Layer / File(s) Summary
Handle printer API client errors
main/routes/printers.ts, tests/printer-api.test.ts
The update and delete handlers return 4xx errors before internal-error tracking and logging. Tests verify the 409 responses for refusing to delete or unset the default printer, and check that no internal error is recorded or logged.
Surface printer delete errors
frontend/src/components/settings/PrintersSettingsTab.tsx, tests/printer-error-toast-clarity.test.ts
The delete failure toast uses printerErrorMessage, with printerDeleteFailed as the fallback. Tests check backend error text, the generic network-error fallback, and that failures do not show a success toast.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related issues

  • Issue 1645 — It concerns error details from the same printerErrorMessage helper, but for WebUSB test-print failures. This change covers printer deletion and does not address the test-print path.
Merge Risk: Minimal · previous review ec68a

Deleting a printer now shows the backend's reason for failure in the toast, such as when it is the only default printer. Expected 4xx printer responses are no longer reported as internal errors. The changes are small and reversible, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(printers): surface 409 on sole delete" matches the main change: the delete-printer toast now shows the backend 409 reason when deleting the sole default printer, and expected 4xx respon…
Description check Passed The description follows the repository template closely. It includes an Intent (issue linkage), Summary of changes, Risk Assessment, Testing with exact commands and results, screenshots, and a 'Closes…
Linked Issues check Passed [#1640] Objective 1: deletePrinterHw must pass the caught error to printerErrorMessage(err, t('printerDeleteFailed')). The AI-generated summary for PrintersSettingsTab.tsx reports this change (+2/-2).…
Out of Scope Changes check Passed The change set, as listed in the summary, covers four files: PrintersSettingsTab.tsx, main/routes/printers.ts, tests/printer-api.test.ts, and tests/printer-error-toast-clarity.test.ts. The source chan…
Full details: Title check

Explanation

The title "fix(printers): surface 409 on sole delete" matches the main change: the delete-printer toast now shows the backend 409 reason when deleting the sole default printer, and expected 4xx responses are no longer logged as internal errors. It is concise, uses a conventional prefix, and names the affected area. It omits the logging change, which is a secondary aspect and acceptable.

Full details: Description check

Explanation

The description follows the repository template closely. It includes an Intent (issue linkage), Summary of changes, Risk Assessment, Testing with exact commands and results, screenshots, and a 'Closes #1640' reference. It does not fill in the template's Scope, Compatibility and data safety, Cross-cutting surfaces table, Developer documentation checkbox, or Contributor checklist sections. These are non-critical omissions, so the description is mostly complete.

Full details: Linked Issues check

Explanation

[#1640] Objective 1: deletePrinterHw must pass the caught error to printerErrorMessage(err, t('printerDeleteFailed')). The AI-generated summary for PrintersSettingsTab.tsx reports this change (+2/-2). The fallback string is kept. The new test in tests/printer-error-toast-clarity.test.ts checks that a 409 body reaches the toast and that a transport error without a body shows the generic text. Objective 2: expected 4xx responses must not reach the internal-error path. The summary for main/routes/printers.ts reports that PUT /:id and DELETE /:id return 4xx errors before setting res.locals.postHogError or logging [API] Internal error. The PR description gives live evidence: 409 responses on DELETE and PUT, with server stderr containing no '[API] Internal error'. Objective 3: the 409 status policy stays unchanged. The summary and the PR description both state this. Limits: the whole-PR diff could not be read (changed blobs missing from checkout). The head file read was truncated before the DELETE handler, so the exact hunks were not checked directly. The PASS relies on the summary and the live evidence.

Full details: Out of Scope Changes check

Explanation

The change set, as listed in the summary, covers four files: PrintersSettingsTab.tsx, main/routes/printers.ts, tests/printer-api.test.ts, and tests/printer-error-toast-clarity.test.ts. The source changes (+2/-2 frontend, +6/-0 backend) map directly to #1640. The test changes support those objectives. No unrelated file or feature change is reported. The 400 order error in the PR log is not attributed to printer code and is not a change in this PR. Limit: the diff itself was unavailable, so the file list comes from the summary only.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • 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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 3cef902 and ec68ab7.

Files selected for processing: 4

  • frontend/src/components/settings/PrintersSettingsTab.tsx
  • main/routes/printers.ts
  • tests/printer-api.test.ts
  • tests/printer-error-toast-clarity.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Surface printer deletion conflicts without logging expected 4xx errors

🐞 Bug fix 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Show the backend’s reason when printer deletion is refused, with a generic fallback for transport
 failures.
• Return expected printer PUT and DELETE 4xx responses without internal-error logging or PostHog
 capture.
• Add regression tests for conflict payloads, logging suppression, and deletion toasts.
Merge Risk 🟢 Low

Blast radius 🟢 Low 💥 1 capability

  • 1 affected end-to-end capability after fault-specific containment; implementation boundaries do not widen its functional scope.
  • The API conflict response and settings toast jointly affect one bounded printer-configuration workflow: rejected default-printer changes are returned by the printer route and presented by the printer settings UI.
  • No separate printing, ordering, or payment behavior is changed.
Behavioral complexity 🟢 Low 🧩 Straightforward

  • Before, expected 4xx exceptions entered the generic logging and telemetry path, while deletion showed only its fallback message.
  • After, 4xx status errors return directly and deletion extracts a string error from the Axios response.
  • The new correctness condition is a simple status-range branch plus fallback precedence: preserve the API status/message, avoid internal-error reporting for expected conflicts, and use the backend reason only when it is a nonempty string.
  • Existing printer validation, transactions, and error-extraction helpers are reused rather than introducing new state or ordering protocols.
Potential damage 🟢 Low 🩹 Reversible

  • If this behavior regresses, users may receive only a generic deletion failure or operators may get noisy internal-error reporting; rejected printer state remains intact and retry or code rollback restores feedback.
  • No persistent printer data or external effect is introduced by these changes.
  • Reverting restores the previous handling; correcting the configuration or retrying remains available.
Assessed commit c4bb2fb
Diagram

sequenceDiagram
    actor User
    participant UI as Printer Settings
    participant Routes as Printer Routes
    participant DB as Printer DB
    participant Formatter as Error Formatter
    participant Telemetry as Error Telemetry
    User->>UI: Delete printer
    UI->>Routes: DELETE printer
    Routes->>DB: Check default invariant
    DB-->>Routes: Result or 409 conflict
    alt Expected 4xx
        Routes-->>UI: Status and error reason
        UI->>Formatter: Format deletion error
        Formatter-->>UI: Reason or fallback
        UI-->>User: Show error toast
    else Unexpected error
        Routes->>Telemetry: Capture and log error
        Routes-->>UI: Error response
    end
Loading
High-Level Assessment

Keep the localized fix. Reusing the settings component’s existing error formatter preserves its fallback behavior, while handling expected 4xx responses before telemetry leaves the default-printer policy unchanged. A shared route error handler would be broader than this printer-specific issue requires.

Files changed (4) +256 / -4

Bug fix (2) +8 / -2
PrintersSettingsTab.tsxShow the API reason for failed printer deletion +2/-2

Show the API reason for failed printer deletion

• The deletion catch block now uses the component’s existing printer error formatter. It displays a backend reason when present and retains the translated generic fallback otherwise.

frontend/src/components/settings/PrintersSettingsTab.tsx

printers.tsExclude expected PUT and DELETE 4xx responses from internal-error telemetry +6/-0

Exclude expected PUT and DELETE 4xx responses from internal-error telemetry

• Both route handlers now return caught 4xx errors before setting postHogError or logging an internal error. Unexpected errors retain the existing logging and response path.

main/routes/printers.ts

Tests (2) +248 / -2
printer-api.test.tsVerify printer conflict responses and telemetry suppression +59/-2

Verify printer conflict responses and telemetry suppression

• The API test checks the 409 reasons for deleting or unsetting the sole default printer. It separately snapshots DELETE and PUT logs and checks that neither response sets postHogError or logs an internal error.

tests/printer-api.test.ts

printer-error-toast-clarity.test.tsCover deletion conflict and transport-failure toasts +189/-0

Cover deletion conflict and transport-failure toasts

• A component-level regression test invokes the rendered delete button with mocked API failures. It checks that a 409 reason appears in the toast, an error without an API body uses the generic fallback, and neither failure shows a success toast.

tests/printer-error-toast-clarity.test.ts

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can commit Qodo's fix in one click with committable suggestions (GitHub & GitLab)

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@khaira777 khaira777 changed the title fix: surface printer delete 409 errors and skip internal error logging for 4xx responses fix(printers): surface 409 on sole delete Nov 27, 2026
@khaira777

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@khaira777

Copy link
Copy Markdown
Contributor Author

@greptile review

@greptile-apps

greptile-apps Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5 · The behavior appears safe to merge once the test comment meets the repository’s explicit rule.RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes affect printer deletion feedback and error reporting for two printer routes.

The behavior appears safe to merge once the test comment meets the repository’s explicit rule.

Findings

  1. P2 Comment includes forbidden issue tag ▶

Summary

The PR makes printer-delete errors clearer without changing the existing 409 policy.

  • Printer deletion toasts show the server’s reason when it refuses a request.
  • Printer update and delete refusals no longer count as internal errors.

No behavioral defect was found. One new test comment must be adjusted to meet the repository’s comment rule.

Checks were limited to source review; builds, tests, and browser checks were not run.

Acknowledged fix: khaira777’s PR description notes that DELETE assertions previously inspected PUT logs. The current code saves separate DELETE and PUT snapshots.

Reviews (1) · Last reviewed commit: "no-mistakes(review): snapshot DELETE and..." · Reviewed by Greptile

@khaira777
khaira777 merged commit 8b1735e into main Nov 28, 2026
23 checks passed
@khaira777
khaira777 deleted the fm/flocafe-fix-printer-delete-409 branch November 28, 2026 01:32
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.

fix(printers): surface backend 409 error on sole printer delete

1 participant