Skip to content

fix: handle member identity unique constraint conflicts#4066

Merged
skwowet merged 1 commit intomainfrom
fix/member-identity-conflict-handling
Apr 30, 2026
Merged

fix: handle member identity unique constraint conflicts#4066
skwowet merged 1 commit intomainfrom
fix/member-identity-conflict-handling

Conversation

@skwowet
Copy link
Copy Markdown
Collaborator

@skwowet skwowet commented Apr 30, 2026

Summary

  • Handle unique constraint conflicts when creating member identities in the public API.
  • Convert duplicate identity DB errors into 409 Conflict responses instead of unhandled 500 errors.
  • Remove the redundant pre-insert identity existence check and rely on DB constraints as the source of truth.

Note

Low Risk
Low risk, localized change to the public member identity create endpoint that maps known DB uniqueness violations to 409 Conflict instead of surfacing 500 errors.

Overview
Updates the public POST member 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 Conflict with 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.

Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
@skwowet skwowet self-assigned this Apr 30, 2026
Copilot AI review requested due to automatic review settings April 30, 2026 17:24
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@skwowet skwowet merged commit 4f9abf6 into main Apr 30, 2026
22 checks passed
@skwowet skwowet deleted the fix/member-identity-conflict-handling branch April 30, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants