Release: idempotency retention sweep (#73) - #74
Merged
Merged
Conversation
The ordering.idempotency_keys table grew unbounded — every keyed POST /api/v1/orders inserted a row and nothing removed it (the honest limitation deferred in ADR-0014). Add a scheduled retention sweep that deletes claims older than a configurable TTL. - IdempotencyRetention: @scheduled sweep deleting claims older than shopsphere.ordering.idempotency.ttl (default PT24H), at fixed delay shopsphere.ordering.idempotency.sweep-interval (default PT1H). The package-private sweep() carries the logic so it can be driven deterministically from a test; the schedule only delegates. - IdempotencyKeys.deleteOlderThan(cutoff): the DELETE by created_at. - OrderingConfig: @EnableScheduling, scoped to the Ordering module. - Flyway V13: index on created_at so the periodic DELETE avoids a full scan (PK is on (customer_id, idempotency_key)). - IdempotencyRetentionIT: backdated key swept, fresh key survives. The 24h default is a wide margin over a legitimate retry window, so the sweep never races live dedupe and the Phase-14 IdempotencyKeyIT dedup scenarios stay green. ADR-0014 updated to record the closed limitation. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Bounds the growth of
ordering.idempotency_keys— the unbounded-growth limitation deferred in ADR-0014 (Phase 14).What shipped
IdempotencyRetention—@Scheduledsweep deleting claims older thanshopsphere.ordering.idempotency.ttl(defaultPT24H), at fixed delayshopsphere.ordering.idempotency.sweep-interval(defaultPT1H). Logic lives in a package-privatesweep(); the schedule only delegates.IdempotencyKeys.deleteOlderThan(cutoff)— theDELETE … WHERE created_at < ?.OrderingConfig—@EnableScheduling, scoped to the Ordering module.V13— index oncreated_atso the periodic delete avoids a full scan (PK is(customer_id, idempotency_key)).IdempotencyRetentionIT— backdated key swept, fresh key survives.Acceptance criteria (#73)
PT24H)IdempotencyKeyITstays green (default TTL ≫ test lifetime)mvn verifygreen (94 tests)Closes #73.
🤖 Generated with Claude Code