Loop 002 — Barber blocks time off; client cancels with their own link
2026-11-15 · The barber can now block a lunch break, a day off or a week away from the phone, and clients can no longer book those times. Client self-cancel was already there; now the client's page also says who cancelled.
Why
The barber needs to block time off (a lunch break or a whole day) so clients cannot book it, and a client must be able to cancel their own booking with a link they get after booking.
This was a test run with the owner unavailable. Every new choice is assumed (D14–D20 in DECISIONS.md). The second half of the request already worked from Loop 001: the booking link shown after booking (also inside the calendar file) cancels in two taps. This loop checked it again in a real browser and filled one gap.
What changed
- Block time from the phone. Block time on the day view opens a form with that day and a 12:00–13:00 lunch already filled in. Saving a lunch break takes two taps. Whole day gives a day off. Repeat until covers a week away, or lunch every day this week, in one entry. No config edit and no restart.
- Clients cannot book it. Blocked times disappear from the booking page at once. The server also refuses them: a stale link, a hand-made request, or the one-tap rebook after a lost race. A day with every slot blocked shows Closed, not "Full".
- Overlap, not just start time. A slot is blocked if any part of it overlaps the block, so a 12:15–12:45 errand removes both 12:00 and 12:30. A block ending at 12:00 leaves 12:00 free. The rule is a pure function in
src/slots.tswith edge-case tests. - No silent cancels. If a client already booked inside a new block, the booking is kept. The "Time blocked" page names it with a tap-to-call number, and the day view flags it in red until the barber calls, moves or cancels it. Why: the app sends no messages, so an automatic cancel would leave the client standing at a closed door.
- Private labels. "Dentist" or "Holiday" is shown only to the barber, never to clients, and never logged.
- Undo in two taps. Remove, then Yes, remove it, and the times are offered again. Upcoming blocks are listed on the Block time page.
- The client's link says who cancelled. "Cancelled by the shop" (with the shop phone when one is set) or "You cancelled this booking", and both offer Book another time.
- A layout choice from the screenshots. The first version put the Blocked list above the bookings. It moved below them, so the day still opens on the people coming in.
Checks
| Command | Result | Notes |
|---|---|---|
npm run format:check | passed | Prettier: all files formatted. |
npm run lint | passed | 0 warnings (a first run flagged two optional chains in the new test; fixed). |
npm run typecheck | passed | tsc strict, app and e2e projects. |
npm test | passed | 56/56 (37 from Loop 001 plus 19 new): overlap edges, off-grid blocks, whole days, ranges, Closed days, form validation, block store, HTTP create/list/remove, cross-site and signed-out refusals, flagged bookings, manage page wording. |
npm run test:e2e | passed | 5/5 in Chromium at 390px: the Loop 001 flows (including client cancel from the link) plus lunch block, day off, Closed day, stale link refused, barber cancel shown to the client, remove block; and blocking and unblocking with JavaScript disabled. |
| lint_diagrams | passed | 5 diagrams in ARCHITECTURE.md and PRODUCT.md, no issues. |
| CI workflow | not_run | No remote; the owner said never push. |
What is left
- The owner confirms or changes the assumed choices from Loops 001 and 002, especially "keep bookings inside a new block".
- Clients are not told when a block or a barber cancel affects them. That needs SMS or e-mail; the barber calls them for now.
- Weekly recurring breaks are not built; a date range covers one week per entry.
- Still carried over: hosting and CI (need the owner's go), the dev-only
npm auditadvisories, and no automated axe scan.