feat(mcp): add tags + typed metadata fields to update_dashboard#40957
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #40957 +/- ##
==========================================
+ Coverage 55.85% 64.55% +8.69%
==========================================
Files 2664 2664
Lines 146384 146472 +88
Branches 33852 33864 +12
==========================================
+ Hits 81764 94556 +12792
+ Misses 63880 50197 -13683
- Partials 740 1719 +979
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:
|
Code Review Agent Run #bed548Actionable Suggestions - 0Additional Suggestions - 2
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 |
|
Yes, this addition is intended to provide a new MCP tool for partially updating dashboard metadata. The |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Code Review Agent Run #a90e16Actionable 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 |
|
Re: "Missing test for empty tag list" — added |
Code Review Agent Run #55969dActionable Suggestions - 0Additional Suggestions - 1
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 |
Code Review Agent Run #925445Actionable 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 |
2f87654 to
7ea0150
Compare
Code Review Agent Run #b4634cActionable 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 |
Builds on the update_dashboard tool added in apache#40399 rather than adding a second tool. Extends its UpdateDashboardRequest with: - tags: full-replacement list of tag IDs, routed through the same validate_tags/update_tags helpers UpdateDashboardCommand uses - cross_filters_enabled, refresh_frequency, filter_bar_orientation: typed convenience fields that fold into json_metadata (so an LLM need not hand-build json_metadata_overrides for common toggles) - slug normalization mirroring the REST DashboardPutSchema contract - validate_css parity so the tool rejects the same CSS the REST path does A key set via both a typed field and json_metadata_overrides is rejected as ambiguous; the generic overrides dict remains an escape hatch.
Collapses the two-line `parsed = ...; if isinstance(parsed, dict):` into a single walrus expression to satisfy the auto-walrus pre-commit hook.
- Slug normalizer: raise ValueError when non-empty input normalizes to empty string (e.g. "!!!") instead of silently clearing the slug. Adds a test case for the new validation. - Tag validation: catch SQLAlchemyError in the pre-flight validate_tags call, which runs before the main SQLAlchemyError handler and was previously unguarded against DB errors. - String concatenation: make all + joins explicit (no implicit ISC) in _collect_metadata_overrides to satisfy ruff-format 0.9.7. - Type annotations: add return types to mcp_server fixture and _mock_dashboard helper; add Mock/object param types to all test methods.
8921430 to
e37a832
Compare
- Annotate _TYPED_METADATA_FIELDS as tuple[str, ...] - Annotate local dict comprehension `typed` as dict[str, Any] - Annotate `metadata_overrides` as dict[str, Any] - Annotate `validation_error` as DashboardError | None
The slug validator was raising ValueError for whitespace-only slugs (e.g. " ") instead of normalizing them to empty string the way the REST DashboardPutSchema does. Added an early-strip check so whitespace-only inputs return "" (clears slug) consistent with the REST update path. The test's match regex "normalizes to an empty" did not match the actual error message; updated to "characters that are removed during normalization" and added a whitespace-only assertion.
Code Review Agent Run #8d78b0Actionable 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 |
SUMMARY
Extends the
update_dashboardMCP tool (added in #40399) with four metadata capabilities, instead of shipping a second, overlapping tool.Added to
UpdateDashboardRequest/ the existing tool:tags— full-replacement list of tag IDs, routed through the samevalidate_tags/update_tagshelpersUpdateDashboardCommanduses (identical custom-tag semantics, permission + existence checks).json_metadatatoggles —cross_filters_enabled,refresh_frequency(seconds, 0 = off),filter_bar_orientation(VERTICAL/HORIZONTAL), so an LLM does not have to hand-build the rawjson_metadata_overridesdict for common operations.DashboardPutSchemacontract (strip, spaces → hyphens, drop chars outside[\w-]).validate_cssthe REST update path uses, so the tool rejects CSS the API would reject.Design notes:
json_metadata_overridesis rejected as ambiguous (clear validation error); the genericjson_metadata_overridesdict remains an escape hatch for keys without a typed field.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A (MCP service, no UI changes)
TESTING INSTRUCTIONS
update_dashboardwith{"identifier": <id>, "tags": [<tag_id>], "refresh_frequency": 300}and verify tags are replaced and the refresh interval is stored injson_metadata.cross_filters_enabledandjson_metadata_overrides: {"cross_filters_enabled": ...}and verify it is rejected as a conflict.pytest tests/unit_tests/mcp_service/dashboard/tool/test_update_dashboard.pyADDITIONAL INFORMATION