Skip to content

chore(common): rename ServiceSavingsPlans -> ServiceSavingsPlansAll + add SavingsPlansPlanTypes() helper #786

Description

@cristim

Summary

The Savings Plans service-type slug system is confusing on first read:

ServiceSavingsPlans            ServiceType = "savingsplans"              // umbrella
ServiceSavingsPlansCompute     ServiceType = "savings-plans-compute"     // specific
ServiceSavingsPlansEC2Instance ServiceType = "savings-plans-ec2instance" // specific
ServiceSavingsPlansSageMaker   ServiceType = "savings-plans-sagemaker"   // specific
ServiceSavingsPlansDatabase    ServiceType = "savings-plans-database"    // specific

Two sources of confusion:

  1. The hyphenation differs (savingsplans vs savings-plans-*) -- deliberate per issue Normalize 'savings-plans' vs 'savingsplans' identifier across frontend + backend cloud-commitments-platform#7 to avoid a SQL migration, but the Go identifier ServiceSavingsPlans doesn't signal that this one is a sentinel/umbrella.
  2. The fan-out from umbrella to 4 plan types is implicit (planTypesForParams does it inside getSavingsPlansRecommendations) -- a reader scanning GetAllRecommendations doesn't see "this expands to 4 calls".

Scope (cosmetic-only, NO SQL migration)

Three changes, all in pkg/common/types.go + call sites:

  1. Rename ServiceSavingsPlans -> ServiceSavingsPlansAll. The string value stays "savingsplans" (DB column unchanged). Same for any test fixtures, frontend constants, etc. Goal: at every call site, the reader can tell at a glance "this is the umbrella sentinel, not a specific plan type".

  2. Add func SavingsPlansPlanTypes() []ServiceType returning the 4 per-plan-type slugs in canonical order (Compute / EC2Instance / SageMaker / Database).

  3. Update IsSavingsPlan to match the renamed identifier (no behaviour change).

Out of scope

Acceptance criteria

  • ServiceSavingsPlans renamed to ServiceSavingsPlansAll across the Go codebase
  • SavingsPlansPlanTypes() helper added with a unit test asserting the 4-element canonical order
  • IsSavingsPlan still recognises all 5 slugs (4 per-plan-type + 1 umbrella)
  • Tests pass (incl. the codec test that round-trips the umbrella string "savingsplans")
  • DB schema unchanged; persisted rows still read/write as "savingsplans" for the umbrella

Cross-references

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

    Labels

    effort/sHoursimpact/internalTeam-internal onlypr-createdA PR has been opened for this issue (dedup guard for the auto-PR loop)priority/p3Polish / idea / may never shipseverity/lowMinor harmtriagedItem has been triagedtype/choreMaintenance / non-user-visibleurgency/eventuallyNo deadline

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions