Skip to content

feat(mcp): waterfall chart type plugin - #42070

Merged
rusackas merged 7 commits into
apache:masterfrom
gkneighb:feat/mcp-waterfall-plugin
Jul 17, 2026
Merged

rusackas merged 7 commits into
apache:masterfrom
gkneighb:feat/mcp-waterfall-plugin

Conversation

@gkneighb

Copy link
Copy Markdown
Contributor

SUMMARY

Adds a waterfall chart type plugin to the MCP generate_chart registry (#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:

  • form_data verified against the frontend plugin source, not assumed: x_axis (single step-per-value column, temporal-friendly), single-select groupby breakdown (the Waterfall controlPanel sets multi: false — the config field is a single breakdown: ColumnRef accordingly, not a list), single metric, and the display options (show_total default true per the controlPanel, increase/decrease/total labels matching constants.ts). row_limit defaults to the shared 10000.
  • Native vocabulary accepted: groupby is a validation alias for breakdown, per the codebase's translate-don't-refuse convention.
  • Dimension fields reject metric-style refs (saved_metric/sql_expression on x_axis/breakdown), consistent with the tightened validation in feat(mcp): histogram and box plot chart type plugins #41860.
  • Preview classification included from the start: waterfall maps 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.
  • Stale chart-type-count references were swept: the two remaining "7 chart types" comments in validator/utils docstrings were made count-agnostic so they can't rot again.
  • get_chart_type_schema gains the type with two examples; generate_chart docstring and server instructions updated.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A (MCP service; no UI changes)

TESTING INSTRUCTIONS

pytest tests/unit_tests/mcp_service/chart/test_waterfall_chart.py  # 13 new tests
pytest tests/unit_tests/mcp_service/chart/                          # full chart suite

Manual: via an MCP client, generate_chart with
{"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

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

🤖 Generated with Claude Code

https://claude.ai/code/session_014z1fQxTadTEvpCJLx9WnB8

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
@bito-code-review

bito-code-review Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #2cbd55

Actionable Suggestions - 0
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • superset/mcp_service/chart/plugins/waterfall.py - 1
Review Details
  • Files reviewed - 11 · Commit Range: 000114d..000114d
    • superset/mcp_service/app.py
    • superset/mcp_service/chart/chart_utils.py
    • superset/mcp_service/chart/plugins/__init__.py
    • superset/mcp_service/chart/plugins/waterfall.py
    • superset/mcp_service/chart/schemas.py
    • superset/mcp_service/chart/tool/generate_chart.py
    • superset/mcp_service/chart/tool/get_chart_preview.py
    • superset/mcp_service/chart/tool/get_chart_type_schema.py
    • superset/mcp_service/chart/validation/dataset_validator.py
    • tests/unit_tests/mcp_service/chart/test_waterfall_chart.py
    • tests/unit_tests/mcp_service/chart/tool/test_get_chart_type_schema.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@netlify

netlify Bot commented Jul 15, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 9662ab8
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a583b02c16c9a0008fca373
😎 Deploy Preview https://deploy-preview-42070--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.

@codecov

codecov Bot commented Jul 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 37.19008% with 76 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.98%. Comparing base (8ce6d42) to head (10daf20).
⚠️ Report is 42 commits behind head on master.

Files with missing lines Patch % Lines
superset/mcp_service/chart/plugins/waterfall.py 29.85% 47 Missing ⚠️
superset/mcp_service/chart/schemas.py 50.00% 22 Missing ⚠️
superset/mcp_service/chart/chart_utils.py 12.50% 7 Missing ⚠️
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     
Flag Coverage Δ
hive 38.98% <37.19%> (-0.05%) ⬇️
mysql 57.68% <37.19%> (-0.08%) ⬇️
postgres 57.74% <37.19%> (-0.08%) ⬇️
presto 40.95% <37.19%> (-0.06%) ⬇️
python 59.16% <37.19%> (-0.09%) ⬇️
sqlite 57.35% <37.19%> (-0.08%) ⬇️
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.

…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
Comment thread superset/mcp_service/chart/schemas.py Resolved
…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
@bito-code-review

bito-code-review Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #d91189

Actionable Suggestions - 0
Review Details
  • Files reviewed - 6 · Commit Range: 000114d..3a65b67
    • superset/mcp_service/chart/chart_utils.py
    • superset/mcp_service/chart/schemas.py
    • superset/mcp_service/chart/tool/get_chart_type_schema.py
    • superset/mcp_service/chart/validation/dataset_validator.py
    • tests/unit_tests/mcp_service/chart/test_waterfall_chart.py
    • tests/unit_tests/mcp_service/chart/tool/test_get_chart_type_schema.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@aminghadersohi aminghadersohi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread superset/mcp_service/chart/schemas.py Resolved
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 aminghadersohi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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):

Comment thread superset/mcp_service/chart/schemas.py Resolved
@bito-code-review

bito-code-review Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #3c5c42

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset/mcp_service/chart/schemas.py - 1
    • Inconsistent default values · Line 2045-2047
      The `show_legend` default for `WaterfallChartConfig` differs from `PieChartConfig` (line 1069) and `MixedChartConfig` (line 1224) which both default to `True`. The updated description references 'frontend default: off' but the actual frontend default should be verified. Consider documenting why waterfall charts have a different default from other chart types, or adding a comment explaining this is intentional alignment.
Review Details
  • Files reviewed - 1 · Commit Range: 3a65b67..57e728b
    • superset/mcp_service/chart/schemas.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

Greg Neighbors and others added 2 commits July 16, 2026 21:33
- 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
Comment thread superset/mcp_service/chart/schemas.py Resolved
Comment thread superset/mcp_service/chart/schemas.py Resolved
@bito-code-review

bito-code-review Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #06ead4

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: 57e728b..09e18c7
    • superset/mcp_service/chart/chart_utils.py
    • superset/mcp_service/chart/schemas.py
    • tests/unit_tests/mcp_service/chart/test_waterfall_chart.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@aminghadersohi aminghadersohi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Comment thread superset/mcp_service/chart/schemas.py Resolved
…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 aminghadersohi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both round-3 findings are fixed correctly, verified at the source level:

  • x_axis bare strings are now coerced the same way groupby/breakdown already were, with a direct test.
  • The temporal-grain check landed as WaterfallChartPlugin.post_map_validate() rather than threading dataset_id into the mapper — that's actually the established pattern here (mirrors BigNumberChartPlugin's trendline temporal check), and I confirmed dataset_id genuinely reaches it via generate_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.

@rusackas
rusackas merged commit a99c98c into apache:master Jul 17, 2026
59 checks passed
@bito-code-review

Copy link
Copy Markdown
Contributor

Bito Automatic Review Skipped – PR Already Merged

Bito scheduled an automatic review for this pull request, but the review was skipped because this PR was merged before the review could be run.
No action is needed if you didn't intend to review it. To get a review, you can type /review in a comment and save it

@gabotorresruiz gabotorresruiz mentioned this pull request Sep 8, 2026
2 of 9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants