Skip to content

feat(reports): add retry on failure support for reports - #42481

Merged
alexandrusoare merged 25 commits into
masterfrom
alexandrusoare/feat/report-failure-retry
Aug 4, 2026
Merged

alexandrusoare merged 25 commits into
masterfrom
alexandrusoare/feat/report-failure-retry

Conversation

@alexandrusoare

@alexandrusoare alexandrusoare commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

SUMMARY

Adds the ability to automatically retry report delivery when it fails. Previously, a failed report would immediately transition to an error state. Now, users can configure retry behavior per report:

  • Enable Retries — automatically retry delivery on failure
  • Max Retry Attempts — how many times to retry before giving up (1–10)
  • Send Failed Reports — optionally deliver the report to recipients even after all retries fail
  • Failure Notifications — choose whether to notify owners and/or recipients on each failed attempt

The retry configuration is available in both the Alerts & Reports page modal and the dashboard/chart email report modal, under a new "Error handling" section.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

image

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • 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 the risk:db-migration PRs that require a DB migration label Jul 27, 2026
@netlify

netlify Bot commented Jul 27, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 0edd477
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a71d3aa4f3dcd00084020cd
😎 Deploy Preview https://deploy-preview-42481--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 Jul 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 64.01869% with 77 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.58%. Comparing base (29098af) to head (a475510).

Files with missing lines Patch % Lines
superset/commands/report/execute.py 67.81% 23 Missing and 5 partials ⚠️
superset/reports/notifications/email.py 10.00% 14 Missing and 4 partials ⚠️
superset/commands/report/update.py 40.00% 4 Missing and 2 partials ⚠️
superset/tasks/scheduler.py 33.33% 3 Missing and 3 partials ⚠️
...-frontend/src/features/alerts/AlertReportModal.tsx 72.22% 5 Missing ⚠️
...rontend/src/features/reports/ReportModal/index.tsx 75.00% 5 Missing ⚠️
superset/reports/notifications/slack_mixin.py 16.66% 5 Missing ⚠️
superset/reports/schemas.py 75.00% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #42481      +/-   ##
==========================================
- Coverage   65.59%   65.58%   -0.01%     
==========================================
  Files        2819     2819              
  Lines      160166   160372     +206     
  Branches    36569    36617      +48     
==========================================
+ Hits       105059   105182     +123     
- Misses      53059    53126      +67     
- Partials     2048     2064      +16     
Flag Coverage Δ
hive 38.07% <25.62%> (-0.03%) ⬇️
javascript 71.75% <81.48%> (-0.01%) ⬇️
mysql 57.91% <58.12%> (-0.01%) ⬇️
postgres 57.96% <58.12%> (-0.01%) ⬇️
presto 39.99% <25.62%> (-0.04%) ⬇️
python 59.34% <58.12%> (-0.01%) ⬇️
sqlite 57.59% <58.12%> (-0.01%) ⬇️
unit 100.00% <ø> (ø)

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 api Related to the REST API label Jul 28, 2026
@alexandrusoare
alexandrusoare marked this pull request as ready for review July 29, 2026 13:05
@dosubot dosubot Bot added alert-reports Namespace | Anything related to the Alert & Reports feature change:backend Requires changing the backend change:frontend Requires changing the frontend labels Jul 29, 2026

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

nice feature, the config surface and schema validation look clean and the notification changes stay backwards compatible. left a few inline notes, the main one is the retry window check which i think keeps it from ever hitting max attempts. worth a run with a tz-aware scheduled_dttm before merge since the tests use naive datetimes and don't really hit that path.

Comment thread superset/commands/report/execute.py Resolved
Comment thread superset/commands/report/execute.py Resolved
)
self._send(notification_content, recipients)

def send_final_failure_report(self, error_message: str) -> None:

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.

quick question on intent here. the description says send_failed_reports will "deliver the report to recipients even after all retries fail", but this builds a NotificationContent with just text=error_message and no screenshots/csv/embedded data, so recipients get a failure notice with the error rather than the actual report. if that's what you meant then all good and maybe just reword the option, but if the idea was to send the last-attempt report itself then this doesn't quite do that yet.

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.

This is intentional, send_failed_reports means "notify recipients about the failure after retries are exhausted," not "deliver a broken report." Recipients get an error email with the failure details and a link to the chart/dashboard.

Comment thread superset/commands/report/execute.py Resolved
Comment thread superset/commands/report/execute.py Resolved
Comment thread superset/commands/report/execute.py Resolved

@bito-code-review bito-code-review 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.

Code Review Agent Run #165e40

Actionable Suggestions - 3
  • superset-frontend/src/pages/AlertReportList/index.tsx - 1
    • Inconsistent filter option coverage · Line 81-81
  • superset-frontend/src/features/alerts/components/AlertStatusIcon.tsx - 1
  • superset-frontend/src/features/alerts/AlertReportModal.tsx - 1
Additional Suggestions - 3
  • superset/commands/report/update.py - 1
    • Missing test for send_failed_reports validation · Line 180-196
      The new cross-field validation at lines 183–193 has no test coverage. `tests/unit_tests/commands/report/update_test.py` contains 20+ tests for `UpdateReportScheduleCommand.validate()` but none verifies that `send_failed_reports=True` without `retry_on_failure` is rejected. Per BITO.md rule [11730], new functionality requires comprehensive unit tests covering both success and error paths.
  • tests/unit_tests/reports/schemas_test.py - 1
    • Missing PUT schema cross-field test · Line 507-513
      The PUT schema lacks a test for the `send_failed_reports`/`retry_on_failure` cross-field constraint. While `ReportSchedulePostSchema` has `validate_retry_config` (schemas.py:343) enforcing that `send_failed_reports=True` requires `retry_on_failure=True`, `ReportSchedulePutSchema` has no such validator (only `@validates("custom_width")` at line 517). Without a test, a future code change adding a validator to PUT would have no regression guard.
  • superset/reports/notifications/email.py - 1
    • Feature scope clarification needed · Line 164-167
      The refactoring removes screenshot embedding from retry error notification emails. This is an intentional behavior change (retry emails now exclude inline screenshots), but it may surprise users who rely on visual context during retry attempts. Consider: (1) documenting this limitation in the retry feature documentation, or (2) adding a comment in the code explaining why screenshots are omitted for retry templates (e.g., to reduce email size/complexity during high-frequency retry operations).
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • superset/daos/report.py - 1
  • superset/reports/types.py - 1
Review Details
  • Files reviewed - 15 · Commit Range: de0bea3..c1601b3
    • superset-frontend/src/features/alerts/AlertReportModal.tsx
    • superset-frontend/src/features/alerts/components/AlertStatusIcon.tsx
    • superset-frontend/src/features/alerts/types.ts
    • superset-frontend/src/features/reports/ReportModal/index.tsx
    • superset/commands/report/execute.py
    • superset/commands/report/update.py
    • superset/config.py
    • superset/daos/report.py
    • superset/reports/notifications/email.py
    • superset/reports/types.py
    • tests/integration_tests/reports/commands_tests.py
    • tests/unit_tests/reports/schemas_test.py
    • superset-frontend/src/pages/AlertReportList/index.tsx
    • superset/migrations/versions/2026-07-28_00-00_f3a8c1d2e9b7_add_report_retry_state_columns.py
    • superset/reports/api.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

Comment thread superset/commands/report/update.py Resolved
Comment thread superset/commands/report/execute.py Resolved
Comment thread superset/commands/report/execute.py Resolved
Comment thread superset/reports/schemas.py Resolved
Comment thread superset/reports/models.py Resolved

@bito-code-review bito-code-review 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.

Code Review Agent Run #ce0668

Actionable Suggestions - 1
  • superset-frontend/src/features/alerts/components/AlertStatusIcon.tsx - 1
Additional Suggestions - 2
  • superset/reports/schemas.py - 1
    • Missing unit test for new validation · Line 357-363
      The new `retry_on_failure` validation for alerts (lines 357-363) lacks test coverage. Add a test that verifies `ReportSchedulePostSchema` raises `ValidationError` when loading data with `type: "Alert"` and `retry_on_failure: true`.
  • superset-frontend/src/features/alerts/components/AlertStatusIcon.test.tsx - 1
    • Incomplete icon type verification · Line 77-82
      The merged test verifies the icon exists via `getByRole('img')` but no longer validates the specific icon type. All 7 other icon tests in this file use `data-icon` attribute queries (e.g., `container.querySelector('[data-icon="check"]')`). Consider restoring the `data-icon="running"` assertion to verify `Icons.Running` is rendered, ensuring the test actually validates what the removed test claimed to test.
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • superset/reports/schemas.py - 1
  • superset-frontend/src/features/alerts/AlertReportModal.test.tsx - 1
  • superset/commands/report/execute.py - 1
