From 1047cbcf458023ec85e24cf684ea1de985d50a2a Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 02:01:07 +0000 Subject: [PATCH 1/6] fix(service-automation)!: a connector_action node refuses an input key its action does not declare The connector_action node judges the evaluated input against the action's inputSchema with the undeclared-key judgment on: a key outside an object schema's properties/required is refused with VALIDATION_ERROR, naming the node, the key and the declared keys, and nothing is sent to the provider. A schema that admits more keys (additionalProperties true or a schema, patternProperties, a composition keyword) or lists no properties declares open input and still dispatches. The pull door does not opt in. Claude-Session: https://claude.ai/code/session_016WV4cxHwXNcGcAHNerZsom Co-authored-by: Claude --- .../builtin/connector-input-schema.test.ts | 108 +++++++++++++++- .../src/builtin/connector-nodes.ts | 19 ++- .../src/connector-input-schema.ts | 118 +++++++++++++++++- 3 files changed, 234 insertions(+), 11 deletions(-) diff --git a/packages/services/service-automation/src/builtin/connector-input-schema.test.ts b/packages/services/service-automation/src/builtin/connector-input-schema.test.ts index faa89752aa2..762e74b1e23 100644 --- a/packages/services/service-automation/src/builtin/connector-input-schema.test.ts +++ b/packages/services/service-automation/src/builtin/connector-input-schema.test.ts @@ -24,12 +24,19 @@ * value is computed by an envelope. * 4. **Only the judged subset refuses.** `required`, `type` (with OpenAPI 3.0 * `nullable`), `properties` and `items` are judged; keywords outside that - * subset (`$ref`, `oneOf`, `enum`, `format`, `additionalProperties`, …) - * never refuse a call, and an action with no `inputSchema` dispatches - * whatever it is given. + * subset (`$ref`, `oneOf`, `enum`, `format`, …) never refuse a call, and an + * action with no `inputSchema` dispatches whatever it is given. * 5. **The refusal is routable.** The input can come from run data, so the * failure is a `runtime` one: a `fault` edge receives it, with * `$error.code === 'VALIDATION_ERROR'`. + * 6. **A key the action does not declare is refused, nothing sent** (#33553). + * A key outside an object schema's `properties` / `required` — at the top + * of `connectorConfig.input` or inside a section — fails the step naming + * the node, the key and the keys declared there, the EVALUATED input + * included. A schema that admits more keys (`additionalProperties` true + * or a schema, `patternProperties`, a composition keyword) or lists no + * `properties` declares open input, and still dispatches. The connector + * pull door, which does not ask for this judgment, is unchanged. */ import { describe, expect, it } from 'vitest'; @@ -37,6 +44,7 @@ import { AutomationEngine } from '../engine.js'; import type { NodeExecutor } from '../engine.js'; import { installBuiltinNodes } from './index.js'; import type { Connector } from '@objectstack/spec/integration'; +import { judgeConnectorInput } from '../connector-input-schema.js'; function silentLogger(): any { return { info() {}, warn() {}, error() {}, debug() {}, child() { return silentLogger(); } }; @@ -93,6 +101,11 @@ const CONNECTOR = { { key: 'post', label: 'Post', inputSchema: SLACK_POST }, { key: 'update', label: 'Update', inputSchema: { ...SLACK_POST, required: ['channel', 'ts'] } }, { key: 'free', label: 'Free-form' }, + { key: 'openTrue', label: 'Open (true)', inputSchema: { ...SLACK_POST, additionalProperties: true } }, + { key: 'openSchema', label: 'Open (schema)', inputSchema: { ...SLACK_POST, additionalProperties: { type: 'string' } } }, + { key: 'openPattern', label: 'Open (pattern)', inputSchema: { ...SLACK_POST, patternProperties: { '^x_': {} } } }, + { key: 'openComposed', label: 'Open (composed)', inputSchema: { ...SLACK_POST, allOf: [{ properties: { thread_ts: { type: 'string' } } }] } }, + { key: 'unlisted', label: 'No properties', inputSchema: { type: 'object' } }, ], } as Connector; @@ -113,6 +126,11 @@ function makeEngine(): { engine: AutomationEngine; sent: Array<{ action: string; post: handler('post'), update: handler('update'), free: handler('free'), + openTrue: handler('openTrue'), + openSchema: handler('openSchema'), + openPattern: handler('openPattern'), + openComposed: handler('openComposed'), + unlisted: handler('unlisted'), }); const faults: Seen[] = []; engine.registerNodeExecutor({ @@ -261,9 +279,9 @@ describe('3. a valid call dispatches as before', () => { }); describe('4. only the judged subset refuses', () => { - it('values outside `enum`/`format`/`$ref`/`oneOf`, and keys outside `properties`, still dispatch', async () => { + it('values outside `enum`/`format`/`$ref`/`oneOf` still dispatch', async () => { const { engine, sent } = makeEngine(); - const input = { text: 'x', mode: 'sideways', meta: 42, when: 'not a date', either: true, extra: 'kept' }; + const input = { text: 'x', mode: 'sideways', meta: 42, when: 'not a date', either: true }; const result = await run(engine, 'ok_unjudged', 'echo', input); expect(result.success, result.error).toBe(true); expect(sent).toEqual([{ action: 'echo', input }]); @@ -276,3 +294,83 @@ describe('4. only the judged subset refuses', () => { expect(sent).toEqual([{ action: 'free', input: {} }]); }); }); + +describe('6. a key the action does not declare is refused before dispatch (#33553)', () => { + it('a top-level key outside `properties` fails naming the node, the key and the declared keys; nothing is sent', async () => { + const { engine, sent, faults } = makeEngine(); + const result = await run(engine, 'stale_top', 'post', { channel: 'c1', text: 'hi', stale_key: 'from the old action' }, { fault: true }); + expect(sent).toEqual([]); + expect(faults).toHaveLength(1); + expect(faults[0]?.code).toBe('VALIDATION_ERROR'); + expect(faults[0]?.message).toContain("connector_action 'call'"); + expect(faults[0]?.message).toContain("'stale_key'"); + expect(faults[0]?.message).toContain("'channel', 'text', 'blocks'"); + expect(result.success).toBe(true); + }); + + it('without a fault edge the step fails, and a `null` undeclared value is refused too', async () => { + const { engine, sent } = makeEngine(); + const result = await run(engine, 'stale_null', 'post', { channel: 'c1', stale_key: null }); + expect(result.success).toBe(false); + expect(sent).toEqual([]); + expect(result.error).toContain("'stale_key'"); + }); + + it('a key a closed schema (`additionalProperties: false`) does not declare is refused', async () => { + const { engine, sent } = makeEngine(); + const result = await run(engine, 'stale_closed', 'echo', { text: 'x', extra: 'dropped?' }); + expect(result.success).toBe(false); + expect(sent).toEqual([]); + expect(result.error).toContain("'extra'"); + }); + + it('a key inside a section is judged against the section, named by its path', async () => { + const { engine, sent } = makeEngine(); + const result = await run(engine, 'stale_nested', 'getPet', { path: { petId: 1 }, query: { verbose: true, stale: 1 } }); + expect(result.success).toBe(false); + expect(sent).toEqual([]); + expect(result.error).toContain("'query.stale'"); + expect(result.error).toContain("'verbose', 'tag'"); + }); + + it('the EVALUATED input is judged: an envelope computing an undeclared key is refused', async () => { + const { engine, sent } = makeEngine(); + const result = await run(engine, 'stale_envelope', 'getPet', { path: { dialect: 'cel', source: '{"petId": rec.petId, "owner": rec.name}' } }); + expect(result.success).toBe(false); + expect(sent).toEqual([]); + expect(result.error).toContain("'path.owner'"); + }); + + it('a schema that admits more keys, or lists no `properties`, declares open input and dispatches every key', async () => { + const { engine, sent } = makeEngine(); + for (const [action, input] of [ + ['openTrue', { channel: 'c1', extra: 'kept' }], + ['openSchema', { channel: 'c1', extra: 'kept' }], + ['openPattern', { channel: 'c1', x_extra: 'kept' }], + ['openComposed', { channel: 'c1', thread_ts: '1.2' }], + ['unlisted', { anything: 'kept' }], + ] as const) { + const result = await run(engine, `open_${action}`, action, input); + expect(result.success, `${action}: ${result.error}`).toBe(true); + } + expect(sent.map((s) => s.input)).toEqual([ + { channel: 'c1', extra: 'kept' }, + { channel: 'c1', extra: 'kept' }, + { channel: 'c1', x_extra: 'kept' }, + { channel: 'c1', thread_ts: '1.2' }, + { anything: 'kept' }, + ]); + }); + + it('a call holding only declared keys dispatches as before', async () => { + const { engine, sent } = makeEngine(); + const result = await run(engine, 'declared_only', 'post', { channel: 'c1', text: 'hi' }); + expect(result.success, result.error).toBe(true); + expect(sent).toEqual([{ action: 'post', input: { channel: 'c1', text: 'hi' } }]); + }); + + it('the judgment is opt-in: a door that does not ask for it (the connector pull door) is unchanged', () => { + expect(judgeConnectorInput(SLACK_POST, { channel: 'c1', extra: 'kept' })).toBeUndefined(); + expect(judgeConnectorInput(SLACK_POST, { channel: 'c1', extra: 'kept' }, { refuseUndeclaredKeys: true })?.undeclaredKey).toBe(true); + }); +}); diff --git a/packages/services/service-automation/src/builtin/connector-nodes.ts b/packages/services/service-automation/src/builtin/connector-nodes.ts index b995d9673e7..2447ee3afd3 100644 --- a/packages/services/service-automation/src/builtin/connector-nodes.ts +++ b/packages/services/service-automation/src/builtin/connector-nodes.ts @@ -5,7 +5,7 @@ import { defineActionDescriptor } from '@objectstack/spec/automation'; import type { AutomationEngine, ConnectorActionContext } from '../engine.js'; import { refuseNode } from '../guard-refusal.js'; import { describeHold } from '../plugin-extension-api.js'; -import { findConnectorActionInputSchema, judgeConnectorInput, TEXT_FOR_SCALAR_HINT } from '../connector-input-schema.js'; +import { findConnectorActionInputSchema, judgeConnectorInput, TEXT_FOR_SCALAR_HINT, UNDECLARED_KEY_HINT } from '../connector-input-schema.js'; import { resolveValueSlotMap } from './value-slot-map.js'; /** @@ -146,9 +146,23 @@ export function registerConnectorNodes(engine: AutomationEngine, ctx: PluginCont // is `connector-input-schema.ts`'s, the one the pull door runs too // (#28040). A `runtime` failure, not a guard: the input can come // from run data, so a `fault` edge may handle it. + // + // [#33553] A key the action's schema does not declare is refused + // here too, instead of reaching the provider — the shape a + // connector or action switch leaves behind in a stored flow. Judged + // HERE, at run time, and not at registration: the boot flow pull + // registers every flow before a declarative connector materializes + // (and a later-starting plugin, a package's `kernel:ready` + // rehydrate or a stored entry at `kernel:bootstrapped` adds its + // connector after that), and an instance's schema is re-read from + // its upstream on every re-materialization. A registration-time + // verdict would be one the boot can still contradict (AGENTS.md + // "Startup registry reads"); this one reads the schema of the very + // instance the call is about to dispatch to. const verdict = judgeConnectorInput( findConnectorActionInputSchema(engine, cfg.connectorId, cfg.actionId, packageId), input, + { refuseUndeclaredKeys: true }, ); if (verdict) { return { @@ -159,7 +173,8 @@ export function registerConnectorNodes(engine: AutomationEngine, ctx: PluginCont + `does not match the action's inputSchema — ${verdict.violations}` + `. Nothing was sent. Fix connectorConfig.input so it satisfies the inputSchema ` + `GET /api/v1/automation/connectors lists for this action.` - + (verdict.textForScalar ? TEXT_FOR_SCALAR_HINT : ''), + + (verdict.textForScalar ? TEXT_FOR_SCALAR_HINT : '') + + (verdict.undeclaredKey ? UNDECLARED_KEY_HINT : ''), }; } diff --git a/packages/services/service-automation/src/connector-input-schema.ts b/packages/services/service-automation/src/connector-input-schema.ts index 6a55440ec2a..b6e50022ee6 100644 --- a/packages/services/service-automation/src/connector-input-schema.ts +++ b/packages/services/service-automation/src/connector-input-schema.ts @@ -14,6 +14,12 @@ * schema an author picks the action by on `GET /connectors`, so what is * enforced is what was shown. Each door words its own refusal around the * sentence {@link judgeConnectorInput} returns. + * + * [#33553] A door may also ask for the keys the schema does not declare + * ({@link ConnectorInputJudgeOptions.refuseUndeclaredKeys}): the + * `connector_action` node does, so a key left in `connectorConfig.input` by a + * connector or action switch is refused at run time instead of being sent to + * the provider. See {@link declaredKeysOf} for which schemas declare their keys. */ import type { ConnectorDescriptor } from '@objectstack/spec/integration'; @@ -35,6 +41,19 @@ export interface ConnectorInputVerdict { violations: string; /** A text value met an `integer` / `number` / `boolean` parameter — the door appends {@link TEXT_FOR_SCALAR_HINT}. */ textForScalar: boolean; + /** [#33553] A key the schema does not declare was found — the door appends {@link UNDECLARED_KEY_HINT}. */ + undeclaredKey: boolean; +} + +/** How a door asks {@link judgeConnectorInput} to judge. */ +export interface ConnectorInputJudgeOptions { + /** + * [#33553] Also refuse every key of an object the schema declares its keys + * for ({@link declaredKeysOf}) that is not one of them, at every level the + * walk reaches. Off by default: a door that sends only keys it adds itself + * leaves it off until its own authors are told. + */ + refuseUndeclaredKeys?: boolean; } /** @@ -47,6 +66,15 @@ export const TEXT_FOR_SCALAR_HINT = ` A text value for an integer, number or boolean parameter is not converted: ` + `cast it in a CEL envelope with int(), double() or bool().`; +/** + * [#33553] The hint a refusal appends when {@link ConnectorInputVerdict.undeclaredKey} + * is set: the key is refused, never passed through, and a connector or action + * switch is the usual way one is left behind. + */ +export const UNDECLARED_KEY_HINT = + ` A key the action does not declare is not sent to the provider: remove it (a connector or action ` + + `switch can leave the previous action's keys behind), or pick the action that declares it.`; + /** The `inputSchema` `connectorId.actionId` declares, or `undefined` when it declares none (or is not registered). */ export function findConnectorActionInputSchema( source: ConnectorInputSchemaSource, @@ -68,8 +96,17 @@ export function findConnectorActionInputSchema( * every value it adds — against `inputSchema`. `undefined` means nothing is * wrong (or the action declares no schema), so the call may be dispatched. */ -export function judgeConnectorInput(inputSchema: unknown, input: unknown): ConnectorInputVerdict | undefined { - const found: InputSchemaViolations = { lines: [], textForScalar: false }; +export function judgeConnectorInput( + inputSchema: unknown, + input: unknown, + options: ConnectorInputJudgeOptions = {}, +): ConnectorInputVerdict | undefined { + const found: InputSchemaViolations = { + lines: [], + textForScalar: false, + undeclaredKey: false, + refuseUndeclaredKeys: options.refuseUndeclaredKeys === true, + }; collectInputSchemaViolations(inputSchema, input, '', found); if (found.lines.length === 0) return undefined; const shown = found.lines.slice(0, MAX_NAMED_VIOLATIONS); @@ -77,6 +114,7 @@ export function judgeConnectorInput(inputSchema: unknown, input: unknown): Conne return { violations: shown.join('; ') + (more > 0 ? `; and ${more} more` : ''), textForScalar: found.textForScalar, + undeclaredKey: found.undeclaredKey, }; } @@ -84,6 +122,59 @@ export function judgeConnectorInput(inputSchema: unknown, input: unknown): Conne interface InputSchemaViolations { lines: string[]; textForScalar: boolean; + undeclaredKey: boolean; + /** The door's {@link ConnectorInputJudgeOptions.refuseUndeclaredKeys}. */ + readonly refuseUndeclaredKeys: boolean; +} + +/** How many declared keys an undeclared-key violation lists before it summarises the rest as a count. */ +const MAX_LISTED_DECLARED_KEYS = 8; + +/** + * Keywords that can admit a key {@link declaredKeysOf} would not see in + * `properties` / `required`: pattern-matched keys, and every way a schema + * pulls in another schema's keys. A schema carrying one is read as OPEN. + */ +const KEY_ADMITTING_KEYWORDS = [ + 'patternProperties', '$ref', '$dynamicRef', 'allOf', 'anyOf', 'oneOf', + 'if', 'then', 'else', 'dependentSchemas', 'dependencies', +]; + +/** + * [#33553] The keys an object schema DECLARES, or `undefined` when it declares + * an open key set — the decision the `connector_action` node refuses by. + * + * Declared = the names in `properties` plus those in `required`. A schema + * declares its key set when it lists `properties`, or says + * `additionalProperties: false` (then an absent `properties` declares none). + * It is OPEN — every key accepted — when it explicitly admits more: + * `additionalProperties` (or `unevaluatedProperties`) set to anything but + * `false`, i.e. `true` or a schema, or a keyword in + * {@link KEY_ADMITTING_KEYWORDS}; and when it lists no `properties` at all, + * since it then names no input to hold a key against. This reads + * `properties` as the action's contract, not as JSON Schema's open default: + * none of the shipped connector producers writes `additionalProperties`, so + * under the default every key would pass — which is how a key no action + * reads reached the provider. + */ +function declaredKeysOf(schema: Record): string[] | undefined { + if (KEY_ADMITTING_KEYWORDS.some((k) => Object.prototype.hasOwnProperty.call(schema, k))) return undefined; + const additional = schema.additionalProperties; + if (additional !== undefined && additional !== false) return undefined; + const unevaluated = schema.unevaluatedProperties; + if (unevaluated !== undefined && unevaluated !== false) return undefined; + const properties = isPlainRecord(schema.properties) ? schema.properties : undefined; + if (!properties && additional !== false) return undefined; + const required = Array.isArray(schema.required) ? schema.required.filter((k): k is string => typeof k === 'string') : []; + return [...new Set([...Object.keys(properties ?? {}), ...required])]; +} + +/** The declared keys as an undeclared-key violation lists them: quoted, at most {@link MAX_LISTED_DECLARED_KEYS}. */ +function listDeclaredKeys(keys: readonly string[]): string { + if (keys.length === 0) return 'none'; + const shown = keys.slice(0, MAX_LISTED_DECLARED_KEYS).map((k) => `'${k}'`).join(', '); + const more = keys.length - MAX_LISTED_DECLARED_KEYS; + return more > 0 ? `${shown} and ${more} more` : shown; } /** How many violations one refusal names before it summarises the rest as a count. */ @@ -121,8 +212,10 @@ function matchesType(type: string, value: unknown, kind: string): boolean { * an OpenAPI document's operation (which may keep an unresolved `$ref`), an * MCP server's `tools/list` entry (any draft), or a code connector's literal. * A keyword outside the subset (`$ref`, `oneOf`/`anyOf`/`allOf`, `enum`, - * `format`, bounds, `additionalProperties`, …) never refuses a call: the - * remote still judges those, as it did before. A missing piece is the narrow + * `format`, bounds, …) never refuses a call: the remote still judges those, + * as it did before. [#33553] With `refuseUndeclaredKeys`, a key an object + * schema does not declare ({@link declaredKeysOf}) is refused at the level it + * appears, and those keywords only ever read a key set as open. A missing piece is the narrow * direction on purpose — a call this check refuses is one the declared * schema itself says is wrong under every draft. `null` on an optional * property counts as absent (see the property loop), and text is never @@ -175,6 +268,23 @@ function collectInputSchemaViolations(schema: unknown, value: unknown, path: str collectInputSchemaViolations(sub, record[key], path ? `${path}.${key}` : key, out); } } + // [#33553] A key the schema does not declare is refused where it + // appears, naming what is declared there. `undefined` is absent (it + // has no JSON spelling, so it is never sent); every other value — + // `null` included — would reach the provider. + const declared = out.refuseUndeclaredKeys ? declaredKeysOf(schema) : undefined; + if (declared) { + const known = new Set(declared); + for (const key of Object.keys(record)) { + if (known.has(key) || record[key] === undefined) continue; + const at = path ? `${path}.${key}` : key; + out.lines.push( + `'${at}' is not an input the action declares ` + + `(declared${path ? ` in '${path}'` : ''}: ${listDeclaredKeys(declared)})`, + ); + out.undeclaredKey = true; + } + } } else if (kind === 'array' && isPlainRecord(schema.items)) { (value as unknown[]).forEach((item, i) => collectInputSchemaViolations(schema.items, item, `${path}[${i}]`, out)); } From 134f9d84d1b60a2315db64b30050ebd93bd7fcb1 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 02:05:34 +0000 Subject: [PATCH 2/6] test(service-automation): snake_case flow names in the open-input pin Claude-Session: https://claude.ai/code/session_016WV4cxHwXNcGcAHNerZsom Co-authored-by: Claude --- .../src/builtin/connector-input-schema.test.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/services/service-automation/src/builtin/connector-input-schema.test.ts b/packages/services/service-automation/src/builtin/connector-input-schema.test.ts index 762e74b1e23..3805b978f5d 100644 --- a/packages/services/service-automation/src/builtin/connector-input-schema.test.ts +++ b/packages/services/service-automation/src/builtin/connector-input-schema.test.ts @@ -343,14 +343,14 @@ describe('6. a key the action does not declare is refused before dispatch (#3355 it('a schema that admits more keys, or lists no `properties`, declares open input and dispatches every key', async () => { const { engine, sent } = makeEngine(); - for (const [action, input] of [ - ['openTrue', { channel: 'c1', extra: 'kept' }], - ['openSchema', { channel: 'c1', extra: 'kept' }], - ['openPattern', { channel: 'c1', x_extra: 'kept' }], - ['openComposed', { channel: 'c1', thread_ts: '1.2' }], - ['unlisted', { anything: 'kept' }], + for (const [flow, action, input] of [ + ['open_true', 'openTrue', { channel: 'c1', extra: 'kept' }], + ['open_schema', 'openSchema', { channel: 'c1', extra: 'kept' }], + ['open_pattern', 'openPattern', { channel: 'c1', x_extra: 'kept' }], + ['open_composed', 'openComposed', { channel: 'c1', thread_ts: '1.2' }], + ['open_unlisted', 'unlisted', { anything: 'kept' }], ] as const) { - const result = await run(engine, `open_${action}`, action, input); + const result = await run(engine, flow, action, input); expect(result.success, `${action}: ${result.error}`).toBe(true); } expect(sent.map((s) => s.input)).toEqual([ From f1f1ace963915f9d8e2b656673d10e740eed8e5b Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 02:08:05 +0000 Subject: [PATCH 3/6] chore(changeset): service-automation minor, narrowing an undeclared connector_action input key Claude-Session: https://claude.ai/code/session_016WV4cxHwXNcGcAHNerZsom Co-authored-by: Claude --- ...53-connector-action-undeclared-input-key.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .changeset/33553-connector-action-undeclared-input-key.md diff --git a/.changeset/33553-connector-action-undeclared-input-key.md b/.changeset/33553-connector-action-undeclared-input-key.md new file mode 100644 index 00000000000..91311151e19 --- /dev/null +++ b/.changeset/33553-connector-action-undeclared-input-key.md @@ -0,0 +1,18 @@ +--- +'@objectstack/service-automation': minor +--- + +fix(service-automation)!: a `connector_action` node refuses an input key its action does not declare, instead of sending it to the provider + +Clause-②: yes (narrowing) — a flow whose `connector_action` node carries a key in `connectorConfig.input` that the chosen action's `inputSchema` does not declare used to run and send that key to the provider; its step now fails before dispatch. First-party flows affected: 0 (the shipped DocuSign, Stripe, GitHub and showcase flows send only declared keys). +Metadata-protocol: narrowed + + + +**BREAKING** for a `connector_action` step whose input holds a key the action does not declare. The step now fails with `code: 'VALIDATION_ERROR'` before the handler is called, naming the node, each undeclared key by its dotted path, and the keys the action declares at that level; nothing is sent. The failure is a `runtime` one, so a `fault` edge on the node receives it, as for a missing required parameter or a value of the wrong type. A connector or action switch in the designer is the usual way such a key is left behind. + +Migration, FROM → TO: `connectorConfig: { connectorId: 'slack', actionId: 'chat.postMessage', input: { channel: 'C1', text: 'hi', stale_key: 'x' } }` → drop `stale_key` from `input`, or pick the action that declares it. A key inside a section is judged against that section (`input.query.stale` against the `query` properties of an OpenAPI action), and a CEL envelope is judged on the map it evaluates to. + +Which schemas declare their keys: an object schema that lists `properties`, or says `additionalProperties: false`; the declared keys are the names in `properties` plus those in `required`. A schema that admits more keys declares open input and every key still dispatches: `additionalProperties` set to `true` or to a schema, `unevaluatedProperties` other than `false`, `patternProperties`, `$ref`, `allOf` / `anyOf` / `oneOf`, `if` / `then` / `else`, `dependentSchemas` or `dependencies`; so does a schema that lists no `properties`, and an action with no `inputSchema`. An undeclared key whose value is `undefined` is absent and not refused; any other value, `null` included, is. + +Judged at run time, against the schema of the instance the call dispatches to, and not when the flow registers: the boot flow pull registers every flow before a declarative connector materializes, and an instance's schema is re-read from its upstream on every re-materialization, so a registration-time verdict could be contradicted later in the same boot. The connector pull door (`connectorSource.input`) is unchanged. From 10a4106a1825444edb72e84a9c9c299ebf60082b Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 03:09:41 +0000 Subject: [PATCH 4/6] feat(spec): ADR-0087 semantic entry for the connector_action undeclared input key refusal Claude-Session: https://claude.ai/code/session_016WV4cxHwXNcGcAHNerZsom Co-authored-by: Claude --- ...tor-action-undeclared-input-key-refused.ts | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 packages/spec/src/migrations/entries/semantic/18.connector-action-undeclared-input-key-refused.ts diff --git a/packages/spec/src/migrations/entries/semantic/18.connector-action-undeclared-input-key-refused.ts b/packages/spec/src/migrations/entries/semantic/18.connector-action-undeclared-input-key-refused.ts new file mode 100644 index 00000000000..311d72d580f --- /dev/null +++ b/packages/spec/src/migrations/entries/semantic/18.connector-action-undeclared-input-key-refused.ts @@ -0,0 +1,28 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import type { SemanticMigration } from '../../types.js'; + +// A `connector_action` node refuses, at run time, an input key the chosen +// action's `inputSchema` does not declare, instead of sending it to the +// provider. A semantic entry and not a conversion: whether a stray key is a +// leftover to drop or a sign the wrong action is picked is the author's call. +export const entry: SemanticMigration = { + id: 'connector-action-undeclared-input-key-refused', + surface: + '`flow.nodes[].connectorConfig.input` of a `connector_action` node, when it holds a key (at the top ' + + 'or inside a section) that the action\'s `inputSchema` does not declare at that level.', + replacement: + 'Drop the key from `connectorConfig.input`, or pick the action that declares it. The declared keys ' + + 'are the names in the schema\'s `properties` plus those in `required`, as `GET /api/v1/automation/connectors` lists them.', + reason: + 'Every shipped connector input schema leaves `additionalProperties` unset, so under JSON Schema\'s ' + + 'open default a key no action reads passed the input check and reached the provider. A connector or ' + + 'action switch in the designer is how such a key is left behind. The step now fails before dispatch ' + + 'with VALIDATION_ERROR naming the key and the declared keys; a schema that admits more keys ' + + '(`additionalProperties` true or a schema, `patternProperties`, a composition keyword) or lists no ' + + '`properties` still dispatches every key.', + acceptanceCriteria: + 'Every `connector_action` node\'s `connectorConfig.input` holds only keys its action declares, at every ' + + 'level, and a run of the flow dispatches the step. A step whose input still holds an undeclared key ' + + 'fails with `code: \'VALIDATION_ERROR\'` naming that key, and the provider is never called.', +}; From d4822373315d8af1d3696b94e1fa30da28c6cc57 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 03:56:55 +0000 Subject: [PATCH 5/6] fix(connector-openapi): a skipped $ref parameter or body reads as open input, not as absent The connector_action executor now refuses a key an object schema does not declare. buildInputSchema skipped an unresolved $ref parameter and an unresolved $ref or schemaless request body, so a flow over a document nobody de-referenced lost inputs it dispatched before. An unresolved $ref parameter now opens path, query and header (additionalProperties: true); such a body is declared as body: {}. Claude-Session: https://claude.ai/code/session_016WV4cwhJBt274G7zk78A5a Co-authored-by: Claude --- .../src/input-schema-dispatch.test.ts | 110 ++++++++++++++++-- .../src/openapi-connector.ts | 37 ++++-- 2 files changed, 131 insertions(+), 16 deletions(-) diff --git a/packages/connectors/connector-openapi/src/input-schema-dispatch.test.ts b/packages/connectors/connector-openapi/src/input-schema-dispatch.test.ts index 9ae3a59f506..c4828735eed 100644 --- a/packages/connectors/connector-openapi/src/input-schema-dispatch.test.ts +++ b/packages/connectors/connector-openapi/src/input-schema-dispatch.test.ts @@ -44,13 +44,13 @@ const document = { }, }; -type Sent = { url: string; headers: Record }; +type Sent = { url: string; headers: Record; body?: string }; -/** Boot a kernel with one hand-wired OpenAPI connector `pets` over {@link document}, recording every request. */ -async function boot(auth: RestAuth): Promise<{ engine: AutomationEngine; sent: Sent[]; kernel: LiteKernel }> { +/** Boot a kernel with one hand-wired OpenAPI connector `pets` over `doc` ({@link document} by default), recording every request. */ +async function boot(auth: RestAuth, doc: object = document): Promise<{ engine: AutomationEngine; sent: Sent[]; kernel: LiteKernel }> { const sent: Sent[] = []; - const fetchImpl = (async (url: string, init: { headers?: Record }) => { - sent.push({ url, headers: { ...init?.headers } }); + const fetchImpl = (async (url: string, init: { headers?: Record; body?: string }) => { + sent.push({ url, headers: { ...init?.headers }, body: init?.body }); return { status: 200, ok: true, headers: { get: () => 'application/json' }, json: async () => ({}), text: async () => '{}' }; }) as unknown as typeof fetch; const kernel = new LiteKernel({ logger: { level: 'silent' } } as never); @@ -65,17 +65,17 @@ async function boot(auth: RestAuth): Promise<{ engine: AutomationEngine; sent: S }, async start() {}, } as never); - kernel.use(new ConnectorOpenApiPlugin({ document, name: 'pets', auth, fetchImpl } as never)); + kernel.use(new ConnectorOpenApiPlugin({ document: doc, name: 'pets', auth, fetchImpl } as never)); await kernel.bootstrap(); return { engine: kernel.getService('automation'), sent, kernel }; } -async function callGetPet(engine: AutomationEngine, name: string, input: Record) { +async function callGetPet(engine: AutomationEngine, name: string, input: Record, actionId = 'getPet') { engine.registerFlow(name, { name, label: name, type: 'autolaunched', nodes: [ { id: 'start', type: 'start', label: 'Start' }, - { id: 'call', type: 'connector_action', label: 'Call', connectorConfig: { connectorId: 'pets', actionId: 'getPet', input } }, + { id: 'call', type: 'connector_action', label: 'Call', connectorConfig: { connectorId: 'pets', actionId, input } }, { id: 'end', type: 'end', label: 'End' }, ], edges: [{ id: 'e1', source: 'start', target: 'call' }, { id: 'e2', source: 'call', target: 'end' }], @@ -136,3 +136,97 @@ describe('connector-openapi inputSchema at the connector_action door (#27995)', } }); }); + +/** + * #33553 — the executor refuses a key an object schema does not declare, so + * what the generator skips on a document nobody de-referenced must read as + * open: an unresolved `$ref` parameter opens every location the handler + * sends, and an unresolved `$ref` or schemaless request body is `body: {}`. + * On `main` before the refusal these calls dispatched and worked; they still do. + */ +describe('connector-openapi skipped $ref inputs still dispatch under the undeclared-key refusal (#33553)', () => { + const refDocument = { + openapi: '3.0.3', + info: { title: 'Petstore', version: '1.0.0' }, + servers: [{ url: 'https://petstore.example.com' }], + components: { + parameters: { + PetId: { name: 'petId', in: 'path', required: true, schema: { type: 'integer' } }, + Tag: { name: 'tag', in: 'query', schema: { type: 'string' } }, + }, + requestBodies: { Pet: { content: { 'application/json': { schema: { type: 'object' } } } } }, + }, + paths: { + '/pets/{petId}': { + put: { + operationId: 'putPet', + parameters: [ + { $ref: '#/components/parameters/PetId' }, + { $ref: '#/components/parameters/Tag' }, + { name: 'limit', in: 'query', schema: { type: 'integer' } }, + ], + requestBody: { $ref: '#/components/requestBodies/Pet' }, + responses: { '200': { description: 'ok' } }, + }, + post: { + operationId: 'postPetRaw', + parameters: [{ name: 'petId', in: 'path', required: true, schema: { type: 'integer' } }], + requestBody: { required: true, content: { 'application/octet-stream': {} } }, + responses: { '200': { description: 'ok' } }, + }, + }, + }, + }; + const none: RestAuth = { type: 'none' }; + + it('1. an unresolved $ref parameter opens path, query and header; the declared query parameter stays typed', async () => { + const { engine, sent, kernel } = await boot(none, refDocument); + try { + const schema = engine.getConnectorDescriptors().find((d) => d.name === 'pets')?.actions + .find((a) => a.key === 'putPet')?.inputSchema as any; + expect(schema.properties.path).toEqual({ type: 'object', additionalProperties: true }); + expect(schema.properties.header).toEqual({ type: 'object', additionalProperties: true }); + expect(schema.properties.query).toEqual({ + type: 'object', properties: { limit: { type: 'integer' } }, additionalProperties: true, + }); + expect(schema.properties.body).toEqual({}); + expect(schema.required).toBeUndefined(); + + const result = await callGetPet(engine, 'ref_params', { + path: { petId: 7 }, query: { tag: 'dog', limit: 2 }, body: { name: 'Rex' }, + }, 'putPet'); + expect(result.success, result.error).toBe(true); + expect(sent).toHaveLength(1); + const url = new URL(sent[0].url); + expect(url.pathname).toBe('/pets/7'); + expect(url.searchParams.get('tag')).toBe('dog'); + expect(sent[0].body).toBe(JSON.stringify({ name: 'Rex' })); + + const wrongType = await callGetPet(engine, 'ref_params_typed', { + path: { petId: 7 }, query: { limit: 'two' }, + }, 'putPet'); + expect(wrongType.success).toBe(false); + expect(sent).toHaveLength(1); + } finally { + await kernel.shutdown().catch(() => {}); + } + }); + + it('2. a request body whose content carries no schema is declared as body: {} and dispatches', async () => { + const { engine, sent, kernel } = await boot(none, refDocument); + try { + const schema = engine.getConnectorDescriptors().find((d) => d.name === 'pets')?.actions + .find((a) => a.key === 'postPetRaw')?.inputSchema as any; + expect(schema.properties.body).toEqual({}); + expect(schema.required).toEqual(['path', 'body']); + expect(schema.properties.path.additionalProperties).toBeUndefined(); + + const result = await callGetPet(engine, 'raw_body', { path: { petId: 3 }, body: 'raw' }, 'postPetRaw'); + expect(result.success, result.error).toBe(true); + expect(sent).toHaveLength(1); + expect(new URL(sent[0].url).pathname).toBe('/pets/3'); + } finally { + await kernel.shutdown().catch(() => {}); + } + }); +}); diff --git a/packages/connectors/connector-openapi/src/openapi-connector.ts b/packages/connectors/connector-openapi/src/openapi-connector.ts index b96c5f1f5a0..58d47fe33ce 100644 --- a/packages/connectors/connector-openapi/src/openapi-connector.ts +++ b/packages/connectors/connector-openapi/src/openapi-connector.ts @@ -508,6 +508,18 @@ const IGNORED_HEADER_PARAMETERS = new Set(['accept', 'content-type', 'authorizat * flow's `connectorConfig.input`), are left out of it — and so, for a * connector with a credential handle, is every parameter an `apiKey` security * scheme the operation requires places the token in (`schemeFilled`). + * + * #33553 — that executor also refuses a key an object schema does not + * declare, reading `properties` as the action's contract. So what this + * generator SKIPS must read as open, never as absent: the handler still + * sends it, and on a document nobody de-referenced it is the only way the + * input can carry it. An unresolved `$ref` parameter has no `in` to read + * without de-referencing, so it opens every location the handler sends + * (`path`, `query`, `header`): each is emitted with + * `additionalProperties: true`, even when it declares no parameter of its + * own. An unresolved `$ref` request body, or one whose content carries no + * `schema`, is declared as `body: {}` — any value. The declared parameters + * beside them are still judged as before. */ function buildInputSchema(op: OpenApiOperation, auth: RestAuth, schemeFilled: ReadonlySet): JsonSchema | undefined { const sections: Record<'path' | 'query' | 'header', { props: Record; required: string[] }> = { @@ -518,8 +530,13 @@ function buildInputSchema(op: OpenApiOperation, auth: RestAuth, schemeFilled: Re const authHeader = auth.type === 'api-key' && !auth.paramName ? (auth.headerName ?? 'X-API-Key').toLowerCase() : undefined; const authQuery = auth.type === 'api-key' ? auth.paramName : undefined; + let unresolvedParameter = false; for (const p of op.parameters ?? []) { - if (!p || typeof p !== 'object' || '$ref' in p) continue; + if (!p || typeof p !== 'object') continue; + if ('$ref' in p) { + unresolvedParameter = true; + continue; + } if (p.in !== 'path' && p.in !== 'query' && p.in !== 'header') continue; if (p.in === 'header' && (IGNORED_HEADER_PARAMETERS.has(p.name.toLowerCase()) || p.name.toLowerCase() === authHeader)) continue; if (p.in === 'query' && authQuery !== undefined && p.name === authQuery) continue; @@ -533,18 +550,22 @@ function buildInputSchema(op: OpenApiOperation, auth: RestAuth, schemeFilled: Re const required: string[] = []; for (const where of ['path', 'query', 'header'] as const) { const sec = sections[where]; - if (Object.keys(sec.props).length === 0) continue; - const schema: JsonSchema = { type: 'object', properties: sec.props }; + const declared = Object.keys(sec.props).length > 0; + if (!declared && !unresolvedParameter) continue; + const schema: JsonSchema = { type: 'object' }; + if (declared) schema.properties = sec.props; if (sec.required.length) schema.required = sec.required; + if (unresolvedParameter) schema.additionalProperties = true; properties[where] = schema; // Path params are always required when present; others only if any are. - if (where === 'path' || sec.required.length) required.push(where); + if ((where === 'path' && declared) || sec.required.length) required.push(where); } - const bodySchema = extractRequestBodySchema(op.requestBody); - if (bodySchema) { - properties.body = bodySchema; - if (op.requestBody && !('$ref' in op.requestBody) && op.requestBody.required) required.push('body'); + if (op.requestBody && typeof op.requestBody === 'object') { + // An unresolved `$ref` body, or content with no `schema`, is still a + // body the handler sends: declared as `{}`, any value. + properties.body = extractRequestBodySchema(op.requestBody) ?? {}; + if (!('$ref' in op.requestBody) && op.requestBody.required) required.push('body'); } if (Object.keys(properties).length === 0) return undefined; From 753c427e4009ead9efeb323fd37cf25b28b23890 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 04:03:20 +0000 Subject: [PATCH 6/6] =?UTF-8?q?fix(service-automation):=20address=20review?= =?UTF-8?q?#2=20=E2=80=94=20Slack=20partial=20schemas=20and=20$recursiveRe?= =?UTF-8?q?f=20in=20the=20changeset,=20pull-door=20pin=20at=20the=20door?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - changeset: Clause-② no (narrowing); name Slack chat.postMessage / chat.update and the call action; every object level, array items included; connector-openapi and spec lines. - semantic entry: surface and replacement name array items and the pass-through action. - $recursiveRef reads a key set as open, beside $dynamicRef. - the pull door's opt-out is pinned through pullConnectorSource. Claude-Session: https://claude.ai/code/session_016WV4cwhJBt274G7zk78A5a Co-authored-by: Claude --- ...553-connector-action-undeclared-input-key.md | 12 +++++++++--- .../src/builtin/connector-input-schema.test.ts | 14 +++++++++++--- .../src/connector-input-schema.ts | 2 +- .../src/connector-pull.test.ts | 17 +++++++++++++++++ ...ector-action-undeclared-input-key-refused.ts | 8 +++++--- 5 files changed, 43 insertions(+), 10 deletions(-) diff --git a/.changeset/33553-connector-action-undeclared-input-key.md b/.changeset/33553-connector-action-undeclared-input-key.md index 91311151e19..f73809f58c4 100644 --- a/.changeset/33553-connector-action-undeclared-input-key.md +++ b/.changeset/33553-connector-action-undeclared-input-key.md @@ -1,18 +1,24 @@ --- '@objectstack/service-automation': minor +'@objectstack/connector-openapi': minor +'@objectstack/spec': minor --- fix(service-automation)!: a `connector_action` node refuses an input key its action does not declare, instead of sending it to the provider -Clause-②: yes (narrowing) — a flow whose `connector_action` node carries a key in `connectorConfig.input` that the chosen action's `inputSchema` does not declare used to run and send that key to the provider; its step now fails before dispatch. First-party flows affected: 0 (the shipped DocuSign, Stripe, GitHub and showcase flows send only declared keys). +Clause-②: no (narrowing) — a flow whose `connector_action` node carries a key in `connectorConfig.input` that the chosen action's `inputSchema` does not declare used to run and send that key to the provider; its step now fails before dispatch. First-party flows affected: 0 (the shipped DocuSign, Stripe, GitHub and showcase flows send only declared keys). Metadata-protocol: narrowed **BREAKING** for a `connector_action` step whose input holds a key the action does not declare. The step now fails with `code: 'VALIDATION_ERROR'` before the handler is called, naming the node, each undeclared key by its dotted path, and the keys the action declares at that level; nothing is sent. The failure is a `runtime` one, so a `fault` edge on the node receives it, as for a missing required parameter or a value of the wrong type. A connector or action switch in the designer is the usual way such a key is left behind. -Migration, FROM → TO: `connectorConfig: { connectorId: 'slack', actionId: 'chat.postMessage', input: { channel: 'C1', text: 'hi', stale_key: 'x' } }` → drop `stale_key` from `input`, or pick the action that declares it. A key inside a section is judged against that section (`input.query.stale` against the `query` properties of an OpenAPI action), and a CEL envelope is judged on the map it evaluates to. +Migration, FROM → TO: `connectorConfig: { connectorId: 'slack', actionId: 'chat.postMessage', input: { channel: 'C1', text: 'hi', stale_key: 'x' } }` → drop `stale_key` from `input`, or pick the action that declares it. A key is judged at every object level the walk reaches, array items included, against the schema of that level (`input.query.stale` against the `query` properties of an OpenAPI action), and a CEL envelope is judged on the map it evaluates to. -Which schemas declare their keys: an object schema that lists `properties`, or says `additionalProperties: false`; the declared keys are the names in `properties` plus those in `required`. A schema that admits more keys declares open input and every key still dispatches: `additionalProperties` set to `true` or to a schema, `unevaluatedProperties` other than `false`, `patternProperties`, `$ref`, `allOf` / `anyOf` / `oneOf`, `if` / `then` / `else`, `dependentSchemas` or `dependencies`; so does a schema that lists no `properties`, and an action with no `inputSchema`. An undeclared key whose value is `undefined` is absent and not refused; any other value, `null` included, is. +An action whose schema lists only some of the parameters its handler forwards refuses the others now. The Slack connector's `chat.postMessage` and `chat.update` list `channel`, `text`, `blocks` and `thread_ts` / `ts` and forward the whole input to the Slack Web API, so any other Slack parameter (`unfurl_links`, `mrkdwn`, `reply_broadcast`, …) on those two actions is refused. Migration, FROM → TO: `{ actionId: 'chat.postMessage', input: { channel: 'C1', text: 'hi', unfurl_links: false } }` → `{ actionId: 'call', input: { method: 'chat.postMessage', params: { channel: 'C1', text: 'hi', unfurl_links: false } } }`; the `call` action's `params` is an object with no `properties`, so it carries any Slack parameter. + +`@objectstack/connector-openapi`: what the generator cannot read without de-referencing the document is now declared open instead of left out, so a flow over an OpenAPI 3.x document nobody normalized keeps dispatching. An unresolved `$ref` parameter has no readable `in`, so it opens every location the handler sends: `path`, `query` and `header` are each emitted with `additionalProperties: true`, also when they declare no parameter of their own, and the parameters declared beside them are still judged. An unresolved `$ref` request body, or one whose content carries no `schema`, is declared as `body: {}` (any value). Running `normalize-openapi` over the document still gives each such parameter its own declaration and type check. + +Which schemas declare their keys: an object schema that lists `properties`, or says `additionalProperties: false`; the declared keys are the names in `properties` plus those in `required`. A schema that admits more keys declares open input and every key still dispatches: `additionalProperties` set to `true` or to a schema, `unevaluatedProperties` other than `false`, `patternProperties`, `$ref`, `$dynamicRef`, `$recursiveRef`, `allOf` / `anyOf` / `oneOf`, `if` / `then` / `else`, `dependentSchemas` or `dependencies`; so does a schema that lists no `properties`, and an action with no `inputSchema`. An undeclared key whose value is `undefined` is absent and not refused; any other value, `null` included, is. Judged at run time, against the schema of the instance the call dispatches to, and not when the flow registers: the boot flow pull registers every flow before a declarative connector materializes, and an instance's schema is re-read from its upstream on every re-materialization, so a registration-time verdict could be contradicted later in the same boot. The connector pull door (`connectorSource.input`) is unchanged. diff --git a/packages/services/service-automation/src/builtin/connector-input-schema.test.ts b/packages/services/service-automation/src/builtin/connector-input-schema.test.ts index 3805b978f5d..488b942a71f 100644 --- a/packages/services/service-automation/src/builtin/connector-input-schema.test.ts +++ b/packages/services/service-automation/src/builtin/connector-input-schema.test.ts @@ -30,8 +30,8 @@ * failure is a `runtime` one: a `fault` edge receives it, with * `$error.code === 'VALIDATION_ERROR'`. * 6. **A key the action does not declare is refused, nothing sent** (#33553). - * A key outside an object schema's `properties` / `required` — at the top - * of `connectorConfig.input` or inside a section — fails the step naming + * A key outside an object schema's `properties` / `required` — at every + * object level of `connectorConfig.input`, array items included — fails the step naming * the node, the key and the keys declared there, the EVALUATED input * included. A schema that admits more keys (`additionalProperties` true * or a schema, `patternProperties`, a composition keyword) or lists no @@ -369,8 +369,16 @@ describe('6. a key the action does not declare is refused before dispatch (#3355 expect(sent).toEqual([{ action: 'post', input: { channel: 'c1', text: 'hi' } }]); }); - it('the judgment is opt-in: a door that does not ask for it (the connector pull door) is unchanged', () => { + // The pull door itself is pinned in connector-pull.test.ts ([#33553] an undeclared key is not refused there). + it('the judgment is opt-in on the helper: without the option an undeclared key is not judged', () => { expect(judgeConnectorInput(SLACK_POST, { channel: 'c1', extra: 'kept' })).toBeUndefined(); expect(judgeConnectorInput(SLACK_POST, { channel: 'c1', extra: 'kept' }, { refuseUndeclaredKeys: true })?.undeclaredKey).toBe(true); }); + + it('a draft 2019-09 `$recursiveRef` or a 2020-12 `$dynamicRef` reads the key set as open', () => { + for (const keyword of ['$recursiveRef', '$dynamicRef']) { + const schema = { ...SLACK_POST, [keyword]: '#' }; + expect(judgeConnectorInput(schema, { channel: 'c1', extra: 'kept' }, { refuseUndeclaredKeys: true }), keyword).toBeUndefined(); + } + }); }); diff --git a/packages/services/service-automation/src/connector-input-schema.ts b/packages/services/service-automation/src/connector-input-schema.ts index b6e50022ee6..2660e2618d4 100644 --- a/packages/services/service-automation/src/connector-input-schema.ts +++ b/packages/services/service-automation/src/connector-input-schema.ts @@ -136,7 +136,7 @@ const MAX_LISTED_DECLARED_KEYS = 8; * pulls in another schema's keys. A schema carrying one is read as OPEN. */ const KEY_ADMITTING_KEYWORDS = [ - 'patternProperties', '$ref', '$dynamicRef', 'allOf', 'anyOf', 'oneOf', + 'patternProperties', '$ref', '$dynamicRef', '$recursiveRef', 'allOf', 'anyOf', 'oneOf', 'if', 'then', 'else', 'dependentSchemas', 'dependencies', ]; diff --git a/packages/services/service-automation/src/connector-pull.test.ts b/packages/services/service-automation/src/connector-pull.test.ts index 91b6595bc3a..e60f83c82d0 100644 --- a/packages/services/service-automation/src/connector-pull.test.ts +++ b/packages/services/service-automation/src/connector-pull.test.ts @@ -382,6 +382,23 @@ describe('[#28040] connector pull — the input is checked against the action\'s expect(res.pulled).toBe(0); }); + it('[#33553] an undeclared key is not refused here: the pull door does not opt in to that judgment', async () => { + const h = harness({ + inputSchema: SINCE_REQUIRED, + mapping: baseMapping({ + connectorSource: { + connector: 'crm_api', action: 'request', + input: { path: '/contacts', query: { since: '2026-01-01', stale: 'x' }, extra: 'kept' }, + }, + }), + }); + await pullConnectorSource(h.deps, { mapping: 'crm_contacts' }); + expect(h.handler).toHaveBeenCalledTimes(1); + expect(h.handler.mock.calls[0][0]).toEqual({ + path: '/contacts', query: { since: '2026-01-01', stale: 'x' }, extra: 'kept', + }); + }); + it('a valid input still pulls and writes', async () => { const h = harness({ inputSchema: SINCE_REQUIRED, diff --git a/packages/spec/src/migrations/entries/semantic/18.connector-action-undeclared-input-key-refused.ts b/packages/spec/src/migrations/entries/semantic/18.connector-action-undeclared-input-key-refused.ts index 311d72d580f..f8cb3ccd5aa 100644 --- a/packages/spec/src/migrations/entries/semantic/18.connector-action-undeclared-input-key-refused.ts +++ b/packages/spec/src/migrations/entries/semantic/18.connector-action-undeclared-input-key-refused.ts @@ -9,11 +9,13 @@ import type { SemanticMigration } from '../../types.js'; export const entry: SemanticMigration = { id: 'connector-action-undeclared-input-key-refused', surface: - '`flow.nodes[].connectorConfig.input` of a `connector_action` node, when it holds a key (at the top ' - + 'or inside a section) that the action\'s `inputSchema` does not declare at that level.', + '`flow.nodes[].connectorConfig.input` of a `connector_action` node, when it holds a key (at any object ' + + 'level, array items included) that the action\'s `inputSchema` does not declare at that level.', replacement: 'Drop the key from `connectorConfig.input`, or pick the action that declares it. The declared keys ' - + 'are the names in the schema\'s `properties` plus those in `required`, as `GET /api/v1/automation/connectors` lists them.', + + 'are the names in the schema\'s `properties` plus those in `required`, as `GET /api/v1/automation/connectors` lists them. ' + + 'For a parameter the provider takes that the action does not list (Slack `chat.postMessage` / `chat.update` list four ' + + 'each), use the connector\'s pass-through action: Slack `call` with `method` and `params`.', reason: 'Every shipped connector input schema leaves `additionalProperties` unset, so under JSON Schema\'s ' + 'open default a key no action reads passed the input check and reached the provider. A connector or '