Pulse/internal
rcourtman 5fd05efa83 Add connection-degraded alert for wedged platform connections
A Proxmox host wedged on a ZFS deadlock yesterday took the cluster API poll
with it (context deadline exceeded). The unified connections aggregator
flipped the Connection from active to stale to unreachable, and the
Settings / Infrastructure page rendered the right badges, but no top-nav
alert ever fired because nothing was actively notifying off that derived
state. Patrol's deterministic triage flagged it every minute, but its LLM
investigation stage has been broken since 2026-02-26 so flags never
escalated into user-visible findings. Result: a 3 hour outage I only
noticed because I happened to open Settings.

This wires an active notification off the same connection state the
Settings badges already use:

- internal/alerts/connection.go: new CheckConnection +
  clearConnectionDegradedAlert that fire connection-degraded after three
  consecutive stale or unreachable observations. Severity scales: stale
  warning, unreachable / unauthorized critical. Clear runs through the
  same recovery-confirmation gate as clearNodeOfflineAlert so a single
  flap back to active doesn't silently resolve a real outage. Paused,
  disabled, and non-platform connections are no-ops.

- internal/api/connections_alerts.go: snapshot translator that turns
  api.Connection into the narrow alerts.ConnectionSnapshot view. Keeping
  the snapshot type inside the alerts package preserves the existing
  api -> monitoring import direction; the monitor would have cycled if
  it called back into api directly.

- internal/monitoring: new SetConnectionsSnapshotLister hook + a
  per-tick checkConnectionAlerts call in the main poll loop, alongside
  the existing evaluate*Agents passes.

- internal/api/router.go: register the lister closure on r.monitor so
  the alerts loop sees the same Connection rows the HTTP handler does.

- internal/alerts/specs/types.go: add "connection" to the migration
  bridge list of accepted ResourceTypes, alongside node / docker-host /
  proxmox-disk / etc. The connection concept doesn't have a canonical
  unified resource type yet; this matches the existing pattern for
  alert-keyed resources that aren't first-class canonical.

Test coverage in internal/alerts/connection_test.go covers active never
fires, three stale observations escalate from pending to warning,
unreachable escalates warning to critical, unauthorized fires critical
cold, paused / disabled / agent never fire, recovery confirmation gate,
and a stale flap during recovery resets the gate.
TestResourceAlertSpecValidateAllowsConnectionMigrationBridgeType mirrors
the existing migration-bridge proof tests for the new type.
2026-05-12 00:29:04 +01:00
..
actionplanner Fail closed dry-run action execution 2026-05-05 09:22:04 +01:00
agentexec
agenttls
agentupdate
ai Sanitise plain-JSON tool-call leaks from weak local models 2026-05-11 17:02:07 +01:00
alerts Add connection-degraded alert for wedged platform connections 2026-05-12 00:29:04 +01:00
api Add connection-degraded alert for wedged platform connections 2026-05-12 00:29:04 +01:00
bootstrap
cloudcp Remove monitored-system volume caps 2026-05-05 12:59:59 +01:00
config Keep direct DeepSeek Patrol models selectable 2026-05-08 11:57:04 +01:00
crypto
deploy Remove monitored-system volume caps 2026-05-05 12:59:59 +01:00
discovery
dockeragent
hostagent Fix PVE version detection on agent hosts 2026-05-08 15:30:08 +01:00
hosted Canonicalize legacy hosted signup principals 2026-05-04 22:52:00 +01:00
hostmetrics
kubernetesagent
license Remove monitored-system volume caps 2026-05-05 12:59:59 +01:00
logging
metrics
mock Bump install pins to rc.5 and refresh test fixtures for Patrol readiness + Unraid host profile tokens 2026-05-11 18:02:52 +01:00
mockmode
mockmodel
mockruntime
models Fix platform identity source contracts 2026-05-08 14:54:08 +01:00
monitoring Add connection-degraded alert for wedged platform connections 2026-05-12 00:29:04 +01:00
notifications Fix notification queue race test 2026-05-01 22:26:01 +01:00
platformsupport Show platform versions in system badges 2026-05-08 15:07:09 +01:00
recovery
relay
remoteconfig
repoctl Add release_cycle_artifact_globs so RC ceremony skips contract-update requirement 2026-05-11 22:55:29 +01:00
securityutil
sensors
servicediscovery Fix silent fingerprint loss for LXC and VMs 2026-05-10 20:31:46 +01:00
ssh/knownhosts
storagehealth Fix Unraid storage health explanations 2026-05-08 12:18:09 +01:00
system
telemetry
testutil
truenas
unifiedresources Merge duplicate map keys in TestActionExecutionContractStaysAPIOwned 2026-05-09 15:08:51 +01:00
updates Verify SSHSIG on in-app update artifacts 2026-05-09 23:14:07 +01:00
updatesignature Fix v6 demo release signing key deployment 2026-05-05 21:40:14 +01:00
utils
vmware
websocket