fix(providers/aws): fail loud on unparseable RI cost fields - #1236
Conversation
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 58 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
Adversarial reviewThe in-scope fix is correct and complete:
Out-of-scope siblings filed as follow-upsThe same silent-fallback shape still exists in three sibling parsers that were intentionally left out of this PR's RI scope but are equally money-affecting:
CI state (UNSTABLE) -- pre-existing, not caused by this PRThe three failing jobs all hit code this PR did not touch:
These are tracked / fixable elsewhere; they do not block COR-07. Minor (non-blocking)
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Merge-prep: rebased onto origin/main (27fdb06). Gates: |
|
✅ Action performedReview finished.
|
|
Rebased onto origin/main (89658a3 -> a945344) which includes #1437 (tflint plugin cache + retry) and #1438 (trivy |
parseAWSCostDetails silently swallowed strconv.ParseFloat errors for UpfrontCost, EstimatedMonthlyOnDemandCost, and RecurringStandardMonthlyCost, leaving the destination at 0. An unparseable UpfrontCost would surface an all-upfront RI recommendation showing $0 upfront, a wrong money figure feeding effective-savings math and purchase decisions, with no signal. Make a present-but-unparseable cost string a hard error, consistent with parseCostInformation in the same file. The caller chain already handles this: parseRecommendationDetail propagates the error and parseRecommendations logs a warning and skips the recommendation, so a malformed CE response drops that detail loudly instead of fabricating zeros. Regression test covers all three malformed fields and was confirmed failing against the pre-fix code. Closes #1171
Problem
parseAWSCostDetailsinproviders/aws/recommendations/parser_ri.gosilently swallowedstrconv.ParseFloaterrors forUpfrontCost,EstimatedMonthlyOnDemandCost, andRecurringStandardMonthlyCost, leaving the destination field at 0 with no log. An unparseableUpfrontCostwould surface an all-upfront RI recommendation showing $0 upfront, a wrong money figure feeding effective-savings math and purchase decisions, with zero signal. This was inconsistent withparseCostInformationin the same file, which fails loud for the savings fields (COR-07 in docs/reviews/codebase-review-2026-06-10.md).Fix
parseAWSCostDetailsnow returns an error when a present cost string is unparseable, matching theparseCostInformationpattern; absent (nil) fields keep their existing behavior.parseRecommendationDetailpropagates the error with context; the existing caller chain (parseRecommendations) logs a warning and skips the affected recommendation detail, so a malformed CE response drops that detail loudly instead of fabricating zeros into money math.Test evidence
TestParseRecommendationDetail_MalformedCostFieldscovers all three malformed fields plus a well-formed sanity case. Confirmed FAILING with the pre-fix code (stashed fix: 3 subtests fail with "An error is expected but got nil") and passing after.go test ./recommendations/in theproviders/awsmodule: 335 passed.go build ./...clean in both the root module andproviders/aws.Closes #1171