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

@cicoyle cicoyle commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

fix scheduler panic if user puts in wrong schedule

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

Copilot AI 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.

File Description
cron/parser.go Prevents panic on timezone-only specs and broadens whitespace handling for timezone parsing.
cron/parser_test.go Adds 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:main Jul 21, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants