Skip to content

Add Slack webhook notifications for flag and value changes#74

Merged
kindermax merged 29 commits into
mainfrom
slack-webhooks
Jun 24, 2026
Merged

Add Slack webhook notifications for flag and value changes#74
kindermax merged 29 commits into
mainfrom
slack-webhooks

Conversation

@kindermax

@kindermax kindermax commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds Slack webhook notifications: when someone changes a feature flag or a value, the server pushes a formatted message to the Slack channels configured for that project. Notification channels (name + webhook URL) are managed globally in the UI (Grafana-style) and selected per-project.

Spec: docs/superpowers/specs/2026-06-12-slack-notifications-design.md
Plan: docs/superpowers/plans/2026-06-12-slack-notifications.md

What's included

  • Data modelnotification_channel (name, type enum SLACK_WEBHOOK, webhook_url) + project_notification_channel M2M; alembic migration f3a9c41e88d2. delete_project cleans up M2M links.
  • DeliveryNotificationsService (featureflags/services/notifications.py): pure Slack legacy-attachment renderers (green/red/grey bar, backticked names, conditions, all operators) + best-effort async dispatch via httpx. Fire-and-forget; never blocks the mutation; failures logged and counted in Prometheus counters slack_notifications_total / slack_notification_errors_total (labelled by channel).
  • GraphQLnotificationChannels query (root + per-project), saveNotificationChannel / deleteNotificationChannel / setProjectNotificationChannels mutations with validation; dispatch hooks wired into all six flag/value mutation handlers (save/reset/delete × flag/value). Delete handlers capture name + project before the row is removed.
  • UI — global "Notification channels" page (gear dropdown in the header → #/settings) with CRUD; per-project multi-select in project settings.

Testing

  • Full backend suite green: 140 passed (lets test).
  • UI builds clean (npm run build).
  • ruff clean on changed files; mypy net-reduced.
  • Verified the channels UI and header rendering in the running dev app.

Notes

  • Delivery is best-effort by design (no retries/outbox); a dropped notification on Slack outage or restart is acceptable.
  • webhook_url is readable by any authenticated user, consistent with the app's existing flat trust model (no role system); it is never written to logs.
image image

m.kindritskiy added 28 commits June 12, 2026 19:24
Implements save_notification_channel, delete_notification_channel,
set_project_notification_channels, and extends delete_project to
clean up ProjectNotificationChannel links on project deletion.
Adds /settings route with a full CRUD table for managing Slack notification
channels, plus a gear button in the sidebar that navigates to it.
…tions

- Changelog entry under [Unreleased]
- Give BaseUserSession a safe user=None default so dispatch guards never
  hit AttributeError on user-less sessions (and to satisfy mypy)
- Annotate notifications loaders with SAConnection; name the HTTP error
  threshold constant; mark save_flag C901 like save_value
- Ignore DTZ001 in tests (naive datetimes mirror stored timestamps)
@kindermax
kindermax merged commit 0eb948d into main Jun 24, 2026
1 check passed
@kindermax
kindermax deleted the slack-webhooks branch June 24, 2026 07:36
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