codeant-ai-for-open-source[bot] commented on code in PR #41456:
URL: https://github.com/apache/superset/pull/41456#discussion_r3536806681
##########
tests/unit_tests/semantic_layers/mapper_test.py:
##########
@@ -1004,6 +1005,379 @@ def
test_map_query_object_with_time_offsets(mock_datasource: MagicMock) -> None:
}
+def _make_grain_variant_datasource(
+ mocker: MockerFixture,
+ granularity_dim_grain: Grain | None,
+ extra_dim_grain: Grain | None = None,
+) -> MagicMock:
+ """Datasource with raw + Hour + Day variants on ``order_date``."""
+ datasource = mocker.Mock()
Review Comment:
**Suggestion:** Add an explicit type annotation to this mocked datasource
variable to satisfy the type-hint requirement for relevant variables.
[custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
The new helper introduces a local variable created from `mocker.Mock()`
without any type annotation. Under the Python type-hint rule, this is a
relevant variable that can be annotated, so the suggestion identifies a real
violation.
</details>
<details>
<summary><b>Rule source 📖 </b></summary>
.cursor/rules/dev-standard.mdc (line 28)
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=55cc693aab4645ea85d7d756f2cc29bc&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=55cc693aab4645ea85d7d756f2cc29bc&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/semantic_layers/mapper_test.py
**Line:** 1014:1014
**Comment:**
*Custom Rule: Add an explicit type annotation to this mocked datasource
variable to satisfy 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%2F41456&comment_hash=6147ca46ef690851660d3286d40c5977a2cd8a36abb6852194e63c26d10cf828&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41456&comment_hash=6147ca46ef690851660d3286d40c5977a2cd8a36abb6852194e63c26d10cf828&reaction=dislike'>👎</a>
##########
tests/unit_tests/semantic_layers/mapper_test.py:
##########
@@ -1004,6 +1005,379 @@ def
test_map_query_object_with_time_offsets(mock_datasource: MagicMock) -> None:
}
+def _make_grain_variant_datasource(
+ mocker: MockerFixture,
+ granularity_dim_grain: Grain | None,
+ extra_dim_grain: Grain | None = None,
+) -> MagicMock:
+ """Datasource with raw + Hour + Day variants on ``order_date``."""
+ datasource = mocker.Mock()
+ base = {
+ "id": "orders.order_date",
+ "name": "order_date",
+ "type": pa.timestamp("us"),
+ "description": "Order date",
+ "definition": "order_date",
+ }
+ date_variants = {
+ Dimension(**base, grain=None),
+ Dimension(**base, grain=Grains.HOUR),
+ Dimension(**base, grain=Grains.DAY),
+ }
Review Comment:
**Suggestion:** Annotate this set variable with its element type so the new
code fully adheres to the type-hinting rule. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
This is a newly added local set variable with no type annotation. Since the
rule requires type hints on 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>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=8b29e20cafd245bbaa80e23e1f2926e3&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=8b29e20cafd245bbaa80e23e1f2926e3&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/semantic_layers/mapper_test.py
**Line:** 1022:1026
**Comment:**
*Custom Rule: Annotate this set variable with its element type so the
new code fully adheres to the type-hinting rule.
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%2F41456&comment_hash=152d9e9793bacbef65d89cbd82fa4fe0a3a90b6787015e2fbfa0aee9f8809aa7&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41456&comment_hash=152d9e9793bacbef65d89cbd82fa4fe0a3a90b6787015e2fbfa0aee9f8809aa7&reaction=dislike'>👎</a>
##########
tests/unit_tests/semantic_layers/mapper_test.py:
##########
@@ -1004,6 +1005,379 @@ def
test_map_query_object_with_time_offsets(mock_datasource: MagicMock) -> None:
}
+def _make_grain_variant_datasource(
+ mocker: MockerFixture,
+ granularity_dim_grain: Grain | None,
+ extra_dim_grain: Grain | None = None,
+) -> MagicMock:
+ """Datasource with raw + Hour + Day variants on ``order_date``."""
+ datasource = mocker.Mock()
+ base = {
+ "id": "orders.order_date",
+ "name": "order_date",
+ "type": pa.timestamp("us"),
+ "description": "Order date",
+ "definition": "order_date",
+ }
Review Comment:
**Suggestion:** Add a concrete type annotation for this dictionary to comply
with the rule requiring type hints on relevant variables. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
The dictionary is a newly introduced local variable and has no type
annotation. It is used to build typed `Dimension` objects, so it is a relevant
annotatable variable covered by the rule.
</details>
<details>
<summary><b>Rule source 📖 </b></summary>
.cursor/rules/dev-standard.mdc (line 28)
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=bc584c4ca30c4c6e93af7af3fd67b406&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=bc584c4ca30c4c6e93af7af3fd67b406&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/semantic_layers/mapper_test.py
**Line:** 1015:1021
**Comment:**
*Custom Rule: Add a concrete type annotation for this dictionary to
comply with 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%2F41456&comment_hash=43074b7794205c569c6e89ec54b8cef8b9efea794ddf06847377e8cfd091e7f1&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41456&comment_hash=43074b7794205c569c6e89ec54b8cef8b9efea794ddf06847377e8cfd091e7f1&reaction=dislike'>👎</a>
##########
tests/unit_tests/semantic_layers/models_test.py:
##########
@@ -655,6 +655,118 @@ def test_semantic_view_data(
assert data["offset"] == 0
[email protected]
+def mock_grain_variant_dimensions() -> list[Dimension]:
+ """Time column exposed as multiple Dimension variants, one per grain."""
+ base = {
+ "id": "orders.created_at",
+ "name": "created_at",
+ "type": pa.timestamp("us"),
+ "definition": "orders.created_at",
+ "description": "Order timestamp",
Review Comment:
**Suggestion:** Add an explicit type annotation to this newly introduced
local dictionary to satisfy the type-hint requirement for relevant variables.
[custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
This newly added local dictionary is a relevant variable that can be
annotated, but it has no type hint. That matches the Python type-hint rule
violation.
</details>
<details>
<summary><b>Rule source 📖 </b></summary>
.cursor/rules/dev-standard.mdc (line 28)
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=931cba9761f24b7aaf5a1d1248e05550&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=931cba9761f24b7aaf5a1d1248e05550&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/semantic_layers/models_test.py
**Line:** 660:666
**Comment:**
*Custom Rule: Add an explicit type annotation to this newly introduced
local dictionary to satisfy 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%2F41456&comment_hash=0cc9321deab2c897dcd16c0479ff42893c3d9453e8ebee847fbd882705eb1d84&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41456&comment_hash=0cc9321deab2c897dcd16c0479ff42893c3d9453e8ebee847fbd882705eb1d84&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]