Repository navigation
feat(azure): flag adopted reservation orders on idempotent re-drives - #265
Conversation
DoIdempotentPurchaseTwoStep and purchaseTwoStepGuarded now also return whether an order already tagged with the idempotency token was adopted (the pre-loop lookup or the in-loop re-check) instead of purchased. The seven reservation services (compute, database, cache, cosmosdb, search, synapse, managedredis) copy it into PurchaseResult.ExistingCommitment. Refs #211
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (16)
Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour. 📝 WalkthroughWalkthroughAzure’s idempotent purchase helper now reports whether it adopted an existing reservation order. Seven Azure service clients copy that status to ChangesAzure reservation adoption and result reporting
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Feature · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The Azure reservation change appears ready to merge after normal checks; no concrete blocking issue was identified. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Linked Issues checkExplanation
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
Refs #211
Final provider step.
DoIdempotentPurchaseTwoStep(providers/azure/services/internal/reservations/purchase.go) returned the adopted order's id with no signal; it now returns(orderID, existing, err).existingis true only on the two adopt paths (pre-loop token lookup, and the in-loop re-check from #1774); the lookup already skips terminal-failed orders and empty names. The rawDoPurchaseTwoStepkeeps its signature. Each of the 7 call sites (compute, database, cache, cosmosdb, search, synapse, managedredis) gains one line:result.ExistingCommitment = existing.Tests: helper tests assert the flag for fresh, failed lookup, re-drive, in-loop adoption, genuine retry and refused re-check. Each service has
existing_commitment_test.godriving the realPurchaseCommitment: fresh false, 500 false, re-drive true with the adopted CommitmentID and zero POSTs, terminal-failed tagged order not adopted. Dropping the plumbing line in any service, or forcing the helper's adopt return to false, fails a test.Not covered: Azure savings plans (savingsplans/client.go PUTs a deterministic SavingsPlanOrderAlias; it is unverified whether the PUT returns 200 for an existing and 201 for a new resource. The SDK create accepts either, and reading the initial response would need azcore runtime.WithCaptureResponse because the poller hides it; left as a possible follow-up, and it avoids files touched by open #207). Not detectable client-side: AWS savings plans (native ClientToken), GCP (best effort, noted on #211). Follow-ups on #211 (EC2 class details, NewAuditRecord dropping the flag) are separate.
Avoids files in open PRs #218, #207, #205 (new test files rather than editing compute/client_test.go).