Repository navigation
fix(gcp/computeengine): normalize recommender savings by the projection duration - #386
Conversation
…on duration EstimatedSavings is monthly, but the CostProjection amount applies over its Duration, which was never read. Scale to a 30-day month and skip a recommendation whose cost has no positive duration. Closes #384 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 4 billable files and costs up to $1.00.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 20 minutes for your next included review. View limit details
Comment |
|
Independent review (claude-opus-5-5) of 444f456: CHANGES REQUESTED Normalising by Blocking
Non-blocking Evidence
|
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Independent review (claude-opus-5-5) of dc3ee68: APPROVE This re-review covers dc3ee68. The blocking item from my earlier review is fixed. Checked
Non-blocking
|
What
extractCostImpactFromRecommendationtreated the RecommenderCostProjectionamount as monthly savings and never readCostProjection.Duration. It now scales the amount to a 730-hour month (monthly = amount x 730h / Duration; 730h = 8760/12, the month length the other providers use). A non-zero cost with a missing, zero or negative Duration returns an error wrappingerrBadAmount, soGetRecommendationsskips that recommendation with a log instead of reporting a window-less number as monthly. A zero cost needs no Duration.Evidence is fixture-based (recommenderpb-shaped; the account has no live Recommender data). Existing cost fixtures gained a 730h Duration, including
providers/gcp/recommendations_sdk_test.go(test file only;recommendations.gois untouched).Tests
savings_window_test.go: 120 USD over 730h = 120/month; over 365 days = 10/month; over 15 days = 243.33/month; missing, zero and negative Duration error; zero cost with no Duration is fine; a rec without Duration is skipped byconvertOrSkipBadAmount. Against main the new tests do not compile (the extractor returned nothing and ignored Duration, so a 365-day projection would be reported as 120 monthly); after the changeGOWORK=off go vet/test ./...inproviders/gcppasses.Disjoint from go#307 (term resolution in
convertGCPRecommendation): this PR touches only the cost-impact extractor and its call site.Closes #384
🤖 Generated with Claude Code