Skip to content

fix(mcp): auto-generate empty dashboard titles - #45799

Open
aminghadersohi wants to merge 2 commits into
apache:masterfrom
aminghadersohi:fix-mcp-empty-dashboard-title
Open

aminghadersohi wants to merge 2 commits into
apache:masterfrom
aminghadersohi:fix-mcp-empty-dashboard-title

Conversation

@aminghadersohi

@aminghadersohi aminghadersohi commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

SUMMARY

Treat an empty generate_dashboard title exactly like a whitespace-only or omitted title: normalize it to None, then generate a descriptive title from the chart names. Remove the intentional-blank-title exception. The dashboard_title, title, and name aliases share the behavior.

Update the schema description, tool docstring, user documentation, and regression coverage (including byte-string inputs).

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

No UI change. Before: dashboard_title: "" persists an empty title. After: it persists the same chart-derived title as whitespace-only input.

TESTING INSTRUCTIONS

Call generate_dashboard with an accessible chart and compare dashboard_title: "", " ", and an omitted title. All should save the same nonblank chart-derived title.

Automated validation:

PYTHONPATH=$PWD/superset-core/src:$PWD pytest -q \
  tests/unit_tests/mcp_service/dashboard/test_dashboard_schemas.py \
  tests/unit_tests/mcp_service/dashboard/tool/test_dashboard_generation.py \
  tests/unit_tests/mcp_service/dashboard/tool/test_update_dashboard.py \
  tests/unit_tests/mcp_service/dashboard/tool/test_duplicate_dashboard.py \
  tests/unit_tests/mcp_service/chart/test_chart_schemas.py \
  tests/unit_tests/mcp_service/test_sanitization_warning_inputs.py \
  -m 'not manual and not llm_compliance'

Result: 2211 passed.

Revert-fails: restored superset/mcp_service/dashboard/schemas.py from the base while retaining the regression tests, then ran the schema, generation, and sanitization-warning modules with -k 'blank_title_uses_auto_title or blank_title_auto_generated or blank_titles_normalize_before_length': 16 failed, 287 passed, 1731 deselected, exit 1. Failures cover empty strings through all three dashboard aliases, the saved title in the tool call, and string/bytes/bytearray normalization. Whitespace and sibling-tool checks still pass. Restored the implementation afterward: 303 passed, 1731 deselected, exit 0, with the same selection.

Scoped pre-commit run: passed, including mypy. Real-model tests were not run (manual / llm_compliance excluded).

Sibling search over superset/mcp_service/ (dashboard_title, chart_name, slice_name, blank/empty checks and name/title declarations):

  • dashboard/schemas.py and dashboard/tool/generate_dashboard.py: empty input uses the existing auto-title path; schema aliases and persisted title covered by regressions.
  • dashboard/schemas.py, dashboard/tool/update_dashboard.py, dashboard/tool/duplicate_dashboard.py: already reject explicit empty/whitespace titles; omitted update titles leave the title unchanged.
  • chart/schemas.py (ChartNameMixin): normalizes blank chart_name, name, title, and slice_name aliases to None. chart/tool/generate_chart.py generates a name. chart/tool/update_chart.py retains the existing name or generates one with config; a blank name-only update is rejected. Neither writes the supplied blank string.
  • chart/tool/update_chart_preview.py: generates a preview name, not a caller-provided blank title.
  • Chart/dashboard response models and restore/read tools may preserve an existing blank slice_name/title; they do not accept a rename or create a blank-named object. This change does not rewrite existing records.
  • sql_lab/schemas.py: SQL Lab tab titles already strip blanks to None for the default naming path.
  • Other name hits are dataset/metric/theme identifiers, native-filter/divider labels, query labels, or response metadata, not chart/dashboard titles. Required names have their own validation; optional labels and clearable slug/CSS/certification fields are separate contracts and remain unchanged.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration
  • Introduces new feature or API
  • Removes existing feature or API

@github-actions github-actions Bot added the doc Namespace | Anything related to documentation label Oct 28, 2026
@netlify

netlify Bot commented Oct 28, 2026

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

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

@netlify

netlify Bot commented Oct 28, 2026

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 51eb49a
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6ae14047e720627a732b22c2
😎 Deploy Preview https://deploy-preview-45799--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 Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.56%. Comparing base (e97d7ca) to head (51eb49a).

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #45799       +/-   ##
===========================================
+ Coverage   65.26%   84.56%   +19.29%     
===========================================
  Files        3068     3068               
  Lines      204990   204988        -2     
  Branches    48174    48173        -1     
===========================================
+ Hits       133788   173342    +39554     
+ Misses      68154    28345    -39809     
- Partials     3048     3301      +253     
Flag Coverage Δ
hive 34.54% <0.00%> (+<0.01%) ⬆️
mysql 52.47% <0.00%> (?)
postgres 52.48% <0.00%> (?)
presto 36.27% <0.00%> (+<0.01%) ⬆️
python 87.64% <100.00%> (+35.29%) ⬆️
sqlite 52.24% <0.00%> (+<0.01%) ⬆️
unit 82.30% <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.

@aminghadersohi

Copy link
Copy Markdown
Contributor Author

Product acceptance at 51eb49a: ship.

I ran the PR head and the merge base (e97d7ca) in a real Superset with Postgres and the MCP service, calling the tools over streamable HTTP through the default search_tools / call_tool proxy, with six saved charts.

  • generate_dashboard: "", " ", "\t\n", omitted and None, through dashboard_title, title and name. On head, 9/9 save the same chart-derived title (Revenue by Region, Orders over Time, Product Mix + 3 more), as Admin, Alpha and Gamma (with dataset access). On the merge base, the three "" cases stored an empty title: the dashboard list shows it blank and the dashboard page title falls back to "Superset".
  • Nonblank titles are unchanged (Q3 Sales & Ops), and <script></script> is still rejected.
  • update_dashboard and duplicate_dashboard still reject blank values for all three aliases with request.dashboard_title: Text must not be empty. The stored title never changed.
  • Chart names behave the same as on the merge base: a blank name on generate_chart gets a generated name. On update_chart, a blank name-only rename is rejected, and a config update keeps the saved name.

One LOW finding, outside this diff and also present on the merge base. A blank name-only update_chart returns "Either 'config', 'add_columns', 'chart_name', or 'dataset_id' must be provided." even though chart_name was passed, and the message has no field location. Nothing blank is written.

Not verified: natural-language prompts through a real LLM (I called the tools directly), and JWT auth (I used fixed-user dev mode).

@aminghadersohi
aminghadersohi marked this pull request as ready for review October 28, 2026 01:48
@codeant-ai-for-open-source

Copy link
Copy Markdown
Contributor

CodeAnt  CodeAnt PR Risk

🟢  Low Risk

  • The PR appears safe to merge; no actionable issues were identified in the review.

Assessed commit: 51eb49a45aeb

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Namespace | Anything related to documentation size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant