Repository navigation
fix(aws/recommendations): fail the detail on an invalid average-instances or SP utilization - #327
Conversation
…nces or SP utilization A present-but-invalid AverageNumberOfInstancesUsedPerHour (RI) or EstimatedAverageUtilization (SP) was zeroed, which --target-coverage reads as no signal and passes the rec through unsized; --min-pool-size also keeps avg<=0 recs. These sizing inputs now error like the money fields, so the detail is dropped and reported through IncompleteRecommendationsError. Display-only fields still degrade to 0 with a warning. Refs #54 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Interim gate note (go gate-2): head is now 66fe9bd after update-branch merges for #313, #328 and #329. The PR-owned diff is byte-identical to the reviewed ed44ecf. Local providers/aws and pkg tests at 66fe9bd pass with go.work and with GOWORK=off. Fails-before and mutation evidence were run at ef65bdc. Parent logic with the signature shimmed fails all 4 named tests and my end-to-end SP probe through GetRecommendations. Reverting the RI site to OrWarn fails 2 tests; reverting the SP site fails 3. In the probe, "abc", "NaN", "-1" and "" each give FailedDetails=1 and keep the valid sibling; nil, "0" and "87.5" pass. Testing parseRecommendations directly is adequate: propagation through GetRecommendations goes via the existing addFailure path, which the probe exercises. Waiting for fresh CI. |
|
Gate verdict (go gate-2): CLEAN at 66fe9bd. The PR-owned diff is byte-identical to the reviewed ed44ecf. CI was 14/14 green and the PR was CLEAN. Local tests passed with go.work and with GOWORK=off. Fails-before and mutation evidence are in the interim note above. Merged with --match-head-commit as d9ead42. |
Refs #54 (the typed
IncompleteRecommendationsErrorfrom #169 is already on main; this closes the remaining silent-zero gap on the same path. The consumer rollout comment on #54 follows after merge.)What
A present-but-invalid sizing input was turned into 0, which
--target-coveragereads as "no signal" and passes the rec through unsized at AWS's full count.IncludesPoolSize(recfilter/filters.go:118) also keepsavg<=0recs, so a corrupt value bypassed--min-pool-size.AverageNumberOfInstancesUsedPerHour(parser_ri.go) and SPEstimatedAverageUtilization(parser_sp.go) now useparseOptionalFloat: nil stays 0 (genuinely absent); unparsable, non-finite, negative or empty returns an error. The detail is dropped and counted inFailedDetailsofIncompleteRecommendationsError.parseRIUtilizationSignalsandparseOptionalFloatOrWarnnow say sizing inputs must error.parseOptionalFloatOrWarncall sites are display-only and stay: RIAverageUtilization, SPEstimatedSavingsPercentage, SPCurrentAverageHourlyOnDemandSpend.Consumers
No consumer change. cli (
multi_service_helpers.go) and platform (scheduler.go) already handleIncompleteRecommendationsError; mcp fails the search on any error. Platform effect:tolerateIncompleteSweep(scheduler.go:993) leaves the previous row of a pool whose rec was dropped in place, so such a row can be stale until the next clean sweep.Verification (fixture-based, CE-shaped details, not live AWS)
parseRecommendationsand SP viaparseSavingsPlansRecommendations: "abc", "NaN", "-1", "Inf", "" each drop one detail withFailedDetails=1and keep the valid sibling; nil stays kept with no signal. Updated the existing unit cases atparser_ri_test.goandparser_sp_test.go.parseOptionalFloatOrWarnfails the named tests (RI:TestParseRIUtilizationSignals,TestParseRecommendations_InvalidAverageInstancesIsReportedNotZeroed; SP:TestParseSavingsPlanDetail_RecommendedUtilization,TestParseSavingsPlansRecommendations_InvalidEstimatedUtilizationIsReported).go test ./providers/aws/...passes with go.work andGOWORK=off; golangci-lint 0 issues.🤖 Generated with Claude Code
Summary by CodeRabbit