Skip to content

fix: serialize member enrichment org savepoints#4071

Merged
skwowet merged 2 commits into
mainfrom
fix/member-enrichment-savepoint-race
May 5, 2026
Merged

fix: serialize member enrichment org savepoints#4071
skwowet merged 2 commits into
mainfrom
fix/member-enrichment-savepoint-race

Conversation

@skwowet
Copy link
Copy Markdown
Collaborator

@skwowet skwowet commented May 4, 2026

Summary

Fixes a savepoint "... " does not exist failure in member enrichment.

The issue came from running multiple organization writes in parallel inside one DB transaction. Each write could create nested savepoints, and one rollback could invalidate another in-flight savepoint.

This PR makes those organization writes run sequentially and syncs after the DB transaction commits.


Note

Medium Risk
Changes transaction execution by making organization upserts sequential and moving syncOrganization outside the member update transaction, which could affect throughput and timing but reduces risk of transactional savepoint conflicts.

Overview
Prevents member enrichment failures caused by parallel organization writes inside a single DB transaction by serializing findOrCreateOrganization calls (removing the in-transaction Promise.all pattern).

Collects created/updated organization IDs during the transaction and triggers syncOrganization after the transaction commits, deduping IDs and isolating sync failures from DB writes.

Reviewed by Cursor Bugbot for commit 4e4dd48. 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 May 4, 2026
Copilot AI review requested due to automatic review settings May 4, 2026 17:40
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

⚠️ 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

github-actions Bot commented May 4, 2026

⚠️ 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.

2 similar comments
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

⚠️ 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

github-actions Bot commented May 4, 2026

⚠️ 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

This PR fixes intermittent savepoint "... " does not exist failures during member enrichment by removing parallel organization writes within a single pg-promise transaction (which can create conflicting nested savepoints) and deferring organization sync until after the transaction has committed.

Changes:

  • Serialize findOrCreateOrganization calls (and related identity/merge-suggestion handling) by removing the prior Promise.all(...) pattern.
  • Track organization IDs that need syncing during the transaction and run syncOrganization only after the outer transaction completes (deduped).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@skwowet skwowet merged commit f3b33a5 into main May 5, 2026
18 checks passed
@skwowet skwowet deleted the fix/member-enrichment-savepoint-race branch May 5, 2026 08:24
Muawiya-contact pushed a commit to Muawiya-contact/crowd.dev that referenced this pull request May 11, 2026
Signed-off-by: Muawiya-contact <contactmuawia@gmail.com>
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