Skip to content

fix(gcp): classify commitment SKUs by usage type, not description - #253

Merged
cristim merged 2 commits into
mainfrom
fix/gcp-commitment-sku-classification
Oct 6, 2026
Merged

cristim merged 2 commits into
mainfrom
fix/gcp-commitment-sku-classification

Conversation

@cristim

@cristim cristim commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Closes #248

The four GCP price extractors (cloudsql, memorystore, computeengine, cloudstorage) picked the commitment slot with strings.Contains(description, "commitment"). They now call skumatch.Slot, which reads Category.UsageType:

  • OnDemand -> on-demand slot
  • Commit1Yr, Commit3Yr -> commitment slot (same last-wins behavior as before)
  • Preemptible, Spot -> skipped (previously they were stored as on-demand)
  • missing category or any other value -> error

extractComputePricingFromSKUs now returns an error, matching the other three.

Test fixtures gained a Category.UsageType. New tests cover a committed-use SKU whose description lacks "commitment" and an unknown usage type, in each service and in skumatch; they fail on main.

Decision for review: the issue says to fail on an unknown usage type. I treat Preemptible and Spot as known and skip them, since erroring would break compute pricing for machine types that have Spot SKUs in the real catalog.

Follow-ups from review: Commit1Yr and Commit3Yr still share one commitment slot, last wins (pre-existing; tracked in #254). The Billing API usageType is not a documented closed enum; unknown values, including Commit1Mo, return an error by design.

The Cloud SQL, Memorystore, Compute Engine and Cloud Storage price
extractors decided on-demand vs commitment with a substring match on the
SKU description. A committed-use SKU whose description lacks the word
landed in the on-demand slot. Use Category.UsageType (OnDemand, Commit1Yr,
Commit3Yr) via a shared skumatch.Slot, skip Preemptible and Spot SKUs, and
return an error for a missing category or unrecognized usage type.
@cristim cristim added priority/p2 Backlog-worthy severity/medium Moderate harm triaged Item has been triaged urgency/this-quarter Within the quarter impact/few Limited audience effort/s Hours type/bug Defect labels Oct 6, 2026
@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

  • Run on-demand review

This review includes 17 billable files and costs up to $4.25.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 4 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 62 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: LeanerCloud/cloud-commitments-go/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 14c4cc75-df5b-43c3-9605-85de90d39dce
📥 Commits

Reviewing files that changed from the base of the PR and between 33f329d and 7c28cfe.

📒 Files selected for processing (17)
  • providers/gcp/internal/skumatch/skumatch.go
  • providers/gcp/internal/skumatch/skumatch_test.go
  • providers/gcp/services/cloudsql/client.go
  • providers/gcp/services/cloudsql/client_test.go
  • providers/gcp/services/cloudsql/pricing_currency_test.go
  • providers/gcp/services/cloudsql/usage_type_test.go
  • providers/gcp/services/cloudstorage/client.go
  • providers/gcp/services/cloudstorage/client_test.go
  • providers/gcp/services/cloudstorage/usage_type_test.go
  • providers/gcp/services/computeengine/client.go
  • providers/gcp/services/computeengine/client_test.go
  • providers/gcp/services/computeengine/usage_type_test.go
  • providers/gcp/services/memorystore/client.go
  • providers/gcp/services/memorystore/client_coverage_test.go
  • providers/gcp/services/memorystore/client_test.go
  • providers/gcp/services/memorystore/pricing_currency_test.go
  • providers/gcp/services/memorystore/usage_type_test.go
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@cristim
cristim merged commit d881edf into main Oct 6, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/s Hours impact/few Limited audience priority/p2 Backlog-worthy severity/medium Moderate harm triaged Item has been triaged type/bug Defect urgency/this-quarter Within the quarter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(gcp): the "commitment" substring splits on-demand from commitment SKUs by free-text description

1 participant