Skip to content

fix(cron): skip validation for disabled cronjobs#640

Merged
thepagent merged 1 commit intomainfrom
fix/skip-validation-disabled-cronjobs
Apr 30, 2026
Merged

fix(cron): skip validation for disabled cronjobs#640
thepagent merged 1 commit intomainfrom
fix/skip-validation-disabled-cronjobs

Conversation

@chaodu-agent
Copy link
Copy Markdown
Collaborator

What problem does this solve?

validate_cronjobs() validates all cronjob configs at startup, including those with enabled: false. This means a disabled job with an invalid cron expression or timezone causes openab to fail at startup, even though the job would never be scheduled.

This contradicts the user expectation that enabled: false means "this job does not affect the system."

The runtime scheduler (parse_job_list()) already correctly skips disabled jobs — only the startup preflight validation was inconsistent.

Discovered by 擺渡法師 (Codex) during four-monk review of PR #638.

Changes

File What
src/cron.rs Add if !job.enabled { continue; } to validate_cronjobs()
src/cron.rs Add 2 tests: disabled job with invalid cron passes, enabled job with invalid cron still fails

Testing

running 7 tests
test cron::tests::validate_cronjobs_enabled_with_invalid_cron_still_fails ... ok
test cron::tests::validate_cronjobs_invalid_timezone_fails ... ok
test cron::tests::validate_cronjobs_disabled_with_invalid_cron_passes ... ok
test cron::tests::validate_cronjobs_unknown_platform_fails ... ok
test cron::tests::validate_cronjobs_valid_passes ... ok
test cron::tests::validate_cronjobs_unconfigured_platform_fails ... ok
test cron::tests::validate_cronjobs_invalid_cron_fails ... ok

test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 170 filtered out

Related

validate_cronjobs() now skips jobs with enabled=false, aligning
startup validation with runtime scheduling semantics. Previously a
disabled job with an invalid cron expression or timezone would cause
openab to fail at startup even though the job would never be scheduled.

Discovered during four-monk review of PR #638.
Co-authored-by: 擺渡法師 <codex@openab.dev>
@chaodu-agent chaodu-agent requested a review from thepagent as a code owner April 30, 2026 05:55
@github-actions github-actions Bot added the closing-soon PR missing Discord Discussion URL — will auto-close in 3 days label Apr 30, 2026
@github-actions
Copy link
Copy Markdown

⚠️ This PR is missing a Discord Discussion URL in the body.

All PRs must reference a prior Discord discussion to ensure community alignment before implementation.

Please edit the PR description to include a link like:

Discord Discussion URL: https://discord.com/channels/...

This PR will be automatically closed in 3 days if the link is not added.

@github-actions github-actions Bot added the pending-screening PR awaiting automated screening label Apr 30, 2026
@thepagent thepagent merged commit 8053a37 into main Apr 30, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

closing-soon PR missing Discord Discussion URL — will auto-close in 3 days pending-screening PR awaiting automated screening

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants