Repository navigation
fix(opportunities): cost-column sort toggle + expand/collapse persistence on filter change - #1259
Conversation
|
Warning Review limit reached
More reviews will be available in 4 minutes and 52 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. 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 (2)
📝 WalkthroughWalkthroughTwo bugs from QA 4.13 are fixed. ChangesQA 4.13: Expand-state reset and monthly_cost sort scoring fixes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai full review |
✅ Action performedFull review finished. |
Monthly Cost sort direction changes had no effect after the first click because Math.min over all finite scaled costs scored every cell with at least one all-upfront variant at 0, making them all tie and leaving the direction multiplier nothing to act on. Fix: compute the minimum NON-ZERO recurring cost so mixed (all-upfront + no-upfront) cells get a meaningful score that responds to direction toggles. Fall back to 0 only when every finite value is 0 (pure all-upfront cell), and to POSITIVE_INFINITY when all values are null (preserving the existing null-sink behavior). Closes #1251
Selecting one provider, clicking "Expand all", then switching the Global provider/account filter left groups for the newly shown provider collapsed, reset the "Collapse all" button back to "Expand all", and produced a mixed expanded/collapsed view under "All Providers". The module-level expandedCells and expandedSpGroups Sets retained stale keys from the prior provider because loadRecommendations re-fetched on filter change without clearing them. Fix: call resetExpandedCells() at the start of loadRecommendations so a provider/account filter change clears expand state before the new data renders. Column-filter and sort re-renders go through rerenderRecommendations (not loadRecommendations), so the intended "expand survives column-filter/sort" behavior is preserved. Closes #1251
a5d6e64 to
8ced5a7
Compare
|
@coderabbitai review |
Rate Limit Exceeded
|
|
@coderabbitai full review |
✅ Action performedFull review finished. |
Adversarial review of #1259 noted the headers above `expandedCells` / `expandedSpGroups` still read "Cleared on page load / full refresh" after this PR moved the actual clear into `loadRecommendations()`. The behavior is now broader than that wording suggests: the reset fires on every loadRecommendations entry — page load, switchTab('opportunities'), provider/account Global filter change, manual refresh, lookback change, and stale auto-refresh. The "survives per-column filter/sort" guarantee still holds because column-filter and sort/period re-renders all go through rerenderRecommendations() instead. Update both headers to match the implementation so the next reader doesn't conclude that a tab switch or refresh preserves expand state (it doesn't). Comment-only change; no behavior delta.
|
@coderabbitai full review |
✅ Action performedFull review finished. |
Closes #1251
Stacked on #1254 (pre-commit repair); retarget to main when #1254 merges.
Bug 1: Cost-column sort no-ops after the first click (QA 4.13)
Symptom: Clicking the Cost column header sorts on the first click but subsequent clicks (which should toggle asc/desc) do nothing.
Root cause: The per-cell
monthly_costsort score usedMath.minover all scaled finite variant costs, including 0. Azure all-upfront recommendations havemonthly_cost = 0(a real value, not null), so any cell with at least one all-upfront variant scored 0. Most/all cells tied at 0, leaving the direction multiplier nothing to act on (direction * (0 - 0) = 0); the comparator then fell through to a direction-invariantcellKeylocaleComparetiebreaker, so flipping direction never reordered. The first click only appeared to work because it switched away from the default savings-desc ordering.Fix: Compute the minimum NON-ZERO recurring cost so mixed (all-upfront + no-upfront) cells get a meaningful, direction-responsive score. Fall back to 0 only when every finite value is 0 (pure all-upfront cell), and to
POSITIVE_INFINITYonly when all variants are null (preserving the existing null-sink behavior and the #494 best-case framing intent).Bug 2: Expand/collapse desyncs on provider-filter change (QA 4.13)
Symptom: Select one provider, click "Expand all", then change the provider filter to another provider (or All Providers). Expected: the table updates and stays expanded. Actual: groups for the newly-shown provider render collapsed, "Collapse all" resets to "Expand all", and "All Providers" yields a mixed expanded/collapsed state.
Root cause: The module-level
expandedCellsandexpandedSpGroupsSets are never cleared when the provider/account Global filter changes.loadRecommendationsre-fetches on provider change but did not clear them, so stale keys from the prior provider desynced the Expand-All button state and left a mixed view.Fix: Call
resetExpandedCells()at the start ofloadRecommendations()so a provider/account filter change clears expand state before the new data renders. Column-filter and sort re-renders go throughrerenderRecommendations()(notloadRecommendations()), so the intended "expand survives column-filter/sort" behavior is preserved.Testing
frontend/src/__tests__/recommendations.test.ts:loadRecommendations), and assert the button label reverts to "Expand all" and newly-shown groups render collapsed.All three confirmed to FAIL on pre-fix code and PASS post-fix.
npx jest src/__tests__/recommendations.test.ts-> 396 pass, 0 failnpx tsc --noEmit-> no errorsSummary by CodeRabbit
Bug Fixes