test: cover concurrent idempotency keys and 5xx cleanup - #1433
Merged
greatest0fallt1me merged 2 commits intoOct 1, 2026
Conversation
|
@AkpakaProsper Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
…cy-keys-in-concurrent # Conflicts: # src/middleware/idempotency.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR closes the coverage gap in the idempotency middleware around concurrent duplicate keys and 5xx cleanup. It adds tests that fire two simultaneous requests with the same key and body, asserts the second receives the
IDEMPOTENCY_IN_PROGRESS409 response, and verifies that a 500 response removes the stored record so a retry can proceed. It also covers verbatim 201 replay and theINVALID_IDEMPOTENCY_KEY400 path for oversized keys.Related Issue
Changes
🔒 Idempotency Middleware
[MODIFY]
src/middleware/idempotency.tsmaxKeyLength→400 INVALID_IDEMPOTENCY_KEY) and verbatim replay of stored 201 responses.[MODIFY]
src/middleware/idempotency.test.ts409with theIDEMPOTENCY_IN_PROGRESScode.maxKeyLengthreturn400 INVALID_IDEMPOTENCY_KEY.Verification Results
Security and Failure-Mode Handling
Compatibility
Closes #1314