codeant-ai-for-open-source[bot] commented on code in PR #39973:
URL: https://github.com/apache/superset/pull/39973#discussion_r3573414804
##########
superset/commands/report/execute.py:
##########
@@ -263,6 +263,9 @@ def _get_url(
"""
Get the url for this report schedule: chart or dashboard
"""
+ chart = self._report_schedule.chart
+ dashboard = self._report_schedule.dashboard
Review Comment:
**Suggestion:** Add explicit type annotations for the newly introduced local
target variables so the new null-guard logic is fully type-checked.
[custom_rule]
**Severity Level:** Minor ๐งน
<details>
<summary><b>Why it matters? โญ </b></summary>
The new local variables `chart` and `dashboard` are introduced without type
annotations in modified Python code. Since these values are used in null checks
and downstream branching, they are relevant variables that can be annotated
under the type-hint 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=9f2dfa26b9ba41a6a82edadc67d1587e&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=9f2dfa26b9ba41a6a82edadc67d1587e&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/commands/report/execute.py
**Line:** 266:267
**Comment:**
*Custom Rule: Add explicit type annotations for the newly introduced
local target variables so the new null-guard logic is fully type-checked.
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%2F39973&comment_hash=a4d6eddf3852b641c0077acd7d050ecf34fe5d4dcb24c39efa2645ad888f821e&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F39973&comment_hash=a4d6eddf3852b641c0077acd7d050ecf34fe5d4dcb24c39efa2645ad888f821e&reaction=dislike'>๐</a>
##########
tests/unit_tests/commands/report/execute_test.py:
##########
@@ -2359,3 +2359,32 @@ def
test_get_dashboard_urls_raises_when_target_dashboard_soft_deleted(
state = BaseReportState(report_schedule, datetime.utcnow(), uuid4())
with pytest.raises(ReportScheduleTargetDashboardDeletedError):
state.get_dashboard_urls()
+
+
+def test_get_url_raises_unexpected_error_when_target_is_missing(
+ mocker: MockerFixture,
+ app,
+) -> None:
Review Comment:
**Suggestion:** Add a type annotation to the `app` fixture parameter in this
test function to satisfy required Python type hints. [custom_rule]
**Severity Level:** Minor ๐งน
<details>
<summary><b>Why it matters? โญ </b></summary>
The new test function adds an unannotated `app` parameter, which violates
the Python type-hint requirement for modified code. The rest of the function is
typed, so this is a real omission in the new hunk.
</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=7ace01b3455e4fe9a25dc7a8a61df16f&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=7ace01b3455e4fe9a25dc7a8a61df16f&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/commands/report/execute_test.py
**Line:** 2364:2367
**Comment:**
*Custom Rule: Add a type annotation to the `app` fixture parameter in
this test function to satisfy required Python type hints.
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%2F39973&comment_hash=4ce794ee2b8e318ce8b3bc99344885d0cac63ce49db39759141b6327db6480c8&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F39973&comment_hash=4ce794ee2b8e318ce8b3bc99344885d0cac63ce49db39759141b6327db6480c8&reaction=dislike'>๐</a>
##########
superset/commands/report/execute.py:
##########
@@ -315,10 +325,7 @@ def _get_url(
) and feature_flag_manager.is_feature_enabled("ALERT_REPORT_TABS"):
return self._get_tab_url(dashboard_state,
user_friendly=user_friendly)
- dashboard = self._report_schedule.dashboard
- dashboard_id_or_slug = (
- dashboard.uuid if dashboard and dashboard.uuid else dashboard.id
- )
+ dashboard_id_or_slug = dashboard.uuid or dashboard.id
Review Comment:
**Suggestion:** Add a type hint to this newly introduced local
identifier-or-slug value to make its UUID-or-integer union explicit.
[custom_rule]
**Severity Level:** Minor ๐งน
<details>
<summary><b>Why it matters? โญ </b></summary>
This is a newly added local variable in modified Python code and it lacks an
explicit type hint. The value is later passed as an identifier/slug, so it is a
relevant variable that can be annotated under the type-hint 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=f2fda7bd58d24448a18337aa6c52e7cb&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=f2fda7bd58d24448a18337aa6c52e7cb&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/commands/report/execute.py
**Line:** 328:328
**Comment:**
*Custom Rule: Add a type hint to this newly introduced local
identifier-or-slug value to make its UUID-or-integer union explicit.
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%2F39973&comment_hash=febc4bd60e08eadaad773196d202de212b662c6ed0ede038952f9718a610b8d0&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F39973&comment_hash=febc4bd60e08eadaad773196d202de212b662c6ed0ede038952f9718a610b8d0&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]