feat(notifications): any number of webhooks, managed in settings (#87) #88

Merged
jfro merged 3 commits from feat/87-many-webhooks into main 2026-11-28 17:16:30 +00:00
Owner

What changed

PR #88 lets settings add, edit, test and remove any number of webhooks, each enabled one gets every notification with its own signature, and the WEBHOOK_* env vars are gone. The tests fail on main and pass here, CI is green, and I checked the UI at 390px and desktop in Chromium and WebKit.

Fixes #87

Red, then green

  • Many webhooks: every enabled one gets each notification with its own signature, each is added, edited, tested and removed in settings, and WEBHOOK_* env vars no longer set one up.: bash -lc 'source ~/.rmenv; eval "$(mise activate bash --shims)"; env -u FORGEJO_TOKEN MIX_TEST_PARTITION=_87 mix test test/lamplighter/notifications_test.exs test/lamplighter/notifications/env_test.exs test/lamplighter_web/live/notification_settings_live_test.exs'
    • fails on the base (3dab5ee): exit 1
    • passes on the branch (8cd5986): exit 0

Checks

  • The whole suite passes on the branch, formatting and warnings-as-errors included, and the new migration rolls back and forward cleanly. (Upper Wolfjaw): bash -lc 'source ~/.rmenv; eval "$(mise activate bash --shims)"; export MIX_TEST_PARTITION=_87; env -u FORGEJO_TOKEN mix format --check-formatted && env -u FORGEJO_TOKEN mix compile --warnings-as-errors && env -u FORGEJO_TOKEN MIX_ENV=test mix ecto.rollback --step 1 && env -u FORGEJO_TOKEN MIX_ENV=test mix ecto.migrate && env -u FORGEJO_TOKEN mix test', exit 0
  • I read the full diff, re-ran the 47 webhook, env and settings tests, and tried forged LiveView events. A non-numeric webhook id in edit-webhook or remove-webhook crashes that user's LiveView with Ecto.Query.CastError (low severity, remounts), and I didn't try real receivers or a released-database upgrade. (Prover): bash -lc 'source ~/.rmenv; eval "$(mise activate bash --shims)"; export MIX_TEST_PARTITION=_87; env -u FORGEJO_TOKEN mix test test/lamplighter/notifications_test.exs test/lamplighter/notifications/env_test.exs test/lamplighter_web/live/notification_settings_live_test.exs', exit 0

Shipping it

  • Goes live when it merges: no. Merging to main only runs CI; images are built when Jeremy runs mise run release (release.yml on v* tags).
  • Undo: a revert puts it back.
  • Not tried on the real thing: Real receivers (an agent, n8n) beyond a local test listener; an upgrade from a released database with a #81 webhook saved (none has shipped yet).
  • For later: Once released with two or more webhooks saved, rolling the migration back fails on the unique index until the extras are removed.

Prover

Passed (Sonnet): I read the full diff, re-ran the 47 webhook, env and settings tests, and tried forged LiveView events. A non-numeric webhook id in edit-webhook or remove-webhook crashes that user's LiveView with Ecto.Query.CastError (low severity, remounts), and I didn't try real receivers or a released-database upgrade.

Every command above was run by Fortysix's Basecamp itself, on the branch named.

## What changed PR #88 lets settings add, edit, test and remove any number of webhooks, each enabled one gets every notification with its own signature, and the WEBHOOK_* env vars are gone. The tests fail on main and pass here, CI is green, and I checked the UI at 390px and desktop in Chromium and WebKit. Fixes #87 ## Red, then green - Many webhooks: every enabled one gets each notification with its own signature, each is added, edited, tested and removed in settings, and WEBHOOK_* env vars no longer set one up.: `bash -lc 'source ~/.rmenv; eval "$(mise activate bash --shims)"; env -u FORGEJO_TOKEN MIX_TEST_PARTITION=_87 mix test test/lamplighter/notifications_test.exs test/lamplighter/notifications/env_test.exs test/lamplighter_web/live/notification_settings_live_test.exs'` - fails on the base (3dab5ee): exit 1 - passes on the branch (8cd5986): exit 0 ## Checks - The whole suite passes on the branch, formatting and warnings-as-errors included, and the new migration rolls back and forward cleanly. (Upper Wolfjaw): `bash -lc 'source ~/.rmenv; eval "$(mise activate bash --shims)"; export MIX_TEST_PARTITION=_87; env -u FORGEJO_TOKEN mix format --check-formatted && env -u FORGEJO_TOKEN mix compile --warnings-as-errors && env -u FORGEJO_TOKEN MIX_ENV=test mix ecto.rollback --step 1 && env -u FORGEJO_TOKEN MIX_ENV=test mix ecto.migrate && env -u FORGEJO_TOKEN mix test'`, exit 0 - I read the full diff, re-ran the 47 webhook, env and settings tests, and tried forged LiveView events. A non-numeric webhook id in edit-webhook or remove-webhook crashes that user's LiveView with Ecto.Query.CastError (low severity, remounts), and I didn't try real receivers or a released-database upgrade. (Prover): `bash -lc 'source ~/.rmenv; eval "$(mise activate bash --shims)"; export MIX_TEST_PARTITION=_87; env -u FORGEJO_TOKEN mix test test/lamplighter/notifications_test.exs test/lamplighter/notifications/env_test.exs test/lamplighter_web/live/notification_settings_live_test.exs'`, exit 0 ## Shipping it - Goes live when it merges: no. Merging to main only runs CI; images are built when Jeremy runs mise run release (release.yml on v* tags). - Undo: a revert puts it back. - Not tried on the real thing: Real receivers (an agent, n8n) beyond a local test listener; an upgrade from a released database with a #81 webhook saved (none has shipped yet). - For later: Once released with two or more webhooks saved, rolling the migration back fails on the unique index until the extras are removed. ## Prover Passed (Sonnet): I read the full diff, re-ran the 47 webhook, env and settings tests, and tried forged LiveView events. A non-numeric webhook id in edit-webhook or remove-webhook crashes that user's LiveView with Ecto.Query.CastError (low severity, remounts), and I didn't try real receivers or a released-database upgrade. Every command above was run by Fortysix's Basecamp itself, on the branch named.
jfro added this to the v1.4 milestone 2026-11-28 16:52:56 +00:00
Notification settings now lists webhooks (none by default): each has a URL,
an optional signing secret and name, its own on switch, minimum severity and
recoveries, and is added, edited, tested and removed on its own. Every
enabled webhook gets each notification, with the same payload,
X-Lamplighter-Event header and signature as #81. WEBHOOK_URL and
WEBHOOK_SECRET are gone; webhooks are only set up in settings.

The unique index on notification_channels.kind now leaves webhooks out, so
an existing webhook carries over as the first one.

Closes #87
feat(notifications): say webhooks can be many on the channel card (#87)
Some checks failed
CI / test (pull_request) Failing after 1m2s
ac19560df5
Author
Owner

Screenshots (example data: three webhooks, one off with a failure)

390-list-chromium

390-list-chromium

desktop-list-chromium

desktop-list-chromium

390-edit-chromium

390-edit-chromium

desktop-edit-chromium

desktop-edit-chromium

390-list-webkit

390-list-webkit

desktop-edit-webkit

desktop-edit-webkit

### Screenshots (example data: three webhooks, one off with a failure) **390-list-chromium** ![390-list-chromium](https://git.knope.dev/attachments/5fc342ee-4d10-47bd-b776-da6f695790d5) **desktop-list-chromium** ![desktop-list-chromium](https://git.knope.dev/attachments/6b05b831-1524-4312-82d7-71088b8a4feb) **390-edit-chromium** ![390-edit-chromium](https://git.knope.dev/attachments/16d85ac2-7252-4c2a-b22f-31d11c97ae05) **desktop-edit-chromium** ![desktop-edit-chromium](https://git.knope.dev/attachments/f464e76b-1522-4f7e-96d8-419f392b6e35) **390-list-webkit** ![390-list-webkit](https://git.knope.dev/attachments/86ff879d-2438-4524-80c6-823bc1c14365) **desktop-edit-webkit** ![desktop-edit-webkit](https://git.knope.dev/attachments/247b4d68-d731-4b39-ab9a-c26f44e74dbf)
style: mix format (#87)
All checks were successful
CI / test (pull_request) Successful in 1m16s
2304d66a73
jfro merged commit fe7f4e66f0 into main 2026-11-28 17:16:30 +00:00
jfro deleted branch feat/87-many-webhooks 2026-11-28 17:16:30 +00:00
Sign in to join this conversation.
No description provided.