mikebridge opened a new pull request, #42641:
URL: https://github.com/apache/superset/pull/42641
### SUMMARY
Operators who redefine `CeleryConfig` in `superset_config.py` — instead of
subclassing or merging the default — silently lose beat-schedule entries. For
the soft-delete purge task (`deletion_retention.purge_soft_deleted`) this
failure mode is invisible until it matters: archived objects accumulate forever
instead of purging after the retention window.
This generalizes the existing startup check for the version-history
retention entry (`_warn_if_retention_beat_missing`) to also cover the purge
task:
- The version-history entry is checked unconditionally, as before (shadow
rows written by prior deploys keep ageing even when capture is off).
- The purge entry is checked only when the `SOFT_DELETE` feature flag
resolves **on** at the config level (`DEFAULT_FEATURE_FLAGS` merged with
`FEATURE_FLAGS`, matching `FeatureFlagManager.init_app` order). The purge task
itself no-ops while the flag is off, so a missing entry is only actionable once
soft delete is live. Flags supplied dynamically via `GET_FEATURE_FLAGS_FUNC`
are deliberately not consulted — this is a configuration-only startup
diagnostic.
All four documented `CELERY_CONFIG` shapes (`None`, class/module, dict,
dotted string) behave as before, and matching is by each entry's `task` value,
not the schedule key, so a correctly-scheduled task under a renamed key does
not warn.
This is groundwork for eventually enabling `SOFT_DELETE` by default: the
warning must exist before any release ships with soft delete on, so deployments
with hand-rolled Celery configs learn about the missing purge entry from the
deploy log rather than from unbounded growth.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — log-only change. New warning text:
```
soft-delete: CELERY_CONFIG.beat_schedule is missing the
'deletion_retention.purge_soft_deleted' entry — archived objects will never be
purged and will accumulate indefinitely. Either inherit from the default
CeleryConfig or add the entry to your override.
```
### TESTING INSTRUCTIONS
1. `pytest tests/unit_tests/initialization_test.py -k RetentionBeatWarning`
— 12 tests: 7 pre-existing plus 5 new covering the purge entry (warn when flag
on + entry missing, silent when flag off, `FEATURE_FLAGS` override beats the
default, silent when both entries present, renamed-key parity).
2. Manually: set `FEATURE_FLAGS = {"SOFT_DELETE": True}` and a
`CELERY_CONFIG` class without the purge entry in `superset_config.py`; start
the app; the warning above appears once at startup. Restore the default
`CeleryConfig`; no warning.
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [x] Required feature flags: `SOFT_DELETE` (the new warning only fires when
it resolves on)
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]