codeant-ai-for-open-source[bot] commented on code in PR #39973:
URL: https://github.com/apache/superset/pull/39973#discussion_r3584716193
##########
superset/commands/report/execute.py:
##########
@@ -315,9 +324,8 @@ 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.uuid if dashboard.uuid is not None else dashboard.id
)
Review Comment:
**Suggestion:** Provide an explicit type annotation for this newly added
computed variable so its expected identifier type is statically enforced.
[custom_rule]
**Severity Level:** Minor ๐งน
<details>
<summary><b>Why it matters? โญ </b></summary>
This newly added computed local variable is inferable as a value that can be
annotated, but no type hint is provided. That matches the custom Python
type-hint rule, so the violation is real.
</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=1169762ca6344cc99996f807a1586f0e&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=1169762ca6344cc99996f807a1586f0e&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:** 327:329
**Comment:**
*Custom Rule: Provide an explicit type annotation for this newly added
computed variable so its expected identifier type is statically 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%2F39973&comment_hash=e8ebda7db9b85a55ffb37839d1fdcd8578f05aa795149cf87c65e96c2a56c560&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F39973&comment_hash=e8ebda7db9b85a55ffb37839d1fdcd8578f05aa795149cf87c65e96c2a56c560&reaction=dislike'>๐</a>
##########
tests/unit_tests/commands/report/execute_test.py:
##########
@@ -2341,6 +2343,33 @@ def
test_get_url_raises_when_target_dashboard_soft_deleted(
state._get_url()
+def test_get_url_uses_valid_chart_with_stale_dashboard_reference(
+ mocker: MockerFixture,
+ app_context: None,
+) -> None:
+ """A stale non-target dashboard must not block a valid chart report."""
+ report_schedule: ReportSchedule = mocker.Mock(spec=ReportSchedule)
+ report_schedule.chart_id = 42
+ report_schedule.chart = mocker.sentinel.chart
+ report_schedule.dashboard_id = 7
+ report_schedule.dashboard = None
+ report_schedule.force_screenshot = False
+ get_url_path = mocker.patch(
+ "superset.commands.report.execute.get_url_path",
+ return_value="/chart",
+ )
Review Comment:
**Suggestion:** Add an explicit type annotation for this newly introduced
local variable to satisfy the type-hint requirement for annotatable variables.
[custom_rule]
**Severity Level:** Minor ๐งน
<details>
<summary><b>Why it matters? โญ </b></summary>
This is newly added Python code in a test, and the local variable
`get_url_path` is inferable and can be annotated (for example as a mock
object). Since the custom rule requires type hints on annotatable new or
modified variables, this omission is 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=90b5df80c9c24be0a3c2b2bbe0aea36c&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=90b5df80c9c24be0a3c2b2bbe0aea36c&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:** 2357:2360
**Comment:**
*Custom Rule: Add an explicit type annotation for this newly introduced
local variable to satisfy the type-hint requirement for annotatable 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%2F39973&comment_hash=5aa84718fb0868d6e8a0aab1b0b7f6258e5a4a0baa8438199518b95d5068298a&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F39973&comment_hash=5aa84718fb0868d6e8a0aab1b0b7f6258e5a4a0baa8438199518b95d5068298a&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]