eschutho opened a new pull request, #46062:
URL: https://github.com/apache/superset/pull/46062

   ### SUMMARY
   
   For a dashboard report or alert with a tab and native filters 
(`ALERT_REPORTS_FILTER`, `ALERT_REPORT_TABS`), the "Explore in Superset" 
call-to-action link in the email (and Slack message) opened the right tab but 
with the dashboard's **default** filters, not the report's. Recipients who 
clicked through saw different numbers than the attachment.
   
   **Root cause:** `_get_notification_content` builds the link with 
`_get_url(user_friendly=True)`. Its dashboard branch created the permalink 
straight from the raw stored `extra["dashboard"]` state and never merged the 
report's native filters into the permalink `urlParams`. The screenshot path 
goes through `get_dashboard_urls`, which does merge them (per tab), so the 
attachment was filtered and the link was not. A multi-tab anchor (a JSON list 
string) was also passed through as-is.
   
   **Changes** (`superset/commands/report/execute.py`):
   - `_get_url`'s dashboard branch now returns the first URL from 
`get_dashboard_urls(user_friendly=..., **kwargs)`, so the link carries the same 
stateful permalink (tab, `urlParams` such as `standalone=true`, and the 
report's native filters) as the attachment. A multi-tab report links to its 
first tab. With `ALERT_REPORT_TABS` off, the link is the filtered permalink the 
screenshot path already produces.
   - If no tab URLs come back (an empty tab list, `"[]"`, which report 
validation accepts), it falls back to the plain dashboard link instead of 
failing the notification.
   - Unchanged: the attachment-free-alert bare dashboard link, the up-front 
chart/dashboard guards, chart-only callers, and 
`_get_failure_notification_url`'s fallback to the plain link when the executor 
cannot access the dashboard.
   - New `_add_execution_warnings` helper so filter warnings are not recorded 
twice now that the URL builder can run more than once per execution.
   
   Note: link correctness for filter values containing quotes also depends on 
the separate fix for the rison quote encoding in `get_native_filters_params` 
(#46060).
   
   ### TESTING INSTRUCTIONS
   
   ```
   pytest tests/unit_tests/commands/report/execute_test.py
   ```
   
   12 new tests use a real `ReportSchedule` with realistic filters (multi-word 
text, commas and quotes, a numeric range, a time range) and cover: the 
permalink state carrying `native_filters`; JSON-list, bare and missing anchors; 
`urlParams` such as `standalone=true` being preserved; the flag-off case; the 
empty-state plain URL; an empty anchor list; the attachment-free alert; 
`_get_notification_content().url`; warning de-duplication; and the failure-URL 
fallback. 8 of them fail on master; the rest guard unchanged behaviour (plain 
URL when there is no state, attachment-free alert, failure-URL fallback, 
de-duplication).
   
   Manual: create a dashboard report on a tab with native filters, run it, and 
open the email's link; the filter bar should show the report's filters.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags: `ALERT_REPORTS_FILTER`, `ALERT_REPORT_TABS`
   - [ ] 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]

  • [PR] fix(reports): carry the r... eschutho (via GitHub) via notifications

Reply via email to