Flow(s) Harm Enclosing Contract

This type of issue is an indication that the enclosing block's activity diagram and its contract do not match.

There are incoming flow(s) (from one or more input parameter nodes) that is not consistent with a transition of the enclosing block. Usually, the label of the transition has too many or too few parameter nodes.

Severity

General Solutions

Since this type of error is related to consistence between the block's activity diagram and its contract, there are, in general, two actions that can be taken to correct it.

  • Change the contract, keep the activity diagram unchanged.
  • Change the activity diagram, keep the contract unchanged.

Of course, you can modify both the contract and the activity diagram. The goal is to make the activity diagram and the contract consistent with one another.

Note that if the harming flow(s) includes an inner block, modifying the activity diagram might require changes to the behavior of the inner block. This action might not be possible when the block is taken from a library or created by other developer. Moreover, making modifications to the inner block might affect other blocks that also use the block.

Example

An example of this type of error is depicted in the following figure.

We see that there is an incoming flow from parameter node send when block Sender is in state active. According to the contract of the enclosing block shown in the upper right hand-side, there are two transitions from state active

  • A transition to a final state with label stop/stopped
  • A transition to state sending with label send/

The second transition is related to the flow from input node send. However, the activity step that corresponds to this flow also includes parameter node ack of block Sender, pins transmit and done from inner block Transmitter. Note that, in the activity step the inner block takes transition from and to state started labelled with transmit/done (see the lower right hand-side part in the figure above). The above activity step is not consistent with the right hand-side transition of state active of block Sender. Or, with any other transition.

Possible Fixe(s)

Here, we show two alternatives that fix the error.

Modify the Contract

We leave the activity diagram of block Sender as it is and change its contract as depicted in the following figure.

As shown in the figure, we remove two transitions:

  • the transition from state active to state ending labelled with send/,
  • the transition from state sending to state active labelled with /ack.

Therefore, we also remove:

  • unused state sending.

And, we add:

  • one self-transition of state active with label send/ack.

Modify the Activity Diagram 1

We keep the contract of block Sender and modify the activity diagram by adding a 0ms timer between pin done of inner block Transmitter and output parameter node ack as depicted in the following figure.

Modify the Activity Diagram 2: the Inner Block

For this example, it is possible to leave the contract of block Sender as it is and change the behavior of inner block Transmitter. Note that this implies that we also modify the activity diagram of the enclosing block. We need the contract of the inner block as depicted in the following figure.

We remove one transition:

  • self-transition of state started labelled with transmit/done.

We add two transitions and a state:

  • one transition from state started to state transmitting labelled with transmit,
  • one transition from state transmitting to state started labelled with done.

In short, the self-transition is splited into two. However, this change to the inner block contract also requires changes to its corresponding activity diagram. One of possible modification is depicted in the following figure.

  • Event DONE is added between operation sendOut and output done
  • Operation sendOut is added with line sendToBlock(“Done”);

Refer to this page on how to work with event or reception. Since the behavior of block Transmitter is modified, consequently the activity diagram of block Sender also needs to be changed. However, the only change here is the inner block. We need to apply Match with Original Block action to the inner block. After the synchronization action, the activity diagram of block Sender, however, still looks the same as the original one.