Skip to content

feat: page through the complete eligible customer display queue - #1270

Merged
khaira777 merged 7 commits into
mainfrom
fm/ship-1159-customer-display-pagination
Oct 21, 2026
Merged

khaira777 merged 7 commits into
mainfrom
fm/ship-1159-customer-display-pagination

Conversation

@khaira777

@khaira777 khaira777 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1159

Intent

Resolve FreeOpenSourcePOS/FloCafe GitHub issue #1159 (feat(customer-display): page through the complete eligible queue). Let customer displays (/customer-display) page through every eligible order, including orders older than the newest-100 feed window: add server-side cursor paging (100 per page) to GET /api/customer-display/feed while preserving paired display token authorization and the sanitized feed projection, load and merge all pages without duplicate orders in both paired display mode and signed-in staff mode, atomically update board state per poll cycle so status transitions and completed orders update cleanly without breaking the #1148 10-second TV visual page rotation, and immediately abort/clear on 401 token revocation. Verify with backend tests, Playwright E2E tests, and screenshots, run through /no-mistakes to open the PR linked to #1159 (Fixes #1159), and do not merge the PR.

What Changed

  • Added cursor-based pagination (cursor, next_cursor, and has_more) to GET /api/customer-display/feed with 100-order page limits, base64url cursor encoding, validation returning 400 for malformed cursors, and sanitized projections.
  • Updated /customer-display to traverse all queue pages via next_cursor in paired mode and before_id in signed-in staff mode, deduplicating orders and applying board updates atomically per poll cycle while preserving TV visual page rotations.
  • Added adaptive poll interval pacing to stay within API rate limits during multi-page fetches, per-page request timeout handling, and immediate in-flight request abortion with board reset on 401 token revocation.

Risk Assessment

✅ Low: The changes cleanly implement cursor-based pagination and rate-bounded polling for the customer display feed with proper status indexing, atomic state updates, and token revocation handling without regression risk.

Testing

Executed targeted backend tests, 18 Playwright customer display E2E tests, and 5 live scenarios against the running product on :3001 in Chromium at 1080p, capturing API payload JSON and 5 full-page PNG screenshots demonstrating pagination, TV rotation, atomic order status transitions, and token revocation. All checks passed.

  • Live validation: ✅ go - 5 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Server-side cursor pagination on GET /api/customer-display/feed pages through a 150-order queue in 100-item chunks with sanitized projection and rejects malformed cursors ✅ pass live ~/.no-mistakes/evidence/01M5FZPEB1JZBW7JCZPFFHA7YM/scenario-1-feed-api-pagination.json
Paired customer display TV loads and merges multi-page queue (>100 orders) without duplicates and rotates visible pages ✅ pass live ~/.no-mistakes/evidence/01M5FZPEB1JZBW7JCZPFFHA7YM/scenario-2-paired-tv-display-page1.png and ~/.no-mistakes/evidence/01M5FZPEB1JZBW7JCZPFFHA7YM/scenario-2-pair…
Signed-in staff mode (/customer-display) pages through complete order queue via /api/orders cursor pagination ✅ pass live ~/.no-mistakes/evidence/01M5FZPEB1JZBW7JCZPFFHA7YM/scenario-3-staff-mode-display.png
Real-time queue update cleanly transitions order from Preparing to Ready and purges completed orders on next poll ✅ pass live ~/.no-mistakes/evidence/01M5FZPEB1JZBW7JCZPFFHA7YM/scenario-4-atomic-order-transition.png
Display token revocation on running customer display immediately aborts polling, clears cached state, and displays unpaired screen ✅ pass live ~/.no-mistakes/evidence/01M5FZPEB1JZBW7JCZPFFHA7YM/scenario-5-token-revocation-unpaired.png
Evidence: Scenario 1: Feed API Cursor Pagination Evidence JSON

{ "scenario": "Server-side cursor paging on GET /api/customer-display/feed", "page1": { "status": 200, "orders_count": 100, "has_more": true, "next_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNi0wMi0wMSAwMDo1MTowMCIsImlkIjo1MX0", "first_order": { "id": 51, "number": "E-051", "status": "preparing" }, "last_order": { "id": 150, "number": "E-150", "status": "ready" } }, "page2": { "status": 200, "orders_count": 50, "has_more": false, "next_cursor": null, "first_order": { "id": 1, "number": "E-001", "status": "preparing" }, "last_order": { "id": 50, "number": "E-050", "status": "preparing" } }, "total_unique_orders": 150, "sanitized_keys": [ "id", "number", "status" ], "adversarial_tests": { "malformed_cursor_status": 400, "unauthenticated_status": 401 } }

