Stop a double-submit from creating duplicate registrations and people - #2465
Merged
Conversation
maebeale
marked this pull request as ready for review
August 31, 2026 21:17
Collaborator
|
This looks overcomplicated. I thought we just had a conversation about double submits. |
A returning registrant (same name + email) reuses their existing Person and single event registration, but re-submitting the form used to overwrite their prior FormSubmission in place. That silently lost their earlier answers. Each registration now records its own FormSubmission, so the full history is preserved, and the public confirmation view defaults to the most recent submission when none is named. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A double-click on the public registration form fired two POSTs. Worst on paid events, which opt out of Turbo (turbo: false) and so had no submitter disabling at all. Each POST ran find_or_create_person independently, neither saw the other's uncommitted person, so both created a Person (and thus a second registration the registrant_id unique index couldn't catch) — two people, two registrations, same minute. Two layers of defense: - Client: attach the existing submit-once Stimulus controller to the form so the button locks after the first click, on both the Turbo (free) and non-Turbo (paid) variants. - Server: serialize concurrent submissions for the same identity behind a MySQL named lock (keyed on email + last name + event, namespaced by database so parallel test suites don't contend), so the second request waits and matches the first's committed person. Best-effort — a blank identity or an un-acquirable lock falls through rather than failing a real registration. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Announce that repeat registration submissions no longer create duplicate people/registrations, framed around repeat submissions generally (not just a double-click) since it also covers registering again later. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
maebeale
force-pushed
the
maebeale/dedupe-duplicate-registration
branch
from
September 1, 2026 03:24
1a344bd to
1fea235
Compare
Collaborator
Author
|
@jmilljr24 happy to have you submit something different |
jmilljr24
approved these changes
Sep 1, 2026
jmilljr24
left a comment
Collaborator
There was a problem hiding this comment.
The lock seemed excessive (same point I made when this double submit came up on a different form). The main issue was handle the turbo-false since it disables turbo handling the double submit. This form needs the option to disable turbo for the stripe checkout so the submit-once controller is sufficient for client side. That will catch 99% of the issues. The deduper can handle the rest since is it needed anyway for true duplicate submission since the person matching is pretty loose.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 suggested review level: 5 Inspect 🔬 concurrency guard (MySQL named lock) + registration-flow change across the public registration path
A registrant who double-clicked Register (or came back and re-submitted) could end up with two people and two registrations for the same event — this closes both the accidental double-click and the underlying race, and stops re-submissions from silently losing earlier answers.
Duplicate registrations from a double-submit
submit-onceStimulus controller, so the button locks after the first click. This matters most on paid events, which opt out of Turbo (turbo: false) and so had no submitter disabling at all — the likely source of the "two registrations in the same minute" incident.find_or_create_person, so the flow now serializes same-identity submissions behind a MySQL named lock (email + last name + event, namespaced by database so parallel test suites don't contend). The second request waits, then matches the first's committed person. Best-effort: a blank identity or an un-acquirable lock falls through rather than failing a real registration.Re-registration no longer overwrites answers
FormSubmissionin place, silently dropping the earlier answers. Each submission is now recorded on its own, preserving the full history (the admin registrants view already iterated multiple submissions).Tests
submit-oncerenders on free and paid events.