What exactly does the [always] in state machines do?


I'm loving the power of workflows, especially the state machines. However, there seems to be very little, if any, documentation on some of its features.

For example, all examples I've seen for state machines have the "on Fix[always] do {expression} transit to Fixed" syntax.

My question is: What is the meaning of [always] here? There seems to be no documentation on this Earth that tells me this. Am I overlooking something?
Hi Salvar,

Sorry for not responding earlier.
Thank you for improving our documentation, we'll add this to the reference.

[always] means that you may point here some conditions for the action.
on Fix[issue.Priority =={Critical}] do {expression}

Thank you and let us know, if have any additional questions.
Hi Andrey,

Thanks for the reply. I suspected that this was the case, but the conditions don't seem to do much.

Say I have a state machine with the states Development, Code Review and Acceptance Testing. In the Development state, I want to add the action "Approve", that transits the issue to the correct state. For issues that involve code, the next state is Code Review. For issues that don't involve writing code, it makes no sense to send them to Code Review and so they should go to Acceptance Testing.

Now, I was really hopeful that the [always] part allowed me to control the flow through the state machine, but sadly the implementation makes it borderline useless.

You see, when I define an action that is restricted to certain conditions, I expect that action to be unavailable when those conditions aren't met. That might be overly presumptuous of me, but that's more or less how I understand the concept of setting conditions for actions.

However, YouTrack has a different idea. In a given state, all actions are available to the user, even if the action itself is impossible due to conditionals. Just to confirm this mind-boggling functionality I created the following action in my state machine:

on Impossible[true == false] do {expression} transit to Backlog
This action is always impossible to choose. It can never be used. Does YouTrack use this information when populating the drop-down list of available actions? It most certainly does not. This action is always available to the user, even if it can never be used.

And should the user select this impossible action, YouTrack responds in turn with a user-friendly feedback of absolutely nothing. No message, no feedback, nothing at all.

Aside from this rant, I guess my question is: Why does YouTrack present the user with an action that YouTrack knows the user cannot choose?

Please sign in to leave a comment.