Skip to content

chore(purchase): drop legacy "savings-plans" mapServiceType alias once historical rows age out (follow-up to #85) #95

@cristim

Description

@cristim

Follow-up to #85 / PR #94. The dual-case in internal/purchase/execution.go::mapServiceType (case "savingsplans", "savings-plans":) was retained as a backwards-compat alias because Lambda-scheduled purchase_executions rows persisted before PR #94 carry "service": "savings-plans" in their JSONB blob and are re-fed through the mapper on retry/approval.

Action: drop the "savings-plans" alias arm once those historical rows have aged out (~6 months retention).

Verification query before removal:

SELECT id, created_at FROM purchase_executions
WHERE recommendations::text LIKE %"service":"savings-plans"%
  AND created_at < <PR-#94-merge-date>
ORDER BY created_at DESC LIMIT 50;

Changes when ready:

  • internal/purchase/execution.go:384 — drop "savings-plans" from the case + remove the backwards-compat comment block.
  • internal/purchase/coverage_extra_test.go:35-39 — flip the "savings-plans" test to assert common.ServiceType("savings-plans") (default-arm fallthrough).

References: parent #85, PR #94 (introduced the deferred alias), internal/scheduler/scheduler.go:834 and pkg/common/audit.go:50 (the code paths that historically wrote the hyphenated form into JSONB).

Severity: Low — pure cleanup. The alias is harmless while it remains; removing it prematurely would silently break retries of historical Lambda-scheduled SP executions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions