Skip to content

fix(aws): adopt the go expiry lookback credit so --target-coverage stops re-buying replacement RIs #2235

Open

Description

@cristim

Summary

LeanerCloud/cloud-commitments-go#449 (fixes go#346) adds recommendations.AdjustExistingCoverageForExpiringCommitmentsWithCoverageOptions. On the EC2 per-pool expiry path, it credits replacement RIs bought inside the Cost Explorer coverage lookback, so a re-run no longer recommends buying them again. The existing AdjustExistingCoverageForExpiringCommitmentsWithCoverage behaves exactly as before, with no credit.

Needed here

  • cmd/multi_service_helpers.go:540 calls the old function.
  • After bumping the providers/aws pin to a version that contains go#449, call the new function instead.
  • Pass PoolExpiryOptions{WindowDays: cfg.RebuyWindowDays, CoverageLookbackDays: <the same lookbackDays given to the coverage fetch>}.
  • Until then, --target-coverage runs can still re-buy replacements purchased within the coverage lookback.

Test

A fixture with expiring RIs, and replacements bought N days ago inside the lookback, produces no replacement purchase.

Activity

  1. self-assigned this
    on Oct 17, 2026
  2. cristim commented on Oct 17, 2026

    @cristim
    MemberAuthor

    Triaged and claiming [claude-cli-impl]: p1, because a --target-coverage run can re-buy replacement RIs bought within the coverage lookback, which spends money twice. go#449 is merged (512e42fe). This starts once #2256 merges, since both touch cmd/multi_service_helpers.go. It will bump the providers/aws pin to a version containing go#449 and switch the call at multi_service_helpers.go:~540.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions