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


##########
tests/integration_tests/utils_tests.py:
##########
@@ -497,3 +498,60 @@ def normalize_col(
         # test numeric epoch_ms format
         df = pd.DataFrame([{"__timestamp": ts.timestamp() * 1000, "a": 1}])
         assert normalize_col(df, "epoch_ms", 0, None)[DTTM_ALIAS][0] == ts
+
+
[email protected]("load_birth_names_dashboard_with_slices")
+class TestExtractDisplayLabels:

Review Comment:
   **Suggestion:** Add a class-level docstring that explains the intent and 
scope of this new test class. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   This is a newly added Python class and it has no docstring. The custom rule 
requires newly added classes to be documented inline, so the suggestion matches 
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=ac612f4b9e094ab5b282d43bccb13536&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=ac612f4b9e094ab5b282d43bccb13536&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/utils_tests.py
   **Line:** 504:504
   **Comment:**
        *Custom Rule: Add a class-level docstring that explains the intent and 
scope of this new test class.
   
   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%2F37396&comment_hash=a7b913fbb66485af0e7c1577c838a347f0aa688eba23142ffebcced9226e2924&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37396&comment_hash=a7b913fbb66485af0e7c1577c838a347f0aa688eba23142ffebcced9226e2924&reaction=dislike'>👎</a>



##########
tests/integration_tests/utils_tests.py:
##########
@@ -497,3 +498,60 @@ def normalize_col(
         # test numeric epoch_ms format
         df = pd.DataFrame([{"__timestamp": ts.timestamp() * 1000, "a": 1}])
         assert normalize_col(df, "epoch_ms", 0, None)[DTTM_ALIAS][0] == ts
+
+
[email protected]("load_birth_names_dashboard_with_slices")
+class TestExtractDisplayLabels:
+    def get_slice(self, slice_name: str) -> Slice:
+        return db.session.query(Slice).filter_by(slice_name=slice_name).one()
+
+    @pytest.mark.parametrize(
+        ("label_map", "colnames", "expected"),
+        [
+            (
+                {
+                    "Index": ["index"],
+                    "Gender": ["gender"],
+                    "Count": ["num_boys", "num_girls"],
+                },
+                ["gender", "num_boys", "num_girls", "unknown"],
+                ["Gender", "Count", "Count", "unknown"],
+            ),
+            (
+                {},
+                ["gender", "num_boys", "num_girls"],
+                ["gender", "num_boys", "num_girls"],
+            ),
+            (
+                # self-reference
+                {"gender": ["gender"]},
+                ["gender"],
+                ["gender"],
+            ),
+            (
+                {},
+                [],
+                [],
+            ),
+        ],
+    )
+    def test_extract_display_labels(
+        self,
+        label_map: dict[str, list[str]],
+        colnames: list[str],
+        expected: list[str],
+    ):
+        result = extract_display_labels(
+            label_map,
+            colnames,
+            self.get_slice("Trends").datasource,
+        )
+        assert result == expected
+
+    def test_no_datasource(self):

Review Comment:
   **Suggestion:** Add an explicit return type annotation to this new test 
method (for example, `-> None`) to keep new functions fully typed. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   This new test method lacks a return type annotation. Under the rule for new 
Python code being fully typed, that omission 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=2b0662aeb4494a72962677b35c271d3a&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=2b0662aeb4494a72962677b35c271d3a&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/utils_tests.py
   **Line:** 551:551
   **Comment:**
        *Custom Rule: Add an explicit return type annotation to this new test 
method (for example, `-> None`) to keep new functions fully 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%2F37396&comment_hash=993dafa04b9ab2b4d0548abb09c598e79f96099c052cd86d6aeebd46acfbb99a&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37396&comment_hash=993dafa04b9ab2b4d0548abb09c598e79f96099c052cd86d6aeebd46acfbb99a&reaction=dislike'>👎</a>



##########
tests/integration_tests/utils_tests.py:
##########
@@ -497,3 +498,60 @@ def normalize_col(
         # test numeric epoch_ms format
         df = pd.DataFrame([{"__timestamp": ts.timestamp() * 1000, "a": 1}])
         assert normalize_col(df, "epoch_ms", 0, None)[DTTM_ALIAS][0] == ts
+
+
[email protected]("load_birth_names_dashboard_with_slices")
+class TestExtractDisplayLabels:
+    def get_slice(self, slice_name: str) -> Slice:
+        return db.session.query(Slice).filter_by(slice_name=slice_name).one()
+
+    @pytest.mark.parametrize(
+        ("label_map", "colnames", "expected"),
+        [
+            (
+                {
+                    "Index": ["index"],
+                    "Gender": ["gender"],
+                    "Count": ["num_boys", "num_girls"],
+                },
+                ["gender", "num_boys", "num_girls", "unknown"],
+                ["Gender", "Count", "Count", "unknown"],
+            ),
+            (
+                {},
+                ["gender", "num_boys", "num_girls"],
+                ["gender", "num_boys", "num_girls"],
+            ),
+            (
+                # self-reference
+                {"gender": ["gender"]},
+                ["gender"],
+                ["gender"],
+            ),
+            (
+                {},
+                [],
+                [],
+            ),
+        ],
+    )
+    def test_extract_display_labels(
+        self,
+        label_map: dict[str, list[str]],
+        colnames: list[str],
+        expected: list[str],
+    ):

Review Comment:
   **Suggestion:** Add an explicit return type annotation to this test method 
(for example, `-> None`) to satisfy full typing requirements for new code. 
[custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   This newly added function has typed parameters but omits an explicit return 
type annotation. The custom rule requires new Python code to be fully typed, so 
the missing `-> None` 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=f0e4119f1e19429fb12f7d8c19a62930&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=f0e4119f1e19429fb12f7d8c19a62930&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/utils_tests.py
   **Line:** 538:543
   **Comment:**
        *Custom Rule: Add an explicit return type annotation to this test 
method (for example, `-> None`) to satisfy full typing requirements for 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%2F37396&comment_hash=850a80de769c36db7343d4303daece7e498dec5afe478722044d06457f617270&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37396&comment_hash=850a80de769c36db7343d4303daece7e498dec5afe478722044d06457f617270&reaction=dislike'>👎</a>



##########
tests/integration_tests/utils_tests.py:
##########
@@ -497,3 +498,60 @@ def normalize_col(
         # test numeric epoch_ms format
         df = pd.DataFrame([{"__timestamp": ts.timestamp() * 1000, "a": 1}])
         assert normalize_col(df, "epoch_ms", 0, None)[DTTM_ALIAS][0] == ts
+
+
[email protected]("load_birth_names_dashboard_with_slices")
+class TestExtractDisplayLabels:
+    def get_slice(self, slice_name: str) -> Slice:
+        return db.session.query(Slice).filter_by(slice_name=slice_name).one()

Review Comment:
   **Suggestion:** Add a docstring to this new helper method to describe what 
it retrieves and why it is used in these tests. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   The helper method is newly added and does not include a docstring. The rule 
explicitly flags newly added Python functions and classes without docstrings, 
so this is a verified 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=684c13cb3e7145009fec3161719dfe54&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=684c13cb3e7145009fec3161719dfe54&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/utils_tests.py
   **Line:** 505:506
   **Comment:**
        *Custom Rule: Add a docstring to this new helper method to describe 
what it retrieves and why it is used in these tests.
   
   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%2F37396&comment_hash=7a22a1cb7f41652f797acb0f7687b9084c38948d997e8f722abde8aa8c4b516f&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37396&comment_hash=7a22a1cb7f41652f797acb0f7687b9084c38948d997e8f722abde8aa8c4b516f&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