fix: update monitor.status for private location monitors - #2496
Conversation
Private location monitors were not updating the monitor.status field when checks failed/recovered, causing the dashboard to always show them as 'active' even when failing. The cloud checker updates monitor.status on status transitions, but the private location handler (updateStatusPrivate) only updated the privateLocationMonitorStatus table without touching monitor.status. This fix adds the same monitor.status update logic to all three status transition cases (error, degraded, active) to match the cloud checker behavior. Fixes dashboard status display and 'Failing'/'Normal' counts for private location monitors.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
There was a problem hiding this comment.
All reported issues were addressed across 1 file
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
f4ecc29 to
535341c
Compare
a0a5dea to
689e1de
Compare
V1 (P1): Filter status query to only attached locations - Prevents detached location stale status from counting toward threshold - Added inArray filter on attachedLocationIds V2 (P1): Gate incident creation with threshold check - Only create incidents when threshold met for private-only monitors - Prevents premature incident creation (1/3 errors) V3 (P2): Pass incident ID to notifications - Capture incident ID in error and recovery cases - Pass to triggerNotifications for provider context V4 (P1): Gate incident resolution with threshold check - Only resolve when threshold met and monitor recovered - Prevents premature incident closure (1/3 recovery) Test (P2): Add PRIVATE_ONLY_MONITOR_ID cleanup to afterEach - Prevents test data leakage between tests
- Move incidentId declaration outside switch to fix redeclaration error - Filter null values from attachedLocationIds for inArray type safety - Fixes TS2451 (redeclaration) and TS2769 (inArray type mismatch)
|
@claude review this |
|
Claude finished @thibaultleouay's task in 3m 31s —— View job Reviewing PR #2496
Good progress overall — the previously flagged P1s (detached locations counting toward the threshold, incidents not gated on threshold, One remaining issue I found by tracing through the multi-location threshold logic: Duplicate notifications when a location's report doesn't change the aggregate monitor statusIn all three cases ( if (hasCloudRegions || shouldUpdateMonitorStatus) {
await triggerNotifications({ ... });
}
Concretely, with 3 attached private locations on a private-only monitor:
The same pattern applies symmetrically to The fix is to gate the notification the same way the DB update is gated, e.g. capture the transition once before the switch: const isStatusTransition = monitor.status !== status;
...
if (hasCloudRegions || (shouldUpdateMonitorStatus && isStatusTransition)) {
await triggerNotifications({ ... });
}( This isn't covered by the new tests either — Minor
|
Resolved conflicts in private-location.ts by combining threshold logic and monitor status updates with upstream's triggeredNotifications tracking for OTel logging.
…com/zapteryx/openstatus into fix/private-location-monitor-status
Resolved conflicts by combining upstream's incident handling improvements with monitor status updates. Changes: - Kept upstream's incident-utils.ts with atomic resolveIncident helper - Kept upstream's race condition detection in incident creation - Added monitor status updates for private-only monitors (error/degraded/active) - Made notifications conditional: cloud monitors always, private-only when threshold met
|
@claude review this |
|
Claude finished @thibaultleouay's task in 3m 18s —— View job Reviewing PR #2496
CI is green (Tests, Check, DX Check, autofix.ci all passing). Note: because Still-open issue from the previous review: duplicate notifications on a repeated (non-transitioning) reportThis is the same finding from the 08:14 review — it hasn't been addressed by any commit since (the only commits after that review are merges of In all three cases — if (hasCloudRegions || shouldTriggerIncident) {
triggeredNotifications = await triggerNotifications({ ... });
}
Concretely, with 3 attached private locations on a private-only monitor:
The cloud checker ( Fix (mirrors the DB-update guard, which already uses the pre-update const isStatusTransition = monitor.status !== status;
...
if (hasCloudRegions || (shouldTriggerIncident && isStatusTransition)) {
await triggerNotifications({ ... });
}Still not covered by tests: Minor (unchanged from earlier review, low priority)
What's correctly handled now
|
Private location monitors were not updating the monitor.status field when checks failed/recovered, causing the dashboard to always show them as 'active' even when failing.
The cloud checker updates monitor.status on status transitions, but the private location handler (updateStatusPrivate) only updated the privateLocationMonitorStatus table without touching monitor.status.
This fix adds the same monitor.status update logic to all three status transition cases (error, degraded, active) to match the cloud checker behavior.
Fixes dashboard status display and 'Failing'/'Normal' counts for private location monitors.
Resolves #2495