Review Details
  • Files reviewed - 13 · Commit Range: c1601b3..7199b4b
    • superset-frontend/src/features/alerts/AlertReportModal.test.tsx
    • superset-frontend/src/features/alerts/components/AlertStatusIcon.test.tsx
    • superset-frontend/src/features/alerts/components/AlertStatusIcon.tsx
    • superset/commands/report/execute.py
    • superset/migrations/versions/2026-07-28_00-00_f3a8c1d2e9b7_add_report_retry_state_columns.py
    • superset/reports/notifications/slack_mixin.py
    • superset/reports/schemas.py
    • tests/integration_tests/reports/commands_tests.py
    • superset-frontend/src/features/alerts/types.ts
    • superset/commands/report/update.py
    • superset/reports/api.py
    • tests/integration_tests/reports/api_tests.py
    • tests/unit_tests/commands/report/update_test.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

Comment on lines +97 to +101
case AlertState.Retrying:
lastStateConfig.icon = Icons.Running;
lastStateConfig.label = t('Report retrying');
lastStateConfig.status = AlertState.Retrying;
break;

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.

Inconsistent conditional handling

Removing the isReportEnabled conditional from the Retrying case creates inconsistent behavior compared to all other alert states (Success, Working, Error, Noop). When isReportEnabled=false (regular alerts), users will now see 'Report retrying' which is semantically incorrect. The label should remain conditional like the other states in this switch.

Code Review Run #ce0668


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

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

LGTM !

@alexandrusoare alexandrusoare changed the title feat(reports): add retry on failure support for alerts and reports feat(reports): add retry on failure support for reports Jul 31, 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.

LGTM2.... but there are some nits that can be followed up now OR later.

  • _get_subject() has a "Report Failed - All Retries Exhausted" branch for the final-failure email, but _get_content() doesn't special-case that path, so the body falls through to the plain generic error template with no retry context. Subject promises more than the body delivers. Bito caught this one and it's still unaddressed.
  • AlertStatusIcon's isRunningIcon still only checks AlertState.Working, so a retrying report gets the running icon at normal size instead of the enlarged "actively working" treatment. Cosmetic only.
  • The new UpdateReportScheduleCommand.validate() cross-field checks (the PUT fix above) have zero test coverage — update_test.py only adds default mock attrs, nothing exercises the actual rejection path through the command. I confirmed the logic is correct by reading it, but it's not proven by a test.
  • Bito flagged duplicate test-setup blocks in the new commands_tests.py additions (real, in this PR's own new code)

@bito-code-review

bito-code-review Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #cab53d

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset/reports/notifications/email.py - 1
    • Missing test coverage for new template · Line 203-248
      No unit test covers the new `_final_failure_template` method, leaving the unreachable-branch defect undetected. Add a test analogous to `test_error_template_sanitizes_html` but using `retry_max_attempts=3` without `retry_attempt`.
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • superset/reports/notifications/email.py - 1
Review Details
  • Files reviewed - 5 · Commit Range: 7199b4b..a475510
    • superset-frontend/src/features/alerts/components/AlertStatusIcon.tsx
    • superset/reports/notifications/email.py
    • tests/unit_tests/commands/report/update_test.py
    • superset-frontend/src/features/alerts/types.ts
    • superset-frontend/src/utils/softDeleteCopy.ts
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@alexandrusoare
alexandrusoare merged commit 3dde95d into master Aug 4, 2026
76 checks passed
@alexandrusoare
alexandrusoare deleted the alexandrusoare/feat/report-failure-retry branch August 4, 2026 15:04
mikebridge pushed a commit to mikebridge/superset that referenced this pull request Aug 5, 2026
The rebase onto current master re-pointed down_revision from
e7d93a524ff6 to f3a8c1d2e9b7 — master gained the reports-retry migration
(apache#42481) claiming the same parent, which left two alembic heads — but
the docstring header still named the old ancestor.

Alembic reads the variable, not the docstring, so the graph was correct
and CI passed. The header was simply lying to the next person to read
it, which is exactly when a migration file gets read: while diagnosing
a broken chain.

Caught by codeant and bito independently.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

alert-reports Namespace | Anything related to the Alert & Reports feature api Related to the REST API change:backend Requires changing the backend change:frontend Requires changing the frontend risk:db-migration PRs that require a DB migration size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants