You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
providers/aws/ec2: getDurationValue silently defaults unknown RI terms to 1yr #33
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.
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.
Checked against main 740dfbd: the EC2 default is gone (providers/aws/services/ec2/client.go:731 fails loud, e6a9372). The Savings Plans normalizeTermString (providers/aws/services/savingsplans/client.go:724) still has a 1yr fallback but only runs after convertTermToSeconds (:478) has rejected unknown terms; no guard test pins that order. Marking needs-info for a close decision (or keep open only for that small test).
Verified on current main. EC2 getDurationValue now fails loud on any term outside 1yr/1/3yr/3 (providers/aws/services/ec2/client.go:737 via purchasecfg.ParseTermMonths, e6a9372) and findOffering errors before any API call (client_test.go:832). The Savings Plans side is stricter than the issue asked: normalizeTermString (savingsplans/client.go:736) now errors instead of defaulting, pinned by TestNormalizeTermString (client_test.go:1749) and TestClient_GetOfferingDetails_UnknownTermErrors (:1778). Duplicate of #23. [claude-cc-libs]
Activity
cristim commentedon Jul 27, 2026
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.
cristim commentedon Oct 16, 2026
Checked against main
740dfbd: the EC2 default is gone (providers/aws/services/ec2/client.go:731fails loud, e6a9372). The Savings PlansnormalizeTermString(providers/aws/services/savingsplans/client.go:724) still has a 1yr fallback but only runs afterconvertTermToSeconds(:478) has rejected unknown terms; no guard test pins that order. Marking needs-info for a close decision (or keep open only for that small test).cristim commentedon Oct 20, 2026
Verified on current main. EC2 getDurationValue now fails loud on any term outside 1yr/1/3yr/3 (providers/aws/services/ec2/client.go:737 via purchasecfg.ParseTermMonths, e6a9372) and findOffering errors before any API call (client_test.go:832). The Savings Plans side is stricter than the issue asked: normalizeTermString (savingsplans/client.go:736) now errors instead of defaulting, pinned by TestNormalizeTermString (client_test.go:1749) and TestClient_GetOfferingDetails_UnknownTermErrors (:1778). Duplicate of #23. [claude-cc-libs]