From ce690a4569ef97732a89382ceeb94a00a073cb4d Mon Sep 17 00:00:00 2001 From: -z <11802769+Aloento@users.noreply.github.com> Date: Sun, 4 Oct 2026 22:59:19 +0200 Subject: [PATCH] Drop legacy status handling from the V2 transformer The backend now emits canonical status values only and no longer sends description rows in updates, so the legacy StatusEnum members (Analyzing, Description, InProgressLegacy, Scheduled, System) and their matching branches in ResolveEventStatus are dead code. Remove them along with the description workaround in the updates loop. --- src/Services/Status.Entities.ts | 12 ------------ src/Services/Status.Trans.V2.ts | 17 ----------------- 2 files changed, 29 deletions(-) diff --git a/src/Services/Status.Entities.ts b/src/Services/Status.Entities.ts index e5e8b98..d7e6fd6 100644 --- a/src/Services/Status.Entities.ts +++ b/src/Services/Status.Entities.ts @@ -66,21 +66,9 @@ export const enum StatusEnum { Observing = "observing", Reopened = "reopened", Resolved = "resolved", - System = "SYSTEM", Planned = "planned", Cancelled = "cancelled", Active = "active", PendingReview = "pending_review", Reviewed = "reviewed", - - /** - * Legacy spellings that only exist in rows stored by older backends; the - * backend passes them through verbatim and folds nothing, so the canonical - * members above are matched to them in `ResolveEventStatus`. Never send these - * back: the API validates `status` against a closed set. - */ - Analyzing = "analyzing", - Description = "description", - InProgressLegacy = "in progress", - Scheduled = "scheduled", } diff --git a/src/Services/Status.Trans.V2.ts b/src/Services/Status.Trans.V2.ts index edd0193..ac29c07 100644 --- a/src/Services/Status.Trans.V2.ts +++ b/src/Services/Status.Trans.V2.ts @@ -13,24 +13,16 @@ function ResolveEventStatus({ source, prev, type, - endDate, }: { source?: StatusEnum; prev: EventStatus; type: EventType; - endDate: null | string; }): EventStatus | undefined { if (!source) { return undefined; } switch (source) { - case StatusEnum.System: - return endDate - ? IsIncident(type) ? EventStatus.Resolved : EventStatus.Completed - : prev; - - case StatusEnum.Analyzing: case StatusEnum.Analysing: return EventStatus.Analysing; case StatusEnum.Detected: @@ -44,7 +36,6 @@ function ResolveEventStatus({ case StatusEnum.Resolved: return EventStatus.Resolved; - case StatusEnum.Scheduled: case StatusEnum.Planned: return EventStatus.Planned; case StatusEnum.Active: @@ -52,7 +43,6 @@ function ResolveEventStatus({ case StatusEnum.Modified: return EventStatus.Modified; case StatusEnum.InProgress: - case StatusEnum.InProgressLegacy: return EventStatus.InProgress; case StatusEnum.Completed: return EventStatus.Completed; @@ -200,7 +190,6 @@ export function TransformerV2({ Components, Events }: { Components: StatusEntity source: event.status, prev: dbEvent.Status, type, - endDate: event.end_date, }); const shouldInferStatusFromUpdates = !statusFromEvent; if (statusFromEvent) { @@ -227,16 +216,10 @@ export function TransformerV2({ Components, Events }: { Components: StatusEntity let prev = dbEvent.Status; for (const update of event.updates) { - if (update.status === StatusEnum.Description) { - dbEvent.Description = update.text; - continue; - } - const status = ResolveEventStatus({ source: update.status, prev, type, - endDate: event.end_date, }); if (!status) {