Skip to content

fix(recommendations): add Savings Plans to GetAllRecommendations fan-out (closes #784) - #785

Merged
cristim merged 1 commit into
feat/multicloud-web-frontendfrom
fix/784-sp-fanout
May 28, 2026
Merged

cristim merged 1 commit into
feat/multicloud-web-frontendfrom
fix/784-sp-fanout

Conversation

@cristim

@cristim cristim commented May 28, 2026

Copy link
Copy Markdown
Member

Symptom

GetAllRecommendations collected 46 recommendations with zero SP rows despite the account having recurring SP-eligible workloads:

2026/05/28 09:29:15 [INFO] Collected 46 recommendations with $1076.22/month potential savings

Root cause

GetAllRecommendations spawned 5 per-service goroutines (EC2 / RDS / ElastiCache / OpenSearch / Redshift) but had no 6th goroutine for common.ServiceSavingsPlans. The dispatch in GetRecommendations already routes SP slugs to getSavingsPlansRecommendations (client.go:69-71), but that branch was never reached. mergeServiceResults also had no SP slot, so SP rows had nowhere to land even if fetched.

A pre-existing nil-pointer dereference in fetchSPAllPages (parser_sp.go:99) was also surfaced by the new code path: when the mock returns (nil, nil) the result was dereferenced unconditionally.

Fix

  • client.go:254-258 -- add spRecs []common.Recommendation and spErr error declarations
  • client.go:294-297 -- add 6th g.Go block calling GetRecommendationsForService(gctx, common.ServiceSavingsPlans)
  • client.go:315 -- append serviceResult{name: "SavingsPlans", recs: spRecs, err: spErr} to mergeServiceResults
  • parser_sp.go:98-100 -- guard if result == nil { break } before dereferencing the output
  • Comments updated: "five" -> "six" in post-Wait block; SP 24-call budget noted in goroutine comment block

Tests

+1 test: TestGetAllRecommendations_IncludesSavingsPlans -- asserts both EC2 and SP rows appear in the merged output when the mock returns both RI and SP fixtures. Total: 280 tests pass (was 279).

SP call budget

The SP goroutine expands to 24 CE calls per refresh (2 terms x 3 payment options x 4 plan types) via planTypesForParams inside getSavingsPlansRecommendations. All calls go through the existing rate limiter and pkg/concurrency semaphore -- no new concurrency controls needed.

Closes #784
Refs #569 #693

…out (closes #784)

Add a 6th goroutine for common.ServiceSavingsPlans to GetAllRecommendations
and extend mergeServiceResults with a SavingsPlans slot so SP recs reach
the Opportunities list. Also guard fetchSPAllPages against a nil result
pointer (pre-existing nil-deref surfaced by the new code path) and add a
regression test asserting both EC2 and SP rows appear in the merged output.
@cristim cristim added triaged Item has been triaged priority/p1 Next up; this sprint severity/high Significant harm urgency/now Drop other things impact/all-users Affects every user effort/s Hours type/bug Defect labels May 28, 2026
@cristim

cristim commented May 28, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 28, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@cristim, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 54 minutes and 31 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3fb844a1-b5bf-430e-88bf-e61eb6649999

📥 Commits

Reviewing files that changed from the base of the PR and between 037508a and 955516b.

📒 Files selected for processing (3)
  • providers/aws/recommendations/client.go
  • providers/aws/recommendations/client_test.go
  • providers/aws/recommendations/parser_sp.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/784-sp-fanout

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim
cristim merged commit e998421 into feat/multicloud-web-frontend May 28, 2026
4 checks passed
@cristim
cristim deleted the fix/784-sp-fanout branch June 3, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/s Hours impact/all-users Affects every user priority/p1 Next up; this sprint severity/high Significant harm triaged Item has been triaged type/bug Defect urgency/now Drop other things

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant