docs: document the Idempotency-Key contract and cache semantics - #442
Merged
mikewheeleer merged 1 commit intoJul 26, 2026
Conversation
Contributor
|
clean diff — shipping it 🚀 |
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.
closes #353
Summary
Document the
Idempotency-Keyrequest-header contract and in-memory cache semantics for API consumers.docs/idempotency.md— New consumer-facing reference covering header name, accepted key length (1–200 chars), TTL (24 h default, configurable viaIDEMPOTENCY_TTL_MS), replay semantics, 409 conflict conditions, the three guarded endpoints, and an explicit list of non-participating mutating routes.src/__tests__/idempotencyCache.test.ts— New dedicated test suite (11 tests) exercising key-boundary edge cases (empty, 1‑char, 200‑char, 201‑char, whitespace-only), non-participating endpoints (POST /pairs/bulk,PATCH /pairs/:s/:d/enabled), cache lifecycle (clearIdempotencyCache, TTL expiry), body-hash sensitivity (different JSON key ordering), and cross-endpoint isolation.Related Issue
Closes #353
Validation
npm run build(no build script configured; ts-jest compiles on test)npm run lint— cleannpm test— 871/871 pass, coverage thresholds met (93.43% stmts, 87.22% branch, 95.38% funcs, 93.65% lines)Checklist
.envfiles, or private credentials.Security Notes
N/A — docs-and-tests-only change. No production code was modified, no new dependencies added, no credentials exposed.