Critical flow
What is the time of the error, and what result can the system still claim afterwards?
The F-17 decision and R-4 submission both expect request A-17 at R-3/v7. Each successful command increments the request version, so exactly one wins. The sequences also show normal business and budget approval, a duplicate decision and a lost purchasing response.
Starting point Step 6 placed outbox processing after the approval commit.
Assumptions for the example case
Illustrative design: an internal procurement request for 6,000 euros undergoes business review followed by budget review. The inclusive budget threshold is 5,000 euros. These figures are assumptions rather than operational measurements. Ordering, payment, contract law and automatic decisions are outside the scope.
Four critical approval scenarios
A-17/R-3 durchläuft Fach- und Budgetprüfung. U-17 entsteht erst nach beiden Freigaben. Die Spur Prüfende benennt die jeweils handelnde Rolle ausdrücklich.
Dashed arrow: decoupled transfer. The messages are read from top to bottom.
Result: A-17 becomes approved after business and budget approval. U-17 remains pending until separate acceptance evidence arrives; only the worker communicates with purchasing.
Business-effect commit point
- Before commit
- A decision made is only an attempt. R-4 can still replace R-3.
- At commit
- Task status, active revision, current role, expected request version and resulting state are checked together. The winner writes v8; the other command against v7 receives 409. After rereading the state, the person can deliberately issue a new command.
- After commit
- The worker transfers U-17 from the outbox. A lost response leaves it pending instead of creating a second order.
Expected outcomes
| Scenario | Expectation | Validation |
|---|---|---|
| Normal flow | A-17 approved, U-17 pending or acknowledged. | Check business and budget approval records before the first handover attempt. |
| R-4 wins | F-17 returns 409; no U-17 is created. | Concurrent test with R-4 and F-17. |
| Response lost | U-17 remains pending and is retried with deduplication. | Target reports existing U-17 without a second order reference. |
| Duplicate decision | The same requestKey returns the same record; changed content receives 409. | Commit before loss of response; repetition does not produce a second G-17. |
Normal flow
- Expectation
- A-17 approved, U-17 pending or acknowledged.
- Validation
- Check business and budget approval records before the first handover attempt.
R-4 wins
- Expectation
- F-17 returns 409; no U-17 is created.
- Validation
- Concurrent test with R-4 and F-17.
Response lost
- Expectation
- U-17 remains pending and is retried with deduplication.
- Validation
- Target reports existing U-17 without a second order reference.
Duplicate decision
- Expectation
- The same requestKey returns the same record; changed content receives 409.
- Validation
- Commit before loss of response; repetition does not produce a second G-17.
Terms in this step
- Optimistic version check
- The writing process compares the expected version with the currently stored version and rejects if there is a deviation.
Try it yourself
Track the case R-4 wins in six messages and name two illicit effects of the old decision.
A hint for your attempt
The outdated decision must not prepare a later worker assignment.
Compare with a possible solution
- Six messages
- 1 Domain reviewer → API: decide on F-17/R-3/v7. 2 Applicant → API: submit R-4 against R-3/v7. 3 API → SQL: atomically write R-4, F-R-4, task cancellations and v8. 4 SQL → API: commit the version change. 5 API → SQL: check the old decision against the current state. 6 SQL → API: version conflict, no write effect. The API then returns 409 to the reviewer.
- Unauthorised effects
- The stale command must neither set A-17 to approved nor create U-17. A-17 remains reviewing on R-4/v8. Test: the request and new task are readable, old F-17 is cancelled and the handover is absent.
Apply to your project
Which external event in your project can only take place after which local commit?