Incidents and maintenance events
Incidents and scheduled maintenance turn service problems and planned work into status updates. They give operators a shared record, give users a public view of impact and progress, and connect each event to the monitors or status pages that it affects. This page is part of status publishing and relates to public status pages and embeds and badges.
Incident records
An incident represents an active service problem. It has a title, a start time, a state, and an optional end time. The state describes progress through INVESTIGATING, IDENTIFIED, MONITORING, and RESOLVED; the record remains open while the incident is active.
Incident creation
Operators create incidents from the management area. A new incident needs a title and a start time. The incident starts in the investigating state, and operators can limit it to linked monitors with a chosen impact.
The same management actions support incidents created by alert handling or other system paths. An alert-created incident can therefore use the same monitor links and update timeline as a manually created incident.
References: src/…/incidentController.ts• L303-334 src/…/+page.svelte• L236-300
Incident management
Operators can edit the title and time data, change monitor links, and remove an incident. State changes use the comment flow. Clearing the end time makes an incident active again.
Deleting an incident also removes its comments and monitor links. If alerts point to the incident, those alert links are cleared first so the alert records remain usable.
References: src/…/incidentController.ts• L337-392 src/…/incidentController.ts• L395-425 src/…/incidentController.ts• L536-560 src/…/+page.svelte• L302-389
Incident comments
Comments are the public update stream for an incident. Each comment has text, a display time, and a state. Adding or editing a comment changes the incident state, and an update marked RESOLVED closes the incident at that comment time. A resolved update cannot be dated before the incident start; a later non-resolved update reopens the incident by clearing its end time.
Only active comments appear in normal public views. The incident detail page presents them as a time-ordered timeline and renders their Markdown as safe HTML. Deleting a comment makes it inactive, so public reads no longer show it.
References: src/…/incidentController.ts• L429-550 src/…/incidents.ts• L768-833 src/…/+page.svelte• L984-1153 src/…/+page.svelte• L47-81
Maintenance schedules
A maintenance schedule describes planned work rather than an unexpected service problem. It stores a title, an optional description, a first start time, a repeat rule, and the duration of each occurrence. A schedule is ACTIVE or INACTIVE and can be tied to selected monitors.
Schedule creation
Operators create maintenance from the management area with a positive duration and a valid calendar repeat rule. A one-time schedule uses a rule with COUNT=1; any other rule describes recurring work. The system creates the first event during creation, then uses the schedule to create later occurrences.
References: src/…/maintenanceController.ts• L28-37 src/…/maintenanceController.ts• L237-273 src/…/+page.svelte• L348-405
Schedule management
Operators can edit the description, schedule, duration, active state, and monitor set. A schedule change regenerates events that are still planned while preserving completed or cancelled history.
Operators can also edit, delete, or manually end a single maintenance event. Completing an event means the work finished. Cancelling an event means the planned occurrence will not run. An event that is already in progress records a bounded end time when an operator ends it early.
References: src/…/maintenanceController.ts• L364-427 src/…/maintenanceController.ts• L440-572 src/…/+page.svelte• L413-479
Maintenance event timelines
Each occurrence of a maintenance schedule is a maintenance event with its own start time, end time, and status. The event is the unit that the status page displays, so a recurring schedule can show current work, recent work, and future work without losing its schedule history.
Event status follows time and operator action:
| Status | Meaning |
|---|---|
SCHEDULED | The event is planned and is more than the reminder window away. |
READY | The event is close to its start time. |
ONGOING | The event is in progress. |
COMPLETED | The event ended normally. |
CANCELLED | The event was stopped before completion. |
The maintenance detail page shows the selected event with its time window and lists nearby past, current, and upcoming events. A public link can identify either a specific event or the maintenance schedule; a schedule link selects the first available event. Terminal transitions allow completion only from ONGOING and cancellation from SCHEDULED, READY, or ONGOING.
References: src/…/maintenanceController.ts• L70-96 src/…/maintenanceController.ts• L292-316 src/…/maintenanceController.ts• L479-562 src/…/maintenances.ts• L239-285 src/…/+page.svelte• L896-965 src/…/+page.server.ts• L11-86
Event scheduling
Recurring schedules are expanded ahead of time so the public view has concrete event windows. The scheduler runs each hour and keeps the next seven days of recurring events available. It skips duplicate start times and does not generate recurring events for inactive schedules.
Time-based processing moves events toward READY, ONGOING, and COMPLETED. It also catches up events that passed the reminder window while the scheduler was not running. Maintenance notifications can be sent when an event is created, is starting soon, starts, or ends, subject to the site notification settings.
References: src/…/maintenanceScheduler.ts• L21-78 src/…/maintenanceScheduler.ts• L81-165 src/…/maintenanceController.ts• L665-734
Monitor associations
A monitor association states which service a record affects and what impact users should see for that service. Associations use monitor tags, so the event can be shown on the matching monitor page and on status pages that include that monitor.
Incident associations use an impact such as DOWN, DEGRADED, or MAINTENANCE. Maintenance associations store the status to show during the event, such as UP, MAINTENANCE, DOWN, or DEGRADED. The management paths check that each referenced monitor exists, and updates replace the association set instead of creating an unintended duplicate.
Global records are the broad form of an association. A global incident or maintenance can appear for all relevant status pages and monitor views even when it has no per-monitor link. A global record linked only to hidden monitors remains visible as a global event, but its public affected-monitor list is empty. A non-global record must match a visible monitor in the requested scope. Hidden monitors do not make that record public, even when their tags are requested.
References: src/…/incidentController.ts• L101-121 src/…/incidentController.ts• L362-392 src/…/maintenanceController.ts• L574-625 src/…/incidents.ts• L453-524 src/…/maintenances.ts• L469-543 src/…/incidents.test.ts• L143-220 src/…/maintenances.test.ts• L95-158
Status page display
Status pages combine monitor health with related incidents and maintenance events. Inline event display is controlled by event settings. Those settings can enable or hide active incidents, resolved incidents, ongoing maintenance, past maintenance, and upcoming maintenance, with limits for history and future windows.
The main page uses the page's monitor set to select local events and also includes global events. A global event with no visible monitor link can therefore appear with no affected monitor listed. A monitor page applies the same rule to one monitor. Public detail pages then provide the full incident update timeline or the maintenance event timeline and affected-monitor view.
The events view merges incidents and maintenance events by date range. RSS and notification responses use the same monitor scope, which keeps feeds and dashboard notices aligned with the public status view.
References: src/…/dashboardController.ts• L51-114 src/…/dashboardController.ts• L301-390 src/…/incidents.ts• L841-902 src/…/maintenances.ts• L640-677 src/…/+page.server.ts• L9-29 src/…/+page.server.ts• L11-86 src/…/rss.ts• L160-197
Change checklist
When these files or sections are changed, remember to consider these:
- Keep incident state changes and comment state changes aligned. Public pages derive the incident timeline from active comments, while the incident's current state controls active and resolved views.
- Keep the resolved-comment date guard aligned across management paths. A resolved comment before the incident start must not change the incident or create a notification.
- Keep maintenance schedule edits aligned with event regeneration rules. A change to the repeat rule, start time, or duration must not create duplicate future occurrences or erase completed history.
- Keep event status transitions aligned with public filters. Upcoming, ongoing, past, and cancelled events use different status and time ranges.
- Keep monitor impact values aligned between management forms, monitor associations, and the status-page display. The impact is the user-facing status for the linked monitor.
- Keep global and monitor-scoped selection aligned across status pages, monitor pages, event history, RSS, and notifications. Global records without visible monitor links must remain visible with an empty affected-monitor list.
- Keep hidden-monitor filtering in public queries. A global event is still public even when it has no visible per-monitor row, but a non-global event must not become visible through a hidden tag.
- Keep maintenance event notification types aligned with event creation and event state changes.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A resolved comment is dated before the incident start | The incident can close at an invalid point in the public timeline | Reject the comment before saving the comment, incident state, or notification |
| A comment is marked inactive instead of being edited | The public incident loses an update while the stored record remains available only to management queries | Use active-comment reads for public output and preserve the intended comment state |
| A maintenance end time is not after its start time | The event has an invalid window and cannot be trusted by status-page range queries | Validate both times when an event is created or edited |
| A recurring event is generated twice for the same start time | Users see duplicate maintenance notices and timeline entries | Check existing event start times before generation |
| A maintenance event is cancelled or completed from an invalid state | The event history reports a state transition that did not occur | Allow completion only from ONGOING; allow cancellation only from SCHEDULED, READY, or ONGOING |
| A monitor tag is removed without updating its event links | An event still claims impact for a service that no longer belongs to it | Change the association through the management actions that update the link set |
| A hidden monitor remains in a public association list | Internal service data appears on a public page or feed | Filter hidden monitors when building public event and monitor views |
| A non-global event matches only a hidden monitor | The event appears in a public list without a visible affected service | Require a visible monitor match for non-global records and keep global records as the only monitor-free exception |
Key files
| File | Why to read it |
|---|---|
| src/…/incidentController.ts | Defines the incident lifecycle, comment effects, monitor links, and subscriber updates. |
| src/…/incidents.ts | Shows how incidents, active comments, global records, hidden monitors, and monitor-scoped records reach public views. |
| src/…/+page.svelte | Shows the operator list and state-based incident management view. |
| src/…/+page.svelte | Shows incident creation, edits, monitor selection, and first-update entry. |
| src/…/+page.svelte | Shows the public incident timeline and affected-monitor view. |
| src/…/maintenanceController.ts | Defines maintenance schedules, event states, event history, monitor links, and notifications. |
| src/…/maintenanceScheduler.ts | Shows how recurring maintenance becomes concrete future events. |
| src/…/maintenances.ts | Shows the time and monitor queries used for maintenance display, filtering, and hidden-monitor handling. |
| src/…/+page.svelte | Shows operator control of schedules, events, statuses, and affected monitors. |
| src/…/+page.server.ts | Resolves schedule or event links and prepares the public event and monitor view. |
| src/…/dashboardController.ts | Connects incidents and maintenance events to page dashboards and notification payloads. |
| src/…/rss.ts | Shows how scoped incident and maintenance data reaches the public feed. |