Skip to content

feat(np): Adds renderer for MSTeams issue alerts - #124860

Merged
hobzcalvin merged 8 commits into
masterfrom
gv/add_msteams_issue_renderer
Sep 23, 2026
Merged

hobzcalvin merged 8 commits into
masterfrom
gv/add_msteams_issue_renderer

Conversation

@hobzcalvin

@hobzcalvin hobzcalvin commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #124857 (gp/add_renderer_registry). Supersedes #112890, which could not be reopened after the branch was rebased.

Summary

Adds IssueMSTeamsRenderer, so issue alerts sent through the notification platform produce the same Adaptive Card the legacy MSTeamsIssueMessageBuilder path produces today. The renderer registers itself for (MSTEAMS, ISSUE) with the registry from the parent PR rather than adding a get_renderer override to the provider.

Original work by @GabeVillalobos; rebased onto current master and adapted to the registry.

Actions are limited to a single "View Issue" link. The legacy card also offers resolve/archive/assign, which need the RpcIntegration for action webhook routing; that is coming in #125160

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Sep 17, 2026
@hobzcalvin
hobzcalvin force-pushed the gv/add_msteams_issue_renderer branch 3 times, most recently from 7572f39 to 9333505 Compare September 18, 2026 22:26
@hobzcalvin
hobzcalvin added this pull request to stack #124985 September 18, 2026 22:41
@hobzcalvin
hobzcalvin marked this pull request as ready for review September 18, 2026 22:43
@hobzcalvin
hobzcalvin requested a review from a team as a code owner September 18, 2026 22:43
@hobzcalvin
hobzcalvin force-pushed the gv/add_msteams_issue_renderer branch from 9333505 to d975181 Compare September 21, 2026 16:34
Comment thread src/sentry/notifications/platform/msteams/renderers/issue.py
@hobzcalvin
hobzcalvin force-pushed the gv/add_msteams_issue_renderer branch from d975181 to acda67c Compare September 21, 2026 23:11
@sentry

sentry Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Sentry Snapshot Testing

Name Added Removed Changed Renamed Unchanged Skipped Status
sentry-frontend
sentry-frontend
0 0 0 0 518 0 ✅ Unchanged

⚙️ sentry-frontend Snapshot Settings

Comment thread tests/sentry/notifications/platform/msteams/renderers/test_issue.py Outdated
@hobzcalvin
hobzcalvin requested a review from a team as a code owner September 21, 2026 23:30
@hobzcalvin
hobzcalvin force-pushed the gv/add_msteams_issue_renderer branch 2 times, most recently from f62fa24 to ee745d1 Compare September 21, 2026 23:44
@hobzcalvin
hobzcalvin force-pushed the gv/add_msteams_issue_renderer branch from ee745d1 to 742a552 Compare September 22, 2026 00:04
@hobzcalvin
hobzcalvin force-pushed the gv/add_msteams_issue_renderer branch from 742a552 to 34cbd30 Compare September 22, 2026 17:48
@hobzcalvin
hobzcalvin force-pushed the gv/add_msteams_issue_renderer branch from 34cbd30 to 477eb0e Compare September 22, 2026 17:58
Base automatically changed from gp/add_renderer_registry to master September 22, 2026 20:05
@hobzcalvin
hobzcalvin force-pushed the gv/add_msteams_issue_renderer branch from 477eb0e to 5c46be1 Compare September 22, 2026 20:05
Comment thread src/sentry/notifications/platform/msteams/renderers/issue.py Outdated
@hobzcalvin
hobzcalvin force-pushed the gv/add_msteams_issue_renderer branch 2 times, most recently from ad19702 to d198ff5 Compare September 22, 2026 21:02

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

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, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d198ff5. Configure here.

Comment thread src/sentry/notifications/platform/msteams/renderers/issue.py
Comment thread src/sentry/notifications/platform/msteams/renderers/issue.py Outdated
if not isinstance(data, IssueNotificationData):
raise ValueError(f"IssueMSTeamsRenderer does not support {data.__class__.__name__}")

from sentry.integrations.msteams.card_builder.base import MSTeamsMessageBuilder

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

think this would be better at the top unless its causing an import error

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I never want inline imports, but there's a big complex set of reasons why it works out this way, involving other renderers, the jira-app-id that comes from sentry options...at least this is building on precedent from other renderers.

@hobzcalvin
hobzcalvin force-pushed the gv/add_msteams_issue_renderer branch from d198ff5 to 91bce24 Compare September 22, 2026 23:00

@shayna-ch shayna-ch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm!

GabeVillalobos and others added 8 commits September 23, 2026 11:01
Annotates _build_expected_card as returning an AdaptiveCard and types its
actions list, resolving mypy errors in the MSTeams issue renderer tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
`sentry.notifications.apps.Config.ready` imports this renderer, and importing
any `sentry.integrations.msteams` submodule executes that package's `__init__`,
which reaches `sentry.notifications.notification_action` and from there the Jira
action validator. That module reads `system.url-prefix` at import time, which
asserts because `ready()` runs during `django.setup()`, before
`bind_cache_to_option_store()`.

Matches the Discord and Slack renderers.

Co-authored-by: Cursor <cursoragent@cursor.com>
@hobzcalvin
hobzcalvin force-pushed the gv/add_msteams_issue_renderer branch from 91bce24 to c51c820 Compare September 23, 2026 18:01
@hobzcalvin
hobzcalvin merged commit e5ba464 into master Sep 23, 2026
67 checks passed
@hobzcalvin
hobzcalvin deleted the gv/add_msteams_issue_renderer branch September 23, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants