← All notes

Workflow recovery: retry, refresh and reset are different

Trace WF-104 through a failed request and a version conflict, with precise before/after states and eight existing model tests.

Basis of this note

A source review of the public React + Ant Design learning demo. Eight reducer tests were rerun on 1 November 2026. Tasks and responses are synthetic; no backend or real multiuser concurrency is involved.

01 / Fix the starting state

After reset, WF-104 is in review at version 3. As reviewer, choose Network error and approve it. The expected result is review/version 3 with a retry action; an error must not be presented as approval.

Switch the next response to Success before retrying. The task moves to approved/version 4. The next-response selector is deliberately persistent; retrying with Network error still selected should fail again.

02 / A conflict requires a new decision

Reset, select Version conflict, then approve WF-104. The client keeps version 3 and records a simulated remote version 4. Further submissions are blocked. Refresh updates the snapshot to 4 but does not approve the task.

Select Success and approve again: the task becomes approved/version 5. Refresh and approval are separate because the original decision may no longer be appropriate for the newer record. A real API must atomically verify and update the version.

03 / Reset invalidates the old operation

Start an action and immediately reset. The UI clears its timer and advances a token; the reducer ignores callbacks without a matching pending operation. This protects local state, but it is not a general server rollback mechanism.

Only one operation may be pending in this demo. That keeps recovery legible, at the cost of blocking edits to different tasks. Per-task concurrency would require per-task pending state and independently scoped tokens.

04 / Verification and the remaining gap

All eight existing tests passed: successful transitions, roles, invalid versions, pending locks, retry, conflict recovery, late callbacks and immutable state. Browser focus is a separate concern: when a card moves, the interface returns focus to that card.

The useful lesson is to define a recoverable next action for each failure. A future service integration still needs authorization, idempotency, transaction-level version checks and real multi-tab tests.

console
node --test demos/react-workflow/tests/workflow.test.ts

Sources & further reading

Compiled from code and documents, with AI-assisted drafting and translation. Examples and proposed checks are learning material; only linked evidence establishes what was run.