# monitor.maintenance-window
Which scheduled maintenance window, if any, is in force at a moment. A
monitoring app asks this before paging someone or counting a check as
downtime, and a status page uses it to say "Scheduled maintenance".
## Decisions
- **Half-open**: a window covers `start <= at < end`. A window ending at
02:00 and the next starting at 02:00 never both apply, and the end second
itself is outside.
- **Overlaps**: when several windows are active, the one that **started
first** is returned (on a tie, the first in the list). The answer then does
not depend on how the caller sorted the list, and the name shown is the
maintenance that caused the outage in the first place.
- **Every window is checked**, not only the active one: a window that does not
end after it starts is a typo that would silently never apply, so it is an
error wherever it sits in the list.
- Returns `null` when nothing is active; returns a copy, never the caller's
object.
## Errors
- `maintenance window "NAME" must end after it starts: start S, end E`
- `at must be a whole second, received X`