Skip to content

fix: keep LFX organizations as primary in merge suggestions#4106

Merged
skwowet merged 4 commits into
mainfrom
bugfix/org-lfx-secondary-primary
May 13, 2026
Merged

fix: keep LFX organizations as primary in merge suggestions#4106
skwowet merged 4 commits into
mainfrom
bugfix/org-lfx-secondary-primary

Conversation

@skwowet
Copy link
Copy Markdown
Collaborator

@skwowet skwowet commented May 12, 2026

What changed

In getOrganizationMergeSuggestions, when generating organization merge suggestions, if the secondary candidate has an LFX membership and the primary does not, the two are now swapped so the LFX org becomes primary.

Why

LFX membership organizations cannot be merged as secondary, and the merge API hard-rejects these cases at runtime. By ensuring they’re always set as primary during suggestion creation, we prevent invalid ordering from entering the pipeline and avoid silently failed merges caused by this constraint.


Note

Medium Risk
Changes merge-suggestion ordering logic, which can affect which organization is treated as the merge primary/secondary and therefore downstream merge behavior. Risk is limited to suggestion generation but could alter merge outcomes for LFX-related candidates.

Overview
Updates getOrganizationMergeSuggestions to force LFX-member organizations to be the primary when building merge suggestions: if only one side has LFX membership, the pair is ordered so the LFX org comes first; otherwise it falls back to the existing identities/activity-based sort. Also avoids repeated opensearchToFullOrg conversions by materializing the secondary org once before scoring and ordering.

Reviewed by Cursor Bugbot for commit 359a056. 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 12, 2026
Copilot AI review requested due to automatic review settings May 12, 2026 18:57
@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

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 64da245. Configure here.

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 adjusts organization merge suggestion generation so that organizations with an LFX membership are placed in the primary position, preventing downstream merge failures where the merge API rejects LFX organizations as the secondary.

Changes:

  • Convert the OpenSearch candidate org once (secondaryOrg) and reuse it for similarity + ordering.
  • Add LFX-aware ordering logic that swaps primary/secondary when the candidate (secondary) has LFX membership and the current org (primary) does not.

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

skwowet added 2 commits May 13, 2026 00:33
…ggestions

Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 12, 2026 19:07
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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
@skwowet skwowet merged commit c98d68e into main May 13, 2026
15 checks passed
@skwowet skwowet deleted the bugfix/org-lfx-secondary-primary branch May 13, 2026 07:42
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