rusackas opened a new pull request, #43025:
URL: https://github.com/apache/superset/pull/43025
### SUMMARY
Test-only PR pinning a real bug: `warm_up_cache` silently drops native
filter defaults, so warming a dashboard's cache produces a different key than
what the browser actually requests, and the warmed cache entry is never hit for
dashboards built with native filters (the standard mechanism today).
`get_dashboard_extra_filters()` in `superset/views/utils.py` only reads the
legacy Filter Box `default_filters`/`filter_scopes` dashboard metadata:
```python
default_filters = json.loads(json_metadata.get("default_filters", "null"))
if not default_filters:
return []
```
It never reads `native_filter_configuration` at all.
`ChartWarmUpCacheCommand` relies on this function to reconstruct a dashboard's
applied filters for cache warming, so for any dashboard using native filters,
warming applies none of them.
Worth noting for whoever picks up the fix: a correct native-filter extractor
already exists and is wired into the real `/api/v1/chart/data` endpoint —
`superset.charts.data.dashboard_filter_context.get_dashboard_filter_context()`
/ `apply_dashboard_filter_context()` (see `superset/charts/data/api.py`).
`ChartWarmUpCacheCommand` just isn't using it; that looks like the natural fix
to reuse rather than reinventing native-filter parsing inside
`get_dashboard_extra_filters`.
Originally raised in discussion #42382 with solid root-cause analysis; filed
as #43024 since it's a confirmed bug (verified independently against current
`master`, not just the original report), not a question. That issue also covers
a second, related root cause (filter list *order* affecting the cache key hash)
which isn't covered by this specific test — worth a follow-up test/fix once the
native-filter gap above is addressed, since fixing one without the other would
still leave cache warming broken.
### TESTING INSTRUCTIONS
`pytest tests/unit_tests/views/test_utils.py -v` —
`test_get_dashboard_extra_filters_ignores_native_filter_defaults` currently
fails (red), confirming the bug reproduces on `master`. Confirmed it fails
without this PR's changes and passes once a correct fix is in place (built and
reverted a fix locally to verify the test's shape, not included here — this PR
is test-only per project convention).
### ADDITIONAL INFORMATION
- [x] Has associated issue: Fixes #43024
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
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]