codeant-ai-for-open-source[bot] commented on code in PR #41497:
URL: https://github.com/apache/superset/pull/41497#discussion_r3532822631


##########
superset/mcp_service/theme/tool/__init__.py:
##########
@@ -0,0 +1,26 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from .create_theme import create_theme
+from .get_theme_info import get_theme_info
+from .list_themes import list_themes
+
+__all__ = [
+    "create_theme",
+    "get_theme_info",
+    "list_themes",
+]

Review Comment:
   **Suggestion:** Add an explicit type annotation for the exported names 
collection so this new module-level variable satisfies the type-hint 
requirement. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   The file is new Python code and defines a module-level variable `__all__` 
without any type annotation. Under the type-hint rule, this is a relevant 
annotatable variable omission, so the suggestion identifies a real violation.
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=5c998d07220944c99b59ecd4e86e5c40&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=5c998d07220944c99b59ecd4e86e5c40&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset/mcp_service/theme/tool/__init__.py
   **Line:** 22:26
   **Comment:**
        *Custom Rule: Add an explicit type annotation for the exported names 
collection so this new module-level variable satisfies the type-hint 
requirement.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=c59f0cf9a1603c32f56778c4054db19759d69bb8bef5ea977687def920531d27&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=c59f0cf9a1603c32f56778c4054db19759d69bb8bef5ea977687def920531d27&reaction=dislike'>👎</a>



##########
tests/unit_tests/mcp_service/theme/tool/test_get_theme_info.py:
##########
@@ -0,0 +1,105 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""Unit tests for the get_theme_info MCP tool."""
+
+from unittest.mock import MagicMock, Mock, patch
+
+import pytest
+from fastmcp import Client
+
+from superset.mcp_service.app import mcp
+from superset.utils import json
+
+
+def create_mock_theme(
+    theme_id: int = 1,
+    theme_name: str = "Corporate Blue",
+    uuid: str = "11111111-1111-1111-1111-111111111111",
+) -> MagicMock:
+    theme = MagicMock()
+    theme.id = theme_id
+    theme.theme_name = theme_name
+    theme.json_data = '{"token": {"colorPrimary": "#1d4ed8"}}'
+    theme.uuid = uuid
+    theme.is_system = False
+    theme.is_system_default = False
+    theme.is_system_dark = False
+    theme.changed_on = None
+    theme.created_on = None
+    return theme
+
+
[email protected]
+def mcp_server():
+    return mcp
+
+
[email protected](autouse=True)
+def mock_auth():
+    with patch("superset.mcp_service.auth.get_user_from_request") as 
mock_get_user:
+        mock_user = Mock()
+        mock_user.id = 1
+        mock_user.username = "admin"
+        mock_get_user.return_value = mock_user
+        yield mock_get_user
+
+
+@patch("superset.daos.theme.ThemeDAO.find_by_id")
[email protected]
+async def test_get_theme_info_by_id_success(mock_find, mcp_server):
+    """Returns ThemeInfo when the theme is found by numeric ID."""
+    mock_find.return_value = create_mock_theme()
+    async with Client(mcp_server) as client:
+        result = await client.call_tool(
+            "get_theme_info", {"request": {"identifier": 1}}
+        )
+        data = json.loads(result.content[0].text)
+    assert data["id"] == 1
+    assert "Corporate Blue" in data["theme_name"]
+    assert "colorPrimary" in data["json_data"]
+

Review Comment:
   **Suggestion:** Add type hints for the fixture/mock parameters and an 
explicit async return type annotation. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   The async test function omits type hints for its parameters and does not 
declare an async return type. Since the rule flags new or modified Python code 
missing type hints where applicable, this is a real violation.
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=ec80b7197b734f3cbe1a850f95c563b6&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=ec80b7197b734f3cbe1a850f95c563b6&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** tests/unit_tests/mcp_service/theme/tool/test_get_theme_info.py
   **Line:** 64:75
   **Comment:**
        *Custom Rule: Add type hints for the fixture/mock parameters and an 
explicit async return type annotation.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=8e13dcb6b132261f1a397cc15fa748a035e94d557072af5770fffd64b4ad0d83&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=8e13dcb6b132261f1a397cc15fa748a035e94d557072af5770fffd64b4ad0d83&reaction=dislike'>👎</a>



##########
tests/unit_tests/mcp_service/theme/tool/test_get_theme_info.py:
##########
@@ -0,0 +1,105 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""Unit tests for the get_theme_info MCP tool."""
+
+from unittest.mock import MagicMock, Mock, patch
+
+import pytest
+from fastmcp import Client
+
+from superset.mcp_service.app import mcp
+from superset.utils import json
+
+
+def create_mock_theme(
+    theme_id: int = 1,
+    theme_name: str = "Corporate Blue",
+    uuid: str = "11111111-1111-1111-1111-111111111111",
+) -> MagicMock:
+    theme = MagicMock()
+    theme.id = theme_id
+    theme.theme_name = theme_name
+    theme.json_data = '{"token": {"colorPrimary": "#1d4ed8"}}'
+    theme.uuid = uuid
+    theme.is_system = False
+    theme.is_system_default = False
+    theme.is_system_dark = False
+    theme.changed_on = None
+    theme.created_on = None
+    return theme
+
+
[email protected]
+def mcp_server():
+    return mcp

Review Comment:
   **Suggestion:** Add an explicit return type annotation to this fixture 
function. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   The fixture `mcp_server` has no return type annotation even though it simply 
returns `mcp`. This is a new Python function in the added file, so it violates 
the rule requiring type hints on annotatable functions.
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=b2d92787dead4a3a89c81097a52fd88f&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=b2d92787dead4a3a89c81097a52fd88f&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** tests/unit_tests/mcp_service/theme/tool/test_get_theme_info.py
   **Line:** 47:49
   **Comment:**
        *Custom Rule: Add an explicit return type annotation to this fixture 
function.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=ffa6d036c2179b32a7c52eec4f53635221ef9c4ac72d6eb898af7bd6489063a9&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=ffa6d036c2179b32a7c52eec4f53635221ef9c4ac72d6eb898af7bd6489063a9&reaction=dislike'>👎</a>



##########
tests/unit_tests/mcp_service/theme/tool/test_get_theme_info.py:
##########
@@ -0,0 +1,105 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""Unit tests for the get_theme_info MCP tool."""
+
+from unittest.mock import MagicMock, Mock, patch
+
+import pytest
+from fastmcp import Client
+
+from superset.mcp_service.app import mcp
+from superset.utils import json
+
+
+def create_mock_theme(
+    theme_id: int = 1,
+    theme_name: str = "Corporate Blue",
+    uuid: str = "11111111-1111-1111-1111-111111111111",
+) -> MagicMock:
+    theme = MagicMock()
+    theme.id = theme_id
+    theme.theme_name = theme_name
+    theme.json_data = '{"token": {"colorPrimary": "#1d4ed8"}}'
+    theme.uuid = uuid
+    theme.is_system = False
+    theme.is_system_default = False
+    theme.is_system_dark = False
+    theme.changed_on = None
+    theme.created_on = None
+    return theme
+
+
[email protected]
+def mcp_server():
+    return mcp
+
+
[email protected](autouse=True)
+def mock_auth():
+    with patch("superset.mcp_service.auth.get_user_from_request") as 
mock_get_user:
+        mock_user = Mock()
+        mock_user.id = 1
+        mock_user.username = "admin"
+        mock_get_user.return_value = mock_user
+        yield mock_get_user

Review Comment:
   **Suggestion:** Add a return type annotation for this generator fixture to 
make its yielded type explicit. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   The `mock_auth` fixture is a generator-style fixture using `yield`, but it 
has no return/yield type annotation. That omission matches the type-hint rule 
violation for annotatable Python functions.
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=10236eaa678b40e685c13f34de01c287&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=10236eaa678b40e685c13f34de01c287&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** tests/unit_tests/mcp_service/theme/tool/test_get_theme_info.py
   **Line:** 52:59
   **Comment:**
        *Custom Rule: Add a return type annotation for this generator fixture 
to make its yielded type explicit.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=ee2d76facff79b5e244024e6215624e80d73d0a9569fde73d202d8a72ac91978&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=ee2d76facff79b5e244024e6215624e80d73d0a9569fde73d202d8a72ac91978&reaction=dislike'>👎</a>



##########
tests/unit_tests/mcp_service/theme/tool/test_create_theme.py:
##########
@@ -0,0 +1,171 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""Unit tests for the create_theme MCP tool."""
+
+import importlib
+from unittest.mock import MagicMock, Mock, patch
+
+import pytest
+from fastmcp import Client
+from marshmallow import ValidationError
+
+from superset.mcp_service.app import mcp
+from superset.utils import json
+
+# Resolve the module object directly so patch.object targets the module, not
+# the function re-exported through __init__.py.
+create_theme_module = importlib.import_module(
+    "superset.mcp_service.theme.tool.create_theme"
+)
+
+
+def _make_mock_theme(
+    theme_id: int = 7,
+    theme_name: str = "Corporate Blue",
+    uuid: str = "22222222-2222-2222-2222-222222222222",
+) -> MagicMock:
+    theme = MagicMock()
+    theme.id = theme_id
+    theme.theme_name = theme_name
+    theme.uuid = uuid
+    return theme
+
+
[email protected]
+def mcp_server():
+    return mcp
+
+
[email protected](autouse=True)
+def mock_auth():
+    with patch("superset.mcp_service.auth.get_user_from_request") as 
mock_get_user:
+        mock_user = Mock()
+        mock_user.id = 1
+        mock_user.username = "admin"
+        mock_get_user.return_value = mock_user
+        yield mock_get_user
+
+
[email protected](create_theme_module.db.session, "commit")
+@patch("superset.daos.theme.ThemeDAO.create")
[email protected](create_theme_module, "_sanitize_and_validate_theme_config")
[email protected]
+async def test_create_theme_success_with_dict(
+    mock_sanitize, mock_create, mock_commit, mcp_server
+):

