#6780·keep

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

Author: chiruu12Created Sep 7, 2026Updated Sep 7, 2026

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.