Skip to content

Commit 3d9175d

Browse files
fix(app-shell): Studio treats connector_action connectorConfig.input values as value slots (#28312)
<!-- claude-projects-attribution: {"github_login":"os-tesla"} --> _Requested by **Tesla** · [project thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoVhsJ371ThioLxQKKJ3YHtY)_ Fixes #28164 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:Studio 里连接器动作(connector_action)节点的「输入」每个值,现在和其他取值位一样,可以切换成 CEL 表达式,写进 `{…}` 模板记号时当场在表单里显示拒绝原因;调试运行也会在该步骤报出同一条拒绝。 - 为什么改:#28150 之后发布时会拒绝输入里的 `{…}` 记号,但 Studio 读表达式台账时忽略了条目所在的块(`connectorConfig`),作者要到发布才看到错误,也没有写表达式的入口。 - 风险与回滚:只改 Studio 前端三个读取点,不动 spec 与运行时;判词全部来自 spec 现有函数。回滚即 revert 本 PR。 - 先看:`flow-value-envelope.ts` 的 `isValueEnvelopeSlot`、`FlowNodeConfigField.tsx` 的 `isScalarValueSlot` / `valueSlotRefusals`、`flow-simulator.ts` 的 `configRefusal`。 - 两分钟验证:`pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/inspectors/FlowNodeInspector.connectorInputEnvelope-28164.test.tsx`,预期 5 个测试全绿。 - 需要你做的:无,席位落地。 ## What changes The flow expression ledger roots `connector_action` `input.*` in the node's `connectorConfig` sibling block (`block: 'connectorConfig'`, landed with #28150). Studio's three readers did not read the entry's block: - `flow-value-envelope.ts` `isValueEnvelopeSlot` now matches the entry's block through the spec's `flowNodeExpressionBlock`. It answers true for `['connectorConfig', 'input']` on a `connector_action` node, and false for the unreachable `['config', 'input']` it used to answer for. The Input key/value repeater therefore gets the text / CEL-expression toggle and its per-row refusal, like the other value maps. - `FlowNodeConfigField.tsx`: `isScalarValueSlot` accepts a field rooted in a declared sibling block (`FLOW_NODE_SIBLING_EXPRESSION_BLOCKS`) and asks `resolveFlowNodeValueSlots` with the node's sibling blocks. A typed connector input field (the ones an action's `inputSchema` produces, at `connectorConfig.input.KEY`) now renders the value-slot control. `valueSlotRefusals` hands `flowNodeValueTemplateRefusals` the node and keeps only refusals in the field's own block, so the spec's refusal of a `{…}` token shows under the value as it is typed. `config` fields behave exactly as before: still one key deep, and still judged by both config judges. - `flow-simulator.ts`: `configRefusal` takes the node, hands the value-slot judge its sibling blocks, and names the refusal's block in the line. The Debug run judges a `connector_action` step before mocking it, because the executor resolves `connectorConfig.input` before dispatch and refuses a `{…}` token there. No i18n keys were added: the toggle label, placeholder and refusal sentences are the existing ones and the spec's own. ## Tests - New `FlowNodeInspector.connectorInputEnvelope-28164.test.tsx` drives the real inspector render path through a host that applies each patch. For a typed field, a token typed into the Text input shows the spec's refusal (`flowNodeValueTemplateRefusals`, read from the installed spec) in the form, and a stored token shows it too. A plain literal shows none, and the toggle stores `{ dialect: 'cel', source }` at the same key. For the repeater (an action with no `inputSchema`), a stored token and a typed token are both refused in place, and the toggle is offered on each row. - New `flow-simulator.connectorInput-28164.test.ts`: a token in `connectorConfig.input` fails the step with the spec's refusal naming `connectorConfig.input.text`. A literal plus a CEL envelope is mocked as before. - `flow-value-envelope.test.ts`: a new case pins the block reading (true for `connectorConfig.input`, false for `config.input` and for another node type). **The six-map case changes to seven, on purpose.** #28193 left it alone pending this card, and the new truth is that the designer table's `connector_action` `connectorConfig.input` key/value field is offered the envelope. The confirmation case that follows measures the new slot against the judge `registerFlow` applies there (`FlowValueSlotSchema`, through `valueEnvelopeRefusals`), and it gives the same sentences as the editor's `AssignmentValueSchema` for malformed envelopes and accepts the same literals. The ledger's 19-entry `value` list is unchanged. ## Acceptance notes - A connector input field the resolver flattens from a nested object schema (`connectorConfig.input.retry.attempts`) is not a whole value slot, so it keeps its plain control. This matches `config` fields, which are value-slot controls only one key deep. The slot's refusal still reaches publish through the spec judge. - A typed connector input of kind `number` / `select` / `boolean` keeps its typed control with no expression toggle, as on `config` value slots, which offer the control only to text / textarea / expression fields. - The Debug run judges no other mocked node's value slots (`create_record` / `update_record` `fields.*`, `http` `body`). It mocks those nodes without reading their values, as before. Only `connector_action` was in this card's scope. Noted, not filed. ## Verification All readings on head `ac2e380a`, worktree off `origin/main` `6285203d`. <details><summary>Targeted tests and package checks</summary> - `pnpm --dir ui exec vitest run` over `inspectors/`, `previews/` and the 31 other `app-shell` test files that import a changed module or its hosts (`FlowNodeConfigField`, `flow-value-envelope`, `flow-simulator`, `FlowNodeInspector`, `FlowKeyValueField`, `FlowPreview`, `FlowCanvas`): Test Files 405 passed (405), Tests 4763 passed, 1 skipped. Lock VERDICT command-exit 0. - `pnpm --filter @object-ui/app-shell type-check` (both `tsc --noEmit` and `tsc -p tsconfig.test.json`): VERDICT command-exit 0. - `eslint` over the six changed ui files: exit 0. `pnpm check:new-line-citations`: 0 new citations, exit 0. - Declared narrowing: the full `app-shell` suite (about 2,000 files) was started with 2 workers and stopped unfinished after about 50 minutes. CI's sharded `Test UI` runs the whole suite. </details> <details><summary>Ablation (one-shot)</summary> With the fix committed, the three changed sources were restored from `origin/main` (tests kept) and the three new/updated test files were run: Test Files 3 failed (3), Tests 8 failed | 11 passed. Every new pin went red. Restored with `git checkout HEAD`, and `git diff HEAD` was empty afterwards. A first attempt was a no-op: its paths carried a `ui/` prefix, which the vitest invocation guard refused. It was rerun with the paths written relative to `ui/`. </details> <details><summary>Derived gates (dispatch-gates --commands, 35 families)</summary> Every line ran with stdin from /dev/null, and its exit code was recorded before any pipe. `dispatch-gates --ran`: 35 derived, 35 run, 0 NOT-MEASURED, 0 UNRUN. All 35 exited 0, including `node scripts/check-sdui-manifest.mjs` and its `--self-test`, `pnpm --dir ui exec vitest run scripts/` (Test Files 169 passed, 2 skipped), `pnpm check:type-check-debt` (run under the verify lock after a first run timed out in the queue, exit 3 NOT MEASURED), and `pnpm check:query-options-erasure` (rerun without the 280 s per-gate cap that cut its first run, exit 124). </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01L9qibxVHVAdKszs18owvD6)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent 7a0481a commit 3d9175d

7 files changed

Lines changed: 380 additions & 34 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
---
4+
5+
fix(app-shell): Studio's `connector_action` form treats each `connectorConfig.input` value as a value slot
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The flow expression ledger roots `connector_action` `input.*` in the node's `connectorConfig` sibling block, and `registerFlow` refuses a `{…}` token there. Studio's readers ignored the entry's block, so the Input section offered no CEL-expression editor and showed no refusal: an author met the refusal only at publish.
11+
12+
- Each input value now has the text / CEL-expression toggle that other value slots have, in both the typed fields an action's `inputSchema` produces and the key/value repeater. An expression is stored as a CEL value envelope, `{ dialect: 'cel', source }`, at the same key.
13+
- A `{…}` token typed into an input value shows the spec's refusal under the value as it is typed. The text is the same sentence the publish door gives.
14+
- The Debug run fails a `connector_action` step whose input holds a `{…}` token, with the spec's refusal naming `connectorConfig.input.<key>`, because the executor refuses that input before it dispatches.

‎ui/packages/app-shell/src/views/metadata-admin/inspectors/FlowNodeConfigField.tsx‎

Lines changed: 57 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ import { Button, Label, cn } from '@object-ui/components';
2323
import { Code2 } from 'lucide-react';
2424
import {
2525
FLOW_NODE_EXPRESSION_PATHS,
26+
FLOW_NODE_SIBLING_EXPRESSION_BLOCKS,
2627
flowNodeConfigRefusals,
2728
flowNodeValueTemplateRefusals,
2829
isExpressionEnvelopeShaped,
2930
resolveFlowNodeValueSlots,
3031
valueSlotTemplateRefusals,
32+
type FlowNodeExpressionBlock,
3133
} from '@objectstack/spec/automation';
3234
import { FlowKeyValueField, type FlowKeyValueFieldProps } from './FlowKeyValueField.js';
3335
import { FlowExprIssue } from './FlowExprIssue.js';
@@ -264,16 +266,49 @@ function configOf(node: Record<string, unknown> | null | undefined): Record<stri
264266
return cfg && typeof cfg === 'object' && !Array.isArray(cfg) ? (cfg as Record<string, unknown>) : {};
265267
}
266268

267-
/** Whether `path` on `node` is one `value`-role slot of the spec's ledger (objectui#12372). */
269+
/**
270+
* `node` with `value` written at `path`, every object on the way copied: the
271+
* node the spec's judges are asked about, as it would stand after the edit.
272+
*/
273+
function withValueAt(node: Record<string, unknown>, path: readonly string[], value: unknown): Record<string, unknown> {
274+
const [head, ...rest] = path;
275+
if (head === undefined) return node;
276+
const cur = node[head];
277+
const inner = cur && typeof cur === 'object' && !Array.isArray(cur) ? (cur as Record<string, unknown>) : {};
278+
return { ...node, [head]: rest.length === 0 ? value : withValueAt(inner, rest, value) };
279+
}
280+
281+
/**
282+
* The node block a field at `path` is rooted in, when the ledger can root a
283+
* slot there: `config` (one key deep, a `['config', KEY]` field), or a declared
284+
* sibling block (`FLOW_NODE_SIBLING_EXPRESSION_BLOCKS` — a `connector_action`
285+
* node's `connectorConfig`, whose `input.<key>` fields the connector's own
286+
* input schema types).
287+
*/
288+
function slotBlockOf(path: readonly string[]): FlowNodeExpressionBlock | null {
289+
const [block] = path;
290+
if (block === 'config') return path.length === 2 ? 'config' : null;
291+
return path.length >= 2 && Object.prototype.hasOwnProperty.call(FLOW_NODE_SIBLING_EXPRESSION_BLOCKS, block)
292+
? (block as FlowNodeExpressionBlock)
293+
: null;
294+
}
295+
296+
/**
297+
* Whether `path` on `node` is one `value`-role slot of the spec's ledger
298+
* (objectui#12372), in the block the ledger roots it in.
299+
*/
268300
function isScalarValueSlot(
269301
node: Record<string, unknown> | null | undefined,
270302
path: readonly string[],
271303
): boolean {
272304
const type = node?.type;
273-
if (typeof type !== 'string' || path.length !== 2 || path[0] !== 'config') return false;
274-
const key = path[1];
275-
const probe = { ...configOf(node), [key]: 'probe' };
276-
return resolveFlowNodeValueSlots(type, probe).some((found) => found.path === key && found.entry.eachElement !== true);
305+
const block = slotBlockOf(path);
306+
if (!node || typeof type !== 'string' || block === null) return false;
307+
const slot = path.slice(1).join('.');
308+
const probe = withValueAt(node, path, 'probe');
309+
return resolveFlowNodeValueSlots(type, configOf(probe), probe).some(
310+
(found) => found.block === block && found.path === slot && found.entry.eachElement !== true,
311+
);
277312
}
278313

279314
/**
@@ -298,10 +333,22 @@ function filterOperandRefusal(value: unknown): string[] | null {
298333
return refusals.length > 0 ? refusals.map((r) => r.message) : null;
299334
}
300335

301-
/** What the spec's config judges refuse at `key` of `config` on a node of `nodeType`. */
302-
function valueSlotRefusals(nodeType: string, config: Record<string, unknown>, key: string): string[] {
303-
const at = (path: string) => path === key || path.startsWith(`${key}.`) || path.startsWith(`${key}[`);
304-
const messages = [...flowNodeValueTemplateRefusals(nodeType, config), ...flowNodeConfigRefusals(nodeType, config)]
336+
/**
337+
* What the spec's judges refuse at the field `path` of `node` on a node of
338+
* `nodeType`. The value-slot judge is handed the node's sibling blocks, so a
339+
* slot rooted outside `config` (a `connector_action` node's
340+
* `connectorConfig.input`) is judged there; the contract judge reads `config`
341+
* only, so it answers for a `config` field alone.
342+
*/
343+
function valueSlotRefusals(nodeType: string, node: Record<string, unknown>, path: readonly string[]): string[] {
344+
const [block, ...rest] = path;
345+
const key = rest.join('.');
346+
const at = (p: string) => p === key || p.startsWith(`${key}.`) || p.startsWith(`${key}[`);
347+
const config = configOf(node);
348+
const messages = [
349+
...flowNodeValueTemplateRefusals(nodeType, config, node).filter((refusal) => refusal.block === block),
350+
...(block === 'config' ? flowNodeConfigRefusals(nodeType, config) : []),
351+
]
305352
.filter((refusal) => at(refusal.path))
306353
.map((refusal) => refusal.message);
307354
return [...new Set(messages)];
@@ -599,7 +646,7 @@ export function FlowNodeConfigField({ field, value, onCommit, disabled, locale,
599646
isScalarValueSlot(context?.node, field.path);
600647
const valueSlotIssues =
601648
valueSlot && typeof context?.node?.type === 'string' && !isUnsetFieldValue(value)
602-
? valueSlotRefusals(context.node.type, { ...configOf(context.node), [field.path[1]]: value }, field.path[1])
649+
? valueSlotRefusals(context.node.type, withValueAt(context.node, field.path, value), field.path)
603650
: [];
604651
// objectui#6226 — the row-based condition builder, on the fields that opted in
605652
// AND at a site that declares the vocabulary. All three conjuncts are load
Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
/**
4+
* FlowNodeInspector — a `connector_action` node's input values are value slots
5+
* (objectstack#28164).
6+
*
7+
* The spec's expression ledger roots `connector_action` `input.*` in the node's
8+
* `connectorConfig` sibling block, and `registerFlow` refuses a `{…}` token
9+
* there. The form gives each input value what every other value slot has: the
10+
* text / CEL-expression toggle, and the spec's refusal beside the value as it
11+
* is typed, read from the same judge the publish door calls. Driven through the
12+
* real render path, for both editors the Input section uses: a typed field
13+
* (the action declares an `inputSchema`) and the key/value repeater (it
14+
* declares none).
15+
*/
16+
17+
import * as React from 'react';
18+
import { describe, it, expect, vi, afterEach } from 'vitest';
19+
import { render, screen, cleanup, fireEvent, waitFor, within } from '@testing-library/react';
20+
import { flowNodeValueTemplateRefusals } from '@objectstack/spec/automation';
21+
22+
vi.mock('../previews/useFlowNodePalette', async (orig) => ({
23+
...(await orig<Record<string, unknown>>()),
24+
useActionConfigSchemas: () => ({}),
25+
useFlowNodePalette: () => [],
26+
}));
27+
vi.mock('../previews/useObjectFields', () => ({
28+
useObjectFields: () => ({ fields: [], loading: false, error: null }),
29+
}));
30+
31+
import { FlowNodeInspector } from './FlowNodeInspector';
32+
import type { MetadataSelection } from '../preview-registry';
33+
34+
afterEach(() => {
35+
cleanup();
36+
vi.unstubAllGlobals();
37+
});
38+
39+
const TOGGLE = 'Write as a CEL expression';
40+
41+
const SLACK_POST_MESSAGE = {
42+
type: 'object',
43+
required: ['channel'],
44+
properties: {
45+
channel: { type: 'string', description: 'Channel id, user id, or #name' },
46+
text: { type: 'string', description: 'Message text' },
47+
},
48+
};
49+
50+
function mockRegistry(actions: unknown[]) {
51+
vi.stubGlobal(
52+
'fetch',
53+
vi.fn(async () =>
54+
new Response(
55+
JSON.stringify({
56+
success: true,
57+
data: { connectors: [{ name: 'slack', label: 'Slack', type: 'saas', origin: 'plugin', state: 'ready', actions }] },
58+
}),
59+
{ status: 200, headers: { 'Content-Type': 'application/json' } },
60+
),
61+
),
62+
);
63+
}
64+
65+
function connectorNode(input: Record<string, unknown>, actionId = 'chat.postMessage') {
66+
return { id: 'post', type: 'connector_action', label: 'Post to Slack', connectorConfig: { connectorId: 'slack', actionId, input } };
67+
}
68+
69+
const SELECTION: MetadataSelection = { kind: 'node', id: 'post' };
70+
71+
/** The inspector over a draft that takes each patch, as the designer host does. */
72+
function Host({ initial, onPatch }: { initial: Record<string, unknown>; onPatch: (patch: Record<string, unknown>) => void }) {
73+
const [draft, setDraft] = React.useState(initial);
74+
return (
75+
<FlowNodeInspector
76+
type="flow"
77+
name="notify_flow"
78+
selection={SELECTION}
79+
draft={draft}
80+
onPatch={(patch: Record<string, unknown>) => {
81+
onPatch(patch);
82+
setDraft((d) => ({ ...d, ...patch }));
83+
}}
84+
onClearSelection={vi.fn()}
85+
locale="en-US"
86+
readOnly={false}
87+
/>
88+
);
89+
}
90+
91+
function renderInspector(input: Record<string, unknown>, actionId?: string) {
92+
const onPatch = vi.fn();
93+
const initial = { nodes: [{ id: 'start', type: 'start' }, connectorNode(input, actionId)], edges: [{ source: 'start', target: 'post' }] };
94+
render(<Host initial={initial} onPatch={onPatch} />);
95+
return { onPatch };
96+
}
97+
98+
/** The spec's refusal of `input` on the node, at `connectorConfig.input.KEY`. */
99+
function specRefusal(input: Record<string, unknown>, key: string): string {
100+
const node = connectorNode(input);
101+
const found = flowNodeValueTemplateRefusals('connector_action', {}, node).find(
102+
(r) => r.block === 'connectorConfig' && r.path === `input.${key}`,
103+
);
104+
expect(found, `the spec refuses connectorConfig.input.${key}`).toBeDefined();
105+
return found!.message;
106+
}
107+
108+
/** The control group a typed field's label heads. */
109+
function typedField(labelText: string): HTMLElement {
110+
const group = screen.getByText(labelText, { selector: 'label' }).parentElement;
111+
if (!group) throw new Error(`no group under the "${labelText}" label`);
112+
return group;
113+
}
114+
115+
function lastInput(onPatch: ReturnType<typeof vi.fn>): unknown {
116+
expect(onPatch).toHaveBeenCalled();
117+
const patch = onPatch.mock.calls.at(-1)![0] as { nodes?: Array<Record<string, unknown>> };
118+
const node = (patch.nodes ?? []).find((n) => n.id === 'post')!;
119+
return (node.connectorConfig as Record<string, unknown>).input;
120+
}
121+
122+
describe('#28164 — a typed connector input is a value slot', () => {
123+
it('shows the spec’s refusal in the form when a `{…}` token is typed into the value', async () => {
124+
mockRegistry([{ key: 'chat.postMessage', label: 'Post Message', inputSchema: SLACK_POST_MESSAGE }]);
125+
const { onPatch } = renderInspector({ channel: 'C123' });
126+
127+
await screen.findByText('Text', { selector: 'label' });
128+
const field = typedField('Text');
129+
expect(within(field).queryByRole('alert')).toBeNull();
130+
fireEvent.change(within(field).getByRole('textbox'), { target: { value: 'Hello {record.name}' } });
131+
132+
expect(lastInput(onPatch)).toEqual({ channel: 'C123', text: 'Hello {record.name}' });
133+
const alert = await within(typedField('Text')).findByRole('alert');
134+
expect(alert.textContent).toContain(specRefusal({ channel: 'C123', text: 'Hello {record.name}' }, 'text'));
135+
});
136+
137+
it('shows the refusal for a stored token, and none for a plain literal', async () => {
138+
mockRegistry([{ key: 'chat.postMessage', label: 'Post Message', inputSchema: SLACK_POST_MESSAGE }]);
139+
const stored = { channel: 'C123', text: 'Hi {name}' };
140+
renderInspector(stored);
141+
142+
await screen.findByText('Text', { selector: 'label' });
143+
expect(within(typedField('Text')).getByRole('alert').textContent).toContain(specRefusal(stored, 'text'));
144+
expect(within(typedField('Channel')).queryByRole('alert')).toBeNull();
145+
});
146+
147+
it('offers the expression toggle, which stores a CEL value envelope at the same key', async () => {
148+
mockRegistry([{ key: 'chat.postMessage', label: 'Post Message', inputSchema: SLACK_POST_MESSAGE }]);
149+
const { onPatch } = renderInspector({ channel: 'C123' });
150+
151+
await screen.findByText('Text', { selector: 'label' });
152+
const field = typedField('Text');
153+
fireEvent.change(within(field).getByRole('textbox'), { target: { value: "'Hello ' + record.name" } });
154+
fireEvent.click(within(field).getByRole('button', { name: TOGGLE }));
155+
156+
expect(lastInput(onPatch)).toEqual({ channel: 'C123', text: { dialect: 'cel', source: "'Hello ' + record.name" } });
157+
expect(within(typedField('Text')).queryByRole('alert')).toBeNull();
158+
});
159+
});
160+
161+
describe('#28164 — the Input repeater’s values are value slots', () => {
162+
it('shows the spec’s refusal under a repeater value holding a `{…}` token, and offers the toggle', async () => {
163+
mockRegistry([{ key: 'plain', label: 'Plain' }]);
164+
const stored = { channel: 'C123', note: 'Hi {name}' };
165+
renderInspector(stored, 'plain');
166+
167+
await screen.findByDisplayValue('note');
168+
const alert = await screen.findByRole('alert');
169+
expect(alert.textContent).toContain(specRefusal(stored, 'note'));
170+
expect(screen.getAllByRole('button', { name: TOGGLE })).toHaveLength(2);
171+
});
172+
173+
it('a token typed into a repeater value is refused in place', async () => {
174+
mockRegistry([{ key: 'plain', label: 'Plain' }]);
175+
renderInspector({ channel: 'C123' }, 'plain');
176+
177+
const cell = await screen.findByDisplayValue('C123');
178+
expect(screen.queryByRole('alert')).toBeNull();
179+
fireEvent.change(cell, { target: { value: '{record.channel}' } });
180+
fireEvent.blur(cell);
181+
182+
await waitFor(() =>
183+
expect(screen.getByRole('alert').textContent).toContain(specRefusal({ channel: '{record.channel}' }, 'channel')),
184+
);
185+
});
186+
});

‎ui/packages/app-shell/src/views/metadata-admin/inspectors/flow-value-envelope.test.ts‎

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
ASSIGNMENT_VALUE_ENVELOPE_REFUSAL,
1313
CreateRecordConfigSchema,
1414
FLOW_NODE_EXPRESSION_PATHS,
15+
FlowValueSlotSchema,
1516
ScreenConfigSchema,
1617
ScriptConfigSchema,
1718
SubflowConfigSchema,
@@ -38,7 +39,17 @@ describe('isValueEnvelopeSlot — read off the spec expression ledger (objectui#
3839
expect(isValueEnvelopeSlot(undefined, ['config', 'assignments'])).toBe(false);
3940
});
4041

41-
it('offers the envelope on exactly the six hand-table key/value maps the ledger names', () => {
42+
it('reads the block an entry is rooted in: a connector_action node’s input map is `connectorConfig.input`', () => {
43+
// The ledger roots `connector_action` `input.*` in the node's
44+
// `connectorConfig` sibling block. The same key under `config` is not the
45+
// map the executor reads (the flow parse refuses it as a loose key), so it
46+
// is not offered there.
47+
expect(isValueEnvelopeSlot('connector_action', ['connectorConfig', 'input'])).toBe(true);
48+
expect(isValueEnvelopeSlot('connector_action', ['config', 'input'])).toBe(false);
49+
expect(isValueEnvelopeSlot('subflow', ['connectorConfig', 'input'])).toBe(false);
50+
});
51+
52+
it('offers the envelope on exactly the seven hand-table key/value maps the ledger names', () => {
4253
// The key/value editor serves many maps (params, headers, filters, inputs)
4354
// where an object naming a `dialect` is plain data. Every keyValue field in
4455
// the designer table is enumerated here. If the ledger declares another
@@ -51,6 +62,11 @@ describe('isValueEnvelopeSlot — read off the spec expression ledger (objectui#
5162
// again at 18.0.0-next.0 (ADR-0032 §3), which declares `screen`
5263
// `defaults.*`, `script` `inputs.*` and `subflow` `input.*` as well; the
5364
// next case measures the same confirmation for those three (objectui#12030).
65+
// It grew to seven when `isValueEnvelopeSlot` started reading an entry's
66+
// block, so the `connector_action` input map the ledger roots in
67+
// `connectorConfig` is offered at the path the designer table writes; the
68+
// next case measures its confirmation against the judge `registerFlow`
69+
// applies there.
5470
const keyValueFields = FLOW_NODE_CONFIG_TYPES.flatMap((type) =>
5571
fieldsForNodeType(type)
5672
.filter((f) => f.kind === 'keyValue')
@@ -62,18 +78,18 @@ describe('isValueEnvelopeSlot — read off the spec expression ledger (objectui#
6278
.map(({ type, path }) => `${type}:${path.join('.')}`);
6379
expect(offered.sort()).toEqual([
6480
'assignment:config.assignments',
81+
'connector_action:connectorConfig.input',
6582
'create_record:config.fields',
6683
'screen:config.defaults',
6784
'script:config.inputs',
6885
'subflow:config.input',
6986
'update_record:config.fields',
7087
]);
71-
// The ledger's whole `value`-role list at 18.0.0-next.0. The six `KEY.*`
72-
// maps above are the ones a key/value cell serves; the rest are single
73-
// values (a filter, a collection, a recipient list, a record id) or a
74-
// nested path, which this editor does not render per entry. The list grew
75-
// at #27968 / #28150 with the one entry rooted in `connectorConfig`
76-
// (`connector_action:input.*`), which `isValueEnvelopeSlot` does not offer.
88+
// The ledger's whole `value`-role list. The seven `KEY.*` maps above are
89+
// the ones a key/value cell serves; the rest are single values (a filter,
90+
// a collection, a recipient list, a record id) or a nested path, which this
91+
// editor does not render per entry. The list grew at #27968 / #28150 with
92+
// the one entry rooted in `connectorConfig` (`connector_action:input.*`).
7793
expect(
7894
FLOW_NODE_EXPRESSION_PATHS.filter((e) => e.role === 'value').map((e) => `${e.nodeType}:${e.path}`).sort(),
7995
).toEqual([
@@ -110,6 +126,10 @@ describe('isValueEnvelopeSlot — read off the spec expression ledger (objectui#
110126
'screen:defaults': (v: unknown) => ScreenConfigSchema.safeParse({ defaults: { name: v } }),
111127
'script:inputs': (v: unknown) => ScriptConfigSchema.safeParse({ function: 'my_fn', inputs: { name: v } }),
112128
'subflow:input': (v: unknown) => SubflowConfigSchema.safeParse({ flowName: 'child_flow', input: { name: v } }),
129+
// The input map's block schema does not judge its values: `registerFlow`
130+
// judges each envelope the ledger resolves there with the value-slot
131+
// schema, and the `{…}` token with `flowNodeValueTemplateRefusals`.
132+
'connector_action:connectorConfig.input': (v: unknown) => FlowValueSlotSchema.safeParse(v),
113133
} as const;
114134
const MALFORMED = [{ dialect: 'cel' }, { dialect: 'js', source: 'a' }];
115135
for (const [slot, parse] of Object.entries(slots)) {

0 commit comments

Comments
 (0)