Repository navigation
Closed
Labels
bugSomething isn't working
Description
Follow-up to #378 and #385, which let participants leave the email blank where the organizer allows it.
What happens
With an email, a second POST /api/slots/[id]/commitments for the same person and slot finds the same participant and is refused: "you already committed to this slot". Without an email there is nothing to recognise them by. Every request creates a new participant, so that check can never match.
Here is a realistic case:
- A participant's phone loses its connection after the server commits the sign-up, but before the response arrives.
- The sign-up form shows "network error", and they press Confirm again.
- A second commitment is created.
- The first response's
Set-Cookiewas lost and no email is sent, so the first commitment has no link anywhere. It holds a place until the organizer removes it from the Responses tab (Organizers can remove one person from a slot #377).
A double click is already blocked, because the button is disabled while sending. A check based on the os_commit cookie doesn't help here, because the lost response is exactly the one that would have set the cookie.
Fix, in outline
- The sign-up form makes an idempotency key when it opens (for example, a random id kept for the life of the dialog). It sends the key with the sign-up request.
- The server stores the key with the commitment it creates. A repeat request with the same key returns that same commitment, with its edit link, instead of creating another.
- This needs somewhere to keep the key. Per CLAUDE.md's "no speculative schema", add it in the same change that reads and writes it, and give it a short lifetime or tie it to the commitment row.
- Keep
POST /api/slots/[id]/commitmentswithin its statement budgets (budgets.json,query-budget.db.test.ts).
Done when
- Two identical sign-up requests with the same key create one commitment and both get its link back.
- A request with a different key, or none, behaves as today.
- DB and e2e tests cover the retry.
pnpm lint && pnpm typecheck && pnpm knip && pnpm testandpnpm test:dbpass.
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity
Look up a retried sign-up after the slot lock, not in its statement
Check in the browser that a sign-up sent again gets its spot back
Tie a sign-up's idempotency key to its details, and keep it after a f…
Give a retried sign-up back the spot it already took (#396)