Skip to content

chore: update byte units on frontend#4444

Open
MasterPtato wants to merge 1 commit into03-17-fix_runner_alloc_idx_logic_api_auth_for_actor_getfrom
03-17-chore_update_byte_units_on_frontend
Open

chore: update byte units on frontend#4444
MasterPtato wants to merge 1 commit into03-17-fix_runner_alloc_idx_logic_api_auth_for_actor_getfrom
03-17-chore_update_byte_units_on_frontend

Conversation

@MasterPtato
Copy link
Contributor

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@railway-app
Copy link

railway-app bot commented Mar 17, 2026

🚅 Deployed to the rivet-pr-4444 environment in rivet-frontend

Service Status Web Updated (UTC)
frontend-cloud 😴 Sleeping (View Logs) Web Mar 23, 2026 at 1:56 pm
frontend-inspector 😴 Sleeping (View Logs) Web Mar 19, 2026 at 12:05 pm
ladle ❌ Build Failed (View Logs) Web Mar 17, 2026 at 7:43 pm
website ❌ Build Failed (View Logs) Web Mar 17, 2026 at 7:41 pm
mcp-hub ✅ Success (View Logs) Web Mar 17, 2026 at 7:39 pm

Copy link
Contributor Author

MasterPtato commented Mar 17, 2026

@claude
Copy link

claude bot commented Mar 17, 2026

Code Review: PR 4444

Summary

This PR corrects byte unit terminology throughout the billing frontend, changing SI prefixes (KB, MB, GB, TB) to IEC binary prefixes (KiB, MiB, GiB, TiB). The change is correct because the actual computation was already using powers of 1024, so the labels were misleading. The PR also refactors billing.ts to use the bigBytes utility from @/utils/bytes instead of inline BigInt constants.

What Is Good

  • The fix is accurate. The old code used base-1024 arithmetic but labeled results with SI prefix names. The labels now match the math.
  • Replacing local constants in billing.ts with shared bigBytes utility functions improves consistency and removes redundant local definitions.
  • The metrics constants comment now correctly reads 4KiB operation units.
  • Coverage is consistent across all five modified files.

Issues Found

Pre-existing inconsistency surfaced by this PR

In frontend/src/app/billing/usage-card.tsx line 66, the operations case still divides by 4000 (decimal 4 KB) rather than 4096 (binary 4 KiB). Meanwhile, billing.ts now calculates plan limits using bigBytes.KiB(4n) and constants.ts uses bytes.KiB(4), both resolving to 4096. This 4000 creates a ~2.4% discrepancy in operation count display. Suggested fix: use bytes.KiB(4) from @/utils/bytes.

Numerical impact of the unit change

This PR changes actual threshold values in billing.ts from powers of 1000 to powers of 1024. For example, 5 GB (5,000,000,000 bytes) became 5 GiB (5,368,709,120 bytes), a ~7.4% increase in actual byte quota. Confirm this is intentional and matches what the backend enforces.

Minor Notes

  • The change is purely frontend and does not touch any Rust, API contracts, or runner protocols, so there are no concerns around breaking changes to published schemas.
  • No new dependencies are introduced; bigBytes already existed in the codebase.
  • The import of bigBytes is added correctly at the top of billing.ts.
  • All five files are consistently updated with no missed occurrences.

Verdict

The PR is clean and correct in its intent. Before merging: (1) clarify and fix the division by 4000 vs 4096 inconsistency in usage-card.tsx, and (2) confirm the ~7.4% quota increase from switching to binary GiB is intentional.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 17, 2026

More templates

@rivetkit/cloudflare-workers

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/cloudflare-workers@4444

@rivetkit/framework-base

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/framework-base@4444

@rivetkit/next-js

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/next-js@4444

@rivetkit/react

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/react@4444

rivetkit

pnpm add https://pkg.pr.new/rivet-dev/rivet/rivetkit@4444

@rivetkit/sql-loader

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/sql-loader@4444

@rivetkit/sqlite-vfs

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/sqlite-vfs@4444

@rivetkit/traces

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/traces@4444

@rivetkit/workflow-engine

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/workflow-engine@4444

@rivetkit/virtual-websocket

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/virtual-websocket@4444

@rivetkit/engine-runner

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/engine-runner@4444

@rivetkit/engine-runner-protocol

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/engine-runner-protocol@4444

commit: 88d15c3

@MasterPtato MasterPtato force-pushed the 03-17-chore_update_byte_units_on_frontend branch from f1b6d0a to d4011f0 Compare March 17, 2026 20:38
@MasterPtato MasterPtato force-pushed the 03-17-fix_runner_alloc_idx_logic_api_auth_for_actor_get branch from 5b2bead to cfc4fad Compare March 17, 2026 20:38
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4444 March 17, 2026 20:38 Destroyed
@MasterPtato MasterPtato force-pushed the 03-17-chore_update_byte_units_on_frontend branch from d4011f0 to 3b845cb Compare March 18, 2026 22:12
@MasterPtato MasterPtato force-pushed the 03-17-fix_runner_alloc_idx_logic_api_auth_for_actor_get branch from cfc4fad to 65280b5 Compare March 18, 2026 22:12
@MasterPtato MasterPtato force-pushed the 03-17-fix_runner_alloc_idx_logic_api_auth_for_actor_get branch from 65280b5 to 84dbf32 Compare March 21, 2026 01:55
@MasterPtato MasterPtato force-pushed the 03-17-chore_update_byte_units_on_frontend branch from 3b845cb to 1028b2c Compare March 21, 2026 01:55
@MasterPtato MasterPtato force-pushed the 03-17-fix_runner_alloc_idx_logic_api_auth_for_actor_get branch from 84dbf32 to 90c2e97 Compare March 24, 2026 00:30
@MasterPtato MasterPtato force-pushed the 03-17-chore_update_byte_units_on_frontend branch from 1028b2c to 88d15c3 Compare March 24, 2026 00:30
@MasterPtato MasterPtato mentioned this pull request Mar 24, 2026
11 tasks
@MasterPtato MasterPtato force-pushed the 03-17-chore_update_byte_units_on_frontend branch from 88d15c3 to ede07de Compare March 24, 2026 00:36
@MasterPtato MasterPtato force-pushed the 03-17-fix_runner_alloc_idx_logic_api_auth_for_actor_get branch from 90c2e97 to ebdaa13 Compare March 24, 2026 00:36
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.

1 participant