Skip to content

fix(webhooks): repair the test button and rework the subscription UI - #16

Merged
albanm merged 6 commits into
mainfrom
fix-webhook-test
Sep 30, 2026
Merged

albanm merged 6 commits into
mainfrom
fix-webhook-test

Conversation

@albanm

@albanm albanm commented Sep 30, 2026

Copy link
Copy Markdown
Member

Repair the webhook "Test" button and rework the webhook subscription embed page:

  • the test button called a wrong api/v1/... path, it now hits webhook-subscriptions/:id/_test
  • a single list of webhooks for all the topics passed to the page, with a topic selector in the form when there are several (none preselected); GET /api/webhook-subscriptions accepts a comma-separated topic list
  • delivery progress (waiting → working → ok/error, retry, cancel) is pushed over WS on <ownerType>:<ownerId>:webhook-subscriptions/<id>/webhooks, readable only by an admin of the owning account; the history updates live and the manual refresh button is gone
  • the form posts only its editable fields and the save button reflects real changes, so a refreshed subscription no longer looks modified
  • English translations for the page, and a dev-only vite fix pre-bundling @data-fair/lib-vue/owner.js for the /events/dev page

Heads-up:

  • new WS authorization rule in api/src/server.ts: any channel whose third segment starts with webhook-subscriptions/ requires the active account to be the owner with the admin role — worth a look since it gates who sees webhook payloads.
  • the embed page no longer shows one "Configurer des Webhooks pour l'évènement {title}" section per topic; integrators embedding it with several key values get one merged list.
  • every state change of a webhook delivery now also writes a WS event (via the mongo-backed emitter).

albanm and others added 6 commits September 30, 2026 11:01
- the test call prefixed api/v1/ to a fetch already based on the API
  path and hit /events/api/api/v1/..., which answered "unknown api
  endpoint"
- label each topic section "Webhooks pour l'évènement « title »" and
  add English messages
- keep the delete and save buttons side by side
- give the call history a heading, a titled refresh button and a
  message when the webhook has never been called

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
owner.js is only imported from lib-vuetify's owner-avatar.vue, reached
through the linked lib-vuetify-events package. Vite's dependency scan
does not crawl .vue files inside node_modules, so owner.js was served
raw and its import chain reached the CommonJS ajv-formats: /events/dev
failed to load and the e2e warmup timed out.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The subscribe-webhooks embed page showed one list per topic. It now
shows every subscription of the given topics in a single list, each
form starting with a topic selector (hidden when only one topic is
proposed, and keeping a topic that is not proposed selectable).

GET /api/webhook-subscriptions accepts a comma-separated list of topic
keys to support it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…iption form

The list only loads subscriptions whose topic is among the proposed
ones, so a subscription with a topic outside them never reaches the
form.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Every write changing a webhook's status (creation, coalesced reset,
worker pick-up and outcome, retry, cancel) emits the webhook on a
channel scoped to its subscription:
<ownerType>:<ownerId>:webhook-subscriptions/<id>/webhooks, that only
an admin of the owning account can subscribe to.

The call history of the embed page listens to it instead of requiring a
manual refresh, and catches up from the API after a reconnection.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Saving an existing webhook subscription posted the listed document with
created, updated, owner and visibility, and the API answered 400. The
form now keeps and posts only the properties accepted by the POST route
and compares them to the saved subscription to enable the save button,
so the refreshed "updated" date after a save is no longer a change.

The new subscription form receives a stable object, an inline literal
was recreated on every render and could reset the chosen topic.

Add e2e tests for the webhooks page: creation with topic selection,
single topic, edition, deletion and live test call progress.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the fix label Sep 30, 2026
@albanm
albanm merged commit 391eb54 into main Sep 30, 2026
4 checks passed
@albanm
albanm deleted the fix-webhook-test branch September 30, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant