feat(purchases): idempotent re-drive across Azure and GCP (closes #639) - #820
Conversation
Replace the AWS-only allRecsAWS predicate in RecoverStrandedApprovals with allRecsSafeToRedrive + recIsSafeToRedrive, extending the idempotent re-drive path to Azure reservation clients (compute, database, cache, cosmosdb, managedredis, search, synapse -- all use DoIdempotentPurchaseTwoStep from #729/#721) and GCP compute CUDs (server- side RequestId + deterministic name from the token, #654). Azure Savings Plans keeps the safe-fail path: the OrderAlias API uses time.Now().UnixNano() as the alias name with no server-side idempotency key, so a re-drive would create a duplicate savings plan. Tests: update three Azure safe-fail tests from reservations to savingsplans (the remaining unsafe service), add two new tests (AzureReservationRedrives, GCPRedrives) that exercise the expanded re-drive path end-to-end with mock provider calls. 191 tests pass; go build clean.
|
Warning Review limit reached
More reviews will be available in 12 minutes and 50 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
|
@coderabbitai review |
Rate Limit Exceeded
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
allRecsAWSpredicate inRecoverStrandedApprovalswithallRecsSafeToRedrive+recIsSafeToRedrive, extending idempotent re-drive from AWS-only to Azure reservations and GCP compute.DoIdempotentPurchaseTwoStepwithopts.IdempotencyToken(PR fix(providers/azure): restore IdempotencyToken threading in DoPurchaseTwoStep #729 / issue bug(providers/azure): DoPurchaseTwoStep dropped IdempotencyToken threading; reintroduces double-purchase risk (regression of #641; blocks #639) #721), making re-drive safe.RequestId+ deterministic commitment name from the token (issue feat(purchases): make GCP Compute commitment creation idempotent (remaining slice of #641) #654), making re-drive safe.time.Now().UnixNano()as the alias name with no server-side idempotency key; a re-drive would create a duplicate savings plan.Idempotency mechanism per provider
ClientToken(#636/#638)DoIdempotentPurchaseTwoSteptag-based lookup (#729)RequestId+ deterministic name (#654)Test plan
savingsplansservice (remaining unsafe case)TestManager_RecoverStrandedApprovals_AzureReservationRedrives-- Azure compute reservation re-drive reachesPurchaseCommitmentexactly once, row endscompletedTestManager_RecoverStrandedApprovals_GCPRedrives-- GCP compute CUD re-drive reachesPurchaseCommitmentexactly once, row endscompletedgo build ./...cleango test github.com/LeanerCloud/CUDly/internal/purchase/...-- 191 passed