fix(mac): show correct cost in trend tooltip for per-provider views#95
Merged
Conversation
The trend chart tooltip always displayed `bar.tokens` in its header, which is zero for provider-filtered history (the CLI only carries per-provider cost+calls in the daily cache, not tokens). Result: when you selected Claude/Codex/Cursor/Pi, hovering a bar showed $0.00 even on days with real spend. The trend chart's main metric already falls back to cost when tokens are zero. Pass that same metric value through to the tooltip so both stay consistent. Also removed the misleading "No model breakdown available" fallback line. For provider-filtered views the per-model breakdown legitimately doesn't exist in the payload, so the tooltip now just shows date + cost without the error-sounding message.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a provider-specific tab is selected (Claude, Codex, Cursor, Pi), hovering a bar in the trend chart showed $0.00 and "No model breakdown available". Pre-existing in mac-v0.7.3 and mac-v0.7.4.
Root cause: the tooltip read
bar.tokenswhich is always 0 for provider-filtered views (CLI only carries per-provider cost+calls in the daily cache, not tokens). The chart's main metric already fell back to cost correctly via themetricclosure; the tooltip just wasn't reusing that same metric.Fix
BarTooltipCardnow takes avalue: Doubleparameter. Parent passesmetric(hoveredBar)so the tooltip header matches what the chart is rendering.Validator verdict
Fresh-session validator: READY TO SHIP. No must-fix. No regression to the .all-providers view. All edge cases clean.
Test plan
mac-v0.7.5after merge