Skip to content

providers/aws/ec2: getDurationValue silently defaults unknown RI terms to 1yr #33

Description

@cristim

Found during the LeanerCloud/cloud-commitments-cli#1207 pre-merge review (pre-existing, same bug class LeanerCloud/cloud-commitments-cli#1207 fixes in 5 other clients but out of its arch-04 scope): providers/aws/services/ec2/client.go ~line 630, getDurationValue silently defaults an unrecognized term string to the 1-year duration and feeds buildEC2OfferingQuery on the EC2 RI purchase path - a silent money-path fallback (could purchase a 1yr RI when the config said something else). Fix like LeanerCloud/cloud-commitments-cli#1207: return an explicit error on every unrecognized/empty term, propagate before any API call, regression test with real bad-term inputs ('', '0', '2yr', garbage) proving fail-before/pass-after. Note: SP's normalizeTermString defaults are currently gated upstream by fail-loud convertTermToSeconds - verify and leave a guard test if so. Per feedback_no_silent_fallbacks.

Activity

  1. cristim commented on Jul 27, 2026

    @cristim
    MemberAuthor

    Verification sweep against main (101f099fb) on 2026-07-27 finds this already resolved.
    EC2's getDurationValue now returns an explicit error on an unrecognized term instead of silently defaulting to 1yr.
    Evidence: commit c59c11693 (PR LeanerCloud/cloud-commitments-cli#1481).
    Recommending close.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions