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


##########
tests/unit_tests/mcp_service/test_mcp_server.py:
##########
@@ -162,6 +169,59 @@ def 
test_create_event_store_returns_none_when_redis_store_fails():
         assert result is None
 
 
[email protected]
+async def test_register_health_endpoint_registers_get_health() -> None:
+    """/health is registered as an HTTP GET custom route on the MCP 
instance."""
+    from superset.mcp_service.server import _register_health_endpoint
+
+    captured: dict[str, object] = {}
+
+    def custom_route(path: str, methods: list[str]) -> Callable[[Endpoint], 
Endpoint]:
+        captured["path"] = path
+        captured["methods"] = methods
+
+        def decorator(fn: Endpoint) -> Endpoint:
+            captured["fn"] = fn
+            return fn
+
+        return decorator
+
+    mcp_instance = MagicMock()

Review Comment:
   **Suggestion:** Add an explicit type annotation for this newly introduced 
local mock variable to satisfy the type-hint requirement for relevant 
variables. [custom_rule]
   
   **Severity Level:** Minor ๐Ÿงน
   <details>
   <summary><b>Why it matters? โญ </b></summary>
   
   This newly added local variable is unannotated in modified Python code, and 
it can be annotated to satisfy the rule requiring type hints on relevant 
variables.
   </details>
   <details>
   <summary><b>Rule source ๐Ÿ“– </b></summary>
   
   .cursor/rules/dev-standard.mdc (line 28)
   </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=c9babd18e25f453792c4c470fb9f56b7&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=c9babd18e25f453792c4c470fb9f56b7&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/test_mcp_server.py
   **Line:** 189:189
   **Comment:**
        *Custom Rule: Add an explicit type annotation for this newly introduced 
local mock variable to satisfy the type-hint requirement for relevant 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%2F41755&comment_hash=61b4bc7f8e66a13a468c79035161723e6bb066c212684b9bbc475a1cf1267853&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41755&comment_hash=61b4bc7f8e66a13a468c79035161723e6bb066c212684b9bbc475a1cf1267853&reaction=dislike'>๐Ÿ‘Ž</a>



##########
tests/unit_tests/mcp_service/test_mcp_server.py:
##########
@@ -162,6 +169,59 @@ def 
test_create_event_store_returns_none_when_redis_store_fails():
         assert result is None
 
 
[email protected]
+async def test_register_health_endpoint_registers_get_health() -> None:
+    """/health is registered as an HTTP GET custom route on the MCP 
instance."""
+    from superset.mcp_service.server import _register_health_endpoint
+
+    captured: dict[str, object] = {}
+
+    def custom_route(path: str, methods: list[str]) -> Callable[[Endpoint], 
Endpoint]:
+        captured["path"] = path
+        captured["methods"] = methods
+
+        def decorator(fn: Endpoint) -> Endpoint:
+            captured["fn"] = fn
+            return fn
+
+        return decorator
+
+    mcp_instance = MagicMock()
+    mcp_instance.custom_route = custom_route
+
+    _register_health_endpoint(mcp_instance)
+
+    assert captured["path"] == "/health"
+    assert captured["methods"] == ["GET"]
+
+
[email protected]
+async def test_health_endpoint_returns_ok() -> None:
+    """The /health handler returns 200 with a JSON status body."""
+    from superset.mcp_service.server import _register_health_endpoint
+    from superset.utils import json
+
+    captured: dict[str, object] = {}
+
+    def custom_route(path: str, methods: list[str]) -> Callable[[Endpoint], 
Endpoint]:
+        def decorator(fn: Endpoint) -> Endpoint:
+            captured["fn"] = fn
+            return fn
+
+        return decorator
+
+    mcp_instance = MagicMock()

Review Comment:
   **Suggestion:** Add an explicit type annotation for this newly introduced 
local mock variable to comply with the rule requiring type hints on relevant 
variables. [custom_rule]
   
   **Severity Level:** Minor ๐Ÿงน
   <details>
   <summary><b>Why it matters? โญ </b></summary>
   
   This newly introduced local variable in modified Python code lacks an 
explicit type annotation even though it can be annotated, matching the 
type-hint rule.
   </details>
   <details>
   <summary><b>Rule source ๐Ÿ“– </b></summary>
   
   .cursor/rules/dev-standard.mdc (line 28)
   </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=3427fde792cf4190919e80e0a6a55eed&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=3427fde792cf4190919e80e0a6a55eed&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/test_mcp_server.py
   **Line:** 213:213
   **Comment:**
        *Custom Rule: Add an explicit type annotation for this newly introduced 
local mock variable to comply with the rule requiring type hints on relevant 
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%2F41755&comment_hash=df1046ffb7e977b6e7c960903b94b8afcfbc13611ae8112e237410a1e71dd281&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41755&comment_hash=df1046ffb7e977b6e7c960903b94b8afcfbc13611ae8112e237410a1e71dd281&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