Skip to content

feat(discord): finish the bot migration — retire the webhook transport and close the frontend gaps - #409

Merged
fclairamb merged 6 commits into
mainfrom
fix/discord-hide-empty-webhook-field
Sep 20, 2026
Merged

fclairamb merged 6 commits into
mainfrom
fix/discord-hide-empty-webhook-field

Conversation

@fclairamb

@fclairamb fclairamb commented Sep 20, 2026 •

Copy link
Copy Markdown
Owner

What & why

The Discord bot migration left loose ends on both sides of the API: a legacy webhook transport still wired behind the dashboard, and frontend branches that enumerate telegram without discord. This PR closes all of them.

1. Dashboard: the empty webhook field is hidden when the bot can be installed

A fresh Discord integration on an instance with the bot rendered an empty Webhook URL box directly under the panel telling you to install the bot. The not-connected branch now applies the same rule the connected branch already used. The field still shows when the instance has no bot (only transport) or the integration already stores a URL (pre-bot rows).

2. Backend: the webhook sending path is removed

  • DiscordSender.Send no longer falls back to webhook delivery — a guild-less, channel-less integration fails with ErrDiscordNoDestination.
  • The webhook HTTP client and WebhookMessage type are gone; ErrUnexpectedStatus/DefaultTimeout moved into bot_client.go. Net for that commit: −349 lines.
  • WebhookURL stays on models.DiscordSettings and the form — stored and displayed, but nothing reads it to send anymore.

3. Dashboard: cover discord everywhere it branched on telegram

  • The Test-button readiness rule (unverified discord offered a button whose call answers ErrContactNotVerified) moved to a tested helper contactCanTest in lib/notifications.ts, mirroring the backend's contactRequiresSetup.
  • getCommentSource dropped discord, so a Discord-ingested comment rendered with no "via" badge. It now returns discord, the timeline renders the badge, and comments.viaDiscord lands in all four locales.

4. Passkey: guard the conditional-UI ceremony against a click-started one

@simplewebauthn/browser owns one shared abort signal for every WebAuthn ceremony, so a background conditional-UI ceremony starting after a click would abort the explicit one — surfacing as a flaky RP-ID-mismatch login error. The login page now skips the background ceremony once an explicit one starts.

How to test

make build-dash0 && cd web/dash0 && bun run lint && bun run test:unit
cd server && go build ./... && go vet ./... && go test ./internal/notifications/... ./internal/integrations/discord/...

cd web/dash0 && CI=true E2E_BASE_URL=http://localhost:4300/d/ bunx playwright test e2e/channels-discord-bot.spec.ts e2e/integrations.spec.ts e2e/discord-member-mapping.spec.ts

fclairamb and others added 2 commits September 20, 2026 20:28
… installed

A fresh Discord integration on an instance that has the bot rendered an
empty "Webhook URL" box directly under a panel telling you to install the
bot instead. Two ways to wire the same integration, one of them legacy,
offered side by side with no indication which to pick.

The field now follows the same rule the connected branch already used: it
shows when it is the real answer, and not otherwise. That is when the
instance has no bot to install, so the webhook is the only transport, or
when the integration already stores a URL - the pre-bot integrations the
bot rework must never break.

The e2e covers both directions, because hiding it unconditionally would
pass a one-sided test: bot available and nothing stored hides the field,
and the same integration on a bot-less instance still shows it.

Co-Authored-By: Claude Opus 5 <[email protected]>
The bot rework left two transports side by side: the instance bot with
threads, buttons and in-place edits, and the legacy one-way webhook POST
a pre-bot integration was created with. The dashboard had already
stopped offering the webhook field when the bot can be installed, so the
sending path was the last half of a deprecation with no announced end.

This deletes it outright:

- DiscordSender.Send no longer falls back to webhook delivery. A
  guild-less, channel-less integration now fails with
  ErrDiscordNoDestination instead of the webhook error, so a
  misconfigured row says so instead of silently routing somewhere else.
- The webhook HTTP client (internal/integrations/discord/client.go) and
  the WebhookMessage type are gone. ErrUnexpectedStatus and
  DefaultTimeout moved into bot_client.go, where their remaining callers
  live.
- The legacy-mode test file went with them.

WebhookURL itself stays on models.DiscordSettings, the install service
and the dashboard form: stored and displayed for the pre-bot rows that
still carry one, but nothing reads it to send anymore.
@fclairamb fclairamb changed the title fix(discord): hide the empty legacy webhook field when the bot can be installed refactor(discord): retire the legacy webhook transport Sep 20, 2026
Deleting client.go took the package's revive package comment with it.
It now lives on types.go, reworded for what the package actually is
since the webhook client is gone.
…gram

Two sites still enumerated telegram by hand and were never extended
when the discord contact type shipped:

- canTest, inline in account.notifications.tsx, offered a Test button on
  an unverified discord route whose call answers ErrContactNotVerified.
  The rule now lives in a tested helper, contactCanTest in
  lib/notifications.ts, mirroring the backend's contactRequiresSetup —
  and unknown future types stay testable by default, as before.
- getCommentSource mapped a discord-ingested comment to undefined, so
  the incident timeline rendered it with no source badge where Slack and
  Telegram get one. It now returns "discord", the timeline renders the
  badge, and comments.viaDiscord is added to all four locales.

Spec: specs/done/2026/09/2026-09-20-01-discord-frontend-telegram-parity.md
…ed one

@simplewebauthn/browser owns one shared abort signal for every WebAuthn
ceremony, so a conditional-UI (background autofill) ceremony that starts
after the user clicks Sign in with a passkey would abort that explicit
ceremony and surface as a flaky RP-ID-mismatch login error. The login
page now sets a flag before starting the explicit ceremony and skips the
background one when it is set.

Spec: specs/done/2026/09/2026-09-20-01-passkey-rp-id-mismatch-flaky-login-error.md
@fclairamb fclairamb changed the title refactor(discord): retire the legacy webhook transport feat(discord): finish the bot migration — retire the webhook transport and close the frontend gaps Sep 20, 2026
@fclairamb
fclairamb enabled auto-merge (squash) September 20, 2026 20:47
@fclairamb
fclairamb merged commit e89710d into main Sep 20, 2026
19 checks passed
@fclairamb
fclairamb deleted the fix/discord-hide-empty-webhook-field branch September 20, 2026 21:33
fclairamb added a commit that referenced this pull request Sep 21, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.30.0](v0.29.2...v0.30.0)
(2026-09-21)


### Features

* add a super-admin user directory and page people on Discord
([#406](#406))
([3506c8f](3506c8f))
* **discord:** finish the bot migration — retire the webhook transport
and close the frontend gaps
([#409](#409))
([e89710d](e89710d))
* group-based status page sections, ICMP burst sampling, and form
exposure ([#411](#411))
([e3c87e8](e3c87e8))


### Bug Fixes

* **deps:** update module github.com/urfave/cli/v3 to v3.13.0
([#408](#408))
([5c10ab5](5c10ab5))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
fclairamb added a commit that referenced this pull request Oct 9, 2026
Three specs from a self-hoster's report:
- 02: secret fields (SMTP password, JWT secret, inbox password) are
  dropped on first save; test mail ignores env overrides.
- 03: Discord webhook delivery was removed in #409 but the UI and docs
  still offer it. Bring it back as the no-bot fallback.
- 04: bot install uses a second redirect URI the public docs never list.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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