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


##########
superset-core/src/superset_core/common/models.py:
##########
@@ -285,6 +285,38 @@ class User(CoreModel):
     active: bool
 
 
+class Role(CoreModel):
+    """
+    Abstract Role model interface.
+
+    Host implementations will replace this class during initialization
+    with concrete implementation providing actual functionality.
+    """
+
+    __abstract__ = True
+
+    # Type hints for expected attributes (no actual field definitions)
+    id: int
+    name: str | None
+

Review Comment:
   **Suggestion:** For this new model interface, avoid introducing an integer 
primary identifier and expose a UUID-based identifier instead. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   The PR adds a new abstract model interface (`Role`) with an `id: int` 
identifier. Under the UUID-primary-key rule, new model surfaces should prefer 
UUID-based identifiers instead of integer primary keys, so this is a real 
violation in the newly added code.
   </details>
   <details>
   <summary><b>Rule source 📖 </b></summary>
   
   .github/copilot-instructions.md (line 51)
   </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=5f2e4cfed1ce4b9cb5041229ea402d6e&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=5f2e4cfed1ce4b9cb5041229ea402d6e&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-core/src/superset_core/common/models.py
   **Line:** 288:301
   **Comment:**
        *Custom Rule: For this new model interface, avoid introducing an 
integer primary identifier and expose a UUID-based identifier instead.
   
   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%2F41897&comment_hash=641289f932d8dc8e3badb59cedf7d64bf7744d8bf32c69d0160903964465e66c&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41897&comment_hash=641289f932d8dc8e3badb59cedf7d64bf7744d8bf32c69d0160903964465e66c&reaction=dislike'>👎</a>



##########
superset-core/src/superset_core/common/models.py:
##########
@@ -285,6 +285,38 @@ class User(CoreModel):
     active: bool
 
 
+class Role(CoreModel):
+    """
+    Abstract Role model interface.
+
+    Host implementations will replace this class during initialization
+    with concrete implementation providing actual functionality.
+    """
+
+    __abstract__ = True
+
+    # Type hints for expected attributes (no actual field definitions)
+    id: int
+    name: str | None
+
+
+class Group(CoreModel):
+    """
+    Abstract Group model interface.
+
+    Host implementations will replace this class during initialization
+    with concrete implementation providing actual functionality.
+    """
+
+    __abstract__ = True
+
+    # Type hints for expected attributes (no actual field definitions)
+    id: int
+    name: str | None
+    label: str | None
+    description: str | None

Review Comment:
   **Suggestion:** Update this newly added model contract to use a UUID 
identifier rather than introducing an integer primary identifier. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   The PR adds a new abstract model interface (`Group`) that exposes `id: int` 
as its identifier. This matches the UUID-primary-key rule violation because the 
newly introduced model surface uses an integer identifier instead of a 
UUID-based one.
   </details>
   <details>
   <summary><b>Rule source 📖 </b></summary>
   
   .github/copilot-instructions.md (line 51)
   </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=5c47ac80eb00430bb3705f42d7997462&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=5c47ac80eb00430bb3705f42d7997462&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-core/src/superset_core/common/models.py
   **Line:** 303:317
   **Comment:**
        *Custom Rule: Update this newly added model contract to use a UUID 
identifier rather than introducing an integer primary identifier.
   
   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%2F41897&comment_hash=3f34c7ff7e2e523bfb5e1892c4e929e70cb16fed3ddc0edd2fc2cf8aba111031&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41897&comment_hash=3f34c7ff7e2e523bfb5e1892c4e929e70cb16fed3ddc0edd2fc2cf8aba111031&reaction=dislike'>👎</a>



##########
superset/subjects/filters.py:
##########
@@ -176,6 +176,28 @@ def apply(self, query: Query, value: Optional[Any]) -> 
Query:
         return _apply_subject_list_filters(query)
 
 
+class SubjectAllTextFilter(BaseFilter):  # pylint: 
disable=too-few-public-methods
+    """ILIKE search across a subject's textual columns.
+
+    Used by the Subject REST API ``search_filters`` for free-text search.
+    """
+
+    name = _("All Text")
+    arg_name = "subject_all_text"

Review Comment:
   **Suggestion:** Add explicit type annotations for the newly introduced 
class-level filter metadata variables so the new code fully complies with the 
type-hint requirement. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   The new class-level metadata variables `name` and `arg_name` are unannotated 
even though they are simple string attributes that can be typed, so this 
matches the Python type-hint rule for newly introduced code.
   </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=836bebe5a5c14f41af9557b2c9e553ec&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=836bebe5a5c14f41af9557b2c9e553ec&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/subjects/filters.py
   **Line:** 185:186
   **Comment:**
        *Custom Rule: Add explicit type annotations for the newly introduced 
class-level filter metadata variables so the new code fully complies 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%2F41897&comment_hash=c007a2e045f5605e06e6d6a2d2162599a49bf7301b3bb261d51a0ab5d1d08103&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41897&comment_hash=c007a2e045f5605e06e6d6a2d2162599a49bf7301b3bb261d51a0ab5d1d08103&reaction=dislike'>👎</a>



##########
tests/unit_tests/dao/subject_test.py:
##########
@@ -0,0 +1,61 @@
+# 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.
+from __future__ import annotations
+
+from typing import Generator
+
+import pytest
+
+from superset import db
+from superset.daos.subject import SubjectDAO
+from superset.subjects.types import SubjectType
+
+
[email protected]
+def after_each() -> Generator[None, None, None]:
+    yield
+    db.session.rollback()
+
+
+def test_create_and_find(after_each: None) -> None:  # noqa: F811
+    subject = SubjectDAO.create(attributes={"label": "Alice", "type": 
SubjectType.USER})

Review Comment:
   **Suggestion:** Add an explicit type annotation for this local variable to 
comply with the type-hint requirement for relevant variables. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   The rule requires type hints on relevant variables when they can be 
annotated. This new local variable is inferred from a DAO call and is not 
annotated, so the suggestion matches a real rule violation.
   </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=d5149f07f4154c3c838d4a6156a50e24&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=d5149f07f4154c3c838d4a6156a50e24&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/dao/subject_test.py
   **Line:** 35:35
   **Comment:**
        *Custom Rule: Add an explicit type annotation for this local variable 
to comply with the type-hint requirement 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%2F41897&comment_hash=9530460fc83078027c665596f2a28b8c836332ca787d846f34ff0052f892c6ee&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41897&comment_hash=9530460fc83078027c665596f2a28b8c836332ca787d846f34ff0052f892c6ee&reaction=dislike'>👎</a>



##########
tests/unit_tests/dao/subject_test.py:
##########
@@ -0,0 +1,61 @@
+# 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.
+from __future__ import annotations
+
+from typing import Generator
+
+import pytest
+
+from superset import db
+from superset.daos.subject import SubjectDAO
+from superset.subjects.types import SubjectType
+
+
[email protected]
+def after_each() -> Generator[None, None, None]:
+    yield
+    db.session.rollback()
+
+
+def test_create_and_find(after_each: None) -> None:  # noqa: F811
+    subject = SubjectDAO.create(attributes={"label": "Alice", "type": 
SubjectType.USER})
+    db.session.flush()
+
+    assert SubjectDAO.find_by_id(subject.id) is subject
+    assert SubjectDAO.find_one_or_none(label="Alice") is subject
+
+
+def test_find_all_and_filter_by(after_each: None) -> None:  # noqa: F811
+    SubjectDAO.create(attributes={"label": "RoleA", "type": SubjectType.ROLE})
+    SubjectDAO.create(attributes={"label": "GroupA", "type": 
SubjectType.GROUP})
+    db.session.flush()
+
+    labels = {s.label for s in SubjectDAO.find_all()}

Review Comment:
   **Suggestion:** Add an explicit type annotation for this computed collection 
variable so its type is clear and enforced. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   This is a newly introduced computed collection variable without an explicit 
type annotation. It fits the custom rule for annotating relevant variables in 
new Python code.
   </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=254163feda03418dbda829de3e4a0735&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=254163feda03418dbda829de3e4a0735&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/dao/subject_test.py
   **Line:** 47:47
   **Comment:**
        *Custom Rule: Add an explicit type annotation for this computed 
collection variable so its type is clear and enforced.
   
   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%2F41897&comment_hash=f8dbdafdeeac53a8f017deab47feaaeddaba5019ecd98d0bd8616aaa836d00e5&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41897&comment_hash=f8dbdafdeeac53a8f017deab47feaaeddaba5019ecd98d0bd8616aaa836d00e5&reaction=dislike'>👎</a>



##########
tests/unit_tests/dao/subject_test.py:
##########
@@ -0,0 +1,61 @@
+# 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.
+from __future__ import annotations
+
+from typing import Generator
+
+import pytest
+
+from superset import db
+from superset.daos.subject import SubjectDAO
+from superset.subjects.types import SubjectType
+
+
[email protected]
+def after_each() -> Generator[None, None, None]:
+    yield
+    db.session.rollback()
+
+
+def test_create_and_find(after_each: None) -> None:  # noqa: F811
+    subject = SubjectDAO.create(attributes={"label": "Alice", "type": 
SubjectType.USER})
+    db.session.flush()
+
+    assert SubjectDAO.find_by_id(subject.id) is subject
+    assert SubjectDAO.find_one_or_none(label="Alice") is subject
+
+
+def test_find_all_and_filter_by(after_each: None) -> None:  # noqa: F811
+    SubjectDAO.create(attributes={"label": "RoleA", "type": SubjectType.ROLE})
+    SubjectDAO.create(attributes={"label": "GroupA", "type": 
SubjectType.GROUP})
+    db.session.flush()
+
+    labels = {s.label for s in SubjectDAO.find_all()}
+    assert {"RoleA", "GroupA"} <= labels
+
+    roles = SubjectDAO.filter_by(type=SubjectType.ROLE)
+    assert all(s.type == SubjectType.ROLE for s in roles)
+
+
+def test_delete(after_each: None) -> None:  # noqa: F811
+    subject = SubjectDAO.create(attributes={"label": "Temp", "type": 
SubjectType.USER})

Review Comment:
   **Suggestion:** Add an explicit type annotation for this local variable in 
the test to keep variable typing consistent across new code. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   This is another new local variable introduced without a type annotation in 
Python code, which matches the type-hint requirement for relevant 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=c16a578eb20e4d368dead788362fabf1&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=c16a578eb20e4d368dead788362fabf1&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/dao/subject_test.py
   **Line:** 55:55
   **Comment:**
        *Custom Rule: Add an explicit type annotation for this local variable 
in the test to keep variable typing consistent across new code.
   
   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%2F41897&comment_hash=c79780996999633532649092dc72ffefa5a6dea42b4f13300e9c7c6e98e9c4e0&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41897&comment_hash=c79780996999633532649092dc72ffefa5a6dea42b4f13300e9c7c6e98e9c4e0&reaction=dislike'>👎</a>



##########
tests/unit_tests/dao/subject_test.py:
##########
@@ -0,0 +1,61 @@
+# 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.
+from __future__ import annotations
+
+from typing import Generator
+
+import pytest
+
+from superset import db
+from superset.daos.subject import SubjectDAO
+from superset.subjects.types import SubjectType
+
+
[email protected]
+def after_each() -> Generator[None, None, None]:
+    yield
+    db.session.rollback()
+
+
+def test_create_and_find(after_each: None) -> None:  # noqa: F811
+    subject = SubjectDAO.create(attributes={"label": "Alice", "type": 
SubjectType.USER})
+    db.session.flush()
+
+    assert SubjectDAO.find_by_id(subject.id) is subject
+    assert SubjectDAO.find_one_or_none(label="Alice") is subject
+
+
+def test_find_all_and_filter_by(after_each: None) -> None:  # noqa: F811
+    SubjectDAO.create(attributes={"label": "RoleA", "type": SubjectType.ROLE})
+    SubjectDAO.create(attributes={"label": "GroupA", "type": 
SubjectType.GROUP})
+    db.session.flush()
+
+    labels = {s.label for s in SubjectDAO.find_all()}
+    assert {"RoleA", "GroupA"} <= labels
+
+    roles = SubjectDAO.filter_by(type=SubjectType.ROLE)

Review Comment:
   **Suggestion:** Add a type annotation for this DAO result variable to 
satisfy the rule requiring type hints on relevant variables. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   The variable stores the result of a DAO query and lacks an explicit type 
hint. Since the rule flags relevant variables that can be annotated, this is a 
valid violation.
   </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=f9e3ac1627ca4017b939f18d37d9bd67&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=f9e3ac1627ca4017b939f18d37d9bd67&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/dao/subject_test.py
   **Line:** 50:50
   **Comment:**
        *Custom Rule: Add a type annotation for this DAO result variable to 
satisfy the rule requiring type hints 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%2F41897&comment_hash=81cae8a792ec5f4cb2a487e4e210c070f54dbf2b6a194be216a6e1b5a80e804e&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41897&comment_hash=81cae8a792ec5f4cb2a487e4e210c070f54dbf2b6a194be216a6e1b5a80e804e&reaction=dislike'>👎</a>



##########
tests/integration_tests/subjects/api_tests.py:
##########
@@ -0,0 +1,142 @@
+# 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.
+from typing import Generator
+
+import pytest
+import rison
+
+import tests.integration_tests.test_app  # noqa: F401
+from superset import db
+from superset.subjects.models import Subject
+from superset.subjects.types import SubjectType
+from superset.utils import json
+from tests.integration_tests.base_tests import SupersetTestCase
+from tests.integration_tests.constants import ADMIN_USERNAME, GAMMA_USERNAME
+
+SUBJECTS_FIXTURE_COUNT = 3

Review Comment:
   **Suggestion:** Add an explicit type annotation to this module-level 
constant to satisfy the required type-hint coverage for relevant variables. 
[custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   The new module-level constant is untyped even though it can be annotated as 
an int. This matches the Python type-hint rule for relevant variables 
introduced in new code.
   </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=f4fb3b64bfdb412d96f958a0dd9263bc&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=f4fb3b64bfdb412d96f958a0dd9263bc&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/subjects/api_tests.py
   **Line:** 30:30
   **Comment:**
        *Custom Rule: Add an explicit type annotation to this module-level 
constant to satisfy the required type-hint coverage 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%2F41897&comment_hash=a3d86a9d5389b7df5f0491255f0be8bff97d41d6893af833f1438e4e837f796e&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41897&comment_hash=a3d86a9d5389b7df5f0491255f0be8bff97d41d6893af833f1438e4e837f796e&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