Repository navigation
feat(cli): configurable --target-coverage CE lookback window (closes #360) - #794
Conversation
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).
|
@coderabbitai review |
|
Warning Review limit reached
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 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
✅ Actions performedReview triggered.
|
|
@coderabbitai full review |
Rate Limit Exceeded
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
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).
Summary
existingCoverageLookbackDayswas hardcoded to 30 incmd/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).--coverage-lookback-daysflag (default 30, matching CE's UI default) that setsConfig.CoverageLookbackDaysand is threaded intoGetRICoverageMapviafetchExistingCoverage.validateNumericRangesrejects values < 1 with a clear error message.Design choices
--coverage-lookback-days*-dayssuffix convention used by--rebuy-window-daysin the same CLIFiles changed
cmd/main.go-Config.CoverageLookbackDaysfield + flag registration ininit()cmd/validators.go-validateNumericRangesguard (< 1 rejected)cmd/multi_service.go- dropexistingCoverageLookbackDaysconstant; threadcfg.CoverageLookbackDays(with<= 0 -> 30fallback) intoadapter.GetRICoverageMapcmd/validators_test.go-TestValidateCoverageLookbackDays(5 cases); existing tests updated to setCoverageLookbackDays: 30cmd/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-daysmatching the report's date range (e.g.--coverage-lookback-days 30for a 30-day window,--coverage-lookback-days 14for a 2-week export). The API has no anchor-alignment option so an exact day match is the best available reconciliation.Closes #360