Skip to content

refactor: unify query building logic for merge suggestions [CM-765]#3581

Merged
skwowet merged 4 commits into
mainfrom
bugfix/merges
Nov 7, 2025
Merged

refactor: unify query building logic for merge suggestions [CM-765]#3581
skwowet merged 4 commits into
mainfrom
bugfix/merges

Conversation

@skwowet

@skwowet skwowet commented Nov 7, 2025

Copy link
Copy Markdown
Collaborator

Changes

This PR builds on the previous refactoring effort to further improve the merge suggestion query logic. The focus is on unifying the implementation for members and organizations to make it more robust and maintainable.

Before:

  • Member and organization query building logic was handled in separate, lengthy blocks of code.
  • Some exact match queries for members were still not chunked, causing maxClauseCount errors to persist in edge cases.
  • Identity processing and cleaning logic was mixed with query construction.

After:

  • A generic clauseBuilders pattern has been introduced to create a unified and DRY implementation for both member and organization queries.
  • All query types are now consistently chunked, fully resolving the OpenSearch maxClauseCount issue for both members and organizations.
  • Helper functions for identity processing (isNumeric, cleanIdentityValue, etc.) have been extracted to improve clarity.
  • Shared constants like EMAIL_AS_USERNAME_PLATFORMS have been moved to a central enums.ts file.

This refactor ensures that the suggestion generation is both efficient and easier to maintain going forward, without affecting the quality of the results.

@skwowet skwowet self-assigned this Nov 7, 2025
@skwowet skwowet changed the title refactor: unify query building logic for merge suggestions refactor: unify query building logic for merge suggestions [CM-765] Nov 7, 2025
@linuxfoundation linuxfoundation deleted a comment from github-actions Bot Nov 7, 2025
@skwowet skwowet merged commit 75c85a6 into main Nov 7, 2025
13 checks passed
@skwowet skwowet deleted the bugfix/merges branch November 7, 2025 11:22
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.

1 participant