Repository navigation
fix(gcp/computeengine): stamp PaymentOption="monthly" to match peer GCP services (followup to #709) #718
Description
Symptom
providers/gcp/services/computeengine/client.go:804 stamps rec.PaymentOption = "upfront" on every Compute Engine CUD recommendation it emits. Peer GCP services (cloudsql, memorystore, cloudstorage) consistently stamp "monthly". After PR #709's NormalizePaymentOption is in place, the normalizer coerces this to "monthly" with a WARN log — which means a WARN fires on every single GCP Compute Engine recommendation emitted by a healthy collector.
Root cause
GCP CUDs are billed monthly across the commitment term. There is no "upfront" billing tier in GCP. The buildCommitmentRequests function at providers/gcp/services/computeengine/client.go:350-373 confirms this — it takes only a Plan (TWELVE_MONTH / THIRTY_SIX_MONTH) and never reads PaymentOption.
The "upfront" literal at line 804 is leftover from when the codebase modelled all providers with AWS-style tokens. Other GCP services were fixed (or always correctly stamped "monthly"); this one was missed.
Fix
One-line change at providers/gcp/services/computeengine/client.go:804:
- rec.PaymentOption = "upfront"
+ rec.PaymentOption = "monthly"After this lands, the NormalizePaymentOption WARN log goes silent on the GCP Compute Engine path (no more all-upfront → monthly with WARN per rec), and the stamping is consistent across all GCP service emitters.
Tests
- Update any test in
providers/gcp/services/computeengine/client_test.gothat asserts the stamped value (change expected"upfront"to"monthly"). - Spot-check downstream consumers (
internal/purchase/execution.go,internal/recommendations/*) to confirm they don't have a GCP-Compute-Engine-specific branch that depends on"upfront"— if they do, that's a separate bug surfaced by this fix.
Why this matters
- Log hygiene: WARN-per-rec on a healthy pipeline pollutes ops dashboards and trains operators to ignore the WARN level.
- Consistency: 4 GCP services should stamp the same canonical token. Drift here is technical debt.
- Forward-compat: any future GCP service added by mirroring computeengine will inherit the bug; mirroring cloudsql/memorystore/cloudstorage won't.
Related
- PR fix(config): accept provider-canonical payment options in plan validator #709 (
fix(config): accept provider-canonical payment options in plan validator) — added the normalizer that masks this bug today. providers/gcp/services/{cloudsql,memorystore,cloudstorage}/client.go— peer services with the correct"monthly"stamp.
Activity
docs(db): clarify GCP commitments are monthly + nil round-trip test
feat(db): nullable MonthlyCost on PurchaseHistoryRecord (closes #255) (…
fix(gcp/computeengine): default PaymentOption to "monthly" (10-M5)
fix(gcp): wire Count/pricing into GCP converters; refuse fabricated p…
fix(gcp/computeengine): stamp PaymentOption="monthly" (closes #718)
fix(gcp/computeengine): stamp PaymentOption="monthly" (closes #718)
fix(gcp/computeengine): stamp PaymentOption="monthly" (closes #718)
fix(gcp/computeengine): stamp PaymentOption="monthly" (closes #718)
fix(gcp/computeengine): stamp PaymentOption="monthly" (closes #718)