A Sync step's rules run after its card write, and since rules may move a
card to another list or archive it, the card can afterwards match
neither the step's before-state nor its after-state. Two things then
failed:
- An interrupted run never recovered. The replay retried the step's
write, which could not be confirmed, so the run failed on every replay.
The journal now treats a stored planned activity as proof that the
write happened (activities are stored only after it is confirmed) and
finishes the effects, which are idempotent.
- Even an uninterrupted run failed whenever a durable rule moved the card
out of the list. The activity's notification and webhook stages ran
after the rule and refused a card that was no longer in the activity's
list. They now also accept the card where a saved move of that
activity's own rules put it, and nowhere else.
A failed replay now logs why. The durable Sync server test runs a rule
that moves each new card out of the synced list, crashes after the move,
and checks that the replay completes the run with one move.
Thanks to xet7 !