Answer a retried feedback submission with the one already saved #24

Merged
Paddy merged 2 commits from fix/feedback-submission-idempotency into master 2026-11-16 17:28:37 +00:00
Owner

When a submission saved but its response never reached the phone, the
form showed an error, the visitor tapped "Feedback absenden" again, and a
second identical row was stored (seen twice in production: 82/83, 87/88).

The form now sends a clientToken, one UUID per visit, on every attempt.
A token that is already stored returns the original submissionId and
saves nothing; the lookup runs before the eligibility check, so a retry
still succeeds if the feedback window closed in between. Two concurrent
retries are settled by a UNIQUE index on submissions.client_token: the
loser gets ER_DUP_ENTRY, rolls back and returns the winner's id. A missing
or non-UUID token behaves as before, so cached copies of the old form
still submit.

Migration 003 must be applied before this is deployed - the INSERT now
writes client_token.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

When a submission saved but its response never reached the phone, the form showed an error, the visitor tapped "Feedback absenden" again, and a second identical row was stored (seen twice in production: 82/83, 87/88). The form now sends a clientToken, one UUID per visit, on every attempt. A token that is already stored returns the original submissionId and saves nothing; the lookup runs before the eligibility check, so a retry still succeeds if the feedback window closed in between. Two concurrent retries are settled by a UNIQUE index on submissions.client_token: the loser gets ER_DUP_ENTRY, rolls back and returns the winner's id. A missing or non-UUID token behaves as before, so cached copies of the old form still submit. Migration 003 must be applied before this is deployed - the INSERT now writes client_token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paddy added 1 commit 2026-11-16 16:49:54 +00:00
Answer a retried feedback submission with the one already saved
Test and deploy / test-and-deploy (pull_request) Successful in 46s
f3f4ca2c9f
When a submission saved but its response never reached the phone, the
form showed an error, the visitor tapped "Feedback absenden" again, and a
second identical row was stored (seen twice in production: 82/83, 87/88).

The form now sends a clientToken, one UUID per visit, on every attempt.
A token that is already stored returns the original submissionId and
saves nothing; the lookup runs before the eligibility check, so a retry
still succeeds if the feedback window closed in between. Two concurrent
retries are settled by a UNIQUE index on submissions.client_token: the
loser gets ER_DUP_ENTRY, rolls back and returns the winner's id. A missing
or non-UUID token behaves as before, so cached copies of the old form
still submit.

Migration 003 must be applied before this is deployed - the INSERT now
writes client_token.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paddy added 1 commit 2026-11-16 17:27:30 +00:00
Match a submission's client token only within its event
Test and deploy / test-and-deploy (pull_request) Successful in 27s
adf723419d
The token is per form visit, and one visit can move on to another
concert's form in the same tab. With a global match, the second event's
submission was answered with the first event's id and its feedback was
silently dropped. The lookup now joins on the event slug, and the unique
index in 003 is (event_id, client_token) instead of client_token alone.

003 is edited in place: it has not been applied anywhere yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paddy merged commit 4a61774a40 into master 2026-11-16 17:28:37 +00:00
Sign in to join this conversation.