Skip to content

fix: accept 0/N step schedules again after the croner 4 update - #1661

Open
manduinca wants to merge 1 commit into
moghtech:mainfrom
manduinca:fix/english-schedule-step-ranges
Open

manduinca wants to merge 1 commit into
moghtech:mainfrom
manduinca:fix/english-schedule-step-ranges

Conversation

@manduinca

Copy link
Copy Markdown

Fixes #1616

english-to-cron writes every step as 0/N: "every 8 hours" becomes 0 0 0/8 * * ? *, "every 15 seconds" becomes 0/15 * * * * ? *. Since 2.3.3 the shared CronParser is built on croner 4, which rejects that form by default ("Stricter Step Syntax Validation" in the croner 4.0.0 notes, as @xaviermarchegay found), so every English schedule with a step fails with English expression produced invalid CRON schedule.

This enables sloppy_ranges(true) on the parser, croner's documented switch for the old behaviour. With it, 0/8 in the hours field reads as 0-23/8 again, the same 00:00, 08:00 and 16:00 cadence the reporter had before the update. Since the parser is shared, CRON schedules written as 0/N by hand work again too.

I added a small test module in schedule.rs:

  • english_step_schedules_parse: "every 15 seconds", "every 5 minutes" and "every 8 hours", run through english-to-cron and trimmed to six fields as find_next_occurrence does, all parse.
  • every_8_hours_runs_at_0_8_16: starting at 01:00, the next three runs are 08:00, 16:00 and 00:00.
  • cron_step_shortcut_parses: 0 0 0/6 * * * parses.

All three fail on main and pass with the change. cargo fmt --all -- --check is clean.

It targets main because there is no 2.3.4 branch yet; it can move to the release branch once there is one.

english-to-cron writes steps as `0/N` ("every 8 hours" becomes
`0 0 0/8 * * ?`), and croner 4 rejects that form unless sloppy ranges
are enabled, so every English step schedule failed to parse after 2.3.3.
Enable sloppy ranges on the shared parser, which also restores CRON
schedules written the same way.

Fixes moghtech#1616
LoganRupe added a commit to LoganRupe/quomodo that referenced this pull request Oct 22, 2026
…arse (#36)

## What and why

Any English schedule with a step, like "every 8 hours" or "every 15
seconds", fails with `English expression produced invalid CRON
schedule`. english-to-cron writes steps as `0/N`, and croner 4 rejects
that form unless sloppy ranges are on. This turns them on for the shared
parser, so hand-written `0/N` CRON schedules work again too.

Ported from upstream komodo
[#1661](moghtech/komodo#1661) by @manduinca,
which fixes [#1616](moghtech/komodo#1616). The
new test fails without the change.

## Checks

- [x] `cargo fmt --all -- --check`, `cargo clippy --workspace -- -D
warnings` and `cargo test --workspace` pass (CI runs these too)
- [ ] Touches deploys, the agent, secrets, Alerters or ResourceSync:
`scripts/e2e.sh` passes (not in CI). N/A, schedules only
- [ ] Changes API types: regenerated `client/core/ts/src/types.ts`,
`ui/public/client` and `ui/public/schema/resources.json` (see
AGENTS.md). N/A
- [ ] User-visible change: `docs/` updated. N/A, restores documented
behaviour
- [x] No secrets, real hostnames or personal emails in code, fixtures or
commit messages

This branch has not been deployed

No deployments
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.

[Bug] v2.3.3: English schedule "Every 8 hours" produces invalid CRON expression (0/8 step rejected by new parser)

1 participant