Skip to content

Refactor: Consolidate recipient resolution into extensible RecipientResolutionStrategy framework - #24626

Merged
TeddyCr merged 3 commits into
mainfrom
refactor/notification-recipient-resolution
Dec 9, 2025
Merged

TeddyCr merged 3 commits into
mainfrom
refactor/notification-recipient-resolution

Conversation

@manerow

@manerow manerow commented Dec 1, 2025 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #24515, #17215, #24389

I worked on a full refactor of the OpenMetadata notification recipient-resolution system by introducing a new extensible RecipientResolutionStrategy framework to replace the SubscriptionUtil monolithic logic.
This change improves maintainability, correctness, and extensibility while preserving all existing notification behavior.

What changes did you make?

  • Implemented the RecipientResolutionStrategy framework, including 8 concrete strategies:

    • OwnerRecipientResolver (owner resolution with inherited ownership + thread-specific owner logic)
    • FollowerRecipientResolver (resolves followers; supports Announcement thread parent-entity fallback)
    • AssigneeRecipientResolver (task assignees and mentioned users)
    • MentionRecipientResolver (resolves mentions from thread posts)
    • AdminRecipientResolver (system administrators)
    • UserRecipientResolver, TeamRecipientResolver, ExternalRecipientResolver
  • Added enhanced thread-aware resolution:

    • Owners: thread creator + parent entity owners
    • Followers: referenced entity’s followers for Announcement threads
    • Assignees & mentions: always fetched using FeedRepository
  • Implemented full downstream recursive lineage resolution:

    • Tier 1: Entity lineage transformation (e.g., Thread → referenced entity → Table; TestCase → Table; TestSuite → tables)
    • Tier 2: Lineage graph traversal with recipient resolution at each downstream node
    • Added cycle detection and multi-parent support
  • Removed duplicated logic from SubscriptionUtil and replaced it with clean strategy-based components.

  • Improved error handling, logging, and separation of concerns.

Why did you make them?

The SubscriptionUtil.getTargetsForAlert() design was not scaling well, was hard to modify and was error-prone:

  • All recipient resolution was hardcoded in one method.
  • Adding new recipient types required modifying core logic.
  • Downstream lineage logic was hardcoded and hard to extend.

The new strategy-based design is modular, testable, and extensible, enabling new recipient types or lineage-driven rules without modifying core logic.

How did you test your changes?

  • Verified all existing notification tests still pass (backward compatibility).

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

Checklist:

@manerow manerow self-assigned this Dec 1, 2025
@manerow
manerow requested a review from a team as a code owner December 1, 2025 11:47
@manerow manerow added safe to test Add this label to run secure Github workflows on PRs To release Will cherry-pick this PR into the release branch backend area:alerts-notifications Change events, event subscriptions, alerts, notification templates and channels, email. labels Dec 1, 2025
@manerow
manerow force-pushed the refactor/notification-recipient-resolution branch from 335e24e to 5c9c85e Compare December 1, 2025 16:15
@github-actions

github-actions Bot commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

The Java checkstyle failed.

Please run mvn spotless:apply in the root of your repository and commit the changes to this PR.
You can also use pre-commit to automate the Java code formatting.

You can install the pre-commit hooks with make install_test precommit_install.

@manerow
manerow force-pushed the refactor/notification-recipient-resolution branch from 757d208 to 25c8bd1 Compare December 9, 2025 08:14
@sonarqubecloud

sonarqubecloud Bot commented Dec 9, 2025

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

Changes have been cherry-picked to the 1.11.1 branch.

This branch was previously deployed

1 inactive deployment
test — 25c8bd12 Deployed Dec 9, 2025 by manerow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:alerts-notifications Change events, event subscriptions, alerts, notification templates and channels, email. backend safe to test Add this label to run secure Github workflows on PRs To release Will cherry-pick this PR into the release branch

Projects

No open projects
Status: Done ✅

3 participants