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


##########
tests/unit_tests/utils/slack_test.py:
##########
@@ -216,3 +226,192 @@ def test_handle_pagination_multiple_pages(self, mocker):
             {"name": "general", "id": "C12345"},
             {"name": "random", "id": "C67890"},
         ]
+
+
+# ---------------------------------------------------------------------------
+# should_use_v2_api: drives the v1→v2 auto-upgrade decision and emits
+# DeprecationWarning + logger.warning for both no-flag and missing-scope cases.
+# ---------------------------------------------------------------------------
+
+
[email protected](autouse=True)
+def _reset_v1_warning_caches():

Review Comment:
   **Suggestion:** Add an explicit return type annotation to this newly added 
fixture function (for example, a generator/yield-compatible return type) to 
satisfy full typing requirements. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   This is a newly added Python fixture function and it has no return type 
annotation. The rule requires new Python code to be fully typed, so omitting 
the generator/yield-compatible return type 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=bd9197c4865e4753aa932e75239e0c20&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=bd9197c4865e4753aa932e75239e0c20&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/utils/slack_test.py
   **Line:** 237:238
   **Comment:**
        *Custom Rule: Add an explicit return type annotation to this newly 
added fixture function (for example, a generator/yield-compatible return type) 
to satisfy full typing requirements.
   
   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%2F39914&comment_hash=648bcec47889965e4b39b58a5ea23ff3eaef23556b53bb302e0f0e8c6e8293e3&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F39914&comment_hash=648bcec47889965e4b39b58a5ea23ff3eaef23556b53bb302e0f0e8c6e8293e3&reaction=dislike'>👎</a>



##########
tests/unit_tests/utils/slack_test.py:
##########
@@ -216,3 +226,192 @@ def test_handle_pagination_multiple_pages(self, mocker):
             {"name": "general", "id": "C12345"},
             {"name": "random", "id": "C67890"},
         ]
+
+
+# ---------------------------------------------------------------------------
+# should_use_v2_api: drives the v1→v2 auto-upgrade decision and emits
+# DeprecationWarning + logger.warning for both no-flag and missing-scope cases.
+# ---------------------------------------------------------------------------
+
+
[email protected](autouse=True)
+def _reset_v1_warning_caches():
+    """Each test sees fresh once-per-process warning state.
+
+    The deprecation emitters are wrapped in `functools.cache` to give
+    thread-safe one-shot semantics in production. Tests need them to fire
+    again, so we clear the cache before and after each case.
+    """
+    _emit_v1_flag_off_deprecation.cache_clear()
+    _emit_v1_scope_missing_deprecation.cache_clear()
+    yield
+    _emit_v1_flag_off_deprecation.cache_clear()
+    _emit_v1_scope_missing_deprecation.cache_clear()
+
+
+class TestShouldUseV2Api:
+    def test_returns_true_when_flag_on_and_scopes_present(self, mocker):

Review Comment:
   **Suggestion:** Add complete type hints for this new test method, including 
the `mocker` parameter type and an explicit `None` return type. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   This is a newly added Python test method and it lacks both parameter type 
hints and an explicit return type. Under the rule that new Python code should 
be fully typed, this is a genuine 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=c8e5622283e44ddc936fdefbf6e3fba1&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=c8e5622283e44ddc936fdefbf6e3fba1&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/utils/slack_test.py
   **Line:** 253:253
   **Comment:**
        *Custom Rule: Add complete type hints for this new test method, 
including the `mocker` parameter type and an explicit `None` return type.
   
   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%2F39914&comment_hash=72267683e679de1317bbe5da47ce8414c9f4a8356b160b83fdb9a08a894bf2f4&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F39914&comment_hash=72267683e679de1317bbe5da47ce8414c9f4a8356b160b83fdb9a08a894bf2f4&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