fix(fsm): refuse all transitions in the Error state

- The Error state is a terminate state: the state machine ignores all
  events in it and calls no action, so ChangeState() returned the
  result of the previous transition (ErrorFound: true)
- Return false for each transition in the Error state, except for
  ErrorFound: the device is already in the Error state, so callers
  such as ChangeStateOrThrow(ErrorFound) in Device::RunWrapper() or
  in user code do not throw
- Enable StateMachine.RefusesTransitionsInError
- Update the documentation pages that described the defect, and
  the source line links into the changed files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-11-04 21:12:48 +00:00
committed by Dennis Klein
parent 8de8505f8c
commit 442b203d0d
7 changed files with 17 additions and 17 deletions

View File

@@ -259,6 +259,12 @@ try {
auto fsm = static_pointer_cast<FairMQFSM>(fFsm);
lock_guard<mutex> lock(fsm->fStateMtx);
if (!static_cast<bool>(fsm->fNewStatePending) || transition == Transition::ErrorFound) {
// The Error state is a terminate state: the state machine ignores all events in it and
// calls no action, so fLastTransitionResult would keep the result of ErrorFound.
// ErrorFound has nothing left to do; refuse all other transitions.
if (fsm->is_flag_active<boost::msm::TerminateFlag>()) {
return transition == Transition::ErrorFound;
}
switch (transition) {
case Transition::Auto:
fsm->process_event(AUTO_E());