Skip to content

Server: route FiniteStateMachineDispatcher through the FiniteStateMachineState transition core #5224

Backlog

Description

@romanett

Follow-up to the MD-1 state-machine builder consolidation.

Problem

FiniteStateMachineDispatcher (src/Opc.Ua.Server) is still a separate path for changing a state machine's state. The Di, Extrusion, MachineTool and Robotics companion servers use it.

It is meant for generated machines that have no StateTable or TransitionTable. It writes CurrentState and LastTransition directly. That differs from FiniteStateMachineState.DoTransition, PrepareTransition/CommitTransition, StateMachineBuilder<T> and ProgramRuntime, which all go through the machine's transition core. As a result, the dispatcher:

  • raises no TransitionEventType events,
  • does not increment StateRevision or otherwise act like a committed transition,
  • runs no guards and no OnBefore/OnAfter transition hooks, so builder callbacks (OnEnter/OnExit/OnTransition/When*) never fire on these machines.

What unifying it needs

  1. State tables for generated machines. The core needs state and transition tables. Either the source generator emits them from the type model (HasTransition, FromState/ToState, HasCause), or Opc.Ua.Core.Types gets an API that injects them into FiniteStateMachineState.
  2. Route the dispatcher through the core. With the tables in place, the dispatcher (or its callers) can use DoTransition/DoCause, or the dispatcher can be removed in favour of StateMachineBuilder<T>.
  3. Accept the visible behaviour change. The four companion servers would start emitting TransitionEvents and bumping StateRevision. That is spec-conformant (OPC 10000-16), but clients and tests of those servers will see it. It needs a changelog and migration note.

Out of scope / already done

  • ProgramRuntime already commits through PrepareTransition/CommitTransition, so it needs no change.
  • The Fluent IStateMachineBuilder now forwards to StateMachineBuilder<T>.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions