Repository navigation
fix(recommendations): wire MemoryDB NodeType from CE InstanceDetails (follow-up to #539, closes #378) - #990
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
…(follow-up to #539) PR #539 made parseMemoryDBDetails read rec.ResourceType and error loudly when empty, with a doc comment claiming the AWS SDK has no MemoryDB sub-struct in ReservationPurchaseRecommendationDetail. That premise is wrong: the CE SDK (costexplorer v1.61.0) exposes details.InstanceDetails.MemoryDBInstanceDetails with NodeType and Region, exactly like ElastiCache and Redshift. Nothing upstream populates rec.ResourceType before parseMemoryDBDetails runs (parseRecommendationDetail only sets it inside the service parsers themselves), so every MemoryDB recommendation hit the empty-ResourceType error and was skipped. The happy-path branch and its unit tests (which injected ResourceType manually) were unreachable in production. Read NodeType and Region from MemoryDBInstanceDetails, mirroring the ElastiCache/Redshift parsers, so the happy path is reachable for real CE responses. Keep a loud error only when the sub-struct or its NodeType is genuinely absent. Rewrite the tests to exercise the real production path via the SDK struct rather than a manually injected ResourceType.
…etails The serviceParserFunc type requires (context.Context, *Recommendation, *Detail) signature. The prior implementation correctly used _ context.Context; keep that to satisfy the function type while the new body reads from details directly.
27c1649 to
e13e083
Compare
|
Rebased on feat/multicloud-web-frontend. Resolved conflicts in providers/aws/recommendations/parser_services.go and providers/aws/recommendations/parser_services_test.go (HEAD had a prior intermediate version of parseMemoryDBDetails; kept the PR's version which wires NodeType from CE InstanceDetails, restored _ context.Context to satisfy serviceParserFunc signature). CR BILLING_BLOCKED; no re-trigger sent. |
Follow-up to merged PR #539 (closes #378 properly)
PR #539 changed
parseMemoryDBDetailsto readrec.ResourceTypeand errorloudly when it is empty, on the premise (stated in the doc comment) that the
AWS SDK has no MemoryDB sub-struct in
ReservationPurchaseRecommendationDetail.That premise is incorrect. The Cost Explorer SDK in use
(
costexplorer@v1.61.0) exposesdetails.InstanceDetails.MemoryDBInstanceDetailswithNodeTypeandRegion,exactly the shape ElastiCache and Redshift already read from.
The residual bug
Nothing upstream populates
rec.ResourceTypebeforeparseMemoryDBDetailsruns:
parseRecommendationDetailonly setsResourceTypeinside eachservice parser. So for MemoryDB,
rec.ResourceTypewas always""at entryand every MemoryDB recommendation hit the empty-
ResourceTypeerror and wasskipped. The happy-path branch and its two unit tests (which injected
ResourceTypemanually) were unreachable in production.The fix
NodeTypeandRegionfromMemoryDBInstanceDetails, mirroring theElastiCache/Redshift parsers, so the happy path is reachable for real CE
responses.
NodeTypeis genuinelyabsent.
instead of a manually injected
ResourceType, adding coverage for themissing-sub-struct and nil-
NodeTypeerror cases plusRegionparsing.Verification
gofmt,go vet,go build ./...: clean.go test ./providers/aws/recommendations/...: 290 passed.SKIP=terraform_validate pre-commit run --files ...: all hooks pass.(One unrelated pre-existing failure in
providers/aws/services/savingsplanstest exists on the base branch and is untouched by this PR.)
Summary by CodeRabbit
Bug Fixes
Tests