Repository navigation
feat(mcp): add feature-gated interactive pivot support - #43268
aminghadersohi wants to merge 6 commits into
Conversation
✅ 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 #43268 +/- ##
==========================================
+ Coverage 66.73% 66.75% +0.01%
==========================================
Files 2876 2877 +1
Lines 164278 164379 +101
Branches 37900 37937 +37
==========================================
+ Hits 109633 109723 +90
+ Misses 52483 52472 -11
- Partials 2162 2184 +22
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:
|
|
The flagged issue is correct. The To resolve this, you should update Would you like me to fetch all other comments on this PR to validate them and implement a minimal fix for all of them? superset/mcp_service/chart/plugin.py |
Code Review Agent Run #bab818Actionable Suggestions - 0Additional Suggestions - 4
Filtered 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 |
gabotorresruiz
left a comment
There was a problem hiding this comment.
Hey Amin, thanks for this one. The gating mechanism is really well built. I checked out the branch and exercised it over MCP HTTP: with the flag off, schema discovery and generate_chart both fail closed with DISABLED_CHART_TYPE, and with the flag on I generated and saved a real chart whose pivot_table_state, control names, and aggregation mapping all line up with what the target plugin consumes. Full tests/unit_tests/mcp_service passes locally (3,527 tests). I also verified your replies on the display-name and time-grain threads against source and I agree with both.
One thing is blocking for me, on the comparison fields; details inline. Happy to dig in with you if there is viz-side context I am missing.
Two smaller notes, neither blocking:
-
The pre-existing message in schema_validator.py ("registered but has been disabled by the operator", around line 189) is now reachable via the new
is_available()gate, and on a vanilla OSS deployment it fires for a visualization the host simply does not ship, sending an admin hunting for a setting that does not exist. Your new message in get_chart_type_schema.py ("The host deployment does not provide...") gets this right; a similarly neutral phrasing there, e.g. "is not available on this instance", would cover both causes. -
Future-direction note: the gap this PR closes for the pivot still exists for ag-grid-table. MainPreset.ts registers that viz only when
AG_GRID_TABLE_ENABLEDis on (default False in config.py), but the MCP table plugin advertisesviz_type="ag-grid-table"unconditionally, so MCP can offer and generate a chart the host will not render.is_available()is per chart_type so it does not directly fit a native viz_type gate, but it feels like the natural follow-up to this work. Worth a follow-up issue?
|
Addressed the remaining review concerns in
I agree the pre-existing Validation: full MCP chart suite 1,307 passed, focused review suite 226 passed, and changed-file pre-commit hooks passed. |
|
Tracked the AG Grid Table native-viz availability follow-up as SC-118029, scoped to variant-level discovery, validation, generation/update gating, and tests while preserving the regular OSS table adapter. |
|
Tracked the visualization-side time-comparison prerequisite and subsequent MCP restoration as SC-118030, so removing the unsupported fields here does not lose the original product requirement. |
There was a problem hiding this comment.
Code Review Agent Run #da35c7
Actionable Suggestions - 1
-
docs/docs/using-superset/using-ai-with-superset.mdx - 1
- Inaccurate documentation removal · Line 86-86
Filtered by Review Rules
Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.
-
superset/mcp_service/chart/schemas.py - 1
- Silent config field removal · Line 1299-1319
Review Details
-
Files reviewed - 9 · Commit Range:
447cc36..895af43- docs/docs/using-superset/using-ai-with-superset.mdx
- superset/mcp_service/chart/plugins/interactive_pivot.py
- superset/mcp_service/chart/resources/chart_configs.py
- superset/mcp_service/chart/schemas.py
- superset/mcp_service/chart/tool/get_chart_type_schema.py
- superset/mcp_service/chart/validation/schema_validator.py
- tests/unit_tests/mcp_service/chart/test_chart_utils.py
- tests/unit_tests/mcp_service/chart/test_interactive_pivot_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 an incremental AI Review. -
/review full- 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
gabotorresruiz
left a comment
There was a problem hiding this comment.
Thanks for the quick and thorough turnaround, Amin. I checked out 895af43 and re-verified everything empirically:
- map_interactive_pivot_config emits no comparison keys, and the published schema and examples contain none. A config that still carries time_compare or comparison_type now fails loudly with the same unknown-field hint every other chart type gives, which is the right shape for LLM self-correction, and nothing released ever wrote those keys into saved params.
- The disabled-chart detail now reads "not available on this instance" on the flag-off path; I confirmed the new wording end to end through SchemaValidator.
- tests/unit_tests/mcp_service/chart passes locally at this head (1,307 tests) and CI is green. The one smoke-test failure I saw locally reproduces identically at the previous head in my environment, so it is environmental, not this change.
Also appreciate the follow-up issues for the ag-grid-table availability gap and the visualization-side comparison prerequisite, plus the fixture rename. LGTM.
SUMMARY
Adds a distinct, feature-gated MCP adapter for Preset's
ag-grid-pivot-tablevisualization. This deliberately does not alias Interactive Pivot to the OSSpivot_table_v2adapter.The new
interactive_pivotschema and plugin cover:pivot_table_statefor the Rows, Column Labels, and Values side-panel bucketsAG_GRID_PIVOT_TABLE_ENABLEDfeature flag plus the existing MCP plugin filter, so OSS-only deployments do not advertise an unavailable visualizationThis implements the supported Interactive Pivot portion of SC-113786 and records the true AG Grid pivot as distinct from the OSS Pivot Table V2 delivered under SC-100129. Time comparison remains a visualization-side prerequisite: the current Preset plugin does not consume
time_compareorcomparison_type, so the MCP does not advertise those controls.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not applicable. This changes MCP schemas and form-data generation; it does not add or modify UI components.
TESTING INSTRUCTIONS
AG_GRID_PIVOT_TABLE_ENABLEDon a host that registers Preset's Interactive Pivot plugin.get_chart_type_schema("interactive_pivot")and verify the schema and examples are returned.viz_type=ag-grid-pivot-tableand its persisted grid state populates the AG Grid side-panel buckets.ag-grid-pivot-tableand UI-managed grid state such as sizing/filter/sort state is retained.DISABLED_CHART_TYPErather than offering a broken chart.Automated validation run:
ADDITIONAL INFORMATION
AG_GRID_PIVOT_TABLE_ENABLEDAI behavior / evaluation evidence
This is a deterministic schema, validation, and form-data mapping change. Unit tests cover schema examples, exact native viz resolution, feature-gated availability, validation, omission of unsupported comparison fields, side-panel state, update/preview preservation, capabilities, and generated naming. No model prompt, routing, retrieval, or sampling behavior changes.
Cost and latency
No additional model calls or network requests are introduced. Availability checks are in-process feature-flag lookups; chart mapping remains deterministic and local.