You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2026/04/06 12:57:23 UTC
(superset) 03/06: fix(mcp): Created dashboard should be in draft state by default (#39011)
This is an automated email from the ASF dual-hosted git repository.
michaelsmolina pushed a commit to branch 6.1
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 42fe0f755a28ceba7bb05938bb2d84be716a3610
Author: Kamil Gabryjelski <ka...@gmail.com>
AuthorDate: Thu Apr 2 19:28:51 2026 +0200
fix(mcp): Created dashboard should be in draft state by default (#39011)
(cherry picked from commit 135e0f809968f14ca4e0ddda3abae7ed1d0eef8c)
---
superset/mcp_service/dashboard/schemas.py | 2 +-
.../dashboard/tool/test_dashboard_generation.py | 29 +++++++++++++++++++++-
2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/superset/mcp_service/dashboard/schemas.py b/superset/mcp_service/dashboard/schemas.py
index 552a30071e3..e76cde36827 100644
--- a/superset/mcp_service/dashboard/schemas.py
+++ b/superset/mcp_service/dashboard/schemas.py
@@ -449,7 +449,7 @@ class GenerateDashboardRequest(BaseModel):
)
description: str | None = Field(None, description="Description for the dashboard")
published: bool = Field(
- default=True, description="Whether to publish the dashboard"
+ default=False, description="Whether to publish the dashboard"
)
@field_validator("dashboard_title")
diff --git a/tests/unit_tests/mcp_service/dashboard/tool/test_dashboard_generation.py b/tests/unit_tests/mcp_service/dashboard/tool/test_dashboard_generation.py
index 71e4b83b5ec..3464d8eb611 100644
--- a/tests/unit_tests/mcp_service/dashboard/tool/test_dashboard_generation.py
+++ b/tests/unit_tests/mcp_service/dashboard/tool/test_dashboard_generation.py
@@ -444,7 +444,34 @@ class TestGenerateDashboard:
== "Minimal Dashboard"
)
- # Verify dashboard was created with default published=True
+ # Verify dashboard was created with default published=False
+ created = mock_dashboard_cls.return_value
+ assert created.published is False
+
+ @patch("superset.models.dashboard.Dashboard")
+ @patch("superset.daos.dashboard.DashboardDAO.find_by_id")
+ @patch("superset.db.session")
+ @pytest.mark.asyncio
+ async def test_generate_dashboard_explicit_published(
+ self, mock_db_session, mock_find_by_id, mock_dashboard_cls, mcp_server
+ ):
+ """Test dashboard generation with published explicitly set to True."""
+ charts = [_mock_chart(id=3)]
+ mock_dashboard = _mock_dashboard(id=41, title="Published Dashboard")
+ _setup_generate_dashboard_mocks(
+ mock_db_session, mock_find_by_id, mock_dashboard_cls, charts, mock_dashboard
+ )
+
+ request = {
+ "chart_ids": [3],
+ "dashboard_title": "Published Dashboard",
+ "published": True,
+ }
+
+ async with Client(mcp_server) as client:
+ result = await client.call_tool("generate_dashboard", {"request": request})
+
+ assert result.structured_content["error"] is None
created = mock_dashboard_cls.return_value
assert created.published is True