feat: combine bandwidth and realtime bandwidth into a single row with breakdown#3017
feat: combine bandwidth and realtime bandwidth into a single row with breakdown#3017lohanidamodar wants to merge 5 commits intomainfrom
Conversation
… breakdown Merges the standalone "Realtime bandwidth" row into the "Bandwidth" row. The progress bar now renders two color-coded segments — regular bandwidth and realtime bandwidth — with hover tooltips showing the realtime value.
Greptile SummaryThis PR merges the bandwidth and realtime-bandwidth rows into a single progress-bar row that visually breaks down each metric's share of the quota. The core implementation is clean, but removing the always-visible realtime-bandwidth row means its associated cost (
Confidence Score: 3/5Not safe to merge until realtime bandwidth cost attribution is confirmed or the fallback condition is fixed. One P1 finding: the removal of the always-visible realtime-bandwidth cost row means billing charges can be silently hidden in normal operation. This is capped at 4/5 by the P1, and the direct billing-visibility impact pulls it further to 3/5. src/routes/(console)/organization-[organization]/billing/planSummary.svelte — the fallback condition on line 372. Important Files Changed
Reviews (4): Last reviewed commit: "chore: drop explanatory comments per rep..." | Re-trigger Greptile |
Backend already rolls realtimeBandwidth value + amount into the bandwidth resource, so the previous commit was summing them again (value + amount), inflating both the displayed total and the priced amount, and over-driving the progress bar. Use bandwidth?.value / bandwidth?.amount directly (already include realtime). For the multi-segment progress bar, carve the realtime slice out of the total instead of summing — regular = total - realtime, realtime = realtime — so the segments add to the actual bandwidth total. Same neutral colour family as before, no multi-colour added. Clamps realtime to [0, total] in case of dirty data.
A handful of legacy orgs have realtime bandwidth tracked separately (not yet billed and not added into the bandwidth resource). For them realtimeBytes > totalBytes, which would otherwise overflow the bar or collapse the regular segment to zero. Detect that case and render bandwidth as a single segment instead, preserving today's behaviour for those orgs.
A handful of orgs still have realtime bandwidth tracked outside the bandwidth resource (not billed/rolled in yet). Earlier commit hid their realtime value entirely once the breakdown bar suppressed it. Render a standalone informational Realtime bandwidth row only when realtimeBandwidthValue > bandwidthValue, matching today's pre-merge behaviour for those orgs while keeping the modern path one row.
| ...(realtimeBandwidthValue > bandwidthValue | ||
| ? [ | ||
| createRow({ | ||
| id: 'realtime-bandwidth', | ||
| label: 'Realtime bandwidth', | ||
| resource: realtimeBandwidth, | ||
| usageFormatter: ({ value }) => { | ||
| const size = humanFileSize(value); | ||
| return `${size.value} ${size.unit}`; | ||
| }, | ||
| priceFormatter: ({ amount }) => formatCurrency(amount), | ||
| includeProgress: false | ||
| }) | ||
| ] | ||
| : []), |
There was a problem hiding this comment.
Realtime bandwidth cost silently dropped in normal cases
The fallback row is only inserted when realtimeBandwidthValue > bandwidthValue (a data anomaly). In the common case where realtime bandwidth is a valid, non-zero sub-set of total bandwidth, the row is omitted entirely. If realtimeBandwidth.amount > 0, those charges are no longer attributed in the drill-down — they're absorbed into the project total but never shown as a line item. The original code always rendered this row (with includeProgress: false) so the cost was always visible.
To surface realtime cost when it exists, the condition should gate on realtimeBandwidthValue > 0 instead (or in addition to the anomaly guard).
Summary
Combines the bandwidth and realtime bandwidth usage rows into a single row with a progress-bar breakdown so the two metrics show their relative contribution to the bandwidth quota in one view, rather than as two disconnected rows.
Test plan
🤖 Generated with Claude Code