The shop's declared default, actually firing - #795
Merged
Merged
Conversation
Owner: "let restaurent owner decide that. give option auto cancel or auto
accept. based ont time he defines it. by default dont accpept or reject."
waiting-order-policy.js was written, tested and merged, and decided
perfectly for nobody. Two dead ends, one on top of the other:
setPolicy() on the desktop OrderAlert was called from nowhere, so the
policy was always { onSilence: 'nothing', decideAfterMinutes: 0 } and
decide() could only ever answer "nothing". There was no setting to feed
it either. So "auto cancel after ten minutes" has never once happened.
And when it did speak, the till emitted posnic:order-decided on the
process bus, WHICH NOTHING LISTENED TO - and then deleted the order from
its pending map. The alarm went quiet with the order still sitting there
and the customer still waiting. An alarm that stops is a promise that
somebody dealt with it, and that promise was false. That is the exact
failure this whole area exists to prevent, and it was built in.
The rule now fires in the API. The till is a sound module, and its own
comment says deciding belongs where the order lives; it is also the wrong
half, because a shop served from the cloud has no till and its held
orders would sit for ever. Both halves read the same pure policy for
different fields: the till reads alert and reach and makes a noise, the
server reads decide and moves the order. Two copies, because the API
ships outside the asar archive, pinned by a behavioural test over a
thousand combinations.
It goes through decideOnOrder, the same door a person at the queue uses,
so an automatic acceptance prints its kitchen ticket exactly the way a
tapped one does rather than by a second path that would drift from it.
AND IT READS THE ORDER BACK BEFORE IT ANNOUNCES ANYTHING. decideOnOrder
narrows its write by whatever tenant the process was last serving and
answers success on what it asked for rather than on what changed, so a
write that matched nothing still says yes. Stopping the alarm on that
would be the same bug arriving by a different door.
Nothing happens unless a shop asked. Absent settings mean nothing, both
halves of the rule are required, an order older than twelve hours is left
for a person, and an aggregator's own deadline is never overrun.
Settings sit under New online orders, beside "When an order arrives", and
are hidden entirely while a shop is on automatic.
Contributor
|
Merged to 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:3000When you have tested it, say what you did and what happened, and set Reporting that something is broken is as useful as fixing it. It is |
This was referenced Sep 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Your ask: "let restaurent owner decide that. give option auto cancel or auto accept.
based ont time he defines it. by default dont accpept or reject."
It was built, and it has never once happened
waiting-order-policy.jswas written, tested and merged. It decides perfectly.Nothing ever asked it for a decision it could act on - two dead ends, one on top
of the other:
setPolicy()on the desktop alarm was called from nowhere, so the policy wasalways
{ onSilence: 'nothing', decideAfterMinutes: 0 }anddecide()could onlyever answer "nothing". There was no setting to feed it either.
posnic:order-decidedon the process bus -which nothing listened to - and then deleted the order from its pending map.
So the alarm went quiet with the order still sitting there and the customer still
waiting. An alarm that stops is a promise that somebody dealt with it, and that
promise was false. That is the exact failure this whole area exists to prevent, and it
was built in.
Where the rule lives now
In the API, not the till. Three reasons:
lives: "a sound module that could cancel a customer's order would be a surprising
place to find that power."
ever.
decideOnOrder, the same door a person at the queue uses, so anautomatic acceptance prints its kitchen ticket exactly the way a tapped one does -
rather than by a second path that would drift from it.
Both halves read the same pure policy for different fields: the till reads
alertandreachand makes a noise, the server readsdecideand moves the order. Two copies,because the API ships outside the asar archive, pinned by a behavioural test over a
thousand combinations - a drift there would have a shop's alarm and a shop's rule
working to two different clocks.
And it reads the order back before it announces anything
decideOnOrdernarrows its write by whatever tenant the process was last serving,and reports success on what it asked for rather than on what changed. A write that
matched nothing still answers yes. Stopping the alarm on that would be the same bug
arriving by a different door, so the state is checked and silence is only ever earned.
What it will not do
The setting
Settings → New online orders, beside "When an order arrives":
Cancel it and tell the customer
Hidden entirely while a shop is on automatic, because a shop that holds nothing has no
queue for this to be about. The alarm keeps asking either way, backing off as it goes.
Checks
api: 375 suites, 10,829 tests (18 new, against a real mongod)tests/: the two policy copies over 1,000+ combinations, plus wiring tests that therule is actually started and that the till no longer pretends to decide
npm run check: 7/7