StackStorm / StackStorm/st2

Feature Request - Orquesta inspection of when expressions

Open
#4,635 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature proposal workflows: orquesta
Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

SUMMARY

Recently in Slack there have been several help requests that all were caused by people introducing logic errors into when expressions in task transitions. When these logic errors are made they result in the when expression always evaluating to true/false and Orquesta either taking always an unexpected branch (in the case of the expression always evaluating to True) and never taking the branch they expect (in the case where the expression always evaluates to False)

This request is to help detect these kinds of errors and warn/fail the workflow to help the user.

ISSUE TYPE
  • Feature Idea
STACKSTORM VERSION
2.10.2
PROBLEM EXPRESSIONS
Mis-typed state functions

Bad Expression:

when: <% succeeded %>

Logic Error:

  • The user thought that they were executing only when the task succeeded, but their expression instead was returning the string succeeded which then evaluated to True and caused that branch to always be taken

Proper Expression:
What the user really wanted was to use the succeeded() function.

when: <% succeeded() %>
Logic outside of expression delimeters

Bad Expression:

when: <% ctx().foo %> and <% ctx().bar %>

Logic Error:

  • The user thought that they were combining two expressions logically with the and keyword. Instead they were creating a string "foo's value and bar's value". This string is non-empty so evaluates to True and causes the branch to be taken no matter the values of ctx().foo and ctx().bar.

Proper Expression
What the user really wanted was to put the logic keyword inside of the expression delimiters

when: <% ctx().foo and ctx().bar %>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points. Start by locating Orquesta's handling of task-transition when expressions and review the two malformed examples; done should include detection that warns or fails workflows for these logic errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.