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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