Review Comment:
   **Suggestion:** Add type annotations for all parameters and the return type 
of this async test function. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   This async test function has unannotated parameters and no return type 
annotation, so it violates the type-hint requirement.
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=751a564eb00d4930bbf7b7ac28a1a9e4&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=751a564eb00d4930bbf7b7ac28a1a9e4&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** tests/unit_tests/mcp_service/theme/tool/test_create_theme.py
   **Line:** 68:70
   **Comment:**
        *Custom Rule: Add type annotations for all parameters and the return 
type of this async test function.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=5c9fe6151516940d5dd75d100272cfae71207a6001988f37bd22b9ab553bd718&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=5c9fe6151516940d5dd75d100272cfae71207a6001988f37bd22b9ab553bd718&reaction=dislike'>👎</a>



##########
tests/unit_tests/mcp_service/theme/tool/test_create_theme.py:
##########
@@ -0,0 +1,171 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""Unit tests for the create_theme MCP tool."""
+
+import importlib
+from unittest.mock import MagicMock, Mock, patch
+
+import pytest
+from fastmcp import Client
+from marshmallow import ValidationError
+
+from superset.mcp_service.app import mcp
+from superset.utils import json
+
+# Resolve the module object directly so patch.object targets the module, not
+# the function re-exported through __init__.py.
+create_theme_module = importlib.import_module(
+    "superset.mcp_service.theme.tool.create_theme"
+)
+
+
+def _make_mock_theme(
+    theme_id: int = 7,
+    theme_name: str = "Corporate Blue",
+    uuid: str = "22222222-2222-2222-2222-222222222222",
+) -> MagicMock:
+    theme = MagicMock()
+    theme.id = theme_id
+    theme.theme_name = theme_name
+    theme.uuid = uuid
+    return theme
+
+
[email protected]
+def mcp_server():
+    return mcp
+
+
[email protected](autouse=True)
+def mock_auth():
+    with patch("superset.mcp_service.auth.get_user_from_request") as 
mock_get_user:
+        mock_user = Mock()
+        mock_user.id = 1
+        mock_user.username = "admin"
+        mock_get_user.return_value = mock_user
+        yield mock_get_user

Review Comment:
   **Suggestion:** Add a return type annotation to this fixture generator 
function. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   This new fixture function is missing a return type annotation, which is 
required by the type-hint rule.
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=f95cb4f85af64933831475e63bfab1e9&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=f95cb4f85af64933831475e63bfab1e9&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** tests/unit_tests/mcp_service/theme/tool/test_create_theme.py
   **Line:** 55:61
   **Comment:**
        *Custom Rule: Add a return type annotation to this fixture generator 
function.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=f51676f6fffaf0c8e8a47704954a26bad64b86d9a3d36f743f4ce47bca46f435&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=f51676f6fffaf0c8e8a47704954a26bad64b86d9a3d36f743f4ce47bca46f435&reaction=dislike'>👎</a>



##########
tests/unit_tests/mcp_service/theme/tool/test_create_theme.py:
##########
@@ -0,0 +1,171 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""Unit tests for the create_theme MCP tool."""
+
+import importlib
+from unittest.mock import MagicMock, Mock, patch
+
+import pytest
+from fastmcp import Client
+from marshmallow import ValidationError
+
+from superset.mcp_service.app import mcp
+from superset.utils import json
+
+# Resolve the module object directly so patch.object targets the module, not
+# the function re-exported through __init__.py.
+create_theme_module = importlib.import_module(
+    "superset.mcp_service.theme.tool.create_theme"
+)
+
+
+def _make_mock_theme(
+    theme_id: int = 7,
+    theme_name: str = "Corporate Blue",
+    uuid: str = "22222222-2222-2222-2222-222222222222",
+) -> MagicMock:
+    theme = MagicMock()
+    theme.id = theme_id
+    theme.theme_name = theme_name
+    theme.uuid = uuid
+    return theme
+
+
[email protected]
+def mcp_server():
+    return mcp
+
+
[email protected](autouse=True)
+def mock_auth():
+    with patch("superset.mcp_service.auth.get_user_from_request") as 
mock_get_user:
+        mock_user = Mock()
+        mock_user.id = 1
+        mock_user.username = "admin"
+        mock_get_user.return_value = mock_user
+        yield mock_get_user
+
+
[email protected](create_theme_module.db.session, "commit")
+@patch("superset.daos.theme.ThemeDAO.create")
[email protected](create_theme_module, "_sanitize_and_validate_theme_config")
[email protected]
+async def test_create_theme_success_with_dict(
+    mock_sanitize, mock_create, mock_commit, mcp_server
+):
+    """Happy path: dict json_data is sanitized, persisted, and id/uuid 
returned."""
+    config = {"token": {"colorPrimary": "#1d4ed8"}}
+    mock_sanitize.return_value = config
+    mock_create.return_value = _make_mock_theme()
+
+    async with Client(mcp_server) as client:
+        result = await client.call_tool(
+            "create_theme",
+            {
+                "request": {
+                    "theme_name": "Corporate Blue",
+                    "json_data": config,
+                }
+            },
+        )
+        data = json.loads(result.content[0].text)
+
+    assert data["success"] is True
+    assert data["id"] == 7
+    assert data["uuid"] == "22222222-2222-2222-2222-222222222222"
+    assert data["theme_name"] == "Corporate Blue"
+    mock_sanitize.assert_called_once_with(config)
+    # json_data persisted as a serialized string
+    create_kwargs = mock_create.call_args.kwargs["attributes"]
+    assert isinstance(create_kwargs["json_data"], str)
+    assert json.loads(create_kwargs["json_data"]) == config
+    mock_commit.assert_called_once()
+
+
[email protected](create_theme_module.db.session, "commit")
+@patch("superset.daos.theme.ThemeDAO.create")
[email protected](create_theme_module, "_sanitize_and_validate_theme_config")
[email protected]
+async def test_create_theme_success_with_json_string(
+    mock_sanitize, mock_create, mock_commit, mcp_server
+):

Review Comment:
   **Suggestion:** Add type annotations for all parameters and the return type 
of this async test function. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   This async test function also lacks parameter annotations and a return type 
annotation, matching the rule violation.
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=7a84dcd0e61a447db98612206fd4f7a3&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=7a84dcd0e61a447db98612206fd4f7a3&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** tests/unit_tests/mcp_service/theme/tool/test_create_theme.py
   **Line:** 104:106
   **Comment:**
        *Custom Rule: Add type annotations for all parameters and the return 
type of this async test function.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=b0f8959974ad4afd456a27010ffac9ef4fae2e61422322eb917120bb317d3460&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=b0f8959974ad4afd456a27010ffac9ef4fae2e61422322eb917120bb317d3460&reaction=dislike'>👎</a>



##########
tests/unit_tests/mcp_service/theme/tool/test_create_theme.py:
##########
@@ -0,0 +1,171 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""Unit tests for the create_theme MCP tool."""
+
+import importlib
+from unittest.mock import MagicMock, Mock, patch
+
+import pytest
+from fastmcp import Client
+from marshmallow import ValidationError
+
+from superset.mcp_service.app import mcp
+from superset.utils import json
+
+# Resolve the module object directly so patch.object targets the module, not
+# the function re-exported through __init__.py.
+create_theme_module = importlib.import_module(
+    "superset.mcp_service.theme.tool.create_theme"
+)
+
+
+def _make_mock_theme(
+    theme_id: int = 7,
+    theme_name: str = "Corporate Blue",
+    uuid: str = "22222222-2222-2222-2222-222222222222",
+) -> MagicMock:
+    theme = MagicMock()
+    theme.id = theme_id
+    theme.theme_name = theme_name
+    theme.uuid = uuid
+    return theme
+
+
[email protected]
+def mcp_server():
+    return mcp
+
+
[email protected](autouse=True)
+def mock_auth():
+    with patch("superset.mcp_service.auth.get_user_from_request") as 
mock_get_user:
+        mock_user = Mock()
+        mock_user.id = 1
+        mock_user.username = "admin"
+        mock_get_user.return_value = mock_user
+        yield mock_get_user
+
+
[email protected](create_theme_module.db.session, "commit")
+@patch("superset.daos.theme.ThemeDAO.create")
[email protected](create_theme_module, "_sanitize_and_validate_theme_config")
[email protected]
+async def test_create_theme_success_with_dict(
+    mock_sanitize, mock_create, mock_commit, mcp_server
+):
+    """Happy path: dict json_data is sanitized, persisted, and id/uuid 
returned."""
+    config = {"token": {"colorPrimary": "#1d4ed8"}}
+    mock_sanitize.return_value = config
+    mock_create.return_value = _make_mock_theme()
+
+    async with Client(mcp_server) as client:
+        result = await client.call_tool(
+            "create_theme",
+            {
+                "request": {
+                    "theme_name": "Corporate Blue",
+                    "json_data": config,
+                }
+            },
+        )
+        data = json.loads(result.content[0].text)
+
+    assert data["success"] is True
+    assert data["id"] == 7
+    assert data["uuid"] == "22222222-2222-2222-2222-222222222222"
+    assert data["theme_name"] == "Corporate Blue"
+    mock_sanitize.assert_called_once_with(config)
+    # json_data persisted as a serialized string
+    create_kwargs = mock_create.call_args.kwargs["attributes"]
+    assert isinstance(create_kwargs["json_data"], str)
+    assert json.loads(create_kwargs["json_data"]) == config
+    mock_commit.assert_called_once()
+
+
[email protected](create_theme_module.db.session, "commit")
+@patch("superset.daos.theme.ThemeDAO.create")
[email protected](create_theme_module, "_sanitize_and_validate_theme_config")
[email protected]
+async def test_create_theme_success_with_json_string(
+    mock_sanitize, mock_create, mock_commit, mcp_server
+):
+    """json_data supplied as a JSON string is parsed and accepted."""
+    config = {"token": {"colorPrimary": "#abcdef"}}
+    mock_sanitize.return_value = config
+    mock_create.return_value = _make_mock_theme(theme_id=9)
+
+    async with Client(mcp_server) as client:
+        result = await client.call_tool(
+            "create_theme",
+            {
+                "request": {
+                    "theme_name": "From String",
+                    "json_data": json.dumps(config),
+                }
+            },
+        )
+        data = json.loads(result.content[0].text)
+
+    assert data["success"] is True
+    assert data["id"] == 9
+    mock_sanitize.assert_called_once_with(config)
+
+
+@patch("superset.daos.theme.ThemeDAO.create")
[email protected](create_theme_module, "_sanitize_and_validate_theme_config")
[email protected]
+async def test_create_theme_invalid_config(mock_sanitize, mock_create, 
mcp_server):

Review Comment:
   **Suggestion:** Add type annotations for all parameters and the return type 
of this async test function. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   This test function has no type annotations on its parameters and no return 
type, so it violates the type-hint rule.
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=861634a7b0dc495186d3f98cdc324750&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=861634a7b0dc495186d3f98cdc324750&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** tests/unit_tests/mcp_service/theme/tool/test_create_theme.py
   **Line:** 132:132
   **Comment:**
        *Custom Rule: Add type annotations for all parameters and the return 
type of this async test function.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=290c34a4ce1a718cf6b78b505719b4871908af3253ef36f133096dceb68f95ee&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=290c34a4ce1a718cf6b78b505719b4871908af3253ef36f133096dceb68f95ee&reaction=dislike'>👎</a>



##########
tests/unit_tests/mcp_service/theme/tool/test_list_themes.py:
##########
@@ -0,0 +1,125 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""Unit tests for the list_themes MCP tool."""
+
+from unittest.mock import MagicMock, Mock, patch
+
+import pytest
+from fastmcp import Client
+from pydantic import ValidationError
+
+from superset.mcp_service.app import mcp
+from superset.mcp_service.theme.schemas import ListThemesRequest, ThemeFilter
+from superset.utils import json
+
+
+def create_mock_theme(
+    theme_id: int = 1,
+    theme_name: str = "Corporate Blue",
+    json_data: str = '{"token": {"colorPrimary": "#1d4ed8"}}',
+    uuid: str = "11111111-1111-1111-1111-111111111111",
+) -> MagicMock:
+    theme = MagicMock()
+    theme.id = theme_id
+    theme.theme_name = theme_name
+    theme.json_data = json_data
+    theme.uuid = uuid
+    theme.is_system = False
+    theme.is_system_default = False
+    theme.is_system_dark = False
+    theme.changed_on = None
+    theme.created_on = None
+    return theme
+
+
[email protected]
+def mcp_server():
+    return mcp
+
+
[email protected](autouse=True)
+def mock_auth():
+    with patch("superset.mcp_service.auth.get_user_from_request") as 
mock_get_user:
+        mock_user = Mock()
+        mock_user.id = 1
+        mock_user.username = "admin"
+        mock_get_user.return_value = mock_user
+        yield mock_get_user
+

Review Comment:
   **Suggestion:** Add an explicit return type annotation for this 
generator-based fixture so the function is fully typed. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   This autouse fixture is a generator fixture using yield but has no return 
type annotation, so it violates the type-hint rule.
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=7f77a7a3f8214629a7356f763630a018&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=7f77a7a3f8214629a7356f763630a018&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** tests/unit_tests/mcp_service/theme/tool/test_list_themes.py
   **Line:** 56:63
   **Comment:**
        *Custom Rule: Add an explicit return type annotation for this 
generator-based fixture so the function is fully typed.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=a7b360fc097178f3e5a0fb19ae94cd39ca942ada357324b49e50ba5d1fa1bdaf&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=a7b360fc097178f3e5a0fb19ae94cd39ca942ada357324b49e50ba5d1fa1bdaf&reaction=dislike'>👎</a>



##########
tests/unit_tests/mcp_service/theme/tool/test_list_themes.py:
##########
@@ -0,0 +1,125 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""Unit tests for the list_themes MCP tool."""
+
+from unittest.mock import MagicMock, Mock, patch
+
+import pytest
+from fastmcp import Client
+from pydantic import ValidationError
+
+from superset.mcp_service.app import mcp
+from superset.mcp_service.theme.schemas import ListThemesRequest, ThemeFilter
+from superset.utils import json
+
+
+def create_mock_theme(
+    theme_id: int = 1,
+    theme_name: str = "Corporate Blue",
+    json_data: str = '{"token": {"colorPrimary": "#1d4ed8"}}',
+    uuid: str = "11111111-1111-1111-1111-111111111111",
+) -> MagicMock:
+    theme = MagicMock()
+    theme.id = theme_id
+    theme.theme_name = theme_name
+    theme.json_data = json_data
+    theme.uuid = uuid
+    theme.is_system = False
+    theme.is_system_default = False
+    theme.is_system_dark = False
+    theme.changed_on = None
+    theme.created_on = None
+    return theme
+
+
[email protected]
+def mcp_server():
+    return mcp
+
+
[email protected](autouse=True)
+def mock_auth():
+    with patch("superset.mcp_service.auth.get_user_from_request") as 
mock_get_user:
+        mock_user = Mock()
+        mock_user.id = 1
+        mock_user.username = "admin"
+        mock_get_user.return_value = mock_user
+        yield mock_get_user
+
+
+class TestThemeFilterSchema:
+    """Tests for ThemeFilter schema — filterable columns."""
+
+    def test_invalid_filter_column_rejected(self):
+        with pytest.raises(ValidationError):
+            ThemeFilter(col="not_a_real_column", opr="eq", value="x")
+
+    def test_valid_theme_name_filter(self):
+        f = ThemeFilter(col="theme_name", opr="ct", value="blue")
+        assert f.col == "theme_name"
+
+
+@patch("superset.daos.theme.ThemeDAO.list")
[email protected]
+async def test_list_themes_basic(mock_list, mcp_server):
+    """Basic theme listing returns the mocked theme."""
+    theme = create_mock_theme()
+    mock_list.return_value = ([theme], 1)
+    async with Client(mcp_server) as client:
+        request = ListThemesRequest(page=1, page_size=10)
+        result = await client.call_tool(
+            "list_themes", {"request": request.model_dump()}
+        )
+        assert result.content is not None
+        data = json.loads(result.content[0].text)
+        assert data["themes"] is not None
+        assert len(data["themes"]) == 1
+        assert data["themes"][0]["id"] == 1
+        assert "Corporate Blue" in data["themes"][0]["theme_name"]
+
+
+@patch("superset.daos.theme.ThemeDAO.list")
[email protected]
+async def test_list_themes_without_request(mock_list, mcp_server):
+    """Listing with no request payload uses defaults."""
+    theme = create_mock_theme()
+    mock_list.return_value = ([theme], 1)
+    async with Client(mcp_server) as client:
+        result = await client.call_tool("list_themes", {})
+        data = json.loads(result.content[0].text)
+        assert data["themes"] is not None
+        assert len(data["themes"]) == 1
+

Review Comment:
   **Suggestion:** Add parameter type hints and a return type annotation to 
this async test function. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   This async test function also omits parameter and return type annotations, 
matching the type-hinting rule violation.
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=bce61e681ad04790a0e1245f08f0735e&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=bce61e681ad04790a0e1245f08f0735e&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** tests/unit_tests/mcp_service/theme/tool/test_list_themes.py
   **Line:** 98:107
   **Comment:**
        *Custom Rule: Add parameter type hints and a return type annotation to 
this async test function.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=290986d913b3ae3af3e21fa3143a6ba3ee8a75fa5e5ddb82e0f5f533b2d67e8d&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=290986d913b3ae3af3e21fa3143a6ba3ee8a75fa5e5ddb82e0f5f533b2d67e8d&reaction=dislike'>👎</a>



##########
tests/unit_tests/mcp_service/theme/tool/test_create_theme.py:
##########
@@ -0,0 +1,171 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""Unit tests for the create_theme MCP tool."""
+
+import importlib
+from unittest.mock import MagicMock, Mock, patch
+
+import pytest
+from fastmcp import Client
+from marshmallow import ValidationError
+
+from superset.mcp_service.app import mcp
+from superset.utils import json
+
+# Resolve the module object directly so patch.object targets the module, not
+# the function re-exported through __init__.py.
+create_theme_module = importlib.import_module(
+    "superset.mcp_service.theme.tool.create_theme"
+)
+
+
+def _make_mock_theme(
+    theme_id: int = 7,
+    theme_name: str = "Corporate Blue",
+    uuid: str = "22222222-2222-2222-2222-222222222222",
+) -> MagicMock:
+    theme = MagicMock()
+    theme.id = theme_id
+    theme.theme_name = theme_name
+    theme.uuid = uuid
+    return theme
+
+
[email protected]
+def mcp_server():
+    return mcp

Review Comment:
   **Suggestion:** Add an explicit return type annotation to this fixture 
function. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   The rule requires type hints on new or modified Python functions that can be 
annotated. This fixture has no return type annotation, so it violates the rule.
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=f54537835a4846f8911d39ad30577006&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=f54537835a4846f8911d39ad30577006&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** tests/unit_tests/mcp_service/theme/tool/test_create_theme.py
   **Line:** 50:51
   **Comment:**
        *Custom Rule: Add an explicit return type annotation to this fixture 
function.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=7d9aea8c7bfc9df61e6b2faf92fb7e54d8e40408175538becfc629610dd329df&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=7d9aea8c7bfc9df61e6b2faf92fb7e54d8e40408175538becfc629610dd329df&reaction=dislike'>👎</a>



##########
tests/unit_tests/mcp_service/theme/tool/test_list_themes.py:
##########
@@ -0,0 +1,125 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""Unit tests for the list_themes MCP tool."""
+
+from unittest.mock import MagicMock, Mock, patch
+
+import pytest
+from fastmcp import Client
+from pydantic import ValidationError
+
+from superset.mcp_service.app import mcp
+from superset.mcp_service.theme.schemas import ListThemesRequest, ThemeFilter
+from superset.utils import json
+
+
+def create_mock_theme(
+    theme_id: int = 1,
+    theme_name: str = "Corporate Blue",
+    json_data: str = '{"token": {"colorPrimary": "#1d4ed8"}}',
+    uuid: str = "11111111-1111-1111-1111-111111111111",
+) -> MagicMock:
+    theme = MagicMock()
+    theme.id = theme_id
+    theme.theme_name = theme_name
+    theme.json_data = json_data
+    theme.uuid = uuid
+    theme.is_system = False
+    theme.is_system_default = False
+    theme.is_system_dark = False
+    theme.changed_on = None
+    theme.created_on = None
+    return theme
+
+
[email protected]
+def mcp_server():
+    return mcp
+

Review Comment:
   **Suggestion:** Add a return type annotation to this fixture function to 
satisfy the required type-hinting rule. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   This fixture is defined without any return type annotation, which violates 
the Python type-hint requirement for functions that can be annotated.
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=1ef76f89f5354dc799e238db1fe35e23&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=1ef76f89f5354dc799e238db1fe35e23&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** tests/unit_tests/mcp_service/theme/tool/test_list_themes.py
   **Line:** 51:53
   **Comment:**
        *Custom Rule: Add a return type annotation to this fixture function to 
satisfy the required type-hinting rule.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=58953df8e67d4127aa1e801e822d9bc6f53a3d6ed7f26b843315e83373e0da23&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=58953df8e67d4127aa1e801e822d9bc6f53a3d6ed7f26b843315e83373e0da23&reaction=dislike'>👎</a>



##########
tests/unit_tests/mcp_service/theme/tool/test_list_themes.py:
##########
@@ -0,0 +1,125 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""Unit tests for the list_themes MCP tool."""
+
+from unittest.mock import MagicMock, Mock, patch
+
+import pytest
+from fastmcp import Client
+from pydantic import ValidationError
+
+from superset.mcp_service.app import mcp
+from superset.mcp_service.theme.schemas import ListThemesRequest, ThemeFilter
+from superset.utils import json
+
+
+def create_mock_theme(
+    theme_id: int = 1,
+    theme_name: str = "Corporate Blue",
+    json_data: str = '{"token": {"colorPrimary": "#1d4ed8"}}',
+    uuid: str = "11111111-1111-1111-1111-111111111111",
+) -> MagicMock:
+    theme = MagicMock()
+    theme.id = theme_id
+    theme.theme_name = theme_name
+    theme.json_data = json_data
+    theme.uuid = uuid
+    theme.is_system = False
+    theme.is_system_default = False
+    theme.is_system_dark = False
+    theme.changed_on = None
+    theme.created_on = None
+    return theme
+
+
[email protected]
+def mcp_server():
+    return mcp
+
+
[email protected](autouse=True)
+def mock_auth():
+    with patch("superset.mcp_service.auth.get_user_from_request") as 
mock_get_user:
+        mock_user = Mock()
+        mock_user.id = 1
+        mock_user.username = "admin"
+        mock_get_user.return_value = mock_user
+        yield mock_get_user
+
+
+class TestThemeFilterSchema:
+    """Tests for ThemeFilter schema — filterable columns."""
+
+    def test_invalid_filter_column_rejected(self):
+        with pytest.raises(ValidationError):
+            ThemeFilter(col="not_a_real_column", opr="eq", value="x")
+

