Skip to content

A table call that arrived by sync rings until somebody answers - #867

Merged
sridharkalaibala merged 1 commit into
developfrom
fix/a-synced-call-rings-until-answered
Sep 17, 2026
Merged

sridharkalaibala merged 1 commit into
developfrom
fix/a-synced-call-rings-until-answered

Conversation

@sridharkalaibala

Copy link
Copy Markdown
Contributor

What

The step #859 named as next. A counter-made call rings until answered because the insert path raises waiting with the call's id and the dock's "seen" resolves that id. A call that arrived by sync never took that path, and the agent's pull line carries a count, not ids; since #859 it rang the arrival bell once and sat in the dock.

Now the till asks:

where change
api route GET /sales/waiterCalls/open the open calls, kiosk-keyed (optionalProtect, protectOrKioskKey, like the floor screen), registered before router.use(protect) because the main process has no session
api controller / service thin pass-through to the repository
api repository openWaiterCalls no branch now means every branch this installation serves ({ branch_id: undefined } matched nothing); each row says its branch_id so a device serving one branch can ignore another's
src/sync-agent-manager.js after a pull into waitercalls, read the open calls and raise waiting per call_id; a call already ringing is not started twice; a call that left the list (seen elsewhere, synced down) is resolved here; if the read fails, the single arrival bell as before

"Seen" at the dock resolves the alarm exactly as it does for a counter-made call. A shop must hear something, and must never hear an alarm it cannot stop; both are tested.

Tests

  • Desktop tests/a-cloud-order-reaches-the-kitchen-at-once.test.js 14/14: rings waiting per id with the branch; the same open call on the next pull does not ring twice; a call answered elsewhere is resolved on the next pull; a failed read falls back to one received bell; the route sits before the session guard and the till sends its key to that exact path.
  • API tests/unit/routes/sales.routes.test.js 4/4: the route is registered before protect and carries protectOrKioskKey.
  • Whole desktop suite 2,900/2,900. Docs regenerated (660 endpoints) and the README badge follows.

On hardware

Ordering page at a table, tap "call waiter": the till rings and keeps ringing until the dock's "seen"; seen on the cloud dashboard instead, the till stops on its next pull.

A counter-made call rings until answered: the API's insert path raises
'waiting' with the call's id and the dock's "seen" resolves that id. A
call that arrived by sync never took that path, and the agent's pull
line says how many rows landed, not which. Since #859 it rang the arrival
bell once and sat in the dock.

Now the till asks. After a pull into waitercalls, the main process reads
the open calls from its own API - GET /sales/waiterCalls/open, kiosk-keyed
and registered before the session guard because this process has no
session - and raises the same 'waiting' per call_id the counter would
have. "Seen" at the dock resolves it exactly as before. A call answered
somewhere else leaves the list on the next pull and is resolved here, so
nothing rings for a table that has been served. A second pull of the
same open call does not start a second alarm.

If the read fails, the arrival bell sounds once and the dock still shows
the call: a shop must hear something, and must never hear an alarm it
cannot stop.

openWaiterCalls with no branch now means every branch this installation
serves; `{ branch_id: undefined }` matched nothing. The row says its
branch, so a device serving one branch can ignore another's. The docs and
the README badge follow the new route: 660 endpoints.
@sridharkalaibala
sridharkalaibala merged commit 5fae82b into develop Sep 17, 2026
9 checks passed
@github-actions github-actions Bot added the ready for QA Merged to develop and live on develop.posnic.io - anyone can test it label Sep 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Merged to develop. Anyone can test this - you do not need write access.

Try it at https://develop.posnic.io, or run it yourself:

git fetch origin develop && git checkout develop
npm install && npm --prefix api install
npm run dev   # then http://localhost:3000

When you have tested it, say what you did and what happened, and set
QA passed or QA failed. If you cannot set labels, just comment -
a maintainer will.

Reporting that something is broken is as useful as fixing it. It is
better found here than by a shopkeeper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for QA Merged to develop and live on develop.posnic.io - anyone can test it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant