rusackas opened a new pull request, #41486: URL: https://github.com/apache/superset/pull/41486
Follow-up to #41177. ### SUMMARY #41177 made the report path raise the typed `ReportScheduleExecutorNotFoundError` when the configured executor user can't be resolved. That PR explicitly left the alert-query path alone (see the note added to `execute.py`: "The alert-query path (AlertCommand) is intentionally left unchanged ... tightening it is out of scope here."). This PR closes that gap. In `AlertCommand._execute_query`, the executor was resolved (`get_executor` -> `security_manager.find_user`) inside the broad `try/except Exception` that re-wraps everything as `AlertQueryError`. So a deleted/disabled executor user or a misconfigured `ALERT_REPORTS_EXECUTORS` passed a `None` user into the auth/query flow, and the resulting opaque NoneType/AttributeError got swallowed and re-surfaced as a generic alert query error. The change resolves the executor before the query `try/except` and raises the dedicated `ReportScheduleExecutorNotFoundError` (naming the username) when `find_user` returns `None`, mirroring the report-path fix. Because that error is not an `AlertQueryError`, it's also no longer pointlessly retried by `retry_call`. Self-contained backend change. No new exception type is introduced; it reuses the one added in #41177. ### TESTING INSTRUCTIONS Added a unit test (`tests/unit_tests/commands/report/alert_test.py::test_execute_query_raises_when_executor_user_missing`) asserting that when `find_user` returns `None`, `_execute_query` raises `ReportScheduleExecutorNotFoundError` naming the username. Run: ``` pytest tests/unit_tests/commands/report/alert_test.py ``` ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration - [ ] Introduces new feature or API - [ ] Removes existing feature or API 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
