Potential bug in terminating replays
What is this bug about?
In executeFlow we currently only end an ongoing replay if a DomainEvent is processed with the revision at which the replay is supposed to end:
https://github.com/thenativeweb/wolkenkit/blob/429e419f3104001370f61f9f6d44735c1e5bb05f/lib/common/domain/executeFlow.ts#L117
This makes sense if the replay is performed successfully. If, however, a replay is performed that does not result in the processing of DomainEvents, say if I request a replay via the CLI while none is required by a stalled flow and I forget to use the --dangerously-reevaluate flag, then a replay is performed but all events in the replay are skipped by the flow, since they were already seen. The result is that the replay is never terminated and the ConsumerProgressStore for the replayed flows is now in a broken state which might or might not lead to problems.
I can't say for sure wether this is an actual problem, it's just something I noticed and might be worth looking into.
What is the expected result?
That a replay is terminated once it has been performed, regardless of if events have been processed or skipped.
What is the actual result?
After a replay that does not result in events being processed, the flow progress is in a (potentially) broken state.
What steps are needed to reproduce the bug?
- Start any of the chat template applications
- Send a few commands to build up a small view
- Use the
replaycommand (once #1081 is completed)
The flows should have logged that they skipped all the replayed events. Now look at the consumer progress store. The replayed flows will still have isReplayingFrom and isReplayingTo set.