Skip to content

Commit 02d22e1

Browse files
committed
docs(webhooks): name the two tokens a declared webhook needs; changeset
Claude-Session: https://claude.ai/code/session_011TdZ8GjixNZFLz1xJD9zzK Co-authored-by: Claude <noreply@anthropic.com>
1 parent 96a99eb commit 02d22e1

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
'@objectstack/plugin-webhooks': patch
3+
'@objectstack/runtime': patch
4+
---
5+
6+
fix(plugin-webhooks,runtime): a declared webhook that the deployment can never deliver is reported at `error` once at boot, and the activation door refuses to switch it on
7+
8+
Clause-②: no
9+
10+
The webhook auto-enqueuer reads record events only from the realtime service. A stack with `requires: ['webhooks']` and no `'realtime'` therefore never delivers a declared webhook.
11+
12+
- **Before.**
13+
- The boot logged one `WARN [webhook-auto-enqueuer] disabled — ObjectQL, Realtime, or Messaging service not available`. The line named no webhook, gave no consequence and gave no fix.
14+
- `POST /api/v1/security/_activation/webhook/NAME` with `{ "enabled": true }` answered `200 { enabled: true }` and wrote the activation row.
15+
- Every record write still answered 200, and no delivery row was ever written.
16+
- **After** (`@objectstack/plugin-webhooks`). When the stack declares at least one webhook, the boot logs one `error` line instead of the warning. The line names each declared webhook and says that none of them will be delivered while record writes keep succeeding. It names the missing service and the fix, for example "add 'realtime' to `requires`". A stack that declares no webhook gets the same `warn` as before.
17+
- **After** (`@objectstack/runtime`). On such a deployment, switching a declared webhook ON through the activation door answers `503` with `error.code: 'SERVICE_UNAVAILABLE'` and writes nothing. The message gives the same reason and fix as the boot line. Switching one OFF still answers `200` and writes the row. A name nothing declares is still `404`. The authority checks still answer first.
18+
- **Unchanged.**
19+
- Every deployment whose auto-enqueuer runs: switching on and off and delivery behave as before.
20+
- A host that constructs `WebhookOutboxPlugin` with `autoEnqueue: false` gets no new log line and no new refusal. It has turned the enqueuer off itself, and redelivery still reads the switch.
21+
- `os validate` and `os build` are unchanged. They still accept a stack that declares webhooks without these tokens.
22+
- **What to do.** A stack that declares webhooks needs `requires` to include both `'webhooks'` and `'realtime'`.

‎content/docs/automation/webhooks.mdx‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,29 @@ A webhook reaches the dispatcher one of two ways:
100100
- **Authored by an organization** — a `sys_webhook` row (§3.1), switched by its
101101
own `active` field.
102102

103+
**The capabilities a declared webhook needs.** A stack that declares a webhook
104+
must name two tokens in `requires`, beside whatever else it declares:
105+
106+
```ts
107+
requires: ['automation', 'triggers', 'webhooks', 'realtime'],
108+
```
109+
110+
- `'webhooks'` mounts `plugin-webhooks`: the declared-webhook reader, the
111+
auto-enqueuer and the redeliver door. Without it nothing reads the
112+
declaration, and the activation door answers `503 SERVICE_UNAVAILABLE`
113+
because no declared-webhook reader is bound.
114+
- `'realtime'` mounts the realtime service, which is the auto-enqueuer's only
115+
source of record events: the engine publishes `data.record.*` through it, and
116+
nothing else feeds the enqueuer (§4.1). With `'webhooks'` and without
117+
`'realtime'` the declaration is read but never dispatched. The boot logs one
118+
`error` that names each declared webhook and the missing token. The
119+
activation door then refuses to switch a declared webhook on, answering
120+
`503 SERVICE_UNAVAILABLE` with the same reason. Switching one off still works.
121+
122+
The outbox itself comes from `messaging`, which every boot mounts unless it runs
123+
with `--preset minimal`. A scaffolded app's `requires` is
124+
`['automation', 'triggers']`, so it carries neither of the two tokens above.
125+
103126
On a database an 18.0 pre-release (`18.0.0-next.*`) created, the rows that release's boot seeder
104127
wrote for declared webhooks (`managed_by: 'package'`) are still there. Until the
105128
ownership migration removes them, a pristine one is ignored in favour of its

0 commit comments

Comments
 (0)