Skip to content

feat(alerts): show lifecycle status labels using NWS messageType#337

Merged
Orinks merged 7 commits intodevfrom
feat/332-alert-lifecycle-labels
Feb 24, 2026
Merged

feat(alerts): show lifecycle status labels using NWS messageType#337
Orinks merged 7 commits intodevfrom
feat/332-alert-lifecycle-labels

Conversation

@Orinks
Copy link
Owner

@Orinks Orinks commented Feb 24, 2026

Closes #332

What changed

Adds lifecycle status labels to alert list items — (New), (Updated) — so users can see at a glance what's changed since the last poll.

Approach

Labels are driven directly by the NWS API's messageType field on each alert:

messageType Label
Alert (New) — freshly issued by NWS
Update (Updated) — NWS explicitly amended it
Cancel (no label — alert no longer active)

Visual Crossing alerts get no label — VC doesn't provide a messageType equivalent; it repackages NWS data with less metadata, so labels would be unreliable.

Why not snapshot diffing?

An earlier approach used before/after snapshot comparison to derive labels. That had edge cases: labels were wrong on first launch (everything appeared New), broke on app restart, and misclassified amended alerts that NWS re-issues with a new ID. Using messageType directly fixes all of these — it reflects NWS's intent, is stateless, and survives restarts.

Note: the diff infrastructure (diff_alerts, AlertLifecycleDiff) is kept — it still drives the notification system (sounds/toasts for escalations, cancellations, etc.), which is a separate concern.

Files changed

  • models/alerts.py — added message_type: str | None field to WeatherAlert
  • weather_client_nws.py — pass messageType from NWS props through to the model
  • alert_lifecycle.pycompute_lifecycle_labels now takes list[WeatherAlert] instead of a diff
  • ui/main_window.py — updated caller; label computation is now fully stateless
  • tests/test_alert_lifecycle.py — updated tests for new signature and NWS/VC behavior

@Orinks Orinks changed the title feat(alerts): show lifecycle status labels in alert list view feat(alerts): show lifecycle status labels using NWS messageType Feb 24, 2026
@Orinks Orinks merged commit ea97251 into dev Feb 24, 2026
6 checks passed
@Orinks Orinks deleted the feat/332-alert-lifecycle-labels branch February 24, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant