You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "mikebridge (via GitHub)" <gi...@apache.org> on 2026/09/14 18:01:41 UTC
[PR] chore(cli): direct tests for the deletion-retention click entry points; non-zero exit on blocked/not-found force-purge [superset]
mikebridge opened a new pull request, #44252:
URL: https://github.com/apache/superset/pull/44252
### SUMMARY
`superset/cli/deletion_retention.py` sat at 0% coverage. The command classes underneath (`ForcePurgeCommand`, `resolve_retention_window`) are covered, but nothing drove the click entry points themselves — option parsing, the irreversible confirmation prompt on `force-purge`, the operator-visible output the CLI is the only consumer of, and exit codes. Raised twice by @rusackas on #41549 (07-13 and 07-29) and independently by bito; committed to as a follow-up there. Ref SC-115409.
**31 CliRunner tests, unit-scoped** (the command objects are mocked at their import source, so no database):
- the group registers exactly `set-window` / `show-window` / `force-purge`
- `set-window`: upserts the shared value for `0` / `N` / large; short option; a negative window is a usage error (exit 2) with nothing written; missing or non-integer `--days` never reaches the upsert
- `show-window`: `N day(s)` vs `disabled` for zero
- `force-purge` parsing: a malformed `--uuid` fails as a clean usage error **before the prompt and before the command is constructed** (the reason that option is `click.UUID`); `--uuid` required; unknown `--type` refused
- the prompt: shown without `--yes`; an empty answer and `n` abort (exit 1) with no command constructed; `y` runs it; `--yes` bypasses with no prompt text
- `--type` resolution: each type maps to its soft-delete model, `None` means every model, case-insensitive, and a drift in the type map surfaces as a `ClickException` rather than silently widening the purge to every model; the resolved model reaches the command
- outcomes: a completed purge's output with counts (and with counts absent), blocked (names the blocking reason), nothing to purge, and an ambiguous bare UUID surfacing as an exit-1 error naming `--type`
**One deliberate contract change** (second commit): a `force-purge` whose target is **blocked** by a deletion rule or **not found** now exits **1** instead of 0, with the messages unchanged. Exiting 0 on a refusal was an operator footgun — a scripted compliance-erasure runbook could not tell a refused purge from a completed one. A completed purge still exits 0; a usage error still exits 2. Noted in `UPDATING.md`.
Two things the ticket's original wording assumed that the shipped CLI does not have: there is no dry-run option on `force-purge` (nothing to pin), and the exit-code point above was the "non-zero on blocked" it asked for.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
No UI. Operator-visible change: `force-purge` exit status on blocked / not-found (messages identical).
### TESTING INSTRUCTIONS
```bash
pytest tests/unit_tests/cli/deletion_retention_test.py # 31 tests
pytest tests/integration_tests/deletion_retention/force_purge_tests.py -k cli # existing CLI integration tests, unchanged
```
Manual: `superset deletion-retention force-purge --uuid <uuid-of-a-chart-referenced-by-a-report> --yes; echo $?` → the "not purged because existing deletion rules block it" message and exit status `1`.
### ADDITIONAL INFORMATION
- [x] Has associated issue: SC-115409 (follow-up to #41549 / SC-111185)
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] 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
This PR was developed with AI assistance (Claude Code); a human (@mikebridge) reviews before merge.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] chore(cli): direct tests for the deletion-retention click entry points; non-zero exit on blocked/not-found force-purge [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #44252:
URL: https://github.com/apache/superset/pull/44252#issuecomment-5668701154
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/44252?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 76.32%. Comparing base ([`eeafd65`](https://app.codecov.io/gh/apache/superset/commit/eeafd65b746c8cff1c424906d385fe911175661b?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`7cd6b44`](https://app.codecov.io/gh/apache/superset/commit/7cd6b44590b2166a6eccd08059065e5f13733abc?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #44252 +/- ##
==========================================
+ Coverage 76.29% 76.32% +0.02%
==========================================
Files 2925 2925
Lines 172692 172692
Branches 40090 40090
==========================================
+ Hits 131758 131809 +51
+ Misses 38247 38196 -51
Partials 2687 2687
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/44252/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [hive](https://app.codecov.io/gh/apache/superset/pull/44252/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `37.33% <0.00%> (ø)` | |
| [presto](https://app.codecov.io/gh/apache/superset/pull/44252/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `39.22% <0.00%> (ø)` | |
| [python](https://app.codecov.io/gh/apache/superset/pull/44252/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `76.94% <100.00%> (+0.05%)` | :arrow_up: |
| [unit](https://app.codecov.io/gh/apache/superset/pull/44252/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `76.01% <100.00%> (+0.05%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/superset/pull/44252?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] chore(cli): direct tests for the deletion-retention click entry points; non-zero exit on blocked/not-found force-purge [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #44252:
URL: https://github.com/apache/superset/pull/44252#issuecomment-5668406326
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] chore(cli): direct tests for the deletion-retention click entry points; non-zero exit on blocked/not-found force-purge [superset]
Posted by "richardfogaca (via GitHub)" <gi...@apache.org>.
richardfogaca merged PR #44252:
URL: https://github.com/apache/superset/pull/44252
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org