eschutho opened a new pull request, #46060:
URL: https://github.com/apache/superset/pull/46060
### SUMMARY
Dashboard reports and alerts with native filters (`ALERT_REPORTS_FILTER`)
sent **unfiltered** data, without any error, whenever a selected filter value
needed rison quoting (text with a space, comma or quote) or whenever a
numeric-range or time-range filter was used. A single such filter caused *all*
of the report's filters to be dropped, and the run was still recorded as a
success.
**Root cause:** `ReportSchedule.get_native_filters_params` replaced `'` with
`%27` in the rison string. That string is stored in the dashboard permalink
state (`urlParams`), and `Superset.dashboard_permalink` URL-encodes every
`urlParams` value when it redirects, so `%27` became `%2527`. The frontend
decodes the parameter once, `rison.decode` then fails on the literal `%27`, and
no native filter is preselected. Rison only emits quotes for values that need
them (spaces, commas, quotes; range labels and time ranges always contain
spaces), which is why single-word values worked.
**Fix:**
- Remove the `%27` replacement so the raw rison string is URL-encoded
exactly once by the redirect. The redirect's per-value `urlencode` (which
guards against parameter injection) is unchanged.
- Add a small check in `get_native_filters_params` that the generated value
survives `urlencode` -> one decode -> `rison.loads`. If it does not, an
execution warning naming the filter ids that were not applied is recorded
instead of failing silently.
### TESTING INSTRUCTIONS
Unit tests (all run in CI):
```
pytest tests/unit_tests/reports/model_test.py \
tests/unit_tests/commands/report/execute_test.py \
tests/unit_tests/views/test_dashboard_permalink_native_filters.py
```
- `model_test.py`: the test that pinned the old `%27` behaviour is replaced
by parametrized round-trip cases (single word, multi-word, comma, single quote,
`!`, non-ASCII, numeric range, relative and absolute time range, and a
combination), plus a single-word-unchanged test and a warning test.
- `execute_test.py`: `get_dashboard_urls` produces round-trippable permalink
`urlParams` with `ALERT_REPORT_TABS` on and off.
- `test_dashboard_permalink_native_filters.py` (new): sends the same cases
through the real `dashboard_permalink` redirect and decodes the resulting URL.
Manual: create a dashboard report with a native filter on a multi-word value
(for example `North America`), a numeric range and a time range; run it and
confirm the attachment and the dashboard permalink show the filters applied.
Test limitations: there is no DB-backed `ReportScheduleDAO` integration
test, and the browser-side decode is covered by simulating `URLSearchParams`
decoding in Python rather than in a real browser.
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags: `ALERT_REPORTS_FILTER` (and
`ALERT_REPORT_TABS` for per-tab reports)
- [ ] Changes UI
- [ ] Includes DB Migration
- [ ] 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]