← All projects
Case study · 02 / 07

unattended

4,335 → 0 incidents

A booking engine for rentals with nobody on site, and a harness that plays 10,000 customers through a year to find what breaks.

01 Problem

Self-service hire (trailers, kayaks, tools) means a customer books online, verifies ID, gets a time-limited smart-lock PIN and collects the item alone. The happy path is easy. The trailer that comes back three hours late, the lock with no reception, the hire that crosses a daylight-saving change, the bond that quietly expired — with nobody on site, each one is a stranded customer at 2am.

02 Approach

Instead of hand-testing a few cases, a seeded harness simulates a whole year: customers who act only on the local times and SMS they were told, locks that drop offline for up to 18 hours, card holds that lapse after 7 days. After every event it checks seven invariants the business promises — no double booking, nobody stranded, no unverified pickup, no zombie PINs, a live bond at return, fair billing, and that what the engine acts on matches what the customer was told. One rule holds the time model together: customer-facing times are stored as wall-clock text, machine actions as instants, converted in one module.

03 Result

The first, obvious version produced 4,335 incidents in a simulated year and only 38.3% of bookings needed no human. Each finding was fixed on its own branch with a regression test that fails on the old code. After the fixes: zero incidents and 87.4% hands-off, clean across 20 seeds — 200,000 year bookings plus 60,000 aimed at clock-change weekends — checked by CI on every push. A full year runs in about 3.6 seconds.

04 What didn’t work

The harness caught a bug in one of the fixes: the first late-return fix moved bookings out of the list it was iterating, silently skipping the next booking. Payments and locks are still fakes modelled on documented behaviour, and the customer model is a reasoned guess — driving it from a real booking export is the next step.

05 Stack

  • TypeScript
  • Node
  • Simulation
  • Vitest
  • GitHub Actions
Next projectSea Anchor