StoneCypher / fsl

Finite State Language specification
9 stars 1 forks source link

Possible loss of `data` in `transition_impl` #1259

Closed StoneCypher closed 6 months ago

StoneCypher commented 6 months ago

The claim is made that the transition_impl path can drop data from current state and history if hooks are not in use

There is a partial reproduction in StoneCypher/jssm#557

Thanks to @WNemencha for reporting this originally

StoneCypher commented 6 months ago

Confirmed

image

StoneCypher commented 6 months ago

data argument for transition, action, go, do via transition_impl wasn't actually wired up. it looked like it was, because the data return value from hooks was and they go through the same mutual implementor.

You were right that the call pattern had to be implemented without hooks, but I also had to implement the call pattern with hooks.

This led to noticing that at this time, there is also no way practical way to set data to undefined, which will be fixed promptly.

26 tests added to enforce:

  1. a common sense full cycle without hooks
  2. a common sense full cycle with hooks
  3. every adjacent pairing of hooks in ordering, to assert that hooks override in the correct order

Thank you, @WNemencha , for improving this state machine. I apologize for this oversight.

image

WNemencha commented 6 months ago

You're welcome, thanks for fixing this.