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
{{ message }}
Repository navigation
Commit bef80d3
Browse filesBrowse the repository at this point in the historyBrowse files
fix(spec,plugin-webhooks)!: retire the GET webhook method and park stored GET subscriptions with a visible reason (#34239)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbCpddLFmKzR39wJWZpkRMCi)_Fixes#34098
Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: none — `git grep` of `skills/` finds no webhook `method`
value taught anywhere, so no page names `GET` as a webhook method.
> **BREAKING** — a webhook can no longer be authored with `method:
'GET'`, on either surface: `WebhookSchema.method`
(`@objectstack/spec/automation`) and the `sys_webhook` `method` select
(`@objectstack/plugin-webhooks`). A row already stored with `get` is
parked with a visible reason, never converted. Migration: set the method
to `POST`, `PUT`, `PATCH` or `DELETE`. ADR-0087 D3 entry
`webhook-method-get-retired`; no D2 conversion exists.
Maintainer ruling (6902187601), quoted as tapped: 「A 从契约中移除 GET」 — spec
枚举和 sys_webhook 下拉都去掉 GET,属破坏性变更;已存的 GET 行停用并写明原因,不自动改成 POST。
## 维护者速读
- 改了什么:Webhook 的请求方法去掉 GET(spec 枚举和 Setup 下拉两处);已经存成 GET 的 Webhook
不再投递,每个事件记一条带原因的 dead 投递记录。
- 为什么改:每次投递都把事件放在请求正文里,GET 请求没有正文,所以 GET Webhook 从来没有成功送达过一次。
- 风险与回滚:破坏性变更,只影响写了 GET 的 Webhook(仓库内没有);已存的 GET 行不会被改成别的方法。回滚即还原本 PR。
- 先看:`packages/plugins/plugin-webhooks/src/auto-enqueuer.ts`(`parseRow`
里的停用分支与刷新循环跳过凭据),`packages/spec/src/automation/webhook.zod.ts`(枚举与提示文案),`.changeset/34098-webhook-method-get-retired.md`。
- 两分钟验证:`pnpm --filter @objectstack/plugin-webhooks exec vitest run
--maxWorkers=2 src/webhook-get-retired-34098.test.ts`,预期 7 个测试全部通过。
- 需要你做的:无,席位落地(需一次 spec 契约面的 CONTRACT_REVIEW_TIER 复核)。
## What changes
- **Spec** (`packages/spec/src/automation/webhook.zod.ts`): `method` is
`enumWithRetiredValues(['POST','PUT','PATCH','DELETE'], { GET: … })`,
default `POST` unchanged. `method: 'GET'` fails parse with a
prescription naming the four methods; any other unknown value keeps
zod's own message. `HEAD` was never in the enum and is not mentioned.
- **D3 entry**
(`packages/spec/src/migrations/entries/semantic/18.webhook-method-get-retired.ts`):
the upgrade-guide entry. No D2 conversion: converting GET would start
sending another method to an endpoint configured for GET.
- **Select**
(`packages/plugins/plugin-webhooks/src/sys-webhook.object.ts`): four
options. The record validator now refuses an insert or update with
`method: 'get'` (`VALIDATION_FAILED`, a field error `invalid_option` on
`method`). The `options.get` leaf and its source hash leave all eleven
locale bundles (regenerated with `node scripts/check-i18n-bundles.mjs
--write --filter=webhooks`; the diff is 21 deletions only).
- **Park** (`packages/plugins/plugin-webhooks/src/auto-enqueuer.ts`):
`parseRow` sets `parkedReason` when the stored method is retired. The
refresh loop then skips credential resolution for that row (a parked
subscription carries no secret and no header map), and `projectDeclared`
does the same for a declared webhook handed in by a reader that skipped
the schema. Each matched event goes through the existing #8069 path to
`recordUndeliverable()`: one `dead` row, 0 attempts, no signature,
reason `[VALIDATION_ERROR/400] webhook 'NAME' is stored with HTTP method
GET … Fix: edit the webhook and set its method to POST, PUT, PATCH or
DELETE …`. Said once at `error`. Parked events never call `enqueue`, so
the outbox's bodyless-GET refusal from #34067 is not reached. The stored
method is never rewritten.
- **Declared webhooks**: `DeclaredWebhookSource.parseItem` parses
through `WebhookSchema`, so a declared GET is now refused there with the
existing "declared webhook failed validation — not dispatched" warning
and never reaches the dispatcher. `declared-webhooks.ts` is unchanged.
- **Docs**: `content/docs/automation/webhooks.mdx` method row without
GET, plus a "Stored GET webhooks are parked" note;
`content/docs/references/automation/webhook.mdx` regenerated by
`gen:docs`.
Sequencing: built after PR #34067 (#33895) merged (`0d1443d0` on main,
merged into this branch). Reviewer note N5 on #34067: until this PR
lands, a GET webhook on main leaves only a lost-event log line and no
delivery row, so this PR should ship in the same release as #34067.
## Tests
New file
`packages/plugins/plugin-webhooks/src/webhook-get-retired-34098.test.ts`,
on a real `SqlDriver` (SQLite) under a real `ObjectQL`, with
`SqlHttpOutbox`, `MessagingService` and `HttpDispatcher`:
- save door: insert with `get` refused `VALIDATION_FAILED` (the engine's
`ValidationError`; REST maps it to 400) with `invalid_option` on
`method`, nothing stored; update to `get` refused, stored method still
`post`; the four methods save; the select offers exactly four.
- stored GET row (H1, H3): one `dead` row per event with 0 attempts, no
signature, `method: GET` and the reason; a dispatcher tick sends
nothing; `redeliverHttp` refused `DELIVERY_NEVER_SENT`; the park is
reported once at `error` with `code`/`status`/`method` in meta; the
stored method reads `get` through the driver and the engine.
- CONTROL (H2): a POST row delivers one POST carrying the envelope.
- declared GET: refused at parse by `DeclaredWebhookSource`; one handed
in past the schema is parked with no credentials on the row.
Spec side, in the existing
`packages/spec/src/automation/webhook.test.ts`: the four methods parse;
`GET` is refused with `invalid_value` at `['method']` and the
prescription's first sentence; `TRACE` keeps zod's message.
## Acceptance notes
- PM hypotheses: H1 holds (one dead row per event, reason present, no
signature, fetch not called). H2 holds (the POST control delivers;
healthy rows take the unchanged path). H3 holds (the method reads `get`
after the park).
- The park reason carries the standard-catalog pair
`[VALIDATION_ERROR/400]`, the pair `webhook-legacy-cleartext.ts` carries
on its own delivery door; the save door's `VALIDATION_FAILED` is the
engine record validator's own answer. A first cut stamped
`VALIDATION_FAILED` in plugin-webhooks and `check:error-code-provenance`
refused it (a registered code with no provenance row under the plugin's
owner key); the standard-catalog member needs no ledger row, so no new
error code and no ledger edit.
- The spec's generated ratchets moved nothing: `check:generated` reports
all 14 up to date and the diff touches nothing under `api-surface/`,
`authorable-surface/` or `json-schema.manifest/`, as an enum-value
narrowing is expected to (the def, its exports and its key are
unchanged); only the generated reference page shows the four values.
## Verification
Final head `b61479ce` (main merged at `8ab601e3`, #34067 included). Each
reading names its head. At open, `git merge-tree --write-tree` against
origin/main `7be32d39` is clean and none of the 27 newer main commits
touches a file in this diff; main was not merged again so the battery
stays on the final head.
<details><summary>Ablations at `4ff9df50` (each restored through a trap,
git diff HEAD empty, HEAD blob hashes matched)</summary>
- Park removed (`retiredMethodParkReason` returns undefined): 2 failed /
5 passed — `expected 'pending' to be 'dead'` for the stored GET row and
for the declared GET past the schema.
- GET put back in the select: 3 failed / 4 passed — `expected undefined
to be defined` (insert admitted), `expected undefined to match object {
code: 'VALIDATION_FAILED' }` (update admitted), the options list.
- Spec enum back to `z.enum(['GET', …])`: 1 failed / 24 passed —
`expected true to be false` (GET parsed).
</details>
<details><summary>Suites and gates</summary>
- `b61479ce`: `pnpm --filter @objectstack/plugin-webhooks test` 26
files, 314 tests passed; `typecheck` exit 0.
- `8ab601e3`: `pnpm --filter @objectstack/spec test` 843 files, 26983
passed, 1 todo; `typecheck` exit 0. Spec `test:repo` is left to CI's
Test Core.
- `8ab601e3`: `pnpm --filter @objectstack/spec check:generated` all 14
artifacts up to date.
- `8ab601e3`, direct dependents of plugin-webhooks:
`@objectstack/verify` test 52 files, 439 passed; http-conformance's two
webhook files 13 passed; cli `--project unit` on its webhook-touching
files 4 files, 176 passed (narrowed to the files that name webhooks; the
full cli suites are CI's). Spec's dependents are CI's.
- Dogfood battery (`pnpm --filter @objectstack/dogfood test` under the
verify lock, closure built), final head `b61479ce`: VERDICT command-exit
0, Test Files 469 passed / 3 skipped (472), Tests 3974 passed / 42
skipped (4016), no failure. The same counts at `69f9d19c`.
- Derived gates (`dispatch-gates.mjs --commands`, 118 families) at
`69f9d19c` / `cf97ed4d`, the first 48 re-run at `b61479ce`: 116 exit 0.
`check:error-code-provenance` and `check:query-options-erasure` were red
on the first cut (a stamped `VALIDATION_FAILED`, three `as any`
query-option casts in the new test) and are exit 0 after the fix. NOT
MEASURED (exit 3, prerequisite not met, CI runs them):
`check:skill-examples` (needs `@objectstack/client-react` built),
`check:dual-build-cjs-loads` (needs every package built). `--ran`
reconciliation: 118 derived, 116 run, 2 NOT-MEASURED, 0 UNRUN. `pnpm
lint` exit 0. `check-changeset-no-major`, `check-adr-0087-registration`
(registered `webhook-method-get-retired`, new here),
`check-closing-keyword-parity`, `check-partof-closing-keyword`,
`check:nul-bytes`, `check:error-code-casing`: exit 0 on this body and
changeset.
</details>
Session: https://claude.ai/code/session_01QsR2jUZKdq3PK2Sab53cT3
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude <noreply@anthropic.com>
fix(spec,plugin-webhooks)!: a webhook can no longer be saved with method `GET`, and a stored GET webhook is parked with a visible reason instead of failing silently
7
+
8
+
Clause-②: no (narrowing)
9
+
Metadata-protocol: narrowed
10
+
Skills-docs: none — `git grep` of `skills/` finds no webhook `method` value taught anywhere, so no page names `GET` as a webhook method.
**BREAKING** for a webhook authored with `method: 'GET'`. Every webhook delivery sends the event envelope as its request body, and a GET request carries none, so no GET webhook ever delivered an event: the outbox sent the body, the HTTP client refused a GET with a body, and the delivery retried until dead. `GET` is removed from both authoring surfaces.
15
+
16
+
What moves (each line FROM → TO):
17
+
18
+
-`WebhookSchema.method` (`@objectstack/spec/automation`, a declared webhook in `defineStack({ webhooks })`): FROM `GET` / `POST` / `PUT` / `PATCH` / `DELETE` TO `POST` / `PUT` / `PATCH` / `DELETE` (default `POST`, unchanged). `method: 'GET'` fails parse with a prescription naming the four methods; any other unknown method keeps zod's own message. A declared GET webhook already in a registry is skipped with the existing "declared webhook failed validation — not dispatched" warning.
19
+
- the `sys_webhook``method` select (`@objectstack/plugin-webhooks`, Setup and the data API): FROM five options TO four; an insert or an update with `method: 'get'` FROM stored TO refused 400 `VALIDATION_FAILED`. The `options.get` translation leaves every locale bundle.
20
+
- a `sys_webhook` row already stored with `get`: FROM retried until dead on every event (and, from the outbox's bodyless-GET refusal on, a lost-event log line and no delivery row) TO parked — each event it matches is written to `sys_http_delivery` as a `dead` row with 0 attempts, no signature and a reason that names the method and the fix, said once at `error`; nothing is sent and the row cannot be redelivered.
21
+
22
+
The fix: set the webhook's `method` to the one the endpoint accepts a body on — `POST` (the default), `PUT`, `PATCH` or `DELETE`. The parked row re-arms at the next periodic cache refresh. A receiver that only answers GET cannot take a webhook.
23
+
24
+
No conversion is made, at load, at save or by a migration (ADR-0087 D3, entry `webhook-method-get-retired`): there is no lossless one, because converting GET to another method would start sending a different request to an endpoint its administrator configured for GET. A stored row's method is left exactly as stored.
25
+
26
+
Unchanged: a `POST` / `PUT` / `PATCH` / `DELETE` webhook delivers byte-identically; `HEAD` was never a webhook method on either surface.
Copy file name to clipboardExpand all lines: content/docs/automation/webhooks.mdx
+19-1Lines changed: 19 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -172,7 +172,7 @@ returned in full by `GET /api/v1/data/sys_webhook`.
172
172
|`object_name`| text | Short object name whose record events fire this webhook. |
173
173
|`triggers`| select | Multi-select of `create` / `update` / `delete` plus the opt-in bulk pair `bulk_update` / `bulk_delete` ([see below](#bulk-writes-bulk_update-and-bulk_delete)), stored as an array (the enqueuer also accepts a legacy comma-separated string). |
174
174
|`url`| text | External endpoint that receives the POST. |
175
-
|`method`| select | HTTP method — one of `GET` / `POST` / `PUT` / `PATCH` / `DELETE`. Default `POST`. |
175
+
|`method`| select | HTTP method — one of `POST` / `PUT` / `PATCH` / `DELETE`. Default `POST`. No `GET`: every delivery carries the event as its body ([see below](#stored-get-webhooks-are-parked)).|
|`active`| boolean | Inactive webhooks are skipped by the dispatcher. Default `true`. |
178
178
|`definition_json`| textarea | Serialised `Webhook` JSON (`WebhookSchema` from `@objectstack/spec/automation`) — the per-attempt `timeoutMs` and the rest of the authored envelope. **Not** the signing secret and **not** the custom headers: each has its own encrypted column below. |
@@ -237,6 +237,24 @@ row, or move the values into their encrypted columns yourself. Never type a toke
237
237
ages it out.
238
238
</Callout>
239
239
240
+
### Stored GET webhooks are parked
241
+
242
+
`GET` was removed from the `method` select and from `WebhookSchema.method`:
243
+
every delivery sends the event envelope as its request body and a GET request
244
+
carries none, so no GET webhook ever delivered an event. Saving a webhook with
245
+
`method: 'get'` — an insert or an update — is now refused
246
+
(`VALIDATION_FAILED` / `400`), and a declared webhook with `method: 'GET'`
247
+
fails `WebhookSchema` parse with the fix in the message.
248
+
249
+
A `sys_webhook` row already stored with `get` keeps loading, but it is
250
+
**parked**: nothing is sent, and each record change it matches is written to
251
+
`sys_http_delivery` as a `dead` row with 0 attempts whose `error` names the
252
+
method and the fix. Such a row cannot be redelivered. The stored method is
253
+
never rewritten to another one — sending a POST to an endpoint configured for
254
+
GET would be a different request. To bring the webhook back, edit it and set
255
+
the method to `POST`, `PUT`, `PATCH` or `DELETE`, whichever the endpoint
256
+
accepts a body on; it re-arms at the next periodic cache refresh.
257
+
240
258
### 3.2 `sys_http_delivery`
241
259
242
260
The outbox + audit. One row per delivery. Persisted **before** any HTTP
0 commit comments