codeant-ai-for-open-source[bot] commented on code in PR #43490:
URL: https://github.com/apache/superset/pull/43490#discussion_r3864763006
##########
superset/initialization/__init__.py:
##########
@@ -1002,11 +1005,14 @@ def _warn_if_retention_beat_missing(self) -> None:
"CeleryConfig or add the module to your override.",
self._RETENTION_TASK_MODULE,
)
- default_flags = self.config.get("DEFAULT_FEATURE_FLAGS", {})
- configured_flags = self.config.get("FEATURE_FLAGS", {})
- soft_delete_enabled = bool(
+ default_flags: dict[str, Any] =
self.config.get("DEFAULT_FEATURE_FLAGS", {})
+ configured_flags: dict[str, Any] = self.config.get("FEATURE_FLAGS", {})
+ soft_delete_enabled: bool = bool(
configured_flags.get("SOFT_DELETE",
default_flags.get("SOFT_DELETE", False))
)
+ audit_pruning_enabled: bool = (
+ self.config.get("PURGE_AUDIT_PRUNING_ENABLED", False) is True
+ )
Review Comment:
The comment is valid. `is True` correctly prevents invalid values from
enabling pruning, but it also collapses invalid values into the legitimate
`False` state, so startup provides no actionable warning.
Keep the fail-closed behavior, but validate the type separately:
```python
audit_pruning_config: Any = self.config.get(
"PURGE_AUDIT_PRUNING_ENABLED", False
)
if not isinstance(audit_pruning_config, bool):
logger.warning(
"deletion-retention: invalid PURGE_AUDIT_PRUNING_ENABLED=%r; "
"audit pruning remains disabled",
audit_pruning_config,
)
audit_pruning_enabled = False
else:
audit_pruning_enabled = audit_pruning_config
```
Then retain the existing schedule/import checks based on
`audit_pruning_enabled`. This preserves the task’s strict behavior while making
values such as `"true"` and `1` visible during initialization. A focused test
should assert that an invalid value logs a warning and does not trigger the
schedule check.
--
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]