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


##########
tests/unit_tests/mcp_service/system/tool/test_find_users.py:
##########
@@ -255,3 +255,84 @@ async def 
test_list_charts_passes_changed_by_fk_filter_to_dao(mock_list, mcp_ser
     forwarded_filters = mock_list.call_args.kwargs.get("column_operators")
     assert forwarded_filters is not None
     assert any(getattr(f, "col", None) == "changed_by_fk" for f in 
forwarded_filters)
+
+
+# ---------------------------------------------------------------------------
+# LIKE wildcard escaping tests
+# ---------------------------------------------------------------------------
+
+
[email protected]
+async def test_find_users_escapes_percent_wildcard(mcp_server):

Review Comment:
   **Suggestion:** Add explicit type hints to this async test function 
signature, including the `mcp_server` parameter type and a `None` return type 
annotation. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   This is a newly added Python function in the modified hunk with no type 
annotations on the parameter or return type, which violates the Python 
type-hints 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=e10c35f45fd540e9bbac24b33b1d60e0&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=e10c35f45fd540e9bbac24b33b1d60e0&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/system/tool/test_find_users.py
   **Line:** 266:266
   **Comment:**
        *Custom Rule: Add explicit type hints to this async test function 
signature, including the `mcp_server` parameter type and a `None` 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%2F41593&comment_hash=9a2524b7de11cbd75f3ba66638daad8bd71b1f73195b64c662207c57ef183ce3&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41593&comment_hash=9a2524b7de11cbd75f3ba66638daad8bd71b1f73195b64c662207c57ef183ce3&reaction=dislike'>👎</a>



##########
superset/mcp_service/system/tool/find_users.py:
##########
@@ -64,17 +65,17 @@ async def find_users(request: FindUsersRequest, ctx: 
Context) -> FindUsersRespon
     )
 
     user_model = security_manager.user_model
-    needle = f"%{request.query.strip()}%"
+    needle = f"%{escape_like(request.query.strip())}%"

Review Comment:
   **Suggestion:** Add an explicit type annotation for the new local variable 
`needle` to comply with the required type-hint rule for newly introduced Python 
variables. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   This is a newly introduced Python variable that can be explicitly annotated 
as a string, so it matches the rule requiring type hints for relevant variables 
in modified code.
   </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=e06b7ed1b2c7491f9923595e445645df&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=e06b7ed1b2c7491f9923595e445645df&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/system/tool/find_users.py
   **Line:** 68:68
   **Comment:**
        *Custom Rule: Add an explicit type annotation for the new local 
variable `needle` to comply with the required type-hint rule for newly 
introduced Python 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%2F41593&comment_hash=726845b87d82a7bec6d0f6e06ad732bfd197a6560eb0ff092f2b1ce0f96f1b67&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41593&comment_hash=726845b87d82a7bec6d0f6e06ad732bfd197a6560eb0ff092f2b1ce0f96f1b67&reaction=dislike'>👎</a>



##########
tests/unit_tests/mcp_service/utils/test_sanitization.py:
##########
@@ -1024,3 +1024,44 @@ def 
test_sanitize_sql_expression_allows_url_scheme_in_string_literal():
     sanitize_sql_expression = _sanitize_sql()
     expr = "COUNT(CASE WHEN url LIKE 'javascript:%' THEN 1 END)"
     assert sanitize_sql_expression(expr, "sql_expression") == expr
+
+
+# ---------------------------------------------------------------------------
+# escape_like
+# ---------------------------------------------------------------------------
+
+
+def test_escape_like_plain_text():

Review Comment:
   **Suggestion:** Add an explicit return type hint to this test function 
signature. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   The added test function is a new Python function with no return type 
annotation, which violates the rule requiring type hints on new or modified 
Python functions when 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=a6f281247974448682ead44cf3bf2b86&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=a6f281247974448682ead44cf3bf2b86&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/utils/test_sanitization.py
   **Line:** 1034:1034
   **Comment:**
        *Custom Rule: Add an explicit return type hint to this test function 
signature.
   
   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%2F41593&comment_hash=e798f72799aab21af53fec30f244fdd9173e439a206ec48fa4cbd621c56255ba&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41593&comment_hash=e798f72799aab21af53fec30f244fdd9173e439a206ec48fa4cbd621c56255ba&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