You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Part of the triggers-detachment epic (part of epic #927).
Goal
Make webhook a table-backed trigger resource. The catch-all webhook route resolves
against the triggers table instead of definition.triggers. Independent of Issues #2/#3.
The webhook callable URL is derived, never stored — the route is a catch-all [...path] and WebhookRouter.route() computes everything from namespace/workflowName/path at request time. So a webhook trigger is fully portable as { method, path, payloadSchema? }; the only instance-specific part is the host, which the
target already knows. Nothing instance-bound is persisted.
Implementation
Handlers/CLI/UI: extend trigger CRUD to --type webhook with config { method, path, payloadSchema? }. Add a "Webhook" panel to the Triggers tab. On
create, report the derived callable URL
(https://<host>/api/triggers/webhook/<ns>/<wf>/<path>) — it is a computed view, not
stored. Enforce webhook-path uniqueness (the partial unique index from Issue Configure Mend Bolt for GitHub #1).
Flip resolution:packages/workflow-engine/src/triggers/webhook-router.ts:88
(findMatchingWebhookTrigger(definition, suffix)) currently reads def.triggers.
Inject the trigger repo and resolve against triggers WHERE type='webhook' AND enabled AND config->>'path' matches suffix,
keeping exact-path + method checks.
Payload schema source: today WebhookTrigger takes a schemaRegistry: Map<name, ZodType>. Source those schemas from the trigger rows' config.payloadSchema instead of
wherever they are populated now, so validation follows the detached trigger.
Backfill migration/seed: create type='webhook' rows from every existing definition's
webhook triggers ({ method, path }), so existing webhook endpoints keep resolving.
Tests
L2: router resolves against the table; 404 when no enabled webhook row matches path;
405 on method mismatch; payload validation from config.payloadSchema.
L3 API-E2E: attach webhook trigger → POST the derived URL → run starts; remove → 404.
Done when
Webhook firing resolves entirely from the triggers table; create reports the derived URL;
CLI + Triggers tab manage webhook triggers; existing webhooks still resolve; suite green.
Part of the triggers-detachment epic (part of epic #927).
Goal
Make
webhooka table-backed trigger resource. The catch-all webhook route resolvesagainst the
triggerstable instead ofdefinition.triggers. Independent of Issues #2/#3.Depends on
Issue #1 (core model). Independent of #2/#3.
Key fact (settled during grilling)
The webhook callable URL is derived, never stored — the route is a catch-all
[...path]andWebhookRouter.route()computes everything fromnamespace/workflowName/pathat request time. So a webhook trigger is fully portable as{ method, path, payloadSchema? }; the only instance-specific part is the host, which thetarget already knows. Nothing instance-bound is persisted.
Implementation
Handlers/CLI/UI: extend trigger CRUD to
--type webhookwith config{ method, path, payloadSchema? }. Add a "Webhook" panel to the Triggers tab. Oncreate, report the derived callable URL
(
https://<host>/api/triggers/webhook/<ns>/<wf>/<path>) — it is a computed view, notstored. Enforce webhook-path uniqueness (the partial unique index from Issue Configure Mend Bolt for GitHub #1).
Flip resolution:
packages/workflow-engine/src/triggers/webhook-router.ts:88(
findMatchingWebhookTrigger(definition, suffix)) currently readsdef.triggers.Inject the trigger repo and resolve against
triggers WHERE type='webhook' AND enabled AND config->>'path' matches suffix,keeping exact-path + method checks.
Payload schema source: today
WebhookTriggertakes aschemaRegistry: Map<name, ZodType>. Source those schemas from the trigger rows'config.payloadSchemainstead ofwherever they are populated now, so validation follows the detached trigger.
Backfill migration/seed: create
type='webhook'rows from every existing definition'swebhook triggers (
{ method, path }), so existing webhook endpoints keep resolving.Tests
405 on method mismatch; payload validation from
config.payloadSchema.Done when
Webhook firing resolves entirely from the
triggerstable; create reports the derived URL;CLI + Triggers tab manage webhook triggers; existing webhooks still resolve; suite green.