Skip to content

Somebody else got there first, and the waiter is told so - #117

Merged
sridharkalaibala merged 2 commits into
mainfrom
fix/somebody-else-got-there-first
Sep 16, 2026
Merged

sridharkalaibala merged 2 commits into
mainfrom
fix/somebody-else-got-there-first

Conversation

@sridharkalaibala

Copy link
Copy Markdown
Contributor

The handset half of Posnic/POS#821.

A save sends the whole order and the till keeps only what arrives, which is how a cancelled dish gets cancelled. On a floor with several handsets it is also how food goes missing:

Another waiter adds a biryani while this screen is open. This screen saves a list that never had it. The till removes a dish the kitchen has already cooked.

The bill goes out short and nobody is told.

What the phone now does

Both saves that rewrite the item list - the edit sheet and the move sheet - say which version of the order they were looking at. It is the order's own timestamp, handed back exactly as it arrived, nothing guessed. The till refuses a save written against an older one.

A full cancel is deliberately untouched. Cancelling the whole order is an intentional act on the order as a whole, and blocking it on a conflict would stop a legitimate cancel.

Being refused is not an error message

The waiter did nothing wrong, and lost nothing: what they typed was never sent.

  • They are told somebody else changed this order, not that something failed.
  • The sheet closes, rather than sitting there looking ready for a second tap at the same refusal.
  • The order is fetched again, so the screen tells the truth.

What happens next is theirs. Only a person knows whether the dish somebody else added was meant to go.

An order nobody has ever edited falls back to when it was opened, so a first edit is guarded too - which is the case a busy table hits most.

An ordinary failure still reads as a failure. A server that is down is a different problem, and a waiter must not be told somebody edited the order when nobody did.

Tests

✔ a move says which version of the order it was looking at
✔ an order nobody has edited falls back to when it was opened
✔ being refused reads as somebody else got there first
✔ the sheet closes on a refusal, rather than sitting there looking ready
✔ a refusal fetches the order again, so the screen tells the truth
✔ an ordinary failure still reads as a failure

Full suite: 302 passed.

One loose end, now closed

The new sentence shipped untranslated in the first commit, because #116 was rewriting the Tamil pack at the time and a line here would have collided with it. That merged, so the second commit adds it - rather than leaving a waiter who reads Tamil to meet one English sentence at the worst possible moment.

Note on rollout

POS#821 is on develop. Until it promotes to main, the handset sends seen_at and the live till ignores it. That is harmless by design - silence means yes - but two phones can still erase each other in production until that promotion happens.

A save sends the WHOLE order and the till keeps only what arrives, which
is how a cancelled dish gets cancelled. On a floor with several handsets
it is also how food goes missing: another waiter adds a biryani while
this screen is open, this screen saves a list that never had it, and the
till removes a dish the kitchen has already cooked. The bill goes out
short and nobody is told.

So both saves now say which version of the order they were looking at -
the order's own timestamp, handed back exactly as it arrived, nothing
guessed - and the till refuses one written against an older version.
Posnic/POS#821 is that half.

Being refused is not an error message. The waiter did nothing wrong and
lost nothing, because what they typed was never sent. They are told that
somebody else changed the order, the sheet closes rather than sitting
there looking ready for a second tap at the same refusal, and the order
is fetched again so the screen tells the truth. What happens next is
theirs: only a person knows whether the dish somebody else added was
meant to go.

An order nobody has ever edited falls back to when it was opened, so a
first edit is guarded too - which is the case a busy table hits most.

An ordinary failure still reads as a failure. A server that is down is a
different problem, and a waiter must not be told somebody edited the
order when nobody did.

The new sentence is not in the Tamil pack yet: that file is being
rewritten in the coverage PR and adding a line here would collide with
it. It follows once that lands.
The sentence shown when somebody else has changed the order was left in
English because the pack was being rewritten in another branch at the
time and a line here would have collided with it. That branch has landed,
so the loose end closes rather than waiting to be noticed by a waiter who
reads Tamil and meets one English sentence at the worst moment.
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.

1 participant