Skip to content

Anchor batch action dtstart to midnight#663

Merged
skomorokh merged 2 commits into
mainfrom
dtstart-midnight
Jul 14, 2026
Merged

Anchor batch action dtstart to midnight#663
skomorokh merged 2 commits into
mainfrom
dtstart-midnight

Conversation

@skomorokh

@skomorokh skomorokh commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Anchoring at today's UTC midnight (now.Truncate(24h)) is a good default because midnight is the zero of every sub-day component: hour 0, minute 0, second 0. So:

  • Unspecified components default to the "natural" reading — FREQ=DAILY means midnight, FREQ=HOURLY means on the hour, seconds are always :00.
  • Interval rules get a deterministic, human-aligned phase — every 15 minutes means :00/:15/:30/:45, and two users creating the same rule get the same schedule.
  • It's idempotent-ish: recomputing next-run tomorrow from a different now still lands on the same grid

Copilot AI review requested due to automatic review settings July 14, 2026 00:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts RRULE scheduling behavior so that schedules which omit time components (seconds/minutes/hours) are anchored to a predictable UTC midnight baseline, preventing “inherit current seconds” drift and making interval schedules phase deterministically.

Changes:

  • Anchor RRULE DTSTART to the current day’s UTC midnight when computing the next run time.
  • Simplify default batch-action RRULEs by removing explicit BYSECOND=0 where it’s now redundant.
  • Update scheduler and API handler tests to assert midnight/zero-second defaults and deterministic interval phases.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
misc/state-models.yaml Removes redundant BYSECOND=0 from a few default batch action schedules.
broker/scheduler/service/scheduler.go Anchors RRULE DTSTART to UTC midnight before computing After(now, false).
broker/scheduler/service/scheduler_test.go Updates/expands tests to validate midnight anchoring and zero-second inheritance.
broker/scheduler/api/api_handler_test.go Adjusts schedule validation expectations to match midnight-anchored run times.
broker/patron_request/service/statemodels/state-models.json Regenerates/updates compiled state model schedules to match YAML changes.

@skomorokh skomorokh marked this pull request as ready for review July 14, 2026 00:41
Copilot AI review requested due to automatic review settings July 14, 2026 14:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@skomorokh skomorokh merged commit bd5553a into main Jul 14, 2026
7 checks passed
@skomorokh skomorokh deleted the dtstart-midnight branch July 14, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants