Skip to content

Commit 2c3f9f5

Browse files
committed
fix(spec): the stored-shape listing hands the value-slot judge the node, so a connector_action's connectorConfig.input token is listed
The flow value-slot detector judged a node's `config` alone, so the slot the ledger roots in a connector_action node's `connectorConfig.input` was never read: `os migrate meta --stored` named nothing for a stored row that `registerFlow` refuses at boot. Both flow detectors now share one walk that hands the judge the whole node, as registerFlow and objectstack validate do, and split its refusals by block: `config` under flow-value-slot-template-dialect-refused, `connectorConfig` under connector-action-input-value-slot-judged, the D3 entry that refuses it. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibz8wBXN5R4YRtm5e5r
1 parent 3a2f4c0 commit 2c3f9f5

3 files changed

Lines changed: 174 additions & 21 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/spec': patch
3+
---
4+
5+
fix(spec): `os migrate meta --stored` lists a stored `connector_action` node whose `connectorConfig.input` carries a `{…}` token, which boot refuses
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
- **Before.** The stored-shape listing judged a flow node's value slots with the node's `config` alone, so it never read the value slot rooted in a `connector_action` node's `connectorConfig.input`. A stored flow with `input: { text: '{record.name}' }` was refused by `registerFlow` at boot (skipped with a `warn`, its trigger not armed), yet the preview listed nothing for it.
11+
- **Now.** The listing hands the value-slot judge the whole node, as `registerFlow` and `objectstack validate` do, so it lists such a value as a TODO under the `connector-action-input-value-slot-judged` entry, by flow, node and path (`connectorConfig.input.text`), with the value's CEL spelling. A loose `config.input` the conversions lift onto `connectorConfig` is listed at its lifted path. Nothing is rewritten.
12+
- **Unchanged.** A `config` value slot is listed under `flow-value-slot-template-dialect-refused`, as before. A CEL value envelope or a literal in `connectorConfig.input` is not listed.

‎packages/spec/src/conversions/refused-shapes.test.ts‎

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { describe, expect, it } from 'vitest';
44

5+
import { FLOW_NODE_SIBLING_EXPRESSION_BLOCKS } from '../automation/flow-node-expression-paths.js';
56
import { flowNodeValueTemplateRefusals } from '../automation/flow-value-slot-template.js';
67
import { ObjectSchema } from '../data/object.zod.js';
78
import { MIGRATIONS_BY_MAJOR } from '../migrations/registry.js';
@@ -66,6 +67,7 @@ describe('the refused-shape list — registered against the migration chain', ()
6667
'cbp-master-relation-tiers-retired',
6768
'view-data-api-provider-retired',
6869
'flow-value-slot-template-dialect-refused',
70+
'connector-action-input-value-slot-judged',
6971
'object-external-binding-managed-datasource-refused',
7072
'visibility-predicate-has-argument-refused',
7173
'object-duplicate-action-name-refused',
@@ -364,6 +366,94 @@ describe('#23269 — a stored flow whose CRUD filter operand is a {…} token is
364366
});
365367
});
366368

369+
// ── #28163 ────────────────────────────────────────────────────────────────
370+
371+
const connectorNode = (id: string, input: unknown) => ({
372+
id,
373+
type: 'connector_action',
374+
label: id,
375+
connectorConfig: { connectorId: 'helpdesk', actionId: 'open_ticket', input },
376+
});
377+
378+
describe('#28163 — a stored connector_action whose connectorConfig.input carries a {…} token is listed by flow and node', () => {
379+
it('one TODO under the connector input entry, at connectorConfig.input.<key>; the row is not rewritten', () => {
380+
const row = flowOf('fd_connector', [connectorNode('ticket', { text: '{record.name}', queue: 'support' })]);
381+
const before = JSON.stringify(row);
382+
const { item, todos } = storedTodos('flow', row);
383+
expect(JSON.stringify(item)).toBe(before);
384+
expect(todos).toHaveLength(1);
385+
const todo = todos[0]!;
386+
expect(todo.conversionId).toBe('connector-action-input-value-slot-judged');
387+
expect(todo.path).toBe('flows[0].nodes[1].connectorConfig.input.text');
388+
expect(todo.from).toBe(JSON.stringify('{record.name}'));
389+
expect(todo.reason).toContain(
390+
"Flow `fd_connector`, node 'ticket' (connector_action), connector_action input value at connectorConfig.input.text.",
391+
);
392+
expect(todo.reason).toContain('registerFlow refuses the flow: it is not registered at boot and never runs');
393+
expect(todo.reason).toContain("{ dialect: 'cel', source: 'record.name' }");
394+
});
395+
396+
it('reaches a value nested in the input map, and a node inside a structured region', () => {
397+
const flow = flowOf('fd_connector_loop', [{
398+
id: 'each', type: 'loop', label: 'Each',
399+
config: {
400+
collection: { dialect: 'cel', source: 'items' },
401+
body: { nodes: [connectorNode('inner', { tags: ['ok', '{item.tag}'] })], edges: [] },
402+
},
403+
}]);
404+
const todos: ConversionTodoNotice[] = [];
405+
applyConversionsToFlow(flow, { includeRetired: true, onTodo: (t) => todos.push(t) });
406+
expect(todos.map((t) => [t.conversionId, t.path])).toEqual([
407+
['connector-action-input-value-slot-judged', 'flows[0].nodes[1].config.body.nodes[0].connectorConfig.input.tags[1]'],
408+
]);
409+
});
410+
411+
it('judges the row the conversions produced: a loose config.input the chain lifts is listed at connectorConfig', () => {
412+
const row = flowOf('fd_connector_loose', [{
413+
id: 'loose', type: 'connector_action', label: 'Loose',
414+
config: { connectorId: 'helpdesk', actionId: 'open_ticket', input: { text: '{record.name}' } },
415+
}]);
416+
const { todos } = storedTodos('flow', row);
417+
expect(todos.map((t) => [t.conversionId, t.path])).toEqual([
418+
['connector-action-input-value-slot-judged', 'flows[0].nodes[1].connectorConfig.input.text'],
419+
]);
420+
});
421+
422+
it.each([
423+
['a CEL envelope', { text: { dialect: 'cel', source: 'record.name' } }],
424+
['a literal', { text: 'Ticket', queue: 'support' }],
425+
['no input', undefined],
426+
])('a connector_action already on protocol (%s) is not listed', (_label, input) => {
427+
const flow = flowOf('fd_connector_ok', [connectorNode('ticket', input)]);
428+
const todos: ConversionTodoNotice[] = [];
429+
applyConversionsToFlow(flow, { includeRetired: true, onTodo: (t) => todos.push(t) });
430+
expect(todos).toEqual([]);
431+
});
432+
433+
it('agrees with the refusing door: each site is one the value-slot judge refuses when handed the node, and no other', () => {
434+
const nodes: Array<Record<string, any>> = [
435+
connectorNode('a', { text: '{record.name}', id: { dialect: 'cel', source: 'record.id' } }),
436+
crudNode('b', 'get_record', { id: '{record.id}' }),
437+
connectorNode('c', { note: 'plain' }),
438+
];
439+
const { todos } = todosOf({ flows: [flowOf('fd_connector_mixed', nodes)] });
440+
// The door's own call — `registerFlow` and `objectstack validate` hand the node.
441+
const judged = nodes.flatMap((n, i) =>
442+
flowNodeValueTemplateRefusals(n.type, n.config, n).map((r) => `flows[0].nodes[${i + 1}].${r.block}.${r.path}`));
443+
// Report order is detector order, so the two are compared as sets.
444+
expect(todos.map((t) => t.path).sort()).toEqual([...judged].sort());
445+
expect(todos.map((t) => [t.conversionId, t.path])).toEqual([
446+
['flow-value-slot-template-dialect-refused', 'flows[0].nodes[2].config.filter.id'],
447+
['connector-action-input-value-slot-judged', 'flows[0].nodes[1].connectorConfig.input.text'],
448+
]);
449+
});
450+
451+
it('the two flow detectors cover every block the ledger roots a value slot in', () => {
452+
// A new sibling block needs a detector here (and its D3 entry) before its refusals can be listed.
453+
expect(['config', ...Object.keys(FLOW_NODE_SIBLING_EXPRESSION_BLOCKS)]).toEqual(['config', 'connectorConfig']);
454+
});
455+
});
456+
367457
// ── #23317 ────────────────────────────────────────────────────────────────
368458

369459
describe('#23317 — a stored page whose component binds the retired API source in its `data` prop is listed by page and component', () => {

‎packages/spec/src/conversions/refused-shapes.ts‎

Lines changed: 72 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
* component-props gate parses at the CLI doors and at the runtime save
3939
* door — and the value-slot judge
4040
* `AutomationEngine.registerFlow` and `objectstack validate` run
41-
* ({@link flowNodeValueTemplateRefusals}), and the `external` binding judge
41+
* ({@link flowNodeValueTemplateRefusals}), handed the whole node as those
42+
* doors hand it, so a sibling block's slot is judged too, and the
43+
* `external` binding judge
4244
* the object refinement and `defineStack` share
4345
* ({@link externalBindingDatasourceRefusal}), and the one-name-per-action
4446
* judge of the object refinement ({@link duplicateActionNames}). A site is listed here exactly
@@ -54,7 +56,10 @@
5456
* The TODO notices it produces are the published shape.
5557
*/
5658

57-
import { flowNodeValueTemplateRefusals } from '../automation/flow-value-slot-template.js';
59+
import {
60+
flowNodeValueTemplateRefusals,
61+
type FlowNodeValueTemplateRefusal,
62+
} from '../automation/flow-value-slot-template.js';
5863
import {
5964
controlledByParentMasterRefusal,
6065
isControlledByParentMasterField,
@@ -391,30 +396,75 @@ const viewDataApiProvider: RefusedStoredShape = {
391396

392397
// ── #23269: a flow value slot carrying a `{…}` token, a CRUD filter operand among them ──
393398

399+
/**
400+
* Hand every value-slot refusal of every node of every stored flow to `visit`,
401+
* with the flow's listed name and the node's own path. The judge is handed the
402+
* node itself (#28163), as `registerFlow` and `objectstack validate` hand it,
403+
* so a slot the ledger roots in a sibling block — a `connector_action` node's
404+
* `connectorConfig.input` — is judged here exactly when those doors judge it.
405+
* Each refusal names its block, and the two detectors below split the blocks
406+
* by the D3 entry that refuses each: `config` and `connectorConfig`, which
407+
* `refused-shapes.test.ts` holds equal to the blocks the ledger declares, so a
408+
* new sibling block cannot go unlisted.
409+
*/
410+
function forEachFlowValueSlotRefusal(
411+
stack: Dict,
412+
visit: (flowName: string, node: Dict & { type: string }, path: string, refusal: FlowNodeValueTemplateRefusal) => void,
413+
): void {
414+
const flows = stack.flows;
415+
if (!Array.isArray(flows)) return;
416+
flows.forEach((flow, fi) => {
417+
if (!isDict(flow) || !Array.isArray(flow.nodes)) return;
418+
const flowName = typeof flow.name === 'string' ? flow.name : `flows[${fi}]`;
419+
mapFlowNodeList(flow.nodes, `flows[${fi}].nodes`, (node, path) => {
420+
if (typeof node.type !== 'string') return node;
421+
const typed = node as Dict & { type: string };
422+
for (const refusal of flowNodeValueTemplateRefusals(typed.type, node.config, node)) {
423+
visit(flowName, typed, path, refusal);
424+
}
425+
return node;
426+
});
427+
});
428+
}
429+
394430
const flowValueSlotTemplateToken: RefusedStoredShape = {
395431
id: 'flow-value-slot-template-dialect-refused',
396432
toMajor: 18,
397433
surface: 'flows[].nodes[].config — a value slot (a get_record, update_record or delete_record filter operand among them)',
398434
detect(stack, report) {
399-
const flows = stack.flows;
400-
if (!Array.isArray(flows)) return;
401-
flows.forEach((flow, fi) => {
402-
if (!isDict(flow) || !Array.isArray(flow.nodes)) return;
403-
const flowName = typeof flow.name === 'string' ? flow.name : `flows[${fi}]`;
404-
mapFlowNodeList(flow.nodes, `flows[${fi}].nodes`, (node, path) => {
405-
if (typeof node.type !== 'string') return node;
406-
for (const refusal of flowNodeValueTemplateRefusals(node.type, node.config)) {
407-
report({
408-
path: `${path}.config.${refusal.path}`,
409-
from: JSON.stringify(refusal.source),
410-
reason: `Flow \`${flowName}\`, node '${String(node.id)}' (${node.type}), ${refusal.label} at `
411-
+ `config.${refusal.path}. No lossless rewrite: the template resolved a token CEL reads `
412-
+ 'differently, so the upgrade does not convert it. Left as stored, registerFlow refuses the flow: '
413-
+ 'it is not registered at boot and never runs. '
414-
+ refusal.message,
415-
});
416-
}
417-
return node;
435+
forEachFlowValueSlotRefusal(stack, (flowName, node, path, refusal) => {
436+
if (refusal.block !== 'config') return;
437+
report({
438+
path: `${path}.config.${refusal.path}`,
439+
from: JSON.stringify(refusal.source),
440+
reason: `Flow \`${flowName}\`, node '${String(node.id)}' (${node.type}), ${refusal.label} at `
441+
+ `config.${refusal.path}. No lossless rewrite: the template resolved a token CEL reads `
442+
+ 'differently, so the upgrade does not convert it. Left as stored, registerFlow refuses the flow: '
443+
+ 'it is not registered at boot and never runs. '
444+
+ refusal.message,
445+
});
446+
});
447+
},
448+
};
449+
450+
// ── #27968: a connector_action node's connectorConfig.input value carrying a `{…}` token ──
451+
452+
const connectorActionInputTemplateToken: RefusedStoredShape = {
453+
id: 'connector-action-input-value-slot-judged',
454+
toMajor: 18,
455+
surface: 'flows[].nodes[].connectorConfig.input — a value of a connector_action node\'s input map',
456+
detect(stack, report) {
457+
forEachFlowValueSlotRefusal(stack, (flowName, node, path, refusal) => {
458+
if (refusal.block !== 'connectorConfig') return;
459+
const at = `${refusal.block}.${refusal.path}`;
460+
report({
461+
path: `${path}.${at}`,
462+
from: JSON.stringify(refusal.source),
463+
reason: `Flow \`${flowName}\`, node '${String(node.id)}' (${node.type}), ${refusal.label} at ${at}. `
464+
+ 'No lossless rewrite: the action was handed the token\'s text as written, and no token has a '
465+
+ 'lossless CEL spelling, so the upgrade does not convert it. Left as stored, registerFlow refuses the '
466+
+ 'flow: it is not registered at boot and never runs. '
467+
+ refusal.message,
418468
});
419469
});
420470
},
@@ -513,6 +563,7 @@ export const REFUSED_STORED_SHAPES: readonly RefusedStoredShape[] = [
513563
controlledByParentWithoutOneMaster,
514564
viewDataApiProvider,
515565
flowValueSlotTemplateToken,
566+
connectorActionInputTemplateToken,
516567
externalBindingOnManagedDatasource,
517568
visibilityHasArgument,
518569
objectDuplicateActionName,

0 commit comments

Comments
 (0)