codeant-ai-for-open-source[bot] commented on code in PR #40495:
URL: https://github.com/apache/superset/pull/40495#discussion_r3541763989
##########
tests/unit_tests/commands/sql_lab/streaming_export_command_test.py:
##########
@@ -771,3 +771,39 @@ def
test_csv_export_config_custom_decimal_for_decimal_type(mocker, mock_query) -
assert "2;56,78" in csv_data
assert "12.34" not in csv_data
assert "56.78" not in csv_data
+
+
+def test_sqllab_streaming_does_not_double_mutate_sql(mocker, mock_query) ->
None:
Review Comment:
**Suggestion:** Add explicit type annotations to all function parameters in
this new test function to satisfy the type-hint requirement. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
This is a newly added Python test function with untyped parameters
(`mocker`, `mock_query`). The rule requires type hints on new or modified
Python functions when they can be annotated, so the violation is real.
</details>
<details>
<summary><b>Rule source 📖 </b></summary>
.cursor/rules/dev-standard.mdc (line 28)
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=7d176190366f4d75a5fc4050a662ac30&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=7d176190366f4d75a5fc4050a662ac30&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/commands/sql_lab/streaming_export_command_test.py
**Line:** 776:776
**Comment:**
*Custom Rule: Add explicit type annotations to all function parameters
in this new test function to satisfy 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%2F40495&comment_hash=fa7daac5e96b050bd6607243ae99b12716f49c0076ef02e67ee1d7fe675523ea&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40495&comment_hash=fa7daac5e96b050bd6607243ae99b12716f49c0076ef02e67ee1d7fe675523ea&reaction=dislike'>👎</a>
##########
tests/unit_tests/commands/chart/streaming_export_command_test.py:
##########
@@ -39,6 +39,10 @@ def _setup_chart_mocks(
datasource = mocker.MagicMock()
datasource.get_query_str.return_value = sql
datasource.database = mocker.MagicMock()
+ # Pass-through mutator so ``text(mutated_sql)`` receives the test's SQL
+ # string unchanged. Individual tests can override ``return_value`` to
+ # exercise specific mutation behavior.
+ datasource.database.mutate_sql_based_on_config.side_effect = lambda s: s
Review Comment:
**Suggestion:** Replace the untyped lambda assigned to the SQL mutator with
a small typed helper function so its parameter and return value are explicitly
annotated. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
The new lambda introduces callable Python code without type hints on its
parameter or return value. This matches the rule requiring type hints for newly
added Python functions or callable logic that can be annotated.
</details>
<details>
<summary><b>Rule source 📖 </b></summary>
.cursor/rules/dev-standard.mdc (line 28)
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=aa2fac97dae54896980d7840571a9863&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=aa2fac97dae54896980d7840571a9863&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/commands/chart/streaming_export_command_test.py
**Line:** 45:45
**Comment:**
*Custom Rule: Replace the untyped lambda assigned to the SQL mutator
with a small typed helper function so its parameter and return value are
explicitly annotated.
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%2F40495&comment_hash=63cb063bf0af4e1a4b63fe5f8cb8758148fb014dd097c807afa9e5b97c74549e&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40495&comment_hash=63cb063bf0af4e1a4b63fe5f8cb8758148fb014dd097c807afa9e5b97c74549e&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]