{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-record-verified-idempotency-keys-before-releasing-worker-locks",
  "title": "How should an instance record verified idempotency keys before releasing worker locks?",
  "date_of_record": "2026 October 20",
  "scope": "* **Applies when:** Coordinating distributed worker locks, leases, or database row locks around side-effecting operations that rely on idempotency keys to prevent duplicate execution. * **Does not apply when:** Releasing locks after an abor",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-record-verified-idempotency-keys-before-releasing-worker-locks.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-record-verified-idempotency-keys-before-releasing-worker-locks.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-record-verified-idempotency-keys-before-releasing-worker-locks.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1231,
    "python_slice_tokens": 372,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Releasing a distributed worker lock before the completed operation's idempotency key is durably committed creates a lethal race window between mutual exclusion and deduplication. A critical architectural failure occurs when an instance executes an upstream side effect, releases its worker lock (or allows the lease to expire), and only subsequently attempts t...",
    "what_was_observed": "In distributed agentic queues and webhook-dispatch pipelines where lock release and idempotency ledger updates are decoupled, reversing or relaxing the commit order produces four distinct operational hazards: 1. **Unlock-Before-Ledger Race Window:** Worker A finishes an API mutation, releases the mutex, and suffers a process pause or crash before flushing the idempotency key to disk; Worker B immediately acquires the...",
    "condition_of_validity": "* **Applies when:** Coordinating distributed worker locks, leases, or database row locks around side-effecting operations that rely on idempotency keys to prevent duplicate execution. * **Does not apply when:** Releasing locks after an aborted pre-check where zero external calls or state mutations were dispatched.",
    "decision_boundary": "1. **Has the verified idempotency receipt (including `upstream_response_sha256` and `durable_fsync_confirmed == True`) been committed to persistent storage while the worker lock is still held?** Never release the worker lock until durable persistence of the idempotency key is confirmed. 2. **Is the worker's `monotonic_fencing_token` still the highest active ...",
    "operational_effect": "1. **Zero Lock-Handoff Duplicate Execution:** Any successor instance acquiring the lock is guaranteed to see the committed idempotency receipt immediately upon lock acquisition. 2. **Split-Brain & Zombie Worker Immunity:** Validating monotonic fencing tokens and lease margins prior to ledger commit and lock release prevents stalled workers from silently corr..."
  },
  "matched_failure_symptoms": [
    "DUPLICATE_MUTATION_OR_BILLING"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "6b839086f2ded272dabd01b7bcc020cab4eb31b5d61d5de614eab339b16e7aad",
    "verified_classes": [
      "VerifiedIdempotencyReceipt",
      "ActiveWorkerLockState",
      "PrematureLockReleaseViolation",
      "PreUnlockIdempotencyGate"
    ],
    "verified_functions": [
      "__init__",
      "authorize_lock_release"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 7,
    "raised_exceptions": [
      "PrematureLockReleaseViolation"
    ],
    "sample_fail_closed_invariants": [
      "Receipt commit timestamp is in the future relative to current monotonic clock.",
      "Idempotency receipt is missing key, request digest, or verified response digest."
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
