Skip to content

Add workflow composition normalization - #9

Draft
sezallagwal wants to merge 2 commits into
feature/workflow-expression-securityfrom
feature/workflow-composer-normalization
Draft

Add workflow composition normalization#9
sezallagwal wants to merge 2 commits into
feature/workflow-expression-securityfrom
feature/workflow-composer-normalization

Conversation

@sezallagwal

Copy link
Copy Markdown
Collaborator

Summary

  • Add normalization for workflow composer input
  • Convert shorthand fields into the final workflow format
  • Normalize event parameter references and template fields
  • Flatten nested workflow steps into a single step list
  • Return warnings when the composer automatically fixes or rewrites input

Depends on

#8

@dhairyashiil dhairyashiil left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Sezal, could we adjust the FOR_EACH / AS alias handling here?

Right now aliases like AS ch are treated globally during normalization. So a later step that is not inside that loop can still write {{ch.name}}, and it gets rewritten as {{steps.ch.name}}. That composes, but at runtime the alias does not exist there and the value becomes empty.

Could we scope the alias only to the step that owns the FOR_EACH, mainly inside that step’s inputMapping? Outside that scope, references like {{ch.name}} should probably fail validation.

This will make workflow behavior easier to reason about and avoid silent empty values later.

@dhairyashiil
dhairyashiil marked this pull request as draft July 1, 2026 09:03
Aliases from `forEach ... as <x>` were normalized globally, so an out-of-scope `{{x.field}}` in an unrelated step was silently rewritten to `{{steps.x.field}}` and resolved to empty at runtime.

Scope alias rewriting to the owning step's inputMapping, treat the forEach collection expression as out of scope, and reject out-of-scope alias references with a clear ComposerError. Also fix pre-existing lint issues in the file and add unit tests covering the scoping behavior.
@sezallagwal
sezallagwal requested a review from dhairyashiil July 7, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants