Skip to content

feat(reports): add native Microsoft Teams alert notifications - #45508

Merged
rusackas merged 45 commits into
apache:masterfrom
KristiDodaj:feature/teams-alerts
Nov 25, 2026
Merged

rusackas merged 45 commits into
apache:masterfrom
KristiDodaj:feature/teams-alerts

Conversation

@KristiDodaj

@KristiDodaj KristiDodaj commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

SUMMARY

Add Microsoft Teams as an optional notification destination for attachment-free alerts.

Administrators configure a single tenant, bot credentials, and approved standard channels. Users select a destination in the alert editor. Each notification creates a new channel post containing the alert name, optional description, and optional link to Superset.

The integration is available once ALERT_REPORTS_TEAMS is configured and the optional teams extra is installed. Authenticated installation callbacks maintain routing information. Removing the bot disables delivery until it is reinstalled.

Includes recipient validation, bounded retries, delivery error handling, setup documentation, and automated tests.

Initial scope excludes scheduled reports, private/shared channels, direct messages, file attachments, and interactive cards.

Related discussion: #45307

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before: Microsoft Teams is not available as a notification destination.

After: Users can select an administrator-approved Teams destination and receive alert cards in its channel.

Teams destination selection

Selecting an approved Microsoft Teams destination in the Superset alert editor

Delivered alerts, including successful delivery after bot reinstallation

Separate alert posts delivered by Superset to the test Microsoft Teams channel

Credentials are configured server-side, not through an administrator UI.

TESTING INSTRUCTIONS

  1. Install the teams extra on the web server and Celery worker.
  2. Enable ALERT_REPORTS and set the tenant, bot credentials, and approved destinations in ALERT_REPORTS_TEAMS.
  3. Apply the migration and configure the bot's HTTPS callback.
  4. Install the bot in an approved team.
  5. Create an alert with attachments disabled and select a Teams destination.
  6. Trigger two deliveries and confirm they appear as separate channel posts.
  7. Remove the bot and confirm delivery fails clearly. Reinstall it and confirm delivery recovers.

Validation:

  • 310 focused backend tests passed.
  • 175 frontend tests across five suites passed using a temporary local module mapping to resolve the shared dependency checkout.
  • Alembic reports one migration head. PostgreSQL migration upgrade, repeated upgrade, downgrade, and re-upgrade passed.
  • Changed-file formatting, linting, Mypy, feature-flag documentation sync, and workflow security checks passed. Custom Pylint passed in the Superset container.
  • The Netlify documentation preview deployed successfully.

Browser creation/editing coverage is provided by an opt-in test against a locally configured Superset instance. It skips when Teams is unconfigured. The local browser flow passed during validation.

Live delivery was tested separately using a Microsoft test tenant: Celery delivery to a non-default standard channel, separate root posts, delivery after web and worker restarts, and fresh removal/reinstallation callbacks with delivery failure and recovery.

ADDITIONAL INFORMATION

  • Has associated issue:
    Related discussion: Native Microsoft Teams notifications without Power Automate #45307
  • Required feature flags: ALERT_REPORTS
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@github-actions github-actions Bot added risk:db-migration PRs that require a DB migration api Related to the REST API doc Namespace | Anything related to documentation github_actions Pull requests that update GitHub Actions code labels Oct 20, 2026
@netlify

netlify Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit cc63540
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6af253b5c983ad67403c1596
😎 Deploy Preview https://deploy-preview-45508--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.66255% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.02%. Comparing base (de11628) to head (1df57dd).
⚠️ Report is 35 commits behind head on master.

