Repository navigation
Conversation
…of seeding USD Cloud Storage pricing seeded currency to USD and let each later priced SKU overwrite it, so a catalog result with mixed or missing currencies reported a currency that did not match the prices it summed. The currency now comes from the priced SKUs via billingcurrency.Unify, as Cloud SQL and Memorystore do since LeanerCloud#239, and a missing or conflicting one is an error. Closes LeanerCloud#243 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
Member
|
Independent review verdict: CLEAN at
Remaining merge gates: CI has not run (the fork workflows are awaiting maintainer approval). The PR is a draft. Labels still need mirroring from #243. CR has not reviewed this head because the PR is a draft. |
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.
Root cause
extractStoragePricingFromSKUs(providers/gcp/services/cloudstorage/client.go) seededcurrency = "USD"and then overwrote it with the currency of whichever priced SKU came last. A catalog result with mixed currencies, or SKUs with no currency code, therefore reported a currency that did not match the prices it summed. This is the Cloud Storage slice of #102 that #239 left out because #205 (now merged) touched the same file.Fix
Mirrors #239 exactly for Cloud Storage: the USD seed is removed and each priced SKU's currency is folded in with
billingcurrency.Unify(currency, curr, sku.SkuId), returning its error. A missing or conflicting currency now fails pricing instead of mislabelling it. No hardcoded"USD"remains inclient.go.The regression test
providers/gcp/services/cloudstorage/pricing_currency_test.gouses the same table ascloudsql/pricing_currency_test.goand goes throughgetStoragePricingwith a mocked billing service: consistent EUR, consistent USD, mixed USD/EUR, and a missing commitment or on-demand currency.Closes #243
Verification
All of this ran locally on macOS against mocked Cloud Billing Catalog responses. No real GCP APIs were called.
Fail before the fix (test added,
client.gounchanged):Pass after the fix:
AWS_CONFIG_FILE=/dev/null AWS_SHARED_CREDENTIALS_FILE=/dev/nullwas set because of an invalid default AWS profile on the author's machine. It has no effect on this GCP-only change.Gap: this was not checked against a live Cloud Billing Catalog response in a non-USD billing account.
Out of scope: #412 added
CommitmentCurrencyfor Cloud SQL, Memorystore and Compute Engine. Cloud Storage does not produce recommendations (GetRecommendationsis not supported), so that part was not applied here.Labels
The author lacks label permissions. Could a maintainer please mirror the issue's triage labels onto this PR:
priority/p2,severity/medium,urgency/this-sprint,impact/few,effort/xs,type/bug,triaged.🤖 Generated with Claude Code