Skip to content

[Bug]: keep.is_business_hours can never be true for a window that crosses midnight #6780

Description

@chiruu12

The final check is start_hour <= hour < end_hour, so a window whose start is after its end is never satisfied:

is_business_hours(dt, start_hour=20, end_hour=8)
  22:00 Mon -> False    02:00 Tue -> False    12:00 Mon -> False

Validation accepts any hour in 0-23 for both, so an after-hours or on-call window is configured happily and then never fires. A workflow gated on it does nothing and reports nothing.

Two ways to read this, and they lead to different fixes:

  1. A start after the end means the window wraps midnight. 20-8 is the night shift. This makes an existing config start working.
  2. It is a configuration error and should raise, the way in_range refuses a reversed interval.

I lean towards the first, since the second still leaves no way to express a night window and the docstring does not say the window has to sit inside one day. Happy to write whichever you prefer.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions