Skip to content

feat(cli): end-of-run summary of dropped recommendations (closes #361)#875

Open
cristim wants to merge 7 commits into
mainfrom
fix/361-wave19
Open

feat(cli): end-of-run summary of dropped recommendations (closes #361)#875
cristim wants to merge 7 commits into
mainfrom
fix/361-wave19

Conversation

@cristim

@cristim cristim commented May 30, 2026

Copy link
Copy Markdown
Member

Summary

Closes #361. Tracks recommendations dropped during sizing, filtering, and family-NU partitioning, then prints a per-stage end-of-run summary so users can see why an instance type didn't make the final plan instead of silently missing.

  • New pkg/common/drop_summary.go + tests — DropSummary collects per-stage counts with optional reasons, formats a multi-line summary at end-of-run.
  • applyFilters, applySizing, and ApplyFamilyNUSizingRDS now thread a *common.DropSummary (nil-safe — production callers can pass nil to opt out).
  • Test call sites updated to pass nil; existing assertions unchanged. Family-NU partition signature gained a 3rd return (dropped count) — both test cases adjusted.

Test plan

  • go test github.com/LeanerCloud/CUDly/cmd/... github.com/LeanerCloud/CUDly/providers/aws/recommendations/... github.com/LeanerCloud/CUDly/pkg/common/... -> 1201 pass across 9 packages
  • Manual: run optimizer with a recommendation set that triggers filter/sizing drops, verify the end-of-run summary shows non-zero counts

Summary by CodeRabbit

  • New Features

    • Added per-reason drop tracking across filtering and sizing, with clearer category labels (e.g., target already met, sized to zero, missing utilization signal).
    • Produce a deterministic one-line drop summary during multi-service runs.
    • Emit warnings once per unsupported commitment type per run, while continuing to pass through unsupported items.
    • Extended RDS family-NU sizing to account for additional drop categories.
  • Tests

    • Updated call sites for the new drop-tracking behavior and added coverage for key drop categories and summary formatting.

@cristim cristim added triaged Item has been triaged priority/p3 Polish / idea / may never ship severity/low Minor harm urgency/eventually No deadline impact/internal Team-internal only effort/s Hours type/feat New capability labels May 30, 2026
@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fcb340a8-5fa6-4a5f-a877-54f6b02a7892

📥 Commits

Reviewing files that changed from the base of the PR and between 71c200a and cf47aa5.

📒 Files selected for processing (7)
  • cmd/helpers.go
  • cmd/helpers_test.go
  • cmd/multi_service.go
  • cmd/multi_service_filters.go
  • cmd/multi_service_filters_test.go
  • cmd/multi_service_helpers.go
  • cmd/multi_service_test.go
🚧 Files skipped from review as they are similar to previous changes (6)
  • cmd/multi_service_test.go
  • cmd/multi_service_filters_test.go
  • cmd/multi_service.go
  • cmd/multi_service_filters.go
  • cmd/helpers.go
  • cmd/multi_service_helpers.go

📝 Walkthrough

Walkthrough

Adds DropSummary and per-reason drop reporting, threads it through filtering, sizing—including family-NU—and deduplication, and prints aggregated drops during multi-service execution. Tests update call sites and verify categorized counts.

Changes

Drop Tracking Feature

Layer / File(s) Summary
DropSummary infrastructure and constants
pkg/common/drop_summary.go, pkg/common/drop_summary_test.go
Adds shared drop reasons, accumulation methods, deterministic formatting, and tests for nil, zero-value, aggregation, and formatting behavior.
RDS family-NU sizing counts
providers/aws/recommendations/family_nu.go, providers/aws/recommendations/family_nu_test.go
Family sizing now returns counts for already-met targets, missing NU signals, and recommendations scaled to zero, with corresponding assertions.
Target coverage drop reporting
cmd/helpers.go, cmd/helpers_test.go
Target-coverage sizing records RI drop reasons and forwards an optional DropSummary through applySizing; tests cover categorized drops and updated signatures.
Filtering and pipeline reporting
cmd/multi_service_filters.go, cmd/multi_service_helpers.go, cmd/multi_service.go, cmd/*_test.go
Filter exclusions and duplicate removal record reasons, the accumulator is threaded through regional processing, fetchAllRecs aggregates it, and multi-service execution prints the summary.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 79.17% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: end-of-run dropped-recommendation accounting in the CLI.
Linked Issues check ✅ Passed The PR implements #361 by tracking the requested drop categories and surfacing an end-of-run dropped summary.
Out of Scope Changes check ✅ Passed The changes stay focused on drop accounting, pipeline threading, and related tests with no unrelated feature work.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/361-wave19

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

@cristim

cristim commented May 30, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 30, 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
providers/aws/recommendations/family_nu.go (1)

256-260: 💤 Low value

Consider the semantic fit of currentNU <= 0AlreadyAtTarget.

When currentNU <= 0, it means the family's recommendations sum to zero NU (typically because instance types aren't in the NU map). Labeling this as "AlreadyAtTarget" is semantically imprecise—it's more "no scalable NU signal" than "target already met."

However, if the drop-summary constants in layer 1 don't provide a distinct category (e.g., DropFamilyNoNUSignal), then grouping with AlreadyAtTarget may be acceptable as "cannot scale to contribute toward target."

Verify that this grouping aligns with the user-facing summary labels.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@providers/aws/recommendations/family_nu.go` around lines 256 - 260, The check
currentNU <= 0 is being classified as drops.AlreadyAtTarget which is
semantically misleading; change the drop categorization so the case where the
family's recommendations sum to zero NU is recorded as a more accurate category
(e.g., DropFamilyNoNUSignal) or, if that constant doesn't exist, add it and use
it instead of AlreadyAtTarget; update any user-facing summary labels/enum in the
layer-1 drop constants (and adjust any callers that consume
drops.AlreadyAtTarget or the new DropFamilyNoNUSignal) to ensure the UI/summary
reflects "no scalable NU signal" rather than "already at target" while keeping
the early-return behavior (return nil, drops) and preserving indices counting.
providers/aws/recommendations/family_nu_test.go (1)

127-363: ⚡ Quick win

Add test coverage for FamilyDropCounts.

All call sites now unpack three return values but discard the third (drops) with _. The new drop-tracking feature is untested at this layer. Consider adding assertions to verify:

  • Line 237 test case ("family at-or-above target"): assert.Equal(t, 1, drops.AlreadyAtTarget)
  • A new test case where scaling produces floor(0) for a rec: assert.Equal(t, 1, drops.SizedToZero)
  • Other test cases: assert.Equal(t, 0, drops.AlreadyAtTarget + drops.SizedToZero) (no drops)

This would catch regressions in drop accounting before it reaches the end-of-run summary layer.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@providers/aws/recommendations/family_nu_test.go` around lines 127 - 363, The
test suite exercises ApplyFamilyNUSizingRDS but never asserts the new
FamilyDropCounts return (the third return value, commonly named drops); update
the existing tests that call ApplyFamilyNUSizingRDS to capture the third return
and assert its fields: in the "family at-or-above target" case capture drops and
assert drops.AlreadyAtTarget == 1; add a new test case where scaling results in
floor(0) for a rec and assert drops.SizedToZero == 1; for the remaining
positive/unchanged cases (e.g., "no coverage signal", "AWS rec
under-recommends", "AWS rec over-recommends", "RecurringMonthlyCost scales",
"non-RDS recs flow through", "ProjectedCoverage", "multiple sizes") capture
drops and assert drops.AlreadyAtTarget + drops.SizedToZero == 0 so drop
accounting is exercised consistently when calling ApplyFamilyNUSizingRDS.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/common/drop_summary.go`:
- Around line 35-40: DropSummary.Add can panic when called on a zero-value
receiver because d.counts may be nil; modify DropSummary.Add (pointer receiver
Add) to lazily initialize d.counts (e.g., if d.counts == nil { d.counts =
make(map[string]int) }) before performing d.counts[reason] += n, keeping the
existing nil receiver and zero n guards.

---

Nitpick comments:
In `@providers/aws/recommendations/family_nu_test.go`:
- Around line 127-363: The test suite exercises ApplyFamilyNUSizingRDS but never
asserts the new FamilyDropCounts return (the third return value, commonly named
drops); update the existing tests that call ApplyFamilyNUSizingRDS to capture
the third return and assert its fields: in the "family at-or-above target" case
capture drops and assert drops.AlreadyAtTarget == 1; add a new test case where
scaling results in floor(0) for a rec and assert drops.SizedToZero == 1; for the
remaining positive/unchanged cases (e.g., "no coverage signal", "AWS rec
under-recommends", "AWS rec over-recommends", "RecurringMonthlyCost scales",
"non-RDS recs flow through", "ProjectedCoverage", "multiple sizes") capture
drops and assert drops.AlreadyAtTarget + drops.SizedToZero == 0 so drop
accounting is exercised consistently when calling ApplyFamilyNUSizingRDS.

In `@providers/aws/recommendations/family_nu.go`:
- Around line 256-260: The check currentNU <= 0 is being classified as
drops.AlreadyAtTarget which is semantically misleading; change the drop
categorization so the case where the family's recommendations sum to zero NU is
recorded as a more accurate category (e.g., DropFamilyNoNUSignal) or, if that
constant doesn't exist, add it and use it instead of AlreadyAtTarget; update any
user-facing summary labels/enum in the layer-1 drop constants (and adjust any
callers that consume drops.AlreadyAtTarget or the new DropFamilyNoNUSignal) to
ensure the UI/summary reflects "no scalable NU signal" rather than "already at
target" while keeping the early-return behavior (return nil, drops) and
preserving indices counting.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0729b911-0b90-4841-9fbe-363017c50c32

📥 Commits

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

📒 Files selected for processing (11)
  • cmd/helpers.go
  • cmd/helpers_test.go
  • cmd/multi_service.go
  • cmd/multi_service_filters.go
  • cmd/multi_service_filters_test.go
  • cmd/multi_service_helpers.go
  • cmd/multi_service_test.go
  • pkg/common/drop_summary.go
  • pkg/common/drop_summary_test.go
  • providers/aws/recommendations/family_nu.go
  • providers/aws/recommendations/family_nu_test.go

Comment thread pkg/common/drop_summary.go
cristim added a commit that referenced this pull request May 30, 2026
… on zero-value

Calling Add on a zero-value DropSummary (var d DropSummary) would panic
with "assignment to entry in nil map" because the counts map is only
populated by NewDropSummary. Lazily initialise the map on first Add so
both construction patterns are safe.

Adds a regression test that exercises a zero-value DropSummary directly.

Addresses CodeRabbit review on PR #875.
@cristim

cristim commented May 30, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 30, 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 added a commit that referenced this pull request May 30, 2026
…test coverage (#875 CR)

- DropSummary.Add already had the lazy-init nil-map guard; add
  TestDropSummary_ZeroValue_Safe regression test to lock the behaviour
- Add DropFamilyNoNUSignal ("family-nu-no-nu-signal") constant and
  FamilyDropCounts.NoNUSignal field for the case where AWS-rec NU sums
  to zero (unknown/unrecognised sizes) -- distinct from AlreadyAtTarget
- Fix sizeRDSFamilyRecs: currentNU<=0 branch now sets NoNUSignal instead
  of incorrectly reusing AlreadyAtTarget
- Propagate NoNUSignal in ApplyFamilyNUSizingRDS aggregation loop and
  in cmd/multi_service_helpers.go drops recording
- Capture drops in all TestApplyFamilyNUSizingRDS subtests; assert
  AlreadyAtTarget==1 for the "at target" case, SizedToZero==1 for a
  new "floor(0)" test case, and zero total drops for passing-through cases
@cristim

cristim commented May 30, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 30, 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 Jun 1, 2026

Copy link
Copy Markdown
Member Author

CR finding addressed in 0386b66 + 0460fba (DropSummary.Add nil-map guard). Pre-commit gocyclo failure fixed in 6f3fc30 (extracted writeReportAndSummary helper, reduces runToolMultiService complexity from 11 to 10). @coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

@cristim: Thanks for the updates! Noted the fixes:

  • DropSummary.Add nil-map guard (0386b66 + 0460fba): ensures Add is safe to call even when the internal counts map hasn't been initialized yet.
  • writeReportAndSummary extraction (6f3fc30): reduces runToolMultiService cyclomatic complexity from 11 → 10, satisfying the gocyclo threshold.

Triggering an incremental review now.

✅ 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 Jun 1, 2026

Copy link
Copy Markdown
Member Author

All CodeRabbit findings from the review have been verified against HEAD and are resolved:

  • Actionable (pkg/common/drop_summary.go:35-40): Lazy-init of DropSummary.counts to prevent nil-map panic - fixed in commit 0460fba; regression test added.
  • Nitpick (providers/aws/recommendations/family_nu.go:256-260): currentNU <= 0 case now correctly uses drops.NoNUSignal (not AlreadyAtTarget); DropFamilyNoNUSignal constant exists and is distinct.
  • Nitpick (providers/aws/recommendations/family_nu_test.go:127-363): All test cases now capture and assert the third return (drops); AlreadyAtTarget, SizedToZero, and NoNUSignal fields are all exercised.

Build and tests pass: go build ./... clean, 281 tests in recommendations, 410 tests in pkg all green. No new commits required.

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

@cristim: Thanks for the thorough follow-up — all three findings look properly resolved:

  • Nil-map guard (0460fba): Lazy-init in DropSummary.Add prevents panics on an uninitialized counts map; regression test covers the nil-receiver path too.
  • NoNUSignal distinction (family_nu.go): currentNU <= 0 now correctly records DropFamilyNoNUSignal rather than conflating it with AlreadyAtTarget, giving operators a meaningful signal when there's no NU coverage data.
  • Test coverage (family_nu_test.go): Third return fully captured and asserted across all cases, exercising AlreadyAtTarget, SizedToZero, and NoNUSignal fields.

Triggering an incremental review now.

(´• ω •`) 🐇

✅ 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 coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@providers/aws/recommendations/family_nu.go`:
- Around line 262-267: The branch that sets drops.NoNUSignal and returns nil
(triggered when currentNU <= 0) means those recommendations are dropped and
never flow into sizedRDS/nonRDS or the per-pool sizing fallback; update the
misleading comments that say “unknown sizes fall back / leave unchanged” to
instead state that unknown-size families are recorded to NoNUSignal and excluded
from per-pool sizing. Edit the comments near the per-pool fallback wording and
the comments around the sizedRDS/nonRDS partition to reference drops.NoNUSignal
(and the existing end-of-run surfacing via
drops.Add(common.DropFamilyNoNUSignal) and drops.FormatOneLine()) so they
accurately describe the behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ac95faf3-2722-47ec-b948-1857d781294a

📥 Commits

Reviewing files that changed from the base of the PR and between e9b45f3 and 6f3fc30.

📒 Files selected for processing (6)
  • cmd/multi_service.go
  • cmd/multi_service_helpers.go
  • pkg/common/drop_summary.go
  • pkg/common/drop_summary_test.go
  • providers/aws/recommendations/family_nu.go
  • providers/aws/recommendations/family_nu_test.go
🚧 Files skipped from review as they are similar to previous changes (4)
  • pkg/common/drop_summary_test.go
  • cmd/multi_service.go
  • pkg/common/drop_summary.go
  • cmd/multi_service_helpers.go

Comment thread providers/aws/recommendations/family_nu.go
@cristim

cristim commented Jun 2, 2026

Copy link
Copy Markdown
Member Author

Resolved the open Minor CR finding (comment #3337746904, 2026-06-01T23:34Z) about misleading comments in providers/aws/recommendations/family_nu.go.

Finding: Four comment blocks claimed unknown-size recs "fall back to per-pool sizing" or are "passed through unchanged", but the currentNU <= 0 branch in sizeRDSFamilyRecs actually drops those recs to drops.NoNUSignal.

Fix (commit b776f80): Updated all four comment blocks to accurately describe the three distinct outcomes of sizeRDSFamilyRecs, and added a clear distinction between the two 0-NU paths (empty family prefix -> nonRDS via partitionRDSRecsByFamily vs. known family with zero-summing NU -> dropped to NoNUSignal). No logic changes.

Tests: go build ./... clean; go test github.com/LeanerCloud/CUDly/providers/aws/recommendations 281 passed; pkg/ 410 passed.

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

@cristim: Thanks for the detailed resolution notes! The comment accuracy fix in commit b776f805a looks exactly right:

  • Accurate outcome descriptions: All four comment blocks now correctly describe the three distinct outcomes of sizeRDSFamilyRecs (AlreadyAtTarget, NoNUSignal, SizedToZero) rather than the previously misleading "falls back to per-pool sizing / passed through unchanged" language.
  • Clear 0-NU path distinction: The two zero-NU scenarios are now explicitly differentiated — empty family prefix → routed to nonRDS via partitionRDSRecsByFamily, vs. known family with zero-summing NU → dropped and counted under NoNUSignal. This was the subtle behavioral nuance the original comments obscured.

Triggering an incremental review now.

✅ 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 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 commented Jun 4, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Rate Limit Exceeded

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

@cristim

cristim commented Jun 6, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 6, 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 changed the base branch from feat/multicloud-web-frontend to main June 9, 2026 15:43
cristim added a commit that referenced this pull request Jun 19, 2026
… on zero-value

Calling Add on a zero-value DropSummary (var d DropSummary) would panic
with "assignment to entry in nil map" because the counts map is only
populated by NewDropSummary. Lazily initialise the map on first Add so
both construction patterns are safe.

Adds a regression test that exercises a zero-value DropSummary directly.

Addresses CodeRabbit review on PR #875.
cristim added a commit that referenced this pull request Jun 19, 2026
…test coverage (#875 CR)

- DropSummary.Add already had the lazy-init nil-map guard; add
  TestDropSummary_ZeroValue_Safe regression test to lock the behaviour
- Add DropFamilyNoNUSignal ("family-nu-no-nu-signal") constant and
  FamilyDropCounts.NoNUSignal field for the case where AWS-rec NU sums
  to zero (unknown/unrecognised sizes) -- distinct from AlreadyAtTarget
- Fix sizeRDSFamilyRecs: currentNU<=0 branch now sets NoNUSignal instead
  of incorrectly reusing AlreadyAtTarget
- Propagate NoNUSignal in ApplyFamilyNUSizingRDS aggregation loop and
  in cmd/multi_service_helpers.go drops recording
- Capture drops in all TestApplyFamilyNUSizingRDS subtests; assert
  AlreadyAtTarget==1 for the "at target" case, SizedToZero==1 for a
  new "floor(0)" test case, and zero total drops for passing-through cases
@cristim

cristim commented Jun 19, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Rate Limit Exceeded

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

cristim added a commit that referenced this pull request Jul 5, 2026
… on zero-value

Calling Add on a zero-value DropSummary (var d DropSummary) would panic
with "assignment to entry in nil map" because the counts map is only
populated by NewDropSummary. Lazily initialise the map on first Add so
both construction patterns are safe.

Adds a regression test that exercises a zero-value DropSummary directly.

Addresses CodeRabbit review on PR #875.
cristim added a commit that referenced this pull request Jul 5, 2026
…test coverage (#875 CR)

- DropSummary.Add already had the lazy-init nil-map guard; add
  TestDropSummary_ZeroValue_Safe regression test to lock the behaviour
- Add DropFamilyNoNUSignal ("family-nu-no-nu-signal") constant and
  FamilyDropCounts.NoNUSignal field for the case where AWS-rec NU sums
  to zero (unknown/unrecognised sizes) -- distinct from AlreadyAtTarget
- Fix sizeRDSFamilyRecs: currentNU<=0 branch now sets NoNUSignal instead
  of incorrectly reusing AlreadyAtTarget
- Propagate NoNUSignal in ApplyFamilyNUSizingRDS aggregation loop and
  in cmd/multi_service_helpers.go drops recording
- Capture drops in all TestApplyFamilyNUSizingRDS subtests; assert
  AlreadyAtTarget==1 for the "at target" case, SizedToZero==1 for a
  new "floor(0)" test case, and zero total drops for passing-through cases
@cristim

cristim commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Rate Limit Exceeded

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

cristim added 7 commits July 17, 2026 21:17
Track and surface recommendations that were dropped during sizing,
filtering, or family-NU partitioning so users see why an instance
type didn't make it into the final plan instead of silently missing.

DropSummary collects per-stage counts with optional reasons; printed
at end-of-run when any drop occurred. applyFilters, applySizing, and
ApplyFamilyNUSizingRDS now thread a *common.DropSummary through their
signatures (nil-safe). Tests cover collection, formatting, and the
no-drops/nil-summary fast paths.
… on zero-value

Calling Add on a zero-value DropSummary (var d DropSummary) would panic
with "assignment to entry in nil map" because the counts map is only
populated by NewDropSummary. Lazily initialise the map on first Add so
both construction patterns are safe.

Adds a regression test that exercises a zero-value DropSummary directly.

Addresses CodeRabbit review on PR #875.
…test coverage (#875 CR)

- DropSummary.Add already had the lazy-init nil-map guard; add
  TestDropSummary_ZeroValue_Safe regression test to lock the behaviour
- Add DropFamilyNoNUSignal ("family-nu-no-nu-signal") constant and
  FamilyDropCounts.NoNUSignal field for the case where AWS-rec NU sums
  to zero (unknown/unrecognised sizes) -- distinct from AlreadyAtTarget
- Fix sizeRDSFamilyRecs: currentNU<=0 branch now sets NoNUSignal instead
  of incorrectly reusing AlreadyAtTarget
- Propagate NoNUSignal in ApplyFamilyNUSizingRDS aggregation loop and
  in cmd/multi_service_helpers.go drops recording
- Capture drops in all TestApplyFamilyNUSizingRDS subtests; assert
  AlreadyAtTarget==1 for the "at target" case, SizedToZero==1 for a
  new "floor(0)" test case, and zero total drops for passing-through cases
… complexity

gocyclo flagged runToolMultiService at complexity 11 (threshold 10).
Extract the final report-write-and-summary block into a dedicated
writeReportAndSummary helper, bringing the parent function to complexity 10.
No logic change.
…havior

The rdsInstanceNU map comment, rdsInstanceNUFromType comment,
ApplyFamilyNUSizingRDS return-value doc, and sizeRDSFamilyRecs
summary all claimed unknown-size recs "fall back to per-pool sizing"
or are "passed through unchanged". That is only true when rdsFamilyFromType
returns an empty prefix (those recs go to nonRDS via
partitionRDSRecsByFamily). When a rec has a known family prefix but
an unrecognised size suffix, it reaches sizeRDSFamilyRecs and, if
the whole family's NU sums to zero (currentNU <= 0), is dropped into
drops.NoNUSignal -- not returned unchanged or forwarded downstream.

Update all four comment blocks to reflect the three distinct outcomes
in sizeRDSFamilyRecs: CE-no-signal (return as-is), already-at-target
(drop to AlreadyAtTarget), and zero-rec-NU (drop to NoNUSignal).
…ummary (refs #361)

Add discriminating tests for the four drop categories that were only
exercised via the nil-DropSummary path, leaving no regression guard
against a future removal of a drops.Add call site:

- TestApplyFilters_DropMinPoolSize: passes a non-nil DropSummary into
  applyFilters with a rec whose avg < --min-pool-size and asserts the
  DropMinPoolSize count is 1.

- TestApplyFilters_DropExtendedSupport: passes a non-nil DropSummary
  into applyFilters with a MySQL 5.7 rec (all instances on extended
  support) and asserts the DropExtendedSupport count is 1.

- TestApplyTargetCoverage_DropTargetAlreadyMet: passes a non-nil
  DropSummary into ApplyTargetCoverage with ExistingCoveragePct=90
  > target=80 and asserts the DropTargetAlreadyMet count is 1.

- TestApplyTargetCoverage_DropTargetSizedToZero: passes a non-nil
  DropSummary into ApplyTargetCoverage with avg=0.4 at target=80
  (floor(0.32)=0) and asserts the DropTargetSizedToZero count is 1.

Each test was verified to fail when its corresponding drops.Add call
was temporarily removed, and to pass with the call present.
- Align const block in drop_summary.go per gofmt (tab-aligned values)
- Fix "synchronisation" -> "synchronization" in drop_summary.go comment
- Fix "unrecognised/recognised" -> "unrecognized/recognized" in new
  family_nu.go comments added by this branch (lines 20, 59, 147, 181)
- Add missing blank comment line before "The second return value" in
  sizeRDSFamilyRecs godoc (gofmt list-item paragraph separator)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/s Hours impact/internal Team-internal only priority/p3 Polish / idea / may never ship severity/low Minor 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.

cli: end-of-run summary of skipped/dropped recommendations by category

1 participant