Repository navigation
fix(purchases): correct Savings History chart axis, tooltip decimals, y-axis ticks - #1253
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 13 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?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 reviews. How do review 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 refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe savings chart now uses timestamped ChangesSavings History chart behavior
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
f8fd2d0 to
3d01037
Compare
|
This PR is now stacked on #1254 (branch The earlier This PR has been rebased onto |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai full review |
✅ Action performedFull review finished. |
3d01037 to
51c8e63
Compare
|
@coderabbitai review |
Rate Limit Exceeded
|
|
@coderabbitai full review |
Action performedFull review triggered. |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
✅ Action performedFull review finished. |
Adversarial review (PR #1253)Reviewed the four QA fixes against the actual data path (API → reducer → frontend chart options) and probed the edge cases the task brief asked about. No actionable findings to block merge. Verified
Minor observations (non-blocking, not worth a follow-up)
UNSTABLE stateFailing checks are pre-existing on
None are caused by or related to this PR's frontend-only changes. Not blocking. VerdictLGTM. CR has already reviewed multiple times with no actionable comments. No fixes pushed. |
|
@coderabbitai review |
✅ Action performedReview finished.
|
9f47ee4 to
4384654
Compare
|
Rebased onto origin/main (27fdb06). Clean 3-commit rebase, no conflicts. Gates: go build/vet exit 0; npm test exit 0 (78 suites, 2629 tests). @coderabbitai review |
|
✅ Action performedReview finished.
|
4384654 to
f7d6036
Compare
…dule Move formatTrendAxisTick from dashboard.ts into frontend/src/modules/chart-utils.ts so it can be reused by the Purchases Savings History chart. Re-export from dashboard.ts for backward compatibility with existing tests and callers.
… y-axis ticks
QA 2.2 -- x-axis starts at period start, not first data point:
Convert datasets from scalar arrays to {x: timestamp_ms, y: value}
objects and switch the x-axis to type:'linear' with min/max anchored
to the selected period window. Mirrors the Home dashboard approach
from PR #746. Uses the shared formatTrendAxisTick helper from
chart-utils.ts for tick labels.
QA 2.3 -- Period Savings tooltip precision matches Cumulative:
Change toFixed(4) to toFixed(2) for the Period Savings tooltip label
so both series and the KPI box above the chart show 2 decimal places.
QA 2.4/2.5 -- y-axis ticks stable when toggling series:
Add maxTicksLimit:6 to both y and y1 axis tick configs to cap
re-autoscaling on legend toggle. Fix the y1 formatter to emit 2
decimal places for non-integer float ticks, preventing distinct float
values from collapsing to the same integer label string.
Regression tests added in savings-history.test.ts:
- QA 2.2: x-axis type:linear with numeric min equal to period start
- QA 2.3: Period Savings tooltip has exactly 2 decimal places
- QA 2.4: both y-axes have maxTicksLimit
- QA 2.5: y1 formatter does not collapse distinct floats to same label
Closes #1252
…etry Minor readability cleanup: the Period Savings dataset array is now named periodSavingsData, matching its sibling cumulativeSavingsData. No behavior change.
f7d6036 to
8be1709
Compare
Closes #1252
Summary
Three visual bugs fixed in the Purchases page Savings History chart (QA session 596).
Root cause and fix per bug
QA 2.2 -- x-axis starts at purchase date, not period start
The chart used a default
categoryx-axis built from alabelsarray of formatted date strings. Chart.js positions the leftmost tick at the first label, so selecting "Last 30 days" with a recent first purchase showed a chart that started mid-period.Fix: converted datasets to
{x: timestamp_ms, y: value}objects and switched the x-axis totype:'linear'withminset to the period start timestamp andmaxset to now. Mirrors the Home dashboard chart approach from PR #746. The tick callback uses the sharedformatTrendAxisTickhelper, extracted tofrontend/src/modules/chart-utils.tsand re-exported fromdashboard.tsfor backward compatibility.QA 2.3 -- Period Savings tooltip shows 4 decimal places vs Cumulative 2
The tooltip
labelcallback usedtoFixed(4)for dataset 0 (Period Savings) andtoFixed(2)for dataset 1 (Cumulative), while the KPI box also uses 2 decimals.Fix: changed
toFixed(4)totoFixed(2)for Period Savings.QA 2.4/2.5 -- y-axis tick behavior changes oddly when toggling series
Neither y-axis had a
maxTicksLimit, so Chart.js re-autoscaled freely on every legend toggle. They1tick formatter usedtoFixed(0)which collapses nearby float ticks (e.g. 0.1 and 0.2) to the same integer string ("$0", "$0").Fix: added
maxTicksLimit: 6to bothyandy1axes. Updated they1formatter to emit 2 decimal places for non-integer float ticks, preventing label collision.Testing
Regression tests added to
frontend/src/__tests__/savings-history.test.ts:x-axis.type === 'linear'with numericminwithin 1s of the period start; asserts no top-levellabelsarray/\$\d+\.\d{2}(?!\d)/(exactly 2 decimals) and does not match 3+ decimalsmaxTicksLimitsetAll 83 tests in
savings-history.test.tspass.npx tsc --noEmitreports no errors. Dashboard tests (96 tests) still pass after theformatTrendAxisTickextraction.Summary by CodeRabbit
$0.00when values are missing.