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


##########
tests/unit_tests/models/test_soft_delete_mixin.py:
##########
@@ -167,6 +180,31 @@ def test_global_filter_excludes_soft_deleted_rows(
     assert result is None
 
 
[email protected]("_synthetic_tables")
+def test_listener_noop_when_gate_off(app_context: None, session: Session) -> 
None:
+    """With the ``SOFT_DELETE`` gate OFF, the listener attaches no criteria, 
so a
+    soft-deleted row is NOT hidden — the substrate is dark. (While
+    the gate is off the delete path also doesn't create such rows; this pins 
the
+    listener side.)"""
+    obj = _SoftDeletable(name="visible_when_gate_off")

Review Comment:
   **Suggestion:** Add an explicit type annotation for this newly introduced 
local variable to comply with the type-hint requirement. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   This is newly added Python code and the local variable `obj` is not 
type-annotated even though its type is clear from the constructor call, so it 
matches the rule requiring type hints on relevant variables.
   </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=8197f7c800734b4ebb2e87ec1632372a&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=8197f7c800734b4ebb2e87ec1632372a&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/models/test_soft_delete_mixin.py
   **Line:** 189:189
   **Comment:**
        *Custom Rule: Add an explicit type annotation for this newly introduced 
local variable to comply with 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%2F41166&comment_hash=00b80bce2100f1842564940d88ab10ae2a40dd3529b8defc20e031362e924d46&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41166&comment_hash=00b80bce2100f1842564940d88ab10ae2a40dd3529b8defc20e031362e924d46&reaction=dislike'>👎</a>



##########
tests/unit_tests/daos/test_base_dao_soft_delete.py:
##########
@@ -59,17 +59,37 @@ class _PlainDAO(BaseDAO[_Plain]):
     model_cls = _Plain
 
 
-def test_delete_routes_to_soft_delete_for_mixin_models(app_context: None) -> 
None:
-    """delete() calls soft_delete() when model_cls includes SoftDeleteMixin."""
+@patch("superset.daos.base.is_feature_enabled", return_value=True)
+def test_delete_routes_to_soft_delete_for_mixin_models(
+    mock_flag: MagicMock, app_context: None
+) -> None:
+    """delete() soft-deletes a mixin model when the SOFT_DELETE gate is ON."""
     items = [MagicMock(), MagicMock()]

Review Comment:
   **Suggestion:** Add an explicit type annotation for the local collection 
variable so the new test code follows the required typing rule for annotatable 
variables. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   The added test introduces a new local variable that can be annotated as a 
collection type, but it is left untyped. This matches the custom rule requiring 
type hints on relevant variables in new or modified Python 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=c24d65b10f44401283f4d47d406696a6&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=c24d65b10f44401283f4d47d406696a6&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/daos/test_base_dao_soft_delete.py
   **Line:** 67:67
   **Comment:**
        *Custom Rule: Add an explicit type annotation for the local collection 
variable so the new test code follows the required typing rule 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%2F41166&comment_hash=866d5271d6244579908c8567fe65cf86f0447f91a95b9a57036f9b3e92c75a47&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41166&comment_hash=866d5271d6244579908c8567fe65cf86f0447f91a95b9a57036f9b3e92c75a47&reaction=dislike'>👎</a>



##########
tests/unit_tests/models/test_soft_delete_mixin.py:
##########
@@ -167,6 +180,31 @@ def test_global_filter_excludes_soft_deleted_rows(
     assert result is None
 
 
[email protected]("_synthetic_tables")
+def test_listener_noop_when_gate_off(app_context: None, session: Session) -> 
None:
+    """With the ``SOFT_DELETE`` gate OFF, the listener attaches no criteria, 
so a
+    soft-deleted row is NOT hidden — the substrate is dark. (While
+    the gate is off the delete path also doesn't create such rows; this pins 
the
+    listener side.)"""
+    obj = _SoftDeletable(name="visible_when_gate_off")
+    session.add(obj)
+    session.flush()
+    obj_id = obj.id
+
+    obj.soft_delete()
+    session.flush()
+    session.expire_all()
+
+    with patch("superset.models.helpers.is_feature_enabled", 
return_value=False):
+        result = (
+            session.query(_SoftDeletable)
+            .filter(_SoftDeletable.id == obj_id)
+            .one_or_none()
+        )

Review Comment:
   **Suggestion:** Annotate this query result variable with its expected 
optional model type to meet the type-hint rule for relevant variables. 
[custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   The new query result variable `result` is left unannotated even though its 
optional model type is inferable, which fits the rule for annotating relevant 
Python variables.
   </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=0b42ab80436c4657b434933a4b75b12c&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=0b42ab80436c4657b434933a4b75b12c&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/models/test_soft_delete_mixin.py
   **Line:** 199:203
   **Comment:**
        *Custom Rule: Annotate this query result variable with its expected 
optional model type to meet the type-hint rule 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%2F41166&comment_hash=8b9f9187a9eb658906e5a66ae87a10a3c69b36aa8aa70a10a696accc59e605bc&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41166&comment_hash=8b9f9187a9eb658906e5a66ae87a10a3c69b36aa8aa70a10a696accc59e605bc&reaction=dislike'>👎</a>



##########
tests/unit_tests/models/test_soft_delete_mixin.py:
##########
@@ -167,6 +180,31 @@ def test_global_filter_excludes_soft_deleted_rows(
     assert result is None
 
 
[email protected]("_synthetic_tables")
+def test_listener_noop_when_gate_off(app_context: None, session: Session) -> 
None:
+    """With the ``SOFT_DELETE`` gate OFF, the listener attaches no criteria, 
so a
+    soft-deleted row is NOT hidden — the substrate is dark. (While
+    the gate is off the delete path also doesn't create such rows; this pins 
the
+    listener side.)"""
+    obj = _SoftDeletable(name="visible_when_gate_off")
+    session.add(obj)
+    session.flush()
+    obj_id = obj.id

Review Comment:
   **Suggestion:** Add a concrete type hint for this identifier value to 
satisfy the rule requiring annotations on relevant variables. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   This added line introduces an unannotated local variable `obj_id` whose type 
can be annotated, so it violates the Python type-hint requirement.
   </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=fd84748eefde4696b90def4953327e03&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=fd84748eefde4696b90def4953327e03&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/models/test_soft_delete_mixin.py
   **Line:** 192:192
   **Comment:**
        *Custom Rule: Add a concrete type hint for this identifier value to 
satisfy the rule requiring annotations 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%2F41166&comment_hash=b0eae144e44c4044f256f4362566228eacd054a64f35a9afef033a824d2b5297&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41166&comment_hash=b0eae144e44c4044f256f4362566228eacd054a64f35a9afef033a824d2b5297&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