Skip to content

[Docs] DurableStateBehavior should document RecoveryCompleted signal and correct import #2579

@hanishi

Description

@hanishi

The DurableStateBehavior documentation doesn't mention the RecoveryCompleted signal or show the correct import path. This leads to a subtle bug when users copy patterns from EventSourcedBehavior examples.

Problem

DurableStateBehavior and EventSourcedBehavior have different RecoveryCompleted signals in different packages:

Behavior Signal Import
EventSourcedBehavior org.apache.pekko.persistence.typed.RecoveryCompleted
DurableStateBehavior org.apache.pekko.persistence.typed.state.RecoveryCompleted

This introduced a subtle bug in my code: when I used the wrong import, the pattern match failed silently. The signal handler never triggered, but:

  • The code compiled without errors
  • No runtime exception was thrown
  • The signal was not matched

Questions

  1. Is there a reason these are separate types? They seem to serve the same purpose.

  2. Could they be unified? A single RecoveryCompleted signal would prevent this mistake.

  3. If they must remain separate, could the compiler warn? Perhaps a sealed trait or exhaustiveness check could help catch this at compile time.

  4. At minimum, should the DurableStateBehavior docs mention this? The current docs don't show receiveSignal usage or the correct import.

Environment

  • Pekko version: 1.1.x
  • Scala 3.3.x

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