Infrastructure · Primitives

IdempotentWrite

Safe retries via unique keys

Definition

Mechanism

A technical primitive where every write request includes a unique 'Idempotency Key'. The receiver maintains a Cache of processed keys. If it receives a duplicate key, it returns the stored result without re-executing the side effects. This makes 'At-Least-Once' delivery safe. It uses a keyed StateLock to deduplicate requests, ensuring only the first write executes while subsequent ones return the cached result.

Preconditions

  1. Receiver has state storage for keys

Postconditions

  1. Action executed exactly once (logically)

Invariants

  1. Idempotence: Apply(Apply(Req)) stands in Equivalence with Apply(Req) — a repeated key returns the first result rather than executing again.
  2. Safety: Duplicate requests trigger zero additional side effects

Risks

Failure modes

  1. Key collision (two different requests use same key).

Relationships

Builds on

References

Cache

Keyed storage for reusing previously obtained values

Equivalence

Sameness decided by canonical content rather than by label

Society

StateLock

Atomic coordination via temporary state fusion

Used by

References

Reference

Identity

Ref
IdempotentWrite#7226
Sema ID
sema:IdempotentWrite#mh:SHA-256:7226e14f5caed42394b33c28989972451a03b43ba531e8cb6a9975a0fee4ab2c
Ring
0
Tier
1
Updated
2026-11-11
Supersedes
  • sema:IdempotentWrite#mh:SHA-256:6c557713e21198238066f28ec889d6c877caab1f34d58c41baca371919e051af
  • sema:IdempotentWrite#mh:SHA-256:9b95e06ae2e4eec89639328bae9c7988f4b5873ff676a1a5f040bf73373e7857
  • sema:IdempotentWrite#mh:SHA-256:e919903ac4044c9761bbdae612c360150f12e679dcc608ee7389f793debda186
  • sema:IdempotentWrite#mh:SHA-256:ebf5e8d3d5a4802033179f871bf4dfd0be7c611ab7534ab8b8e07e5f21eab7d0
  • sema:IdempotentWrite#mh:SHA-256:fb8b8f05286097c6456e4273ad99a144d856554828ef15b9bd351cfcb45ae8a3