Skip to content

feat(commitmentopts): probe Savings Plans offerings live (closes #108)#569

Open
cristim wants to merge 1 commit into
feat/multicloud-web-frontendfrom
feat/issue-108-sp-probe
Open

feat(commitmentopts): probe Savings Plans offerings live (closes #108)#569
cristim wants to merge 1 commit into
feat/multicloud-web-frontendfrom
feat/issue-108-sp-probe

Conversation

@cristim
Copy link
Copy Markdown
Member

@cristim cristim commented May 20, 2026

Summary

  • Adds SavingsPlansProber that calls DescribeSavingsPlansOfferings once per plan type (Compute, EC2Instance, SageMaker, Database) and emits per-product service keys aligned with SERVICE_FIELDS in settings.ts
  • Reuses walkPaginated, normalizePayment, and durationToTerm from the existing RI probe infrastructure
  • Introduces dedupeRaw to collapse duplicate (duration, payment) pairs that arise because the SP API returns one row per ProductType (EC2/Lambda/Fargate) within a plan type
  • Registers SavingsPlansProber in DefaultProbers() alongside the six RI probers
  • Empty plan-type results are silently dropped so the frontend falls back to hardcoded rules rather than treating an empty DB row as a probe sentinel

Test plan

  • go test ./internal/commitmentopts/... passes (66 tests including 8 new SP prober tests)
  • go test ./internal/api/... -short passes (1151 tests)
  • New tests cover: standard combos, all four plan types, empty-result drop, error propagation, page cap, dedup across ProductType variants, DefaultProbers registration

Closes #108

Add SavingsPlansProber that calls DescribeSavingsPlansOfferings once per
plan type (Compute, EC2Instance, SageMaker, Database) and emits per-product
service keys aligned with SERVICE_FIELDS in settings.ts:
  savings-plans-compute / savings-plans-ec2instance /
  savings-plans-sagemaker / savings-plans-database

The prober reuses walkPaginated (page cap, token threading) and the shared
normalizePayment/durationToTerm normalizers. Duplicate (duration, payment)
pairs within one plan type are collapsed via dedupeRaw before collect so
ProductType variants in the SP API response don't inflate the combo count.
Empty plan types return zero combos and are silently dropped so the frontend
falls back to its hardcoded rules for that key rather than treating an empty
DB row as "probed and nothing valid".

SavingsPlansProber is registered in DefaultProbers alongside the six RI
probers. Service.probeAndPersist fans it out concurrently; the all-or-nothing
abort-on-error contract is inherited.

Unit tests cover: standard combos, all four plan types, empty-result drop,
error propagation, page cap, dedup across ProductType variants.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Warning

Review limit reached

@cristim, we couldn't start this review because you've used your available PR reviews for now.

Your plan currently allows 2 reviews/hour. Refill in 21 minutes and 49 seconds.

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

⌛ How to resolve this issue?

After more review capacity refills, 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 have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f32417b2-a8eb-4a4b-b4de-5e5926349674

📥 Commits

Reviewing files that changed from the base of the PR and between bc7bf0f and cb903e4.

📒 Files selected for processing (3)
  • go.mod
  • internal/commitmentopts/probe.go
  • internal/commitmentopts/probe_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/issue-108-sp-probe

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

@cristim cristim added priority/p2 Backlog-worthy severity/medium Moderate harm urgency/this-sprint Within the current sprint impact/many Affects most users effort/m Days type/feat New capability triaged Item has been triaged labels May 20, 2026
@cristim
Copy link
Copy Markdown
Member Author

cristim commented May 20, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

✅ 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
Copy link
Copy Markdown
Member Author

cristim commented May 22, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

✅ 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
Copy link
Copy Markdown
Member Author

cristim commented May 22, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

✅ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/m Days impact/many Affects most users priority/p2 Backlog-worthy severity/medium Moderate harm triaged Item has been triaged type/feat New capability urgency/this-sprint Within the current sprint

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant