codeant-ai-for-open-source[bot] commented on code in PR #41611:
URL: https://github.com/apache/superset/pull/41611#discussion_r3533487302
##########
superset/mcp_service/utils/response_utils.py:
##########
@@ -161,3 +164,56 @@ def add_extracted_field(
def build(self) -> Dict[str, str]:
"""Return the omission metadata dict."""
return dict(self._fields)
+
+
+STATS_ROW_CAP = 5000
Review Comment:
**Suggestion:** Add an explicit type annotation for this new module-level
constant to comply with the type-hint requirement for annotatable variables.
[custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
This is a newly added module-level variable that can be annotated as an int,
but it is written without a type hint. That matches the rule requiring type
hints for annotatable variables in new or modified Python code.
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=736904571ee84308998d3360cc3b0d42&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=736904571ee84308998d3360cc3b0d42&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/utils/response_utils.py
**Line:** 169:169
**Comment:**
*Custom Rule: Add an explicit type annotation for this new module-level
constant to comply with the type-hint requirement for annotatable variables.
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%2F41611&comment_hash=dfeb89bceb5fddb80567f9fe45f9aef3697c9fe6c917aad56220ccb1f0b467fc&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41611&comment_hash=dfeb89bceb5fddb80567f9fe45f9aef3697c9fe6c917aad56220ccb1f0b467fc&reaction=dislike'>👎</a>
##########
superset/mcp_service/semantic_layer/schemas.py:
##########
@@ -0,0 +1,302 @@
+# 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.
+
+"""Pydantic schemas for semantic layer MCP tools."""
+
+from __future__ import annotations
+
+from typing import Any, Literal
+
+from pydantic import BaseModel, Field
+
+from superset.mcp_service.chart.schemas import DataColumn, PerformanceMetadata
+from superset.mcp_service.common.cache_schemas import CacheStatus
+from superset.mcp_service.common.error_schemas import MCPBaseError
+
+# ---------------------------------------------------------------------------
+# Shared error schema
+# ---------------------------------------------------------------------------
+
+
+class SemanticLayerError(MCPBaseError):
+ """Error response returned by semantic layer tools."""
+
+ success: Literal[False] = False
+
+ @classmethod
+ def create(cls, *, error: str, error_type: str) -> "SemanticLayerError":
Review Comment:
**Suggestion:** Add an explicit type annotation for the class method
receiver parameter to satisfy the type-hint requirement for method signatures.
[custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
The custom rule requires Python methods to include type hints where
possible. This classmethod annotates `error` and `error_type`, but leaves the
receiver `cls` unannotated even though it can be typed, so the suggestion
identifies a real type-hint omission.
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=420367776c884cf69061902bde511d4c&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=420367776c884cf69061902bde511d4c&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/semantic_layer/schemas.py
**Line:** 40:41
**Comment:**
*Custom Rule: Add an explicit type annotation for the class method
receiver parameter to satisfy the type-hint requirement for method signatures.
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%2F41611&comment_hash=ec22bbedea98dda44dbb03d94bc03984f88b51dcb5e49c46768d84e2abed53eb&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41611&comment_hash=ec22bbedea98dda44dbb03d94bc03984f88b51dcb5e49c46768d84e2abed53eb&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]