Files with missing lines Patch % Lines
superset/integrations/teams/adapter.py 93.81% 10 Missing and 7 partials ⚠️
superset/integrations/teams/store.py 89.83% 4 Missing and 2 partials ⚠️
superset/views/base.py 77.77% 1 Missing and 1 partial ⚠️
...-frontend/src/features/alerts/AlertReportModal.tsx 98.24% 1 Missing ⚠️
superset/integrations/teams/api.py 98.73% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #45508      +/-   ##
==========================================
+ Coverage   85.97%   86.02%   +0.04%     
==========================================
  Files        3128     3139      +11     
  Lines      217773   218537     +764     
  Branches    51629    51772     +143     
==========================================
+ Hits       187230   187996     +766     
+ Misses      27119    27110       -9     
- Partials     3424     3431       +7     
Flag Coverage Δ
hive 33.74% <21.02%> (-0.08%) ⬇️
javascript 82.83% <99.22%> (+0.04%) ⬆️
mysql 51.50% <28.38%> (-0.13%) ⬇️
postgres 51.52% <28.38%> (-0.13%) ⬇️
presto 35.43% <21.02%> (-0.09%) ⬇️
python 88.52% <96.17%> (+0.04%) ⬆️
sqlite 51.20% <28.38%> (-0.13%) ⬇️
unit 84.04% <96.02%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Oct 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Possible DB migration conflict

@KristiDodaj the base branch master picked up a new database migration under superset/migrations/ after this PR was opened, and this PR adds or modifies migration files too. Alembic migrations form a single linear chain, so if both branch off the same parent revision, merging this PR as-is could leave the migration history with two heads instead of one, which makes superset db upgrade fail with Multiple head revisions are present.

To check and, if needed, fix this:

  1. Rebase this branch onto the latest master.
  2. Run superset db heads. If it lists more than one revision, you have a conflict.
  3. In your new migration's script, update down_revision (and the Revises comment) to point at the other head instead, so the chain has a single head again.

See Merging DB Migrations in the contributing guide for a worked example.

@github-actions github-actions Bot added i18n Namespace | Anything related to localization requires:rebase Requires rebasing on top of current master and removed requires:rebase Requires rebasing on top of current master labels Oct 22, 2026
@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Oct 23, 2026
@KristiDodaj
KristiDodaj marked this pull request as ready for review October 23, 2026 14:48
@github-actions github-actions Bot added requires:rebase Requires rebasing on top of current master and removed requires:rebase Requires rebasing on top of current master labels Nov 14, 2026
@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Nov 15, 2026

@rusackas rusackas 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.

Heya @KristiDodaj, appreciate you sticking with this one, and thanks again for working through my last round of questions! Couple of things before this goes in, though.

I don't think we need the ALERT_REPORT_TEAMS feature flag. We try not to add new flags where we can avoid it, since each one doubles the paths we have to test, and Slack has no enable flag at all: it's on when SLACK_API_TOKEN is set. Teams is already off unless ALERT_REPORTS_TEAMS is populated and the teams extra is installed, which configured_teams() checks anyway. Mind dropping the flag and gating on that config the same way Slack does?

Also, the events callback is public and runs SDK auth for every request inside one per-process with lock: in adapter.py, so a pile of junk requests could stack up behind it and tie up web workers. A bounded lock.acquire(timeout=...) that returns a 503 when it can't get the lock seems like it'd be enough.

@KristiDodaj KristiDodaj left a comment

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.

Hey @rusackas, thanks for the callouts! Dropped feature flag as mentioned. The callback now returns 503 if it can’t acquire the lock within one second. Added tests for lock contention and recovery. Ready for another look :)

@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Nov 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Possible DB migration conflict

@KristiDodaj the base branch master picked up a new database migration under superset/migrations/ after this PR was opened, and this PR adds or modifies migration files too. Alembic migrations form a single linear chain, so if both branch off the same parent revision, merging this PR as-is could leave the migration history with two heads instead of one, which makes superset db upgrade fail with Multiple head revisions are present.

To check and, if needed, fix this:

  1. Rebase this branch onto the latest master.
  2. Run superset db heads. If it lists more than one revision, you have a conflict.
  3. In your new migration's script, update down_revision (and the Revises comment) to point at the other head instead, so the chain has a single head again.

