Repository navigation
fix(cli): count every Savings Plan and RI type in the run summary - #2239
Conversation
collectSPSavings ignored SageMaker plans and silently dropped any plan type it did not know. categorizeSPRecommendations dropped unknown types and keyed only on the details PlanType string. collectRISavings keyed only on the legacy service constants, so canonical services read from a CSV (compute, relational-db, cache, data-warehouse) were not counted. Resolve the plan type from the per-plan-type service slug first, then a case-insensitive PlanType, share one classifier between both helpers, and count anything unrecognized in an explicit "Other SP" line so counts and savings always add up. collectRISavings now accepts the canonical service types too. Display only; purchase logic is unchanged. Refs #1613 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 2 billable files and costs up to $0.50.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 23 minutes for your next included review. View limit details
Comment |
Independent review verdict: CLEAN at 633bd90Reviewer: fresh Claude agent (Sonnet, high effort), not the author, cold brief. The PR body was treated as a claim. Coordinator: claude-cc-reviewer. Blocking findings: none. This PR changes only the savings aggregation and display ( How rows are classified (checked against the pinned
Overlap with #2238:
What was attacked and how (
Gate: there is no linked issue, and the PR carries its own triage labels. Merge once CI is green at this SHA. |
|
CR waived: quota, adversarial review + local verification + green CI (per CLAUDE.md:172-173). CodeRabbit posted 'Review limit reached' on this PR. Gate at 633bd90: CLEAN independent verdict above, CI green, mergeability CLEAN. (claude-cc-reviewer) |
Refs #1613 (finding M9). The other remaining findings are tracked on the issue and in #2236 / #2237.
Summary
The run summary in
cmd/multi_service_stats_helpers.gosilently dropped some Savings Plan and RI recommendations, so the counts and savings it printed could be short of what the run contained:collectSPSavingsskipped SageMaker plans.PlanTypewas unknown, lowercase or empty. They also dropped umbrella-slug rows with no details, which is what an--input-csvrow loads as.collectRISavingskeyed only on the legacy service constants, so the canonicalcompute,relational-db,cacheanddata-warehousetypes (which can arrive from a CSV) were missed.The fix:
spPlanKind, checks the per-plan-type service slug first and thenPlanType, case-insensitively.collectSPSavingsnow goes throughcategorizeSPRecommendations, which gains SageMaker and Other buckets. Anything it does not recognise is printed on an "Other SP" line with its count and savings, so every row lands in exactly one bucket and the lines add up to the total.collectRISavingsaccepts the canonical RI types as well as the legacy ones.This change only affects the summary. The purchase path keys on the slug through
PlanTypeForServiceType, and the changed helpers are called only from the summary and comparison print paths. One visible effect: canonical RI rows now count toward the DB and EC2 RI savings used in the comparison section's options.Evidence (local, macOS,
GOTOOLCHAIN=go1.26.9, unit tests)origin/mainhelpers restored (only the new struct fields stubbed), 13 cases in the newcmd/multi_service_stats_plan_types_test.gofail, covering SageMaker (parser, umbrella and lowercase forms), canonical slug without details, unknown plan type, umbrella without details, totals, the Other print, and RIcompute,relational-db,cacheanddata-warehouse. With the fix, all pass.cacheanddata-warehousefrom the DB bucket;make build,go vet ./...andgo test -race ./cmd/...pass.scripts/test-git-secrets-allowlist.shpasses 44/44.Pre-existing and out of scope: OpenSearch RIs are in neither RI savings bucket.
🤖 Generated with Claude Code