The current approach to state reconstitution in Verbs is brittle—it relies on the StateManager tracking whether it's in a "replaying" state, then branching behavior accordingly. This creates coupling issues and edge cases when states trigger loading of other states during reconstitution. We need a cleaner abstraction that encapsulates replay operations.
- Core problem: StateManager's singleton state handling doesn't cleanly separate normal operation from replay/reconstitution, leading to scattered
is_replayingchecks and potential sync issues - Key file:
src/Lifecycle/StateManager.php— particularly around line 192 whereif (! $this->is_replaying)gates behavior - Edge case to address: When reconstituting state A triggers loading of state B, state B also reconstitutes and can get out of sync in memory if the two states are interdependent
- Branch:
generics