championble3 opened a new issue, #45237:
URL: https://github.com/apache/superset/issues/45237
### Bug description
Problem: Charts created or edited through the REST API/MCP have no
query_context, or an outdated one. get_chart_data then rebuilds a generic query
from form_data. For chart types where the frontend buildQuery adds logic (time
grain, trendline, period comparison, SQL columns), this returns different
numbers than the dashboard.
Example: big_number chart with time_grain_sqla: P3M, compare_lag: 1,
show_trend_line: true. The dashboard shows the QoQ change; get_chart_data
returns the plain sum of the metric.
Why it is hard to notice: the fallback only calls ctx.warning(...), which
does not reach the client’s tool result, so an LLM client presents the number
as correct. Charts with a stale saved context are not flagged at all.
Suggestions: (1) include a warning in the tool result (e.g. in insights)
when the fallback is used; (2) mention in the tool description that exact
results need a chart saved from Explore; (3) consider flagging a saved
query_context older than the chart’s changed_on.
Related:
[apache/superset#39413](https://github.com/apache/superset/pull/39413) (fixed
update_chart),
[apache/superset#45210](https://github.com/apache/superset/issues/45210),
[#28446](https://github.com/apache/superset/issues/28446).
### Screenshots/recordings
_No response_
### Superset version
6.1.0
### Python version
3.11
### Node version
16
### Browser
Chrome
### Additional context
Observed on 6.1.0 (built-in MCP service) with charts created through the
API. On current master the fallback still only calls ctx.warning, and insights
has no entry for it.
### Checklist
- [x] I have searched Superset docs and Slack and didn't find a solution to
my problem.
- [x] I have searched the GitHub issue tracker and didn't find a similar bug
report.
- [x] I have checked Superset's logs for errors and if I found a relevant
Python stacktrace, I included it here as text in the "additional context"
section.
--
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]