Skip to content

feat(mcp): add aggregation field to BigNumberChartConfig for Big Number with Trendline#40775

Draft
aminghadersohi wants to merge 2 commits into
apache:masterfrom
aminghadersohi:sc-105327-chatbot-aggregation-diagnosis
Draft

feat(mcp): add aggregation field to BigNumberChartConfig for Big Number with Trendline#40775
aminghadersohi wants to merge 2 commits into
apache:masterfrom
aminghadersohi:sc-105327-chatbot-aggregation-diagnosis

Conversation

@aminghadersohi
Copy link
Copy Markdown
Contributor

Summary

  • Adds aggregation field to BigNumberChartConfig with options LAST_VALUE, sum, mean, min, max, median, raw
  • Wires the field into map_big_number_config so it is written into form_data["aggregation"] when set
  • Updates system-prompt guidance and chart type schema examples so the model can diagnose and fix Big Number with Trendline charts displaying only the last data point instead of a total
  • Adds unit tests for schema validation and form_data mapping with and without aggregation

Context

The Big Number with Trendline chart has a client-side aggregation field in form_data (separate from the SQL aggregate on the metric) that controls how the single displayed value is computed from the trendline data points. Options include Total (Sum), Last Value, Average, Min, Max, etc. The frontend defaults to LAST_VALUE when this field is absent. Previously BigNumberChartConfig did not model this field, so the MCP chatbot could not set or update it, causing charts to always show the last data point instead of a total when users asked for all-time totals.

Testing

Unit tests added in tests/unit_tests/mcp_service/chart/test_big_number_chart.py.

@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 4, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 282383e
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a232278f6a6410009953b81
😎 Deploy Preview https://deploy-preview-40775--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

…er with Trendline

Adds the `aggregation` field to `BigNumberChartConfig` so the chatbot can
read, diagnose, and update the aggregation method on Big Number with Trendline
charts. When absent, the frontend defaults to LAST_VALUE (most recent data
point); setting aggregation="sum" gives the all-time total. Updates system
prompt guidance and chart type schema examples to help the model diagnose
wrong values and avoid accidentally changing the viz_type when fixing
aggregation.
@aminghadersohi aminghadersohi force-pushed the sc-105327-chatbot-aggregation-diagnosis branch from 440c8c3 to 282383e Compare June 5, 2026 19:24
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 5, 2026

Codecov Report

❌ Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.18%. Comparing base (863e935) to head (282383e).
⚠️ Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
superset/mcp_service/chart/chart_utils.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #40775      +/-   ##
==========================================
- Coverage   64.19%   64.18%   -0.01%     
==========================================
  Files        2666     2666              
  Lines      143991   143994       +3     
  Branches    33108    33109       +1     
==========================================
+ Hits        92428    92429       +1     
- Misses      49950    49952       +2     
  Partials     1613     1613              
Flag Coverage Δ
hive 39.76% <33.33%> (-0.01%) ⬇️
mysql 58.41% <33.33%> (-0.01%) ⬇️
postgres 58.48% <33.33%> (-0.01%) ⬇️
presto 41.35% <33.33%> (-0.01%) ⬇️
python 59.94% <33.33%> (-0.01%) ⬇️
sqlite 58.10% <33.33%> (-0.01%) ⬇️
unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants