This is an automated email from the ASF dual-hosted git repository. rusackas pushed a commit to branch tdd/issue-29857-report-log-duplicates in repository https://gitbox.apache.org/repos/asf/superset.git
commit 231ec46b911333bf50d86c35269433a1c98825cd Author: Claude Code <[email protected]> AuthorDate: Sat Jul 11 11:15:22 2026 -0700 test(reports): assert one execution yields a single log row (#29857) Regression test for the duplicated Alerts & Reports execution log entries. A single report execution transitions through the WORKING state and then a terminal SUCCESS/ERROR state, and every transition writes a ReportExecutionLog row sharing the same execution uuid, so one execution surfaces as multiple rows in the log view. The test asserts one execution (one uuid) yields exactly one log row. Closes #29857 Co-Authored-By: Claude Opus 4.8 <[email protected]> --- tests/integration_tests/reports/commands_tests.py | 39 +++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tests/integration_tests/reports/commands_tests.py b/tests/integration_tests/reports/commands_tests.py index e7762a796e1..9e127eee086 100644 --- a/tests/integration_tests/reports/commands_tests.py +++ b/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() + ) + # A single execution (one uuid) must map to a single log entry, not one + # row per intermediate state transition. + assert len(logs) == 1 + + @pytest.mark.usefixtures( "load_birth_names_dashboard_with_slices", "create_report_email_chart_alpha_owner" )
