Skip to content

Flow createDefaults missing type field — save may fail server validation if type not explicitly selected #2326

Description

@akarma-synetal

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

  1. Create a new Flow, enter name and label
  2. Don't explicitly pick a type value
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions