fix: return 404 when merging a member that no longer exists - #4531
Merged
Conversation
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Contributor
|
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. |
Contributor
There was a problem hiding this comment.
Pull request overview
Prevents stale member merges from returning 500 errors and repeatedly retrying in Temporal workers.
Changes:
- Return 404 when either member no longer exists.
- Treat that 404 as a successful no-op in three merge activities.
- Avoid marking missing-member merges as failed.
Review note: The PR title is missing the required (CM-XXX) JIRA key.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
services/libs/common_services/src/services/common.member.service.ts |
Adds member existence validation and 404 propagation. |
services/apps/script_executor_worker/src/activities/common.ts |
Stops retries for missing members. |
services/apps/merge_suggestions_worker/src/activities/common.ts |
Stops retries for missing members. |
services/apps/members_enrichment_worker/src/activities/member.ts |
Stops retries for missing members. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Summary
Merge suggestions can still send a merge against a profile that was just merged away. After a successful merge we hard-delete the extra member. If the UI still has that id (next suggestion already on screen, or a retry), we try to move identities onto a member that no longer exists.
Postgres then fails with
memberIdentities_memberId_fkey(insert or update on table "memberIdentities" violates foreign key constraint). The API returns 500 and Slack reportsAPI Error 500: PUT /member/:id/merge/SequelizeForeignKeyConstraintError.That is a stale request, not bad identity data. The leftover profile should stay put; a new suggestion can pair it with whoever is still alive.
Changes