Skip to content

fix scheduler panic if user puts in wrong schedule - #160

Merged
JoshVanL merged 2 commits into
dapr:mainfrom
cicoyle:jobs-api-rfc3339-test
Jul 21, 2026
Merged

fix scheduler panic if user puts in wrong schedule#160
JoshVanL merged 2 commits into
dapr:mainfrom
cicoyle:jobs-api-rfc3339-test

Conversation

@cicoyle

Copy link
Copy Markdown
Contributor

fix scheduler panic if user puts in wrong schedule

Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
CopilotAI review requested due to automatic review settings July 20, 2026 19:27
@cicoyle
cicoyle requested review from a team as code ownersJuly 20, 2026 19:27

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the cron schedule parser to prevent a panic when a user supplies a timezone prefix (TZ= / CRON_TZ=) without an accompanying schedule, returning a descriptive error instead.

Changes:

  • Parse timezone prefixes using strings.IndexFunc(..., unicode.IsSpace) so any whitespace separator (e.g., tabs) is accepted.
  • Add an explicit error return when a timezone prefix is not followed by a schedule (avoids slice-out-of-range panic).
  • Extend parser tests to cover missing-schedule timezone prefixes and tab-separated timezone schedules.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

FileDescription
cron/parser.goPrevents panic on timezone-only specs and broadens whitespace handling for timezone parsing.
cron/parser_test.goAdds regression tests for timezone-only specs and verifies tab-separated timezone schedules parse correctly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
@JoshVanL
JoshVanL merged commit b4ecc77 into dapr:mainJul 21, 2026
6 checks passed
@cicoylecicoyle mentioned this pull request Jul 27, 2026
JoshVanL pushed a commit that referenced this pull request Jul 29, 2026
* fix scheduler panic if user puts in wrong schedule (#160)
* fix scheduler panic if user puts in wrong schedule
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* add test
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
---------
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* handle @every schedule with timezone (#161)
* handle @every with timezone, should not happen
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* PR feedback
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
---------
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
---------
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@cicoyle@JoshVanL