Repository navigation
fix(frontend): allow unauthenticated customer display pairing and guard clipboard copy - #1149
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
|
@greptile review |
[Medium impact] The PR appears safe to merge; no blocking issues remain.
|
|
@greptileai review |
eb08021 to
541d4eb
Compare
|
@greptileai review |
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-safetyTitle:
fix(display): verify pairing and safe copyingRequirements:
navigator.clipboardmay be unavailable.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
/customer-displayas a public, standalone route inAuthGuard(and documented it indocs/architecture/frontend.md) so paired customer displays load without a staff session or shared auth store hydration.CustomerDisplayCardagainst missingnavigator.clipboard.writeText, synchronous errors, and rejected promises, showing localized error toasts while leaving the displayed links selectable.frontend/e2e/customer-display-pairing.spec.tsfor 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.tsagainst the live E2E server, and captured live screenshots and API verification artifacts in the evidence directory; all scenarios passed.npx playwright test --config=playwright.config.ts --project=chromium e2e/customer-display-pairing.spec.tsand `~/.no-mistakes/evidence/01M4YHHJF53KVDSDZ7GYEVVESQ/03-paired-custom…npx playwright test --config=playwright.config.ts --project=chromium e2e/customer-display-pairing.spec.ts, `~/.no-mistakes/evidence/01M4YHHJF53KVDSDZ7GYEVVESQ/04-settings-after-r…npx playwright test --config=playwright.config.ts --project=chromium e2e/customer-display-pairing.spec.tsand `~/.no-mistakes/evidence/01M4YHHJF53KVDSDZ7GYEVVESQ/01-settings-pair…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.…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 }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.
npx playwright test --config=playwright.config.ts --project=chromium e2e/customer-display-pairing.spec.tsand `~/.no-mistakes/evidence/01M4YHHJF53KVDSDZ7GYEVVESQ/03-paired-custom…npx playwright test --config=playwright.config.ts --project=chromium e2e/customer-display-pairing.spec.ts, `~/.no-mistakes/evidence/01M4YHHJF53KVDSDZ7GYEVVESQ/04-settings-after-r…npx playwright test --config=playwright.config.ts --project=chromium e2e/customer-display-pairing.spec.tsand `~/.no-mistakes/evidence/01M4YHHJF53KVDSDZ7GYEVVESQ/01-settings-pair…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-pairingnpm run test:customer-display-confignpm run test:customer-display-settings-routenpm run test:backupnpm run test:database-tools-apinpm 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.