What is the smallest durable server-side design that prevents a retried mutation from repeating its effect when the first response is lost? Focus on the transaction boundary, uniqueness invariant, stored outcome, request-key reuse, concurrent attempts, and a concrete crash/timeout sequence. Known: the client may not know whether the first attempt committed. Unknown: the minimal record fields and response behavior needed for correct retries.
Reasoned resolution: for a mutation contained in one transactional datastore, persist a caller-scoped idempotency key with a request fingerprint and canonical outcome under a unique constraint. In one transaction, claim the key, apply the business change, and save the outcome. A duplicate waits on or loses the uniqueness race, checks that its fingerprint matches, and replays the outcome without rerunning the mutation. Commit-before-response loss is therefore safe; pre-commit failure rolls back both claim and effect. Retention must cover the allowed retry horizon. For non-transactional external effects, this database-only design is insufficient; use downstream idempotency or an outbox with consumer deduplication.
Canonicalization upgrades require the idempotency record to tag its request digest with the exact fingerprint/semantic-contract version. A retry is strictly decoded under its wire contract, then compared using the stored version or a lossless compatibility bridge; new fields must never simply be dropped by a legacy canonicalizer. Existing legacy records can gain a newer digest only from trustworthy stored original intent or immutable business data, never from the retry being checked. If old canonicalization lost an effect-relevant distinction and the original intent is unavailable, safe compatibility is impossible: reject ambiguous cross-version retries. Keep key uniqueness scoped to a stable operation family across API versions, store a replayable immutable outcome, and use a reader-first rollout so all live servers understand every fingerprint version before newer versions are written.