feat(soft-delete): warn at startup when the purge beat entry is missing - #42641
Draft
mikebridge wants to merge 1 commit into
Draft
feat(soft-delete): warn at startup when the purge beat entry is missing#42641mikebridge wants to merge 1 commit into
mikebridge wants to merge 1 commit into
Conversation
Operators who redefine CeleryConfig in superset_config.py instead of subclassing or merging the default silently lose the deletion_retention.purge_soft_deleted beat entry: archived objects then accumulate forever instead of purging after the retention window. Generalize the existing version-history beat check to also cover the purge task, gated on SOFT_DELETE resolving on at the config level (the purge task itself no-ops while the flag is off, so a missing entry is only actionable once soft delete is live). This is a precondition for flipping the SOFT_DELETE default (sc-111918): the warning must be in place before any release ships with soft delete on by default. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #42641 +/- ##
==========================================
- Coverage 65.44% 65.44% -0.01%
==========================================
Files 2810 2810
Lines 159362 159366 +4
Branches 36372 36373 +1
==========================================
- Hits 104301 104300 -1
- Misses 53019 53022 +3
- Partials 2042 2044 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SUMMARY
Operators who redefine
CeleryConfiginsuperset_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:SOFT_DELETEfeature flag resolves on at the config level (DEFAULT_FEATURE_FLAGSmerged withFEATURE_FLAGS, matchingFeatureFlagManager.init_apporder). 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 viaGET_FEATURE_FLAGS_FUNCare deliberately not consulted — this is a configuration-only startup diagnostic.All four documented
CELERY_CONFIGshapes (None, class/module, dict, dotted string) behave as before, and matching is by each entry'staskvalue, not the schedule key, so a correctly-scheduled task under a renamed key does not warn.This is groundwork for eventually enabling
SOFT_DELETEby 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:
TESTING INSTRUCTIONS
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_FLAGSoverride beats the default, silent when both entries present, renamed-key parity).FEATURE_FLAGS = {"SOFT_DELETE": True}and aCELERY_CONFIGclass without the purge entry insuperset_config.py; start the app; the warning above appears once at startup. Restore the defaultCeleryConfig; no warning.ADDITIONAL INFORMATION
SOFT_DELETE(the new warning only fires when it resolves on)🤖 Generated with Claude Code