Uh oh!
There was an error while loading. Please reload this page.
Diagnostics: fix the empty daily-cost chart - #413
Draft
alex-clickhouse wants to merge 1 commit into
Draft
Conversation
The "Daily cost" chart rendered as bare date labels with no bars.
Each bar carries style={{ height: `${heightPct}%` }}, but its parent
column was a flex item in an `items-end` row, so the column's cross
size was content-based. A percentage height against an auto-height
containing block resolves to `auto`, and the bar has no content of its
own, so every bar computed to 0px -- including the tallest one, which
asks for 100%.
The column is now h-full, and the bar sits in a `flex-1 min-h-0` track
that takes the space left over after the date label. The percentage
resolves against that track, so the chart keeps its 80px total height
and the labels stay put.
Measured in Chromium against the built app and the real /api/diagnostics
response (8 days): bars were 0px across the board, and are now 1.6-64.5px
in proportion to cost. The hover tooltip still shows on the bar.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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 freeto 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.
The Diagnostics page renders "Daily cost" as a row of bare date labels with no bars. Flagged as known-but-unexplained in #411; this is the explanation and the fix.
Root cause
Frontend only. The backend is healthy —
/api/diagnosticsreturns 8 daily rows with realcost_usd, andget_usage_by_periodalready emits exactly thedate/cost_usdshape the chart reads.Each bar carries
style={{ height: `${heightPct}%` }}. Its parent column was a flex item in anitems-endrow, so the column's cross size is content-based — it measured 15.5px, the height of the date label alone. A percentage height against an auto-height containing block resolves toauto, and the bar has no content of its own, so every bar computed to 0px — including the tallest, which asks for100%.Measured in Chromium against the built app and the real API response:
Fix
The column gets
h-full, and the bar moves into aflex-1 w-full flex items-end min-h-0track that takes the space left over after the date label. The percentage now resolves against that track.The chart keeps its 80px total height, the labels stay where they were, and a 100% bar exactly fills the track rather than overflowing — verified as 0px overflow, top and bottom.
Verification
dist/with/api/*reverse-proxied to a live Nerve instance, so the numbers above come from the actual component against the actual endpoint.mainbuild to produce the before column.744.9K · $128.63on the 08-19 bar, matching that DB row exactly.npm run build(tsc + vite) passes.25 failed, 3256 passed, 25 errors— byte-identical with and without this change (verified by stashing). All of it is a local env gap: 49 ×ModuleNotFoundError: No module named 'mcp.server.context', unrelated to this diff.no-explicit-anyon lines this PR does not touch.Notes
DiagnosticsPage.tsx, so this branches offmainand the two do not conflict. The change uses stock layout utilities only, so it holds under either token set.rg items-endfinds three hits; the other two areflex-wraptoolbars), so there is no sibling instance of the bug to fix.vite.config.tssetstest.css: falseand jsdom does not do layout, so this class of bug is invisible to the unit suite. A class-list assertion would pin the markup without testing the behaviour. The browser measurement above is the regression evidence.🤖 Generated with Claude Code