From bf83c1a7794c75238a6d4b22939bfe529ae0015d Mon Sep 17 00:00:00 2001 From: Josh Wright Date: Sun, 12 Apr 2026 11:40:42 -0400 Subject: [PATCH] Preserve alert history when reopening MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a closed alert reopens (condition still present, no active cooldown), keep firstSeen and comments intact. The alert is the same incident continuing — closing and reopening should not erase history. Co-Authored-By: Claude Sonnet 4.6 --- src/lib/db.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/db.ts b/src/lib/db.ts index 5a30722..f935863 100644 --- a/src/lib/db.ts +++ b/src/lib/db.ts @@ -126,14 +126,14 @@ export function upsertAlerts(candidates: AlertCandidate[]): number { if (isSuppressed) continue; - // Re-open if previously closed (manually or resolved) and not suppressed + // Re-open if previously closed (manually or resolved) and not suppressed. + // Preserve firstSeen and comments — this is the same incident continuing, + // not a brand new one. if (existing.status === "closed") { existing.status = "open"; existing.closeReason = null; existing.closedAt = null; existing.suppressedUntil = null; - existing.firstSeen = nowISO; // treat as a new occurrence - existing.comments = []; } // Refresh content and lastSeen