Skip to content

docs(dashboard): audit provider savings semantics, enforce 100%-coverage contract#589

Open
cristim wants to merge 1 commit into
feat/multicloud-web-frontendfrom
feat/issue-215-coverage-aware
Open

docs(dashboard): audit provider savings semantics, enforce 100%-coverage contract#589
cristim wants to merge 1 commit into
feat/multicloud-web-frontendfrom
feat/issue-215-coverage-aware

Conversation

@cristim
Copy link
Copy Markdown
Member

@cristim cristim commented May 20, 2026

Summary

  • Audited AWS CE, Azure Advisor, and GCP Recommender savings semantics: all three APIs return savings sized for ~100% coverage of historical demand (issue feat(recommendations): make rec generation coverage-aware OR enforce 100%-coverage contract #215).
  • Replaced the deferred // Note: assumes recs are generated at 100% coverage comment in summarizeRecommendationsWithCoverage with a // CONTRACT: block citing per-provider evidence; the read-side coverage scaling is correct and not double-counting.
  • Added // issue #215 audit comments to parseCostInformation (AWS), extractLegacy NetSavings (Azure), and extractCostImpactFromRecommendation (GCP) documenting the 100%-coverage contract at each source site.
  • Added TestSummarizeRecommendationsWithCoverage_100PctContract to pin the scaling math: two accounts with $1000/$500 savings at 70%/90% coverage must total $1150; double-apply or factor-100 bugs break this test.

Test plan

  • go test ./internal/api/ -run TestSummarizeRecommendationsWithCoverage passes (9 tests including the new contract test)
  • go build ./... succeeds
  • No logic changes; documentation + test only

Closes #215

…age contract (closes #215)

All three upstream APIs (AWS CE GetReservationPurchaseRecommendation,
Azure Consumption NetSavings, GCP Recommender PrimaryImpact) return
savings sized for 100% coverage of historical demand. The dashboard's
read-side scaling by the operator-configured coverage% is therefore
correct: it projects partial-buy savings against the 100%-coverage
baseline. This closes the deferred-assumption comment from #196 PR #200.

Changes:
- Replace the "Note: assumes recs are generated at 100% coverage" TODO
  comment in summarizeRecommendationsWithCoverage with a CONTRACT block
  citing the per-provider evidence and linking to the verifying test.
- Add parseCostInformation godoc (AWS) documenting EstimatedMonthlySavingsAmount
  semantics: sized for ~100% coverage of historical on-demand demand.
- Add extractLegacy NetSavings comment (Azure) confirming the 100%-coverage
  contract and deprecating the stale "lookback-period" framing.
- Add extractCostImpactFromRecommendation comment (GCP) confirming CUD
  recommendations are sized for 100% historical usage.
- Add TestSummarizeRecommendationsWithCoverage_100PctContract: seeds two
  accounts at known savings baselines, applies per-account coverage
  overrides (70%/90%), and asserts the dashboard total equals the sum of
  the per-account scaled amounts; double-apply or factor-100 bugs would
  break this test.
@cristim cristim added priority/p2 Backlog-worthy severity/medium Moderate harm urgency/this-sprint Within the current sprint impact/many Affects most users effort/s Hours type/docs Documentation 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.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Warning

Rate limit exceeded

@cristim has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 7 minutes and 17 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, 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 the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 15471e6d-ee32-4a81-b499-c5c30629b50e

📥 Commits

Reviewing files that changed from the base of the PR and between bc8831b and 8ddbaa9.

📒 Files selected for processing (5)
  • internal/api/handler_dashboard.go
  • internal/api/handler_dashboard_test.go
  • providers/aws/recommendations/parser_ri.go
  • providers/azure/internal/recommendations/converter.go
  • providers/gcp/services/computeengine/client.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/issue-215-coverage-aware

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

@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/s Hours impact/many Affects most users priority/p2 Backlog-worthy severity/medium Moderate harm triaged Item has been triaged type/docs Documentation urgency/this-sprint Within the current sprint

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant