{{ message }}
Repository navigation
fix: return 409 when a token request reuses an existing user ID - #13790
Merged
Merged
Conversation
The phone, email and magic URL token endpoints create a user when no user matches the identifier, but never caught the unique-index failure when the caller supplied a userId that already belongs to another user. That surfaced as an unhandled 500 (Sentry CLOUD-3QYD, 5.7k events). Map it to USER_ALREADY_EXISTS like the other user-creating endpoints.
Contributor
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after) |
HarshMN2345
approved these changes
Sep 21, 2026
abnegate
added a commit
that referenced
this pull request
Sep 22, 2026
Drop the account.php and AccountCustomClientTest changes: the phone token and push target duplicate handling landed on main via #13789 and #13790 with 409 semantics. Keep only the teams membership Duplicate mapping and its concurrent E2E coverage. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.

What does this PR do?
POST /v1/account/tokens/phone,/tokens/emailand/tokens/magic-urlcreate a user when no user matches the given identifier. When the caller supplies auserIdthat already belongs to a different user, the insert hits the unique index and the request 500s instead of returning409 user_already_exists. Fixes Sentry CLOUD-3QYD, 5.7k events since 9/6.Test Plan
testCreatePhonegains a case that reuses the created user ID with a different phone and asserts 409. NewtestCreateEmailTokenWithExistingUserIdcovers the email and magic URL endpoints the same way. Verified red (500) with the controller hunk reverted and green with it applied.Related PRs and Issues
Same shape as #13789, which fixed the push target update path.
Checklist