From 42667cd1f5c22d9d5772bebf778b90758ce6ab9e Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 11:39:01 +0000 Subject: [PATCH 1/4] fix(runtime): a channel list with a member off the declared shape is not judged at the automation save doors A getKnownChannels() list with any member that is not { id: string } is now an unreadable registry (not judged), like a reader that throws or answers no list; dropping such members left a roster that refused every channel. The notify-channel-unknown-refused semantic entry now names every not-judged case and the paths a refusal names. Data text only in packages/spec. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01QsR2jUZKdq3PK2Sab53cT3 --- ...-notify-channel-roster-malformed-member.md | 13 ++++++++++++ ...automation-authoring-doors-durable.test.ts | 20 ++++++++++++++++++- packages/runtime/src/domains/automation.ts | 19 ++++++++++-------- .../18.notify-channel-unknown-refused.ts | 12 ++++++----- 4 files changed, 50 insertions(+), 14 deletions(-) create mode 100644 .changeset/32733-notify-channel-roster-malformed-member.md diff --git a/.changeset/32733-notify-channel-roster-malformed-member.md b/.changeset/32733-notify-channel-roster-malformed-member.md new file mode 100644 index 00000000000..e3d6d40c8e7 --- /dev/null +++ b/.changeset/32733-notify-channel-roster-malformed-member.md @@ -0,0 +1,13 @@ +--- +'@objectstack/runtime': patch +'@objectstack/spec': patch +--- + +fix(runtime): a channel list with a member off the declared shape is not judged at the automation save doors, so it no longer refuses every channel + +Clause-②: no +Metadata-protocol: none + +The `/automation` write doors (`POST /api/v1/automation`, `PUT /api/v1/automation/NAME`, `POST /api/v1/automation/NAME/clone`) read the messaging service's `getKnownChannels()` to refuse a `notify` node naming a channel nothing registers. A reader that throws or answers no list was already not judged. A list whose members were not all `{ id: string }` (the declared shape) had those members dropped instead, so a reader answering bare channel ids left an empty roster and every named channel was refused `400 VALIDATION_FAILED`. Such a list is now an unreadable registry like the other two: not judged, and the save goes on as it did before the check existed. No first-party messaging service answers that shape; `MessagingService.getKnownChannels()` answers the declared one, and a flow naming an unknown channel on it is refused exactly as before. + +The `notify-channel-unknown-refused` entry `os migrate meta` prints now lists every not-judged case the doors have (a save before `kernel:ready` has settled, and an unreadable channel reader, beside the four it named) and the paths a refusal names (`nodes.N.config.channels`, `nodes.N.config.channels.M` for a list member, a longer path inside a region body). Data text only. diff --git a/packages/runtime/src/domains/automation-authoring-doors-durable.test.ts b/packages/runtime/src/domains/automation-authoring-doors-durable.test.ts index 5aab987f96a..0170338da8b 100644 --- a/packages/runtime/src/domains/automation-authoring-doors-durable.test.ts +++ b/packages/runtime/src/domains/automation-authoring-doors-durable.test.ts @@ -66,7 +66,9 @@ const storeRefusal = () => Object.assign(new Error('flow/x failed spec validatio * And whether the kernel's `kernel:ready` has settled (`hasBootPhaseSettled`). */ interface ChannelComposition { - messaging?: ReadonlyArray<{ id: string; configured: boolean }> | 'no-reader' | 'reader-throws' | 'reader-not-a-list'; + messaging?: + | ReadonlyArray<{ id: string; configured: boolean }> + | 'no-reader' | 'reader-throws' | 'reader-not-a-list' | 'reader-bare-ids' | 'reader-one-bare-id'; /** `'throws'`: the kernel's boot-phase reader itself throws, so the check cannot finish. */ ready?: boolean | 'throws'; } @@ -101,6 +103,10 @@ function boot({ protocol: mode = 'real', messaging, ready = false }: { protocol? if (messaging === 'no-reader') services.messaging = { emit: async () => ({}) }; else if (messaging === 'reader-throws') services.messaging = { getKnownChannels: () => { throw new Error('registry unreadable'); } }; else if (messaging === 'reader-not-a-list') services.messaging = { getKnownChannels: () => ({ inbox: true }) }; + else if (messaging === 'reader-bare-ids') services.messaging = { getKnownChannels: () => ['inbox', 'email'] }; + else if (messaging === 'reader-one-bare-id') { + services.messaging = { getKnownChannels: () => [{ id: 'inbox', configured: true }, 'email'] }; + } else if (messaging) services.messaging = { getKnownChannels: () => messaging.map((entry) => ({ ...entry })) }; const resolve = (name: string): unknown => services[name]; const kernel = { @@ -387,6 +393,18 @@ describe('a notify node naming a channel no plugin registers is refused at the s } }); + it('a list with any member that is not a `{ id: string }` is unreadable, not judged: a channel it names is never refused', async () => { + // The reader knows `email`, spelled off the declared shape: dropping the + // member would leave a roster without it and refuse the node. + for (const messaging of ['reader-bare-ids', 'reader-one-bare-id'] as const) { + const h = boot({ messaging, ready: true }); + const { response } = await h.dispatcher.handleAutomation('', 'POST', notifyFlowOf(NEW, 'email'), AUTHOR(), undefined); + expect(statusOf(response), messaging).toBe(200); + expect(h.saveMetaItem, messaging).toHaveBeenCalledTimes(1); + expect(h.held(NEW), messaging).toBeDefined(); + } + }); + it('a check that cannot finish undoes the registration before the error leaves: nothing registered-but-unsaved', async () => { const h = boot({ messaging: STOCK_CHANNELS, ready: 'throws' }); const before = h.held(CUSTOMER); diff --git a/packages/runtime/src/domains/automation.ts b/packages/runtime/src/domains/automation.ts index 2ff2dc9a289..9580228d1f0 100644 --- a/packages/runtime/src/domains/automation.ts +++ b/packages/runtime/src/domains/automation.ts @@ -2298,8 +2298,9 @@ function notifyChannelEntries(value: unknown): NotifyChannelEntry[] { * delivers nothing whatever it names (it records a skipped step), and a * messaging service with no `getKnownChannels()` (another implementation of * the service) cannot be enumerated: neither is judged. Nor is a reader - * that throws or answers something other than a list: an unreadable - * registry gives no verdict, and the save goes on as before. + * that throws, answers something other than a list, or answers a list + * with any member that is not a `{ id: string }`: an unreadable registry + * gives no verdict, and the save goes on as before. * * Read per request and recorded nowhere: the answer is the registry as it * stands at this save (AGENTS.md, "Startup registry reads"). @@ -2328,8 +2329,10 @@ async function refuseUnknownNotifyChannels( // A reader that throws, or answers anything but a list, is a registry this // door cannot read: not judged, like a service with no reader at all. The // save goes on as it did before this check existed, and a delivery on an - // unknown channel still reports itself at run time. Members that are not a - // `{ id: string }` are not channels and are left out of the roster. + // unknown channel still reports itself at run time. So is a list with any + // member that is not a `{ id: string }` (the declared `NotifyChannelRegistry` + // shape): dropping such members would leave a roster that misses channels + // the reader does know, and refuse every name it carries. let read: unknown; try { read = messaging.getKnownChannels(); @@ -2337,10 +2340,10 @@ async function refuseUnknownNotifyChannels( return undefined; } if (!Array.isArray(read)) return undefined; - const known = (read as unknown[]).filter( - (entry): entry is { id: string; configured: boolean } => - !!entry && typeof entry === 'object' && typeof (entry as { id?: unknown }).id === 'string', - ); + const isChannel = (entry: unknown): entry is { id: string; configured: boolean } => + !!entry && typeof entry === 'object' && typeof (entry as { id?: unknown }).id === 'string'; + if (!(read as unknown[]).every(isChannel)) return undefined; + const known = read as Array<{ id: string; configured: boolean }>; const knownIds = known.map((entry) => entry.id); const lines: string[] = []; diff --git a/packages/spec/src/migrations/entries/semantic/18.notify-channel-unknown-refused.ts b/packages/spec/src/migrations/entries/semantic/18.notify-channel-unknown-refused.ts index e85b8ab567f..67b864fd1ff 100644 --- a/packages/spec/src/migrations/entries/semantic/18.notify-channel-unknown-refused.ts +++ b/packages/spec/src/migrations/entries/semantic/18.notify-channel-unknown-refused.ts @@ -15,11 +15,13 @@ export const entry: SemanticMigration = { 'A channel is code a plugin registers with the messaging service, so a name nothing registers is a typo or a ' + 'missing plugin. The automation write doors saved such a flow with 200; every delivery on that channel then ' + 'failed at run time with "channel NAME not registered" and a step warning. The doors now refuse it 400 ' - + 'VALIDATION_FAILED at nodes.N.config.channels, naming the node and the channel with a did-you-mean and listing ' - + 'the registered channels. A channel whose transport is not configured yet (email with no email service) is ' - + 'known and still accepted. Not judged: a deployment with no messaging service, a flow a package ships, a flow ' - + 'stored through the metadata door, and a stored row re-registered at boot. There is no mechanical rewrite: ' - + 'only the author knows which channel was meant.', + + 'VALIDATION_FAILED, naming the node and the channel at its path (nodes.N.config.channels, ' + + 'nodes.N.config.channels.M for a list member, a longer path inside a region body) with a did-you-mean and ' + + 'listing the registered channels. A channel whose transport is not configured yet (email with no email ' + + 'service) is known and still accepted. Not judged: a deployment with no messaging service, one whose channel ' + + 'reader throws, answers no list or answers a list with a member that is not a channel, a save before ' + + 'kernel:ready has settled, a flow a package ships, a flow stored through the metadata door, and a stored row ' + + 're-registered at boot. There is no mechanical rewrite: only the author knows which channel was meant.', acceptanceCriteria: 'POST /api/v1/automation with the flow, every notify node naming registered channels, answers 200, and ' + 'GET /api/v1/automation/NAME serves it.', From 36d24369d60988be2b7642184887d3962f487b68 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 12:44:42 +0000 Subject: [PATCH 2/4] chore: move the notify channel roster fix off this branch The fold is split: that fix now lives on its own branch, and this branch carries only the addressed automation route declarations. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01QsR2jUZKdq3PK2Sab53cT3 --- ...-notify-channel-roster-malformed-member.md | 13 ------------ ...automation-authoring-doors-durable.test.ts | 20 +------------------ packages/runtime/src/domains/automation.ts | 19 ++++++++---------- .../18.notify-channel-unknown-refused.ts | 12 +++++------ 4 files changed, 14 insertions(+), 50 deletions(-) delete mode 100644 .changeset/32733-notify-channel-roster-malformed-member.md diff --git a/.changeset/32733-notify-channel-roster-malformed-member.md b/.changeset/32733-notify-channel-roster-malformed-member.md deleted file mode 100644 index e3d6d40c8e7..00000000000 --- a/.changeset/32733-notify-channel-roster-malformed-member.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -'@objectstack/runtime': patch -'@objectstack/spec': patch ---- - -fix(runtime): a channel list with a member off the declared shape is not judged at the automation save doors, so it no longer refuses every channel - -Clause-②: no -Metadata-protocol: none - -The `/automation` write doors (`POST /api/v1/automation`, `PUT /api/v1/automation/NAME`, `POST /api/v1/automation/NAME/clone`) read the messaging service's `getKnownChannels()` to refuse a `notify` node naming a channel nothing registers. A reader that throws or answers no list was already not judged. A list whose members were not all `{ id: string }` (the declared shape) had those members dropped instead, so a reader answering bare channel ids left an empty roster and every named channel was refused `400 VALIDATION_FAILED`. Such a list is now an unreadable registry like the other two: not judged, and the save goes on as it did before the check existed. No first-party messaging service answers that shape; `MessagingService.getKnownChannels()` answers the declared one, and a flow naming an unknown channel on it is refused exactly as before. - -The `notify-channel-unknown-refused` entry `os migrate meta` prints now lists every not-judged case the doors have (a save before `kernel:ready` has settled, and an unreadable channel reader, beside the four it named) and the paths a refusal names (`nodes.N.config.channels`, `nodes.N.config.channels.M` for a list member, a longer path inside a region body). Data text only. diff --git a/packages/runtime/src/domains/automation-authoring-doors-durable.test.ts b/packages/runtime/src/domains/automation-authoring-doors-durable.test.ts index 0170338da8b..5aab987f96a 100644 --- a/packages/runtime/src/domains/automation-authoring-doors-durable.test.ts +++ b/packages/runtime/src/domains/automation-authoring-doors-durable.test.ts @@ -66,9 +66,7 @@ const storeRefusal = () => Object.assign(new Error('flow/x failed spec validatio * And whether the kernel's `kernel:ready` has settled (`hasBootPhaseSettled`). */ interface ChannelComposition { - messaging?: - | ReadonlyArray<{ id: string; configured: boolean }> - | 'no-reader' | 'reader-throws' | 'reader-not-a-list' | 'reader-bare-ids' | 'reader-one-bare-id'; + messaging?: ReadonlyArray<{ id: string; configured: boolean }> | 'no-reader' | 'reader-throws' | 'reader-not-a-list'; /** `'throws'`: the kernel's boot-phase reader itself throws, so the check cannot finish. */ ready?: boolean | 'throws'; } @@ -103,10 +101,6 @@ function boot({ protocol: mode = 'real', messaging, ready = false }: { protocol? if (messaging === 'no-reader') services.messaging = { emit: async () => ({}) }; else if (messaging === 'reader-throws') services.messaging = { getKnownChannels: () => { throw new Error('registry unreadable'); } }; else if (messaging === 'reader-not-a-list') services.messaging = { getKnownChannels: () => ({ inbox: true }) }; - else if (messaging === 'reader-bare-ids') services.messaging = { getKnownChannels: () => ['inbox', 'email'] }; - else if (messaging === 'reader-one-bare-id') { - services.messaging = { getKnownChannels: () => [{ id: 'inbox', configured: true }, 'email'] }; - } else if (messaging) services.messaging = { getKnownChannels: () => messaging.map((entry) => ({ ...entry })) }; const resolve = (name: string): unknown => services[name]; const kernel = { @@ -393,18 +387,6 @@ describe('a notify node naming a channel no plugin registers is refused at the s } }); - it('a list with any member that is not a `{ id: string }` is unreadable, not judged: a channel it names is never refused', async () => { - // The reader knows `email`, spelled off the declared shape: dropping the - // member would leave a roster without it and refuse the node. - for (const messaging of ['reader-bare-ids', 'reader-one-bare-id'] as const) { - const h = boot({ messaging, ready: true }); - const { response } = await h.dispatcher.handleAutomation('', 'POST', notifyFlowOf(NEW, 'email'), AUTHOR(), undefined); - expect(statusOf(response), messaging).toBe(200); - expect(h.saveMetaItem, messaging).toHaveBeenCalledTimes(1); - expect(h.held(NEW), messaging).toBeDefined(); - } - }); - it('a check that cannot finish undoes the registration before the error leaves: nothing registered-but-unsaved', async () => { const h = boot({ messaging: STOCK_CHANNELS, ready: 'throws' }); const before = h.held(CUSTOMER); diff --git a/packages/runtime/src/domains/automation.ts b/packages/runtime/src/domains/automation.ts index 9580228d1f0..2ff2dc9a289 100644 --- a/packages/runtime/src/domains/automation.ts +++ b/packages/runtime/src/domains/automation.ts @@ -2298,9 +2298,8 @@ function notifyChannelEntries(value: unknown): NotifyChannelEntry[] { * delivers nothing whatever it names (it records a skipped step), and a * messaging service with no `getKnownChannels()` (another implementation of * the service) cannot be enumerated: neither is judged. Nor is a reader - * that throws, answers something other than a list, or answers a list - * with any member that is not a `{ id: string }`: an unreadable registry - * gives no verdict, and the save goes on as before. + * that throws or answers something other than a list: an unreadable + * registry gives no verdict, and the save goes on as before. * * Read per request and recorded nowhere: the answer is the registry as it * stands at this save (AGENTS.md, "Startup registry reads"). @@ -2329,10 +2328,8 @@ async function refuseUnknownNotifyChannels( // A reader that throws, or answers anything but a list, is a registry this // door cannot read: not judged, like a service with no reader at all. The // save goes on as it did before this check existed, and a delivery on an - // unknown channel still reports itself at run time. So is a list with any - // member that is not a `{ id: string }` (the declared `NotifyChannelRegistry` - // shape): dropping such members would leave a roster that misses channels - // the reader does know, and refuse every name it carries. + // unknown channel still reports itself at run time. Members that are not a + // `{ id: string }` are not channels and are left out of the roster. let read: unknown; try { read = messaging.getKnownChannels(); @@ -2340,10 +2337,10 @@ async function refuseUnknownNotifyChannels( return undefined; } if (!Array.isArray(read)) return undefined; - const isChannel = (entry: unknown): entry is { id: string; configured: boolean } => - !!entry && typeof entry === 'object' && typeof (entry as { id?: unknown }).id === 'string'; - if (!(read as unknown[]).every(isChannel)) return undefined; - const known = read as Array<{ id: string; configured: boolean }>; + const known = (read as unknown[]).filter( + (entry): entry is { id: string; configured: boolean } => + !!entry && typeof entry === 'object' && typeof (entry as { id?: unknown }).id === 'string', + ); const knownIds = known.map((entry) => entry.id); const lines: string[] = []; diff --git a/packages/spec/src/migrations/entries/semantic/18.notify-channel-unknown-refused.ts b/packages/spec/src/migrations/entries/semantic/18.notify-channel-unknown-refused.ts index 67b864fd1ff..e85b8ab567f 100644 --- a/packages/spec/src/migrations/entries/semantic/18.notify-channel-unknown-refused.ts +++ b/packages/spec/src/migrations/entries/semantic/18.notify-channel-unknown-refused.ts @@ -15,13 +15,11 @@ export const entry: SemanticMigration = { 'A channel is code a plugin registers with the messaging service, so a name nothing registers is a typo or a ' + 'missing plugin. The automation write doors saved such a flow with 200; every delivery on that channel then ' + 'failed at run time with "channel NAME not registered" and a step warning. The doors now refuse it 400 ' - + 'VALIDATION_FAILED, naming the node and the channel at its path (nodes.N.config.channels, ' - + 'nodes.N.config.channels.M for a list member, a longer path inside a region body) with a did-you-mean and ' - + 'listing the registered channels. A channel whose transport is not configured yet (email with no email ' - + 'service) is known and still accepted. Not judged: a deployment with no messaging service, one whose channel ' - + 'reader throws, answers no list or answers a list with a member that is not a channel, a save before ' - + 'kernel:ready has settled, a flow a package ships, a flow stored through the metadata door, and a stored row ' - + 're-registered at boot. There is no mechanical rewrite: only the author knows which channel was meant.', + + 'VALIDATION_FAILED at nodes.N.config.channels, naming the node and the channel with a did-you-mean and listing ' + + 'the registered channels. A channel whose transport is not configured yet (email with no email service) is ' + + 'known and still accepted. Not judged: a deployment with no messaging service, a flow a package ships, a flow ' + + 'stored through the metadata door, and a stored row re-registered at boot. There is no mechanical rewrite: ' + + 'only the author knows which channel was meant.', acceptanceCriteria: 'POST /api/v1/automation with the flow, every notify node naming registered channels, answers 200, and ' + 'GET /api/v1/automation/NAME serves it.', From 534e0c14462cfb193f98592201092b17f65df66f Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 12:45:50 +0000 Subject: [PATCH 3/4] wip: declare the addressed automation shapes as domain-decided Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01QsR2jUZKdq3PK2Sab53cT3 --- ...mation-every-verb.hono.integration.test.ts | 42 +++++++++++++++++++ packages/runtime/src/dispatcher-plugin.ts | 9 ++++ 2 files changed, 51 insertions(+) diff --git a/packages/runtime/src/automation-every-verb.hono.integration.test.ts b/packages/runtime/src/automation-every-verb.hono.integration.test.ts index e72f0292f86..a862d173aab 100644 --- a/packages/runtime/src/automation-every-verb.hono.integration.test.ts +++ b/packages/runtime/src/automation-every-verb.hono.integration.test.ts @@ -25,6 +25,14 @@ import { createDispatcherPlugin } from './dispatcher-plugin.js'; * `405` with the verbs it serves (`automationRouteAllow`, pinned against the * ledger in `route-ledger.conformance.test.ts`). * + * An address is served exactly as its bare path (ADR-0150 D5), so the + * addressed shapes of those rows (`/automation/:ns/:name/runs`, + * `/automation/:ns/:name/trigger`, `/automation/trigger/:ns/:name`) are + * declared too, and answer the same as their bare row: an anonymous caller + * `401`, a signed-in one the domain's `405`. `crm` is an installed namespace + * holding `send_digest` (an ObjectQL registry double answering the holder + * table the address reads). + * * The door is read off the body, as in `actions-every-verb.hono.integration.test.ts`: * the dispatcher's envelope fills `error.httpStatus` and carries no * `error.details`; the transport's fills `error.details` and no `httpStatus`. @@ -42,8 +50,19 @@ const ROWS = [ ['/automation/send_digest/trigger', 'GET', 'POST'], ['/automation/connectors/credential-refs', 'POST', 'GET'], ['/automation/trigger/send_digest', 'GET', 'POST'], + // The addressed shapes: three segments, the namespace `crm` in front of the name. + ['/automation/crm/send_digest/runs', 'DELETE', 'GET'], + ['/automation/crm/send_digest/runs', 'POST', 'GET'], + ['/automation/crm/send_digest/runs', 'PUT', 'GET'], + ['/automation/crm/send_digest/trigger', 'GET', 'POST'], + ['/automation/trigger/crm/send_digest', 'GET', 'POST'], ] as const; +/** The installed namespace the addressed rows name, and the package holding `send_digest` under it. */ +const CRM = 'com.crm.pkg'; +const NAMESPACES: Record = { [CRM]: 'crm' }; +const HOLDERS: Record = { 'flow:send_digest': [CRM] }; + /** Every flow name the automation double was asked to run. */ const executed: string[] = []; @@ -67,6 +86,18 @@ function fakeAuthPlugin(): Plugin { return { success: true, output: {} }; }, }); + // The holder table the address reads: `crm` is installed and holds `send_digest`. + const holdersOf = (type: string, name: string) => HOLDERS[`${type}:${name}`] ?? []; + ctx.registerService('objectql', { + registry: { + getNamespaceOwners: (ns: string) => Object.keys(NAMESPACES).filter((id) => NAMESPACES[id] === ns), + packageScopedHoldersOf: holdersOf, + getPackageScopedItem: (type: string, name: string, packageId: string) => + (holdersOf(type, name).includes(packageId) ? { name, _packageId: packageId } : undefined), + getEnvironmentScopedItem: () => undefined, + getPackage: (id: string) => (NAMESPACES[id] ? { manifest: { id, namespace: NAMESPACES[id] } } : undefined), + }, + }); }, }; } @@ -190,6 +221,17 @@ describe('every verb on a two-segment /api/v1/automation path reaches the automa expect(status, JSON.stringify(body)).toBe(200); expect(executed).toEqual(['send_digest']); }); + + // ── control: the declarations hand only unserved verbs to the domain; a served verb on an address runs ── + for (const shape of ['/automation/crm/send_digest/trigger', '/automation/trigger/crm/send_digest']) { + it(`CONTROL — signed-in POST ${prefix}${shape} runs the addressed flow`, async () => { + executed.length = 0; + const { status, body } = await call('POST', `${prefix}${shape}`, true); + + expect(status, JSON.stringify(body)).toBe(200); + expect(executed).toEqual(['send_digest']); + }); + } } // ── the claim is narrow: a shape no mount matches stays the transport's 404 ── diff --git a/packages/runtime/src/dispatcher-plugin.ts b/packages/runtime/src/dispatcher-plugin.ts index c53051a9b30..298ce680e55 100644 --- a/packages/runtime/src/dispatcher-plugin.ts +++ b/packages/runtime/src/dispatcher-plugin.ts @@ -2074,6 +2074,15 @@ export function createDispatcherPlugin(config: DispatcherPluginConfig = {}): Plu domainDecidesEveryVerb('GET', `${base}/automation/:ns/:name`); domainDecidesEveryVerb('GET', `${base}/automation/:name/runs`); domainDecidesEveryVerb('GET', `${base}/automation/connectors/credential-refs`); + // An address is served exactly as its bare path (ADR-0150 D5), + // so the addressed shapes of the bare rows above are declared + // too: the addressed `/runs` list, `trigger` and legacy trigger. + // Left undeclared, a verb they are not served under was the + // transport's `405` (its envelope, `Allow: GET, HEAD`, and that + // answer ahead of an anonymous caller's `401`), not the domain's. + domainDecidesEveryVerb('GET', `${base}/automation/:ns/:name/runs`); + domainDecidesEveryVerb('POST', `${base}/automation/:ns/:name/trigger`); + domainDecidesEveryVerb('POST', `${base}/automation/trigger/:ns/:name`); for (const { verb, pattern, readsBody, encode } of addressedAutomationRoutes) { server![verb](`${base}${pattern}`, async (req: any, res: any) => { try { From 9bdd492b633e33904e95d07fd3048a0a5cd0095c Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 13:04:15 +0000 Subject: [PATCH 4/4] wip: changeset and the no-namespace control Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01QsR2jUZKdq3PK2Sab53cT3 --- .changeset/33026-addressed-automation-every-verb.md | 12 ++++++++++++ .../automation-every-verb.hono.integration.test.ts | 10 ++++++++++ 2 files changed, 22 insertions(+) create mode 100644 .changeset/33026-addressed-automation-every-verb.md diff --git a/.changeset/33026-addressed-automation-every-verb.md b/.changeset/33026-addressed-automation-every-verb.md new file mode 100644 index 00000000000..5596bb547b6 --- /dev/null +++ b/.changeset/33026-addressed-automation-every-verb.md @@ -0,0 +1,12 @@ +--- +'@objectstack/runtime': patch +--- + +fix(runtime): an addressed `/automation/:ns/:name/(runs|trigger)` route under a verb it does not serve answers the automation domain, as its bare path does + +Clause-②: no +Metadata-protocol: none + +On the standalone server (the dispatcher plugin on an HTTP adapter), an address is served exactly as its bare path (ADR-0150 D5), but a verb the route is not served under was answered differently on the two. `DELETE /api/v1/automation/send_digest/runs` answered the automation domain's `405` with `Allow: GET` in the dispatcher's envelope, and `401 UNAUTHENTICATED` to an anonymous caller. `DELETE /api/v1/automation/crm/send_digest/runs` answered the transport's `405` with `Allow: GET, HEAD` and an `error.details` envelope, to an anonymous caller too. The same held for `POST` / `PUT` on the addressed `/runs`, `GET` on `/automation/NS/NAME/trigger` and `GET` on `/automation/trigger/NS/NAME`. + +The dispatcher now declares those three addressed shapes as routes whose domain decides every verb, as it already did for their bare two-segment shapes. Each of them answers an anonymous caller `401`, and a signed-in caller the domain's `405` with the verbs the route serves (`Allow: GET` for `/runs`, `Allow: POST` for both triggers) in the dispatcher's envelope. A served verb on an address (`GET .../runs`, `POST .../trigger`) is unchanged, and so is a three-segment path whose first segment is no installed namespace: under an unserved verb it now answers the dispatcher's `404 ROUTE_NOT_FOUND`, as the same path does under `GET`. diff --git a/packages/runtime/src/automation-every-verb.hono.integration.test.ts b/packages/runtime/src/automation-every-verb.hono.integration.test.ts index a862d173aab..627c4a02b4d 100644 --- a/packages/runtime/src/automation-every-verb.hono.integration.test.ts +++ b/packages/runtime/src/automation-every-verb.hono.integration.test.ts @@ -222,6 +222,16 @@ describe('every verb on a two-segment /api/v1/automation path reaches the automa expect(executed).toEqual(['send_digest']); }); + // ── control: a first segment that is no installed namespace is no address — declined under every verb ── + for (const method of ['GET', 'DELETE']) { + it(`CONTROL — signed-in ${method} ${prefix}/automation/no_such_ns/send_digest/runs → the dispatcher's no-route 404, never a 405`, async () => { + const { status, allow, body } = await call(method, `${prefix}/automation/no_such_ns/send_digest/runs`, true); + + expect([status, allow]).toEqual([404, null]); + expect(body?.error?.code).toBe('ROUTE_NOT_FOUND'); + }); + } + // ── control: the declarations hand only unserved verbs to the domain; a served verb on an address runs ── for (const shape of ['/automation/crm/send_digest/trigger', '/automation/trigger/crm/send_digest']) { it(`CONTROL — signed-in POST ${prefix}${shape} runs the addressed flow`, async () => {