PRODUCTION SCENARIO
A reservation agent calls create_reservation. The network times out after the request leaves the service, so the caller cannot tell whether the booking was made, and blind retries have produced duplicate reservations.
Which change prevents the duplicates?
Answering here is anonymous. Nothing is saved unless you sign in.
Show answer and explanation
Answer: Send an idempotency key on create_reservation and read the booking status before retry
The duplicate is made in the integration layer, not by the model, so the fix belongs there: an idempotency key lets the reservation service recognize the retry as the same booking, and a status read resolves the ambiguous outcome before anything is sent again. A circuit breaker limits how many duplicates get created, not whether they are created. Handing is_error to the model puts a transactional decision to something that cannot see whether the write landed. A longer timeout narrows the uncertain window without closing it.