Skip to content

state: StartEffects leaves out a compound state's services and actors, so Start and Recover don't start them #249

Open

Description

@reka18

What happens

Instance.StartEffects covers the active leaves only. A service or actor declared on a compound state starts when a Fire enters that state, since the kernel's entry path emits every entered state's invokes, but not when Start casts into it or Recover resumes in it. A durable instance that starts in, or recovers into, a compound state runs without that state's services and actors.

Why it isn't a one-line change

Widening StartEffects to every active state was tried in #234 and reverted, to keep state's v1 behavior unchanged there:

  • after a Restore, a compound state's service or actor may already have settled into one of its children, and the snapshot can't say, so starting it again runs it twice. durable would need to record which settled (it records ended actors and settled services now, but only for this version's journals);
  • a checkpoint an older version wrote records neither, so Recover from one would need to treat a compound state's invokes as settled;
  • ResumeEffects has to stay leaves-only for the same reason.

Tests: #234 adds skipped tests for this: TestRecover_SpawnsASuperstatesActor, TestRecover_DoesNotRearmASuperstatesSettledService, TestRecover_StartsAServiceAnActorsMessageReentered and TestRecover_ARetriedSpawnsMessageDoesNotRestartARunningActor.

Relates to: #214, #234

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