Summary
Flow createFields asks for type, but createDefaults does not include a default value for type. If a user saves without selecting a type, the body may fail server validation against FlowSchema.
Root cause
In packages/app-shell/src/views/metadata-admin/anchors.ts, lines 253-267:
createFields: ['label', 'name', 'type', 'description'],
createDefaults: { nodes: [], edges: [] },
The spec's FlowSchema (spec/src/automation/flow.zod.ts, line 253) defines type: z.enum(['autolaunched', 'record_change', 'schedule', 'screen', 'api']) as non-optional. The authoritative BUILTIN_METADATA_CREATE_SEEDS correctly seeds type: 'autolaunched', but anchors.ts createDefaults is out of sync.
There is also no createSchema, so the type enum is not constrained client-side.
Steps to reproduce
- Create a new Flow, enter name and label
- Don't explicitly pick a
type value
- Save — may fail server validation because
type is missing
Expected behavior
createDefaults should include type: 'autolaunched'.
Fix
- createDefaults: { nodes: [], edges: [] },
+ createDefaults: { type: 'autolaunched', nodes: [], edges: [] },
Also optionally add a createSchema with a type enum.
Impact
Users who don't explicitly select a flow type before save may encounter a server validation error.
Summary
Flow
createFieldsasks fortype, butcreateDefaultsdoes not include a default value fortype. If a user saves without selecting a type, the body may fail server validation againstFlowSchema.Root cause
In
packages/app-shell/src/views/metadata-admin/anchors.ts, lines 253-267:The spec's
FlowSchema(spec/src/automation/flow.zod.ts, line 253) definestype: z.enum(['autolaunched', 'record_change', 'schedule', 'screen', 'api'])as non-optional. The authoritativeBUILTIN_METADATA_CREATE_SEEDScorrectly seedstype: 'autolaunched', but anchors.tscreateDefaultsis out of sync.There is also no
createSchema, so thetypeenum is not constrained client-side.Steps to reproduce
typevaluetypeis missingExpected behavior
createDefaultsshould includetype: 'autolaunched'.Fix
Also optionally add a
createSchemawith atypeenum.Impact
Users who don't explicitly select a flow type before save may encounter a server validation error.