fix(cronjob): parse schedules like robfig/cron with go-cron v0.19.0 #3184
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 327 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.347
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3184"
general
weight: 0.35
dgrisonnet
What this PR does / why we need it:
Bumps
github.com/netresearch/go-cronfrom v0.18.0 to v0.19.0 and parses CronJob schedules with itsRobfigCompatoption, so KSM interprets a schedule the same way as the Kubernetes CronJob controller, which usesrobfig/cron/v3.With the standard parser, KSM and the controller disagreed:
/120 4-22,0 1 /32,1-7 3). These CronJobs hadkube_cronjob_schedule_invalidset and nokube_cronjob_next_schedule_time.0 1 /32,1-7 3next runs on Wednesday 2018-03-14 in robfig/cron, not on the first Wednesday that falls on day 1–7.5/2wrapped around to Sunday; robfig/cron stops at Saturday.RobfigCompatcombinesDowOrDom,LenientSteps,EveryRoundUp,DSTSkipandDowStepToSaturday(new in v0.19.0). The parser is built once withMustNewParser, sinceNewParseris deprecated.Tests:
TestParseScheduleRobfigCompatcovers the lenient step, the day-of-month/day-of-week OR, the day-of-week step stopping at Saturday and@everyrounding up to 1s. The expected times were checked againstrobfig/cron/v3v3.0.1.TestCronJobStoreScheduleParsingused specs that robfig/cron accepts, so they now use60and/0, which both parsers reject.How does this change affect the cardinality of KSM: does not change cardinality. CronJobs whose schedule robfig/cron accepts but the old parser rejected now emit
kube_cronjob_next_schedule_timeinstead ofkube_cronjob_schedule_invalid; each CronJob still emits one of the two.Which issue(s) this PR fixes: N/A
🤖 Generated with Claude Code
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
Bug Fixes
Improved cron schedule parsing compatibility for large step values, schedules combining day-of-month and day-of-week restrictions, and sub-second
@everyintervals.Invalid schedules with out-of-range field values or zero steps continue to be rejected with wrapped parse errors.
* Schedule parsing supports standard cron descriptors and retains timezone-aware schedules. These changes make supported schedules behave more consistently with Robfig cron timing.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->