Skip to content

feat(dataset): warn about dependent charts and dashboards before purging an archived dataset - #43724

Merged
aminghadersohi merged 2 commits into
apache:masterfrom
mikebridge:sc-118271-purge-dependency-warning
Sep 2, 2026
Merged

aminghadersohi merged 2 commits into
apache:masterfrom
mikebridge:sc-118271-purge-dependency-warning

Conversation

@mikebridge

Copy link
Copy Markdown
Member

SUMMARY

With SOFT_DELETE enabled, archiving a dataset warns about the charts and dashboards that depend on it — but permanently deleting that same dataset from Settings → Recently archived showed only a generic type-DELETE confirmation. The irreversible action carried less warning than the recoverable one, and confirming it silently orphaned every dependent chart (the non-cascade itself is intended behaviour: ForcePurgeCommand preserves independently owned entities).

This PR makes the permanent-delete confirmation for an archived dataset show the full dependency impact before the user can confirm:

  • A new protected endpoint, GET /api/v1/dataset/<uuid>/purge-impact, returns the authoritative dependent-object counts (live and recoverable-archived charts and dashboards), the names/links the caller may see, an aggregate restricted_count for objects the caller cannot access (no names, UUIDs, or links leak), and a versioned SHA-256 impact_token fingerprinting the exact affected set.
  • The modal names and links the affected charts and dashboards (archived ones badged), shows explicit zero-states, keeps the type-DELETE gate, and disables Delete until the impact is known — if impact cannot be determined, permanent deletion is unavailable (Cancel/Retry only, fail closed).
  • The purge request must carry the confirmed impact_token. The purge re-collects impact at submit time and again under the dataset row lock inside the cascade; if the affected set changed since the user read the warning, the request mutates nothing and returns 409 with the refreshed impact, and the modal asks for a renewed confirmation (same TOCTOU shape as the version-restore guard). A post-write-ahead mismatch finalises its force-purge audit row as failed with zero removals.
  • Chart and dashboard purges keep the existing generic confirmation — the impact preview is dataset-only, where the orphaning harm is.
  • A reversible migration (8f31c5d726ab) adds two small indexes used by the impact queries: slices(datasource_type, datasource_id) and dashboard_slices(slice_id).

Design notes: dependents are deliberately not globally serialised — the guarantee is two submit-time rechecks, not an immutable set after the final snapshot (documented in the spec; a 7-lens review's serialisation finding was evaluated and rejected by design). Inaccessible dependents are counted but never named.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Archived dataset purge_demo with two live dependent charts.

Before — no mention of the two charts this purge will orphan:

Before: bare type-DELETE confirmation

After — authoritative counts, named and linked charts, explicit zero-state for dashboards, Delete gated on the typed confirmation:

After: impact-aware confirmation, light

After: impact-aware confirmation, dark

TESTING INSTRUCTIONS

  1. Enable SOFT_DELETE. Create a dataset and build two charts on it.
  2. Archive the dataset from the Datasets list, then open Settings → Recently archived, set Type to Dataset, and click Delete permanently on the row.
  3. The modal lists "2 Charts" with links (and "0 Dashboards" explicitly); Delete stays disabled until the impact has loaded and DELETE is typed.
  4. Stale-impact path: with the modal open, create another chart on the dataset in a second tab, then confirm — the purge is refused, nothing is deleted, and the modal shows the refreshed impact and asks to confirm again.
  5. Failure path: block /purge-impact in devtools and open the modal — an error state with Retry/Cancel appears and Delete cannot be reached.
  6. Confirm with a matching token: the dataset is purged; the charts remain (intended) and the force-purge audit row records the dangling chart UUIDs from the confirmed snapshot.
  7. Chart/dashboard rows in Recently archived keep the previous generic confirmation.

Automated: test_purge_impact.py (canonical ordering, fingerprint stability, dashboard dedup, archived inclusion), soft_delete_tests.py (authorization incl. a caller with a restricted dependent; contract fields), force_purge_tests.py / purge_tests.py (matching/mismatched/same-count tokens, locked recheck, failed audit finalisation, token-free scheduled retention), ArchivedList.test.tsx (27 tests: loading, counts, badges, restricted aggregates, bounded lists, 409 renewal, error/retry, unchanged chart/dashboard flows), DeleteModal.test.tsx (external disable/loading/reset). Migration verified by upgrade→downgrade→re-upgrade on a fresh metadata DB, re-run after re-chaining onto 39097d124752.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags: SOFT_DELETE
  • 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: two CREATE INDEX statements on slices and dashboard_slices; seconds on typical metadata volumes, no table rewrites, no downtime expected
  • Introduces new feature or API
  • Removes existing feature or API

This description was drafted with Claude (AI) assistance on behalf of @mikebridge.

🤖 Generated with Claude Code

@bito-code-review

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

Copy link
Copy Markdown
Contributor

Code Review Agent Run #09ae2e

Actionable Suggestions - 0
Additional Suggestions - 8
  • superset-frontend/src/pages/ArchivedList/index.tsx - 3
    • Missing in-flight guard · Line 304-307
      `loadDatasetPurgeImpact` fires without `beginAction`, so `busy` stays false and the row's restore/purge buttons remain enabled during the preflight (unlike `handlePurge`/`confirmDatasetPurge`). A user can click Restore while the impact modal is loading, restoring the item, then confirm a purge that hits a 404. Add the `beginAction`/`endAction` guard to disable the row.
    • Stale error reopens modal · Line 378-385
      In `confirmDatasetPurge` the generation staleness check runs only before `await getClientErrorObject(error)`. If the user closes the modal (incrementing `impactRequestGeneration` via `closeDatasetPurgeModal`) while the error is being parsed, the stale response still calls `setDatasetPurgeModal` and reopens the modal. `loadDatasetPurgeImpact` re-checks after the await; do the same here.
    • Stale list on dismiss mid-submit · Line 583-590
      `DeleteModal.hide()` calls `onHide()` unconditionally, so Cancel during `submitting` closes the modal and bumps `impactRequestGeneration`. The success path (line 371) then early-returns before `refreshData()` (line 377), leaving the purged row in the list; a re-attempt surfaces a misleading "Failed to delete" 404. Consider refreshing the list even when the generation changed.
  • superset/commands/deletion_retention/purge_impact.py - 1
    • Impact token omits archived state · Line 64-67
      `_impact_token` hashes only `chart:{uuid}`/`dashboard:{uuid}`, yet `archived` is collected (lines 110, 119) and shown in the preview. If a dependent is restored (archived→active) between preview and purge, the token is unchanged, so `PurgeImpactChangedError` in `purge_cascade.py` won't fire and an active chart/dashboard the user never confirmed gets hard-deleted. Consider folding `archived` into the fingerprint.
  • superset/commands/deletion_retention/purge_cascade.py - 1
    • Duplicated chart extraction · Line 263-266
      This branch re-implements `policy.collect_dangling_chart_uuids` (which for datasets is exactly `[chart.uuid for chart in impact.charts]`, see `purge_policy.dangling_chart_uuids`). The confirmed path and the fallback path now compute the same value in two places; if the policy's extraction ever changes (e.g. filtering archived charts), the audit's `affected_referrers` would diverge depending on whether a token was passed. Consider a shared helper.
  • superset-frontend/packages/superset-ui-core/src/components/DeleteModal/index.tsx - 1
    • Duplicated disabled-gate logic · Line 87-87
      The primary-button disabled condition is now expressed twice in new code: in `onPressEnter`'s guard (line 87) and in the Modal `disablePrimaryButton` prop (lines 94-98). They must stay logically in sync; a future edit to one would let Enter confirm while the button is disabled (or vice versa), breaking the confirmation gate. Consider computing a single `primaryDisabled` value and reusing it in both places.
  • superset/commands/purge.py - 1
    • Redundant impact-token check · Line 101-106
      This pre-check duplicates the impact-token comparison already performed authoritatively in `cascade_hard_delete` (purge_cascade.py:251-254) under `with_for_update()`. It runs outside the lock, so it can be invalidated by a concurrent commit, and it adds an extra `collect_dataset_purge_impact` query on every purge. Consider removing it and keeping the locked check as the single source of truth.
  • superset/datasets/schemas.py - 1
    • Dead validation code · Line 292-299
      `DatasetPurgeImpactCollectionSchema` is only registered in `openapi_spec_component_schemas` (api.py:413-422) for docs; it is never `.load()`/`.validate()`d. `serialize_dataset_purge_impact` (purge.py:226) builds the payload directly, so `validate_totals` never executes. This gives false confidence that impact totals are checked at runtime. Remove the dead method or actually validate the serialized impact.
Review Details
  • Files reviewed - 22 · Commit Range: 058c37d..058c37d
    • docs/docs/using-superset/recently-archived.mdx
    • superset-frontend/packages/superset-ui-core/src/components/DeleteModal/DeleteModal.test.tsx
    • superset-frontend/packages/superset-ui-core/src/components/DeleteModal/index.tsx
    • superset-frontend/packages/superset-ui-core/src/components/DeleteModal/types.ts
    • superset-frontend/src/pages/ArchivedList/ArchivedDatasetPurgeModal.tsx
    • superset-frontend/src/pages/ArchivedList/ArchivedList.test.tsx
    • superset-frontend/src/pages/ArchivedList/index.tsx
    • superset-frontend/src/pages/ArchivedList/types.ts
    • superset/commands/deletion_retention/force_purge.py
    • superset/commands/deletion_retention/purge_cascade.py
    • superset/commands/deletion_retention/purge_impact.py
    • superset/commands/deletion_retention/purge_policy.py
    • superset/commands/purge.py
    • superset/datasets/api.py
    • superset/datasets/schemas.py
    • superset/migrations/versions/2026-08-25_18-00_8f31c5d726ab_index_dataset_dependency_lookups.py
    • superset/models/dashboard.py
    • superset/models/slice.py
    • superset/translations/messages.pot
    • tests/integration_tests/datasets/soft_delete_tests.py
    • tests/integration_tests/deletion_retention/force_purge_tests.py
    • tests/unit_tests/commands/deletion_retention/test_purge_impact.py
  • Files skipped - 1
    • UPDATING.md - Reason: Filter setting
  • 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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@github-actions github-actions Bot added i18n Namespace | Anything related to localization risk:db-migration PRs that require a DB migration api Related to the REST API doc Namespace | Anything related to documentation packages labels Aug 31, 2026
@netlify

netlify Bot commented Aug 31, 2026

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 058c37d
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a95af8df6ccde0008725653
😎 Deploy Preview https://deploy-preview-43724--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.

@bito-code-review

Copy link
Copy Markdown
Contributor

The pull request introduces a mechanism to prevent XSS or injection vulnerabilities by ensuring that exception text is properly handled and that destructive actions (like purging an archived dataset) are gated by a confirmed impact token. The changes include updates to the DeleteModal component to support loading states, independent button disabling, and a confirmationResetKey to re-arm the type-to-confirm gate when the impact payload changes. These updates ensure that users cannot proceed with destructive actions while dependencies are being calculated or if the impact has changed since the confirmation was initially displayed.

superset-frontend/packages/superset-ui-core/src/components/DeleteModal/index.tsx

const onPressEnter = () => {
    if (!disableChange && !disablePrimaryButton && !loading) {
      confirm();
    }
  };

@codecov

codecov Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.19856% with 41 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.25%. Comparing base (040b33c) to head (25781a0).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
superset-frontend/src/pages/ArchivedList/index.tsx 75.75% 16 Missing ⚠️
superset/commands/purge.py 82.97% 5 Missing and 3 partials ⚠️
superset/datasets/api.py 73.07% 7 Missing ⚠️
superset/datasets/schemas.py 78.26% 5 Missing ⚠️
...c/pages/ArchivedList/ArchivedDatasetPurgeModal.tsx 93.22% 4 Missing ⚠️
...erset-ui-core/src/components/DeleteModal/index.tsx 88.88% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master   #43724    +/-   ##
========================================
  Coverage   79.24%   79.25%            
========================================
  Files        2888     2890     +2     
  Lines      166446   166719   +273     
  Branches    38529    38605    +76     
========================================
+ Hits       131908   132140   +232     
- Misses      32045    32081    +36     
- Partials     2493     2498     +5     
Flag Coverage Δ
hive 37.90% <47.55%> (+0.01%) ⬆️
javascript 74.76% <84.32%> (+0.01%) ⬆️
mysql 57.62% <86.01%> (+0.04%) ⬆️
postgres 57.65% <86.01%> (+0.04%) ⬆️
presto 39.81% <47.55%> (+<0.01%) ⬆️
python 83.74% <86.01%> (+<0.01%) ⬆️
sqlite 57.34% <86.01%> (+0.04%) ⬆️
unit 73.97% <54.54%> (-0.04%) ⬇️

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.

… modal

Follow-ups from CI and the first review round on the purge warning:

- Add the missing OpenAPI operation block to GET /<uuid>/purge-impact; the
  generated spec had an operation without `responses`, failing
  test_open_api_spec on every integration lane.
- A purge that succeeds after the user closed the modal mid-request now
  still shows the success toast and refreshes the list; only the modal
  state remains gated on the request generation.
- Impact entries only render as links for server-issued application paths;
  absolute and scheme-relative URLs render as plain text.

Both behaviour fixes have tests that fail against the previous code.

Co-Authored-By: Claude Fable 5 <[email protected]>
@mikebridge

Copy link
Copy Markdown
Member Author

Follow-up pushed as 25781a0:

  • CI reds fixed: all three integration lanes failed on test_open_api_spec because GET /<uuid>/purge-impact lacked an OpenAPI operation block (an operation without responses fails spec validation). The contract is now documented, referencing DatasetPurgeImpactSchema.
  • CodeAnt (modal close during submit): valid — fixed; success toast and list refresh no longer depend on the modal still being open. Regression test included.
  • CodeAnt (post-lock chart inserts): by design — replied on the thread with the two-recheck contract rationale.
  • CodeQL (exception text as HTML): impact entries now only render links for server-issued application paths (/-prefixed, not scheme-relative); everything else renders as plain text, with a test.

Comment generated by Claude (AI) on behalf of @mikebridge.

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

Reviewed at 25781a051a. This is a genuinely careful piece of work on an irreversible operation — the two-phase confirm, the fail-closed preview, and the re-check inside the row lock are the right shape, and the access-redaction design is better than I expected going in. Comments below, heaviest first. One substantive finding, one alert triage, and a few notes; the rest is me confirming things are clean so that's on the record.


1. Impact can under-report: dashboards linked only through native filters

collect_dataset_purge_impact finds dashboards by joining Dashboard → dashboard_slices → Slice and filtering on the slice's datasource (purge_impact.py:93-99). That finds every dashboard that contains a chart built on the dataset. It does not find a dashboard whose only reference to the dataset is a native filter target, because such a dashboard has no dashboard_slices row for it.

That linkage is real and load-bearing elsewhere in this repo:

  • superset/models/dashboard.py:477 — export resolves native_filter_configuration[].targets[].datasetId through DatasourceDAO.get_datasource(DatasourceType.TABLE, id_), i.e. straight to a SqlaTable.
  • superset/tasks/native_filter_cache.py:58 — the filter cache warms datasets read from target.get("datasetId").
  • superset/migrations/shared/native_filters.py:114,131 — the legacy filter_box → native-filter migration wrote targets: [{"datasetId": filter_box.datasource_id}]. Long-lived deployments have exactly this shape today, and in that migration path the filter's dataset need not match any chart on the dashboard.

Consequence: the modal renders "No affected dashboards." (ArchivedDatasetPurgeModal.tsx:106), the user types DELETE, and a dashboard filter silently breaks with no recovery. For an irreversible purge, under-reporting is the direction that costs data; over-reporting is only noise.

Two things keep this off the "blocking" line for me:

  • The scoping choice is pre-existing and consistent — DatasetDAO.get_related_objects (superset/daos/dataset.py:145-165) has the same shape. This PR did not introduce it.
  • docs/docs/using-superset/recently-archived.mdx is precisely worded: "which dashboards contain those charts." That is accurate to the code.

But the docs and the UI disagree in tone. "No affected dashboards." reads as an absolute statement about the dataset, and it is now the last thing a user sees before an unrecoverable action. Either widen the query to union in native_filter_configuration dataset targets, or soften the modal copy to match the docs' narrower claim (e.g. "No dashboards contain affected charts."). The copy change is cheap and closes the honesty gap immediately; the query change is the real fix. Your call which belongs in this PR.

I'd also note Slice.datasource_type == "table" (purge_impact.py:80,98) is correct — I checked, DatasourceDAO.sources maps only TABLE → SqlaTable (superset/daos/datasource.py:50-55), and the model's own relationship uses the same predicate (superset/models/slice.py:167). Not a gap.

2. CodeQL alert 2594 — I believe this is a false positive; here is the reasoning to dismiss it with

Not repeating the bot thread, just triaging it, since it's the only unresolved thread and mergeStateStatus is BLOCKED.

The sink is <a href={item.url}>{item.name}</a> (ArchivedDatasetPurgeModal.tsx:65). The "exception text" the query is tracking is real — it enters at index.tsx:384-396, where the 409 body is pulled out of a caught error via getClientErrorObject(error) and parsedError.impact is fed into modal state. So the dataflow CodeQL found exists. It is the exploitability that does not:

  • {item.name} is JSX children. React escapes it. It is not an HTML sink, regardless of what a chart is named.
  • href is guarded at :60-61 (startsWith('/') && !startsWith('//')), and independently both URL sources are server-built fixed-prefix relative paths: Slice.url → /explore/?slice_id={int} (superset/models/slice.py:389-390) and Dashboard.url → /dashboard/{slug or id}/ (superset/models/dashboard.py:263-264). Character 1 is always a literal letter, so javascript:, data:, and scheme-relative forms are all unreachable — the guard is belt-and-braces over already-safe values.

Suggest dismissing 2594 in the code-scanning UI as false positive with that justification rather than leaving it to block the merge.

One defence-in-depth note while you're in there: !startsWith('//') does not reject /\, which browsers normalise to a scheme-relative URL per the WHATWG URL spec (/\evil.com → http://evil.com). Not reachable here for the reason above, so this is not a finding against the current code — but the guard's comment claims it rejects "scheme-relative URLs" generally, and it doesn't quite. If it's meant to be reusable, matching /[^/\\] would make the comment true.

3. Confirmed clean — recording these because they were the things worth doubting

Unauthorized names do not reach the client. This was my main concern and the answer is good. collect_dataset_purge_impact deliberately runs under skip_visibility_filter (purge_impact.py:76) so count is authoritative — right call, a warning that hid dependents would defeat the feature. Redaction then happens at serialization: serialize_dataset_purge_impact (superset/commands/purge.py:226) gates every entry on can_access_chart / can_access_dashboard (:245, :253) and folds the rest into restricted_count (:264, :269). So only cardinality leaks, never names, UUIDs, or links. Your own integration test asserts exactly that — the restricted chart's UUID and name are absent from the serialized payload. The docs describe this honestly too. That's the right trade-off, correctly implemented.

The impact token is enforced server-side, not echoed. Twice: a fast-fail pre-check at superset/commands/purge.py:105, and — the one that actually matters — a re-collect and compare inside begin_nested() after claim.with_for_update() (purge_cascade.py:248,251-254). Both fail closed. Worth calling out that the integration test asserts the dataset still exists after the 409, which is the assertion that makes the guard meaningful rather than decorative.

Migration is convention-consistent. create_index does a plain blocking create with no CONCURRENTLY option, and zero migrations in the tree use CONCURRENTLY — every recent 2026 migration uses this same helper. downgrade() drops in correct reverse order. Not a defect. Flagging for operator awareness only: slices is large in real deployments and this will block writes on it for the duration of the build.

DeleteModal is backward compatible. All three new props are optional with behavior-preserving defaults (disablePrimaryButton = false, loading = false, confirmationResetKey undefined). The new useEffect resets to what is already the initial state on mount, and the composed disablePrimaryButton expression reduces to the old one when both are false. ~20 existing callers are unaffected.

Permission mapping. "purge_impact": "write" on a GET is deliberate and correct — it scopes the preview to the purge audience rather than the read audience.

4. Nit

index.tsx:384-392 casts the parsed error to Partial<PurgeImpactChangedResponse> and then only truthiness-checks parsedError.impact. A 409 from an intermediary with a different body shape would reach render and throw inside ImpactCollection on collection.result.slice(...). A shape check on impact.charts?.result would keep the error path from becoming its own error.


Verification. RAN: tests/unit_tests/commands/deletion_retention/ — 44 passed; full tests/unit_tests/commands/ — 970 passed. I also ran a mutation check, removing both token-enforcement branches: all 970 unit tests still passed, but that is expected and not a criticism — enforcement lives in soft_delete_tests.py / force_purge_tests.py, which run under test-postgres / test-mysql / test-sqlite and pass. A unit-level test of the mismatch branch would be cheap insurance, nothing more. INSPECTED (not run): all frontend tests — superset-frontend/node_modules is not installed in my environment, which is an environment limitation on my side and not a statement about this PR. Everything in §1–§3 is from reading code at the pinned SHA, with each cited line verified against 25781a051a.

Not approving as I'm not a committer on this repo — leaving that to a maintainer. The design here is sound; §1 is the one I'd want a decision on before this merges.

@bito-code-review

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

Copy link
Copy Markdown
Contributor

Code Review Agent Run #16267f

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset-frontend/src/pages/ArchivedList/ArchivedDatasetPurgeModal.tsx - 1
    • CWE-601: Open Redirect Bypass · Line 60-62
      The guard blocks `//` and absolute URLs but not a leading backslash. `Dashboard.url` is `/dashboard/{slug}/`, and the import path (`superset/commands/dashboard/importers/v1/utils.py`) assigns `existing.slug = config["slug"]` without the `re.sub(r"[^\w\-]+", ...)` sanitization the API schema applies. A slug like `\evil.com` yields `href="/dashboard/\evil.com/"`, which browsers parse as a network-path reference and navigate to `http://evil.com` — bypassing this open-redirect hardening. Reject backslashes or verify the resolved origin matches the app origin. ([CWE-601](https://cwe.mitre.org/data/definitions/601.html))
Review Details
  • Files reviewed - 4 · Commit Range: 058c37d..25781a0
    • superset-frontend/src/pages/ArchivedList/ArchivedDatasetPurgeModal.tsx
    • superset-frontend/src/pages/ArchivedList/ArchivedList.test.tsx
    • superset-frontend/src/pages/ArchivedList/index.tsx
    • superset/datasets/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

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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

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

approving with the comment above

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

Thanks @mikebridge, this is careful work on a genuinely dangerous flow, and the fail-closed shape of the modal is exactly right.

I went beyond reading the diff and verified this empirically:

  • Ran the new unit tests plus the full deletion_retention and datasets unit suites (153 passed), the whole deletion_retention integration package (84 passed, 1 skipped), and the TestDatasetArchiveListing class (8 passed) on a fresh metadata DB.
  • Ran both jest suites (38 passed). I also ran the new DeleteModal tests against the pre-PR component: the three new behaviors (loading, external disable, confirmationResetKey re-arm) fail there, so the tests pin the fix rather than the status quo.
  • Verified the migration: upgrade, downgrade to 39097d124752, and re-upgrade all succeed on a fresh DB, with both indexes present afterwards.
  • Exercised the endpoints on a live instance with SOFT_DELETE enabled: purge-impact returns the right counts, names, links, and token; purge with a missing or empty token answers 400; a bogus or stale token answers 409 with refreshed impact and mutates nothing; after adding a chart mid-flow the stale token was refused and the refreshed impact included it; confirming with the refreshed token purged the dataset while every dependent chart and the dashboard survived, and the audit row recorded the dangling chart UUIDs.

Two non-blocking notes:

  • The two open js/xss-through-exception CodeQL alerts point at the impact list rendering. The flagged values render as React text nodes and an href gated to server-issued application paths (ArchivedDatasetPurgeModal.tsx, the isSafeAppPath check), so I read both as false positives and will dismiss them.
  • Future-direction note, not a blocker: a dashboard can depend on a dataset solely through a native filter target (native_filter_configuration targets carry a datasetId; dashboard export already follows them in superset/models/dashboard.py), and such a dashboard would show as "0 Dashboards" here. That matches the existing related_objects discovery exactly, so it is parity rather than a regression, but it may be worth a follow-up covering both surfaces someday.

LGTM.

@aminghadersohi
aminghadersohi merged commit e8540b7 into apache:master Sep 2, 2026
81 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 doc Namespace | Anything related to documentation i18n Namespace | Anything related to localization packages 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