codeant-ai-for-open-source[bot] commented on code in PR #42650:
URL: https://github.com/apache/superset/pull/42650#discussion_r3692001585
##########
superset/commands/report/base.py:
##########
@@ -288,13 +289,18 @@ def validate_report_frequency(
return
iterations = 60 if minimum_interval <= 3660 else 24
- schedule = croniter(cron_schedule)
- current_exec = next(schedule)
-
- for _i in range(iterations):
- next_exec = next(schedule)
- diff, current_exec = next_exec - current_exec, next_exec
- if int(diff) < minimum_interval:
- raise ReportScheduleFrequencyNotAllowed(
- report_type=report_type, minimum_interval=minimum_interval
- )
+ try:
+ schedule = croniter(cron_schedule)
+ current_exec = next(schedule)
+
+ for _i in range(iterations):
+ next_exec = next(schedule)
+ diff, current_exec = next_exec - current_exec, next_exec
+ if int(diff) < minimum_interval:
+ raise ReportScheduleFrequencyNotAllowed(
+ report_type=report_type,
minimum_interval=minimum_interval
+ )
+ except CroniterBadDateError as ex:
+ raise ReportScheduleCrontabNotValidError(
+ cron_schedule=cron_schedule
+ ) from ex
Review Comment:
**Suggestion:** The never-matching-date check is only reached after the
`minimum_interval < 120` early return. With the default minimum interval of `0`
(or any value below 120 seconds), schedules such as `0 0 30 2 *` still pass
schema validation and are accepted even though the scheduler can never produce
an execution for them. Validate calendar validity independently of the
frequency-limit threshold, or move this check before the early return.
[incomplete implementation]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Default zero-minute configuration bypasses calendar validation.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=ec1347294e5f4aa393f5b879e2d426c0&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=ec1347294e5f4aa393f5b879e2d426c0&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/base.py
**Line:** 292:306
**Comment:**
*Incomplete Implementation: The never-matching-date check is only
reached after the `minimum_interval < 120` early return. With the default
minimum interval of `0` (or any value below 120 seconds), schedules such as `0
0 30 2 *` still pass schema validation and are accepted even though the
scheduler can never produce an execution for them. Validate calendar validity
independently of the frequency-limit threshold, or move this check before the
early return.
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%2F42650&comment_hash=5ae3f63e0edaca51b042897854ee168211171fca0fd738d49d2e3c6ad4664219&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42650&comment_hash=5ae3f63e0edaca51b042897854ee168211171fca0fd738d49d2e3c6ad4664219&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]