Merge branch 'develop' into feat/status-page-themes-backend

This commit is contained in:
Alex Holliday committed 2026-04-29 11:35:55 -07:00
commit f4c3ee16db
42 files changed
+557 -389

No files matched your search

@@ -232,10 +232,17 @@ export class StatusService implements IStatusService {
// Build the status patch — computed against the projected window
const patch: Partial<Monitor> = {};
// Not enough data points yet
if (projectedWindow.length < monitor.statusWindowSize) {
patch.status = status === true ? "up" : "down";
// Resolve "initializing" up-front, incidents should be created on initialization && down
let newStatus: MonitorStatus = monitor.status;
let statusChanged = false;
if (monitor.status === "initializing") {
newStatus = status === true ? "up" : "down";
patch.status = newStatus;
statusChanged = newStatus === "down";
}
// Not enough data points yet — record the check and return
if (projectedWindow.length < monitor.statusWindowSize) {
const updated = await this.monitorsRepository.updateStatusWindowAndChecks(
monitor.id,
monitor.teamId,
@@ -248,24 +255,13 @@ export class StatusService implements IStatusService {
return {
monitor: updated,
statusChanged: false,
statusChanged,
prevStatus,
code,
timestamp: Date.now(),
};
}
// With a full window, a single raw check must not change UNLESS we are initializing.
// Otherwise, only the sliding-window threshold can trigger a transition.
let newStatus: MonitorStatus;
if (monitor.status === "initializing") {
newStatus = status === true ? "up" : "down";
} else {
newStatus = monitor.status;
}
let statusChanged = false;
// First evaluate reachability-based status changes, which apply to all monitor types
// and take precedence over hardware breaches.
const reachabilityResult = this.computeReachability(newStatus, projectedWindow, monitor.statusWindowThreshold);