Skip to catalogue

43

idempotency

Doing it twice has the same result as doing it once. Clicks, webhooks, and retries need this.

What is idempotency?

An idempotent operation can be repeated without extra effect. PUT and DELETE often are. POST that creates an order is not, unless you send an idempotency key.

Why does idempotency matter when vibe coding?

The model writes a submit handler and a webhook and neither can survive a double fire. Users double-click. Stripe retries. You get two charges.

How do you do idempotency?

Any create-that-costs-money or create-that-emails gets a key. Store it. Return the original result on replay. Disable the button in flight as UX, not as the only lock.

How do you ask a model for idempotency?

Make (action) idempotent. Same key, same result, no second (charge / email / row). Disable the button while in flight, but do not rely on the button.

What goes wrong with idempotency?

Trusting the UI disable. The retry is a webhook, a tab restore, or a fetch that ran twice. The lock lives on the server.

adjacent