See Merging DB Migrations in the contributing guide for a worked example.

@aminghadersohi aminghadersohi 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.

Unauthenticated requests can still hold the callback lock; details inline.

Nit: The PR description still names the removed ALERT_REPORT_TEAMS flag (summary, testing step 2, required flags); Teams turns on once ALERT_REPORTS_TEAMS is set and the teams extra is installed.

Comment thread superset/integrations/teams/adapter.py Resolved
Comment thread superset/integrations/teams/adapter.py Resolved
@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Nov 20, 2026
@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Nov 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Possible DB migration conflict

@KristiDodaj the base branch master picked up a new database migration under superset/migrations/ after this PR was opened, and this PR adds or modifies migration files too. Alembic migrations form a single linear chain, so if both branch off the same parent revision, merging this PR as-is could leave the migration history with two heads instead of one, which makes superset db upgrade fail with Multiple head revisions are present.

To check and, if needed, fix this:

  1. Rebase this branch onto the latest master.
  2. Run superset db heads. If it lists more than one revision, you have a conflict.
  3. In your new migration's script, update down_revision (and the Revises comment) to point at the other head instead, so the chain has a single head again.

See Merging DB Migrations in the contributing guide for a worked example.

@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Nov 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Possible DB migration conflict

@KristiDodaj the base branch master picked up a new database migration under superset/migrations/ after this PR was opened, and this PR adds or modifies migration files too. Alembic migrations form a single linear chain, so if both branch off the same parent revision, merging this PR as-is could leave the migration history with two heads instead of one, which makes superset db upgrade fail with Multiple head revisions are present.

To check and, if needed, fix this:

  1. Rebase this branch onto the latest master.
  2. Run superset db heads. If it lists more than one revision, you have a conflict.
  3. In your new migration's script, update down_revision (and the Revises comment) to point at the other head instead, so the chain has a single head again.

See Merging DB Migrations in the contributing guide for a worked example.

@KristiDodaj

Copy link
Copy Markdown
Contributor Author

@rusackas should be good for another look whenever you have a chance 🙏

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Possible DB migration conflict

@KristiDodaj the base branch master picked up a new database migration under superset/migrations/ after this PR was opened, and this PR adds or modifies migration files too. Alembic migrations form a single linear chain, so if both branch off the same parent revision, merging this PR as-is could leave the migration history with two heads instead of one, which makes superset db upgrade fail with Multiple head revisions are present.

To check and, if needed, fix this:

  1. Rebase this branch onto the latest master.
  2. Run superset db heads. If it lists more than one revision, you have a conflict.
  3. In your new migration's script, update down_revision (and the Revises comment) to point at the other head instead, so the chain has a single head again.

See Merging DB Migrations in the contributing guide for a worked example.

@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Nov 24, 2026
@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Nov 24, 2026

@rusackas rusackas 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.

Heya @KristiDodaj, thanks for turning those around so quickly! Both look good, and the bounded lock covers what I was worried about, especially with the issuer check from @aminghadersohi's thread sitting ahead of it. LGTM!

The trino testcontainers failure looks like a container connection flake during setup, so it isn't on you. I've kicked off a rerun. The migration-conflict bot seems to be crying wolf too, since a7d29bc4e681 is still the head on master.

@rusackas rusackas added the merge-if-green If approved and tests are green, please go ahead and merge it for me label Nov 25, 2026
@rusackas
rusackas merged commit c73c917 into apache:master Nov 25, 2026
134 of 135 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Related to the REST API dependencies:python doc Namespace | Anything related to documentation github_actions Pull requests that update GitHub Actions code i18n Namespace | Anything related to localization merge-if-green If approved and tests are green, please go ahead and merge it for me risk:db-migration PRs that require a DB migration size/XXL utsc2026 UTSC 2026 course contributions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants