codeant-ai-for-open-source[bot] commented on code in PR #41966:
URL: https://github.com/apache/superset/pull/41966#discussion_r3564775794
##########
tests/integration_tests/reports/commands_tests.py:
##########
@@ -772,6 +772,45 @@ def test_email_chart_report_schedule(
assert_log(ReportState.SUCCESS)
[email protected](
+ "load_birth_names_dashboard_with_slices", "create_report_email_chart"
+)
+@patch("superset.reports.notifications.email.send_email_smtp")
+@patch("superset.utils.screenshots.ChartScreenshot.get_screenshot")
+def test_email_chart_report_schedule_single_log_per_execution(
+ screenshot_mock,
+ email_mock,
+ create_report_email_chart,
+):
Review Comment:
**Suggestion:** Add explicit type hints to the new test function parameters
and return type to satisfy the typing requirement for modified Python
functions. [custom_rule]
**Severity Level:** Minor ๐งน
<details>
<summary><b>Why it matters? โญ </b></summary>
The new test function is a modified Python function and its parameters are
untyped even though they can be annotated, which matches the type-hint
requirement.
</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=c307793847444d02ad694b5cf1cec6a9&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=c307793847444d02ad694b5cf1cec6a9&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/reports/commands_tests.py
**Line:** 780:784
**Comment:**
*Custom Rule: Add explicit type hints to the new test function
parameters and return type to satisfy the typing requirement for modified
Python functions.
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%2F41966&comment_hash=b9f7d35e25bcbe4c645fdbabbf3e88ec412d1559ce1e843d5eb1a9b359b3379a&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41966&comment_hash=b9f7d35e25bcbe4c645fdbabbf3e88ec412d1559ce1e843d5eb1a9b359b3379a&reaction=dislike'>๐</a>
##########
tests/integration_tests/reports/commands_tests.py:
##########
@@ -772,6 +772,45 @@ def test_email_chart_report_schedule(
assert_log(ReportState.SUCCESS)
[email protected](
+ "load_birth_names_dashboard_with_slices", "create_report_email_chart"
+)
+@patch("superset.reports.notifications.email.send_email_smtp")
+@patch("superset.utils.screenshots.ChartScreenshot.get_screenshot")
+def test_email_chart_report_schedule_single_log_per_execution(
+ screenshot_mock,
+ email_mock,
+ create_report_email_chart,
+):
+ """
+ ExecuteReport Command: a single execution should produce a single log row.
+
+ Regression for #29857: the Alerts & Reports execution log shows duplicated
+ entries for a single execution. Each execution transitions through the
+ WORKING state and then a terminal state (SUCCESS/ERROR), and every
+ transition writes a ReportExecutionLog row sharing the same execution
+ ``uuid``. As a result one execution surfaces as two rows in the log view
+ (the "trigger" row and the "result" row). This test asserts that one
+ execution -- identified by its execution uuid -- yields exactly one log
row.
+ """
+ screenshot_mock.return_value = SCREENSHOT_FILE
+
+ with freeze_time("2020-01-01T00:00:00Z"):
+ AsyncExecuteReportScheduleCommand(
+ TEST_ID, create_report_email_chart.id, datetime.utcnow()
+ ).run()
+
+ db.session.commit()
+ logs = (
+ db.session.query(ReportExecutionLog)
+ .filter(ReportExecutionLog.uuid == TEST_ID)
+ .all()
+ )
Review Comment:
**Suggestion:** Add a type annotation for the new `logs` variable assignment
so the introduced local value is explicitly typed. [custom_rule]
**Severity Level:** Minor ๐งน
<details>
<summary><b>Why it matters? โญ </b></summary>
The new local variable `logs` is introduced without a type annotation, and
the rule explicitly asks for relevant variables that can be annotated to be
typed.
</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=b547999f58f04b7386886059921f872a&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=b547999f58f04b7386886059921f872a&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/reports/commands_tests.py
**Line:** 804:808
**Comment:**
*Custom Rule: Add a type annotation for the new `logs` variable
assignment so the introduced local value is explicitly 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%2F41966&comment_hash=c84bcc323cf2426e57b284b9afde03bd0f5da2252ebc56e75b7c5c9fde5f6cbd&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41966&comment_hash=c84bcc323cf2426e57b284b9afde03bd0f5da2252ebc56e75b7c5c9fde5f6cbd&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]