🧪 Improve test coverage for cron expression parsing failures - #49
Conversation
- Expand `test_invalid_cron` to cover empty strings, too few fields, too many fields, out-of-range values, and exceptionally long strings to prevent DoS. Co-authored-by: undivisible <136312656+undivisible@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_fd807d54-0126-4f89-bd45-f24ea8222a74) |
|
Tick the box to add this pull request to the merge queue (same as
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b885000acf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Exceptionally long string | ||
| let long_string = "a".repeat(10_000); | ||
| let result = scheduler.schedule(&long_string, "test", 5).await; | ||
| assert!(result.is_err()); |
There was a problem hiding this comment.
Make the long-input case assert bounded processing
For an oversized input that takes seconds of synchronous parsing before eventually returning Err, this assertion still passes, so it does not test the claimed denial-of-service or hang protection. Add an explicit production input-length bound and test that boundary (or otherwise assert bounded execution with a preemptible parser task) so the case can fail when long inputs monopolize the async runtime.
AGENTS.md reference: AGENTS.md:L530-L536
Useful? React with 👍 / 👎.
| // Empty string | ||
| let result = scheduler.schedule("", "test", 5).await; | ||
| assert!(result.is_err()); |
There was a problem hiding this comment.
Exercise the runtime cron scheduler
When cron expressions are submitted through the CLI or agent tool, they reach cron_scheduler::CronScheduler::add (src/cron_scheduler.rs:73-96), whereas the newly added cases invoke the legacy in-memory scheduler::Scheduler, which has no internal consumers beyond its re-export. Consequently these tests will remain green if validation at the production scheduling boundary regresses or diverges; place these edge cases against CronScheduler::add or the cron tool path instead.
AGENTS.md reference: AGENTS.md:L83-L88
Useful? React with 👍 / 👎.
🎯 What: The testing gap in invalid cron expression handling has been addressed.
📊 Coverage: Test coverage now includes empty strings, insufficient fields, extra fields, out-of-range values, and exceptionally long strings (to test for potential DOS or hang issues).
✨ Result: Increased confidence in the reliability and safety of the cron scheduling module by validating a variety of edge case failures.
PR created automatically by Jules for task 1356124356398383541 started by @undivisible
Note
Low Risk
Test-only changes with no modifications to scheduling or validation logic.
Overview
Extends
test_invalid_cronsoScheduler::scheduleis checked against more bad cron inputs, not only a generic"invalid"string.New cases assert errors for an empty expression, too few / too many fields, an out-of-range value (
60in the seconds field), and a 10,000-character string to guard against slow or problematic parsing on huge input. No production code changes—behavior still comes from existingcron::Schedule::from_strvalidation inschedule.Reviewed by Cursor Bugbot for commit b885000. Configure here.