Review Comment:
   **Suggestion:** Add a return type annotation to this test method to comply 
with the type-hint requirement. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   This test method omits a return type annotation, which is a direct violation 
of the Python type-hint requirement.
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=dc7cfa1cca82428491ab209698aa337c&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=dc7cfa1cca82428491ab209698aa337c&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** tests/unit_tests/mcp_service/theme/tool/test_list_themes.py
   **Line:** 68:71
   **Comment:**
        *Custom Rule: Add a return type annotation to this test method to 
comply with the type-hint requirement.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=16ba750d66f42602be446b8fae185ea6b7da5b1b323c5e962512c29047eed24e&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=16ba750d66f42602be446b8fae185ea6b7da5b1b323c5e962512c29047eed24e&reaction=dislike'>👎</a>



##########
tests/unit_tests/mcp_service/theme/tool/test_list_themes.py:
##########
@@ -0,0 +1,125 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""Unit tests for the list_themes MCP tool."""
+
+from unittest.mock import MagicMock, Mock, patch
+
+import pytest
+from fastmcp import Client
+from pydantic import ValidationError
+
+from superset.mcp_service.app import mcp
+from superset.mcp_service.theme.schemas import ListThemesRequest, ThemeFilter
+from superset.utils import json
+
+
+def create_mock_theme(
+    theme_id: int = 1,
+    theme_name: str = "Corporate Blue",
+    json_data: str = '{"token": {"colorPrimary": "#1d4ed8"}}',
+    uuid: str = "11111111-1111-1111-1111-111111111111",
+) -> MagicMock:
+    theme = MagicMock()
+    theme.id = theme_id
+    theme.theme_name = theme_name
+    theme.json_data = json_data
+    theme.uuid = uuid
+    theme.is_system = False
+    theme.is_system_default = False
+    theme.is_system_dark = False
+    theme.changed_on = None
+    theme.created_on = None
+    return theme
+
+
[email protected]
+def mcp_server():
+    return mcp
+
+
[email protected](autouse=True)
+def mock_auth():
+    with patch("superset.mcp_service.auth.get_user_from_request") as 
mock_get_user:
+        mock_user = Mock()
+        mock_user.id = 1
+        mock_user.username = "admin"
+        mock_get_user.return_value = mock_user
+        yield mock_get_user
+
+
+class TestThemeFilterSchema:
+    """Tests for ThemeFilter schema — filterable columns."""
+
+    def test_invalid_filter_column_rejected(self):
+        with pytest.raises(ValidationError):
+            ThemeFilter(col="not_a_real_column", opr="eq", value="x")
+
+    def test_valid_theme_name_filter(self):
+        f = ThemeFilter(col="theme_name", opr="ct", value="blue")
+        assert f.col == "theme_name"
+
+
+@patch("superset.daos.theme.ThemeDAO.list")
[email protected]
+async def test_list_themes_basic(mock_list, mcp_server):
+    """Basic theme listing returns the mocked theme."""
+    theme = create_mock_theme()
+    mock_list.return_value = ([theme], 1)
+    async with Client(mcp_server) as client:
+        request = ListThemesRequest(page=1, page_size=10)
+        result = await client.call_tool(
+            "list_themes", {"request": request.model_dump()}
+        )
+        assert result.content is not None
+        data = json.loads(result.content[0].text)
+        assert data["themes"] is not None
+        assert len(data["themes"]) == 1
+        assert data["themes"][0]["id"] == 1
+        assert "Corporate Blue" in data["themes"][0]["theme_name"]
+

Review Comment:
   **Suggestion:** Add parameter type hints and a return type annotation to 
this async test function. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   The async test function has untyped parameters and no return annotation, so 
it violates the requirement to add type hints where applicable.
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=788ba8bc18cb45cbbd89cd7926dd9822&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=788ba8bc18cb45cbbd89cd7926dd9822&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** tests/unit_tests/mcp_service/theme/tool/test_list_themes.py
   **Line:** 79:94
   **Comment:**
        *Custom Rule: Add parameter type hints and a return type annotation to 
this async test function.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=39531045e2630177d13cff8e42ef6ed3380179a8bd7d90c6c27268853a974792&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41497&comment_hash=39531045e2630177d13cff8e42ef6ed3380179a8bd7d90c6c27268853a974792&reaction=dislike'>👎</a>



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to