Build an Offline Job System for a Plumbing and Heating Firm
A plumbing and heating firm saves each job as one record, so a phone that was offline for hours overwrites what the office decided in the meantime. You will build the job system from the first call through booking, stock and the technicians' phones to the invoice, and prove it on a simulated working day.
The brief
The client
I run a plumbing and heating firm with nine technicians and about 35 jobs a day, mostly for homeowners and a few letting agents. Our office admin and I dispatch from the same screen, and every technician has a phone with our job app, which saves the whole job record whenever it finds signal. Last month the office corrected a house number from 14 to 41 at 09:30 and added the gate code to the access notes. The technician spent the afternoon inside a farmhouse with no signal, wrote up a weeping pressure relief valve on the hot water cylinder in his notes, and synced at 17:45. His old copy replaced the whole record, so the address went back to 14, the gate code vanished, and the follow-up visit was booked to the wrong house. I need the office and the phones to be able to disagree for hours, with every disagreement visible and settled by a rule that says who owns each part of a job.
The problem
The app stores each job as one record, and the office screen, each technician's phone and the accounts screen all overwrite it. A phone that has been offline holds a copy of the job as it was, and when it syncs, that copy replaces whatever the office decided in the meantime. The record cannot tell a decision from a stale copy.
Two other things follow from the same habit. Van stock is a spreadsheet each technician updates in the evening, so nobody knows which van holds a circulation pump, and two jobs can be promised the last one. Invoices come from a button on the accounts screen and not from a job finishing, so a job cancelled in the office and finished on a phone can be billed, and a finished job can be missed. The cost is a visit to the wrong house, a letting agent disputing an invoice for a job the agent had withdrawn, and an office admin who rebuilds the day by phone every evening.
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
- Take a job request from a web form or the phone desk with an address, the kind of problem and a description, and put an emergency ahead of routine work by rules the client can read.
- Open exactly one job for each triaged request, keep a history the office can read of everything that happened to the job, and refuse a status move that the job's states do not allow.
- Book a job to a technician who has the skill for its trade, is on shift and is free, and never hold two overlapping bookings for one technician, even when two dispatchers book at the same moment.
- Track parts in the warehouse and in every van, and reserve a part for a job without promising the same unit twice.
- Show each technician the day's jobs on a phone with no signal, and accept the changes made offline when signal returns, so that receiving the same change twice, late or out of order, gives the same result.
- Merge offline changes by a rule per field: notes, time on site, parts used and photos are kept; status follows the job's states; address, access notes and booked time belong to the office. No change is silently lost, and every refusal is a conflict the office can see.
- Record a part a technician used offline even when stock says the van had none, and tell the stores person about the shortfall.
- Invoice a completed job exactly once, record payments that arrive twice, late or out of order once, and let the office settle a conflicting visit by charging or waiving a flat fee.
- Erase a customer's name, phone and email on request, and keep invoices, payments and the work history.
- Show with one command that no two bookings overlap, no job status disagrees with its history, no invoice exists for a cancelled job without a charged fee, and every completed job has exactly one invoice.
Deliverables
- Your repository starts the whole product with one command, together with the simulated phones and the payment provider stand-in, with seed data for nine technicians, nine vans, a warehouse and the price list.
- A README that takes a reviewer from a fresh clone to a simulated working day's report in 15 minutes, and lists the command for each test.
- A table that gives every job field an owner and says what happens when two parties change it without seeing each other.
- A test suite for every Phase. The tests that send competing requests run them at the same moment and are shown able to fail.
- A way to run the firm's day faster than real time and to cause the outside failures this brief names: a phone uploading the same changes twice, out of order or 8 hours late with a clock up to 15 minutes wrong; the payment provider sending a message twice, late, out of order or without the proof that it sent it; and the process being killed in the middle of its work.
- The result of the Phase 4 test and the report of the final simulated day, both committed to your repository.
- A short operations note: how to check that every job's status matches its history, how to read and settle a conflict, and how to read a stock shortfall.
Out of scope
- Quotes, quote acceptance and variations. The firm bills a call-out charge, an hourly rate and parts at list price, so there is nothing to accept.
- Gas safety certificates and compliance deadlines. They need the regulated-job rules that the advanced brief builds, and they repeat the status-move rule from Phase 2.
- Customer messages and arrival-window texts. Sending one message per reshuffle needs coalescing across a day of changes, which is the advanced brief's subject.
- Route optimisation. The vehicle routing problem is a research field of its own, and skill, shift and overlap checks are enough here.
- A native technician app. A simulated phone stands in for the real ones, because the rule for each field is the subject.
- Photo files. A photo is a reference string on the job, and storage and upload are not the subject.
- Card handling. Payment arrives as messages from a payment provider stand-in you build, so card data never enters the product.
- Live van tracking. It adds a personal-data problem and no consistency problem.
- Supplier purchase orders, accounting export and a customer portal with accounts. Each needs rules or integrations this brief does not fix, and replenishing a van is a recorded transfer of stock.
- Tax lines. Invoices show one total in euro cents. A real Dutch invoice also shows the VAT separately, which this brief leaves out to keep the money rules to one.
- Deleting invoices and payments once their 7 years have passed. The product only keeps them, and the brief gives no legal advice.
Architectural constraints
- Money is an integer number of euro cents, and an amount is exact to the cent.
- Times shown to staff and technicians are in Europe/Amsterdam, and a booking made for 09:00 still reads 09:00 after the clocks change.
- A technician never holds two overlapping bookings, and a job never holds two active bookings. A booking that starts exactly where another ends is accepted.
- The office owns a job's trade, urgency, description, site address, access notes, booked time and estimated minutes. A phone's change to any of them is refused, and the office can see that it was.
- A technician's notes, time on site, parts used and photos are never lost, whichever phone sent them and in whatever order they arrive. The phone's clock decides the order of nothing.
- A job is open, completed or cancelled. The technician completes an open job, the office cancels an open job, and nothing leaves completed or cancelled.
- The same part is never promised to two jobs, and a reservation never takes available stock below zero. A part a technician reports used is recorded even when stock disagrees.
- A change sent by a phone takes effect once, however many times it arrives. A message from the payment provider takes effect once, however many times it arrives, and a message the provider did not send changes nothing.
- A completed job is invoiced exactly once. A cancelled job is never invoiced, except for the flat visit fee when the office decides to charge it. An issued invoice does not change when a price or a later time log changes.
- No card number is ever stored.
- A customer's name, phone and email are erased on request, while invoices, payments and the work history stay, identified by the customer's ID. Dutch law requires the client to keep its business records, invoices and payments included, for 7 years (Belastingdienst), so erasure never removes them.
- A customer's phone number appears only on the technician's phone for the day's visits. The site address and access notes may be copied onto the job, and the billing name and address onto an issued invoice.
- When the process dies at any moment, nothing is lost and nothing is doubled: a triaged request ends with one job, a completed job with one invoice, and a payment message with one payment.
Prerequisites
You have built one application with a database, in any language and framework. You can start a process on your machine and send several requests to it at the same moment. You do not need distributed systems experience, and you do not need to have built Build a Parcel Delivery Network. You do not need to know how a plumbing and heating firm runs its jobs; the first Phase explains the business and the words the brief uses. If the domain is new to you, Build a Diary and Job Sheet for a One-Van Electrician covers the same words at a smaller scale. Having once lost an edit because two screens saved the same record will make most of this brief familiar.
Free to start. An account is what keeps track of the checkpoints you finish.
Work out the firm's rules by hand
Produces a replay of the day a visit went to the wrong house, a worked example of a job from the first call to the final payment with the client's numbers, and a table that says who decides each part of a job. Builds nothing yet: the product comes in the next Phase.
Acceptance criteria
You write a replay document in your repository with five sections. The first replays the day the follow-up visit went to the wrong house, as a timeline of three moments: 09:30, when the office corrected a house number from 14 to 41 and added the gate code to the access notes; the afternoon, when the technician worked inside a farmhouse with no signal and wrote up a weeping pressure relief valve on the hot water cylinder in his notes; and 17:45, when his phone synced. For each moment it shows what the office screen shows, what the phone shows, what the old app's record held, and what the record should hold. At 17:45 the old record went back to the address 14, lost the gate code and sent the follow-up visit to the wrong house. The answer in the replay is that the address stays 41, the gate code stays and the valve note is kept. The replay does not choose the rule that gets there. The next Checkpoint does.
The second section is a numbered timeline of what happens from the customer's first call to the final payment when nothing goes wrong, with at least these eleven steps: request taken, request triaged, job opened, job booked to a technician, parts reserved, the day's jobs sent to the technician's phone, work done offline, phone syncs, job completed, invoice issued, payment received. Each step names who acts (customer, office, technician or payment provider), what that person can see afterwards, and a concrete value, for example "technician T05 is booked from 09:00 to 10:25 on Tuesday 10 Mar 2026".
In the third section you work three jobs through the client's rules with every number shown: a burst pipe, a no-heating call from a home with a vulnerable resident, and a boiler service. For each it gives the trade, the urgency, the estimated minutes, the length of the booking (the estimated minutes plus a flat 25 minutes of travel, so a 60 minute heating job booked at 09:00 runs to 10:25) and the invoice if 40 minutes were spent on site and one 15 mm thermostatic radiator valve was fitted: call-out 7000 cents, labour 3 started blocks of 15 minutes at 1500 cents each, part 1800 cents, total 13300 cents. It also gives the labour for 45, 46 and 0 minutes.
The fourth section is a table of a job's states: open, completed and cancelled, with one row for each of the six ordered pairs of different states and the word legal or illegal. Only open to completed and open to cancelled are legal. It then follows the client's cancelled job in time: the office cancels at 14:10, the technician completes at 14:30 with no signal, and the phone syncs at 17:45. For each of the three moments it lists what the office's screen shows and what the phone shows, and it ends with the question the next Checkpoint answers: which of the two actions counts, and what happens to the other.
The fifth section lists the places a customer's phone number may appear: the technician's phone for the day's visits. It also lists where the site address and access notes may be copied (the job) and where the billing name and address may be copied (an issued invoice). Anywhere else a customer's name, phone or email appears is a defect, and the document says so.
Architectural guidance
The client's trouble began because nobody had written down who decides each fact, so the phone, the office screen and the accounts button all wrote the same record. Small arithmetic that nobody wrote down has the same cost: a booking that does or does not include travel, or 46 minutes billed as three blocks or four, is found in an invoice a letting agent disputes. The list of states is short on purpose. Every state added is one more move a late phone upload can attempt.
Acceptance criteria
You write a field table in your repository with one row for each of these twelve job fields: status, trade, urgency, description, site address, access notes, booked time, estimated minutes, notes, time on site, parts used and photos. Each row says who decides the field (the office, the technician, or the list of legal moves), what happens when a phone and the office changed it without seeing each other, and what the office sees when a phone's change is refused. Notes, time on site, parts used and photos are only ever added to, so changes from any phone are kept. For status, the technician completes and the office cancels. The other seven fields belong to the office.
Below the table, four cases are each answered in one sentence that names the rule applied. First, the office corrected the house number from 14 to 41 at 09:30 and a phone that was offline since 08:00 sends an edit of the access notes: the edit is refused, the gate code and the address survive, and the technician is told. Second, the office cancels at 14:10 and the phone completes at 14:30: the completion is refused, and the notes, the 40 minutes and the radiator valve are kept. Third, two phones add a note to the same job in opposite order: both notes are kept. Fourth, a phone completes a job and the office's cancellation reaches the firm afterwards: the completion stands and the cancellation is refused.
The document says in two sentences why no field is decided by whoever saved last and why no field is ordered by a phone's clock. Every refusal in the table names a place where the office reads it.
Architectural guidance
Letting whoever saved last decide is the shortest rule to write, and it is the rule that sent the follow-up visit to the wrong house. Each field costs the firm something different when it loses: a lost note is a repeat visit, a lost gate code is a locked gate, a replaced address is a visit to the wrong house. If the rule per field is written before the first screen exists, a disagreement found in the fourth week is a lookup and not an argument.
Architectural walkthrough
How a plumbing and heating firm runs its jobs
The client is a plumbing and heating firm with nine technicians, nine vans and a warehouse. About 35 jobs a day come in, mostly from homeowners and a few from letting agents, by a web form or by phone. The office admin and the owner dispatch from one screen, and every technician has a phone with the job app.
A request names an address, the kind of problem and a description. Each problem type has a trade and a time estimate: a burst pipe is plumbing for 90 minutes, a no-heating call is heating for 90. A burst pipe is an emergency, and so is a no-heating call from a home with a vulnerable resident. Everything else is routine. The office books the job to a technician with the skill for the trade, who is on shift and free. A booking lasts the estimated time plus 25 minutes of travel.
A technician sees the day's jobs on the phone and often works where there is no signal. The technician writes notes, logs time on site, records parts used from the van and adds photos. The phone sends these changes when signal returns. The office, meanwhile, may have changed the address or the access notes. Van and warehouse stock are tracked by part. When a job is done, the firm invoices a call-out charge of 7000 cents, labour at 1500 cents for each started 15-minute block, and parts at list price.
The words this brief uses:
Trade: the kind of work, plumbing or heating, which a technician needs the skill for.
Triage: deciding a request's trade, urgency and time estimate from the problem type.
Emergency and routine: the two urgencies. An emergency goes ahead of routine work.
Shift: the hours a technician works, with a break.
Booking: the slot a technician is given for a job, including travel.
Van stock: the parts a van carries, tracked apart from the warehouse.
Reservation: a part set aside for a job so it is not promised twice.
Access notes: how to get into the property, such as a gate code.
Call-out charge: the fixed charge for a visit.
Conflict: a change from a phone that the office's version contradicts, which the office has to see and settle.
Why the rules are worked out first
This Phase has no software. You work out how the firm runs, with the client's numbers, before anything can be wrong in code. Getting a rule wrong here costs a rewrite later, because every part of the product depends on the answers.
The failure to avoid is the one that sent the follow-up visit to the wrong house. The old app gave every field the same rule: whatever was saved last stood. A rule invented inside a screen during a deadline becomes the same rule again, because it is the shortest thing that makes the screen stop complaining.
A second failure is small arithmetic nobody wrote down. Working three jobs by hand, with numbers, finds every one of them while it still costs a paragraph.
Open and track jobs
Produces triage of a request, a job opened for every triaged request, and a history for each job whose status only moves by the legal moves. Leaves booking, stock and phones for later: nothing here knows a technician exists.
Acceptance criteria
The product accepts a request with the customer's name, phone number, optional email, street, house number, postcode, city, optional access notes, problem type, description, whether a vulnerable resident lives at the address (default no) and the channel it came in on (web form or phone desk). It answers with the trade, the urgency and the estimated minutes. Reading the stored request back returns the same values plus the area, the first four characters of the postcode with spaces removed (postcode 1071 AB gives area 1071).
The client can read the triage rules without reading code, one line per problem type: burst pipe is plumbing for 90 minutes, leaking tap is plumbing for 45, blocked drain is plumbing for 60, no heating is heating for 90, cold radiator is heating for 45, boiler service is heating for 60 and no hot water is heating for 75. Urgency is emergency for a burst pipe, and for no heating when a vulnerable resident lives at the address. Everything else is routine. A burst pipe request returns plumbing, emergency, 90. A no-heating request returns heating, routine, 90 when no vulnerable resident lives there and heating, emergency, 90 when one does. A boiler service request with a vulnerable resident is still routine, 60. A second request with the same phone number reuses the same customer: the firm holds one customer and two requests for that phone number.
A request with an unknown problem type, or with no phone number, is refused and leaves nothing behind: no customer, no address, no request. A request whose handling is killed part of the way through leaves either nothing or a complete triaged request, never a customer with half a request.
Architectural guidance
A half-saved request gives the office a customer with no urgency and no way to see why. The desk re-enters it, and the customer is booked twice or not at all. Urgency decides who is sent first, so a wrong emergency flag puts a burst pipe at the back of the day. A phone number typed twice must not create two customers, or erasure later finds only one of them.
Acceptance criteria
After a request is triaged, a job exists for it without anyone pressing a button. Reading the request back shows its job once the job has been opened. The job view shows status open, trade, urgency, estimated minutes, the site address and access notes copied from the request, and the area. The job view carries no customer name, phone number or email. Two requests from the same phone number give two jobs.
A request that was refused never gets a job. Opening the job for the same request a second time, because a retry fired or two copies ran at once, leaves exactly one job: 20 attempts to open a job for one request at the same moment end with 1 job. The job's history starts with one entry that says the job was opened.
The process is killed after the request has been saved and before the job has been opened, using the way this brief requires to cause that. After the restart the request ends with exactly one job, and the office never has to re-enter it. The same kill after the job has been opened ends with the same single job.
Architectural guidance
A process can die between saving a request and opening its job. If it does, the customer rang, the desk said it was booked in, and no job exists. Nobody finds out until the customer rings again. The opposite failure is a retry that opens the job a second time, and two technicians are sent to the same boiler. Both are invisible in a test that never kills anything.
Acceptance criteria
The office can complete or cancel an open job, and each move shows in the job view straight away. A move out of completed or out of cancelled is refused with a reason the office can read and changes nothing. A job completed at this point shows 0 minutes on site and no parts, because phones come in Phase 4.
The job view shows its history: every status move and every change to the address or access notes, in the order the firm applied it. Each entry says what happened, who did it (the office, or later a phone), when the sender says it happened and when the firm received it. History entries are never edited or removed. The order is the order the firm applied them, and the sender's time orders nothing: an entry stamped 14:30 that was received before an entry stamped 14:10 is shown first. The firm's own clock can be set forward, for example 8 hours, so that received times can be tested without waiting.
Sending the same change twice applies it once and adds one history entry. The office sending a cancel and a complete for one job at the same moment, 20 times over, ends with exactly one of the two accepted and one status-change entry in the history.
The process killed in the middle of a move leaves the job either unchanged with no new entry, or moved with its entry, never one without the other. One command lists every job whose shown status differs from what its history says, and exits with a failure if there is any. A test that damages one job's status by hand makes the command fail.
Architectural guidance
A move saved without its record of why, or a record without the move, leaves a job that says one thing while its history says another, and nobody notices until someone is billed.
Architectural walkthrough
The failure this Phase must survive is a job that cannot explain itself. The old app updated one record in place, so the 14:10 cancellation and the 14:30 completion could not both exist, and nobody could tell which had come first. A status with no history behind it cannot be defended to a letting agent who disputes an invoice. So a job keeps everything that happened to it, in the order the firm applied it. A phone's clock is shown beside each entry and decides nothing, because a phone can be wrong by 15 minutes and silent for hours.
A process that dies between saving a request and opening its job, or between a move and its history entry, is the other failure, and urgency decides who is sent first.
Never promise a slot or a part twice
Produces bookings that cannot overlap and stock that cannot be promised twice, each proven by a test that sends competing requests at the same moment. Leaves phones, parts used offline and invoices for later: stock only changes through receipts, transfers, adjustments and reservations.
Acceptance criteria
The firm has technicians T01 to T09. T01 to T04 hold the plumbing skill, T05 to T07 the heating skill, and T08 and T09 both. Each has a shift on Tuesday 10 Mar 2026 from 08:00 to 17:00 Europe/Amsterdam (UTC+01:00) with a break from 12:00 to 12:30. Once a job is opened it appears in the list of unbooked jobs. Booking a job that does not exist is refused.
A booking takes the job, the technician and the start time, which must fall on a 15 minute mark (09:10 is refused). A booking runs from its start to the start plus the job's estimated minutes plus a flat 25 minute travel allowance. A heating job of 60 minutes booked to T05 at 09:00 is accepted and runs to 10:25. A second heating job of 45 minutes booked to T05 at 10:15 is refused for overlapping, and at 10:30 it is accepted and runs to 11:40. A booking that starts where another ends is accepted. A plumbing job booked to T05 is refused because T05 lacks the plumbing skill, and to T08 is accepted. A 60 minute job on T06 at 11:30 would run into the break and is refused for not fitting the shift, as is a 60 minute job at 15:45, which would run to 17:10, and one at 07:45. Booking the first job again to T06 at 13:00 is refused because the job already has an active booking.
A booking made for 09:00 on Monday 30 Mar 2026, after the clocks change on Sunday 29 Mar 2026, still reads 09:00 local. A technician's day view for 10 Mar 2026 lists the active bookings in start order.
The office can cancel a booking. Its job goes back to the unbooked list and the slot can be booked again. When a job is cancelled, its booking is cancelled as well and the job is not in the unbooked list. Cancelling twice leaves the same result. The process killed after the job was cancelled and before its booking was released ends, after the restart, with the booking cancelled.
Architectural guidance
Two jobs at 09:00 for one technician are found when he arrives at one house and the next customer rings to ask where he is. A job with two active bookings sends two vans to one house. A booking that outlives its cancelled job blocks a slot nobody will use, and if the process dies between the cancellation and the release, the slot stays blocked until someone notices by hand. On the night the clocks change, a time handled without care shifts by an hour, and every later booking is wrong by that hour.
Acceptance criteria
You write tests in your repository that send competing booking requests at the same moment, so that they really overlap in time and see the same starting state. They run against the real product with its data kept between requests, and each test reports, for every request, whether it was accepted and, if not, the reason. The README says how the requests are made to overlap and why a test that runs the requests one after another, or in a way that lets each request see the others' results as its own, would not show the problem.
Five tests use technician T05 and the 60 minute heating jobs registered for the test. First, many requests book different jobs at 09:00: exactly 1 is accepted, every other request is refused for overlapping, and T05 holds 1 active booking. Second, some requests book jobs at 09:00 and others book other jobs at 09:15, ranges that overlap without being equal: exactly 1 booking exists afterwards. Third, 5 requests book the same job to T05, T06, T07, T08 and T09 at 09:00: exactly 1 is accepted and the other 4 are refused because the job already has an active booking. Fourth, one booking request for one job, technician and start time is sent 10 times at once: 1 booking exists and no request ends in a server error. Fifth, the first test is repeated over many rounds with a reset between rounds: every round ends with exactly 1 booking.
A deliberately weakened build, in which a booking request checks for an overlap and then pauses before booking, is run through the first test several times. It ends with more than 1 booking every time, so the test is shown able to fail.
Architectural guidance
A test for this passes for the wrong reason when it cannot fail. If the competing requests run one after another, the second sees the first one's booking and refuses, so the product passes the test and double-books in production the first morning two dispatchers use the same screen. Showing the test failing against a build weakened this way is the proof that the test tests anything.
Acceptance criteria
The firm holds stock in a warehouse WH and in nine vans V01 to V09. The parts used in this Checkpoint are P-CIRC-PUMP (circulation pump), P-TRV-15 (15 mm thermostatic radiator valve) and P-PRV-3BAR (3 bar pressure relief valve). Receiving 10 P-CIRC-PUMP at WH makes the stock view for WH and P-CIRC-PUMP show on hand 10, reserved 0 and available 10. The stores person can read the list of every receipt, transfer and adjustment for a location and part, and its quantities add up to the on-hand figure.
A transfer of 2 pumps from WH to V03 leaves WH with 8 on hand and V03 with 2, and the list shows both sides. A transfer of 9 from WH is refused for insufficient stock and changes nothing. An adjustment of -1 on P-TRV-15 at WH after a receipt of 5, with the reason "dropped", makes the on-hand figure 4, and the earlier entries in the list are unchanged. Entries in the list are never edited or deleted.
A reservation takes the job, the part, the quantity and the location. A reservation of 1 pump at V03 is accepted, and the view for V03 and P-CIRC-PUMP shows on hand 2, reserved 1 and available 1. A reservation of 2 more is refused for insufficient stock and the reserved figure stays 1. A quantity of 0 or -1 is refused, and so is an unknown location. A transfer of 2 out of V03 is now refused, because only 1 unit is available, and a transfer of 1 is accepted.
When a job is cancelled, its reservations are released, the reserved figure falls back, and the record that they existed stays readable. Cancelling twice changes nothing. The process killed after the job was cancelled and before its reservations were released ends, after the restart, with them released.
Architectural guidance
Promising the last circulation pump to two jobs sends two technicians to jobs where only one has the part, and the second finds out in a customer's kitchen. Stock that is overwritten with the latest count leaves nobody able to say where a pump went, which is how the spreadsheet the firm uses today came to be wrong. A job cancelled at 14:10 that keeps its reserved parts hides them from the next job, and a process that dies between the cancellation and the release makes it permanent.
Acceptance criteria
You write tests in your repository that send competing reservation and transfer requests at the same moment, run against the real product with its data kept between requests. WH is seeded with 6 P-CIRC-PUMP and V03 with 1.
Four tests report, for every request, whether it was accepted and, if not, the reason. First, many requests from different jobs each reserve 1 P-CIRC-PUMP at V03: exactly 1 is accepted, every other request is refused for insufficient stock, and the view for V03 shows reserved 1 and available 0. Second, 8 requests each reserve 1 pump at WH, which holds 6: exactly 6 are accepted and the view shows reserved 6. Third, 5 requests each reserve 2 pumps at WH: exactly 3 are accepted and the view shows reserved 6. Fourth, a transfer of the last unit out of V03 and a reservation of it are sent at the same moment: exactly one of the two succeeds, and available stock never shows below 0.
The first test is repeated over many rounds with a reset between rounds. Every round ends with the same result, and no request ends in a server error. A deliberately weakened build, in which a reservation request reads the available figure and then pauses before reserving, is run through the first test several times. It reserves more than 1 pump every time, so the test is shown able to fail.
Architectural guidance
Two reservations that both read "1 available" before either writes promise the last unit twice. The second technician learns of it at the customer's door. A test whose requests run one after another, or see each other's results as their own, passes the weakened build and oversells in production. A test that cannot fail has proved nothing.
Architectural walkthrough
The failure this Phase must survive is two people being told yes to the same thing. The office admin and the owner both dispatch from one screen. If each request first asks whether 09:00 is free for a technician and then books it, both can ask before either writes, both hear yes, and both book. The technician has two jobs at 09:00 and the second customer waits at a door. The same shape promises the last circulation pump to two jobs, and a technician finds out in a customer's kitchen that the van does not have it.
Booking one job twice, a test that cannot fail, and a booking or reservation still held after its job was cancelled are the same problem seen from other sides.
Sync the technician's phone
Produces what a technician sees on a phone with no signal, changes accepted once and in the phone's own order, a rule for every field, conflicts the office can read, and parts used offline recorded in stock. Leaves invoices and payments for later, so a completed job is not yet billed.
Acceptance criteria
The firm has nine phones D01 to D09, one for each technician (D01 is T01 and so on) and one for each van (V01 and so on). A phone asking for 10 Mar 2026 gets that technician's jobs and nothing else. With four jobs booked to T03 and three to T05 on that date, D03 receives exactly the four. Each job shows its status, trade, description, address, access notes, start time in Europe/Amsterdam and in UTC, estimated minutes and the customer's phone number. No job shows an email address or a customer's name, and no job belongs to another technician. A date on which the technician has no booking gives an empty list.
On its next sync the phone receives only what changed since the last one. After the office cancels one of the four jobs at 10 Mar 2026, 13:10 UTC, the answer holds that one job with status cancelled, and the three unchanged jobs are absent. A job newly booked to T03 appears in full. A job whose booking was cancelled or moved to another technician is reported to the phone as gone, with no address and no phone number. Asking twice for the changes since the same sync gives the same answer both times.
The refusals: a phone asking for another phone's changes (D04 asking for D03's) is refused, a request that names a sync that was never made is refused, and an unknown phone is refused. Asking for the day writes nothing to any job, booking or customer.
Architectural guidance
A technician in a farmhouse has only what the phone downloaded before the signal went. A phone that carries someone else's jobs, or a customer's email, is a privacy leak on a device that gets left in vans. A phone whose day is out of date shows a cancelled job as live, and the technician drives to a house the office has already dropped. If every sync resends the whole day, nine phones syncing at 17:45 each pull everything again.
Acceptance criteria
A simulated phone stands in for the real ones, and the way it is built is yours. It can start a day from a seed with phones D01 to D09, make changes while offline, and stamp each change with its own clock, which is wrong by up to 15 minutes either way. It can upload the same group of changes twice, upload groups out of order, and hold a group back by a number of hours. Every change a phone makes carries a unique ID the phone made up and the phone's own running count, starting at 1 with no gaps.
Six changes from D03 each complete one of six open jobs. They are sent in group A (counts 1 to 3) and group B (counts 4 to 6). Group B is delivered first: none of the six jobs changes, and the product shows that D03 is waiting for change 1. After group A arrives, all six jobs are completed, and the order the firm applied them in is 1 to 6. When change 5 is withheld, changes 1 to 4 are applied, change 6 waits, and the product shows that D03 is waiting for change 5. Sending change 5 applies both. Changes stamped 14:30, 14:10 and 14:50 with counts 1, 2 and 3 are applied in the order 1, 2, 3. A gap on D03 does not hold D04's changes.
A change that was already applied, even when it comes again in a new group, is not applied again and adds nothing. Every history entry written this way names D03 as its source. With the firm's clock moved 8 hours forward before delivery, a late group is accepted, its entries show a received time 8 hours later, and the time the phone gave is shown as sent. A group claiming to come from a different phone than the one that sent it is refused, as is a group from an unknown phone, and so is a change that reuses a count already used by a different change ID.
The process is killed after applying 3 of 6 changes. After the restart, all 6 are applied once, and each job's history holds exactly one status change. Two copies of one group processed at the same moment leave every change applied once.
Architectural guidance
A phone that never heard the first answer sends the same changes again. Applied twice, a completion bills twice or a part leaves the van twice. A phone on a bad connection retries one group while a later one gets through, so if the firm applies changes in arrival order, a technician's second change lands before his first. Its clock can be 15 minutes wrong and its upload 8 hours late, so neither the clock nor the arrival order says what the technician did first. A process killed halfway leaves some changes applied and the rest lost, and nobody knows which.
Acceptance criteria
A phone can send four more kinds of change: add a note, log minutes on site, use a part, and add a photo. A note is text, minutes are a number, a part use is a part with a quantity, and a photo is a reference string with no file behind it. Each accepted change shows in the job's history with its position, its source and both times.
Two phones, D03 and D04, each add a note to the same job, and the groups arrive in opposite orders in two runs. In both runs the job view shows both notes, in the order the firm applied them. A time log of 40 minutes and then one of 15 for the same job gives 55 minutes on site in the job view, so the entries add up and neither replaces the other. A change from D03 that uses part P-TRV-15 with quantity 1 shows in the job view, and the van it is taken from is the one the firm has on record for D03, V03: a change that names V07 still records V03. Sending the same change twice adds one entry.
After those entries, completing the job shows 40 minutes on site and one P-TRV-15 in the job view, where Phase 2 showed 0 minutes and no parts. Notes, minutes, parts and photos that reach a cancelled job or an already completed job are accepted and shown, because they are facts.
An empty note, a time log of 0, -5 or 1000 minutes, a part use with quantity 0 and a photo with an empty reference are each refused with a reason and add nothing. A test reads the four additive rows of the table from Phase 1 and checks that each kind is implemented.
Architectural guidance
A technician who writes up a weeping valve in his notes and loses it on sync has done work the firm cannot follow up. Notes from two phones on the same job, replaced by whichever syncs second, are the old app's failure again. Minutes that replace each other bill a customer for 15 minutes when the technician worked 55.
Acceptance criteria
A change from a phone that the firm refuses is kept as a conflict and not thrown away. The office can list the open conflicts, each with the job, the kind (a phone changed something the office owns, or a move the job's states forbid), the refused content, the phone, and both times. The phone is told that the change is in conflict, and the job's history shows an entry recording it. A change from the office that is refused is refused outright and creates no conflict.
The cancellation at 14:10 is replayed. The office cancels the farmhouse job at 10 Mar 2026, 13:10 UTC. D03 uploads at 16:45Z (17:45 local) a group with a note, 40 minutes, a use of part P-TRV-15 and then a completion stamped 13:30Z. The note, the 40 minutes and the part are applied. The completion is in conflict as a forbidden move, the job stays cancelled, the office sees 1 open conflict, and the history shows the conflict after the three additions.
The office had set the address to Molenweg 41 and the access notes to "Gate code 4471" at 09:30. A phone that was offline since 08:00 sends a change that sets the address to Molenweg 14 and one that sets the access notes to the old text, and both are in conflict as changes to something the office owns. The job view still shows Molenweg 41 and the gate code. A cancel sent by a phone is in conflict for the same reason. A second completion with a new change ID for a job already completed is in conflict as a forbidden move.
A conflicted change still counts as received in its phone's running count: when change 4 is in conflict, change 5 is applied in the same run. Sending the refused change again leaves the same single conflict and adds nothing. The job's status, address and access notes are identical before and after a group of refused changes.
Architectural guidance
A refusal nobody sees is a lost edit with extra steps. The technician finished a job the office had cancelled. If the refusal is thrown away, the visit happened, the letting agent will dispute whatever is billed, and nobody can say why the firm disagreed with the phone. The office also needs the refused content, since the gate code might have been in it.
Acceptance criteria
When a phone reports a part used, the van's stock falls by that quantity. V03 holds 3 P-TRV-15, and a use of 1 leaves 2 on hand and flags nothing. V03 holds 1 P-CIRC-PUMP and a phone reports 2 used. The use is recorded anyway: the on-hand figure is -1, and the stores person's list of open shortfalls shows location V03, part P-CIRC-PUMP, shortfall 1 and the job. The shortfall is the quantity used minus what was on hand, counted from zero when the figure was already negative. A further use of 1 with -1 on hand gives a shortfall of 1, and a use of 1 from exactly 0 on hand gives 1. A new reservation of P-CIRC-PUMP at V03 is now refused for insufficient stock, and the available figure shows the negative figure as it is.
The same report of a part used arriving twice, or being processed twice at the same moment, leaves 1 reduction and 1 shortfall. A process killed before the reduction was saved ends, after the restart, with 1 reduction. A process killed after the reduction and before the shortfall was raised ends, after the restart, with the shortfall raised once. The list of stock changes for each location still adds up to its on-hand figure.
Architectural guidance
A part in a wall is a fact whatever the paperwork says. If the product refuses to record it because the van had none, the stock figure stays too high and the next job is promised a pump that is not there. The shortfall is the signal to the stores person that a receipt or a transfer went unrecorded. Raised twice, it sends the stores person after a problem that does not exist. Lost in a crash, it hides one that does.
Acceptance criteria
You write a test in your repository that plays one fixed set of phone changes in many orders and compares the results. The set comes from the simulated day: nine phones with about 60 changes each, so about 540 changes, made offline for up to 8 hours with clocks up to 15 minutes wrong. It includes notes, time logs, parts used, photos and completions. The office's own edits are included but do not conflict with a phone's.
In each run the groups arrive in a different order drawn from a fixed seed, some groups are sent twice, and some are held back by 8 hours. The README states exactly what "the same result" means, and the test checks exactly that. First, the notes, minutes, parts and photos of every job end identical whatever order groups from different phones arrive in. Second, one phone's changes are applied in the order that phone made them whatever order they arrive in. Third, a job's status equals what the legal moves give for the order the firm received the office's actions and the phone's changes. Fourth, the address and access notes of every job equal what the office set, in every run.
The test does not claim one status for every interleaving of the office and a phone. Two named cases are checked against their documented outcomes: the office's cancel received before a phone's completion leaves the job cancelled with 1 open conflict, and a phone's completion received before the office's cancel leaves the job completed with the cancel refused. In a further run, the process is killed once at a random point, and the final result still matches the other runs.
A deliberately wrong version that orders changes by the phone's clock and lets each phone's latest edit replace the job's fields is run through the same test. It ends with a different address from the one the office set, so the test is shown able to fail. The result of the test is committed.
Architectural guidance
A rule that works for one upload order and fails for another is found when a phone on a bad connection syncs, and nobody can reproduce it because nobody can reproduce the order. The test claims only what the rules promise. Arrival order decides between the office and a phone, and that is the only place it decides. A wrong version that fails the test is the proof that the test sees the failure.
Architectural walkthrough
The failure this Phase must survive is the one in the client's story: a phone that was offline since 08:00 replaces a house number the office corrected at 09:30, and nothing says which copy was newer. A phone never sends a whole job here. It sends what the technician did, and the firm decides what each change means by the table you wrote in Phase 1.
Phones send the same changes twice, out of order and hours late with a wrong clock. A change refused without anyone seeing it is a lost edit, and a part used offline is a fact stock has to record.
Bill the work and prove the day
Produces one invoice per completed job, payments recorded once from a provider stand-in, a settlement for conflicting visits, customer erasure, and a command that checks the firm's rules after a simulated working day. Leaves tax and refunds out.
Acceptance criteria
The price list holds the call-out charge 7000 cents, the labour rate 1500 cents for each started 15 minute block, and part prices P-CIRC-PUMP 14500, P-TRV-15 1800 and P-PRV-3BAR 2200. A job completed with 40 minutes on site and one P-TRV-15 gets an invoice with three lines: call-out 7000, labour 3 blocks at 1500 equal to 4500, and part 1800, total 13300 cents. Reading the invoice back by job returns the lines, the total and a payment reference the provider will quote. It holds the customer's billing name and address as they were when the invoice was issued. Time rounds up: 45 minutes is 3 blocks, 46 minutes is 4 blocks, and 0 minutes is 0 blocks and an invoice of 7000 plus parts.
The negative cases: the farmhouse job, cancelled in the office and refused a completion, has no invoice. A completion received twice, or processed twice, or processed 20 times at the same moment, leaves 1 invoice. Changing the P-TRV-15 price to 2000 afterwards leaves the issued invoice at 13300. A time log of 20 minutes that reaches the job after the invoice was issued stays in the history and changes no invoice. All amounts are whole cents.
The process killed after the completion was saved and before the invoice was issued ends, after the restart, with exactly 1 invoice for the job. The same kill at any other point in the work also ends with exactly 1.
Architectural guidance
A completed job with no invoice is revenue nobody notices is missing, and a job invoiced twice is a dispute with a letting agent. An invoice computed from today's prices and not the day's rewrites paper the customer already holds. A button on the accounts screen is how the old app billed a cancelled job. A process that dies between completing a job and invoicing it is the quietest of the three, since nothing looks wrong until the month-end count.
Acceptance criteria
A payment provider stand-in, built by you, can be told that an invoice, by its payment reference, was paid or failed, and delivers that news to the firm. It can send a message twice, send a failure after a success that happened later, delay a message, and send one that does not carry the proof that the provider sent it. A message the provider did not send is refused and changes nothing.
A valid paid message whose amount equals the invoice total records 1 payment and marks the invoice paid. A failed message records the attempt and leaves the invoice unpaid. With a fixed seed the stand-in pays 100 invoices of 13300 cents and also sends failed attempts. 5 paid messages are sent twice and 10 failed and paid pairs reach the firm in reverse. Afterwards the firm holds 100 payments, 100 invoices are paid, every distinct message the provider sent is on record once (100 paid and the failed ones), and no paid invoice has gone back to unpaid. One message delivered 20 times at the same moment gives 1 payment.
A message the firm has acknowledged is never lost. The process killed right after acknowledging a message, and again in the middle of handling one, ends with the payment recorded once. Three kinds of message cannot be applied and create no payment: a second, different paid message for an invoice already paid, one for a payment reference no invoice has, and one whose amount differs from the invoice total. The operator can list these messages, each with its reason in plain words.
Architectural guidance
A provider resends a message when it hears nothing, so the same payment announcement arrives twice, and two messages about one invoice can arrive in the wrong order. A payment recorded twice means the firm believes it holds money it does not. A failure that arrives after a success must not turn a paid invoice back into an unpaid one. A message the firm acknowledges and then loses is never resent, so a customer who has paid is chased for money. A message the provider did not send must change nothing, or anyone can mark a bill paid.
Acceptance criteria
The office settles a conflict by choosing to charge the visit fee or to waive it. The conflict leaves the list of open conflicts and the job's history shows the decision and when it was made. A decision to charge is accepted only for the conflict where a completion reached a cancelled job. For the farmhouse conflict, a decision to charge is accepted and the firm issues a visit-fee invoice of 3500 cents for that job. It holds the customer's billing name and address and can be paid through the same payment messages as any other invoice. The 40 minutes and the valve are not billed. The job itself has no job invoice and its status is still cancelled.
A decision to charge for a conflict about something the office owns, such as a stale address, is refused because that fee cannot be charged, and settles nothing. A decision to waive closes any conflict, issues no invoice and still shows in the history. An unknown conflict is refused. Settling a settled conflict with the same decision changes nothing. With a different decision it is refused because the conflict is already settled, and the first decision stands.
20 decisions to charge sent for one conflict at the same moment record 1 decision, issue 1 visit-fee invoice and end with no server error. The process killed after the decision was saved and before the fee invoice was issued ends, after the restart, with exactly 1 visit-fee invoice. The command that compares each status with its history still passes.
Architectural guidance
Whether to bill a letting agent for a visit the agent had withdrawn is the firm's call, so a person decides. Two office staff clicking at once, or a click repeated by a slow screen, must not bill the agent twice. A decision to charge that is saved and never reaches billing is a fee the firm quietly loses, and the person who decided believes it was billed.
Acceptance criteria
An erasure request for a customer clears the customer's name, phone and email, keeps the customer's ID, and records when the erasure happened. The test customer has 3 jobs, 2 invoices, 1 payment, and a phone number that was sent to technician phones for 2 of the jobs.
After erasure, reading the customer's requests back returns no name, phone or email. A new request for the day by a phone carrying one of the customer's jobs shows no phone number for it. The 3 jobs and their histories are unchanged, with the same number of entries as before. The 2 invoices and the payment are unchanged, including totals and the billing name and address printed on the invoices, which stay because an issued invoice is a legal document. One of the 3 jobs has the phone number typed into its description by the office. A search of a full dump of everything the product stores for the phone number finds it only there, because free text is not scanned, and the README says so.
An erasure request for an unknown customer is refused. A second request for an erased customer changes nothing. Erasure succeeds for a customer with an open job. The process killed after the customer's details were cleared and before the day sheets prepared for technician phones were cleaned ends, after the restart, with no stored copy of the number anywhere. The README names three limits in plain words. A phone that already holds the number keeps it until its next sync. Invoices and payments stay because Dutch law requires the firm to keep them for 7 years (Belastingdienst), and the README says the product never deletes them. The brief gives no legal advice.
Architectural guidance
A customer who asks to be erased and still finds their phone number on a technician's day sheet has not been erased. The firm must keep invoices and payments, so deleting every row would break the accounts, and keeping everything would ignore the request. A day sheet prepared for a technician's phone is easy to forget because it lives away from the customer's record. If the process dies after the customer is cleared and before the day sheets are cleaned, the number stays in a place nobody looks.
Acceptance criteria
One documented command plays a working day. The simulated phones play 35 jobs across nine phones. Phones make changes offline for up to 8 hours with clocks wrong by up to 15 minutes, and 10% of uploads are sent twice. Some jobs are cancelled in the office and completed on a phone. Two dispatchers book at the same moment, and two reservations race for the last part. Payment messages are repeated 5% of the time and reordered 10% of the time. The process is killed in the middle of its work at least three times at different points. One customer is erased during the day.
A second documented command then checks the firm's rules and reports each one as passed or failed: no two bookings for one technician overlap; no job's shown status differs from its history; no invoice exists for a cancelled job without a charged visit fee; every completed job has exactly 1 invoice; every payment is recorded once; every shortfall in a van's stock is matched by one flagged shortfall; and no triaged request is without exactly one job. The command exits with a failure if any rule fails.
Each rule has a prepared case with one deliberate violation, and the check fails on it, so the check is shown able to fail. Running the day twice with the same seed gives the same report. The report of the final day and the prepared failing cases are committed to your repository.
Architectural guidance
Each Phase proved one failure alone. The day proves they do not break each other: the cancelled-and-completed job arriving in the same hour as a payment message that arrives twice and a process that dies halfway through. A check that always says all clear is a report nobody should trust, so every rule needs a case it catches. A day that gives a different report for the same seed hides a failure that depends on timing.
Architectural walkthrough
The failure this Phase must survive is money that disagrees with facts. A job cancelled in the office and finished on a phone must not be billed. A finished job must not be missed, and must not be billed twice when a retry follows a crash. An invoice already issued must not change because a price list changed or a late time log arrived, since the customer holds the old one.
Payment messages that repeat or arrive out of order, a visit fee decided by a person, and an erasure that has to reach every copy while invoices and payments stay for the 7 years Dutch law requires come next. The last Checkpoint runs the whole day with every failure at once.
Architectural walkthrough
A phone's old copy replaces a decision
The old app stored each job as one record and let the office screen, every phone and the accounts screen overwrite it. Each failure in the client's story follows from that. A phone that had been offline for hours held a copy of the job as it was, and when it synced, the copy replaced what the office had decided in the meantime. Nothing in the record said which copy was newer, so the replacement was silent. That failure, a stale copy replacing a decision, happens in any app that lets a device save a whole record after being offline.
One rule does not fit every field
Letting whoever saved last decide is the shortest rule to write, and it is wrong for most of a job. A technician's notes, minutes and parts only grow, so the loser of the race loses work: a weeping valve written up in a farmhouse, an hour of labour that cannot be billed. The address, the access notes and the booked time belong to the office, so a phone's offline edit of them sends the next visit to the wrong house. The status has a short list of legal moves, and a phone that finishes a job the office has cancelled breaks it. Each field costs the firm something different when it loses, which is why the first Phase writes down who decides what before anything is built.
The cancellation at 14:10, traced
A letting agent withdraws a job on a rented farmhouse because the tenant has moved out. The office cancels it at 14:10. The technician is inside the farmhouse with no signal, finishes the job at 14:30 after 40 minutes on site and one thermostatic radiator valve, and the phone syncs at 17:45.
The notes, the 40 minutes and the valve are things that happened, and the firm needs them. The completion contradicts a decision the office already made. The valve still leaves the van's stock, because a part in a wall is a fact whatever the paperwork says. No invoice may be built for a cancelled job. The visit did happen, so a person in the office decides whether to charge the flat visit fee, and the decision has to be visible later. The order of the decisions is the order in which the firm received them: cancel, then complete. Had the completion arrived first, it would have been accepted and the cancellation refused. A product that cannot say which of those two happened cannot answer the letting agent.
Two people asking for the same thing at the same moment
The office admin and the owner dispatch from one screen. If both book 09:00 for the same technician within the same second, a product that checks first and writes afterwards says yes to both, and the technician has two jobs at 09:00. He finds out when he arrives at one house and the next customer rings to ask where he is. The same shape promises the last circulation pump to two jobs, and two technicians drive off to jobs where only one of them has the part.
The same message twice, late, or in the wrong order
A phone that never heard the first answer sends its changes again. A phone on a bad connection retries one group of changes while a later group gets through. A clock on a phone is wrong by up to 15 minutes, and its upload arrives hours late. The payment provider resends a message when it hears nothing, and a failure it reports can arrive after the success that came later. If the product acts on every copy, a part leaves the van twice, a payment is recorded twice, and a paid invoice goes back to unpaid. If it orders by arrival or by the phone's clock, a technician's second change lands before his first.
The process that dies in the middle
A process can die between saving something and doing what should follow from it. A request is saved and the job never opens: the customer was told it is booked in, and nobody finds out until the customer rings again. A job is completed and no invoice appears: revenue nobody notices is missing. The opposite failure is a retry that does the follow-up twice, and the customer is invoiced twice or two technicians are sent to one boiler. Both are invisible in a test that never kills anything.
What it costs
Conflicts are real records that a person has to resolve. The phone can show a state the office has already overruled until it syncs again. Every field needs a written rule before it has code, and every refusal needs a place where someone reads it. The firm accepted those costs because a visible disagreement is cheaper than the visit to the wrong house.
Where it shows if you cut a corner
If two dispatchers can both be told yes to one slot, the Phase 3 tests find two bookings in it. If the latest edit simply replaces a field, the Phase 4 test ends with a different address from the one the office set. If a job is invoiced from a button and not from the completed job, the simulated day shows an invoice for a cancelled job. If a process dies between completing a job and billing it, the simulated day shows a completed job with no invoice. Run each of those in your own build before you call a Phase done, and read what the product tells the office.