hub v0.24.0: dispatcher routes critical severity (+ nil-prefs crash guard)

ProcessEvent routed only warning/error; a critical-severity event was silently dropped.
Now routes warning/error/critical, logs unrecognized severities, and guards a nil
GetNotificationPrefs (which would panic/crash the hub). host_disk_critical emits its
natural critical severity.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HxLA1mZurFq9kt8hneFeCs
This commit is contained in:
2026-06-30 14:18:45 +02:00
parent 6882d853ed
commit 0ff1d3c883
6 changed files with 159 additions and 14 deletions
+21
View File
@@ -1,5 +1,26 @@
# Felhom Hub — Changelog
## v0.24.0 — dispatcher routes `critical` severity (+ nil-prefs crash guard) (2026-06-30)
NAS Part A2's "Part 0": close the dispatcher's silent drop of `critical`-severity events.
- **`internal/notify/dispatcher.go` `ProcessEvent`:** the severity gate was `severity != "warning" &&
severity != "error"` → a `critical` event was **silently dropped** (never emailed). Now routes
**warning / error / critical** (`severityNotifies`); `info` stays an intentional non-notify; any
**unrecognized** severity is **logged** (`[WARN] Dispatcher: unrecognized severity …`), never silently
dropped. Verified safe first: no controller event emits `critical` (all are info/warning/error) and the
hub's only would-be `critical` emitter is `host_disk` — so no surprise alert volume.
- **`internal/monitor/host_disk.go`:** `host_disk_critical` now emits its **natural `critical` severity**
(was forced to `error` to survive the old gate); `FormatOperatorEmail` styles `critical` 🔴 like `error`.
- **Latent crash guard:** `processCustomer` dereferenced `GetNotificationPrefs`, which returns `(nil, nil)`
for a customer with no notification row — an event for such a customer would **panic the dispatcher
goroutine and crash the hub**. Now guards `prefs == nil` before use.
- **Seam:** `sendEmailFn` field (defaults to the Resend sender) so routing is unit-tested without real HTTP.
- Tests: `severityNotifies` (warning/error/critical notify; info/unknown don't) + **companion red-proof**
(the pre-fix `warning||error` predicate drops `critical`); ProcessEvent routes `critical` to the operator;
an unknown severity is logged not dropped; `info` is silent and not mis-logged. `go build/vet/test ./...`
green.
## v0.23.0 — host root-disk pressure monitoring + alert (2026-06-30)
Closes the silent-failure gap behind the felhom-pve incident: a Proxmox host root fs filling up (vzdump