mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
fix(mcp): add description and certification fields to default list tool columns (#39017)
(cherry picked from commit 7be2acb2f3)
This commit is contained in:
committed by
Michael S. Molina
parent
4764eea1dc
commit
b9b48fb1e4
@@ -363,6 +363,8 @@ def _make_mock_chart(chart_id: int = 42) -> Mock:
|
||||
chart.datasource_name = "test_table"
|
||||
chart.datasource_type = "table"
|
||||
chart.description = None
|
||||
chart.certified_by = None
|
||||
chart.certification_details = None
|
||||
chart.cache_timeout = None
|
||||
chart.changed_by = None
|
||||
chart.changed_by_name = "admin"
|
||||
@@ -394,6 +396,20 @@ class TestChartSerializationEagerLoading:
|
||||
assert result.tags == []
|
||||
assert result.owners == []
|
||||
|
||||
def test_serialize_chart_object_with_certification_fields(self):
|
||||
"""serialize_chart_object correctly serializes non-None certification values."""
|
||||
from superset.mcp_service.chart.schemas import serialize_chart_object
|
||||
|
||||
chart = _make_mock_chart()
|
||||
chart.certified_by = "Data Team"
|
||||
chart.certification_details = "Verified Q1 2026 metrics"
|
||||
|
||||
result = serialize_chart_object(chart)
|
||||
|
||||
assert result is not None
|
||||
assert result.certified_by == "Data Team"
|
||||
assert result.certification_details == "Verified Q1 2026 metrics"
|
||||
|
||||
def test_serialize_chart_object_fails_on_detached_instance(self):
|
||||
"""serialize_chart_object raises when accessing lazy attrs on detached
|
||||
instance — this is the bug scenario that the eager-loading fix prevents."""
|
||||
|
||||
@@ -46,6 +46,8 @@ def mock_chart():
|
||||
chart.datasource_name = "test_dataset"
|
||||
chart.datasource_type = "table"
|
||||
chart.description = "Test chart"
|
||||
chart.certified_by = None
|
||||
chart.certification_details = None
|
||||
chart.url = "/chart/1"
|
||||
chart.changed_by_name = "admin"
|
||||
chart.changed_on = None
|
||||
@@ -197,20 +199,21 @@ class TestChartDefaultColumnFiltering:
|
||||
"""Test that minimal default columns are properly defined."""
|
||||
from superset.mcp_service.common.schema_discovery import CHART_DEFAULT_COLUMNS
|
||||
|
||||
# Required minimal columns must be present
|
||||
required_columns = {
|
||||
assert set(CHART_DEFAULT_COLUMNS) == {
|
||||
"id",
|
||||
"slice_name",
|
||||
"viz_type",
|
||||
"description",
|
||||
"certified_by",
|
||||
"certification_details",
|
||||
"url",
|
||||
"changed_on",
|
||||
"changed_on_humanized",
|
||||
}
|
||||
assert required_columns.issubset(set(CHART_DEFAULT_COLUMNS))
|
||||
|
||||
# Heavy columns should NOT be in defaults
|
||||
assert "form_data" not in CHART_DEFAULT_COLUMNS
|
||||
assert "query_context" not in CHART_DEFAULT_COLUMNS
|
||||
assert "description" not in CHART_DEFAULT_COLUMNS
|
||||
assert "datasource_name" not in CHART_DEFAULT_COLUMNS
|
||||
assert "uuid" not in CHART_DEFAULT_COLUMNS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user