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


##########
tests/integration_tests/deletion_retention/_base.py:
##########
@@ -0,0 +1,228 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Shared base + self-contained builders for deletion-retention tests.
+
+These tests do not depend on the example datasets โ€” each builds its own
+``Database`` + ``SqlaTable`` so they run on a bare (schema-only) test DB.
+Everything created is torn down (bypassing the soft-delete visibility
+filter) so a leftover soft-deleted row never trips a later test.
+"""
+
+from __future__ import annotations
+
+from datetime import datetime, timedelta
+from typing import Any
+
+import sqlalchemy as sa
+
+from superset import db
+from superset.connectors.sqla.models import SqlaTable, SqlMetric, TableColumn
+from superset.constants import SKIP_VISIBILITY_FILTER_CLASSES
+from superset.models.core import Database
+from superset.models.dashboard import Dashboard
+from superset.models.slice import Slice
+from tests.integration_tests.base_tests import SupersetTestCase
+
+_PREFIX = "retention_it_"
+
+
+def _bypass(model: type[Any]) -> dict[str, Any]:
+    return {"execution_options": {SKIP_VISIBILITY_FILTER_CLASSES: {model}}}
+
+
+class DeletionRetentionTestBase(SupersetTestCase):
+    """Builds an isolated database + dataset and cleans up after itself."""
+
+    def setUp(self) -> None:
+        super().setUp()
+        self._cleanup()
+        self.database = Database(
+            database_name=f"{_PREFIX}db", sqlalchemy_uri="sqlite://"
+        )
+        db.session.add(self.database)
+        db.session.commit()
+        self.dataset = self.make_dataset("ds")

Review Comment:
   **Suggestion:** Add an explicit type annotation for this instance attribute 
assignment to satisfy the type-hint requirement. [custom_rule]
   
   **Severity Level:** Minor ๐Ÿงน
   <details>
   <summary><b>Why it matters? โญ </b></summary>
   
   This is another newly introduced instance attribute assignment without an 
explicit type hint, so it violates the Python type-hint requirement for 
annotatable 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=3138a4d11ff149a1ac4e4cd298a19c19&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=3138a4d11ff149a1ac4e4cd298a19c19&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/integration_tests/deletion_retention/_base.py
   **Line:** 58:58
   **Comment:**
        *Custom Rule: Add an explicit type annotation for this instance 
attribute assignment 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%2F41549&comment_hash=7f921bf9708a7e1fb0f7e88a5775e78df665f9468fbace31d5f6851e564f812f&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41549&comment_hash=7f921bf9708a7e1fb0f7e88a5775e78df665f9468fbace31d5f6851e564f812f&reaction=dislike'>๐Ÿ‘Ž</a>



##########
tests/integration_tests/deletion_retention/_base.py:
##########
@@ -0,0 +1,228 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Shared base + self-contained builders for deletion-retention tests.
+
+These tests do not depend on the example datasets โ€” each builds its own
+``Database`` + ``SqlaTable`` so they run on a bare (schema-only) test DB.
+Everything created is torn down (bypassing the soft-delete visibility
+filter) so a leftover soft-deleted row never trips a later test.
+"""
+
+from __future__ import annotations
+
+from datetime import datetime, timedelta
+from typing import Any
+
+import sqlalchemy as sa
+
+from superset import db
+from superset.connectors.sqla.models import SqlaTable, SqlMetric, TableColumn
+from superset.constants import SKIP_VISIBILITY_FILTER_CLASSES
+from superset.models.core import Database
+from superset.models.dashboard import Dashboard
+from superset.models.slice import Slice
+from tests.integration_tests.base_tests import SupersetTestCase
+
+_PREFIX = "retention_it_"
+
+
+def _bypass(model: type[Any]) -> dict[str, Any]:
+    return {"execution_options": {SKIP_VISIBILITY_FILTER_CLASSES: {model}}}
+
+
+class DeletionRetentionTestBase(SupersetTestCase):
+    """Builds an isolated database + dataset and cleans up after itself."""
+
+    def setUp(self) -> None:
+        super().setUp()
+        self._cleanup()
+        self.database = Database(
+            database_name=f"{_PREFIX}db", sqlalchemy_uri="sqlite://"
+        )

Review Comment:
   **Suggestion:** Add an explicit type annotation for this instance attribute 
assignment so it is statically typed. [custom_rule]
   
   **Severity Level:** Minor ๐Ÿงน
   <details>
   <summary><b>Why it matters? โญ </b></summary>
   
   This new instance attribute is assigned without any type annotation in a 
newly added Python class, which matches the type-hint rule for relevant 
variables that can be annotated.
   </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=1f5696531f644cadb0ec6f00ed1bf93a&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=1f5696531f644cadb0ec6f00ed1bf93a&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/integration_tests/deletion_retention/_base.py
   **Line:** 53:55
   **Comment:**
        *Custom Rule: Add an explicit type annotation for this instance 
attribute assignment so it is statically typed.
   
   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%2F41549&comment_hash=2b5fbee2caf36c0e3d1507df8530b979833c3a4013fe10c6330335a58c92720d&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41549&comment_hash=2b5fbee2caf36c0e3d1507df8530b979833c3a4013fe10c6330335a58c92720d&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