fix: handle member identity unique constraint conflicts#4066
Conversation
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
1 similar comment
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
There was a problem hiding this comment.
Pull request overview
Updates the public API member identity creation endpoint to rely on database uniqueness constraints and convert specific unique-constraint violations into 409 Conflict responses (instead of bubbling up as 500 errors).
Changes:
- Removed the pre-insert “identity existence” lookup and relies on DB constraints as the source of truth.
- Added constraint-name-based handling to translate duplicate identity / duplicate verified identity inserts into
ConflictError(409).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
409 Conflictresponses instead of unhandled500errors.Note
Low Risk
Low risk, localized change to the public member identity create endpoint that maps known DB uniqueness violations to
409 Conflictinstead of surfacing500errors.Overview
Updates the public
POSTmember identity creation flow to rely on DB uniqueness constraints rather than a pre-insert existence check.On insert, it now catches specific unique-index violations (duplicate identity on the same member, or an identity already verified on another member) and returns
409 Conflictwith clearer messages, while rethrowing unexpected errors.Reviewed by Cursor Bugbot for commit 018bd12. Bugbot is set up for automated code reviews on this repo. Configure here.