Skip to content

fix: handle empty organization data correctly (CM-1113)#4032

Merged
themarolt merged 2 commits intomainfrom
fix/dsw-fix-CM-1113
Apr 17, 2026
Merged

fix: handle empty organization data correctly (CM-1113)#4032
themarolt merged 2 commits intomainfrom
fix/dsw-fix-CM-1113

Conversation

@themarolt
Copy link
Copy Markdown
Contributor

@themarolt themarolt commented Apr 17, 2026

Note

Medium Risk
Changes organization upsert behavior to return undefined (skip) instead of throwing when verified identities are lost during domain normalization, which can affect whether organizations are created/updated in ingestion flows.

Overview
Improves findOrCreateOrganization to better handle empty/invalid identity data by defaulting data.identities to an empty array and re-computing verifiedIdentities after domain normalization/filtering.

If normalization removes all verified identities and there is no displayName, the function now logs and returns undefined (skips processing) instead of erroring, preventing failures on malformed organization inputs.

Reviewed by Cursor Bugbot for commit ae719a8. Bugbot is set up for automated code reviews on this repo. Configure here.

Signed-off-by: Uroš Marolt <uros@marolt.me>
Copilot AI review requested due to automatic review settings April 17, 2026 12:04
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 upsert behavior to correctly handle cases where domain normalization invalidates previously verified organization identities, avoiding incorrect lookups/creation attempts with now-empty identity data.

Changes:

  • Make verifiedIdentities re-assignable and re-derive it after domain normalization + identity cleanup.
  • Skip further processing (return undefined) when normalization removes all verified identities and there is no displayName.

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

Comment thread services/libs/data-access-layer/src/organizations/base.ts Outdated
Signed-off-by: Uroš Marolt <uros@marolt.me>
@themarolt themarolt requested a review from mbani01 April 17, 2026 12:25
@themarolt themarolt merged commit 6745534 into main Apr 17, 2026
15 checks passed
@themarolt themarolt deleted the fix/dsw-fix-CM-1113 branch April 17, 2026 12: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.

3 participants