{
  "scenario": "Server-side cursor paging on GET /api/customer-display/feed",
  "page1": {
    "status": 200,
    "orders_count": 100,
    "has_more": true,
    "next_cursor": "eyJjcmVhdGVkX2F0IjoiMjAyNi0wMi0wMSAwMDo1MTowMCIsImlkIjo1MX0",
    "first_order": {
      "id": 51,
      "number": "E-051",
      "status": "preparing"
    },
    "last_order": {
      "id": 150,
      "number": "E-150",
      "status": "ready"
    }
  },
  "page2": {
    "status": 200,
    "orders_count": 50,
    "has_more": false,
    "next_cursor": null,
    "first_order": {
      "id": 1,
      "number": "E-001",
      "status": "preparing"
    },
    "last_order": {
      "id": 50,
      "number": "E-050",
      "status": "preparing"
    }
  },
  "total_unique_orders": 150,
  "sanitized_keys": [
    "id",
    "number",
    "status"
  ],
  "adversarial_tests": {
    "malformed_cursor_status": 400,
    "unauthenticated_status": 401
  }
}
![Scenario 2: Paired TV Display Initial View (Page 1)](https://github.com/user-attachments/assets/4e047c65-c9d2-4ad4-81ef-e8cae156c3db) ![Scenario 2: Paired TV Display After 10s Visual Rotation](https://github.com/user-attachments/assets/a64381fe-35a6-4fe5-920c-b544dcc95c5b) ![Scenario 3: Signed-In Staff Mode Paginated Queue](https://github.com/user-attachments/assets/146b6f4f-8ff6-4822-84d3-ad8c80aeebf2) ![Scenario 4: Atomic Order Transition & Completion](https://github.com/user-attachments/assets/cdd5240e-f195-408b-8626-e42edcc93c81) ![Scenario 5: Revoked Token Immediate Abort & Unpaired Screen](https://github.com/user-attachments/assets/2deb7afc-c956-4392-a675-ad993ad6adf2)

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 - 5 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Server-side cursor pagination on GET /api/customer-display/feed pages through a 150-order queue in 100-item chunks with sanitized projection and rejects malformed cursors ✅ pass live ~/.no-mistakes/evidence/01M5FZPEB1JZBW7JCZPFFHA7YM/scenario-1-feed-api-pagination.json
Paired customer display TV loads and merges multi-page queue (>100 orders) without duplicates and rotates visible pages ✅ pass live ~/.no-mistakes/evidence/01M5FZPEB1JZBW7JCZPFFHA7YM/scenario-2-paired-tv-display-page1.png and ~/.no-mistakes/evidence/01M5FZPEB1JZBW7JCZPFFHA7YM/scenario-2-pair…
Signed-in staff mode (/customer-display) pages through complete order queue via /api/orders cursor pagination ✅ pass live ~/.no-mistakes/evidence/01M5FZPEB1JZBW7JCZPFFHA7YM/scenario-3-staff-mode-display.png
Real-time queue update cleanly transitions order from Preparing to Ready and purges completed orders on next poll ✅ pass live ~/.no-mistakes/evidence/01M5FZPEB1JZBW7JCZPFFHA7YM/scenario-4-atomic-order-transition.png
Display token revocation on running customer display immediately aborts polling, clears cached state, and displays unpaired screen ✅ pass live ~/.no-mistakes/evidence/01M5FZPEB1JZBW7JCZPFFHA7YM/scenario-5-token-revocation-unpaired.png
  • npm run test:customer-display-feed
  • npm run test:customer-display-pairing
  • cd frontend && npx playwright test --config=playwright.config.ts --project=chromium -g "customer display"
  • NODE_PATH=./node_modules:./frontend/node_modules node live_verification.js (running against live Express server on :3001 with Playwright Chromium)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@coderabbitai

coderabbitai Bot commented Oct 21, 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: 6c29af9d-efd7-4cd7-a572-ed8d35d5f909

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

@greptileai review this at apex

@greptile-apps

greptile-apps Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5 Tier: apex

[Medium impact] The changes affect the customer-display workflow for paired devices and signed-in staff.

Do not merge until both display modes can finish queues beyond 50 pages.

Findings

  1. P1 Older orders never appear ▶

Summary

Adds cursor paging to the display feed and merges pages in paired and signed-in displays.

  • The paired-display feed returns eligible orders in cursor-linked pages.
  • Customer displays page through the full eligible order queue.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Start poll] --> B{Display mode}
  B -->|Paired| C[Fetch feed with display token]
  B -->|Staff| D[Read settings and fetch orders]
  C --> E[Collect orders by ID]
  D --> E
  E --> F{More pages and fewer than 50?}
  F -->|Yes| G[Fetch next page]
  G --> E
  F -->|No| H[Replace board once]
  H --> I[Adjust poll interval]
Loading

Reviews (3) · Last reviewed commit: "no-mistakes(document): Document customer..." · Reviewed by Greptile

@khaira777

Copy link
Copy Markdown
Contributor Author

@greptileai review this at apex

@khaira777
khaira777 force-pushed the fm/ship-1159-customer-display-pagination branch from fd0a30a to a38c31a Compare October 21, 2026 20:08
@khaira777 khaira777 changed the title feat(customer-display): page through the complete eligible queue feat: page through the complete eligible customer display queue Oct 21, 2026
@khaira777

Copy link
Copy Markdown
Contributor Author

@greptileai review this at apex

@khaira777
khaira777 merged commit ee5a07f into main Oct 21, 2026
23 checks passed
@khaira777
khaira777 deleted the fm/ship-1159-customer-display-pagination branch October 21, 2026 20:46
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.

feat(customer-display): page through the complete eligible queue

1 participant