Repository navigation
feat(mcp): add typed geographic chart generation - #44148
Conversation
Code Review Agent Run #4f89e9Actionable Suggestions - 0Additional Suggestions - 20
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 #44148 +/- ##
==========================================
+ Coverage 82.85% 82.90% +0.05%
==========================================
Files 3017 3024 +7
Lines 192909 193634 +725
Branches 44974 45167 +193
==========================================
+ Hits 159836 160537 +701
+ Misses 30034 30025 -9
- Partials 3039 3072 +33
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:
|
|
Validation update for exact head |
|
CI budget follow-up in Also reused the compiled chart union adapter in the new tests while retaining fresh model instances, with three isolation regression cases. Coverage-instrumented focused runs: 167 tests in 58.22s before, 170 in 57.36s after—only a small improvement, not enough to solve the shared job budget. Pre-commit including MyPy/Ruff/workflow audit passed; explicit Pylint scored 10/10. Fresh exact-head CI is running. No actionable review comments were present when refetched. |
|
Follow-up complete: all 13 required checks are green on Python CI run completed in 33m03s, confirming the old 30-minute budget was insufficient:
Local exact-head validation: 4,134 MCP tests passed, 1 skipped; focused geographic coverage run 170 passed; full branch pre-commit/MyPy/Ruff/Pylint checks passed. No retries were needed on this head. Reviews and inline comments were refetched at completion; no actionable feedback was present. This supersedes the earlier timeout-blocked status. |
|
Maintainer follow-up in Response to the additional suggestions in the review report:
Validation: 4,162 MCP tests passed, 2 skipped; 180 focused geographic tests passed; 181 frontend tests passed across 16 suites; native plugin TypeScript builds and full branch pre-commit/MyPy/Ruff/Pylint/type/lint checks passed. Exact-head CI is pending. There were no inline review threads to resolve; none were marked resolved. |
|
Finite maintainer pass complete: all 13 required checks are green on
Tracking linkage is preserved. The branch was updated through a normal upstream merge and normal push; the worktree is clean. |
There was a problem hiding this comment.
Code Review Agent Run #51cfc3
Actionable Suggestions - 1
-
superset-frontend/plugins/preset-chart-deckgl/src/layers/Scatter/transformProps.ts - 1
- Undeclared form-data property access · Line 176-176
Review Details
-
Files reviewed - 5 · Commit Range:
4f08115..696f569- docs/admin_docs/configuration/mcp-server.mdx
- superset-frontend/plugins/preset-chart-deckgl/src/layers/Scatter/transformProps.test.ts
- superset-frontend/plugins/preset-chart-deckgl/src/layers/Scatter/transformProps.ts
- superset/mcp_service/chart/chart_utils.py
- tests/unit_tests/mcp_service/chart/test_geographic_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
- Eslint (Linter) - ✔︎ 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
Code Review Agent Run #a48c10Actionable 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 |
A saved map with granularity_sqla and a bounded time_range lost its time filter after an update omitting temporal controls, because the typed Scatter query and the shared map query never bound the legacy time column. Bind granularity_sqla (or a dashboard granularity override) in all geographic queries while typed points still skip time bucketing.
Code Review Agent Run #7cf8cbActionable 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 |
…andling - Reject a deck_scatter dimension that reuses a coordinate column. - Require exact boundary ISO codes for the legacy country-map format. - Normalize a preserved numeric-string radius to an explicit fixed radius on typed updates, and apply the same rule in Scatter buildQuery. - Strengthen the full-bounded-result test with two valid rows first.
Supply the security-manager access decision for geographic tool fixtures so the target-dataset check added on master uses the same controlled access as sibling entry points. Assert that rebinds check the dataset without bypassing the production auth helper.
There was a problem hiding this comment.
Code Review Agent Run #5bf46d
Actionable Suggestions - 3
-
superset-frontend/plugins/preset-chart-deckgl/src/layers/Scatter/buildQuery.ts - 1
- Misplaced shared helper · Line 58-68
-
superset/utils/geographic.py - 2
- Boolean flag over explicit mode enum · Line 40-40
- Parameter shadows deleted set name · Line 53-53
Additional Suggestions - 3
-
superset-frontend/plugins/preset-chart-deckgl/src/layers/Scatter/buildQuery.test.ts - 2
-
Inconsistent test title prefix · Line 548-548Every other test in `buildQuery.test.ts` titles itself 'Scatter buildQuery …' (28 occurrences, e.g. lines 505, 519); this new test at line 548 says 'native buildQuery', a term this file never uses elsewhere. Aligning the title keeps the suite's naming convention consistent and grep-friendly.
-
Missing falsy-flag test case · Line 534-546This `test.each` only exercises `mcp_geographic: true`. The negative branch — `getTypedFixedRadius` returning `null` when the flag is falsy, so the numeric-string stays a saved metric — is asserted only for the default (no-flag) form at line 548, never for `mcp_geographic: false`/`undefined`, which `transformProps.test.ts:602` does cover. Add those cases so the flag's falsy values are pinned here too.
-
-
superset/mcp_service/chart/plugins/geographic.py - 1
-
Signature drift from base hook · Line 646-646The base hook `BaseChartPlugin.validate_merged_form_data` (`plugin.py:331`) types `dataset_context` as `Callable[[], Any] | None`; this override widens it to `Any`. The preview caller (`update_chart_preview.py:280-285`) already passes a lambda, so behavior is unchanged today, but the drifted annotation defeats static checking for future callers. Aligning the type is a two-line change.
-
Review Details
-
Files reviewed - 8 · Commit Range:
f1a5f67..e97884a- superset-frontend/plugins/preset-chart-deckgl/src/layers/Scatter/buildQuery.test.ts
- superset-frontend/plugins/preset-chart-deckgl/src/layers/Scatter/buildQuery.ts
- superset-frontend/plugins/preset-chart-deckgl/src/layers/Scatter/transformProps.ts
- superset/mcp_service/chart/plugins/geographic.py
- superset/mcp_service/chart/schemas.py
- superset/utils/geographic.py
- tests/unit_tests/mcp_service/chart/test_geographic_chart.py
- docs/admin_docs/configuration/mcp-server.mdx
-
Files skipped - 0
-
Tools
- MyPy (Static Code Analysis) - ✔︎ Successful
- Astral Ruff (Static Code Analysis) - ✔︎ Successful
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
- Eslint (Linter) - ✔︎ 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
Code Review Agent Run #212366Actionable 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 |
…t-types # Conflicts: # docs/admin_docs/configuration/mcp-server.mdx
|
@villebro @rusackas @sha174n @p2er this is approved by @sadpandajoe and @rebenitez1802 and waiting on a code owner stamp (it touches the country-map plugin). Could one of you take a look when you get a chance? Thanks! |
Reconcile the geographic chart plugins with master's shared query-context and update-merge refactor: - Build Deck.gl layer queries through the shared frontend-equivalent adapter - Declare geographic query-role keys and own the same-viz update merge - Apply explicit time overrides on conversions via finalize_update_form_data - Keep disabled types editable only in place across update entry points
SUMMARY
Add end-to-end typed geographic chart generation to MCP so migration and chart-building clients can discover and create native maps instead of substituting unrelated charts.
Public contract
generate_chart,update_chart, andgenerate_explore_linkshare three new config discriminators:country_map,world_map, anddeck_scatter. Separate types match native visualization keys and existing runtime capability probes.get_chart_type_schemareturns closed, bounded schemas and examples for each; no consuming-skill changes are needed.{"chart_type":"country_map","country":"usa","region_format":"abbreviation","entity":{"name":"state"},"metric":{"name":"sales","aggregate":"SUM"},"filters":[{"column":"country","op":"IN","value":["USA"]}]}{"chart_type":"world_map","country_format":"cca2","entity":{"name":"country"},"metric":{"name":"sales","aggregate":"SUM"},"show_bubbles":true,"secondary_metric":{"name":"population","aggregate":"SUM"}}{"chart_type":"deck_scatter","latitude":{"name":"latitude"},"longitude":{"name":"longitude"},"radius_metric":{"name":"orders","aggregate":"COUNT"},"point_unit":"square_m"}Pass one of these objects inside
config, alongside the tool's dataset/chart identifier.Behavior and validation
usa,canada,australia,japan,uk) and value format (name,abbreviation,iso_3166_2). Resolution uses the actual bundled GeoJSON identifiers: exact matches first, then only unique case/diacritic-insensitive matches. There is no fuzzy geocoding. Compact backend/frontend lookups have geometry-parity tests.UnsupportedGeographicPreview, never a misleading bar chart or invented map geometry.Compatibility
The branch incorporates upstream Country Map conditional formatting with a regression test for formatting normalized regions. Existing non-geographic types retain their behavior, including raw Gauge data exports. Legacy native maps retain their existing behavior unless the explicit regional format or typed MCP contract is selected. Boundary coverage is deliberately bounded and is not a complete ISO registry. Point basemap requests still depend on browser network access and deployment policy.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Screenshots
country_map — US births by state. The typed config drives the native controls: Country USA, ISO 3166-2 Codes = state, Region value format = ISO suffix / abbreviation, SUM(num).
world_map — population by country with bubbles. Country Field Type = code ISO 3166-1 alpha-3 (cca3), choropleth on SUM(SP_POP_TOTL), bubbles sized by the secondary metric (205 countries).
deck_scatter — 10k San Francisco addresses from LON/LAT, autozoomed to the data.
Captured at
4e4c7858. Local docker-compose-light dev env with the examples dataset. All three charts were created through the MCP generate_chart tool (save_chart=true) and opened in Explore. The deck.gl basemap tiles do not paint under headless capture; the stock Superset deck.gl Scatterplot example renders identically here, so it is a capture artifact and not a change in this PR.Before: these geographic MCP config discriminators were unavailable.
After: clients discover real schemas and generate native maps. A Jest rendering test runs the real D3 projection against USA GeoJSON, verifies a shaded California path, and verifies cross-filtering on the original
CAvalue.No live deployment/browser screenshot verification was performed. The local UI health endpoint was unavailable and the available staging connector required reauthentication; the rendering evidence above is initialized, in-process coverage, not a claim that a saved chart was visually inspected in a live deployment.
TESTING INSTRUCTIONS
Automated validation:
git diff --checkpass. Native plugin TypeScript project builds pass.setup.pyversion-metadata generation; without generated version metadata, an unrelated health-check smoke failure reproduced on untouched upstream master.CI budget follow-up (
9f8983f): both prior attempts passed 15,248 main unit tests, then exhausted the 30-minute job budget during the independent coverage phase. The job uses the shared 40-minute adjustment from #43770/#43771; all test commands, independent 100% gates, and coverage uploads are unchanged. Geographic tests reuse the compiled config schema without sharing mutable configs (three added isolation cases). Coverage-instrumented focused runs: 167 passed in 58.22s before, 170 passed in 57.36s after. All 13 required exact-head checks are green. The Python job completed in 33m03s: 15,270 main tests passed (5 skipped, 2 xfailed), followed by 1,717 SQL tests and 437 semantic-layer tests, each reaching its unchanged 100% coverage threshold. Successful exact-head run. Prior timeout evidence.Manual verification:
get_chart_type_schema, then create a saved chart using the returned schema.California,CA, andUS-CAwith their respective formats. Verify a non-USA value such asBCfails clearly instead of leaving a blank map; selecting Canada resolvesBC.ADDITIONAL INFORMATION
Maintainer pass (
7975e11): merged upstream39944ff, retained both conflicting documentation sections, and addressed the concrete review suggestions with regression coverage. Full MCP (4,162 passed, 2 skipped), focused geographic (180 passed), frontend (181 passed), native TypeScript builds, and full branch pre-commit checks pass. All 13 required exact-head checks are green on7975e11. Python CI: 15,288 main tests passed, then both independent 100% coverage gates passed (1,717 SQL tests and 437 semantic-layer tests). The Cypress infrastructure retry also passed; its first attempt failed before tests because the Chrome package mirror returned an inconsistent index size.Reviewer follow-up (
688aa8d): fixed geographic saved/preview dataset rebinding through the strict path and accepted finite database Decimal/real query coordinates and metrics before JSON conversion. Added fail-before/pass-after public FastMCP regressions, saved/cached exports, exact Decimal bounds, and invalid numeric cases. Local full MCP: 4,221 passed, 2 skipped; full branch static checks pass. Upstream1b03ad8is merged with Treemap and geographic support retained. All 13 required checks are green on688aa8d. Exact-head Python CI: 15,351 main tests passed; both independent 100% gates passed (1,717 SQL and 437 semantic-layer tests). Both reviewer threads have individual evidence replies and are fully addressed. No retries were needed on this head.Reviewer follow-up (
af5a062): merged upstreammaster(UPDATING.md kept both entries). Gantt compile errors returnCHART_COMPILE_FAILED; only Gantt bypasses the empty saved Vega-LiteNoDataError; country-map blank-metric regions cross-filter/drill on their source value;select_countryis case-insensitive; a world mapsecondary_metricwith bubbles off no longer gates the choropleth (backend and frontend);GB-WRLis labeled Wirral in both the GeoJSON and the region tables; skipped deck_scatter points log a count. Local: MCP unit tests 6,543 passed (3test_mcp_cachingcatalog failures reproduce on untouched master with the locally installed FastMCP 3.4.2, not the pinned 3.4.7); 15 frontend suites / 169 tests pass; branch pre-commit (MyPy, Ruff, Pylint, oxfmt, oxlint, frontend type check) passes.