Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unreachable State Not Caught #17

Closed
mtsvickers opened this issue Mar 15, 2018 · 4 comments
Closed

Unreachable State Not Caught #17

mtsvickers opened this issue Mar 15, 2018 · 4 comments
Milestone

Comments

@mtsvickers
Copy link

If a state us unreachable it should be considered invalid ASL, but right now still validates.
Ex: ( "Finished Choice" is unreachable but this returns valid)

{
	"StartAt": "Start State",
	"States":{
		"Start State": {
			"Type": "Pass",
			"Next": "Finished"
		},
		"Finished Choice":{
			"Type":"Choice",
			"Choices": [
				{
					"Variable": "$.x",
					"BooleanEquals": false,
					"Next": "Finished"
				}
			],
			"Default": "Finished"
		},
		"Finished": {
			"Type": "Pass",
			"End": true
		}
	}
}
@ChristopheBougere
Copy link
Owner

Thanks for reporting!

image

You're right, this state machine definition should throw

Error code: MISSING_TRANSITION_TARGET 
Message: State "Finished Choice" is not reachable.

For now, asl-validator is validating syntax statically using JSON schemas and JSON paths.
I'd like to add this case, but we need to define a clear rule to know when a state is unreachable.
Maybe every state should be referenced either in:

  • a StartAt field (of the state machine or a parallel state)
  • a Next field (of a state or a catch)
  • a Default field (of a choice)

Do you see anything else?

@mtsvickers
Copy link
Author

mtsvickers commented Apr 2, 2018

I think that would cover everything for an unreachable state. The converse of this is if next points to a state which doesn't exist (typo in the name for example) we would want to catch that.

@ChristopheBougere
Copy link
Owner

Fixed in 1.0.8, thanks @tristanbenier

@mtsvickers
Copy link
Author

mtsvickers commented Apr 9, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants