Skip to content

Validate natural interval steps in the correct clock fields - #133

Open
OskarEichler wants to merge 1 commit into
floraison:masterfrom
OskarEichler:codex/check-strict-natural-interval-step-values
Open

Validate natural interval steps in the correct clock fields#133
OskarEichler wants to merge 1 commit into
floraison:masterfrom
OskarEichler:codex/check-strict-natural-interval-step-values

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

Strict natural-interval validation reads the start of a slash expression instead of its step; */3 therefore becomes zero and valid schedules are rejected. It also relies on positions in the assembled cron fields, which shift when seconds/timezones are present. Validate the original hour/minute pair and read capture 2.

Reproduction

Run after require 'fugit':

p Fugit.parse_nat('every 3 hours', strict: true).to_cron_s # "0 0,3,6,9,12,15,18,21 * * *"
p Fugit.parse_nat('every 17 hours', strict: true) # nil
# previously both were nil

Verification

  • rbenv Ruby 4.0.6, TZ=UTC. Master baseline and this individual patch: 1,524 existing tests, 3,379 assertions, zero failures, one existing pending test.
  • 20 focused checks for this change, run outside the repository. The combined release-based branch passes 1,517 existing RSpec examples, zero failures, one pending, plus 998 focused checks.
  • Also checked the combined master changes with unmodified registry EtOrbi 1.4.1/Raabro 1.5.0: 1,524 tests/3,379 assertions, zero failures, one pending, and 997 focused checks. The extra blank-line check requires the independently fixed Raabro empty-input behavior; it is not claimed to pass on unmodified Raabro.
  • Individual/release checks used the same versions of EtOrbi/Raabro with their separately proposed fixes. Syntax and whitespace checks pass. Combined source has the same 18 pre-existing Lint warnings, with no new warnings. Release gem packaging checked.

Compatibility and limitations

Strict mode now accepts valid intervals instead of rejecting all wildcard steps. Existing hour-divisor and 1..60-minute policies are retained; this does not impose new divisibility rules on minutes or redefine seconds policy.

No dependency/version upgrades, test additions or test modifications are included. The task's no-new-tests constraint was followed; reproduction/check scripts stayed outside the repository. Other Ruby versions and platforms await upstream CI. No production execution was performed. Prepared with Codex assistance.

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.

1 participant