Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: throw instead of silently rewriting invalid cron expressions #937

Merged
merged 6 commits into from
Jan 10, 2025

Conversation

sheerlox
Copy link
Collaborator

@sheerlox sheerlox commented Dec 29, 2024

Description

Removes an outdated function that would silently rewrite invalid expressions, e.g. 0 0 30 FEB * to 0 0 1 FEB *.

Related Issues

N/A

Motivation and Context

@Anurag-Bansal1 stumbled upon the MONTH_CONSTRAINTS constant while exploring the codebase and asked why 29 was chosen for February.

This constant is only used by the _verifyParse function, and upon careful review, it looks like this function was added a very long time ago to prevent infinite loops, which is a problem that we've since resolved at a deeper level.

How Has This Been Tested?

Added a new test case. See the failed test in CI before I pushed the code changes.

Screenshots (if appropriate):

Initially discussed on Discord:

image

image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • If my change introduces a breaking change, I have added a ! after the type/scope in the title (see the Conventional Commits standard).

Related Commits

From most to least recent:

@sheerlox sheerlox added the type:feature New feature or feature improvement & requests label Dec 29, 2024
@sheerlox sheerlox requested a review from intcreator December 29, 2024 16:02
@sheerlox sheerlox changed the title feat: throw instead of silently rewriting invalid cron expressions on initialization feat: throw instead of silently rewriting invalid cron expressions Dec 29, 2024
@sheerlox
Copy link
Collaborator Author

sheerlox commented Jan 9, 2025

ping @intcreator

tests/cron.test.ts Show resolved Hide resolved
@sheerlox sheerlox merged commit dcc5b93 into main Jan 10, 2025
18 checks passed
@ncb000gt
Copy link
Member

🎉 This PR is included in version 3.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

intcreator pushed a commit that referenced this pull request Jan 10, 2025
## [3.5.0](v3.4.0...v3.5.0) (2025-01-10)

### ✨ Features

* throw instead of silently rewriting invalid cron expressions ([#937](#937)) ([dcc5b93](dcc5b93))

### ⚙️ Continuous Integrations

* **action:** update step-security/harden-runner action to v2.10.3 ([#943](#943)) ([cd7ee9f](cd7ee9f))

### ♻️ Chores

* **deps:** update dependency [@types](https://github.com/types)/node to v20.17.12 ([2a867f9](2a867f9))
* **deps:** update dependency [@types](https://github.com/types)/node to v22 ([#900](#900)) ([f7548bd](f7548bd))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released type:feature New feature or feature improvement & requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants