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

   ### SUMMARY
   
   `get_chart_preview` silently dropped forwarded `extra_form_data`, so a 
preview always rendered the full dataset even when the caller passed the 
dashboard filters the user is currently viewing.
   This threads `extra_form_data` into the ASCII, Table, and VegaLite preview 
strategies via `build_query_context_from_form_data(..., extra_form_data=...)`, 
so the preview reflects the filtered view.
   It mirrors the pattern `get_chart_data` and `get_chart_sql` already follow 
(#43478).
   The URL strategy runs no query and is unchanged.
   
   `get_chart_info` gains an optional `extra_form_data` input and reports the 
forwarded active filters under `filters.active_filters` (column based) and 
`filters.active_time_range` (time filter), kept distinct from the chart's own 
saved filters and from `dashboard_filters` (the configured dashboard state).
   It runs no query; the values are echoed for awareness so a metadata answer 
reflects the chart as currently viewed, mirroring the `filter_state` echo on 
`get_dashboard_info` (#43688).
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   Not applicable (MCP tool behavior, no UI).
   
   ### TESTING INSTRUCTIONS
   
   ```
   pytest tests/unit_tests/mcp_service/chart/tool/test_get_chart_preview.py \
          tests/unit_tests/mcp_service/chart/tool/test_get_chart_info.py
   ```
   
   * `test_extra_form_data_filters_reach_preview_query` builds a real query 
context and asserts the forwarded filter reaches the executed query.
   * `TestAttachActiveFilters` covers column filters, adhoc filters, an active 
time range, time range only, and the empty case.
   
   Manual: call `get_chart_preview` with `extra_form_data={"filters": [{"col": 
"gender", "op": "IN", "val": ["Female"]}]}` and confirm the rendered data is 
filtered; call `get_chart_info` with the same payload and confirm 
`filters.active_filters` reflects it.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
   - [x] 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]

Reply via email to