mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-11-09 05:24:49 +09:00
Route WordPress health transitions to the configured notification channels and the outbound webhook bus, edge-triggered so an autonomous poller never spams. EnvironmentHealthService.check_health now captures the prior health_status and, ONLY on a state transition (up<->down edge), fires _notify_health_ transition -> _dispatch_health_alert which: - preserves the existing WorkflowEventBus 'health_check_failed' emit (still fires every failing poll; back-compat for event-trigger workflows); - NEW: NotificationService.send_all to every enabled channel (Discord/Slack/Telegram/email/generic). unhealthy->critical, degraded->warning (delivered by default), recovery->info (delivered only to channels that opt into info). Sent off-thread because send_all does blocking HTTP/SMTP and must not stall the health check; - NEW: emits wordpress.site_down / wordpress.site_up via EventService, added to EVENT_CATALOG, so user webhook subscriptions (incl. wordpress.*) deliver with HMAC + retry and the events auto-appear in the subscription UI. Edge-triggering is the dedup (no in-memory cooldown, which would be single-worker-fragile): a continuously-down site alerts once, recovery once. No schema/migration and no frontend — channel delivery is governed by the existing Notifications settings. Also seeds #35's WP lifecycle-event registry. Deferred: the "error spike" rule needs per-site error metrics that #25 will provide. Verified: backend py_compile. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>