Skip to content

feat: combine bandwidth and realtime bandwidth into a single row with breakdown#3017

Open
lohanidamodar wants to merge 5 commits intomainfrom
claude/bandwidth-progress-bar-breakdown-D4fej
Open

feat: combine bandwidth and realtime bandwidth into a single row with breakdown#3017
lohanidamodar wants to merge 5 commits intomainfrom
claude/bandwidth-progress-bar-breakdown-D4fej

Conversation

@lohanidamodar
Copy link
Copy Markdown
Member

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

  • Open Organization Billing → Usage and verify the bandwidth row now shows a single progress bar with realtime bandwidth visually distinguished as part of the total
  • Hover / inspect to confirm both numeric values are still surfaced
  • Confirm projects with zero realtime bandwidth still render correctly (no empty segment)

🤖 Generated with Claude Code

… 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-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 3, 2026

Greptile Summary

This 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 (realtimeBandwidth.amount) is no longer shown as a line item in normal usage — only the bandwidth.amount appears in the price column, so users cannot trace realtime charges in the breakdown.

  • The standalone realtime-bandwidth row is now only rendered in the anomalous case (realtimeBandwidthValue > bandwidthValue); any non-zero realtime cost in normal scenarios is silently omitted from the visible drill-down.

Confidence Score: 3/5

Not 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

Filename Overview
src/routes/(console)/organization-[organization]/billing/planSummary.svelte Introduces createBandwidthProgressData for a segmented progress bar combining regular and realtime bandwidth; removes the always-visible realtime-bandwidth row, which may hide realtime bandwidth costs when they are non-zero.

Reviews (4): Last reviewed commit: "chore: drop explanatory comments per rep..." | Re-trigger Greptile

Comment thread src/routes/(console)/organization-[organization]/billing/planSummary.svelte Outdated
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.
Comment on lines +372 to +386
...(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
})
]
: []),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants