Skip to content

More validation on ranges + tweak error messages#5

Merged
jahidulpabelislam merged 19 commits into1.xfrom
copilot/check-range-ordered-values
Dec 14, 2025
Merged

More validation on ranges + tweak error messages#5
jahidulpabelislam merged 19 commits into1.xfrom
copilot/check-range-ordered-values

Conversation

Copy link
Contributor

Copilot AI commented Dec 9, 2025

Changes

Ranges can only be ordered numerical values but were currently incorrectly accepted as valid.

  • Range validation: Check that range start ≤ end for numeric values only in all cron fields (minute, hour, day, month, day of week)
  • Error precedence: Only report range order errors when both values are valid; invalid values take precedence
  • Named ranges rejected: Named ranges like dec-jan and fri-mon are now properly rejected with "values in range must be numeric"
  • Error message: Reports "values must be ordered" for backwards numeric ranges
  • Updated error messages: Aligned with 1.x branch improvements for consistency

Examples

// Now correctly rejected (numeric backwards ranges)
"10-9 * * * * cmd"     → "values must be ordered"
"* 23-0 * * * cmd"     → "values must be ordered"

// Now correctly rejected (not numerical)
"* * * jan-dec * cmd"  → "values in range must be numeric"
"* * * dec-jan * cmd"  → "values in range must be numeric"
"* * * * fri-mon cmd"  → "values in range must be numeric"

// Invalid value takes precedence over range order
"61-59 * * * * cmd"    → "invalid value: 61"  // not "values must be ordered"

// Valid ranges still accepted
"9-10 * * * * cmd"     → valid

Added test cases covering numeric backwards ranges and proper rejection of named ranges across all field types. All 102 tests passing.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits December 9, 2025 20:20
Co-authored-by: jahidulpabelislam <15434150+jahidulpabelislam@users.noreply.github.com>
Co-authored-by: jahidulpabelislam <15434150+jahidulpabelislam@users.noreply.github.com>
Co-authored-by: jahidulpabelislam <15434150+jahidulpabelislam@users.noreply.github.com>
Co-authored-by: jahidulpabelislam <15434150+jahidulpabelislam@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix range validation for ordered values Validate range ordering in cron expressions Dec 9, 2025
@jahidulpabelislam
Copy link
Owner

@copilot Is there a better message instead of range is backwards?

Values must be ordered or something maybe?

@jahidulpabelislam
Copy link
Owner

@copilot Also no need to handle non numerical values. i.e only check if all values are numerical.

…ered'

Co-authored-by: jahidulpabelislam <15434150+jahidulpabelislam@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 11, 2025

@copilot Is there a better message instead of range is backwards?

Values must be ordered or something maybe?

Changed to "values must be ordered" in commit 3c2e143. This is clearer and more descriptive than "range is backwards".

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/jahidulpabelislam/codestyles-php/zipball/0c99fffae7b9a10e92ece656476adc2ecf292b3f
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/Nbx4Ej /usr/bin/composer install --no-interaction --ignore-platform-reqs (http block)
  • https://api.github.com/repos/sebastianbergmann/exporter/zipball/016951ae10980765e4e7aee491eb288c64e505b7
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/Nbx4Ej /usr/bin/composer install --no-interaction --ignore-platform-reqs (http block)
  • https://api.github.com/repos/sebastianbergmann/global-state/zipball/ef1377171613d09edd25b7816f05be8313f9115d
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/Nbx4Ej /usr/bin/composer install --no-interaction --ignore-platform-reqs (http block)
  • https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1effe8e9b8e068e9ae228e542d5d11b5d16db894
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/Nbx4Ej /usr/bin/composer install --no-interaction --ignore-platform-reqs (http block)
  • https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/4bfa827c969c98be1e527abd576533293c634f6a
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/Nbx4Ej /usr/bin/composer install --no-interaction --ignore-platform-reqs (http block)
  • https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/0b01998a7d5b1f122911a66bebcb8d46f0c82d8c
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/Nbx4Ej /usr/bin/composer install --no-interaction --ignore-platform-reqs (http block)
  • https://api.github.com/repos/sebastianbergmann/type/zipball/e549163b9760b8f71f191651d22acf32d56d6d4d
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/Nbx4Ej /usr/bin/composer install --no-interaction --ignore-platform-reqs (http block)
  • https://api.github.com/repos/sebastianbergmann/version/zipball/3e6ccf7657d4f0a59200564b08cead899313b53c
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/Nbx4Ej /usr/bin/composer install --no-interaction --ignore-platform-reqs (http block)
  • https://api.github.com/repos/staabm/side-effects-detector/zipball/d8334211a140ce329c13726d4a715adbddd0a163
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/Nbx4Ej /usr/bin/composer install --no-interaction --ignore-platform-reqs (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Co-authored-by: jahidulpabelislam <15434150+jahidulpabelislam@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 11, 2025

@copilot Also no need to handle non numerical values. i.e only check if all values are numerical.

Updated in commit 3d584f5. Now only checking range ordering for numeric values. Named ranges like dec-jan and fri-mon are now valid, as they can represent wrap-around periods.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/jahidulpabelislam/codestyles-php/zipball/0c99fffae7b9a10e92ece656476adc2ecf292b3f
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/sC5sfp /usr/bin/composer install --no-interaction --ignore-platform-reqs (http block)
  • https://api.github.com/repos/sebastianbergmann/global-state/zipball/ef1377171613d09edd25b7816f05be8313f9115d
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/sC5sfp /usr/bin/composer install --no-interaction --ignore-platform-reqs (http block)
  • https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1effe8e9b8e068e9ae228e542d5d11b5d16db894
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/sC5sfp /usr/bin/composer install --no-interaction --ignore-platform-reqs (http block)
  • https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/0b01998a7d5b1f122911a66bebcb8d46f0c82d8c
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/sC5sfp /usr/bin/composer install --no-interaction --ignore-platform-reqs (http block)
  • https://api.github.com/repos/sebastianbergmann/type/zipball/e549163b9760b8f71f191651d22acf32d56d6d4d
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/sC5sfp /usr/bin/composer install --no-interaction --ignore-platform-reqs (http block)
  • https://api.github.com/repos/sebastianbergmann/version/zipball/3e6ccf7657d4f0a59200564b08cead899313b53c
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/sC5sfp /usr/bin/composer install --no-interaction --ignore-platform-reqs (http block)
  • https://api.github.com/repos/staabm/side-effects-detector/zipball/d8334211a140ce329c13726d4a715adbddd0a163
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/sC5sfp /usr/bin/composer install --no-interaction --ignore-platform-reqs (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Validate range ordering in cron expressions Validate range ordering for numeric values in cron expressions Dec 11, 2025
@jahidulpabelislam jahidulpabelislam force-pushed the copilot/check-range-ordered-values branch from 06f553f to 178fbb8 Compare December 12, 2025 21:59
@jahidulpabelislam jahidulpabelislam marked this pull request as ready for review December 12, 2025 21:59
@jahidulpabelislam jahidulpabelislam changed the title Validate range ordering for numeric values in cron expressions More validation on ranges Dec 12, 2025
@jahidulpabelislam jahidulpabelislam force-pushed the copilot/check-range-ordered-values branch from 178fbb8 to 4ea1df4 Compare December 12, 2025 22:05
@jahidulpabelislam jahidulpabelislam force-pushed the copilot/check-range-ordered-values branch from 4ea1df4 to ceedde8 Compare December 12, 2025 22:09
@jahidulpabelislam
Copy link
Owner

@copilot Can you resolve the conflicts here?

Copy link
Contributor Author

Copilot AI commented Dec 13, 2025

@copilot Can you resolve the conflicts here?

Conflicts resolved in commit 107c567. Merged with 1.x branch, updating error messages to match the new format and preserving range validation logic. All 102 tests passing.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/jahidulpabelislam/codestyles-php/zipball/0c99fffae7b9a10e92ece656476adc2ecf292b3f
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/e86Rxw /usr/bin/composer install --no-interaction --ignore-platform-reqs (http block)
  • https://api.github.com/repos/sebastianbergmann/global-state/zipball/ef1377171613d09edd25b7816f05be8313f9115d
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/e86Rxw /usr/bin/composer install --no-interaction --ignore-platform-reqs (http block)
  • https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1effe8e9b8e068e9ae228e542d5d11b5d16db894
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/e86Rxw /usr/bin/composer install --no-interaction --ignore-platform-reqs (http block)
  • https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/4bfa827c969c98be1e527abd576533293c634f6a
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/e86Rxw /usr/bin/composer install --no-interaction --ignore-platform-reqs (http block)
  • https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/0b01998a7d5b1f122911a66bebcb8d46f0c82d8c
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/e86Rxw /usr/bin/composer install --no-interaction --ignore-platform-reqs (http block)
  • https://api.github.com/repos/sebastianbergmann/type/zipball/e549163b9760b8f71f191651d22acf32d56d6d4d
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/e86Rxw /usr/bin/composer install --no-interaction --ignore-platform-reqs (http block)
  • https://api.github.com/repos/sebastianbergmann/version/zipball/3e6ccf7657d4f0a59200564b08cead899313b53c
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/e86Rxw /usr/bin/composer install --no-interaction --ignore-platform-reqs (http block)
  • https://api.github.com/repos/staabm/side-effects-detector/zipball/d8334211a140ce329c13726d4a715adbddd0a163
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/e86Rxw /usr/bin/composer install --no-interaction --ignore-platform-reqs (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@jahidulpabelislam jahidulpabelislam changed the title More validation on ranges More validation on ranges + tweak error messages Dec 14, 2025
@jahidulpabelislam jahidulpabelislam merged commit ea31d23 into 1.x Dec 14, 2025
4 checks passed
@jahidulpabelislam jahidulpabelislam deleted the copilot/check-range-ordered-values branch December 14, 2025 19:40
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.

Don't allow having mix of numbers & text version in ranges Check values in a range is ordered

2 participants