Back to the pile

The club card that upgraded itself

A five-day-old member with £15 of spend is somehow top-tier — free pastry, £50 credit, staff perks. The back office granted none of it. The account page can't. Something did.

nodeexpressChewy~25 min
1

Fresh from the oven

Clone it down and have a look around.

$git clone https://github.com/loaf-crumbs/club-card-that-updated-itself.git
2

The scenario

Loaf runs a loyalty scheme called Crumb Club. Members climb tiers — Crumb, Half Loaf, Whole Loaf — by how much they spend over time, and each tier unlocks a bigger discount; the top one adds a free pastry with every order. Members can edit their own profile from an account page: name, email, delivery address, favourite bake. Everything else — tier, discount rate, store credit, whether someone's staff — is set by the loyalty jobs and the back office. Members don't get to touch those. Marina flagged a member during the weekly perks review. Theo Whitmore joined five days ago and has spent £15.70. The roster even prints the tier he's *earned* from that spend: Crumb, the bottom rung. But the tier he's actually holding is Whole Loaf — full 10% discount, a free pastry every order, and £50 of store credit sitting in his account. Nobody in the back office issued any of it. There's no discount button, no "grant credit" control, nothing on the account page that could have done this. The whole storefront was scaffolded by an AI assistant, and it's been running the club without complaint. Edit a profile through the page and it behaves exactly as designed — your four fields change and nothing else moves. So how did an ordinary member end up with the keys to the top tier, and how would you stop the next one from handing themselves the same thing?
3

What done looks like

- Updating a profile only changes the fields the member is allowed to edit - A member cannot set their own tier, discount, store credit, or staff flag through the update endpoint - Editing name, email, address, or favourite through the page still works - Perks stay tied to what a member has actually earned, not to what a request claims
4

Stuck?

Peek if you need to — they get more specific as you go.

5

Taste test

Send it in when you’re ready. We’ll see if it’s tasty.

When you've got the flag, paste it here.

No attempts yet.