fix(gcp): skip a recommendation with a bad amount and cap string VCPU amounts - #255
Conversation
… amounts A malformed VCPU or MEMORY amount on one Recommender row aborted GetRecommendations and dropped every other row. Such a row is now skipped with a warning, like the AWS and Azure paths. Structural payload errors (unknown resource type, missing VCPU, duplicate amounts) still abort. recommendationAmount now caps string amounts at 2^53-1 for VCPU as well as MEMORY, so the MEMORY-only check is removed. Closes #237
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour. 📝 WalkthroughWalkthroughGCP recommendation amount parsing now rejects malformed and oversized values. ChangesGCP recommendation amounts
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~12 minutes Change: Bug fix · Severity of issue fixed: Medium Sequence Diagram(s)sequenceDiagram
participant GetRecommendations
participant convertOrSkipBadAmount
participant convertGCPRecommendation
participant recommendationAmount
participant logger
GetRecommendations->>convertOrSkipBadAmount: pass recommendation
convertOrSkipBadAmount->>convertGCPRecommendation: convert recommendation
convertGCPRecommendation->>recommendationAmount: parse resource amount
recommendationAmount-->>convertGCPRecommendation: amount or errBadAmount
convertGCPRecommendation-->>convertOrSkipBadAmount: conversion result or error
convertOrSkipBadAmount->>logger: log and skip errBadAmount
convertOrSkipBadAmount-->>GetRecommendations: return result or propagate other error
Merge Risk: ⚪ Minimal · up to No actionable merge-blocking risk is identified; the change is mergeable after normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
…batch Wrap the ParseInt cause with a second %w for errorlint.
Closes #237
Gates (providers/gcp): go test -race -short -mod=readonly ./... pass, gocyclo clean, go mod tidy -diff clean. golangci-lint panics locally (needs go1.27, built with go1.26).
Summary by CodeRabbit