Allow a workflow to be assigned an initial state different from the first state declared. #64
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
My current use case is a model for outgoing payments with the following workflow:
The payout falls into
:incompletestate if the prerequisites (which are more than validations alone) are not met. However, a new payout should be born with:pendingstate for reasons beyond my control.I could of course declare the
:incompletestate last, but since one of the previous extensions of the workflow geminclude Comparableand thus allow states to be compared by declaration order e.g. with>or<, the right place of this state is first.The
initial_stateis completely optional. Unless present, the first state declared will automatically become the initial state and therefore this commit is fully backwards compatible and shouldn't break any existing code.Thanks for considering this addition!