codeant-ai-for-open-source[bot] commented on code in PR #38531:
URL: https://github.com/apache/superset/pull/38531#discussion_r2910667910
##########
superset/mcp_service/chart/tool/get_chart_data.py:
##########
@@ -249,6 +260,8 @@ async def get_chart_data( # noqa: C901
cached_metrics = cached_form_data_dict.get("metrics", [])
cached_groupby = cached_form_data_dict.get("groupby", [])
+ _apply_extra_form_data(cached_form_data_dict,
request.extra_form_data)
Review Comment:
**Suggestion:** In the cached-form-data and fallback paths,
`extra_form_data` is merged into `form_data` via `_apply_extra_form_data`,
which populates `adhoc_filters`, but the subsequent
`QueryContextFactory.create` calls only pass the `filters` list from
`form_data` and omit `adhoc_filters`; since `merge_extra_filters` puts
dashboard-native filters into `adhoc_filters`, those filters are silently
ignored in these paths, so `extra_form_data` has no effect unless the chart has
a saved `query_context`. To make the feature work consistently, include the
merged `adhoc_filters` (and optionally `extras`) from `form_data` in the
`queries` dict passed to `QueryContextFactory.create`. [logic error]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ❌ MCP get_chart_data ignores dashboard filters in cached-form-data path.
- ⚠️ Affects charts queried via form_data_key (unsaved state).
- ⚠️ LLM agents receive unfiltered data, skewing analysis results.
```
</details>
--
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]