diff --git a/.changeset/33016-webhook-exact-qualifier-door.md b/.changeset/33016-webhook-exact-qualifier-door.md new file mode 100644 index 00000000000..7232c051730 --- /dev/null +++ b/.changeset/33016-webhook-exact-qualifier-door.md @@ -0,0 +1,20 @@ +--- +'@objectstack/runtime': patch +'@objectstack/plugin-security': patch +'@objectstack/spec': patch +--- + +fix(runtime,plugin-security): the declared-webhook activation door switches one of two holders the namespace address cannot tell apart, and the upgrade report names every withheld holder + +Clause-②: yes (widening) +Metadata-protocol: none + +Two holders of one declared webhook name that the namespace address cannot tell apart, two packages co-owning one namespace or a package that declares no namespace beside another holder, are both dispatched, but neither could be switched: `POST /api/v1/security/_activation/webhook/NAME` and `.../webhook/NS/NAME` both answered `409` naming both. The bare address now takes `?package=PKG`, the exact qualifier `/meta` reads, and switches exactly PKG's declaration, writing PKG's own activation row and no other. + +- FROM `400 VALIDATION_ERROR` (unknown query parameter) TO `200` writing PKG's row, `data.packageId` = PKG, for `POST /security/_activation/webhook/NAME?package=PKG` when PKG declares NAME and is enabled. +- A PKG that does not serve NAME (a disabled package included) answers `409 RESOURCE_CONFLICT` naming the holders that do, or `404` when no enabled package declares it. Nothing is written. +- `package` is the only query parameter of the bare webhook address; the namespace address takes none, and an empty or repeated `package` is `400`, as on the permission-set door. + +The upgrade-impact report's withheld-webhook finding now reports each holder of the name, a disabled second holder included: FROM one finding (the holder the bare artifact lookup answered) TO one finding per holder. Its log lines name each finding's switch, `POST /api/v1/security/_activation/webhook/NAME?package=PKG`, where they named the namespace address. A withheld-webhook finding whose package is disabled is marked `packageDisabled: true` (an added optional field), and the line says to enable that package first: its address answers `409` until then. + +The `webhook` liveness ledger's `name` evidence (`@objectstack/spec`, text only) names one slot per served `(package, name)` holder and its `declared:PKG/NAME` reference. diff --git a/content/docs/automation/webhooks.mdx b/content/docs/automation/webhooks.mdx index 4b51f52e23b..19cc23dbf21 100644 --- a/content/docs/automation/webhooks.mdx +++ b/content/docs/automation/webhooks.mdx @@ -93,7 +93,11 @@ A webhook reaches the dispatcher one of two ways: `POST /api/v1/security/_activation/webhook/:name` and body `{ "enabled": true | false }`, or, when packages of two namespaces each declare the name, `POST /api/v1/security/_activation/webhook/:ns/:name` - (the bare address then answers `409` naming both). It writes that holder's + (the bare address then answers `409` naming both). Two holders a namespace + cannot tell apart (two packages sharing one namespace, or a package that + declares no namespace beside another holder) are each switched by the exact + qualifier, `POST /api/v1/security/_activation/webhook/:name?package=`. + It writes that holder's own `sys_metadata_activation` row of type `webhook` and overrides the declared `isActive` in either direction (ADR-0131 D6, regime C — the door, its authority tiers and its refusals are diff --git a/docs/qa/platform-checklist/areas/cli.json b/docs/qa/platform-checklist/areas/cli.json index 772ef60ae40..73a1c885fd6 100644 --- a/docs/qa/platform-checklist/areas/cli.json +++ b/docs/qa/platform-checklist/areas/cli.json @@ -2080,7 +2080,7 @@ "title": "`os migrate organization-ownership` upgrades a database 17.x or an 18.0 pre-release (18.0.0-next.*) created (18.x): a bare run writes the reviewed plan and changes nothing; `--apply --plan-file PLAN --backup-taken` runs every step — attribution through the moves, the declared webhook and sharing-rule settlements, the column drops and NOT NULL — and certifies the marker at this release's ownership shape generation; the served boot refuses an uncertified database, naming the command, and boots a certified one; `os migrate apply --allow-destructive` still withholds every organization_id drop the ceremony owns, and `os migrate comment-reactions --apply` stays pinned", "since": "v18", "status": "active", - "revision": 9, + "revision": 10, "priority": "P0", "surface": "cli", "personas": [ @@ -2145,7 +2145,7 @@ { "clause": "an 18.0 pre-release database (one an 18.0.0-next.* release created and served) takes the same path as a v17 one and keeps its data: the served boot refuses it, the reviewed apply completes, and the next boot serves it with its identity mail, its global setting audit, its pending mail jobs and its declared webhook carried over", "oracle": "build", - "verify": "steps[5], each leg read at its own layer. Boot output: the first `os serve` exits 1 before any listening line, opening \"This database carries no organization-ownership marker\" and naming the tables still carrying organization_id (sys_flow_credential and sys_secret on 18.0.0-next.5); a database an 18.0.0-next.3 ceremony already certified at shape generation 0 is refused instead with \"… certified by an organization-ownership ceremony of shape generation 0, and this release requires generation 1 …\". The apply exits 0 with complete true and blocking 0, and the second boot reaches its serving line. Row reads, before the plan and after the second boot: every identity mail row (related_object sys_user, which is the reset and verification mail, and any magic-link mail) is in sys_identity_email under its original id, equal over the columns both tables hold, and gone from sys_email, while organization invitations stay in sys_email (packages/cli/src/utils/organization-ownership-apply.ts#SIBLING_MOVES); every sys_setting_audit row with scope 'global' is in sys_platform_setting_audit and gone from sys_setting_audit; every pending or running email.send.async or email.attachment.reclaim job naming a moved mail carries object sys_identity_email in its payload and metadata, while completed jobs and the organization-invitation job are unchanged; and no row disappears outside the apply report: each pre-existing table's count after equals its count before, less what the report's steps say they moved or deleted. On the cli-18-prerelease-db restore, sys_automation_run in the telemetry sibling keeps its count across the second boot but not two of its ids: the recipe's knownGaps[3] says why, and those two ids are not data the apply lost. The door's answer: each pre-release user signs in with its 18.0 password (200; a wrong one 401); the token read from the moved reset mail resets (200); and the one showcase_task PATCH writes exactly one sys_http_delivery row whose ref_id is declared:showcase_task_changed", + "verify": "steps[5], each leg read at its own layer. Boot output: the first `os serve` exits 1 before any listening line, opening \"This database carries no organization-ownership marker\" and naming the tables still carrying organization_id (sys_flow_credential and sys_secret on 18.0.0-next.5); a database an 18.0.0-next.3 ceremony already certified at shape generation 0 is refused instead with \"… certified by an organization-ownership ceremony of shape generation 0, and this release requires generation 1 …\". The apply exits 0 with complete true and blocking 0, and the second boot reaches its serving line. Row reads, before the plan and after the second boot: every identity mail row (related_object sys_user, which is the reset and verification mail, and any magic-link mail) is in sys_identity_email under its original id, equal over the columns both tables hold, and gone from sys_email, while organization invitations stay in sys_email (packages/cli/src/utils/organization-ownership-apply.ts#SIBLING_MOVES); every sys_setting_audit row with scope 'global' is in sys_platform_setting_audit and gone from sys_setting_audit; every pending or running email.send.async or email.attachment.reclaim job naming a moved mail carries object sys_identity_email in its payload and metadata, while completed jobs and the organization-invitation job are unchanged; and no row disappears outside the apply report: each pre-existing table's count after equals its count before, less what the report's steps say they moved or deleted. On the cli-18-prerelease-db restore, sys_automation_run in the telemetry sibling keeps its count across the second boot but not two of its ids: the recipe's knownGaps[3] says why, and those two ids are not data the apply lost. The door's answer: each pre-release user signs in with its 18.0 password (200; a wrong one 401); the token read from the moved reset mail resets (200); and the one showcase_task PATCH writes exactly one sys_http_delivery row whose ref_id is declared:com.example.showcase/showcase_task_changed (the declaring package's id, then the name: packages/qa/dogfood/test/upgrade-18x-harness.dogfood.test.ts pins it)", "evidence": "the refused boot's excerpt and exit code, the apply report's complete and blocking, the serving line; the before and after reads of sys_email, sys_identity_email, sys_setting_audit, sys_platform_setting_audit and the mail jobs, with per-table counts; the sign-in, reset and delivery answers" } ], @@ -2222,6 +2222,12 @@ "date": "2026-11-08", "change": "steps[1], steps[3] and steps[4]: `os migrate apply` and `os migrate comment-reactions` take no `--dev` flag; only `os migrate organization-ownership` and `os serve` of the ceremony's commands do. Checklist-accuracy finding of QA run #31486 (owed:weekly, at 0647dabb). Read at base 4894cfe1", "ref": "#31499" + }, + { + "revision": 10, + "date": "2026-11-14", + "change": "acceptance[5].verify's delivery reference follows the per-holder slot a declared webhook is dispatched under since its ref_id names the declaring package: ref_id declared:com.example.showcase/showcase_task_changed, as packages/qa/dogfood/test/upgrade-18x-harness.dogfood.test.ts pins. The bare declared:showcase_task_changed failed a correct product. No clause weakened; read from source at base 4c152685", + "ref": "#33016" } ] }, diff --git a/docs/qa/platform-checklist/areas/integration-system.json b/docs/qa/platform-checklist/areas/integration-system.json index 752dcfaa3ef..bf13e408489 100644 --- a/docs/qa/platform-checklist/areas/integration-system.json +++ b/docs/qa/platform-checklist/areas/integration-system.json @@ -588,7 +588,7 @@ "title": "Outbound webhooks are read from the registry (spec object→object_name, no sys_webhook row) and switched through the activation ledger, fire per trigger variant through the sys_http_delivery outbox with HMAC + timeout honored, redeliver terminal rows tenant-scoped via POST /api/v1/webhooks/redeliver, and reject retired trigger kinds", "since": "v15", "status": "active", - "revision": 14, + "revision": 15, "priority": "P1", "surface": "mixed", "fixtures": { @@ -615,7 +615,7 @@ ], "steps": [ "boot the showcase on a fresh database; verify the declared webhook is NOT materialized (ADR-0131 D2 retired the boot seeder): read sys_webhook over /api/v1/data and find NO showcase_task_changed row — the dispatcher reads the declaration from the registry", - "switch the shipped declared showcase_task_changed on as the admin: POST /api/v1/security/_activation/webhook/showcase_task_changed with { enabled: true } — 200 { type: 'webhook', name, enabled: true }, and one sys_metadata_activation row of metadata_type 'webhook' whose `active` column is true (the door's body and answer spell it `enabled`, the row's column is `active`); an undeclared name answers 404. A declared webhook is read-only: pointing it at the receiver means a copy under a new name (the scratch webhook below). This switch is the subject of acceptance[6] ONLY: switched on, the declaration delivers under `single` (one sys_http_delivery row with ref_id declared:showcase_task_changed, stamped with the Default Organization, per task change), but only to its placeholder url (fixtures.requires[0]). Author the in-organization scratch webhook beside it for the delivery legs", + "switch the shipped declared showcase_task_changed on as the admin: POST /api/v1/security/_activation/webhook/showcase_task_changed with { enabled: true } — 200 { type: 'webhook', name, enabled: true }, and one sys_metadata_activation row of metadata_type 'webhook' whose `active` column is true (the door's body and answer spell it `enabled`, the row's column is `active`); an undeclared name answers 404. A declared webhook is read-only: pointing it at the receiver means a copy under a new name (the scratch webhook below). This switch is the subject of acceptance[6] ONLY: switched on, the declaration delivers under `single` (one sys_http_delivery row with ref_id declared:com.example.showcase/showcase_task_changed — the declaring package's id, then the name, packages/plugins/plugin-webhooks/src/declared-webhooks.ts#declaredWebhookRefId — stamped with the Default Organization, per task change), but only to its placeholder url (fixtures.requires[0]). Author the in-organization scratch webhook beside it for the delivery legs", "with the in-organization scratch webhook (fixtures.requires[0]) active and pointed at the receiver, create, update, then delete a showcase_task; capture the three deliveries at the receiver (headers incl. the HMAC signature when the row's `signing_secret` is set, body incl. recordId). The create needs showcase_task's required `project` lookup — pass an existing showcase_project id, or the create answers 400 VALIDATION_FAILED 'Project is required' and no create event fires", "run a predicate multi-update and multi-delete (multi:true) matching several rows — through a FLOW node, not REST: author update_record / delete_record nodes with multi:true and fire them via the api trigger (the REST batch routes strip options.multi, #3897 — see the knownGap); capture the bulk deliveries and their { object, matched } shape", "read sys_http_delivery over /api/v1/data (a `$filter` is a JSON filter object): one row per delivery with status/attempts/response_code", @@ -770,6 +770,12 @@ "date": "2026-11-10", "change": "fixtures.requires[0], steps[2] and steps[6] name the keys a runner met. Checklist-accuracy findings of QA run #32135 (at ff04ad81; card #32168): the scratch webhook's on/off column is `active`, not `is_active`; its secret goes in `signing_secret` and its custom headers in `headers_secret`, not in definition_json; redeliver's body key is `deliveryId`. Re-read at base 8523ef9a: packages/plugins/plugin-webhooks/src/sys-webhook.object.ts (active, signing_secret, headers_secret; definition_json carries no credentials), packages/plugins/plugin-webhooks/src/webhook-outbox-plugin.ts (the redeliver route reads body.deliveryId, else 400 MISSING_REQUIRED_FIELD). No clause changed", "ref": "#32168" + }, + { + "revision": 15, + "date": "2026-11-14", + "change": "steps[1]'s delivery reference follows the per-holder slot a declared webhook is dispatched under since its ref_id names the declaring package: ref_id declared:com.example.showcase/showcase_task_changed, as packages/qa/dogfood/test/upgrade-18x-harness.dogfood.test.ts pins (packages/plugins/plugin-webhooks/src/declared-webhooks.ts#declaredWebhookRefId). The bare declared:showcase_task_changed failed a correct product. No clause weakened; read from source at base 4c152685", + "ref": "#33016" } ], "enumSource": { diff --git a/packages/plugins/plugin-security/src/upgrade-impact-report.test.ts b/packages/plugins/plugin-security/src/upgrade-impact-report.test.ts index 9c21929da7e..7a498d05b49 100644 --- a/packages/plugins/plugin-security/src/upgrade-impact-report.test.ts +++ b/packages/plugins/plugin-security/src/upgrade-impact-report.test.ts @@ -155,6 +155,10 @@ function fakeRegistry(r: { }, getPackage: (id) => packages[id], isPackageDisabled: disabled, + packageScopedHoldersOf(type, name, _caller, options) { + const ids = items.filter((i) => i.type === type && i.name === name && !i.tenant && i.packageId).map((i) => i.packageId!); + return [...new Set(ids)].filter((id) => options?.includeDisabledPackages === true || !disabled(id)); + }, getAllApps: () => Object.keys(r.apps ?? {}).map((name) => ({ name })), getAppNavDiagnostics: (app) => r.apps?.[app] ?? [], }; @@ -398,7 +402,7 @@ describe('webhook: a sys_webhook row holding a declared name', () => { // [#31699] A webhook is addressed by (package, name): two packages of two // namespaces may each declare one name, and a row holding it withholds both. - it('[FROM one TO each] two packages declaring the name: one finding per withheld holder, and the remedy names the namespace address', async () => { + it('[FROM one TO each] two packages declaring the name: one finding per withheld holder, and the remedy names the exact-qualifier address', async () => { const d = deployment({ webhooks: [{ id: 'wh_1', name: 'acme_deal_won', organization_id: 'org_tenant' }], registry: { items: [ @@ -411,8 +415,37 @@ describe('webhook: a sys_webhook row holding a declared name', () => { { name: 'acme_deal_won', packageId: OTHER_VENDOR, rowId: 'wh_1', organizationId: 'org_tenant' }, { name: 'acme_deal_won', packageId: VENDOR, rowId: 'wh_1', organizationId: 'org_tenant' }, ]); - expect(errorLines(r).some((m) => m.includes('POST /api/v1/security/_activation/webhook// with'))).toBe(true); - }); + // [#33016 nit 2] The exact qualifier serves every enabled holder, whatever + // its namespace; every finding names a package, so no bare-address arm. + const line = errorLines(r).find((m) => m.includes('sys_webhook row(s) hold the name of a webhook')) ?? ''; + expect(line).toContain('POST /api/v1/security/_activation/webhook/?package='); + expect(line).not.toContain('names no package'); + expect(line).not.toContain(''); + }); + + // [#33016 nit 3] The bare artifact lookup answers one holder; a disabled + // SECOND holder used to get no finding. Each holder is reported, in both + // registration orders, disabled or not. + for (const order of [[VENDOR, OTHER_VENDOR], [OTHER_VENDOR, VENDOR]]) { + it(`[FROM one TO each] registered ${order.join(', ')}, ${order[1]} disabled: each holder's withheld declaration is a finding`, async () => { + const d = deployment({ + webhooks: [{ id: 'wh_1', name: 'acme_deal_won', organization_id: 'org_tenant' }], + registry: { + items: order.map((packageId) => ({ type: 'webhook', name: 'acme_deal_won', packageId })), + packages: { [order[1]]: { source: 'code', disabled: true } }, + }, + }); + const r = await boot(d, 'walled'); + expect(r.report.withheldWebhooks.map((w) => w.packageId).sort()).toEqual([OTHER_VENDOR, VENDOR].sort()); + // [#33016 S2] The disabled holder's address answers 409 until it is + // enabled again: its finding says so, and the line says to enable first. + expect(r.report.withheldWebhooks.map((w) => [w.packageId, w.packageDisabled ?? false]).sort()) + .toEqual([[order[0], false], [order[1], true]].sort()); + const line = errorLines(r).find((m) => m.includes('sys_webhook row(s) hold the name of a webhook')) ?? ''; + expect(line).toContain('A finding marked packageDisabled names a disabled package'); + expect(line).toContain('enable the package first, then switch it there'); + }); + } it('[FROM no finding TO orphan] a webhook switch naming a package that no longer ships the name is an orphan, whichever other package does; its rename is a suspected re-enablement', async () => { const d = deployment({ diff --git a/packages/plugins/plugin-security/src/upgrade-impact-report.ts b/packages/plugins/plugin-security/src/upgrade-impact-report.ts index 4bc567071ba..f4120029dbc 100644 --- a/packages/plugins/plugin-security/src/upgrade-impact-report.ts +++ b/packages/plugins/plugin-security/src/upgrade-impact-report.ts @@ -197,6 +197,12 @@ export interface UpgradeImpactRegistry { getPackagedObjectOwner(name: string): { packageId?: string } | undefined; getPackage(id: string): { source?: string } | undefined; isPackageDisabled(id?: string): boolean; + /** + * Every package holding `(type, name)`; with `includeDisabledPackages`, a + * disabled package's included (`SchemaRegistry.packageScopedHoldersOf`). + */ + packageScopedHoldersOf?(type: string, name: string, callerPackageId?: string | null, + options?: { includeDisabledPackages?: boolean }): string[]; getAllApps?(): unknown[]; getAppNavDiagnostics?(app: string): readonly NavDiagnosticLike[]; } @@ -273,6 +279,11 @@ export interface WithheldDeclaredWebhook { packageId: string; rowId: string; organizationId: string | null; + /** + * [#33016] Set when that package is disabled: it holds nothing for the + * activation door until it is enabled again, so its address answers `409`. + */ + packageDisabled?: true; } /** An overlay row bound to a package that no longer ships the item. */ @@ -462,7 +473,11 @@ function shipsAt(registry: UpgradeImpactRegistry, type: string, name: string, pa /** * [#31699] Every package that declares webhook `name`: the one the bare * artifact lookup answers (a disabled package's included, as before), then - * each other package the served listing holds it under, in listing order. + * each other package the served listing holds it under, in listing order, + * then [#33016] each other holder the registry counts with the disabled + * packages included, so a disabled SECOND holder is reported too, not only + * the one the bare lookup happens to answer. Each is confirmed against its + * own code artifact ({@link shipsAt}). */ function webhookShippers(registry: UpgradeImpactRegistry, name: string): string[] { const out = new Set(); @@ -472,6 +487,11 @@ function webhookShippers(registry: UpgradeImpactRegistry, name: string): string[ if (!isRecord(item) || !isCodeArtifactBody(item) || nameOf(item.name) !== name) continue; out.add(String(item._packageId)); } + if (typeof registry.packageScopedHoldersOf === 'function') { + for (const packageId of registry.packageScopedHoldersOf('webhook', name, null, { includeDisabledPackages: true })) { + if (shipsAt(registry, 'webhook', name, packageId)) out.add(packageId); + } + } return [...out]; } @@ -654,7 +674,10 @@ export async function collectUpgradeImpactFindings( const name = nameOf(row.name); if (name === undefined) continue; for (const packageId of webhookShippers(registry, name)) { - report.withheldWebhooks.push({ name, packageId, rowId: String(row.id), organizationId: organizationOf(row) }); + report.withheldWebhooks.push({ + name, packageId, rowId: String(row.id), organizationId: organizationOf(row), + ...(registry.isPackageDisabled(packageId) ? { packageDisabled: true as const } : {}), + }); } } @@ -788,9 +811,21 @@ function logError(logger: UpgradeReportLogger | undefined, message: string, meta else logger?.warn(message, meta); } +/** + * [#33016] The webhook switch a finding names: the exact qualifier, which + * addresses the finding's package whatever its namespace — the namespace + * address answers 409 for two co-owners of one namespace, and a package that + * declares no namespace has none. Every webhook finding names a package (a + * re-enablement's row records one, and a withheld webhook's holder is a + * package), so no finding takes the bare address. A disabled package holds + * nothing for the door until it is enabled again (a withheld webhook's + * `packageDisabled`). + */ +const WEBHOOK_SWITCH_DOOR = 'POST /api/v1/security/_activation/webhook/?package='; + const SWITCH_DOORS = 'POST /api/v1/automation//toggle, POST /api/v1/actions/_activation// or ' + - 'POST /api/v1/security/_activation/webhook//, with { "enabled": false }'; + `${WEBHOOK_SWITCH_DOOR}, with { "enabled": false }`; /** The finding set as stable data: what the digest, the notification and the log carry. */ export function upgradeImpactSummary(report: UpgradeImpactReport): Record { @@ -829,8 +864,9 @@ const CATEGORY_LINES: Record string> = { `[security] upgrade impact: ${n} sys_webhook row(s) hold the name of a webhook a package declares, so the row ` + 'answers and the declared webhook is withheld for the whole deployment. Nothing was changed. Fix: rename or ' + 'delete the row to let the declaration answer; to keep the row as well, rename it, and switch the declared ' + - 'one off if it must not fire (POST /api/v1/security/_activation/webhook// with { "enabled": false }, ' + - 'the namespace of the package the finding names).', + `one off if it must not fire (${WEBHOOK_SWITCH_DOOR}, with { "enabled": false }; the package is the one the ` + + 'finding names). A finding marked packageDisabled names a disabled package: it does not fire now, and that ' + + 'address answers 409 until the package is enabled again, so enable the package first, then switch it there.', overlayOrphans: (n) => `[security] upgrade impact: ${n} customization(s) of a view, dashboard, report, translation or email template ` + 'are bound to a package that no longer ships the item, so each is served as an item of its own beside ' + diff --git a/packages/plugins/plugin-webhooks/src/declared-webhooks.test.ts b/packages/plugins/plugin-webhooks/src/declared-webhooks.test.ts index 96b955a645f..01db23a7020 100644 --- a/packages/plugins/plugin-webhooks/src/declared-webhooks.test.ts +++ b/packages/plugins/plugin-webhooks/src/declared-webhooks.test.ts @@ -680,6 +680,69 @@ describe('declared webhooks — one declaration per (package, name) slot (ADR-01 await enqueuer.stop(); }); + // [#33016 S1] Two co-owners of one namespace (a state install refuses and + // the cold boot seals with a warning): both are served and both dispatched, + // in either registration order. The activation door's `?package=` switches + // each (`catalog-activation-door.test.ts`). + for (const order of [[A, B], [B, A]] as const) { + it(`two co-owners of one namespace, registered ${order.map((p) => p.split('.').pop()).join(', ')}: both dispatched under their own ids, the bare read refused naming both`, async () => { + const registry = new SchemaRegistry(); + registry.logLevel = 'silent'; + for (const id of order) { + // One artifact delivers both, so they co-own the namespace (ADR-0130 D1). + registry.installPackage({ id, name: id, version: '1.0.0', type: 'app', namespace: 'shared' } as never, 'code', + undefined, { packageIds: [...order] }); + registry.registerItem('webhook', { ...(id === A ? ALPHA : BETA) }, 'name' as never, id); + } + const engine = engineOver(registry); + const { enqueuer, realtime, calls, declaredWebhooks } = await startEnqueuer(engine); + await realtime.publish(taskCreated()); + await flush(); + expect(calls.map((c) => [c.refId, c.url]).sort()).toEqual([ + [declaredWebhookRefId('task_changed', A), 'https://hooks.example/alpha'], + [declaredWebhookRefId('task_changed', B), 'https://hooks.example/beta'], + ]); + expect((await declaredWebhooks.list()).map((d) => [d.packageId, d.namespace]).sort()) + .toEqual([[A, 'shared'], [B, 'shared']]); + const err = await declaredWebhooks.declaredWebhookNamed('task_changed').then(() => undefined, (e: unknown) => e); + expect(err).toBeInstanceOf(DeclaredWebhookAmbiguousError); + expect((err as DeclaredWebhookAmbiguousError).refusal.candidates.map((c: any) => c.packageId).sort()).toEqual([A, B]); + await enqueuer.stop(); + }); + } + + // [#33016 S1] The second state the namespace address cannot tell apart: a + // package that declares no namespace beside another holder. Both are served + // and both dispatched; the one with no namespace has no namespace address, + // and the activation door's `?package=` switches each + // (`catalog-activation-door.test.ts`). + for (const order of [[A, 'com.acme.nons'], ['com.acme.nons', A]] as const) { + it(`a package with no namespace beside a holder, registered ${order.map((p) => p.split('.').pop()).join(', ')}: both dispatched under their own ids, the bare read refused naming both`, async () => { + const N = 'com.acme.nons'; + const registry = new SchemaRegistry(); + registry.logLevel = 'silent'; + for (const id of order) { + registry.installPackage({ id, name: id, version: '1.0.0', type: 'app', ...(id === A ? { namespace: 'alpha' } : {}) } as never, 'code'); + registry.registerItem('webhook', { ...(id === A ? ALPHA : BETA) }, 'name' as never, id); + } + const engine = engineOver(registry); + const { enqueuer, realtime, calls, declaredWebhooks } = await startEnqueuer(engine); + await realtime.publish(taskCreated()); + await flush(); + expect(calls.map((c) => [c.refId, c.url]).sort()).toEqual([ + [declaredWebhookRefId('task_changed', A), 'https://hooks.example/alpha'], + [declaredWebhookRefId('task_changed', N), 'https://hooks.example/beta'], + ]); + expect((await declaredWebhooks.list()).map((d) => [d.packageId, d.namespace ?? null]).sort()) + .toEqual([[A, 'alpha'], [N, null]]); + const err = await declaredWebhooks.declaredWebhookNamed('task_changed').then(() => undefined, (e: unknown) => e); + expect(err).toBeInstanceOf(DeclaredWebhookAmbiguousError); + expect((err as DeclaredWebhookAmbiguousError).refusal.candidates.map((c: any) => c.packageId).sort()).toEqual([A, N]); + expect((await declaredWebhooks.declaredWebhookAt(N, 'task_changed'))?.webhook.url).toBe('https://hooks.example/beta'); + await enqueuer.stop(); + }); + } + it('two holders: the bare by-name read throws the 409 naming both, carrying the refusal; each slot is read exactly', async () => { const source = new DeclaredWebhookSource(twoHolders(), undefined); const err = await source.declaredWebhookNamed('task_changed').then(() => undefined, (e: unknown) => e); diff --git a/packages/runtime/src/domains/catalog-activation-door.test.ts b/packages/runtime/src/domains/catalog-activation-door.test.ts index f6316772e19..b1cda4bd218 100644 --- a/packages/runtime/src/domains/catalog-activation-door.test.ts +++ b/packages/runtime/src/domains/catalog-activation-door.test.ts @@ -887,6 +887,119 @@ describe('the catalog activation door — a declared webhook two packages declar expect(h.writes).toEqual([]); }); + // [#33016 S3] The lone case above is 404; beside an enabled holder of another + // namespace, the disabled namespace holds nothing and is refused naming the holder. + it('B disabled beside A enabled: B\'s namespace address is 409 `not-held-by-qualifier` naming A, nothing written', async () => { + const h = bootWith([A], [], [A, B]); + const res = await flip(h, TENANT_ADMIN(), `/_activation/webhook/beta/${HOOK}`); + expect([statusOf(res), codeOf(res), candidatesOf(res)]).toEqual([409, 'RESOURCE_CONFLICT', [A]]); + expect(messageOf(res)).toContain('is not held by package "com.acme.beta"'); + expect(h.writes).toEqual([]); + }); + + // [#33016 S1] Two holders the namespace address cannot tell apart: two + // co-owners of one namespace (or a package with no namespace beside another + // holder, which has only the bare address). Both are served, the bare and + // the namespace address both refuse naming both, and `?package=PKG`, the + // exact qualifier, switches exactly one. Both registration orders. + describe('[FROM 409 TO switched] two holders one namespace cannot tell apart: `webhook/:name?package=PKG`', () => { + const flipAt = (h: Harness, path: string, query: Record, body: unknown = { enabled: false }) => + h.dispatcher.handleSecurity(path, 'POST', body, query, TENANT_ADMIN()); + for (const order of [[A, B], [B, A]]) { + it(`registered ${order.map((p) => p.split('.').pop()).join(', ')}: both doors refuse naming both, and \`?package=\` switches each holder's own row`, async () => { + const h = bootWith(order, [{ package_id: null, active: false }]); + for (const path of [`/_activation/webhook/${HOOK}`, `/_activation/webhook/shared/${HOOK}`]) { + const refused = await flip(h, TENANT_ADMIN(), path); + expect([statusOf(refused), [...candidatesOf(refused)].sort()], path).toEqual([409, [A, B]]); + } + expect(h.writes).toEqual([]); + + const res = await flipAt(h, `/_activation/webhook/${HOOK}`, { package: A }, { enabled: true }); + expect(statusOf(res)).toBe(200); + expect(res.response?.body?.data).toEqual({ type: 'webhook', name: HOOK, packageId: A, enabled: true }); + expect(ledger(h)).toEqual([[null, false], [A, true]]); + + expect(statusOf(await flipAt(h, `/_activation/webhook/${HOOK}`, { package: B }))).toBe(200); + expect(ledger(h)).toEqual([[null, false], [A, true], [B, false]]); + expect(statusOf(await flipAt(h, `/_activation/webhook/${HOOK}`, { package: A }))).toBe(200); + expect(ledger(h)).toEqual([[null, false], [A, false], [B, false]]); + }); + } + + // The second state: a package that declares no namespace beside another + // holder. Its only address is the bare one, which refuses naming both; + // `?package=` switches each holder's own row. + const N = 'com.acme.nons'; + for (const order of [[A, N], [N, A]]) { + it(`a package with no namespace beside a holder, registered ${order.map((p) => p.split('.').pop()).join(', ')}: the bare address refuses naming both, and \`?package=\` switches each holder's own row`, async () => { + const h = bootWith(order, [{ package_id: null, active: false }]); + const refused = await flip(h, TENANT_ADMIN(), `/_activation/webhook/${HOOK}`); + expect([statusOf(refused), [...candidatesOf(refused)].sort()]).toEqual([409, [A, N]]); + expect(h.writes).toEqual([]); + + const res = await flipAt(h, `/_activation/webhook/${HOOK}`, { package: N }, { enabled: true }); + expect(statusOf(res)).toBe(200); + expect(res.response?.body?.data).toEqual({ type: 'webhook', name: HOOK, packageId: N, enabled: true }); + expect(ledger(h)).toEqual([[null, false], [N, true]]); + + expect(statusOf(await flipAt(h, `/_activation/webhook/${HOOK}`, { package: A }, { enabled: true }))).toBe(200); + expect(ledger(h)).toEqual([[null, false], [N, true], [A, true]]); + expect(statusOf(await flipAt(h, `/_activation/webhook/${HOOK}`, { package: N }))).toBe(200); + expect(ledger(h)).toEqual([[null, false], [N, false], [A, true]]); + }); + } + + it('a package that does not hold the name is 409 naming the holders; nothing served is 404; nothing written', async () => { + const h = bootWith([A, B]); + const notHeld = await flipAt(h, `/_activation/webhook/${HOOK}`, { package: 'com.acme.gamma' }); + expect([statusOf(notHeld), codeOf(notHeld), candidatesOf(notHeld)]).toEqual([409, 'RESOURCE_CONFLICT', [A, B]]); + expect(messageOf(notHeld)).toContain('is not held by package "com.acme.gamma"'); + expect(statusOf(await flipAt(h, '/_activation/webhook/our_own_hook', { package: A }))).toBe(404); + expect(h.writes).toEqual([]); + }); + + it('a disabled package holds nothing: beside an enabled holder 409 naming it, alone 404', async () => { + const beside = bootWith([A], [], [A, B]); + const res = await flipAt(beside, `/_activation/webhook/${HOOK}`, { package: B }); + expect([statusOf(res), candidatesOf(res)]).toEqual([409, [A]]); + expect(beside.writes).toEqual([]); + const alone = bootWith([], [], [B]); + expect(statusOf(await flipAt(alone, `/_activation/webhook/${HOOK}`, { package: B }))).toBe(404); + expect(alone.writes).toEqual([]); + }); + + it('CONTROL — one holder: `?package=` writes the row the bare address writes, taking the row naming no package over (D8)', async () => { + const h = bootWith([A], [{ package_id: null, active: true }], [A]); + expect(statusOf(await flipAt(h, `/_activation/webhook/${HOOK}`, { package: A }))).toBe(200); + expect(ledger(h)).toEqual([[A, false]]); + }); + + it('the query is closed: an empty or repeated `package`, an unknown name, or `package` on the namespace address is 400, nothing written', async () => { + const h = bootWith([A, B]); + for (const [path, query] of [ + [`/_activation/webhook/${HOOK}`, { package: '' }], + [`/_activation/webhook/${HOOK}`, { package: [A, B] }], + [`/_activation/webhook/${HOOK}`, { packages: A }], + [`/_activation/webhook/alpha/${HOOK}`, { package: A }], + [`/_activation/sharing_rule/${HOOK}`, { package: A }], + ] as const) { + const res = await flipAt(h, path, query as Record); + expect([statusOf(res), codeOf(res)], `${path} ${JSON.stringify(query)}`).toEqual([400, 'VALIDATION_ERROR']); + } + expect(h.writes).toEqual([]); + }); + }); + + // [#33016 nit 4] The one-holder widening the #31699 changeset declares: a + // row naming no package beside the holder's own row was a 409; the holder's + // own row is written, and the row naming no package is left as it is. + it('[FROM 409 TO written] one holder with its own row beside a row naming no package: the bare address writes the holder\'s own row', async () => { + const h = bootWith([A], [{ package_id: null, active: false }, { package_id: A, active: false }], [A]); + const res = await flip(h, TENANT_ADMIN(), `/_activation/webhook/${HOOK}`, { enabled: true }); + expect(statusOf(res)).toBe(200); + expect(ledger(h)).toEqual([[null, false], [A, true]]); + }); + it('the namespace address is the webhook\'s alone: any other type with four segments is the shape 400', async () => { const h = bootWith([A]); expect(statusOf(await flip(h, TENANT_ADMIN(), `/_activation/sharing_rule/alpha/${HOOK}`))).toBe(400); diff --git a/packages/runtime/src/domains/catalog-activation.ts b/packages/runtime/src/domains/catalog-activation.ts index bf566b97342..a105cea6a67 100644 --- a/packages/runtime/src/domains/catalog-activation.ts +++ b/packages/runtime/src/domains/catalog-activation.ts @@ -89,9 +89,11 @@ * serves the name) would still keep off. Nothing is written then. * * The door's query set is closed (AGENTS route rule 5): `package` for - * `permission`, nothing for every other type — a name outside it is refused - * `400 VALIDATION_ERROR` before any lookup, where it used to be dropped - * without a word ({@link catalogActivationQueryParams}). + * `permission` and for the bare `webhook/:name` address (#33016, the exact + * qualifier), nothing for the namespace address `webhook/:ns/:name` or any + * other type — a name outside it is refused `400 VALIDATION_ERROR` before any + * lookup, where it used to be dropped without a word + * ({@link catalogActivationQueryParams}). * * ## A declared webhook two packages declare (ADR-0150 D3/D4/D5, #31699) * @@ -104,6 +106,10 @@ * RESOURCE_CONFLICT`, naming both (it was a `503`: the reader's refusal * carried no `refusal`), and `POST /security/_activation/webhook/:ns/:name` * addresses the holder in namespace `:ns` ({@link resolveQualifiedWebhook}). + * Two holders the namespace address cannot tell apart — two co-owners of one + * namespace, or a package that declares no namespace beside another holder — + * are each switched by the exact qualifier, `webhook/:name?package=PKG` + * ({@link resolveExactWebhook}, #33016): the one webhook query parameter. * A row naming no package becomes the holder's own when the name has that one * holder (`adoptPackageless`, ADR-0150 D8), as the name-addressed store wrote * it before; under two holders it is neither's and is never written for one. @@ -289,6 +295,43 @@ async function resolveQualifiedWebhook( return { refusal: { ...base, message: packageScopedRefusalMessage(base) } }; } +/** + * [ADR-0150 D2/D5, #33016] The declared webhook `POST /security/_activation/ + * webhook/:name?package=PKG` addresses: exactly PKG's declaration of `name` + * among the served slots — the exact qualifier `/meta` reads, and the address + * that switches one holder wherever the namespace address cannot: two + * co-owners of one namespace, or a package that declares no namespace beside + * another holder. A PKG that does not hold the name is refused naming the + * holders (`not-held-by-qualifier`); `404` when nothing serves the name. As + * in {@link resolveQualifiedWebhook}, a DISABLED package's declaration is no + * slot, so a disabled PKG holds nothing here. + */ +async function resolveExactWebhook( + reader: DeclaredWebhookReader, + packageId: string, + name: string, +): Promise< + | { readonly entry: { name: string; packageId: string }; readonly holders: number } + | { readonly refusal: PackageScopedRefusal } + | { readonly missing: string } +> { + const slots = (await reader.list!()).filter((d) => d.webhook.name === name); + if (slots.some((d) => d.packageId === packageId)) return { entry: { name, packageId }, holders: slots.length }; + if (slots.length === 0) return { missing: 'no enabled package declares the name' }; + const candidates: PackageScopedHolder[] = slots.map((d) => (d.packageId === undefined + ? { kind: 'environment' as const } + : { kind: 'package' as const, packageId: d.packageId })); + const base = { + status: 'refused' as const, + reason: 'not-held-by-qualifier' as const, + type: 'webhook' as const, + name, + callerPackageId: packageId, + candidates, + }; + return { refusal: { ...base, message: packageScopedRefusalMessage(base) } }; +} + function declaredWebhookReaderOf(service: unknown): DeclaredWebhookReader | undefined { const candidate = service as Partial | null | undefined; return typeof candidate?.declaredWebhookNamed === 'function' ? (candidate as DeclaredWebhookReader) : undefined; @@ -389,15 +432,31 @@ export function refusedNameAnswer(deps: DomainHandlerDeps, refusal: PackageScope export const PERMISSION_SET_DOOR_QUERY_PARAMS: readonly string[] = Object.freeze(['package']); /** - * [AGENTS route rule 5] The closed query set of this door for every type but - * `permission`. **Measured**: EMPTY — a position, a declared sharing rule, - * webhook, queue or assignment rule is addressed by its path alone. + * [ADR-0150 D2/D5, #33016; AGENTS route rule 5] The closed query set of + * `POST /security/_activation/webhook/:name`. **Measured**: `package` alone, + * the exact qualifier ({@link resolveExactWebhook}), read by the same reader + * as the permission set's ({@link readPermissionSetPackageQuery}). The + * namespace address `webhook/:ns/:name` names its holder by path and keeps + * the empty set. + */ +export const WEBHOOK_DOOR_QUERY_PARAMS: readonly string[] = Object.freeze(['package']); + +/** + * [AGENTS route rule 5] The closed query set of this door for every other + * address. **Measured**: EMPTY — a position, a declared sharing rule, queue or + * assignment rule, and a webhook's namespace address, are addressed by their + * path alone. */ const CATALOG_ACTIVATION_NO_QUERY_PARAMS: readonly string[] = Object.freeze([]); -/** The closed query set of `POST /security/_activation/:type/:name`, per type. */ -export function catalogActivationQueryParams(type: string): readonly string[] { - return type === 'permission' ? PERMISSION_SET_DOOR_QUERY_PARAMS : CATALOG_ACTIVATION_NO_QUERY_PARAMS; +/** + * The closed query set of `POST /security/_activation/:type/:name`, per type; + * `qualified` is the webhook's namespace address, `webhook/:ns/:name`. + */ +export function catalogActivationQueryParams(type: string, qualified = false): readonly string[] { + if (type === 'permission') return PERMISSION_SET_DOOR_QUERY_PARAMS; + if (type === 'webhook' && !qualified) return WEBHOOK_DOOR_QUERY_PARAMS; + return CATALOG_ACTIVATION_NO_QUERY_PARAMS; } /** @@ -411,6 +470,7 @@ export function readPermissionSetPackageQuery( deps: DomainHandlerDeps, query: unknown, declared: readonly string[], + noun = 'permission set', ): { packageId?: string; refusal?: HttpDispatcherResult } { const unknownMessage = unknownQueryParamRefusalMessage(query, declared); if (unknownMessage !== undefined) { @@ -437,8 +497,8 @@ export function readPermissionSetPackageQuery( refusal: { handled: true, response: deps.error( - '`package` names the package whose permission set this request addresses — a non-empty package id. ' - + 'Leave it out to address the set by its name alone.', + `\`package\` names the package whose ${noun} this request addresses — a non-empty package id. ` + + `Leave it out to address the ${noun === 'permission set' ? 'set' : noun} by its name alone.`, 400, { code: 'VALIDATION_ERROR' }, ), @@ -754,7 +814,8 @@ function ledgerUnregistered(ql: any): boolean { * or `['_activation', 'webhook', ns, name]` (#31699). * Then the **query**: the type's closed set * ({@link catalogActivationQueryParams}), and `?package=` for a - * permission set ({@link readPermissionSetPackageQuery}). + * permission set or a webhook's bare address + * ({@link readPermissionSetPackageQuery}). * 3. **Body**: {@link readActivationBody}. * 4. **Declaration**, through the catalog reader the security plugin binds to * the engine — the one `resolveUserAuthzGrants` reads, so this door and @@ -828,7 +889,12 @@ export async function handleCatalogActivationWrite( // [AGENTS route rule 5, ADR-0150 D5, #32164] The type's closed set, read // before the body and before any lookup, so a refused request reads // nothing and writes nothing. - const queryReading = readPermissionSetPackageQuery(deps, query, catalogActivationQueryParams(type)); + const queryReading = readPermissionSetPackageQuery( + deps, query, catalogActivationQueryParams(type, namespace !== undefined), type === 'webhook' ? 'webhook' : undefined, + ); + // [ADR-0150 D2/D5, #33016] `webhook/:name?package=PKG` addresses exactly + // PKG's declaration, as the namespace address addresses its namespace's. + const exactWebhookPackage = type === 'webhook' ? queryReading.packageId : undefined; if (queryReading.refusal) return queryReading.refusal; // ── 3. body ───────────────────────────────────────────────────────────── @@ -847,7 +913,7 @@ export async function handleCatalogActivationWrite( return { handled: true, response: deps.error('Data engine not available', 503) }; } let entry: { name: string; packageId?: string } | undefined; - if (namespace !== undefined) { + if (namespace !== undefined || exactWebhookPackage !== undefined) { const reader = declaredWebhookReaderOf(await deps.resolveService(context, 'declaredWebhooks')); if (!reader || typeof reader.list !== 'function') { return { @@ -862,7 +928,9 @@ export async function handleCatalogActivationWrite( } let address: Awaited>; try { - address = await resolveQualifiedWebhook(reader, ql, namespace, name); + address = namespace !== undefined + ? await resolveQualifiedWebhook(reader, ql, namespace, name) + : await resolveExactWebhook(reader, exactWebhookPackage!, name); } catch (err: any) { return { handled: true, @@ -877,10 +945,13 @@ export async function handleCatalogActivationWrite( } if ('refusal' in address) return refusedNameAnswer(deps, address.refusal); if ('missing' in address) { + const addressPhrase = namespace !== undefined + ? `in namespace '${namespace}'` + : `by package '${exactWebhookPackage}'`; return { handled: true, response: deps.error( - `Webhook '${name}' is not declared in namespace '${namespace}': ${address.missing}. There is nothing ` + + `Webhook '${name}' is not declared ${addressPhrase}: ${address.missing}. There is nothing ` + `to switch ${enabled ? 'on' : 'off'}. ${DECLARATION_LOOKUPS.webhook.authoredRemedy}`, 404, ), @@ -1064,7 +1135,7 @@ export async function handleCatalogActivationWrite( response: deps.success({ type, name: entry.name, - ...(namespace !== undefined ? { packageId: entry.packageId } : {}), + ...(namespace !== undefined || exactWebhookPackage !== undefined ? { packageId: entry.packageId } : {}), enabled, }), }; diff --git a/packages/runtime/src/route-ledger.ts b/packages/runtime/src/route-ledger.ts index d48a87d248c..112d5739751 100644 --- a/packages/runtime/src/route-ledger.ts +++ b/packages/runtime/src/route-ledger.ts @@ -450,7 +450,10 @@ export const ROUTE_LEDGER: readonly RouteLedgerEntry[] = [ + 'declare a webhook of one name, and the bare `webhook/:name` refuses that name 409 naming both. `:ns` names the holder ' + 'among the packages of that namespace (the registry\'s `getNamespaceOwners`); two co-owners holding the name are 409 ' + '`ambiguous-in-namespace`, none is 409 `not-held-by-qualifier` naming the holders, or 404 when nothing declares it. ' - + 'Writes that holder\'s own `(webhook, package_id, name)` row and no other. Same body, gates and caller as the row above, ' + + 'Writes that holder\'s own `(webhook, package_id, name)` row and no other. Two holders `:ns` cannot tell apart (two ' + + 'co-owners of one namespace, or a package that declares no namespace beside another holder) are each switched by the row ' + + 'above with `?package=PKG`, the exact qualifier and the one query parameter of the webhook\'s bare address (a PKG that ' + + 'does not hold the name is 409 naming the holders); this address takes none. Same body, gates and caller as the row above, ' + 'whose arm it is (`domains/catalog-activation.ts`). Pinned in `domains/catalog-activation-door.test.ts` and ' + '`qa/dogfood/test/bare-name-one-holder-flow-family.dogfood.test.ts`' }, { route: 'POST /security/permission-sets/:name/clone', domain: '/security', disposition: 'server-only', diff --git a/packages/spec/liveness/webhook.json b/packages/spec/liveness/webhook.json index 5a2a735d70f..b9c3836603d 100644 --- a/packages/spec/liveness/webhook.json +++ b/packages/spec/liveness/webhook.json @@ -4,7 +4,7 @@ "props": { "name": { "status": "live", - "evidence": "packages/plugins/plugin-webhooks/src/declared-webhooks.ts#DeclaredWebhookSource (`WebhookSchema.parse` of each registry item; the first registration of a name holds it); packages/plugins/plugin-webhooks/src/auto-enqueuer.ts#projectDeclared (`name: wh.name`, and `declaredWebhookRefId(wh.name)` as the subscription id and every delivery's `ref_id`); packages/plugins/plugin-webhooks/src/auto-enqueuer.ts#resolveDeclared (the name finds any `sys_webhook` row holding it; such a row answers as itself and the declaration is withheld); packages/plugins/plugin-webhooks/src/auto-enqueuer.ts#parseRow (`name: (row.name as string) ?? row.id` — the dispatcher's dedup/log key)", + "evidence": "packages/plugins/plugin-webhooks/src/declared-webhooks.ts#DeclaredWebhookSource (`WebhookSchema.parse` of each registry item; one slot per served `(package, name)` holder, so two packages declaring one name are each their own slot: `slotsOf`); packages/plugins/plugin-webhooks/src/auto-enqueuer.ts#projectDeclared (`name: wh.name`, and `declaredWebhookRefId(name, packageId)` — `declared:PKG/NAME`, or `declared:NAME` for the environment's own — as the subscription id and every delivery's `ref_id`); packages/plugins/plugin-webhooks/src/auto-enqueuer.ts#resolveDeclared (the name finds any `sys_webhook` row holding it; such a row answers as itself and the declaration is withheld); packages/plugins/plugin-webhooks/src/auto-enqueuer.ts#parseRow (`name: (row.name as string) ?? row.id` — the dispatcher's dedup/log key)", "note": "Was dead pre-bridge (admin-CRUD-only). Now fed by authoring. 2026-08-28: RE-ANCHORED (commit 9ee2dcfbd) — see the file `_note` for what the re-closure found across this ledger; re-closed by hand against c459da6bc, DATED for the first time. 2026-10-19: RE-ANCHORED to the registry read — ADR-0131 D2 retired the boot seeder `bootstrapDeclaredWebhooks`, so a declared webhook is no longer copied into a `sys_webhook` row; the dispatcher reads the declaration itself (packages/plugins/plugin-webhooks/src/declared-webhooks.ts#DeclaredWebhookSource, projected by packages/plugins/plugin-webhooks/src/auto-enqueuer.ts#projectDeclared). Re-closed by hand against that change.", "verifiedAt": "2026-10-19" },