Skip to content

fix(datasets): warn about affected charts and dashboards on bulk delete - #43967

Open
msyavuz wants to merge 3 commits into
apache:masterfrom
msyavuz:msyavuz/fix/dataset-bulk-delete-warning
Open

fix(datasets): warn about affected charts and dashboards on bulk delete#43967
msyavuz wants to merge 3 commits into
apache:masterfrom
msyavuz:msyavuz/fix/dataset-bulk-delete-warning

Conversation

@msyavuz

@msyavuz msyavuz commented Sep 7, 2026

Copy link
Copy Markdown
Member

SUMMARY

Deleting a single dataset names the charts and dashboards that depend on it before asking for confirmation. Bulk delete showed only a generic "type DELETE to confirm" dialog, so the one flow with the largest blast radius had no warning at all.

This adds GET /api/v1/dataset/related_objects/?q=!(ids), returning the union of dependent charts and dashboards across the requested datasets, de-duplicated and filtered to what the current user can access (ids are scoped through the DAO base filter; 404 when none are visible). The bulk confirm calls it once when the action fires, keeps the Delete button disabled until the lookup resolves, and renders the same Affected Charts / Affected Dashboards lists the single-row modal uses. A failed lookup is stated explicitly so "unknown" is never read as "nothing depends on these". Semantic views are skipped since they delete through their own endpoint.

ConfirmStatusChange gains a disablePrimaryButton passthrough to its DeleteModal. The affected-objects list markup is extracted into a component shared by both delete paths.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before: bulk dialog reads only "Are you sure you want to delete the selected datasets? Type DELETE to confirm."
After: same dialog also shows "The selected datasets are linked to N charts that appear on M dashboards" followed by the named charts and dashboards, or "No charts or dashboards depend on the selected datasets."

TESTING INSTRUCTIONS

  1. Have one dataset with a chart on a dashboard and one dataset with no dependents.
  2. Datasets list, Bulk select, tick both, click Delete.
  3. The dialog names the affected chart and dashboard and counts them; Delete stays disabled until the lookup finishes.
  4. Select only the clean dataset: the dialog says nothing depends on it.
  5. Block /api/v1/dataset/related_objects/ (devtools) and repeat: the dialog says the check could not be done; Delete still works after typing DELETE.

Automated: pytest tests/integration_tests/datasets/api_tests.py -k related_objects and npm run test -- ConfirmStatusChange DatasetList.integration.

ADDITIONAL INFORMATION

  • Has associated issue: No
  • Required feature flags: None
  • Changes UI
  • Includes DB Migration: No
  • Introduces new feature or API: GET /api/v1/dataset/related_objects/
  • Removes existing feature or API: No

Deleting a single dataset names the charts and dashboards that depend on
it before asking for confirmation, but bulk delete showed only a generic
"type DELETE to confirm" dialog. Bulk delete is where the blast radius is
largest and it was the one path with no warning.

Add GET /api/v1/dataset/related_objects/?q=!(ids) which returns the union
of dependents across the requested datasets, de-duplicated and filtered
to what the current user can access. The bulk confirm calls it once when
the action fires, keeps the Delete button disabled until the lookup
resolves, renders the same Affected Charts / Affected Dashboards lists
the single-row modal uses, and says explicitly when the lookup failed so
"unknown" is never mistaken for "nothing depends on these".

ConfirmStatusChange gains a disablePrimaryButton passthrough so callers
can hold the confirm while they load what the user needs to see.
@bito-code-review

bito-code-review Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #f71a16

Actionable Suggestions - 0
Additional Suggestions - 2
  • superset/datasets/api.py - 1
    • Partial visibility results · Line 1214-1216
      `DatasetDAO.find_by_ids` applies the `DatasourceFilter` base filter, so a mixed request like `[visible_id, invisible_id]` returns only the visible dataset and this endpoint returns 200 with partial data. This is inconsistent with `bulk_delete`, which 404s on any missing id. If partial results are intended, document it and add a test; otherwise return 404 when any requested id is invisible.
  • superset/datasets/schemas.py - 1
    • Duplicate schema definition · Line 49-53
      `get_related_objects_ids_schema` is byte-for-byte identical to `get_delete_ids_schema` and `get_export_ids_schema` already defined in this file. Reuse one of them (e.g. `get_related_objects_ids_schema = get_delete_ids_schema`) to avoid three copies of the same schema and the risk that future edits diverge.
Review Details
  • Files reviewed - 11 · Commit Range: da00dc1..da00dc1
    • superset-frontend/packages/superset-ui-core/src/components/ConfirmStatusChange/ConfirmStatusChange.test.tsx
    • superset-frontend/packages/superset-ui-core/src/components/ConfirmStatusChange/index.tsx
    • superset-frontend/packages/superset-ui-core/src/components/ConfirmStatusChange/types.ts
    • superset-frontend/src/pages/DatasetList/DatasetList.integration.test.tsx
    • superset-frontend/src/pages/DatasetList/DatasetList.testHelpers.tsx
    • superset-frontend/src/pages/DatasetList/index.tsx
    • superset/constants.py
    • superset/daos/dataset.py
    • superset/datasets/api.py
    • superset/datasets/schemas.py
    • tests/integration_tests/datasets/api_tests.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 an incremental AI Review.

  • /review full - 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 evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@github-actions github-actions Bot added api Related to the REST API packages labels Sep 7, 2026
@github-actions github-actions Bot added the doc Namespace | Anything related to documentation label Sep 7, 2026
@netlify

netlify Bot commented Sep 7, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit ce561a7
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a9ed2eacad1900009074564
😎 Deploy Preview https://deploy-preview-43967--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 Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.28571% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.81%. Comparing base (7d09490) to head (973ecf3).
⚠️ Report is 10 commits behind head on master.

Files with missing lines Patch % Lines
superset-frontend/src/pages/DatasetList/index.tsx 95.55% 2 Missing ⚠️
superset/daos/dataset.py 66.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #43967   +/-   ##
=======================================
  Coverage   79.81%   79.81%           
=======================================
  Files        2914     2914           
  Lines      170458   170513   +55     
  Branches    39514    39528   +14     
=======================================
+ Hits       136044   136098   +54     
- Misses      31892    31893    +1     
  Partials     2522     2522           
Flag Coverage Δ
hive 37.64% <56.52%> (+<0.01%) ⬆️
javascript 75.35% <95.74%> (+<0.01%) ⬆️
mysql 57.34% <91.30%> (+0.01%) ⬆️
postgres 57.37% <91.30%> (+0.01%) ⬆️
presto 39.52% <56.52%> (+<0.01%) ⬆️
python 84.20% <91.30%> (+0.01%) ⬆️
sqlite 57.08% <91.30%> (+0.01%) ⬆️
unit 75.19% <56.52%> (-0.01%) ⬇️

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.

@bito-code-review

bito-code-review Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #84bd30

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: da00dc1..973ecf3
    • superset-frontend/src/pages/DatasetList/DatasetList.listview.test.tsx
  • Files skipped - 1
    • docs/static/resources/openapi.json - Reason: Filter setting
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

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

  • /review - Manually triggers an incremental AI Review.

  • /review full - 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 evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

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 doc Namespace | Anything related to documentation packages size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant