Repository navigation
Fixes #39143: reject zero-step cron expressions across all cron fields in the ScheduleInterval validator - #39180
Merged
harshach merged 1 commit intoNov 28, 2026
Conversation
…s in the ScheduleInterval validator
harshach
deleted the
detail/bug-fix/fixes-39143-reject-zero-step-cron-expressions-acro-41f647
branch
November 28, 2026 05:34
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.
Detail bug report: View on Detail
Describe your changes:
Fixes #39143
I worked on the shared
ScheduleIntervalcron validator because it accepted cron expressions with a zero step (*/0,1-5/0,5/0,1,2/0) in the hour, day-of-month, month, and day-of-week fields. The only step-aware guard (hasMultipleRunsPerHour) inspected the minute field alone, and the shared field regexes (Schedular.constants.ts) allow\/\d+which matches/0. An invalid cron typed into a custom schedule therefore passed UI validation and was submitted to the backend, where it failed opaquely: an HTTP 500 (UNHANDLED_SERVER_EXCEPTION, "Failed in scheduling Job for the Application") on application install/update, and a permanently unscheduled, error-loopingCronOMJobon the k8s operator (IllegalArgumentException: Failed to parse cron expression. Period 0 not in range [1, 31]). The legacy ingestion-wizard flow was unaffected because itscronValidatoradditionally runscronstrue.toString, which rejects zero steps; the regression was introduced when PR #32082 rewired the app and test-suite-pipeline flows onto the regex-onlyvalidateCronExpressionand demoted cronstrue to descriptive-only text.The fix adds a small
hasZeroStep(field)helper (same style as the existinghasDescendingMinuteRange/hasMultipleRunsPerHour) and a loop invalidateCronExpressionthat applies it to all five cron fields right after the regex pattern loop, returning the offending field's error key. This restores the zero-step safety net cronstrue provided before #32082, covers the test-case-scheduling and bundle-suite flows (which never had it), and keeps the format-before-semantic ordering across fields.Type of change:
High-level design:
N/A — small change. A single centralized zero-step check over all five fields was chosen over tightening each field regex in
Schedular.constants.ts(\/\d+→\/[1-9]\d*): both fixvalidateCronExpression, but the regex route depends on every future field-pattern edit remembering the[1-9]guard, while a dedicated helper keeps the invariant local to the validator and matches the existing step-aware pattern (hasMultipleRunsPerHour). The legacycronValidatorpath is left untouched since cronstrue already gates it.Tests:
Use cases covered
*/0, range1-5/0, single5/0, list1,2/0, and leading-zero*/00variants)*/2,1-5/2,1,15/2,1/2) are still accepted — no false-positive regressionUnit tests
openmetadata-ui/.../Steps/ScheduleInterval.utils.test.ts— 18 new cases (10 zero-step rejections across all fields/variants, 7 valid non-zero-step acceptances, 1 format-before-semantic ordering). 28 tests pass.Backend integration tests
Ingestion integration tests
Playwright (UI) tests
openmetadata-ui/.../playwright/e2e/Features/CronValidations.spec.ts— extended the existingCron Validationsspec with assertions that each zero-step cron (0 0 */0 * *,0 0 * * */0,0 */0 * * *,0 0 1 */0 *,*/0 0 * * *) renders the offending field's inline error in the real app-schedule form, and that a valid0 0 */2 * *clears it. The full spec passes against a live stack (auth setup, entity seeding, and the cron validation scenario).Manual testing performed
openmetadata-servicejar against them, and the Vite dev server proxying/apito it) and ran theCron ValidationsPlaywright spec end-to-end (3/3 green, including the new zero-step assertions in a real browser).PATCH /api/v1/apps/{id}withcronExpression: "0 0 */2 * *"returns HTTP 200 and persists.cronExpression: "0 0 */0 * *"returns HTTP 500UNHANDLED_SERVER_EXCEPTION"Failed in scheduling Job for the Application", with the server log showingIllegalArgumentException: Failed to parse cron expression. Period 0 not in range [1, 31]— matching the bug report. The UI fix blocks this cron at form time so the request can no longer be made from the UI.tsc:check(no new errors; baseline-identical when stashed), and ESLint/Prettier/organize-imports on all changed files all pass.UI screen recording:
Not applicable — a form-validation correctness fix with no new UI surface or behavior to record (the change makes an existing error state appear for previously-accepted invalid input).
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.REVIEW.mdand fixed every 🔴 finding, or answered it on the line below.docs/decisions/. (N/A — the fix restores a pre-refactor(ui): consolidate schedule interval #32082 invariant rather than introducing a new decision.)Automatic Fixes PRs can be configured here.