Skip to content

Commit c080016

Browse files
committed
docs(changeset): Clause-② arm (4), the library reads of a webhook only a disabled package holds
Measured with `webhook` out of the three type sets, as main has them: `MetadataFacade.get` / `getEntry` and `SchemaRegistry.resolveItem` answered the disabled package's declaration and `MetadataFacade.exists` true; on this head they answer undefined and false, as #32497 made them for the other package-scoped types. The lone-disabled pin now asserts all four. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgUJAvdCcvoqdsFGVz8
1 parent 491e70b commit c080016

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

‎.changeset/31699-webhook-names-per-namespace.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010

1111
feat(plugin-webhooks)!: two packages of two namespaces may each declare a webhook of the same name, each is dispatched and switched as its own, and a delivery names the package it came from (ADR-0150 child B, webhook family 2/3)
1212

13-
Clause-②: yes (narrowing) — three answers move for a caller that worked before. (1) The bare `GET /meta/webhook/NAME` of a name two packages hold (a disabled package holds none here, #32497), and its published read `GET /meta/webhook/NAME/published` (which asks the bare item read for the item's package), are refused `409 RESOURCE_CONFLICT` (`ambiguous-in-environment`, naming both), where they served the first registered package's declaration; before this change that state existed only for a clash the cold boot sealed with a warning. (2) A declared webhook a package ships is subscribed, and its new deliveries are written, under `ref_id = declared:PKG/NAME`, where they carried `declared:NAME`; a consumer that selects deliveries by `ref_id = 'declared:NAME'` no longer matches the ones written after the upgrade. (3) The history, diff and rollback of a webhook name two packages saved through `DatabaseLoader` (`MetadataManager.getHistory` / `diff` / `rollback`), naming no package, are refused `409 RESOURCE_CONFLICT` (`ambiguous-in-environment`, naming both), where they answered every version of the one row both saves wrote, and a rollback to the version of a package removed since is refused `409 RESOURCE_CONFLICT` (`not-held-by-qualifier`, naming it), where it wrote that body into the remaining holder's row: #32351's rules reach `webhook` with `PACKAGE_SLOTTED_STORE_TYPES`. Widened beside them: the engine's package door, item seam and cold-boot seal admit a second package holder of a webhook name that declares another namespace, and the dispatcher, which subscribed neither holder of such a name, subscribes each one.
13+
Clause-②: yes (narrowing) — four answers move for a caller that worked before. (1) The bare `GET /meta/webhook/NAME` of a name two packages hold (a disabled package holds none here, #32497), and its published read `GET /meta/webhook/NAME/published` (which asks the bare item read for the item's package), are refused `409 RESOURCE_CONFLICT` (`ambiguous-in-environment`, naming both), where they served the first registered package's declaration; before this change that state existed only for a clash the cold boot sealed with a warning. (2) A declared webhook a package ships is subscribed, and its new deliveries are written, under `ref_id = declared:PKG/NAME`, where they carried `declared:NAME`; a consumer that selects deliveries by `ref_id = 'declared:NAME'` no longer matches the ones written after the upgrade. (3) The history, diff and rollback of a webhook name two packages saved through `DatabaseLoader` (`MetadataManager.getHistory` / `diff` / `rollback`), naming no package, are refused `409 RESOURCE_CONFLICT` (`ambiguous-in-environment`, naming both), where they answered every version of the one row both saves wrote, and a rollback to the version of a package removed since is refused `409 RESOURCE_CONFLICT` (`not-held-by-qualifier`, naming it), where it wrote that body into the remaining holder's row: #32351's rules reach `webhook` with `PACKAGE_SLOTTED_STORE_TYPES`. (4) For a webhook name only disabled packages hold, `MetadataFacade.get` / `getEntry` and `SchemaRegistry.resolveItem` (`@objectstack/objectql`) answer `undefined` where they answered the disabled package's declaration, and `MetadataFacade.exists` answers false where it answered true: #32497's rule for the package-scoped readers reaches `webhook` with `PACKAGE_SCOPED_READ_TYPES`, and the by-name door already answered `404`. Widened beside them: the engine's package door, item seam and cold-boot seal admit a second package holder of a webhook name that declares another namespace, and the dispatcher, which subscribed neither holder of such a name, subscribes each one.
1414
Metadata-protocol: added
1515

1616
<!-- adr-0087: not-required (no-migration-prescription) no key of any schema is added, removed, renamed or re-shaped and no stored metadata changes shape: what moves is which second package an install admits, which declaration a by-name read answers, and the reference new delivery rows carry; stored rows are read as they are, so there is nothing for `objectstack migrate meta` to rewrite -->
1717

18-
**BREAKING** for three callers. A deployment that already held one webhook name under two packages (sealed at boot with a warning) reads `409` naming both on `GET /meta/webhook/NAME`: read each by its package (`?package=ID`, or `/meta/webhook/NS/NAME`). A consumer of `sys_http_delivery` that matches a declared webhook's deliveries by `ref_id = 'declared:NAME'` must match `declared:PKG/NAME` for the deliveries written after this release (rows written before keep `declared:NAME`, so match both across the upgrade). A caller of `MetadataManager` history on a database-backed loader that reads, diffs or rolls back a webhook name two packages saved names the package (`{ packageId }`), once per package. Nothing in the workspace is in any of the three positions.
18+
**BREAKING** for four callers. A deployment that already held one webhook name under two packages (sealed at boot with a warning) reads `409` naming both on `GET /meta/webhook/NAME`: read each by its package (`?package=ID`, or `/meta/webhook/NS/NAME`). A consumer of `sys_http_delivery` that matches a declared webhook's deliveries by `ref_id = 'declared:NAME'` must match `declared:PKG/NAME` for the deliveries written after this release (rows written before keep `declared:NAME`, so match both across the upgrade). A caller of `MetadataManager` history on a database-backed loader that reads, diffs or rolls back a webhook name two packages saved names the package (`{ packageId }`), once per package. An in-process caller of `MetadataFacade` or `SchemaRegistry.resolveItem` that reads a webhook name only disabled packages hold reads `undefined`, as it does for the other package-scoped types since #32497. Nothing in the workspace is in any of the four positions: `MetadataFacade` is never constructed in-tree, and the one door that reads `resolveItem`, the protocol's by-name read, already withheld the body.
1919

2020
The bare-name one-holder rule (`bare-name-one-holder.ts`) has narrowed for `webhook` from one package holder per deployment to one per namespace (ADR-0150 D2, D9): `webhook` joins `NAMESPACE_SCOPED_BARE_NAME_TYPES` (`@objectstack/core`), `PACKAGE_SCOPED_READ_TYPES` (`@objectstack/objectql`) and `PACKAGE_SLOTTED_STORE_TYPES` (`@objectstack/metadata`). Every reader of a declared webhook answers by `(package, name)`:
2121

‎packages/objectql/src/package-scoped-e8-readers.test.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,13 +369,19 @@ describe('webhook joins the readers (ADR-0150 D9, #31699 PR 2): `/meta/webhook/N
369369
await expectRefusal(() => protocol.getMetaItem({ type: 'webhook', name: 'twin_hook' }), 'ambiguous-in-environment', [A, B]);
370370
});
371371

372-
// BASE (2200b8c9, same fixture): the protocol read served nothing (404) already, while
373-
// `MetadataFacade.get` answered the disabled package's body (#32497's row 1, now for the webhook).
372+
// BASE (2200b8c9, and this head with `webhook` out of the three type sets, as
373+
// main has them; same fixture): the protocol read served nothing (404) already,
374+
// while `MetadataFacade.get` / `getEntry` and `SchemaRegistry.resolveItem`
375+
// answered the disabled package's body and `exists` true (#32497's row 1, now
376+
// for the webhook).
374377
it('[FROM the disabled body TO undefined, library] a lone disabled holder: the protocol read serves nothing, as before, and `MetadataFacade.get` answers undefined', async () => {
375378
ship('webhook', 'gone_hook', B);
376379
registry.disablePackage(B);
377380
expect((await protocol.getMetaItem({ type: 'webhook', name: 'gone_hook' }))?.item ?? null).toBeNull();
378381
expect(await facade.get('webhook', 'gone_hook')).toBeUndefined();
382+
expect(facade.getEntry('webhook', 'gone_hook')).toBeUndefined();
383+
expect(await facade.exists('webhook', 'gone_hook')).toBe(false);
384+
expect(registry.resolveItem('webhook', 'gone_hook')).toBeUndefined();
379385
});
380386
});
381387

0 commit comments

Comments
 (0)