From 008773148e8598757ae89ce94e4c3db08b5f4f5a Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 22:28:46 +0000 Subject: [PATCH 1/6] fix(spec,plugin-webhooks)!: retire the GET webhook method and park stored GET subscriptions (WIP) Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01QsR2jUZKdq3PK2Sab53cT3 --- .../plugin-webhooks/src/auto-enqueuer.ts | 123 +++++++++++++++++- .../plugin-webhooks/src/sys-webhook.object.ts | 11 +- packages/spec/src/automation/webhook.test.ts | 31 ++++- packages/spec/src/automation/webhook.zod.ts | 29 ++++- 4 files changed, 183 insertions(+), 11 deletions(-) diff --git a/packages/plugins/plugin-webhooks/src/auto-enqueuer.ts b/packages/plugins/plugin-webhooks/src/auto-enqueuer.ts index 24910c7f431..c16cd97f412 100644 --- a/packages/plugins/plugin-webhooks/src/auto-enqueuer.ts +++ b/packages/plugins/plugin-webhooks/src/auto-enqueuer.ts @@ -121,6 +121,47 @@ const CUSTOM_HEADERS_CREDENTIAL: DropReason = { ratherThan: 'delivered without the headers it was authored with', }; +/** + * The HTTP methods a webhook may no longer deliver with, upper-cased. + * + * `GET` left both authoring surfaces (the spec's `WebhookSchema.method` and the + * `sys_webhook` `method` select — ADR-0049 enforce-or-remove): every delivery + * sends the event envelope as its request body and a GET carries none, so no + * GET webhook ever delivered. A row stored with `get` before the option left + * still loads, and is PARKED here rather than dispatched. + */ +const RETIRED_WEBHOOK_METHODS: ReadonlySet = new Set(['GET']); + +/** + * The ADR-0112 pair a retired-method park carries: the save door's own verdict + * on the same row content (the `method` select refuses `get` with + * `VALIDATION_FAILED`/400), judged later — the pairing + * `webhook-legacy-cleartext.ts` makes for its delivery door. + */ +const RETIRED_METHOD_PARK_CODE = 'VALIDATION_FAILED'; +const RETIRED_METHOD_PARK_STATUS = 400; + +/** + * [#8069 park path] The reason a subscription whose stored method is retired + * is parked with, or `undefined` for a deliverable method. It names the method + * and the fix, and says the method is left as stored: converting it would + * start sending another method to an endpoint the administrator configured + * for GET, so no conversion is made, here or anywhere. + */ +function retiredMethodParkReason(name: string, method: string): string | undefined { + if (!RETIRED_WEBHOOK_METHODS.has(method)) return undefined; + return ( + `[${RETIRED_METHOD_PARK_CODE}/${RETIRED_METHOD_PARK_STATUS}] webhook '${name}' is stored with HTTP method ` + + `${method}, which a webhook can no longer use: every delivery sends the event as its request body and a ` + + `${method} request carries none, so this event was NOT delivered — recorded here rather than sent. ` + + 'This row was never sent and cannot be redelivered. The stored method is left exactly as it is: it is ' + + 'never converted, because sending another method to an endpoint configured for ' + + `${method} would be a different request. Fix: edit the webhook and set its method to POST, PUT, PATCH ` + + 'or DELETE, whichever the endpoint accepts a body on; the subscription re-arms at the next periodic ' + + 'refresh, and later events are delivered normally.' + ); +} + /** * Optional logger interface (subset of console / kernel logger). */ @@ -333,6 +374,13 @@ export class AutoEnqueuer { * is deleted and re-created reports again. */ private readonly organizationRefusalReported = new Set(); + /** + * Webhook ids whose retired-method park has been said out loud + * ({@link reportRetiredMethod}) — the #8022 say-once shape: once per + * parked subscription, again after its method is fixed and it breaks + * again. Pruned on refresh with the two ledgers above. + */ + private readonly retiredMethodReported = new Set(); /** [ADR-0131 D2/D6] The declared-webhook reader, when the host binds one. */ private readonly declared?: DeclaredWebhookReader; /** Self-heal subscription on the activation ledger — bound only with {@link declared}. */ @@ -499,6 +547,16 @@ export class AutoEnqueuer { for (const row of rows) { const sub = this.parseRow(row); if (!sub) continue; + // A row parked for its retired method (see `parseRow`) is never + // sent, so neither credential is resolved for it: a parked row + // carries no secret and no header map (the #8069 park rule), and a + // decrypt for a subscription that cannot deliver buys nothing. + if (sub.parkedReason) { + this.reportRetiredMethod(sub); + add(sub); + continue; + } + this.retiredMethodReported.delete(sub.id); // [#7799, #7986] Neither credential is in the row we just read — // the signing key and the custom header map both live encrypted in // `sys_secret`, and this read path returns only a mask. Dereference @@ -521,7 +579,11 @@ export class AutoEnqueuer { // deactivated. Otherwise the set grows for the life of the process, and // a webhook turned off while broken and later turned back on still // broken would have its first report suppressed as a repeat. - if (this.droppedForSecret.size > 0 || this.organizationRefusalReported.size > 0) { + if ( + this.droppedForSecret.size > 0 + || this.organizationRefusalReported.size > 0 + || this.retiredMethodReported.size > 0 + ) { const live = new Set(rows.map((r) => String(r?.id))); for (const sub of declared.subscriptions) live.add(sub.id); for (const id of this.droppedForSecret) { @@ -531,6 +593,9 @@ export class AutoEnqueuer { for (const id of this.organizationRefusalReported) { if (!live.has(id)) this.organizationRefusalReported.delete(id); } + for (const id of this.retiredMethodReported) { + if (!live.has(id)) this.retiredMethodReported.delete(id); + } } this.logger?.debug?.('[webhook-auto-enqueuer] cache refreshed', { @@ -629,6 +694,13 @@ export class AutoEnqueuer { definition_json: JSON.stringify({ timeoutMs: wh.timeoutMs }), }); if (!sub) return null; + // `WebhookSchema` refuses a retired method, so a declaration parsed by + // `DeclaredWebhookSource` cannot carry one; a reader that hands one in + // anyway is parked by `parseRow` like a row, with no credentials. + if (sub.parkedReason) { + this.reportRetiredMethod(sub); + return sub; + } const { secret } = splitWebhookSecret(wh as Record); const { headers } = splitWebhookHeaders(wh as Record); if (secret) sub.secret = secret; @@ -1047,6 +1119,34 @@ export class AutoEnqueuer { } } + /** + * Report a subscription parked for its retired method, once + * ({@link retiredMethodReported}). `error` by the AGENTS.md question: the + * webhook keeps reading `active: true` in Setup while no matching event + * is delivered. The consequence and the fix are the park reason itself, + * which each dead row carries too. + */ + private reportRetiredMethod(sub: CachedSubscription): void { + if (this.retiredMethodReported.has(sub.id)) return; + this.retiredMethodReported.add(sub.id); + const message = + `[webhook-auto-enqueuer] webhook '${sub.name}' is PARKED: ${sub.parkedReason} Until then every matching ` + + 'record change is recorded in sys_http_delivery as a dead row with 0 attempts carrying this reason, ' + + 'while the row keeps reading active:true in Setup.'; + const meta = { + id: sub.id, + webhook: sub.name, + method: sub.method, + code: RETIRED_METHOD_PARK_CODE, + status: RETIRED_METHOD_PARK_STATUS, + }; + if (typeof this.logger?.error === 'function') { + this.logger?.error(message, undefined, meta); + } else { + this.logger?.warn?.(message, meta); + } + } + private parseRow(row: any): CachedSubscription | null { if (!row?.id || !row?.url) return null; // `triggers` is now authored as a multi-select (stored as an array), but @@ -1127,17 +1227,26 @@ export class AutoEnqueuer { } } + const name = (row.name as string) ?? row.id; + // Method is authored via a select whose option values are lowercased + // (post/put/…); upper-case here so delivery uses a canonical HTTP + // method regardless of whether the row was authored before or after + // the select change (legacy rows stored 'POST'). + const method = String(row.method ?? defn.method ?? 'POST').toUpperCase(); + // A method no webhook can deliver with (`GET`, stored before the select + // and the spec dropped it) PARKS the subscription: it stays cached, and + // each event it matches is written as a terminal `dead` row carrying + // this reason instead of being enqueued (#8069's path). The method + // itself is carried through unchanged — parking never rewrites it. + const parkedReason = retiredMethodParkReason(name, method); return { id: row.id as string, - name: (row.name as string) ?? row.id, + name, objectName: row.object_name ? String(row.object_name) : undefined, triggers, url: String(row.url), - // Method is authored via a select whose option values are lowercased - // (get/post/…); upper-case here so delivery uses a canonical HTTP - // method regardless of whether the row was authored before or after - // the select change (legacy rows stored 'POST'). - method: String(row.method ?? defn.method ?? 'POST').toUpperCase(), + method, + ...(parkedReason ? { parkedReason } : {}), // `headers` and `secret` are both filled by attachCredentials() // from their encrypted columns, NOT read off the row — see #7799 // (secret) and #7986 (headers). diff --git a/packages/plugins/plugin-webhooks/src/sys-webhook.object.ts b/packages/plugins/plugin-webhooks/src/sys-webhook.object.ts index 59e16bfad6e..20ba9f37d05 100644 --- a/packages/plugins/plugin-webhooks/src/sys-webhook.object.ts +++ b/packages/plugins/plugin-webhooks/src/sys-webhook.object.ts @@ -169,14 +169,21 @@ export const SysWebhook = ObjectSchema.create({ }), method: Field.select( - ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'], + ['POST', 'PUT', 'PATCH', 'DELETE'], { label: 'HTTP Method', required: true, // Select instead of free text. Option values are lowercased by the - // Field.select helper (get/post/…); the auto-enqueuer upper-cases the + // Field.select helper (post/put/…); the auto-enqueuer upper-cases the // resolved method before delivery, so existing 'POST' rows and the // lowercase option values both normalise correctly. + // + // No `GET` (ADR-0049 enforce-or-remove, the spec's `WebhookSchema` + // `method` in step): every delivery carries the event as its body, so + // a GET webhook never delivered, and the select refusing it is what + // refuses it at save. A row stored with `get` before the option left + // is PARKED by the auto-enqueuer with the reason on a dead delivery + // row (`retiredMethodParkReason`); its method is never rewritten. defaultValue: 'post', description: 'HTTP method used for the callback request', group: 'Definition', diff --git a/packages/spec/src/automation/webhook.test.ts b/packages/spec/src/automation/webhook.test.ts index d85d3a29665..64a678cec10 100644 --- a/packages/spec/src/automation/webhook.test.ts +++ b/packages/spec/src/automation/webhook.test.ts @@ -97,7 +97,7 @@ describe('WebhookSchema', () => { }); it('should accept different HTTP methods', () => { - const methods: Array = ['POST', 'PUT', 'GET']; + const methods: Array = ['POST', 'PUT', 'PATCH', 'DELETE']; methods.forEach(method => { const webhook = WebhookSchema.parse({ @@ -119,6 +119,35 @@ describe('WebhookSchema', () => { })).toThrow(); }); + // GET is retired by name (ADR-0049 enforce-or-remove; ADR-0087 D3 entry + // `webhook-method-get-retired`): every delivery carries the event as its + // body, so a GET webhook never delivered. A schema refusal carries the issue + // `code` and `path` but no ADR-0112 `status` (that envelope belongs to the + // doors), so the pin is the code, the path and the prescription's first + // sentence; a misspelt method keeps zod's own message, never the retirement. + it("refuses method 'GET' by name with the prescription, and admits exactly the four body-carrying methods", () => { + const base = { name: 'test_webhook', object: 'account', triggers: ['create'], url: 'https://example.com/webhook' }; + + const refused = WebhookSchema.safeParse({ ...base, method: 'GET' }); + expect(refused.success).toBe(false); + const issue = refused.error!.issues[0]!; + expect(issue.code).toBe('invalid_value'); + expect(issue.path).toEqual(['method']); + expect(issue.message).toContain( + "`webhook.method: 'GET'` was removed in @objectstack/spec 18.6.0 (ADR-0049 enforce-or-remove) — every " + + 'delivery sends the event envelope as the request body, and a GET request carries no body, so a GET ' + + 'webhook never delivered a single event.', + ); + expect(issue.message).toContain('`POST` (the default), `PUT`, `PATCH` or `DELETE`'); + + const misspelt = WebhookSchema.safeParse({ ...base, method: 'TRACE' }); + expect(misspelt.success).toBe(false); + expect(misspelt.error!.issues[0]!.message).not.toContain('was removed'); + + expect(WebhookSchema.shape.method.unwrap().options).toEqual(['POST', 'PUT', 'PATCH', 'DELETE']); + expect(WebhookSchema.parse(base).method).toBe('POST'); + }); + it('should accept multiple triggers', () => { const webhook = WebhookSchema.parse({ name: 'multi_trigger_webhook', diff --git a/packages/spec/src/automation/webhook.zod.ts b/packages/spec/src/automation/webhook.zod.ts index 94bf63fa1e3..18c2a4bc714 100644 --- a/packages/spec/src/automation/webhook.zod.ts +++ b/packages/spec/src/automation/webhook.zod.ts @@ -5,6 +5,7 @@ import { SnakeCaseIdentifierSchema } from '../shared/identifiers.zod'; import { MetadataProtectionFields } from '../kernel/metadata-protection.zod'; import { ProtectionSchema } from '../shared/protection.zod'; import { strictObject } from '../shared/strict-object'; +import { enumWithRetiredValues } from '../shared/retired-key'; /** * Webhook Trigger Event @@ -51,6 +52,19 @@ export const WebhookTriggerType = z.enum([ export type WebhookTriggerType = z.input; +/** + * The parse refusal an author meets for `method: 'GET'` (ADR-0049 + * enforce-or-remove; `enumWithRetiredValues`, `../shared/retired-key.ts`). + * There is no `os migrate meta` sentence: no ADR-0087 D2 conversion exists, + * because the replacement method is the receiver's to choose — the D3 + * semantic entry `webhook-method-get-retired` carries that judgement. + */ +const WEBHOOK_METHOD_GET_RETIRED = + "`webhook.method: 'GET'` was removed in @objectstack/spec 18.6.0 (ADR-0049 enforce-or-remove) — every " + + 'delivery sends the event envelope as the request body, and a GET request carries no body, so a GET ' + + 'webhook never delivered a single event. Set `method` to the one your endpoint accepts a body on: ' + + '`POST` (the default), `PUT`, `PATCH` or `DELETE`. A receiver that only answers GET cannot take a webhook.'; + /** * CANONICAL WEBHOOK DEFINITION * @@ -193,7 +207,20 @@ export const WebhookSchema = lazySchema(() => strictObject({ /** Target */ url: z.string().url().describe('External webhook endpoint URL'), - method: z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE']).default('POST').describe('HTTP method'), + /** + * The delivery's HTTP method. Every delivery sends the event envelope as + * the request body, so the vocabulary is the four methods that carry one. + * `GET` was retired (ADR-0049 enforce-or-remove, ADR-0087 D3): no GET + * webhook ever delivered — the outbox sent the envelope as its body and the + * HTTP client refuses a GET with a body, so the row retried until dead — + * and no lossless conversion exists, because sending another method to an + * endpoint configured for GET is a different request, not a spelling of + * the same one. A stored GET subscription is parked by the dispatcher with + * the reason on a dead delivery row; its method is never rewritten. + */ + method: enumWithRetiredValues(['POST', 'PUT', 'PATCH', 'DELETE'], { GET: WEBHOOK_METHOD_GET_RETIRED }) + .default('POST') + .describe('HTTP method'), /** * Headers. A credential MAP as a whole (`.meta({ credential: 'map' })`): From 98768f7c303285814b8e10d2b111e75abe448b72 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 22:41:24 +0000 Subject: [PATCH 2/6] test(plugin-webhooks): pin the GET method retirement and the stored-row park (WIP) Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01QsR2jUZKdq3PK2Sab53cT3 --- .../34098-webhook-method-get-retired.md | 26 ++ content/docs/automation/webhooks.mdx | 20 +- .../src/webhook-get-retired-34098.test.ts | 321 ++++++++++++++++++ .../semantic/18.webhook-method-get-retired.ts | 33 ++ 4 files changed, 399 insertions(+), 1 deletion(-) create mode 100644 .changeset/34098-webhook-method-get-retired.md create mode 100644 packages/plugins/plugin-webhooks/src/webhook-get-retired-34098.test.ts create mode 100644 packages/spec/src/migrations/entries/semantic/18.webhook-method-get-retired.ts diff --git a/.changeset/34098-webhook-method-get-retired.md b/.changeset/34098-webhook-method-get-retired.md new file mode 100644 index 00000000000..5b289108041 --- /dev/null +++ b/.changeset/34098-webhook-method-get-retired.md @@ -0,0 +1,26 @@ +--- +'@objectstack/spec': minor +'@objectstack/plugin-webhooks': minor +--- + +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 + +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** 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. + +What moves (each line FROM → TO): + +- `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. +- 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. +- 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. + +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. + +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. + +Unchanged: a `POST` / `PUT` / `PATCH` / `DELETE` webhook delivers byte-identically; `HEAD` was never a webhook method on either surface. diff --git a/content/docs/automation/webhooks.mdx b/content/docs/automation/webhooks.mdx index b94bd58b5c3..59d7fe1ee05 100644 --- a/content/docs/automation/webhooks.mdx +++ b/content/docs/automation/webhooks.mdx @@ -172,7 +172,7 @@ returned in full by `GET /api/v1/data/sys_webhook`. | `object_name` | text | Short object name whose record events fire this webhook. | | `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). | | `url` | text | External endpoint that receives the POST. | -| `method` | select | HTTP method — one of `GET` / `POST` / `PUT` / `PATCH` / `DELETE`. Default `POST`. | +| `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)). | | `description` | textarea | Free-text description. | | `active` | boolean | Inactive webhooks are skipped by the dispatcher. Default `true`. | | `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 ages it out. +### Stored GET webhooks are parked + +`GET` was removed from the `method` select and from `WebhookSchema.method`: +every delivery sends the event envelope as its request body and a GET request +carries none, so no GET webhook ever delivered an event. Saving a webhook with +`method: 'get'` — an insert or an update — is now refused +(`VALIDATION_FAILED` / `400`), and a declared webhook with `method: 'GET'` +fails `WebhookSchema` parse with the fix in the message. + +A `sys_webhook` row already stored with `get` keeps loading, but it is +**parked**: nothing is sent, and each record change it matches is written to +`sys_http_delivery` as a `dead` row with 0 attempts whose `error` names the +method and the fix. Such a row cannot be redelivered. The stored method is +never rewritten to another one — sending a POST to an endpoint configured for +GET would be a different request. To bring the webhook back, edit it and set +the method to `POST`, `PUT`, `PATCH` or `DELETE`, whichever the endpoint +accepts a body on; it re-arms at the next periodic cache refresh. + ### 3.2 `sys_http_delivery` The outbox + audit. One row per delivery. Persisted **before** any HTTP diff --git a/packages/plugins/plugin-webhooks/src/webhook-get-retired-34098.test.ts b/packages/plugins/plugin-webhooks/src/webhook-get-retired-34098.test.ts new file mode 100644 index 00000000000..d548c0d139e --- /dev/null +++ b/packages/plugins/plugin-webhooks/src/webhook-get-retired-34098.test.ts @@ -0,0 +1,321 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * The webhook method `GET` is retired (ADR-0049 enforce-or-remove; ADR-0087 D3 + * entry `webhook-method-get-retired`), and a subscription already stored with + * it is PARKED, never converted. + * + * Every webhook delivery sends the event envelope as its request body, and a + * GET request carries none, so no GET webhook ever delivered: the outbox sent + * the body, the HTTP client refused a GET with a body, and the row retried + * until dead. The spec's `WebhookSchema.method` and the `sys_webhook` `method` + * select both drop `GET`; a row a customer database already holds with `get` + * keeps loading and goes through the #8069 park path, which writes each + * matched event as a terminal `dead` row with the reason instead of enqueueing + * it. + * + * The whole chain on a REAL `SqlDriver` under a REAL `ObjectQL`, because the + * two halves under test live in two different places: the save door is the + * engine's record validator judging the select's options, and the park is the + * `AutoEnqueuer` reading the row the driver hands back. Pinned: + * + * 1. the save door — an insert and an update with `method: 'get'` are refused + * with the validator's own code, and nothing is stored; + * 2. the park — a stored `get` row writes exactly one `dead` delivery row per + * matched event, with 0 attempts, no signature and a reason that names the + * method and the fix; nothing reaches `fetch`; the row cannot be + * redelivered; the park is said once at `error`; + * 3. no conversion — the stored method reads `get` after the park, in the + * database and through the engine; + * 4. CONTROL — a `post` row on the same composition delivers a POST with the + * envelope as its body. + */ + +import { describe, expect, it } from 'vitest'; +import { ObjectQL } from '@objectstack/objectql'; +import { SqlDriver } from '@objectstack/driver-sql'; +import type { IRealtimeService, RealtimeEventHandler, RealtimeEventPayload } from '@objectstack/spec/contracts'; +import { + HttpDelivery, + HttpDispatcher, + MessagingService, + SqlHttpOutbox, + type EnqueueHttpInput, + type FetchImpl, +} from '@objectstack/service-messaging'; +import { AutoEnqueuer } from './auto-enqueuer.js'; +import type { DeclaredWebhook, DeclaredWebhookReader } from './declared-webhooks.js'; +import { DeclaredWebhookSource } from './declared-webhooks.js'; +import { createWebhookRedeliverGuard } from './redeliver-guard.js'; +import { SysWebhook } from './sys-webhook.object.js'; +import { installDefaultOrganization } from './default-organization.testkit.js'; + +const SYSTEM = { context: { isSystem: true } }; + +class FakeRealtime implements IRealtimeService { + private subs = new Map(); + private n = 0; + async publish(event: RealtimeEventPayload): Promise { + for (const sub of this.subs.values()) { + if (sub.opts?.object && event.object !== sub.opts.object) continue; + await sub.handler(event); + } + } + async subscribe(_channel: string, handler: any, opts?: any): Promise { + const id = `s-${++this.n}`; + this.subs.set(id, { handler, opts }); + return id; + } + async unsubscribe(id: string): Promise { this.subs.delete(id); } +} + +async function waitFor(check: () => Promise, ms = 3000): Promise { + const end = Date.now() + ms; + while (Date.now() < end) { + if (await check()) return; + await new Promise((r) => setTimeout(r, 25)); + } +} + +function makeFetch() { + const calls: Array<{ url: string; method: string; body: string }> = []; + const impl: FetchImpl = async (url, init) => { + calls.push({ url, method: init.method, body: init.body }); + return { ok: true, status: 200, async text() { return 'ok'; } }; + }; + return { impl, calls }; +} + +/** A `sys_webhook` row as Setup saves it, on `probe_task` creates. */ +function webhookRow(name: string, method: string) { + return { + name, + object_name: 'probe_task', + triggers: ['create'], + url: `https://receiver.invalid/${name}`, + method, + active: true, + definition_json: '{}', + }; +} + +async function boot(opts: { declared?: DeclaredWebhookReader } = {}) { + const driver = new SqlDriver({ client: 'better-sqlite3', connection: { filename: ':memory:' }, useNullAsDefault: true }); + const engine = new ObjectQL(); + engine.registerDriver(driver, true); + await engine.init(); + engine.registry.registerObject({ name: 'probe_task', label: 'Probe Task', fields: { title: { type: 'text', label: 'Title' } } } as any, 'test'); + engine.registry.registerObject(HttpDelivery as any, 'test'); + engine.registry.registerObject(SysWebhook as any, 'test'); + await engine.syncSchemas(); + await installDefaultOrganization(engine); + + const realtime = new FakeRealtime(); + engine.setRealtimeService(realtime); + const errors: Array<{ message: string; meta: any }> = []; + const warns: string[] = []; + const logger = { + info() {}, debug() {}, + warn: (m: string) => { warns.push(m); }, + error: (m: string, _err?: unknown, meta?: unknown) => { errors.push({ message: m, meta }); }, + }; + const outbox = new SqlHttpOutbox(engine as any, { partitionCount: 1 }); + const messaging = new MessagingService({ logger: { info() {}, warn() {}, error() {}, debug() {} } as any }); + messaging.setHttpOutbox(outbox); + messaging.registerRedeliverGuard('webhook', createWebhookRedeliverGuard(engine as any)); + const enqueuer = new AutoEnqueuer(engine as any, realtime, (input: EnqueueHttpInput) => messaging.enqueueHttp(input), { + refreshIntervalMs: 0, + logger, + ...(opts.declared ? { declaredWebhooks: opts.declared } : {}), + }); + const deliveries = async () => (await engine.find('sys_http_delivery', {}, SYSTEM)) as any[]; + const tick = async () => { + const { impl, calls } = makeFetch(); + await new HttpDispatcher({ nodeId: 'n1', outbox, fetchImpl: impl, partitionCount: 1 }).tick(); + return calls; + }; + return { driver, engine, enqueuer, messaging, deliveries, tick, errors, warns }; +} + +/** + * A row a customer database holds with `get`: saved through the select before + * the option left. Written as data at rest — inserted as `post`, then the + * stored value set through the driver, below the save door this release adds. + */ +async function storeGetRow(engine: any, driver: SqlDriver, name: string): Promise { + const row: any = await engine.insert('sys_webhook', webhookRow(name, 'post'), SYSTEM); + await driver.update('sys_webhook', row.id, { method: 'get' }); + return String(row.id); +} + +describe('webhook method GET retired — the save door (sys_webhook select)', () => { + it('refuses an insert with method get, with the validator\'s code, and stores nothing', async () => { + const { driver, engine } = await boot(); + try { + const refused = await engine.insert('sys_webhook', webhookRow('get_hook', 'get'), SYSTEM).then( + () => undefined, + (err: any) => err, + ); + expect(refused).toBeDefined(); + expect(refused).toMatchObject({ code: 'VALIDATION_FAILED' }); + const fieldErrors = JSON.stringify(refused.details ?? refused.fieldErrors ?? refused); + expect(fieldErrors).toContain('method'); + expect(fieldErrors).toContain('invalid_option'); + expect(await engine.find('sys_webhook', { where: { name: 'get_hook' } }, SYSTEM)).toEqual([]); + + // CONTROL: the four body-carrying methods save. + for (const method of ['post', 'put', 'patch', 'delete']) { + await expect(engine.insert('sys_webhook', webhookRow(`hook_${method}`, method), SYSTEM)).resolves.toBeTruthy(); + } + } finally { + await driver.disconnect(); + } + }); + + it('refuses an update to method get, and the stored method is unchanged', async () => { + const { driver, engine } = await boot(); + try { + const row: any = await engine.insert('sys_webhook', webhookRow('post_hook', 'post'), SYSTEM); + const refused = await engine.update('sys_webhook', { method: 'get' }, { where: { id: row.id }, ...SYSTEM }).then( + () => undefined, + (err: any) => err, + ); + expect(refused).toMatchObject({ code: 'VALIDATION_FAILED' }); + const stored: any = await driver.findOne('sys_webhook', { where: { id: row.id } } as any); + expect(stored.method).toBe('post'); + } finally { + await driver.disconnect(); + } + }); + + it('offers exactly the four body-carrying methods', () => { + const options = (SysWebhook.fields.method as { options?: Array<{ value: string }> }).options ?? []; + expect(options.map((o) => o.value)).toEqual(['post', 'put', 'patch', 'delete']); + }); +}); + +describe('webhook method GET retired — a stored GET row is parked, never converted', () => { + it('writes one dead row per event with the reason, sends nothing, refuses redelivery, and leaves the method as stored', async () => { + const { driver, engine, enqueuer, messaging, deliveries, tick, errors } = await boot(); + try { + const id = await storeGetRow(engine, driver, 'legacy_get_hook'); + await enqueuer.start(); + + await engine.insert('probe_task', { title: 'first' }); + await waitFor(async () => (await deliveries()).length >= 1); + const rows = await deliveries(); + expect(rows).toHaveLength(1); + const row = rows[0]; + expect(row.ref_id).toBe(id); + expect(row.status).toBe('dead'); + expect(Number(row.attempts)).toBe(0); + expect(row.signature ?? undefined).toBeUndefined(); + expect(row.method).toBe('GET'); + // The reason names the method and the fix. + expect(row.error).toContain('[VALIDATION_FAILED/400]'); + expect(row.error).toContain("webhook 'legacy_get_hook' is stored with HTTP method GET"); + expect(row.error).toContain('set its method to POST, PUT, PATCH or DELETE'); + expect(JSON.parse(row.payload_json)).toMatchObject({ object: 'probe_task', action: 'created' }); + + // Nothing on the wire, and the dead row is not a resend button. + expect(await tick()).toEqual([]); + await expect(messaging.redeliverHttp(row.id, { tenantId: undefined })).rejects.toMatchObject({ + code: 'DELIVERY_NEVER_SENT', + }); + + // A second event: a second dead row, and the park is said ONCE. + await engine.insert('probe_task', { title: 'second' }); + await waitFor(async () => (await deliveries()).length >= 2); + expect((await deliveries()).map((r) => r.status)).toEqual(['dead', 'dead']); + const parkedReports = errors.filter((e) => e.message.includes("webhook 'legacy_get_hook' is PARKED")); + expect(parkedReports).toHaveLength(1); + expect(parkedReports[0].meta).toMatchObject({ code: 'VALIDATION_FAILED', status: 400, method: 'GET' }); + + // No conversion: the method reads exactly as stored. + const raw: any = await driver.findOne('sys_webhook', { where: { id } } as any); + expect(raw.method).toBe('get'); + const served: any = await engine.findOne('sys_webhook', { where: { id }, ...SYSTEM } as any); + expect(served.method).toBe('get'); + } finally { + await enqueuer.stop(); + await driver.disconnect(); + } + }); + + it('CONTROL: a POST row on the same composition delivers a POST carrying the envelope', async () => { + const { driver, engine, enqueuer, deliveries, tick, errors } = await boot(); + try { + const row: any = await engine.insert('sys_webhook', webhookRow('post_hook', 'post'), SYSTEM); + await enqueuer.start(); + await engine.insert('probe_task', { title: 'control' }); + await waitFor(async () => (await deliveries()).length >= 1); + const [delivery] = await deliveries(); + expect(delivery.ref_id).toBe(String(row.id)); + expect(delivery.status).toBe('pending'); + expect(delivery.method).toBe('POST'); + expect(delivery.error ?? undefined).toBeUndefined(); + + const calls = await tick(); + expect(calls).toHaveLength(1); + expect(calls[0].method).toBe('POST'); + expect(calls[0].url).toBe('https://receiver.invalid/post_hook'); + expect(JSON.parse(calls[0].body)).toMatchObject({ object: 'probe_task', action: 'created' }); + expect(errors).toEqual([]); + } finally { + await enqueuer.stop(); + await driver.disconnect(); + } + }); +}); + +describe('webhook method GET retired — a declared GET webhook', () => { + it('is refused at parse by the declared-webhook reader, so it never reaches the dispatcher', async () => { + const reader = { list: (type: string) => (type === 'webhook' ? [{ ...webhookRow('declared_get', 'GET'), object: 'probe_task' }] : []) }; + const { driver, engine, enqueuer, deliveries } = await boot(); + const source = new DeclaredWebhookSource(engine, reader); + try { + expect(await source.list()).toEqual([]); + await enqueuer.start(); + await engine.insert('probe_task', { title: 'declared' }); + await new Promise((r) => setTimeout(r, 50)); + expect(await deliveries()).toEqual([]); + } finally { + await enqueuer.stop(); + await driver.disconnect(); + } + }); + + it('handed in by a reader that skips the schema anyway, it is parked like a row, with no credentials', async () => { + const declared: DeclaredWebhook = { + webhook: { + name: 'declared_get', + object: 'probe_task', + triggers: ['create'], + url: 'https://receiver.invalid/declared_get', + method: 'GET' as never, + secret: 'whsec_declared', + isActive: true, + timeoutMs: 30000, + } as DeclaredWebhook['webhook'], + active: true, + } as DeclaredWebhook; + const reader: DeclaredWebhookReader = { + list: async () => [declared], + } as unknown as DeclaredWebhookReader; + const { driver, engine, enqueuer, deliveries, tick } = await boot({ declared: reader }); + try { + await enqueuer.start(); + await engine.insert('probe_task', { title: 'declared' }); + await waitFor(async () => (await deliveries()).length >= 1); + const [row] = await deliveries(); + expect(row.status).toBe('dead'); + expect(row.error).toContain("webhook 'declared_get' is stored with HTTP method GET"); + expect(row.signature ?? undefined).toBeUndefined(); + expect(JSON.stringify(row)).not.toContain('whsec_declared'); + expect(await tick()).toEqual([]); + } finally { + await enqueuer.stop(); + await driver.disconnect(); + } + }); +}); diff --git a/packages/spec/src/migrations/entries/semantic/18.webhook-method-get-retired.ts b/packages/spec/src/migrations/entries/semantic/18.webhook-method-get-retired.ts new file mode 100644 index 00000000000..416d427d88b --- /dev/null +++ b/packages/spec/src/migrations/entries/semantic/18.webhook-method-get-retired.ts @@ -0,0 +1,33 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import type { SemanticMigration } from '../../types.js'; + +// The upgrade-guide entry of the webhook method `GET`, retired from both +// authoring surfaces (ADR-0049 enforce-or-remove): `WebhookSchema.method` and +// the `sys_webhook` `method` select. No D2 conversion: no lossless rewrite +// exists, because sending another method to an endpoint configured for GET is +// a different request, and which method the receiver takes a body on is the +// owner's to say. +export const entry: SemanticMigration = { + id: 'webhook-method-get-retired', + surface: + 'automation.Webhook.method (a declared webhook, `defineStack({ webhooks })`) and the `sys_webhook` `method` ' + + 'field (a webhook saved in Setup or through the data API): the value `GET`', + replacement: + 'Set `method` to the one the endpoint accepts a body on: `POST` (the default), `PUT`, `PATCH` or `DELETE`. A ' + + 'receiver that only answers GET cannot take a webhook', + reason: + '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 now refused where it is written: a declared webhook fails ' + + '`WebhookSchema` parse with the prescription, and a `sys_webhook` insert or update with `method: \'get\'` is ' + + 'refused 400 `VALIDATION_FAILED` by the select. A row already stored with `get` keeps loading and is parked: ' + + 'each event it matches is written to `sys_http_delivery` as a dead row with 0 attempts whose reason names the ' + + 'method and the fix, and nothing is sent. The stored method is never converted, at load, at save or by a ' + + 'migration, because a conversion would start sending another method to an endpoint configured for GET. There ' + + 'is no mechanical rewrite: only the owner knows which method the receiver accepts', + acceptanceCriteria: + 'os validate reports no webhook whose `method` is `GET`; GET /api/v1/data/sys_webhook lists no row whose `method` ' + + 'is `get`; after a record change the webhook subscribes to, its sys_http_delivery row has status ' + + 'success or a receiver answer, never a dead row with 0 attempts naming the GET method.', +}; From 4ff9df50a931908ea087c19e03da1daeef116f40 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 23:22:39 +0000 Subject: [PATCH 3/6] chore(spec,plugin-webhooks): regenerate the webhook reference doc and the sys_webhook translation bundles Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01QsR2jUZKdq3PK2Sab53cT3 --- content/docs/references/automation/webhook.mdx | 2 +- .../plugin-webhooks/src/translations/ar.objects.generated.ts | 1 - .../src/translations/ar.source-hashes.generated.ts | 1 - .../plugin-webhooks/src/translations/de.objects.generated.ts | 1 - .../src/translations/de.source-hashes.generated.ts | 1 - .../plugin-webhooks/src/translations/en.objects.generated.ts | 1 - .../plugin-webhooks/src/translations/es-ES.objects.generated.ts | 1 - .../src/translations/es-ES.source-hashes.generated.ts | 1 - .../plugin-webhooks/src/translations/fr.objects.generated.ts | 1 - .../src/translations/fr.source-hashes.generated.ts | 1 - .../plugin-webhooks/src/translations/ja-JP.objects.generated.ts | 1 - .../src/translations/ja-JP.source-hashes.generated.ts | 1 - .../plugin-webhooks/src/translations/ko.objects.generated.ts | 1 - .../src/translations/ko.source-hashes.generated.ts | 1 - .../plugin-webhooks/src/translations/pt-BR.objects.generated.ts | 1 - .../src/translations/pt-BR.source-hashes.generated.ts | 1 - .../plugin-webhooks/src/translations/ru.objects.generated.ts | 1 - .../src/translations/ru.source-hashes.generated.ts | 1 - .../plugin-webhooks/src/translations/zh-CN.objects.generated.ts | 1 - .../src/translations/zh-CN.source-hashes.generated.ts | 1 - .../src/translations/zh-Hant.objects.generated.ts | 1 - .../src/translations/zh-Hant.source-hashes.generated.ts | 1 - 22 files changed, 1 insertion(+), 22 deletions(-) diff --git a/content/docs/references/automation/webhook.mdx b/content/docs/references/automation/webhook.mdx index fc95e269132..809877b49b1 100644 --- a/content/docs/references/automation/webhook.mdx +++ b/content/docs/references/automation/webhook.mdx @@ -33,7 +33,7 @@ const result = WebhookSchema.parse(data); | **object** | `string` | optional | Object whose record events (create/update/delete, bulk_update/bulk_delete) trigger this webhook | | **triggers** | `Enum<'create' \| 'update' \| 'delete' \| 'bulk_update' \| 'bulk_delete'>[]` | optional | Events that trigger execution | | **url** | `string` | ✅ | External webhook endpoint URL | -| **method** | `Enum<'GET' \| 'POST' \| 'PUT' \| 'PATCH' \| 'DELETE'>` | optional (default: `"POST"`) | HTTP method | +| **method** | `Enum<'POST' \| 'PUT' \| 'PATCH' \| 'DELETE'>` | optional (default: `"POST"`) | HTTP method | | **headers** | `Record` | optional | Custom HTTP headers | | **timeoutMs** | `integer` | optional (default: `30000`) | Request timeout in milliseconds | | **secret** | `string` | optional | Signing secret for HMAC signature verification | diff --git a/packages/plugins/plugin-webhooks/src/translations/ar.objects.generated.ts b/packages/plugins/plugin-webhooks/src/translations/ar.objects.generated.ts index 323678517fe..8af082f4310 100644 --- a/packages/plugins/plugin-webhooks/src/translations/ar.objects.generated.ts +++ b/packages/plugins/plugin-webhooks/src/translations/ar.objects.generated.ts @@ -53,7 +53,6 @@ export const arObjects: NonNullable = { label: "أسلوب HTTP", help: "أسلوب HTTP المستخدم في طلب الاستدعاء", options: { - get: "GET", post: "POST", put: "PUT", patch: "PATCH", diff --git a/packages/plugins/plugin-webhooks/src/translations/ar.source-hashes.generated.ts b/packages/plugins/plugin-webhooks/src/translations/ar.source-hashes.generated.ts index 18f5e8200f0..88c10e6e9e6 100644 --- a/packages/plugins/plugin-webhooks/src/translations/ar.source-hashes.generated.ts +++ b/packages/plugins/plugin-webhooks/src/translations/ar.source-hashes.generated.ts @@ -19,7 +19,6 @@ export const arGeneratedSourceHashes: Readonly> = { "objects.sys_webhook.fields.method.options.delete": "f59e059ed51f9bfc", - "objects.sys_webhook.fields.method.options.get": "470848255971c548", "objects.sys_webhook.fields.method.options.patch": "7de3603749decb30", "objects.sys_webhook.fields.method.options.post": "004b24eab36d26a4", "objects.sys_webhook.fields.method.options.put": "04d929ecae7aa435", diff --git a/packages/plugins/plugin-webhooks/src/translations/de.objects.generated.ts b/packages/plugins/plugin-webhooks/src/translations/de.objects.generated.ts index 12100e69d44..0997ee7beb5 100644 --- a/packages/plugins/plugin-webhooks/src/translations/de.objects.generated.ts +++ b/packages/plugins/plugin-webhooks/src/translations/de.objects.generated.ts @@ -53,7 +53,6 @@ export const deObjects: NonNullable = { label: "HTTP-Methode", help: "HTTP-Methode für die Callback-Anfrage", options: { - get: "GET", post: "POST", put: "PUT", patch: "PATCH", diff --git a/packages/plugins/plugin-webhooks/src/translations/de.source-hashes.generated.ts b/packages/plugins/plugin-webhooks/src/translations/de.source-hashes.generated.ts index ae7cf503c7e..cb21a498b0d 100644 --- a/packages/plugins/plugin-webhooks/src/translations/de.source-hashes.generated.ts +++ b/packages/plugins/plugin-webhooks/src/translations/de.source-hashes.generated.ts @@ -20,7 +20,6 @@ export const deGeneratedSourceHashes: Readonly> = { "objects.sys_webhook.fields.definition_json.label": "efa6ad859212b898", "objects.sys_webhook.fields.method.options.delete": "f59e059ed51f9bfc", - "objects.sys_webhook.fields.method.options.get": "470848255971c548", "objects.sys_webhook.fields.method.options.patch": "7de3603749decb30", "objects.sys_webhook.fields.method.options.post": "004b24eab36d26a4", "objects.sys_webhook.fields.method.options.put": "04d929ecae7aa435", diff --git a/packages/plugins/plugin-webhooks/src/translations/en.objects.generated.ts b/packages/plugins/plugin-webhooks/src/translations/en.objects.generated.ts index 0b087e2f621..7fd1211f9ff 100644 --- a/packages/plugins/plugin-webhooks/src/translations/en.objects.generated.ts +++ b/packages/plugins/plugin-webhooks/src/translations/en.objects.generated.ts @@ -53,7 +53,6 @@ export const enObjects: NonNullable = { label: "HTTP Method", help: "HTTP method used for the callback request", options: { - get: "GET", post: "POST", put: "PUT", patch: "PATCH", diff --git a/packages/plugins/plugin-webhooks/src/translations/es-ES.objects.generated.ts b/packages/plugins/plugin-webhooks/src/translations/es-ES.objects.generated.ts index 0c4a103a508..96290189f08 100644 --- a/packages/plugins/plugin-webhooks/src/translations/es-ES.objects.generated.ts +++ b/packages/plugins/plugin-webhooks/src/translations/es-ES.objects.generated.ts @@ -53,7 +53,6 @@ export const esESObjects: NonNullable = { label: "Método HTTP", help: "Método HTTP utilizado en la solicitud de callback.", options: { - get: "GET", post: "POST", put: "PUT", patch: "PATCH", diff --git a/packages/plugins/plugin-webhooks/src/translations/es-ES.source-hashes.generated.ts b/packages/plugins/plugin-webhooks/src/translations/es-ES.source-hashes.generated.ts index 2a448973f3b..93f9daf796d 100644 --- a/packages/plugins/plugin-webhooks/src/translations/es-ES.source-hashes.generated.ts +++ b/packages/plugins/plugin-webhooks/src/translations/es-ES.source-hashes.generated.ts @@ -19,7 +19,6 @@ export const esESGeneratedSourceHashes: Readonly> = { "objects.sys_webhook.fields.method.options.delete": "f59e059ed51f9bfc", - "objects.sys_webhook.fields.method.options.get": "470848255971c548", "objects.sys_webhook.fields.method.options.patch": "7de3603749decb30", "objects.sys_webhook.fields.method.options.post": "004b24eab36d26a4", "objects.sys_webhook.fields.method.options.put": "04d929ecae7aa435", diff --git a/packages/plugins/plugin-webhooks/src/translations/fr.objects.generated.ts b/packages/plugins/plugin-webhooks/src/translations/fr.objects.generated.ts index 6202538b5a2..3f9e8b69d78 100644 --- a/packages/plugins/plugin-webhooks/src/translations/fr.objects.generated.ts +++ b/packages/plugins/plugin-webhooks/src/translations/fr.objects.generated.ts @@ -53,7 +53,6 @@ export const frObjects: NonNullable = { label: "Méthode HTTP", help: "Méthode HTTP utilisée pour la requête de rappel", options: { - get: "GET", post: "POST", put: "PUT", patch: "PATCH", diff --git a/packages/plugins/plugin-webhooks/src/translations/fr.source-hashes.generated.ts b/packages/plugins/plugin-webhooks/src/translations/fr.source-hashes.generated.ts index 76cfd3ad307..9ba0f97d016 100644 --- a/packages/plugins/plugin-webhooks/src/translations/fr.source-hashes.generated.ts +++ b/packages/plugins/plugin-webhooks/src/translations/fr.source-hashes.generated.ts @@ -21,7 +21,6 @@ export const frGeneratedSourceHashes: Readonly> = { "objects.sys_webhook.fields.description.label": "779a4342c8eb6707", "objects.sys_webhook.fields.managed_by.options.package": "1c8c6168730324a3", "objects.sys_webhook.fields.method.options.delete": "f59e059ed51f9bfc", - "objects.sys_webhook.fields.method.options.get": "470848255971c548", "objects.sys_webhook.fields.method.options.patch": "7de3603749decb30", "objects.sys_webhook.fields.method.options.post": "004b24eab36d26a4", "objects.sys_webhook.fields.method.options.put": "04d929ecae7aa435", diff --git a/packages/plugins/plugin-webhooks/src/translations/ja-JP.objects.generated.ts b/packages/plugins/plugin-webhooks/src/translations/ja-JP.objects.generated.ts index 4b5966f35b1..e8687a94310 100644 --- a/packages/plugins/plugin-webhooks/src/translations/ja-JP.objects.generated.ts +++ b/packages/plugins/plugin-webhooks/src/translations/ja-JP.objects.generated.ts @@ -53,7 +53,6 @@ export const jaJPObjects: NonNullable = { label: "HTTP メソッド", help: "コールバックリクエストで使用する HTTP メソッド", options: { - get: "GET", post: "POST", put: "PUT", patch: "PATCH", diff --git a/packages/plugins/plugin-webhooks/src/translations/ja-JP.source-hashes.generated.ts b/packages/plugins/plugin-webhooks/src/translations/ja-JP.source-hashes.generated.ts index fa8d719c0ff..ed157d9b0ec 100644 --- a/packages/plugins/plugin-webhooks/src/translations/ja-JP.source-hashes.generated.ts +++ b/packages/plugins/plugin-webhooks/src/translations/ja-JP.source-hashes.generated.ts @@ -20,7 +20,6 @@ export const jaJPGeneratedSourceHashes: Readonly> = { "objects.sys_webhook.fields.id.label": "9a4c8ec2a2567b95", "objects.sys_webhook.fields.method.options.delete": "f59e059ed51f9bfc", - "objects.sys_webhook.fields.method.options.get": "470848255971c548", "objects.sys_webhook.fields.method.options.patch": "7de3603749decb30", "objects.sys_webhook.fields.method.options.post": "004b24eab36d26a4", "objects.sys_webhook.fields.method.options.put": "04d929ecae7aa435", diff --git a/packages/plugins/plugin-webhooks/src/translations/ko.objects.generated.ts b/packages/plugins/plugin-webhooks/src/translations/ko.objects.generated.ts index 731794adb42..c9d3362d08a 100644 --- a/packages/plugins/plugin-webhooks/src/translations/ko.objects.generated.ts +++ b/packages/plugins/plugin-webhooks/src/translations/ko.objects.generated.ts @@ -53,7 +53,6 @@ export const koObjects: NonNullable = { label: "HTTP 메서드", help: "콜백 요청에 사용하는 HTTP 메서드", options: { - get: "GET", post: "POST", put: "PUT", patch: "PATCH", diff --git a/packages/plugins/plugin-webhooks/src/translations/ko.source-hashes.generated.ts b/packages/plugins/plugin-webhooks/src/translations/ko.source-hashes.generated.ts index 26cb2777c36..131e1c1688e 100644 --- a/packages/plugins/plugin-webhooks/src/translations/ko.source-hashes.generated.ts +++ b/packages/plugins/plugin-webhooks/src/translations/ko.source-hashes.generated.ts @@ -19,7 +19,6 @@ export const koGeneratedSourceHashes: Readonly> = { "objects.sys_webhook.fields.method.options.delete": "f59e059ed51f9bfc", - "objects.sys_webhook.fields.method.options.get": "470848255971c548", "objects.sys_webhook.fields.method.options.patch": "7de3603749decb30", "objects.sys_webhook.fields.method.options.post": "004b24eab36d26a4", "objects.sys_webhook.fields.method.options.put": "04d929ecae7aa435", diff --git a/packages/plugins/plugin-webhooks/src/translations/pt-BR.objects.generated.ts b/packages/plugins/plugin-webhooks/src/translations/pt-BR.objects.generated.ts index 99188430bef..6a5f31e9953 100644 --- a/packages/plugins/plugin-webhooks/src/translations/pt-BR.objects.generated.ts +++ b/packages/plugins/plugin-webhooks/src/translations/pt-BR.objects.generated.ts @@ -53,7 +53,6 @@ export const ptBRObjects: NonNullable = { label: "Método HTTP", help: "Método HTTP usado na requisição de callback", options: { - get: "GET", post: "POST", put: "PUT", patch: "PATCH", diff --git a/packages/plugins/plugin-webhooks/src/translations/pt-BR.source-hashes.generated.ts b/packages/plugins/plugin-webhooks/src/translations/pt-BR.source-hashes.generated.ts index acccb27ceb8..5b495048423 100644 --- a/packages/plugins/plugin-webhooks/src/translations/pt-BR.source-hashes.generated.ts +++ b/packages/plugins/plugin-webhooks/src/translations/pt-BR.source-hashes.generated.ts @@ -19,7 +19,6 @@ export const ptBRGeneratedSourceHashes: Readonly> = { "objects.sys_webhook.fields.method.options.delete": "f59e059ed51f9bfc", - "objects.sys_webhook.fields.method.options.get": "470848255971c548", "objects.sys_webhook.fields.method.options.patch": "7de3603749decb30", "objects.sys_webhook.fields.method.options.post": "004b24eab36d26a4", "objects.sys_webhook.fields.method.options.put": "04d929ecae7aa435", diff --git a/packages/plugins/plugin-webhooks/src/translations/ru.objects.generated.ts b/packages/plugins/plugin-webhooks/src/translations/ru.objects.generated.ts index 4af68bd609e..e30f56aae64 100644 --- a/packages/plugins/plugin-webhooks/src/translations/ru.objects.generated.ts +++ b/packages/plugins/plugin-webhooks/src/translations/ru.objects.generated.ts @@ -53,7 +53,6 @@ export const ruObjects: NonNullable = { label: "Метод HTTP", help: "Метод HTTP для запроса обратного вызова", options: { - get: "GET", post: "POST", put: "PUT", patch: "PATCH", diff --git a/packages/plugins/plugin-webhooks/src/translations/ru.source-hashes.generated.ts b/packages/plugins/plugin-webhooks/src/translations/ru.source-hashes.generated.ts index 0f0fc7ee04a..9bd0e49028d 100644 --- a/packages/plugins/plugin-webhooks/src/translations/ru.source-hashes.generated.ts +++ b/packages/plugins/plugin-webhooks/src/translations/ru.source-hashes.generated.ts @@ -19,7 +19,6 @@ export const ruGeneratedSourceHashes: Readonly> = { "objects.sys_webhook.fields.method.options.delete": "f59e059ed51f9bfc", - "objects.sys_webhook.fields.method.options.get": "470848255971c548", "objects.sys_webhook.fields.method.options.patch": "7de3603749decb30", "objects.sys_webhook.fields.method.options.post": "004b24eab36d26a4", "objects.sys_webhook.fields.method.options.put": "04d929ecae7aa435", diff --git a/packages/plugins/plugin-webhooks/src/translations/zh-CN.objects.generated.ts b/packages/plugins/plugin-webhooks/src/translations/zh-CN.objects.generated.ts index ca94f5913b1..e6505cb46d1 100644 --- a/packages/plugins/plugin-webhooks/src/translations/zh-CN.objects.generated.ts +++ b/packages/plugins/plugin-webhooks/src/translations/zh-CN.objects.generated.ts @@ -53,7 +53,6 @@ export const zhCNObjects: NonNullable = { label: "HTTP 方法", help: "回调请求使用的 HTTP 方法", options: { - get: "GET", post: "POST", put: "PUT", patch: "PATCH", diff --git a/packages/plugins/plugin-webhooks/src/translations/zh-CN.source-hashes.generated.ts b/packages/plugins/plugin-webhooks/src/translations/zh-CN.source-hashes.generated.ts index 29e216e235a..15aa8724ecf 100644 --- a/packages/plugins/plugin-webhooks/src/translations/zh-CN.source-hashes.generated.ts +++ b/packages/plugins/plugin-webhooks/src/translations/zh-CN.source-hashes.generated.ts @@ -20,7 +20,6 @@ export const zhCNGeneratedSourceHashes: Readonly> = { "objects.sys_webhook.fields.id.label": "9a4c8ec2a2567b95", "objects.sys_webhook.fields.method.options.delete": "f59e059ed51f9bfc", - "objects.sys_webhook.fields.method.options.get": "470848255971c548", "objects.sys_webhook.fields.method.options.patch": "7de3603749decb30", "objects.sys_webhook.fields.method.options.post": "004b24eab36d26a4", "objects.sys_webhook.fields.method.options.put": "04d929ecae7aa435", diff --git a/packages/plugins/plugin-webhooks/src/translations/zh-Hant.objects.generated.ts b/packages/plugins/plugin-webhooks/src/translations/zh-Hant.objects.generated.ts index cd2613a8064..1be9220fd02 100644 --- a/packages/plugins/plugin-webhooks/src/translations/zh-Hant.objects.generated.ts +++ b/packages/plugins/plugin-webhooks/src/translations/zh-Hant.objects.generated.ts @@ -53,7 +53,6 @@ export const zhHantObjects: NonNullable = { label: "HTTP 方法", help: "回呼請求使用的 HTTP 方法", options: { - get: "GET", post: "POST", put: "PUT", patch: "PATCH", diff --git a/packages/plugins/plugin-webhooks/src/translations/zh-Hant.source-hashes.generated.ts b/packages/plugins/plugin-webhooks/src/translations/zh-Hant.source-hashes.generated.ts index 2aa6cf6019c..a88f01cf2d8 100644 --- a/packages/plugins/plugin-webhooks/src/translations/zh-Hant.source-hashes.generated.ts +++ b/packages/plugins/plugin-webhooks/src/translations/zh-Hant.source-hashes.generated.ts @@ -20,7 +20,6 @@ export const zhHantGeneratedSourceHashes: Readonly> = { "objects.sys_webhook.fields.id.label": "9a4c8ec2a2567b95", "objects.sys_webhook.fields.method.options.delete": "f59e059ed51f9bfc", - "objects.sys_webhook.fields.method.options.get": "470848255971c548", "objects.sys_webhook.fields.method.options.patch": "7de3603749decb30", "objects.sys_webhook.fields.method.options.post": "004b24eab36d26a4", "objects.sys_webhook.fields.method.options.put": "04d929ecae7aa435", From 69f9d19c0c093b9c4205076fd951766ec2ee32eb Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 23:49:06 +0000 Subject: [PATCH 4/6] test(plugin-webhooks): type the captured fetch body as optional, as the sender now declares it Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01QsR2jUZKdq3PK2Sab53cT3 --- .../plugin-webhooks/src/webhook-get-retired-34098.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/plugins/plugin-webhooks/src/webhook-get-retired-34098.test.ts b/packages/plugins/plugin-webhooks/src/webhook-get-retired-34098.test.ts index d548c0d139e..df95dc8d973 100644 --- a/packages/plugins/plugin-webhooks/src/webhook-get-retired-34098.test.ts +++ b/packages/plugins/plugin-webhooks/src/webhook-get-retired-34098.test.ts @@ -78,7 +78,7 @@ async function waitFor(check: () => Promise, ms = 3000): Promise } function makeFetch() { - const calls: Array<{ url: string; method: string; body: string }> = []; + const calls: Array<{ url: string; method: string; body: string | undefined }> = []; const impl: FetchImpl = async (url, init) => { calls.push({ url, method: init.method, body: init.body }); return { ok: true, status: 200, async text() { return 'ok'; } }; @@ -259,7 +259,7 @@ describe('webhook method GET retired — a stored GET row is parked, never conve expect(calls).toHaveLength(1); expect(calls[0].method).toBe('POST'); expect(calls[0].url).toBe('https://receiver.invalid/post_hook'); - expect(JSON.parse(calls[0].body)).toMatchObject({ object: 'probe_task', action: 'created' }); + expect(JSON.parse(calls[0].body ?? '')).toMatchObject({ object: 'probe_task', action: 'created' }); expect(errors).toEqual([]); } finally { await enqueuer.stop(); From cf97ed4dba900fbab194e50dec5ac9f36defbd05 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 16 Nov 2026 00:46:49 +0000 Subject: [PATCH 5/6] fix(plugin-webhooks): park a retired-method subscription under the standard-catalog VALIDATION_ERROR pair Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01QsR2jUZKdq3PK2Sab53cT3 --- packages/plugins/plugin-webhooks/src/auto-enqueuer.ts | 11 ++++++----- .../src/webhook-get-retired-34098.test.ts | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/plugins/plugin-webhooks/src/auto-enqueuer.ts b/packages/plugins/plugin-webhooks/src/auto-enqueuer.ts index c16cd97f412..c607b328c00 100644 --- a/packages/plugins/plugin-webhooks/src/auto-enqueuer.ts +++ b/packages/plugins/plugin-webhooks/src/auto-enqueuer.ts @@ -133,12 +133,13 @@ const CUSTOM_HEADERS_CREDENTIAL: DropReason = { const RETIRED_WEBHOOK_METHODS: ReadonlySet = new Set(['GET']); /** - * The ADR-0112 pair a retired-method park carries: the save door's own verdict - * on the same row content (the `method` select refuses `get` with - * `VALIDATION_FAILED`/400), judged later — the pairing - * `webhook-legacy-cleartext.ts` makes for its delivery door. + * The ADR-0112 pair a retired-method park carries: the standard-catalog + * member for "this row content is not acceptable", judged at delivery — the + * pair `webhook-legacy-cleartext.ts` carries on its own delivery door. (The + * save door refusing the same value is the engine's record validator, which + * answers with its own code.) A standard-catalog code needs no ledger row. */ -const RETIRED_METHOD_PARK_CODE = 'VALIDATION_FAILED'; +const RETIRED_METHOD_PARK_CODE = 'VALIDATION_ERROR'; const RETIRED_METHOD_PARK_STATUS = 400; /** diff --git a/packages/plugins/plugin-webhooks/src/webhook-get-retired-34098.test.ts b/packages/plugins/plugin-webhooks/src/webhook-get-retired-34098.test.ts index df95dc8d973..867cd89220f 100644 --- a/packages/plugins/plugin-webhooks/src/webhook-get-retired-34098.test.ts +++ b/packages/plugins/plugin-webhooks/src/webhook-get-retired-34098.test.ts @@ -212,7 +212,7 @@ describe('webhook method GET retired — a stored GET row is parked, never conve expect(row.signature ?? undefined).toBeUndefined(); expect(row.method).toBe('GET'); // The reason names the method and the fix. - expect(row.error).toContain('[VALIDATION_FAILED/400]'); + expect(row.error).toContain('[VALIDATION_ERROR/400]'); expect(row.error).toContain("webhook 'legacy_get_hook' is stored with HTTP method GET"); expect(row.error).toContain('set its method to POST, PUT, PATCH or DELETE'); expect(JSON.parse(row.payload_json)).toMatchObject({ object: 'probe_task', action: 'created' }); @@ -229,7 +229,7 @@ describe('webhook method GET retired — a stored GET row is parked, never conve expect((await deliveries()).map((r) => r.status)).toEqual(['dead', 'dead']); const parkedReports = errors.filter((e) => e.message.includes("webhook 'legacy_get_hook' is PARKED")); expect(parkedReports).toHaveLength(1); - expect(parkedReports[0].meta).toMatchObject({ code: 'VALIDATION_FAILED', status: 400, method: 'GET' }); + expect(parkedReports[0].meta).toMatchObject({ code: 'VALIDATION_ERROR', status: 400, method: 'GET' }); // No conversion: the method reads exactly as stored. const raw: any = await driver.findOne('sys_webhook', { where: { id } } as any); From b61479cef2fd9c792411795db9f3a9e83a542565 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 16 Nov 2026 01:14:39 +0000 Subject: [PATCH 6/6] test(plugin-webhooks): read the stored webhook row with typed query options Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01QsR2jUZKdq3PK2Sab53cT3 --- .../plugin-webhooks/src/webhook-get-retired-34098.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/plugins/plugin-webhooks/src/webhook-get-retired-34098.test.ts b/packages/plugins/plugin-webhooks/src/webhook-get-retired-34098.test.ts index 867cd89220f..d7423255af4 100644 --- a/packages/plugins/plugin-webhooks/src/webhook-get-retired-34098.test.ts +++ b/packages/plugins/plugin-webhooks/src/webhook-get-retired-34098.test.ts @@ -181,7 +181,7 @@ describe('webhook method GET retired — the save door (sys_webhook select)', () (err: any) => err, ); expect(refused).toMatchObject({ code: 'VALIDATION_FAILED' }); - const stored: any = await driver.findOne('sys_webhook', { where: { id: row.id } } as any); + const stored: any = await driver.findOne('sys_webhook', { where: { id: row.id } }); expect(stored.method).toBe('post'); } finally { await driver.disconnect(); @@ -232,9 +232,9 @@ describe('webhook method GET retired — a stored GET row is parked, never conve expect(parkedReports[0].meta).toMatchObject({ code: 'VALIDATION_ERROR', status: 400, method: 'GET' }); // No conversion: the method reads exactly as stored. - const raw: any = await driver.findOne('sys_webhook', { where: { id } } as any); + const raw: any = await driver.findOne('sys_webhook', { where: { id } }); expect(raw.method).toBe('get'); - const served: any = await engine.findOne('sys_webhook', { where: { id }, ...SYSTEM } as any); + const served: any = await engine.findOne('sys_webhook', { where: { id }, ...SYSTEM }); expect(served.method).toBe('get'); } finally { await enqueuer.stop();