aminghadersohi commented on code in PR #40960:
URL: https://github.com/apache/superset/pull/40960#discussion_r3493585288
##########
superset/daos/dashboard.py:
##########
@@ -431,7 +431,8 @@ def update_native_filters_config(
raise DashboardUpdateFailedError("Dashboard not found")
if attributes:
- metadata = json.loads(dashboard.json_metadata or "{}")
+ _parsed = json.loads(dashboard.json_metadata or "{}")
+ metadata = _parsed if isinstance(_parsed, dict) else {}
Review Comment:
Fixed in 582ebf891c: wrapped `json.loads` in
`DashboardDAO.update_native_filters_config` with `(json.JSONDecodeError,
TypeError)` handling so corrupt `json_metadata` degrades to `{}` rather than
crashing the write path (mirrors the same guard already in
`_current_native_filter_config`).
##########
superset/daos/dashboard.py:
##########
@@ -431,7 +431,8 @@ def update_native_filters_config(
raise DashboardUpdateFailedError("Dashboard not found")
if attributes:
- metadata = json.loads(dashboard.json_metadata or "{}")
+ _parsed = json.loads(dashboard.json_metadata or "{}")
Review Comment:
Declining: annotating local variables (`_parsed`, `metadata`) and
module-level loggers is not a pattern the codebase follows — mypy infers these
correctly. The overhead of maintaining explicit annotations on internal local
vars throughout the codebase would exceed the benefit.
--
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]