fix(cron): accept day-of-week 7 as a valid Sunday alias#470
Open
gaoflow wants to merge 1 commit into
Open
Conversation
Standard cron syntax allows weekday values 0–7, where both 0 and 7 mean Sunday (documented in crontab(5) and implemented by vixie-cron, cronie, fcron, and most Unix cron daemons). The validator was enforcing a max of 6, rejecting valid expressions like `* * * * 7`, `0 0 * * 0-7`, and `0 0 * * 0,7`. Change the weekday upper bound from 6 to 7 and add three test cases that were previously (incorrectly) rejected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
validators.cron()rejects valid cron expressions that use7for the day-of-week field.7is a well-documented alias for Sunday (the same as0), supported by all major cron implementations (vixie-cron, cronie, fcron, and crontab(5)).Root cause
In
src/validators/cron.py, the weekdays component is validated withmax_val=6:Fix
Change the upper bound from
6to7. DOW8continues to be rejected (the existing test for'0 12 * * 8'still passes).Tests
Three new cases added to
test_returns_true_on_valid_cron:"0 12 * * 7"— DOW=7 is Sunday"0 0 * * 0-7"— range 0–7 (Sunday to Sunday)"0 0 * * 0,7"— Sunday listed via both aliasesAll 29 cron tests pass; the 17 pre-existing ETH address failures are unrelated.