Skip to content

feat(cli): configurable --target-coverage CE lookback window (closes #360) - #794

Merged
cristim merged 1 commit into
feat/multicloud-web-frontendfrom
fix/360-from-bucket-c
Jun 5, 2026
Merged

cristim merged 1 commit into
feat/multicloud-web-frontendfrom
fix/360-from-bucket-c

Conversation

@cristim

@cristim cristim commented May 28, 2026

Copy link
Copy Markdown
Member

Summary

  • existingCoverageLookbackDays was hardcoded to 30 in cmd/multi_service.go. Operators reconciling CUDly's ExistingCoverage column against the AWS console coverage-report export could not align the windows, causing percentage discrepancies for the same pool (see issue description for a concrete RDS example).
  • Adds --coverage-lookback-days flag (default 30, matching CE's UI default) that sets Config.CoverageLookbackDays and is threaded into GetRICoverageMap via fetchExistingCoverage.
  • Validation in validateNumericRanges rejects values < 1 with a clear error message.

Design choices

Decision Choice Rationale
Flag name --coverage-lookback-days Matches the *-days suffix convention used by --rebuy-window-days in the same CLI
Default value 30 Matches CE's UI default and the previous hardcoded constant; no behaviour change on upgrade
Env-var? Not added Other flags in this CLI don't expose env-var aliases; consistent with existing convention
Validation lower bound >= 1 CE requires start < end; a 0-day window is undefined

Files changed

  • cmd/main.go - Config.CoverageLookbackDays field + flag registration in init()
  • cmd/validators.go - validateNumericRanges guard (< 1 rejected)
  • cmd/multi_service.go - drop existingCoverageLookbackDays constant; thread cfg.CoverageLookbackDays (with <= 0 -> 30 fallback) into adapter.GetRICoverageMap
  • cmd/validators_test.go - TestValidateCoverageLookbackDays (5 cases); existing tests updated to set CoverageLookbackDays: 30
  • cmd/multi_service_coverage_test.go - TestFetchExistingCoverage_LookbackDays (3 cases)

Test counts

1031 passed, 0 failed (up from 1019 passed, 12 failed before fixing test setup)

Note for operators

To reconcile CUDly's ExistingCoverage column against the AWS console reservations-coverage report, pass --coverage-lookback-days matching the report's date range (e.g. --coverage-lookback-days 30 for a 30-day window, --coverage-lookback-days 14 for a 2-week export). The API has no anchor-alignment option so an exact day match is the best available reconciliation.

Closes #360

closes #360)

The GetReservationCoverage lookback was hardcoded to 30 days. Operators
reconciling CUDly's ExistingCoverage column against the AWS console
coverage-report export need to match the window used by each. Add
--coverage-lookback-days (default 30, matching CE's UI default) that
threads through Config.CoverageLookbackDays into GetRICoverageMap.

Validation rejects values < 1. The fetchExistingCoverage fallback guard
(lookbackDays <= 0 -> 30) is kept as a defensive belt-and-suspenders
path for callers that bypass flag parsing (e.g. API callers).
@cristim cristim added triaged Item has been triaged priority/p2 Backlog-worthy severity/medium Moderate harm urgency/eventually No deadline impact/many Affects most users effort/s Hours type/feat New capability 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 51 minutes and 9 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: 424bd9cb-e18d-4167-ab5b-97d112596191

📥 Commits

Reviewing files that changed from the base of the PR and between 4956d66 and bfc29ef.

📒 Files selected for processing (5)
  • cmd/main.go
  • cmd/multi_service.go
  • cmd/multi_service_coverage_test.go
  • cmd/validators.go
  • cmd/validators_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/360-from-bucket-c

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 commented May 30, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown
Contributor

Rate Limit Exceeded

@cristim have exceeded the limit for the number of chat messages per hour. Please wait 54 minutes and 20 seconds before sending another message.

@cristim

cristim commented Jun 4, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 4, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

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 0f6e284 into feat/multicloud-web-frontend Jun 5, 2026
4 checks passed
@cristim
cristim deleted the fix/360-from-bucket-c branch June 5, 2026 08:55
cristim added a commit that referenced this pull request Sep 27, 2026
closes #360) (#794)

The GetReservationCoverage lookback was hardcoded to 30 days. Operators
reconciling CUDly's ExistingCoverage column against the AWS console
coverage-report export need to match the window used by each. Add
--coverage-lookback-days (default 30, matching CE's UI default) that
threads through Config.CoverageLookbackDays into GetRICoverageMap.

Validation rejects values < 1. The fetchExistingCoverage fallback guard
(lookbackDays <= 0 -> 30) is kept as a defensive belt-and-suspenders
path for callers that bypass flag parsing (e.g. API callers).
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/feat New capability urgency/eventually No deadline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant