Repository navigation
feat(mcp): waterfall chart type plugin - #42070
Conversation
Add chart_type="waterfall" to the generate_chart plugin registry: single x_axis step column, single metric, optional single-select breakdown (form_data groupby; accepts the native 'groupby' alias), show_total/labels/formats matching the frontend controlPanel defaults, and row_limit at the shared 10000 default. Dimension fields reject metric-style refs; waterfall maps into the bar-mark preview bucket; remaining chart-type-count comments made count-agnostic. 13 unit tests. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014z1fQxTadTEvpCJLx9WnB8
Code Review Agent Run #2cbd55Actionable Suggestions - 0Filtered by Review RulesBito filtered these suggestions based on rules created automatically for your feedback. Manage rules.
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #42070 +/- ##
==========================================
- Coverage 65.02% 64.98% -0.04%
==========================================
Files 2752 2752
Lines 154390 154604 +214
Branches 35380 35421 +41
==========================================
+ Hits 100391 100472 +81
- Misses 52088 52216 +128
- Partials 1911 1916 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…plugin # Conflicts: # superset/mcp_service/app.py # superset/mcp_service/chart/chart_utils.py # superset/mcp_service/chart/plugins/__init__.py # superset/mcp_service/chart/schemas.py # superset/mcp_service/chart/tool/generate_chart.py # superset/mcp_service/chart/tool/get_chart_type_schema.py # tests/unit_tests/mcp_service/chart/tool/test_get_chart_type_schema.py
…c fixes - Add time_grain (alias time_grain_sqla) so a temporal x_axis is bucketed rather than sent as raw timestamps, matching the frontend Waterfall control panel and the xy/mixed/big_number pattern (review: codeant) - Accept the native form_data shape where groupby is a one-item list (frontend Breakdowns is single-select but stores a list); reject multi-item lists rather than silently dropping (review: codeant) - Fix merge artifacts from the apache#41860 rebase: the get_chart_type_schema docstring listed two contradictory type sets; the dataset_validator docstring overstated coverage - Replace the brittle chart-type-count assertion with adapter-registry parity (review: codeant) Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014z1fQxTadTEvpCJLx9WnB8
Code Review Agent Run #d91189Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
aminghadersohi
left a comment
There was a problem hiding this comment.
Reviewed the waterfall plugin against the frontend Waterfall source (controlPanel.tsx / buildQuery.ts / transformProps.ts / constants.ts). Most of the form_data contract checks out: groupby single-select (multi: false), show_total default true, row_limit 10000, y_axis_format/x_axis_time_format defaults, the groupby→breakdown alias with list-unwrap, and the metric-style-ref rejection on x_axis/breakdown all match the frontend and are covered by tests. Preview classification and registry wiring (plugins/__init__.py, chart_utils.py, get_chart_type_schema.py) are also correctly single-sourced, no duplication. The prior codeant-ai findings (temporal time_grain_sqla, groupby list round-trip, docstring drift, brittle chart-count test) all look genuinely fixed at this HEAD, not just claimed.
One default value mismatch found below.
The frontend Waterfall controlPanel defaults show_legend to false; the config defaulted to True (review: aminghadersohi). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014z1fQxTadTEvpCJLx9WnB8
aminghadersohi
left a comment
There was a problem hiding this comment.
The show_legend default fix looks correct — matches the frontend CheckboxControl's default: false.
Two real issues surfaced by codeant-ai on this round that are worth confirming (verified both against the actual code, not just the bot writeups):
Code Review Agent Run #3c5c42Actionable Suggestions - 0Additional Suggestions - 1
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
- When time_grain is set, also set granularity_sqla to the x_axis column
so the grain has a temporal column to apply to, mirroring the xy path's
configure_temporal_handling (review: codeant)
- Coerce bare-string column names in groupby/breakdown to {"name": ...};
native form_data names physical columns as strings, and ColumnRef does
not accept bare strings (review: codeant)
Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014z1fQxTadTEvpCJLx9WnB8
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014z1fQxTadTEvpCJLx9WnB8
Code Review Agent Run #06ead4Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
aminghadersohi
left a comment
There was a problem hiding this comment.
Both round-2 findings are fixed correctly, each with a targeted regression test (verified by reading the code, not just the commit message): granularity_sqla is now paired with time_grain_sqla, and the groupby/breakdown unwrap now coerces a bare string to {"name": ...}.
Two more findings on this round, both the same bug classes as before, just found on adjacent surface area:
…temporal grain guard
- Coerce a bare-string x_axis (native form_data column name) to
{"name": ...}, matching the groupby/breakdown handling (review: codeant)
- Add waterfall to the get_chart_data recommendation category map (its
own category — cumulative flow differs from a plain bar) so dedup does
not misclassify existing waterfall charts (review: codeant)
- post_map_validate rejects time_grain on a non-temporal x_axis, so
DATE_TRUNC is not applied to a category/numeric column (review: codeant)
Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014z1fQxTadTEvpCJLx9WnB8
aminghadersohi
left a comment
There was a problem hiding this comment.
Both round-3 findings are fixed correctly, verified at the source level:
x_axisbare strings are now coerced the same waygroupby/breakdownalready were, with a direct test.- The temporal-grain check landed as
WaterfallChartPlugin.post_map_validate()rather than threadingdataset_idinto the mapper — that's actually the established pattern here (mirrorsBigNumberChartPlugin's trendline temporal check), and I confirmeddataset_idgenuinely reaches it viagenerate_chart.py→map_config_to_form_data→post_map_validate. Negative and positive paths are both tested now, which closes a gap this PR's history had a few times.
One harmless aside, not a finding: the _VIZ_CATEGORY["waterfall"] = "waterfall" addition in get_chart_data.py is a no-op — that dict's only call site is .get(viz_type, viz_type), so an unmapped key already falls back to itself as its own category. Doesn't hurt anything, just doesn't change behavior either.
Fresh full scan of the rest of the diff found nothing else. Not approving per policy (external contributor), but this round is clean.
|
Bito Automatic Review Skipped – PR Already Merged |
SUMMARY
Adds a waterfall chart type plugin to the MCP
generate_chartregistry (#39922), the third statistical/analytical addition in this series (delete/restore lifecycle: #41472 merged / #41842; histogram + box plot: #41860).Design notes — incorporating the review outcomes from #41860 up front:
x_axis(single step-per-value column, temporal-friendly), single-selectgroupbybreakdown (the Waterfall controlPanel setsmulti: false— the config field is a singlebreakdown: ColumnRefaccordingly, not a list), singlemetric, and the display options (show_totaldefaulttrueper the controlPanel, increase/decrease/total labels matchingconstants.ts).row_limitdefaults to the shared 10000.groupbyis a validation alias forbreakdown, per the codebase's translate-don't-refuse convention.saved_metric/sql_expressiononx_axis/breakdown), consistent with the tightened validation in feat(mcp): histogram and box plot chart type plugins #41860.waterfallmaps into the bar-mark preview bucket (it is a bar construction), avoiding the misclassification gap found post-hoc on feat(mcp): histogram and box plot chart type plugins #41860.get_chart_type_schemagains the type with two examples;generate_chartdocstring and server instructions updated.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A (MCP service; no UI changes)
TESTING INSTRUCTIONS
Manual: via an MCP client,
generate_chartwith{"dataset_id": <id>, "config": {"chart_type": "waterfall", "x_axis": {"name": "<period_col>"}, "metric": {"name": "<value_col>", "aggregate": "SUM"}}}returns a working preview; add
"breakdown": {"name": "<category_col>"}for per-category steps.ADDITIONAL INFORMATION
🤖 Generated with Claude Code
https://claude.ai/code/session_014z1fQxTadTEvpCJLx9WnB8