Skip to content

feat(purchases): idempotent re-drive across Azure and GCP (closes #639) - #820

Merged
cristim merged 1 commit into
feat/multicloud-web-frontendfrom
fix/639-wave7
Jun 5, 2026
Merged

feat(purchases): idempotent re-drive across Azure and GCP (closes #639)#820
cristim merged 1 commit into
feat/multicloud-web-frontendfrom
fix/639-wave7

Conversation

@cristim

@cristim cristim commented May 28, 2026

Copy link
Copy Markdown
Member

Summary

Idempotency mechanism per provider

Provider Service Mechanism Re-drive
AWS all tag-guard or ClientToken (#636/#638) enabled
Azure reservations (compute, db, cache, cosmosdb, managedredis, search, synapse) DoIdempotentPurchaseTwoStep tag-based lookup (#729) enabled
Azure savings-plans timestamp-based alias name, no deduplication safe-fail preserved
GCP compute (CUDs) server-side RequestId + deterministic name (#654) enabled

Test plan

  • Updated three existing Azure safe-fail tests to use savingsplans service (remaining unsafe case)
  • Added TestManager_RecoverStrandedApprovals_AzureReservationRedrives -- Azure compute reservation re-drive reaches PurchaseCommitment exactly once, row ends completed
  • Added TestManager_RecoverStrandedApprovals_GCPRedrives -- GCP compute CUD re-drive reaches PurchaseCommitment exactly once, row ends completed
  • go build ./... clean
  • go test github.com/LeanerCloud/CUDly/internal/purchase/... -- 191 passed

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.
@cristim cristim added triaged Item has been triaged priority/p3 Polish / idea / may never ship severity/low Minor harm urgency/eventually No deadline impact/all-users Affects every user effort/s Hours type/feat New capability labels May 28, 2026
@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@cristim, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6779ee2f-86c0-404e-9c2b-2b4d1c410cd6

📥 Commits

Reviewing files that changed from the base of the PR and between 4956d66 and 97b2a72.

📒 Files selected for processing (2)
  • internal/purchase/manager.go
  • internal/purchase/manager_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/639-wave7

Comment @coderabbitai help to get the list of available commands and usage tips.

@cristim

cristim commented May 28, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim

cristim commented May 30, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Full review triggered.

@cristim

cristim commented Jun 4, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Rate Limit Exceeded

@cristim have exceeded the limit for the number of chat messages per hour. Please wait 39 minutes and 6 seconds before sending another message.

@cristim

cristim commented Jun 5, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim
cristim merged commit fa03ee1 into feat/multicloud-web-frontend Jun 5, 2026
4 checks passed
@cristim
cristim deleted the fix/639-wave7 branch June 5, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/s Hours impact/all-users Affects every user priority/p3 Polish / idea / may never ship severity/low Minor harm triaged Item has been triaged type/feat New capability urgency/eventually No deadline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant