This is an automated email from the ASF dual-hosted git repository.

sadpandajoe pushed a commit to branch 
ultraset-dataset-discovery-mypy-optional-uuid
in repository https://gitbox.apache.org/repos/asf/superset.git

commit a63f59faf1855bf5637d40999542f38c201d4d4e
Author: Joe Li <[email protected]>
AuthorDate: Sat Nov 14 06:34:22 2026 +0000

    fix(mcp): silence superset-core uuid union-attr in dataset discovery
    
    The scheduled full-tree mypy run fails on
    superset/mcp_service/dataset/discovery.py:73 with two union-attr errors
    on SqlaTable.uuid.in_(scope). SqlaTable inherits superset-core's
    CoreDataset first, whose plain `uuid: UUID | None` annotation shadows the
    UUIDMixin column when superset-core sources are part of the mypy run.
    Per-PR runs skip superset_core imports, so #46120 merged green.
    
    Apply the same narrow ignore already used for the identical expression
    in superset/mcp_service/dataset_scope.py, and add the module to the
    mirror-case warn_unused_ignores override so the per-PR run does not
    report the ignore as unused.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 pyproject.toml                            | 1 +
 superset/mcp_service/dataset/discovery.py | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/pyproject.toml b/pyproject.toml
index 827dad2d8b3..d07581e8832 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -434,6 +434,7 @@ warn_unused_ignores = false
 [[tool.mypy.overrides]]
 module = [
     "superset.mcp_service.dataset_scope",
+    "superset.mcp_service.dataset.discovery",
     "tests.unit_tests.mcp_service.dataset.tool.test_dataset_tools",
     "superset.commands.chart.importers.v1",
     "superset.daos.datasource",
diff --git a/superset/mcp_service/dataset/discovery.py 
b/superset/mcp_service/dataset/discovery.py
index db0eca10663..3aca9c59542 100644
--- a/superset/mcp_service/dataset/discovery.py
+++ b/superset/mcp_service/dataset/discovery.py
@@ -70,7 +70,11 @@ def discover_dataset(
     ).filter(identity_filter, SqlaTable.deleted_at.is_(None))
     query = DatasetDAO._apply_base_filter(query)
     if (scope := get_dataset_scope()) is not None:
-        query = query.filter(SqlaTable.uuid.in_(scope))
+        # SqlaTable.uuid is an unannotated Column, so mypy sees the raw
+        # nullable value type here instead of an InstrumentedAttribute; same
+        # false positive already ignored in
+        # superset/mcp_service/dataset_scope.py.
+        query = query.filter(SqlaTable.uuid.in_(scope))  # type: 
ignore[union-attr]
     row = query.one_or_none()
     if row is None:
         return DatasetError.create("Dataset not found", "not_found")

Reply via email to