Build a Delivery Desk for a Pizzeria
A pizzeria with its own drivers charges cards at checkout, prints tickets in the kitchen and hands out deliveries in a WhatsApp group, and on a busy Friday those three never agree on what happened to an order. You will build the ordering system where the card hold, the kitchen and the driver always agree, and prove it on a simulated Friday evening with failures injected.
The brief
The client
I own a pizzeria in a town of about 40,000 people. Customers order on our website, a plugin charges the card at checkout, a cloud printer in the kitchen prints the ticket, and on Friday evenings seven drivers take the pizzas out.
One Friday at 19:40 we ran out of dough. The kitchen phoned 11 customers whose cards the plugin had already charged, and I refunded each of them by hand on Monday by editing the order total, which left three of them with a different amount than the others. The drivers get orders in a WhatsApp group where the first one to reply "mine" takes it, and that same night two drivers drove off with the same order.
I need an ordering system where the card hold, the kitchen and the driver always agree on what happened to an order, and where at closing I can show where every cent went, tips included.
The problem
The plugin captures the card at checkout and keeps one status text per order. The plugin, the printer app and the drivers' WhatsApp replies all effectively overwrite it, so nothing can answer whether the money, the kitchen and the driver agree.
The website sells and charges whether or not the kitchen can make the pizza, because taking payment never waits for the kitchen to say yes. The same happens when the printer loses its connection, so the shop also has to stop selling while the kitchen cannot be reached. Every refund is a manual edit of an order total, so a pizza removed before capture and a pizza removed after capture end with different amounts, and the owner cannot say which is right.
Tips are inside the card total, so they sit in the day's takings and reach the drivers in cash when somebody remembers. Under the provider's terms the shop loses the card fee on a refunded capture, and the Monday refunds cost it the fees on 11 captures and the goodwill of 11 customers. A closing report that matches neither the till nor the card provider's list of captures takes an evening to reconcile by hand.
The client's name and figures are invented for this brief; the rules and the failures are ones that real businesses of this kind work with.
The spec
Requirements
- Let the owner publish a menu with modifiers, allergen tags and opening hours, and mark items sold out.
- Let a customer build a basket and see a total with delivery fee and tip that equals the amount held on the card.
- Place an order so that a repeated or simultaneous submit creates one order and one card hold.
- Hold the card before the kitchen is asked, and charge only for the lines that were delivered plus the delivery fee and tip.
- Show each order on the kitchen tablet, take an acceptance with a prep time or a rejection within 5 minutes, and release the hold on rejection, no answer or cancellation.
- Stop taking orders while the kitchen tablet has been silent for 3 minutes, and resume when it returns.
- Let drivers claim an order from a board, give it to exactly one, take it back when the driver hands it in or never shows, and tell the owner when nobody claims it.
- Show the customer the order's status on a page that stays correct after any restart or crash, and give the owner the history of every order and a list of problems that need a person.
- Show the owner a day report with every delivered order as lines, tips in their own account, that matches the card provider's list of charges.
- Erase a customer's name, phone and address on request while the day report and the delivery proofs stay intact.
Deliverables
- Your repository starts the shop and the three stand-ins (a card provider, a kitchen tablet and a driver phone) with one command.
- A README that takes a reviewer from a fresh clone to one order placed, held, accepted, delivered, charged and visible in the day report in 15 minutes, and lists the command for each test.
- The replay of the Friday from the first Phase: the parties, the steps, what is left behind when a step fails and every limit with its number, kept in your repository and corrected when the build shows it wrong.
- A tablet integration guide: how a kitchen tablet asks the shop for tickets and answers them, enough for another developer to build a real tablet app.
- A test suite that includes race tests with real simultaneous requests and crash tests that kill the running shop, and the committed results of the simulated Friday with every injected failure listed.
- A way to run the shop's day faster than real time and to cause each outside failure the brief names: a clock you control, the stand-ins and the Friday runner.
- A short owner's note: what the owner can do (stop and reopen orders, clear entries on the problem list, ask for an erasure), what each kind of entry on the list means and what to do about it.
Out of scope
- A marketplace of many restaurants, commission and restaurant payouts. The client is one pizzeria, and the three-sided money belongs to "Build a Food Delivery Platform".
- Tax. Menu prices are the final prices the customer pays. Rates and rules vary by place and need a source, and the problem under study does not depend on them.
- Bank challenge (3-D Secure). It needs a customer redirect and a deadline of its own, and the hold rules can be learned without it.
- Refunds after capture, "not received" claims and bank disputes. The shop settles these in the provider's dashboard.
- Checking that the provider's messages are genuine. A real provider signs them; here the stand-in runs on your own machine and the failure under study is the repeat, not the forgery.
- Real maps, geocoding and routing. A delivery area is a list of 25 postcodes the shop serves.
- Customer and driver mobile apps. A web page and the stand-ins play those roles.
- A real payment provider or real card data. A stand-in keeps the build on one machine and card data out of your repository.
- Automatic offers to drivers one at a time. A board where the first claim wins teaches the same race with less to build.
- Batching, one driver carrying two orders. It turns assignment into a matching problem.
- Collection orders where the customer picks up. They skip the driver step, and delivery keeps one fixed path.
- Driver wages, rotas and payroll. The shop records the tips owed to a driver, and paying a wage is the shop's business.
- Promotions, loyalty, ratings and reviews. Each adds pricing or moderation rules outside the problem under study.
- Push, SMS and email notifications. The status page is how the customer learns an order changed.
- Customer accounts and login. Guest checkout with a phone number is enough, and the tool is not meant to sit on the internet.
- Cloud deployment and Kubernetes. Everything runs on one machine.
- Payment methods other than cards, such as iDEAL. The shop takes cards only, because the card is held before the kitchen says yes and charged after delivery, and iDEAL takes the money at once.
Architectural constraints
- Amounts are exact to the cent, in euros, and the total shown to a customer equals the amount held on their card.
- A customer's card is never charged for an order the kitchen has not accepted, and never for more than the delivered lines plus the delivery fee and the tip.
- A customer can cancel only until the kitchen accepts. After acceptance the cancel is refused.
- One order never holds or charges a card twice, however often the same request or message arrives and however the shop is restarted.
- An order keeps the prices it was placed at when the menu changes later.
- No card number is ever stored or logged by the shop. Only the provider's payment tokens are.
- A wrong clock on the kitchen tablet or on a driver's phone moves no limit. The shop's own time decides every limit.
- A restart or crash at any moment leaves no order waiting forever and no card hold open for an order that has ended, except a hold that is on the owner's list of problems.
- Tips and food sales are separate in the day report and never netted against each other.
- A line in the day report is never edited or deleted.
- Name, phone and delivery address are erased on request. Report lines and delivery proofs stay, identified by order reference, for 7 years. The Dutch tax administration (Belastingdienst) requires the shop to keep its business records for 7 years, and that duty is the owner's.
- The shop never deactivates a driver on its own. It raises an entry on the owner's list.
- Opening hours and the dates of the day report use Europe/Amsterdam.
Prerequisites
You have built one application with a database, in any language and framework. You need no distributed systems experience and no payments experience, and no other Codyssey project. You do not need to know how a pizzeria takes and delivers its orders; the first Phase explains the business and the words the brief uses. You build the stand-ins yourself. The race tests in this brief send real simultaneous requests, so your shop has to handle several requests at the same moment: a setup that handles one request at a time hides the bugs these tests exist to catch. Having once debugged two records that disagreed about the same fact will make most of this brief feel familiar.
Free to start. An account is what keeps track of the checkpoints you finish.
Work out the rules and start the shop
Produces a worked sheet of what happens to one order, with the client's numbers, and a shop that starts with one command and runs on a clock you control. Leaves all ordering behaviour for later, so there is no menu, no order and no payment yet.
Acceptance criteria
Before you write any ordering code, you write a replay in your repository: one document. It tells the Friday the kitchen ran out of dough at 19:40, and for each moment it says what the old shop did and what the rules should have done. It opens with the parties: the customer, the card provider, the kitchen tablet, the drivers' phones and the owner.
The timeline has one row for each moment: the cards charged at checkout before the kitchen had said yes, the dough running out at 19:40, the kitchen phoning 11 customers whose cards were already charged, the refunds made on Monday by editing the order total, which left three of the 11 with a different amount than the others, and the two drivers who drove off with the same order. Each row ends with the answer the rules below give. Where the steps and limits below do not settle a row, the replay says so as a question to the owner.
A table lists the steps of the order as it should have gone, in sequence: placed, card held, kitchen asked, driver found, picked up, delivered, card charged, shown in the day report. Each row names who acts, what proves the step happened, and what must be put right if a later step fails. That column reads: release the hold, withdraw the ticket from the tablet, take the order off the drivers' board, leave the line out of the bill. The charge row says the money is taken last and only for the lines that were delivered.
A table of limits carries the client's numbers and says what happens when each one passes: the shop knows within 2 minutes of placement whether the card was held; the kitchen has 5 minutes to answer a ticket; drivers see an order from the accepted time plus the prep minutes minus 8 minutes, never before it was accepted; the owner is told 10 minutes after that moment or after the prep time ends, whichever is later, if nobody has claimed the order; a driver who claimed an order has 15 minutes after the later of the claim and the prep end to pick it up; the tablet counts as silent after 3 minutes without contact; a delivered order is charged within 5 minutes of delivery.
The replay then lists, for each of four failures, the steps that are put right and the steps never reached: the kitchen rejects the order; the customer cancels before the kitchen accepts; nobody claims the order; the provider makes the hold but the answer never arrives. The rejected order lists "release the hold" as its only step to put right. The replay states that a cancel after acceptance is refused and that no card is charged for an order the kitchen has not accepted.
A last section, "If the shop dies here", takes each step in turn and says what the customer and the owner would be left with if the shop were killed right after finishing it and before doing what follows, and what must happen after the restart to put it right. The section names a hold nobody released, a ticket never sent and a charge never recorded as cases.
The replay fixes the words the customer's status page uses in plain language: waiting for payment, waiting for the kitchen, being prepared, with a driver, on its way, delivered, completed, cancelled, rejected by the kitchen, not answered by the kitchen, card could not be held, card could not be charged.
Architectural guidance
Writing down what is put right at each step and each limit with its number before building is the cheap moment to decide them. If you skip it, the code decides them by accident, usually in the order the first bug reports arrive.
Acceptance criteria
One command, named in the README, starts everything the shop needs to run, and a second command stops it. Later Phases add the card provider stand-in, the kitchen tablet stand-in and the driver phone stand-in to the same command. Within 60 seconds of a start from a fresh clone, the README's check that the shop is up succeeds.
The shop can run with simulation switched on or off. With simulation on, you can set the shop's time to a given moment, such as Tuesday 17:00 in Europe/Amsterdam, and ask the shop what time it believes it is; the answer matches. Moving the time 11 minutes forward makes the shop say 11 minutes later. The time stays where it was put until it is moved again.
With simulation off, a request to set the time is refused with a message saying simulation is off, and the shop's time stays the real time. A shop started with simulation on says so when asked, so nobody mistakes a simulated shop for the real one.
Architectural guidance
A bug that costs money only on a busy Friday cannot be reproduced by waiting for a Friday. A test that sleeps five real minutes to watch a limit pass is a test nobody runs, so limits go untested until a customer finds them. Moving the clock on purpose is also the only way to see what happens to waiting orders while the shop is switched off.
Architectural walkthrough
How a pizzeria takes delivery orders
The client owns a pizzeria in a town of about 40,000 people. A customer orders on the website, picks from a menu with extras such as cheese or a choice of size, adds a tip if they want to, and pays by card. The shop delivers to a list of 25 postcodes and charges a delivery fee of 300 cents. The kitchen sees each order on a tablet, and a printer prints the ticket. On Friday evenings seven drivers take the pizzas out.
The card is held when the order is placed, which sets the money aside without taking it. The kitchen then says yes or no. A yes comes with a prep time, and a no or no answer within 5 minutes releases the hold. The customer is charged after delivery, for the delivered lines plus the delivery fee and the tip. If the kitchen cannot make an item, it drops that line from the order. The tip belongs to the driver. The card provider takes a fee on each charge.
At closing the owner wants a day report that shows where every cent went and matches the card provider's list of charges. The shop keeps its report lines and delivery proofs for 7 years, because Dutch law requires it to keep business records that long.
The words this brief uses:
Hold: money set aside on a customer's card at order time without being taken. A hold expires after a window, 7 days by default.
Charge: taking the held money, after delivery.
Release: letting a hold go without charging.
Modifier: an extra or a choice on a menu item, such as extra cheese.
Prep time: how long the kitchen says an order will take.
Board: the list of orders ready for a driver, from which a driver claims one.
Delivery proof: the record that an order arrived, with the driver and the times.
Day report: the owner's closing report of every delivered order, line by line.
Card fee: what the card provider takes from the shop on each charge.
Why the gaps between steps come first
This Phase has no ordering behaviour. It exists because the client's Friday went wrong in the gaps between steps, and nobody had written down what should happen in them.
An order touches a card provider, a kitchen tablet and a driver's phone, and none of the three can be rolled back together with the others. When a step fails late, something is left behind, and each wait in the order's life needs a number.
The second problem is time. The failures that cost the client money show up at 19:40 on a Friday, with seven drivers out and the kitchen behind.
Take an order
Produces the menu, the quote and a placed order that is placed once, with every refusal the shop owes a customer. Leaves the card, the kitchen and the driver for later, so a placed order waits for payment and nothing picks it up yet.
Acceptance criteria
The website asks the shop for a quote on a basket of lines (item, modifier options, quantity) plus a tip in cents. The shop answers with each line and its line total, the food subtotal, the delivery fee of 300 cents, the tip, the grand total and the currency EUR. The shop works every price out itself and ignores any price the website sends.
A table of baskets that you worked out by hand before writing the code passes in your test suite. Basket A: one large Margherita (900 + 300 = 1,200) and two Colas (500) is food 1,700, plus fee 300, plus tip 0, total 2,000. Basket B: two large Margheritas with extra cheese (900 + 300 + 150 = 1,350 each) is food 2,700, plus fee 300, plus tip 200, total 3,200. Basket C: one Salami (1,100) and one Cola (250) is food 1,350, plus fee 300, plus tip 150, total 1,800. The table holds at least two more baskets of your own.
After the owner raises the Margherita to 1,000 cents, a new quote for basket A says 2,100.
A tip written as 2.50 instead of 250, or a currency other than EUR, is refused with a message naming the field. So are an empty basket, a quantity of 0 or less, an item or modifier option that is not on the menu, a modifier that belongs to a different item and a negative tip. A refused quote returns no total.
Architectural guidance
A total that drifts by a cent means the amount held on the customer's card no longer matches the bill they were shown, and the client cannot say which of the two is right. A browser can send any total it likes, so a total taken from the request is a price the customer chose. Work the baskets by hand first, because a test whose expected numbers came from the code agrees with the code even when the code is wrong.
Acceptance criteria
The website submits an order with the basket, the tip, the customer's name and phone, a delivery address with a postcode, and an attempt reference the website chooses. Every resend of one attempt carries the same attempt reference. The shop answers with an order reference, the status "waiting for payment", the total and nothing else is asked of the card provider yet.
A status page for an order reference shows the status in plain words, the lines, the delivery fee, the tip and the total.
Sending the same submission twice returns the same order reference and leaves 1 order. Sending the same attempt reference with a different basket is refused with a conflict message and changes nothing.
A test sends the same submission many times at the same moment, each request on its own connection to the shop, and ends with exactly 1 order. Every response carries the same order reference and none is a server error, including the responses to the requests that arrived second.
The order keeps what was agreed. After the owner raises the Margherita to 1,000 cents, the status page of an earlier order still shows 900 for the Margherita and the original total.
The owner can read the history of an order: each change, what caused it and the time the shop recorded it. Right after placement the history shows one change.
Architectural guidance
A double tap or a browser retry sends the same order twice, and the customer who gets two orders gets two holds on their card a moment later. The repeat is hard to catch because the two requests often arrive in the same instant, and a test that sends them one after the other passes for a shop that fails on the real thing. A setup that handles one request at a time hides this bug, which is why the test needs real simultaneous requests.
Acceptance criteria
A submission is refused with a message that names the cause, and no order exists afterwards, in each of these cases: the postcode is outside the delivery area, which is a list of 25 postcodes the shop serves; the shop is closed, tested on a Monday, at Tuesday 16:59 and at Tuesday 22:00; an item in the basket is marked sold out.
A postcode on the list is accepted, and a postcode one digit off the list is refused.
A refused submission does not use up its attempt reference. After the owner clears the sold-out mark, the same submission with the same attempt reference creates the order.
At Tuesday 21:59, with a postcode on the list and nothing sold out, the submission is accepted.
Architectural guidance
A shop that takes an order it cannot serve reserves money on a customer's card for a pizza that will never arrive, and the customer finds out when the hold shows up on a statement. The refusal has to come before any money is touched. A refusal that also used up the customer's attempt would leave them unable to order the same basket once the item is back.
Architectural walkthrough
This Phase covers what can go wrong before any card is touched: a price that changes under an order, a total that drifts by a cent, the same order sent twice, and an order the shop should never have taken. The client already lives with the first: the Monday refunds were made by editing order totals, which left three of the 11 customers with a different amount than the others.
Hold the card
Produces a card provider stand-in you build yourself and the hold on the card for every placed order, kept correct when the provider is slow, down, repeating itself or reordering its messages, or when the shop dies mid-hold. Leaves the kitchen for later, so a held order waits and nothing is charged.
Acceptance criteria
The stand-in keeps answering while the shop is stopped, the way a real provider does. You can see every hold, charge and release it has made, with amounts, tokens and hold references, without the shop running. No card number appears anywhere in the shop or the stand-in.
The stand-in behaves like the real provider the client will use, and everything the shop sends it and hears back is the provider's outside behaviour. A request for a hold carries an amount in cents, the currency EUR, a payment token and a reference the caller chooses. It answers with a hold reference, the status "held" and an expiry time. Asking again with the same caller reference returns the same hold and the stand-in shows 1 hold. An amount of 0 or less is refused.
A charge on a hold of 2,400 cents succeeds for 2,400 and for 1,700, and answers with the amount taken and a fee of 1.5 percent of that amount plus 25 cents, rounded half up to the cent: 61 for 2,400 and 51 for 1,700. A second charge on the same hold is refused. A charge of 2,401 against 2,400 is refused. A charge after a release is refused. A release turns a held hold into a released one.
Holds expire after a window, 7 days by default and settable to minutes for tests. When you move the shop's simulated time, the stand-in follows it. With a 10-minute window, moving the time 11 minutes past the hold's creation makes a charge on that hold refused, and the stand-in sends an "expired" message.
The stand-in sends the shop a message for every change: created, charged, released and expired. Each carries a message identifier, the hold reference, the amount and the provider's time. A lookup by the caller's reference returns the hold or says there is none, and a list of charges for a date returns each charge with its hold, amount and fee.
Six behaviours can be switched on and off while the stand-in runs, and each is visible from outside. It makes the hold but waits 30 seconds to answer, so a caller that gives up after 10 seconds can still find the hold by looking it up. It refuses every hold with a decline. It fails every call. It sends every message twice. It sends the "charged" message before the answer to the charge returns. It delays some messages so they arrive after messages sent later.
Architectural guidance
Real providers rarely fail in the ways that hurt most, so the shop's handling of those failures goes untested until a customer is charged twice. A provider you can make fail on command turns "the hold was made and the answer never came" into a check that takes a second. The shop and the stand-in must also agree on what time it is, because holds that expire on one clock while the shop runs on another make the expiry tests disagree with themselves.
Acceptance criteria
Placing an order now leads to a hold on the customer's card for the order's total. The placement is answered at once with "waiting for payment", without the customer waiting for the provider. Run basket A (total 2,000 cents) and, within a few seconds, the stand-in shows 1 hold for 2,000 EUR and the status page says "waiting for the kitchen". No kitchen exists yet, so the order stays there.
However many attempts the shop makes for one order, the stand-in shows exactly 1 hold afterwards.
With the stand-in declining every hold, the status page says "card could not be held" and the stand-in saw 1 attempt, because a decline is final.
With the stand-in failing every call, the shop makes 3 attempts with growing gaps between them, then the status page says "card could not be held" and the stand-in holds nothing.
With the stand-in making the hold and answering only after 30 seconds, the shop gives up waiting after 10 seconds, checks with the provider for the hold up to 3 times, 5 seconds apart, finds it, and the status page says "waiting for the kitchen". The stand-in still shows 1 hold. If the provider cannot answer any of the 3 checks either, the status page says "card could not be held" although a hold may exist at the provider. The next Checkpoint makes the owner hear about it.
No card number is stored or logged by the shop; the hold uses the payment token the website sends.
Architectural guidance
The shop cannot tell a hold that was never made from a hold whose answer got lost. Treating the two alike either leaves a customer's money reserved for an order that failed, or reserves it twice for one pizza, and a double hold stays on the card until the provider lets it go. The customer's wording matters as well: "card could not be held" is a sentence the customer can act on, and a provider's own code is not.
Acceptance criteria
The owner has a list of open problems. When the result of a hold is unknown, because the provider did not answer and the checks that followed did not answer either, the list shows an entry that names the order, the time it was raised and a note saying a hold may still exist at the provider.
The owner reads the list over the web and clears an entry. A cleared entry no longer appears in the open list. Clearing it again changes nothing. Two such orders give two entries, and clearing one leaves the other.
An order that ended with a plain decline or with the provider failing every call, where the provider confirmed it holds nothing, raises no entry.
Later Phases add other kinds of entry to the same list.
Architectural guidance
A hold the shop cannot see still ties up the customer's money. The customer phones to ask why their card shows a reservation for a pizza they never received, and if the shop shows the owner nothing, that call is the first time anyone hears of the problem. The owner can only act on what the shop shows, and an entry that disappears without anyone clearing it is as bad as no entry.
Acceptance criteria
The shop accepts the provider's messages. With the stand-in sending every message twice, placing an order moves the order to "waiting for the kitchen" once, the history of the order shows one change, and the owner can see that the second copy of each message was a repeat.
With the stand-in sending the "created" message before the answer to the hold request returns, the order reaches "waiting for the kitchen" once, and when the answer arrives afterwards it changes nothing. A "created" message that arrives after the order has moved on also changes nothing.
A message about a hold the shop has never heard of is answered with success, noted where the owner can read it, and changes nothing.
The shop answers with success for every message it understood, including the ones it chose to ignore, and answers with an error only when it could not take the message in at all, so that the provider sends it again.
A test delivers the same message to the shop twice at the same moment, each on its own connection. The order moves once and the history shows one change.
Architectural guidance
A provider promises to deliver a message at least once, which makes repeats normal, and it promises nothing about the order they arrive in. A shop that believes whatever arrived last moves an order twice, sends two tickets to the kitchen, and cannot explain either one. Answering with an error for a message the shop chose to ignore makes the provider keep sending it again.
Acceptance criteria
The tests kill the real shop while the stand-in keeps answering.
Place an order and kill the shop after the stand-in made the hold and before the shop wrote down that it did. Start the shop again. Within 2 minutes the status page says "waiting for the kitchen" and the stand-in shows 1 hold for the order.
Place an order and kill the shop after the order was saved and before any hold was requested. Start it again. Within 2 minutes the stand-in shows 1 hold for the order and the status page says "waiting for the kitchen".
Stop and start the shop several more times. The stand-in still shows 1 hold per order and no status changes.
Place 10 orders and kill and restart the shop 5 times at moments chosen by a seed while the holds are in progress. Every order ends with exactly 1 hold or with the status "card could not be held". None ends with 2 holds, and none stays at "waiting for payment" after 2 minutes.
Repeat the first test with the stand-in making the hold and answering after 30 seconds.
Show the first test failing against a deliberately broken version that forgets every unfinished order when it restarts, then remove the broken version.
Architectural guidance
A shop can die between asking the provider for a hold and writing down the answer, or between taking an order and asking at all. The first leaves a customer's money reserved for an order the shop has no record of, and the second leaves an order waiting for payment for good. Neither writes an error anywhere. The customer sees an order that never moves, and the pizzeria learns about it from a phone call.
Architectural walkthrough
This Phase turns on one rule: the card is held first and charged last. A hold reserves an amount on the customer's card and takes nothing. A charge later takes the money, for the held amount or less. The plugin the client runs charges at checkout, and that is how 11 customers paid for dough that did not exist. Holding first means a rejection, a timeout or an outage costs the customer nothing, and releasing the hold is the whole refund.
The provider is an outside party that does not behave: it can make the hold and lose the answer, repeat its messages and send them out of order, and the shop itself can die mid-hold. You build the provider yourself, to fail on command.
Ask the kitchen
Produces the kitchen tablet stand-in you build and the order's life up to the kitchen's answer: tickets, acceptance, rejection, cancellation, the 5-minute limit and a shop that stops selling while the tablet is silent. Leaves drivers and charging for later, so an accepted order waits and nothing is charged.
Acceptance criteria
The kitchen tablet sits behind the shop's router with no public address, so it asks the shop for tickets every 10 seconds, carrying a device token. A request with a missing or unknown token is refused and changes nothing. The README holds a short integration guide for the tablet's maker: how a tablet identifies itself, asks for tickets and answers one.
You build a tablet stand-in that is started with the same command as the rest. It can stop asking, resume, repeat its last answer, answer a named ticket, and report a time of day that is wrong.
Take an order with two lines, 900 and 1,700, a delivery fee of 300 and a tip of 200, so the hold is 3,100. Once the hold exists, the tablet's next ask returns one ticket with the order reference, both lines by name and quantity, and the time the order was placed.
The tablet accepts with whole prep minutes from 5 to 90 and an optional list of lines to remove. 4 and 91 are refused as invalid prep times and the ticket stays open. A line that is not on the ticket is refused as unknown, and a list that removes every line is refused with a message telling the tablet to reject the ticket instead. Accepting with 25 prep minutes and the 900 line removed makes the status page say "being prepared" with a total of 2,200, while the stand-in card provider still shows a hold of 3,100.
A rejection carries one reason from out of stock, too busy, oven down and closing early. Any other reason is refused. A rejection makes the status page say "rejected by the kitchen". Releasing the hold is the next Checkpoint's work.
A ready mark on an accepted ticket is recorded on the order without changing its status. A ready mark on a ticket that is still open is answered, noted where the owner can read it, and changes nothing.
Sending the same answer twice returns the first answer's result as a success, is recorded where the owner can read it as a repeat, and changes nothing a second time. A different answer to a ticket that already has one, such as a rejection after an acceptance, is refused as already answered and changes nothing. An answer for a withdrawn ticket is refused as withdrawn, and an answer for a ticket that does not exist is refused as unknown.
The stand-in reports a time 40 minutes ahead of the shop. The owner's history of the order shows both times, the tablet's marked as the device's, and every limit counts from the time the shop received the answer.
Architectural guidance
The tablet can answer twice, answer late or carry a clock set wrong, and each of those looks like a normal answer. A shop that believes the tablet's time lets a tablet set an hour ahead move every limit the order has. A shop that acts on every answer lets a retry from flaky wifi move the order twice, and a late "accepted" for a cancelled order must not bring it back to life.
Acceptance criteria
A rejection by the kitchen ends with the status "rejected by the kitchen" and the stand-in card provider showing the hold released, with one release.
An order whose ticket the kitchen does not answer within 5 minutes of being sent, tested by moving the shop's clock, ends with the status "not answered by the kitchen". The tablet's next ask lists the ticket as withdrawn, and the stand-in shows the hold released once. A tablet answer that arrives after that is refused as withdrawn and the order stays as it is.
A customer cancel while the order waits for the kitchen ends with the status "cancelled", the ticket withdrawn and the hold released. A cancel while the order waits for payment ends with the status "cancelled", and when the hold arrives afterwards the hold is released and no ticket is ever sent. The stand-in ends with 1 hold, released.
A cancel after the kitchen accepted is refused with a message saying the kitchen already accepted. The status stays "being prepared" and the hold stays held. A cancel sent twice on an order that is already cancelled changes nothing and the stand-in shows one release. A late acceptance for a cancelled order is refused, the order stays cancelled, and the owner's history shows the refused attempt marked as refused.
With the stand-in failing every call at the moment the hold has to be released, the shop tries 3 times with growing gaps. If all 3 fail, the owner's list gets an entry saying a hold may still exist at the provider, and the shop does not try again.
A limit that passes after its order has already ended changes nothing: after a rejection, the 5-minute point passes, the order stays rejected, and the stand-in still shows one release.
Architectural guidance
The shop cannot know whether the first release got through, so asking for a release twice must be harmless, and a limit that passes for an order that has already ended must not touch it.
Acceptance criteria
The tablet counts as silent after more than 3 minutes without contact. With the last contact 179 seconds ago, a new order is taken. With the last contact 181 seconds ago, and after giving the shop up to 10 seconds to notice, the shop stops taking orders. A tablet that has never asked is judged from the moment the owner set it up.
While the shop is not taking orders, a submission is refused with a message saying that orders are paused because the kitchen cannot be reached. No order exists afterwards and the attempt reference is not used up: the same submission sent after the shop reopens creates the order. Orders already placed carry on. One waiting for the kitchen keeps its 5-minute limit and one that is being prepared is unchanged.
When the tablet asks for tickets again, the shop takes orders again within 10 seconds. A tablet clock set one hour ahead changes nothing about when the silence is noticed.
The owner can stop and reopen orders over the web. A stop by the owner shows the owner as the cause. If the tablet falls silent and returns during an owner stop, the shop stays stopped. An owner request to reopen while the tablet is silent is refused with a message saying the kitchen cannot be reached.
Stopping and starting the shop while orders are paused leaves them paused.
Architectural guidance
A shop that keeps selling while nobody can read tickets reserves money on cards for orders that will sit unanswered for 5 minutes and then be cancelled, and customers watch it happen. Silence has to be judged by when the shop last heard from the tablet, on the shop's own clock, because a tablet with a wrong clock would otherwise decide for itself whether it is silent. A restart that reopens the shop by accident does the same damage.
Acceptance criteria
The tests switch the real shop off and on while the stand-ins stay up.
Place an order and let it reach "waiting for the kitchen". Stop the shop. While it is down, move the simulated clock 6 minutes ahead. Start the shop. Within 10 seconds the status page says "not answered by the kitchen", the ticket was withdrawn once and the stand-in shows the hold released once.
Stop and start the shop several more times. The status, the owner's history of the order (one change for the expiry) and the number of releases at the stand-in do not change.
Place an order whose "hold created" message never reaches the shop, stop the shop, move the clock 3 minutes ahead and start it. The order reaches "waiting for the kitchen" and the stand-in shows 1 hold.
Create 50 orders that are all overdue and start the shop twice at the same moment. Every order is expired once and the history shows one expiry per order.
Kill the shop after it has expired an order and before the hold is released. Start it again. The hold is released once within 60 seconds of the start.
Show the first test failing against a deliberately broken version that forgets every waiting order when it restarts, then remove the broken version.
Architectural guidance
A test that never restarts anything cannot tell a shop that remembers its waiting orders from one that only remembers them while it is running. After a restart that forgets, an order waits forever with the customer's money reserved behind it. Move the clock while the shop is switched off, so the shop has no chance to notice the time passing, and start two copies of the shop at once, because a restart can overlap with the old copy still running, and each order must still expire and release once.
Acceptance criteria
The tests send the tablet's acceptance and the customer's cancel at the same moment, each on its own connection, with the stand-ins running. They run enough rounds to see both outcomes.
After every round, exactly one of two outcomes holds. In the first, the status is "being prepared", the ticket is accepted, the stand-in shows the hold still held with no release, and the cancel was refused with a message. In the second, the status is "cancelled", the ticket is withdrawn, the stand-in shows the hold released once, and the tablet's next ask lists the ticket as withdrawn. The owner's history shows one change leaving "waiting for the kitchen". No round ends with a prepared order and a released hold, or a cancelled order and a held hold.
Each outcome is also produced on purpose by sending the cancel first and the acceptance a moment later, and then the other way round, asserting the end states above.
A third race sends the acceptance at the same moment the 5-minute limit passes, by moving the clock to the limit. Each round ends "being prepared" or "not answered by the kitchen" and never both. The hold is released only in the second case.
Architectural guidance
Someone at the shop presses accept while someone at home presses cancel. If the shop honours both, the kitchen cooks an order whose hold was released, so the pizza is made and nobody can charge for it, or the customer is told "cancelled" while a pizza is in the oven. Tests that send the two one after the other never show it, and a setup that runs one write at a time hides it entirely.
Architectural walkthrough
This Phase turns on one question: what happens to the customer's reserved money while the shop waits for a kitchen that may never answer.
Every way out of the wait leaves a hold on a card. The kitchen rejects the order, nobody answers within 5 minutes, or the customer cancels. If one of those exits forgets to release the hold, the customer sees a reservation for food that was never cooked, which is exactly what the 11 customers on that Friday saw.
The tablet is an outside party you cannot trust: it asks for tickets itself, can answer twice or late, and can carry a clock that is an hour off. The shop also has to notice when nobody is reading tickets, remember what was waiting across a restart, and settle a cook's accept and a customer's cancel that arrive together.
Give each order a driver
Produces the driver board, the driver phone stand-in you build, and an order that goes to exactly one driver, is taken back when a driver hands it in or never shows, and is flagged when nobody wants it. Leaves charging for the next Phase, so a delivered order is still only delivered.
Acceptance criteria
The owner sets which drivers are on shift. The driver phone stand-in is started with the same command as the rest, and it can claim an order as a named driver, claim as two drivers at once, hand an order back, mark an order picked up, and mark an order delivered while reporting a time in the past.
An accepted order appears on the board of drivers on shift at the accepted time plus the prep minutes minus 8 minutes, and never before it was accepted. An order accepted at 19:00 with 30 prep minutes opens at 19:22, and with 5 prep minutes it opens at 19:00. Before 19:22 the board shows the driver nothing for that order, and a claim is refused as not open yet. The board shows the delivery address and the time the order opened.
A claim from a driver who is not on shift is refused as not on shift. A rejected order never appears on the board.
If nobody claims an order, the owner's list gets an entry 10 minutes after the later of the board opening and the end of the prep time. For the 19:00 order with 30 prep minutes that is 19:40. The entry names the order and says how long it has waited. The order stays "being prepared" and a later claim still works. A claim at 19:39 means the entry never appears.
Architectural guidance
A board that opens too early has drivers waiting at the shop for food still in the oven, and one that opens too late lets the pizza cool on the counter. A rejected order on the board sends a driver on a trip for nothing. An order nobody claims goes cold quietly, and the customer's phone call is the first sign unless the shop tells the owner first.
Acceptance criteria
A driver hands an order back with the reason "declined" or "dropped". The status returns to "being prepared", the order appears on the board again, and a new 10-minute limit for nobody claiming starts, counted from the later of the hand-back and the end of the prep time. A hand-back from a driver who does not hold the order is refused as not that driver's order.
A driver who has claimed an order has until the later of the claim and the end of the prep time, plus 15 minutes, to pick it up. A claim at 19:25 on the 19:00 order with 30 prep minutes gives 19:45. If the order is still "with a driver" at 19:45, the shop takes it from the driver, records the reason "no show", sets the status back to "being prepared" and puts the order on the board again. If the driver picked the order up before 19:45, nothing changes.
When one driver hands back a second order in the same shift, with any of the three reasons, the owner's list gets one entry for that driver. The driver stays active and can still claim. Nothing the shop does marks a driver as inactive. The owner clears the entry over the web.
Architectural guidance
A driver who takes an order and never turns up leaves a hot pizza and a customer waiting while the board still shows the order as taken. The shop has to notice and put the order back in front of the other drivers. It must not decide anything about the driver, because a shop that deactivates drivers on its own punishes a flat tyre. The shop notices and tells, and the owner, who knows the reason, decides.
Acceptance criteria
A claim from a driver on shift on an order that is open gives that driver the order, the status page says "with a driver", and the order no longer appears on the other drivers' boards.
Two drivers claim the same order at the same moment, each on its own connection. Exactly one claim succeeds and the other is refused as already claimed. The order has 1 driver and the owner's history shows 1 change to "with a driver". The test repeats enough rounds to hit both orderings, and every round ends this way.
A claim on an order that already has a driver is refused as already claimed, whether it comes from the same driver or another.
Architectural guidance
A test that sends the claims one after the other passes for a shop that fails the real Friday, and a setup that runs one write at a time hides the race altogether.
Architectural walkthrough
This Phase is about the Friday when two drivers drove off with the same order. The group chat let both answer "mine" in the same second and each believed they had won. The cost was one wasted trip, a second pizza that nobody was waiting for, and a customer who got two knocks on the door or none.
An order a driver claims and never collects, an order nobody claims and a board that opens at the wrong moment each leave a pizza on the counter. The shop notices and tells the owner, and it never decides anything about a driver.
Get paid and show where every cent went
Produces the charge for what was delivered, a charge that happens once whatever goes wrong, a warning to the owner when a charge fails, and a day report that matches the card provider's list of charges. Leaves the full evening for the next Phase, so each part is proven on a handful of orders.
Acceptance criteria
Before any reporting code exists, you work one order's money out by hand and your repository holds the result in a document. The order has delivered lines of 1,700 (one line of 900 was removed from an original 2,600), a delivery fee of 300 and a tip of 200, so the card is charged 2,200. The provider's fee is 1.5 percent of 2,200 plus 25 cents, rounded half up: 33 plus 25, which is 58.
The document lists every line of the owner's day report for this order, with its account and amount in cents, with debits as positive numbers and credits as negative ones, and shows that the lines sum to zero. The report has exactly 5 accounts: food sales, delivery fee income, driver tips payable, card fees and card provider receivable. It has no tax account because this build computes no tax.
The document shows the net amount in card provider receivable as 2,142 and what happens to the 900 left on the hold.
The document also holds a second order with a tip of 0 and shows that it has 5 lines and not 6.
The document shows what the report would read if the tip were added to food sales (food sales -1,900, driver tips payable 0), shows that the sum is still zero, and gives the reason that is wrong.
Architectural guidance
A day report built before anyone has worked an order by hand agrees with whatever the code does, right or wrong. The tip is the easy mistake: folded into food sales it leaves the report adding up to zero while the shop claims 200 that belongs to the driver. Work the order by hand first, so the later tests have an answer that did not come from the code.
Acceptance criteria
The driver stand-in marks an assigned order picked up and the status page says "on its way". The pickup works when the kitchen never marked the order ready, because a driver holding the pizza proves it is ready, and a ready time that is already recorded stays unchanged. A pickup from a driver other than the assigned one is refused as not that driver's order.
Marking the order delivered makes the status "delivered" and then charges the card. A delivered mark on an order that was not picked up is refused. Sending the same delivered mark twice returns the first result and charges once.
The stand-in marks an order delivered with a device time 3 minutes in the past. The owner can see who delivered the order and both times, the driver's phone time and the shop's time, and every limit counts from the shop's time.
Take the order with lines of 900 and 1,700, a fee of 300 and a tip of 200, so the hold is 3,100, and the kitchen removed the 900 line when it accepted. After delivery the stand-in card provider's list of charges shows one charge of 2,200 with a fee of 58, the status page says "completed" with a total of 2,200, and the remaining 900 of the hold is not taken.
A delivered mark on an order that is rejected, not answered, cancelled or waiting for the kitchen is refused, and the stand-in's list of charges stays empty. The shop never charges a card for an order the kitchen has not accepted.
After delivery the driver's board no longer shows the order's address. The owner can still see the driver and the two times.
Architectural guidance
The hold was for the whole order, and the customer must pay for what arrived. A charge of the original total after the kitchen removed a line is a refund the client makes by hand later, and the provider keeps its fee on a refunded charge, so each one costs real money. A driver's phone with a late clock would otherwise decide when the customer's card is charged.
Acceptance criteria
The tests run the real shop, switching it off and on, with the stand-ins staying up, against a hold of 2,000 with a delivered amount of 1,700.
The same delivered mark is sent twice at the same moment, each on its own connection. The stand-in's list of charges shows 1 charge and the status is "completed" with 1,700.
The shop is killed after the stand-in made the charge and before the shop wrote it down. After the restart the list still shows 1 charge and the status page says "completed" with 1,700.
The shop is killed right after recording the delivery and before asking for the charge. Started again, it charges within 5 minutes of the delivery on the shop's clock, and the list shows 1 charge.
With the stand-in sending every message twice, the order is completed once. With the stand-in sending the "charged" message before the answer to the charge returns, the order is completed once with 1,700, and the answer arriving afterwards changes nothing. An "expired" message for a hold that was already charged is recorded as ignored where the owner can read it, the order stays "completed" and nothing is released. The same message delivered twice at the same moment on two connections has the same result.
After all of these runs, the stand-in's list of charges for the date matches the orders that ended "completed" one to one on amount and fee.
Architectural guidance
A second charge takes a customer's money twice for one pizza. It happens when the shop dies after the provider charged and before the shop knew, and then tries again. A provider's late message that says a hold expired must not release or undo money that was already taken, and a message that arrives before the answer to its own cause must not complete the order twice.
Acceptance criteria
With the stand-in's hold window set to 10 minutes and the clock moved 11 minutes after the hold was placed, before the driver marks the order delivered, the delivery ends with the status "card could not be charged". The owner's list gets an entry that names the order and says the card was not charged. The stand-in's list of charges has nothing for the order.
The same happens when the provider refuses the charge for a hold it has already expired, whatever the shop's own clock says.
With the stand-in failing every call at the moment of the charge, the result is the same, and the entry says the provider could not be reached.
The shop does not try to charge such an order again: 10 more minutes on the clock produce no further attempt. The owner clears the entry over the web, and a cleared entry no longer appears.
Architectural guidance
A charge the provider refuses will be refused again, and the pizza has already been delivered. The owner has to hear about it, because collecting that money takes a phone call, and a silent failure becomes the Monday of hand-made refunds all over again. Trying a refused charge over and over only repeats the refusal.
Acceptance criteria
The owner reads the day report for a date over the web. For the order worked by hand in the first Checkpoint of this Phase, alone on its day, the report shows card provider receivable 2,142, food sales -1,700, delivery fee income -300, driver tips payable -200 and card fees 58, and the sum over all accounts is 0. The report equals the hand-worked document to the cent.
For each completed order the report has: a debit to card provider receivable for the amount charged; a credit to food sales for the delivered lines; a credit to delivery fee income for the fee; a credit to driver tips payable for the tip; a debit to card fees for the provider's fee; and a credit to card provider receivable for the same fee. A line with the amount 0 does not appear, so an order with a tip of 0 has 5 lines. The tip is its own line of 200 and never part of the food sales line of 1,700.
The owner can list the lines behind any total, each with its account, amount and order reference, and check them one by one. The report offers no way to change or delete a line.
Marking the same order delivered twice, or at the same moment on two connections, leaves the order with 6 lines. Killing the shop partway through adding an order to the report leaves it, after the restart, with all 6 lines and never with 3. An order that was rejected, not answered, cancelled or not charged has no lines.
Architectural guidance
A day report that matches neither the till nor the card provider's list takes the owner an evening to reconcile by hand. The tip belongs to the driver, and folded into food sales it makes takings 200 higher while the report still adds up to zero. A completion counted twice, or counted half after a crash, shifts the day by an order's worth and nothing in the report flags it.
Acceptance criteria
A test plays one day of orders on the simulated clock with the real shop and the stand-ins. The day holds several orders delivered with all lines, the order with a removed line, an order delivered with a tip of 0, an order rejected by the kitchen, an order cancelled before acceptance, and an order whose charge the provider refuses.
The stand-in's list of charges for the date has one charge for each order that was charged, each with a hold, an amount and a fee. The day report shows a sum of 0 over all accounts. Card fees equal the sum of the fees. Driver tips payable equals the sum of the tips. The credits to food sales, delivery fee income and driver tips payable add up to the sum of the amounts charged. The receivable equals the sum of the amounts charged minus the sum of the fees.
Each charge matches exactly one completed order in the report by hold and amount. The orders with no charge have no lines. When something does not match, the test names the first mismatch by order and field.
The check is shown to fail when the report is wrong: the check run on a copy of the report with one amount changed by 1 cent, and again on a copy with one order's lines removed, fails both times and names the order. Marking one of the charged orders delivered a second time leaves every total unchanged.
An order completed at 22:30 UTC on 12 Jun 2026, which is 00:30 on 13 Jun 2026 in Europe/Amsterdam, appears in the report for 13 Jun 2026 and not in the report for 12 Jun 2026. The stand-in's list for each of the two dates follows the same boundary.
Architectural guidance
The provider's list of charges is the one record in the system that the shop does not write, so the day report is worth trusting only once it matches that list charge by charge. Match one to one first and compare the sums second, because two errors of opposite sign cancel in a total. Keep orders with no charge in the day, since the likely bug is a line booked for an order that never took money. Reconciling against an outside record is the check that would have caught the Monday of 11 hand-edited refunds.
Architectural walkthrough
This Phase is about the money, and the client has lived the cost of getting it wrong. The plugin charged the whole total at checkout, so every rejection became a manual refund. Under the provider's terms the shop loses its card fee on a refunded charge, and the Monday refunds cost the fees on 11 charges and the goodwill of 11 customers.
The hold was for the whole order. The charge is for what arrived: the delivered lines, the delivery fee and the tip. If the kitchen removed a 900 line from a 3,100 order, the customer pays 2,200 and the books show 2,200 to the cent.
A second charge, a refused charge nobody hears about, and a tip folded into food sales are the failures that follow.
Run a Friday
Produces a runner that plays a simulated Friday evening against the whole shop, a way to erase a customer's personal fields while the books stay intact, and a proof that the evening survives every failure at once. Adds no new order behaviour, so everything it finds is a gap in the earlier Phases.
Acceptance criteria
A command, the Friday runner, takes a seed and a list of failures, which is empty in this Checkpoint, and drives the shop, the three stand-ins and the simulated clock. It judges the shop only by what a customer, the owner and the stand-ins can see: placing an order, the status page, the owner's list, the day report and the stand-in card provider's list of charges, plus the clock control.
The runner moves the clock in steps of 10 simulated seconds and lets the shop finish what it is doing between steps. The clock control exists only when the shop runs with simulation on.
With seed 17, the runner attempts 30 orders on a Friday between 18:30 and 20:30 simulated, with 7 drivers on shift and baskets drawn from the seeded menu. The tablet stand-in accepts with prep minutes from 15 to 40, rejects some orders, and removes a line from some. Drivers claim, pick up and deliver. The run ends when every placed order has ended, or 2 simulated hours after the last placement, whichever comes first.
Running seed 17 twice gives the same placement times, the same baskets and tablet answers, and the same count of orders per ending status. Seed 18 gives different placement times.
The run writes a results file to your repository and commits it. The file names the seed and the failure list (none), the orders attempted, the refusals at the door by reason, the orders placed, a count per ending status, every entry on the owner's list and the day report. The counts per ending status add up to the orders placed. If any placed order has not ended, the run exits with a failure code and lists it.
At the end of every run, the day report is compared with the stand-in's list of charges for the date, using the check from the last Phase, and the run fails on a mismatch. The 2 simulated hours finish in under 10 minutes of real time.
Architectural guidance
A shop tested piece by piece can still fail as a whole, because the failures live between the pieces. A run on a clock that moves only when the runner moves it replays the same evening from a seed, so a failure found at 19:40 can be found again. A check that peeks inside the shop to decide what to do next agrees with the shop for the same reason the shop is wrong.
Acceptance criteria
The owner asks for an erasure by phone number over the web. An unknown phone number is answered as an unknown customer and changes nothing. A customer with an order that is still live is refused and nothing is erased. Once that order ends, the same request succeeds.
Erasing clears the customer's name and phone and the delivery address on every order of that customer, including any copy a driver's board still holds. Order references, lines, amounts and statuses stay. A second customer who shares nothing with the first keeps their name, phone and address.
The status page for an erased customer's order still shows the status, the lines, the total, the delivery fee and the tip, and shows no name and no address.
The day report before the erasure and after it are identical. The number of report lines and delivery proofs is the same before and after. The delivery proofs keep the driver and both times and hold no address. Driver records are untouched.
Before the erasure, a search of everything the shop stores and logs for the customer's phone number finds it. After the erasure, the same search for the name, the phone and the address finds nothing anywhere, including the logs, error records and the order's history.
Asking for the same erasure a second time changes nothing and says so.
The owner's note states that report lines and delivery proofs are kept for 7 years because Dutch law (Belastingdienst) requires the shop to keep its business records that long, and that this is the owner's legal duty.
Architectural guidance
Personal details end up in more places than anyone remembers: logs, error records, histories. An erasure that clears the obvious record and leaves a name in a log tells the customer it is done when it is not, and the client has then said something untrue. The books must keep working afterwards, so the report lines and the delivery proofs have to hold up without a name.
Acceptance criteria
The Friday runner is run with seeds 17, 18 and 19, each with all six failures: the tablet stops asking for 20 simulated minutes; the card provider fails every call for 5 simulated minutes; every provider message and every tablet answer arrives twice, and some provider messages arrive after messages sent later; two drivers claim the same order at the same moment, for several orders; two drivers each hand back one order; and the shop is killed and restarted 5 times at moments the seed picks, including while orders are midway through the hold, the acceptance and the charge.
A run passes only if every one of these holds, and the runner prints each as pass or fail with the order references that break it:
- Every placed order has ended in exactly one way, and its history shows one path to it with no step the rules forbid, such as a cancel after acceptance or a charge before delivery.
- Every hold at the stand-in is charged, released or expired, except for an order with an open entry on the owner's list about a hold that may exist or a charge that failed. Nothing else is still held at the end of the run.
- Every charge on the stand-in's list belongs to an order that ended completed, so no customer is charged for an order the kitchen did not accept.
- No order has two drivers: each order has at most one driver who did not hand it back, and a completed order carries that driver.
- The day report sums to 0 and matches the stand-in's charges one to one, using the check from the last Phase.
- The day report is unchanged after erasing 10 customers whose orders have ended, and their status pages show no name.
The results file also shows that each failure took effect. During the tablet outage, placements were refused because orders were paused (a count above 0), and orders waiting for the kitchen ended "not answered by the kitchen" with their holds released. During the provider outage, placements ended "card could not be held". The results count the repeated messages and answers that were received and recognised as repeats (a count above 0). The losing drivers were refused as already claimed. The 5 restarts are listed with the orders that were midway at each one, and those orders kept moving. Every entry on the owner's list is listed.
Worked timeline for the tablet outage, in simulated time, which the results must match:
- 19:30:00 is the tablet's last contact, and the runner stops it for 20 minutes.
- At 19:31:00 a customer places an order. The hold is made and the ticket is open for the tablet at 19:31:05, so the 5-minute limit ends at 19:36:05.
- By 19:33:10 the shop has stopped taking orders, because the tablet has been silent for more than 3 minutes.
- At 19:35:00 a placement is refused with a message that orders are paused.
- At 19:36:10 the order shows "not answered by the kitchen", the ticket is withdrawn and the hold is released.
- At 19:50:00 the tablet asks again, and by 19:50:10 the shop takes orders again.
The pass check is tested on fixtures. A fixture with an order that has two live drivers, one with a hold still held for a rejected order, and one with a charge for an order that did not complete each make the check fail and name the order, and a clean fixture passes.
The results of the three seeds are committed, each with its failure list.
Architectural guidance
A test that passes while everything is healthy says nothing about the evening the tablet's wifi drops. Write the pass condition before the run and have the runner enforce it from outside, so a failure sends you to fix the shop and never to loosen the check. Inject each failure while orders are midway through acceptance, delivery or charging, because those are the orders that can go wrong, and read the results for evidence that each failure took effect before trusting the pass.
Architectural walkthrough
This Phase is judged from outside, on a repeatable evening. The first run has no failures and serves as the baseline: 30 orders over 2 simulated hours with 7 drivers on shift. The failing run injects six failures, each aimed at a promise made earlier: a silent tablet, a provider that errors, messages that arrive twice or late, two drivers on one order, two drivers who drop their orders, and a shop that is killed and restarted. A pass means the promises hold, not that the evening was quiet.
The Phase also erases a customer's personal fields while the books stay intact. The report lines and the delivery proofs are kept for 7 years, because the Dutch tax administration requires the owner to keep business records that long.
Architectural walkthrough
Three records, three stories
The old setup keeps one status text per order and lets the plugin, the printer app and the drivers' WhatsApp replies all overwrite it. When the money, the kitchen and the driver disagree, nothing can say which one is right. On the Friday in the brief, 11 customers were charged for food nobody cooked and two drivers left with the same order. The client paid for it twice: once in Monday refunds that left three customers with a different amount than the rest, and once in card fees, because under the provider's terms a refunded charge keeps its fee.
Steps you cannot take back together
An order touches a card provider, a kitchen tablet and a driver's phone, and none of the three can be rolled back along with the others. When a step fails late, something is left behind: a hold on a card for a pizza that will not come, a ticket on the tablet for an order the customer cancelled, a driver on the way to collect something that does not exist. The customer sees it first, as a reservation on their card statement or a pizza that never arrives, and the pizzeria sees it as a phone call.
Two people, one last thing
Two drivers answer "mine" in the same second. A cook presses accept while the customer presses cancel. A browser sends the same order twice in the same instant. Each of these works when the requests arrive one after the other and breaks when they arrive together. The cost is a wasted trip, a pizza cooked for an order nobody can charge for, or two holds on a card for one pizza. Tests that send the requests one at a time pass for a shop that fails on Friday.
Messages that arrive late, twice or out of order
The card provider reports what it did, and it promises to report at least once, in no guaranteed order. A "charged" message can arrive before the answer to the charge. An "expired" message can arrive after the money was already taken. The same message can arrive twice. A shop that believes whatever came last completes an order twice, releases money that was taken, or moves an order backwards, and the first person to notice is the customer.
The shop dies in the middle
A shop can be killed between saving an order and telling the kitchen, or between the provider charging and the shop writing it down. Nothing shows an error. The customer has paid for food nobody is cooking, or has been charged twice, and nobody finds out until they phone. A restart that forgets what was waiting leaves orders waiting forever with the customer's money reserved behind them.
What to check in your build
If your build passes every test and still fails one of these, look at what the test exercised. A request sent after the previous one finished is not a race. A shop that was never switched off is not a restart test. A clock that was never moved cannot show a limit passing. A failure that never took effect in the Friday run proves nothing, so read the results for evidence that each one did.
Next step
"Build a Food Delivery Platform" takes the same hold, kitchen and courier order further: more parties, refunds on both sides of the charge, three-sided money and a simulated dinner peak. You will recognise the failures from this build.
Where it shows if you cut a corner
Four symptoms show a cut corner. Customers are charged for food nobody cooked, as 11 were on the Friday in the brief, or a card shows a hold for an order that has ended. Two drivers leave with the same order. A customer has two holds on the card for one pizza after a repeated submit or a repeated provider message. An order waits for ever with the customer's money reserved behind it after a restart.
Related Links
- Belastingdienst, keeping your business recordsbacks the 7 years report lines and delivery proofs stay after a customer is erased.
- Stripe: webhooksthe provider behaviour the stand-in imitates, with messages that arrive late, twice or out of order.
- Stripe API reference, repeating a request safelybacks one order and one card hold however often the same submit arrives.
- Online payment statistics for the Netherlands 2026secondary source for iDEAL taking the money at once, which is why the shop takes cards only.