{
  "handle": "IdempotentWrite",
  "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 {{state_lock}} to deduplicate requests, ensuring only the first write executes while subsequent ones return the cached result.",
  "gloss": "Safe retries via unique keys",
  "failure_modes": [
    "Key collision (two different requests use same key)."
  ],
  "invariants": [
    "Idempotence: Apply(Apply(Req)) stands in {{equivalence}} with Apply(Req) — a repeated key returns the first result rather than executing again.",
    "Safety: Duplicate requests trigger zero additional side effects"
  ],
  "preconditions": [
    "Receiver has state storage for keys"
  ],
  "postconditions": [
    "Action executed exactly once (logically)"
  ],
  "_meta": {
    "tier": 1,
    "related": [
      "sema:UniqueHandle#mh:SHA-256:c3fb079be6908528bb340de26feb85f429a61fc13db10e728ea0ec3fffb19110"
    ],
    "ring": 0,
    "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"
    ],
    "path": [
      "Infrastructure",
      "Primitives"
    ]
  },
  "sema_id": "sema:IdempotentWrite#mh:SHA-256:7226e14f5caed42394b33c28989972451a03b43ba531e8cb6a9975a0fee4ab2c",
  "sema_ref": "IdempotentWrite#7226",
  "sema_stub": "7226",
  "dependencies": {
    "references": {
      "cache": "sema:Cache#mh:SHA-256:465f391fb70426b0ec99c724ecf5db549d4f2e8124c821530271124aa10e17f3",
      "equivalence": "sema:Equivalence#mh:SHA-256:23f09a1881f50a07a5c565897f0837b3cfe4955a3b83250045f94abebf5b058c",
      "state_lock": "sema:StateLock#mh:SHA-256:c9c2809bdf97bb6ac17a8ffe428d4aa9a28294b99d64cc8a336a239d26a8afb8"
    }
  },
  "sema_layer": "Infrastructure",
  "sema_category": "Primitives",
  "used_by": {
    "references": {
      "StateSnapshot": "sema:StateSnapshot#mh:SHA-256:d75752f332fe14ae3abf2253a45ab180034d2becc3a7e19e3e30da3c94b3c636"
    }
  }
}
