Answer a retried feedback submission with the one already saved
Test and deploy / test-and-deploy (pull_request) Successful in 46s

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>
This commit is contained in:
PaddyandClaude Opus 5.5 committed 2026-11-16 17:48:33 +01:00
1 parent c9c40af382
commit f3f4ca2c9f
5 files changed
+202 -11

No files matched your search

@@ -56,6 +56,10 @@
* website:
* type: string
* description: Honeypot field. Must stay empty; a real visitor never fills it in.
* clientToken:
* type: string
* format: uuid
* description: Generated once per form and resent on every retry. A retry whose token is already stored returns the original submissionId instead of saving a duplicate. Optional; a value that isn't a UUID is ignored.
* SubmissionResponse:
* type: object
* properties:
@@ -95,4 +99,5 @@ export interface SubmissionRequestBody {
guestBook?: GuestBookInput;
newsletter?: NewsletterInput;
website?: string;
clientToken?: string;
}