Repository navigation
feat(mcp): add typed Sunburst chart support - #43771
Conversation
Code Review Agent Run #eec59fActionable Suggestions - 0Additional Suggestions - 6
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 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #43771 +/- ##
==========================================
+ Coverage 82.74% 82.77% +0.02%
==========================================
Files 3013 3016 +3
Lines 188491 192300 +3809
Branches 43761 44731 +970
==========================================
+ Hits 155963 159169 +3206
- Misses 29758 30098 +340
- Partials 2770 3033 +263
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:
|
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Code Review Agent Run #d98b39Actionable Suggestions - 0Additional Suggestions - 9
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 |
Code Review Agent Run #3f2309Actionable Suggestions - 0Additional Suggestions - 15
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 |
Code Review Agent Run #07c451Actionable Suggestions - 0Additional Suggestions - 17
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 |
Code Review Agent Run #82b6e5Actionable Suggestions - 0Additional Suggestions - 6
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 |
There was a problem hiding this comment.
Code Review Agent Run #4d446c
Actionable Suggestions - 2
-
superset/mcp_service/utils/response_utils.py - 1
- bool/int unique_count collision · Line 253-255
-
superset/mcp_service/chart/tool/get_chart_data.py - 1
- Decimal type detection removed · Line 261-261
Additional Suggestions - 2
-
superset/mcp_service/chart/query_result.py - 1
-
Oversized string raises AssertionError · Line 200-202Data strings longer than `MAX_RESULT_STRING_LENGTH` (65,536) now hit `assert size is not None` in `_normalized_scalar_json_size`, raising an uncaught `AssertionError`. The removed `_charge_text` path returned `"invalid text data"` instead. Callers `get_table.py`/`query_dataset.py` don't catch exceptions, so this is a behavior regression. Return `None` and emit the graceful error.
-
-
tests/unit_tests/mcp_service/chart/query_result_fixtures.py - 1
-
Empty-list falsy default · Line 55-55`coltypes = coltypes or [...]` treats an explicitly-passed empty list `coltypes=[]` as falsy and silently substitutes NUMERIC defaults, unlike the `is not None` checks on lines 53-54. No current caller passes `coltypes=[]`, so this is latent, but an empty-result caller would get unexpected coltypes. Consider `if coltypes is None` for consistency.
-
Review Details
-
Files reviewed - 15 · Commit Range:
813b15f..63c6cdc- superset/mcp_service/chart/query_result.py
- superset/mcp_service/chart/tool/get_chart_data.py
- superset/mcp_service/dataset/tool/query_dataset.py
- superset/mcp_service/semantic_layer/tool/get_table.py
- tests/unit_tests/mcp_service/chart/query_result_fixtures.py
- tests/unit_tests/mcp_service/chart/test_compile.py
- tests/unit_tests/mcp_service/chart/test_preview_utils.py
- tests/unit_tests/mcp_service/chart/test_query_result.py
- tests/unit_tests/mcp_service/chart/test_sunburst_chart.py
- tests/unit_tests/mcp_service/chart/tool/test_get_chart_data.py
- tests/unit_tests/mcp_service/chart/tool/test_get_chart_preview.py
- tests/unit_tests/mcp_service/dataset/tool/test_query_dataset.py
- tests/unit_tests/mcp_service/semantic_layer/tool/test_get_table.py
- superset/mcp_service/utils/response_utils.py
- tests/unit_tests/mcp_service/utils/test_response_utils.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 evan@preset.io.
Documentation & Help
Code Review Agent Run #e5e4cfActionable 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 |
Code Review Agent Run #c11764Actionable Suggestions - 0Additional Suggestions - 6
|
Code Review Agent Run #c5cd0eActionable 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 |
There was a problem hiding this comment.
Code Review Agent Run #bb24a2
Actionable Suggestions - 1
-
superset/mcp_service/chart/tool/get_chart_data.py - 1
- Exact-type guard breaks parse fallback · Line 450-452
Additional Suggestions - 7
-
tests/unit_tests/mcp_service/dataset/tool/test_query_dataset.py - 3
-
fold=1 offset expectation wrong · Line 599-599`fold=1` on 2024-10-27 01:30 in `Europe/Dublin` denotes the second occurrence after clocks fall back, which is GMT (+00:00), not IST (+01:00). The expected `+01:00` is semantically inconsistent with Python/dateutil fold semantics. Verify `_dateutil_named_offset_without_hooks`'s `if not value.fold and is_ambiguous: index -= 1` branch; either the expectation should be `+00:00` or the source's fold handling is inverted.
-
Vacuous secret-leak assertion · Line 337-337`HostileRuntimeError.__str__`/`__repr__` return `"round21-hostile-runtime-secret"`, never the constructor arg `"stored-secret"`. So this assertion checks a literal that can never appear and would pass even if the secret leaked. Assert the real leakable string so the containment test actually verifies its claim.
-
Unmocked DB lookup in unit test · Line 298-313In the `context-exit` branch `resolve_dataset` is left unmocked, so the test performs a real `DatasetDAO.find_by_id(1)` DB lookup before the context `__exit__` raises. Every other test in this file mocks `resolve_dataset` (e.g. lines 570, 626). Mock it here too for a deterministic unit test.
-
-
tests/unit_tests/mcp_service/chart/tool/test_get_chart_data.py - 1
-
Duplicated test setup · Line 961-989Both new tests duplicate the same `_Command` stub, `form_data`, and five `monkeypatch.setattr` calls (lines 902-923 vs 961-989). If one setup block is later updated (e.g. a new mock) and the other is not, the two tests silently diverge. Consider a shared fixture/helper to keep the timezone assertions the only difference.
-
-
tests/unit_tests/mcp_service/chart/tool/test_get_chart_sql.py - 1
-
Test no longer near boundary · Line 428-428`test_extract_sql_accepts_multi_query_and_near_response_boundary` only patches `_get_chart_sql_mod.MAX_QUERY_RESULT_VALUE_BYTES`, but the boundary case flows through `response_json_failure`, which reads the constant from `query_result` (still 16 MiB). So `boundary_sql = test_limit - 512` (3584 B) is no longer near the response limit, and the test no longer verifies its stated purpose. Patch `query_result.MAX_QUERY_RESULT_VALUE_BYTES` too, as the sibling test does.
-
-
superset/mcp_service/chart/response_preflight.py - 1
-
Missing unit tests · Line 45-80This new helper is now used at 10+ call sites across `get_chart_data.py`, `query_dataset.py`, and `get_table.py`, yet has no unit tests. Its byte-budget truncation, multi-byte UTF-8 handling, and type-dispatch branches are non-trivial (C901-suppressed). Per BITO.md rules 11730/11731, add tests covering success paths, edge cases, and the 'request failed' fallback.
-
-
tests/unit_tests/mcp_service/chart/query_result_fixtures.py - 1
-
Nested ternary readability · Line 82-90The nested conditional expression for deriving `columns` is hard to read and error-prone. Consider refactoring to use explicit `if/elif/else` statements for clarity and easier maintenance.
-
Review Details
-
Files reviewed - 12 · Commit Range:
0ae605f..414c7a6- superset/mcp_service/chart/response_preflight.py
- superset/mcp_service/chart/tool/get_chart_data.py
- superset/mcp_service/dataset/tool/query_dataset.py
- superset/mcp_service/semantic_layer/tool/get_table.py
- tests/unit_tests/mcp_service/chart/test_query_result.py
- tests/unit_tests/mcp_service/chart/test_response_preflight.py
- tests/unit_tests/mcp_service/chart/tool/test_get_chart_data.py
- tests/unit_tests/mcp_service/chart/tool/test_get_chart_sql.py
- tests/unit_tests/mcp_service/dataset/tool/test_query_dataset.py
- tests/unit_tests/mcp_service/semantic_layer/tool/test_get_table.py
- superset/mcp_service/chart/query_result.py
- tests/unit_tests/mcp_service/chart/query_result_fixtures.py
-
Files skipped - 1
- .github/workflows/superset-python-unittest.yml - Reason: Filter setting
-
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 evan@preset.io.
Documentation & Help
# Conflicts: # superset/mcp_service/chart/tool/get_chart_data.py # tests/unit_tests/mcp_service/chart/tool/test_get_chart_data.py
|
@michael-s-molina @msyavuz this is approved by @sadpandajoe and waiting on a code owner stamp. Could one of you take a look when you get a chance? Thanks! |
Keep saved temporal range filters when only the aggregation grain changes. Skip rolling and forecast analytics on bounded compile samples without changing full chart queries. Document non-finite export normalization and cover CSV and both XLSX writers.
SUMMARY
Adds complete typed MCP support for the frontend ECharts Sunburst plugin using the exact
sunburst_v2viz tag and the typedchart_type="sunburst"discriminator.Registers ordered hierarchy, saved/SIMPLE/SQL primary and secondary metrics, filters/time controls, ordering/limits, presentation controls, schema discovery, previews, and recommendation metadata. A supplied secondary metric drives sequential coloring through its ratio to the primary metric; omitting it uses categorical colors.
Preserves native/plugin presentation controls on same-viz updates while replacing every target-owned query-role alias from the chart plugin registry before overlay. This removes stale singular/plural, raw/aggregate, primary/secondary, pivot, series, and x-axis roles across every enabled registered native viz alias and table/Handlebars query mode.
Treats an explicit null temporal range, column, or grain as an atomic clear across top-level range/granularity/grain keys, adhoc filters, top-level legacy
filters/extra_filters, and nestedextra_form_datafilters while retaining unrelated predicates.Seeds
g.form_datawithset_query_context_form_dataimmediately beforeChartDataCommand.run()for saved ASCII, table, and Vega-Lite previews, so virtual-dataseturl_param,filter_values, andget_filtersJinja macros receive the saved query fields.Retains strict first-query result handling, operation-owned chart/datasource identity, exact/unique-casefold namespace resolution, native WHERE semantics, finite numeric Sunburst result validation, and programmatic query-context seeding for all other compile/preview paths.
Normalizes SQL NULL Sunburst metrics to frontend zero in compile, preview, and data/export paths, while retaining strict field/alias and finite-numeric checks.
Accepts the exact Superset
CACHE_DISABLED_TIMEOUT = -1result metadata sentinel.Maintainer coordination
sort_by_metricbehavior, and shared MCP update semantics.Scope and review map
A file-by-file audit separated the original 77-file diff into four groups:
The independently testable incidental work is being separated without rewriting this ready PR:
Landing order: #44218 and #44219 first (independent), then #43771. Current master has been integrated into #43771 with a normal merge commit; the duplicated #44219 files remain until that dependency lands.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Screenshots
Sunburst created by the MCP
generate_charttool and opened in Explore: hierarchyterritory->country->product_line, primary metricSUM(sales). The native Sunburst controls are populated from the MCP config.secondary_metric(SUM(quantity_ordered)) over the primary metric drives the sequential colour scale; omitting it gives categorical colours.The rendered
sunburst_v2panel, showing the three hierarchy rings and the total.Captured at
5b0df699. Captured on a local dev env (docker-compose-light) against the Superset examples datasetcleaned_sales_data; both charts were created through the MCPgenerate_charttool.No frontend component changes. MCP gains typed Sunburst support and frontend-faithful NULL aggregate behavior.
TESTING INSTRUCTIONS
Python 3.11, with the repository and
superset-core/srconPYTHONPATH:Regressions cover UTC/named/static pytz zones, both DST-fold occurrences and nanoseconds; short/default/tall Sunburst canvases, omitted-row accounting, wide/combining Unicode and clipping markers; aggregate/raw paginated Table export rebuilds without page-size truncation/count sheets; and distinct bounded Decimal fraction identities. Existing NULL compile/preview/data/export tests remain passing.
Exact-head CI: head
fb3e2c40d798223d3910fde661cb93c0ccb83717is mergeable. Focused Gauge, Sunburst, and chart-data tests pass (656 passed, 1 skipped), and merge-conflict pre-commit passes. Integration/E2E checks are blocked by the two migration heads present on currentmaster(c7f53d184ea2and88a01c781622).All 21 live review threads are resolved. The scope/reviewability request is addressed with two companion PRs, removal of the Excel and unrelated CI-timeout diffs from this branch, and the evidence-backed review/dependency map above. The PR is OPEN / non-draft / MERGEABLE, with REVIEW_REQUIRED plus the upstream migration-head CI blocker. Local, tracking, fork, and live PR heads match; the worktree is clean.
Local HTTP health is unavailable, so browser/manual runtime testing is not claimed.
ADDITIONAL INFORMATION