You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Buffer-side counterpart to PG's idempotency-key uniqueness, per the Q5
mollifier-idempotency design. Three changes to the buffer's atomic
Lua surface plus two new high-level methods.
acceptMollifierEntry: when the caller passes idempotencyKey + task-
Identifier, SETNX a `mollifier:idempotency:{env}:{task}:{key}` lookup
pointing at the runId. Second accepts for the same tuple return the
existing winner's runId so the loser's response can echo it as a
cached hit. accept's return shape changes from boolean to a discrim-
inated AcceptResult (accepted / duplicate_run_id / duplicate_idemp-
otency). Existing four callers that ignored the boolean continue to
work; one assertion was updated for the new shape in tests.
ackMollifierEntry: DELs the idempotency lookup atomically with
marking the entry materialised. PG becomes canonical post-mater-
ialisation; the lookup TTL is the safety net if the DEL is missed.
New lookupIdempotency: resolves a buffered run by (env, task, key)
tuple. Used by IdempotencyKeyConcern in B6b. Self-heals stale lookups
that point at expired entries.
New resetIdempotency: atomic Lua that nulls idempotencyKey +
idempotencyKeyExpiresAt on the snapshot payload, clears the
denormalised hash pointer, and DELs the lookup. Used by
ResetIdempotencyKeyService in B6b alongside the PG-side updateMany.
BufferEntrySchema gains an optional idempotencyLookupKey string field
(empty when no idempotency key was bound) so the ack Lua can DEL the
lookup without reading the payload JSON.
8 new tests cover: lookup write+TTL, duplicate_idempotency return,
lookupIdempotency hit/miss/self-heal, ack-DELs-lookup, reset clears
both stores, reset null when nothing bound.
Add buffer-side idempotency-key dedup to `MollifierBuffer` per the Q5 mollifier-idempotency design. The `acceptMollifierEntry` Lua now SETNX-writes a `mollifier:idempotency:{envId}:{taskIdentifier}:{idempotencyKey}` lookup when the caller passes both an `idempotencyKey` and a `taskIdentifier`. Second accepts for the same tuple return `{ kind: "duplicate_idempotency", existingRunId }` so the loser can echo the winner's runId as a cached hit. `accept`'s return shape changes from `boolean` to a discriminated `AcceptResult` (`accepted` / `duplicate_run_id` / `duplicate_idempotency`).
6
+
7
+
New methods: `lookupIdempotency` (with stale-lookup self-heal) and `resetIdempotency` (atomic Lua that nulls `idempotencyKey` + `idempotencyKeyExpiresAt` on the snapshot payload, clears the denormalised hash pointer, and DELs the lookup). The drainer ack Lua now DELs the lookup atomically with marking the entry materialised — PG is canonical for the key post-materialisation.
8
+
9
+
`BufferEntrySchema` gains an optional `idempotencyLookupKey` field (the denormalised Redis lookup key string stored on the entry hash so the ack Lua can DEL it without reading the payload JSON).
0 commit comments