Skip to content

fix(idempotency): bind operations to their own key prefix on a shared store - #5708

Open
svozza wants to merge 1 commit into
mainfrom
fix/idempotency-nested-key-prefix
Open

svozza wants to merge 1 commit into
mainfrom
fix/idempotency-nested-key-prefix

Conversation

@svozza

@svozza svozza commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Summary

BasePersistenceLayer keeps the key prefix as mutable state and every IdempotencyHandler construction reconfigures it, so an operation that awaited a nested idempotent call completed under the nested operation's prefix and overwrote its record. Operations now capture the prefix the store resolved for them and re-apply it immediately before each persistence call. configure() also resets the prefix to its base when neither keyPrefix nor functionName is given, so an operation without a prefix no longer inherits a sibling's.

Changes

  • Reset idempotencyKeyPrefix to the base value in configure() when no prefix or function name is supplied
  • Snapshot the resolved prefix in IdempotencyHandler and restore it on the store before save, get, update, and delete calls
  • Remove the now unused #keyPrefix field
  • Add tests for nested operations with and without an explicit prefix, for the configure() reset, and one pinning that the key is hashed before the first await

Issue number: closes #5707


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L PRs between 100-499 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Idempotency operations sharing a persistence store complete under the wrong key prefix

1 participant