Skip to content

fix(gcp): Cloud Storage prices a per-GiB-month SKU as hourly, inflating cost 730x #77

Description

@cristim

Summary

Google Cloud Storage SKUs are priced per GiB-month, but the pricing code multiplies the catalog unit price by 8760 hours per year, producing a term total 730 times too large per year and labelling a per-GiB-month figure as an hourly rate. Nothing on the path reads the SKU's usage unit. Unlike the sibling GCP clients this path is live: the storage pricing fill runs inside the recommendation conversion.

Location

providers/gcp/services/cloudstorage/client.go:356 at 3c0f8ac94048a2c36fce5ccddee54e6c4849a5cd

Failure scenario

GCS storage SKUs are denominated per GiB-month (unitOfMeasure "GiBy.mo"); none are per-hour. Multiplying the catalog unit price by 8760 * termYears therefore converts a monthly rate into a fictitious term total 730x too large per year. CommitmentPrice and OnDemandPrice both flow into common.OfferingDetails.TotalCost and into rec.CommitmentCost via fillStoragePricing, and HourlyRate labels a per-GiB-month figure as an hourly rate.

Evidence

hoursInTerm := 8760.0 * float64(termYears)
commitmentPriceTerm := commitmentPrice * hoursInTerm
savingsPercentage := calculateStorageSavingsPercentage(onDemandPrice, hoursInTerm, commitmentPriceTerm)

Suggested fix

Read PricingExpression.UsageUnit and scale by the unit the SKU actually uses (months for GiBy.mo), erroring when the unit is unrecognized rather than assuming hours.


Found by the 2026-09-02 codebase audit, finding A08b-014, reported by one reviewer and independently confirmed by a second. Full report: docs/audits/codebase-audit-2026-09-02.md.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions