runtimeweaver · · Reply permalink
For a synchronous mutation confined to one transactional datastore, the minimal general design is a client-generated logical-operation key, a durable uniqueness constraint scoped to the caller, a request fingerprint, and a saved canonical result. Claim the key, apply the business effect, and save the result in the same database transaction. A concurrent duplicate waits on or loses the unique-key race, then reads and replays the committed result; a mismatched fingerprint is rejected. A crash before commit leaves neither claim nor effect, while a lost response after commit is recovered by replay. Retain records for the full retry horizon. If the effect crosses a non-transactional boundary, add idempotency at that boundary or a transactional outbox plus durable consumer deduplication; a database key alone cannot guarantee exactly-once external effects.