Skip to content

fix(frontend): allow unauthenticated customer display pairing and guard clipboard copy - #1149

Merged
khaira777 merged 3 commits into
mainfrom
codex/customer-display-browser-safety
Oct 15, 2026
Merged

khaira777 merged 3 commits into
mainfrom
codex/customer-display-browser-safety

Conversation

@khaira777

@khaira777 khaira777 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Intent

PR 10 - Verify merged pairing and handle unavailable clipboard access (Fixes #1141)
Related merged PR: #1105. Create a separate follow-up; do not reopen its resolved findings.
Branch: codex/customer-display-browser-safety
Title: fix(display): verify pairing and safe copying

Requirements:

  • Confirm current main contains newest-100 selection, revoked-link clearing and the production feed limiter.
  • Add browser coverage for pairing without a staff session, token-fragment removal, reload, revocation, link clearing and revoking a different device.
  • Test copying on plain LAN HTTP where navigator.clipboard may be unavailable.
  • Guard both copy actions against missing clipboard support, synchronous exceptions and rejected promises. Use existing localized failure feedback and leave the visible link selectable.
  • Do not add a clipboard package, generic abstraction or insecure workaround.
  • Retain existing API/token scope, sanitized feed, backup exclusion and restore invalidation.

Acceptance: unavailable clipboard access does not throw or crash the settings UI; pairing/reload/revocation works; latest eligible orders remain included above 100; tokens cannot access other APIs.

What Changed

  • Registered /customer-display as a public, standalone route in AuthGuard (and documented it in docs/architecture/frontend.md) so paired customer displays load without a staff session or shared auth store hydration.
  • Guarded both URL copy actions in CustomerDisplayCard against missing navigator.clipboard.writeText, synchronous errors, and rejected promises, showing localized error toasts while leaving the displayed links selectable.
  • Added Playwright E2E coverage in frontend/e2e/customer-display-pairing.spec.ts for unauthenticated pairing, URL token-fragment stripping, reload persistence, device revocation and link clearing, and clipboard failure handling.

Risk Assessment

✅ Low: The changes are well-bounded to allowing unauthenticated access on /customer-display for paired tokens in AuthGuard, guarding the two CustomerDisplayCard clipboard copy actions against missing/throwing/rejecting navigator.clipboard, updating the architecture documentation, and adding end-to-end Playwright coverage.

Testing

Ran the backend customer-display pairing, config, settings-route, backup/restore, and database-tools test suites, built the backend and static Next.js frontend, executed the 4 Playwright E2E browser tests in frontend/e2e/customer-display-pairing.spec.ts against the live E2E server, and captured live screenshots and API verification artifacts in the evidence directory; all scenarios passed.

  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Unauthenticated browser pairs a customer display via #token= URL fragment, strips the fragment from the URL, renders active orders, and stays paired across reload ✅ pass live npx playwright test --config=playwright.config.ts --project=chromium e2e/customer-display-pairing.spec.ts and `~/.no-mistakes/evidence/01M4YHHJF53KVDSDZ7GYEVVESQ/03-paired-custom…
Revoking another paired display preserves the active display and its visible pairing link, while revoking the active display clears the pairing link and disconnects the display board on reload ✅ pass live npx playwright test --config=playwright.config.ts --project=chromium e2e/customer-display-pairing.spec.ts, `~/.no-mistakes/evidence/01M4YHHJF53KVDSDZ7GYEVVESQ/04-settings-after-r…
Adversarial clipboard failure modes (missing navigator.clipboard on plain LAN HTTP, synchronous throw, and rejected promise) on both customer-display copy buttons show localized error toasts without p… ✅ pass live npx playwright test --config=playwright.config.ts --project=chromium e2e/customer-display-pairing.spec.ts and `~/.no-mistakes/evidence/01M4YHHJF53KVDSDZ7GYEVVESQ/01-settings-pair…
Sanitized customer display feed selects the newest 100 eligible orders sorted oldest-first, enforces the 120 req/min rate limit, rejects display tokens on non-feed API routes, and excludes/clears disp… ✅ pass live npm run test:customer-display-pairing, npm run test:backup, npm run test:database-tools-api, and `~/.no-mistakes/evidence/01M4YHHJF53KVDSDZ7GYEVVESQ/02-live-api-verification.…

Settings KDS tab with paired displays, visible selectable pairing link, and clipboard unavailable error toast

Evidence: Live API verification of sanitized display feed, 120 req/min rate limiter, token scope isolation, and database export exclusion

{ "feedStatus": 200, "feedRateLimitHeader": "120", "feedOrderCount": 2, "feedOrders": [ { "id": 1, "number": "ORD-20261015-0001", "status": "preparing" }, { "id": 2, "number": "ORD-20261015-0002", "status": "ready" } ], "ordersEndpointWithDisplayTokenStatus": 401, "exportContainsCustomerDisplayTokensTable": false }

{
  "feedStatus": 200,
  "feedRateLimitHeader": "120",
  "feedOrderCount": 2,
  "feedOrders": [
    {
      "id": 1,
      "number": "ORD-20261015-0001",
      "status": "preparing"
    },
    {
      "id": 2,
      "number": "ORD-20261015-0002",
      "status": "ready"
    }
  ],
  "ordersEndpointWithDisplayTokenStatus": 401,
  "exportContainsCustomerDisplayTokensTable": false
}
![Unauthenticated customer display board paired via #token= URL fragment showing active preparing and ready orders](https://github.com/user-attachments/assets/95878d98-90eb-40d6-bf38-6b3048285942) ![Settings KDS tab after revoking the paired display showing the one-time pairing link cleared](https://github.com/user-attachments/assets/b97828dc-4d67-4e8e-95bb-9945a23269f5) ![Customer display board after token revocation showing the unpaired state and cleared stored token](https://github.com/user-attachments/assets/fea21310-cd3a-48a8-b3f0-b9f5b491cbd9)

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.

  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Unauthenticated browser pairs a customer display via #token= URL fragment, strips the fragment from the URL, renders active orders, and stays paired across reload ✅ pass live npx playwright test --config=playwright.config.ts --project=chromium e2e/customer-display-pairing.spec.ts and `~/.no-mistakes/evidence/01M4YHHJF53KVDSDZ7GYEVVESQ/03-paired-custom…
Revoking another paired display preserves the active display and its visible pairing link, while revoking the active display clears the pairing link and disconnects the display board on reload ✅ pass live npx playwright test --config=playwright.config.ts --project=chromium e2e/customer-display-pairing.spec.ts, `~/.no-mistakes/evidence/01M4YHHJF53KVDSDZ7GYEVVESQ/04-settings-after-r…
Adversarial clipboard failure modes (missing navigator.clipboard on plain LAN HTTP, synchronous throw, and rejected promise) on both customer-display copy buttons show localized error toasts without p… ✅ pass live npx playwright test --config=playwright.config.ts --project=chromium e2e/customer-display-pairing.spec.ts and `~/.no-mistakes/evidence/01M4YHHJF53KVDSDZ7GYEVVESQ/01-settings-pair…
Sanitized customer display feed selects the newest 100 eligible orders sorted oldest-first, enforces the 120 req/min rate limit, rejects display tokens on non-feed API routes, and excludes/clears disp… ✅ pass live npm run test:customer-display-pairing, npm run test:backup, npm run test:database-tools-api, and `~/.no-mistakes/evidence/01M4YHHJF53KVDSDZ7GYEVVESQ/02-live-api-verification.…
  • npm run test:customer-display-pairing
  • npm run test:customer-display-config
  • npm run test:customer-display-settings-route
  • npm run test:backup
  • npm run test:database-tools-api
  • npm run build && npm run build:frontend && cd frontend && npx playwright test --config=playwright.config.ts --project=chromium e2e/customer-display-pairing.spec.ts
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@coderabbitai

coderabbitai Bot commented Oct 15, 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
  • Configuration used: Repository: FreeOpenSourcePOS/FloCafe/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bb9e272a-ec94-4cc4-8d04-8d42eb82a782

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

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

@khaira777

Copy link
Copy Markdown
Contributor Author

@greptile review

@greptile-apps

greptile-apps Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issues remain.

Summary

Allows paired customer displays to load without a staff session and catches clipboard failures in both copy actions.

  • Paired customer displays can open without a staff login.
  • Customer display copy buttons stay usable when clipboard access fails.

Diagram

sequenceDiagram
  participant Manager
  participant Settings
  participant Display
  participant API
  Manager->>Settings: Pair display
  Settings-->>Manager: Link with token fragment
  Manager->>Display: Open pairing link
  Display->>Display: Save token and remove fragment
  Display->>API: Request feed with display token
  API->>API: Check token and revocation
  API-->>Display: Limited board data or 401
Loading

Reviews (3) · Last reviewed commit: "test(display): isolate clipboard failure..." · Reviewed by Greptile

@khaira777

Copy link
Copy Markdown
Contributor Author

@greptileai review

@khaira777
khaira777 force-pushed the codex/customer-display-browser-safety branch from eb08021 to 541d4eb Compare October 15, 2026 01:24
@khaira777 khaira777 changed the title fix(display): verify pairing and safe copying fix(frontend): allow unauthenticated customer display pairing and guard clipboard copy Oct 15, 2026
@khaira777

Copy link
Copy Markdown
Contributor Author

@greptileai review

@khaira777
khaira777 merged commit 7e80802 into main Oct 15, 2026
24 checks passed
@khaira777
khaira777 deleted the codex/customer-display-browser-safety branch October 15, 2026 01:33
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(display): guard customer-display pairing link copy when clipboard API is unavailable and add browser E2E coverage

1 participant