Backend for AIintermediate12 min · 10 steps
Transactions and ACID
Group reads and writes into one unit that fully succeeds or fully fails, and use a transactional outbox for the external calls a database transaction can't cover.
datatool callresponse
ProblemStep 1 of 10
Two clicks, 40 ms apart, two approvals
A manager approves pending action PA-3381 (add a user to a group) and double-clicks. Two requests arrive 40 ms apart. Both read "not used yet", both write an audit row, both call ServiceNow.
Result: the user is added twice and two approvals are logged. Each request was correct on its own; the bug is check-then-act with nothing stopping the second one between the check and the act.
Watch outAny "read, decide, write" sequence without a guard is a race waiting for a double click or a retry.
Lesson 10 of 20 in Backend for AI