Conversation
The costs endpoint answers in full float precision, so two cents arrives as 0.01999999999999999872 and taking the first two decimal digits made it one. That put the metric charges a cent under the invoice and left the usage column unable to add up to the headline it sits beneath. Invoice fields are already given to two decimals, so this only moves the per-metric charges — the one caller reading a full-precision figure. All ten live pay-as-you-go accounts now reconcile: metric charges plus the minimum row equal the amount due, exactly.
macko911
force-pushed
the
matej/orb-amount-rounding
branch
from
September 14, 2026 13:09
1c58403 to
5003797
Compare
macko911
marked this pull request as ready for review
September 14, 2026 13:17
ErickRDev
approved these changes
Sep 14, 2026
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.
Context
orbAmountToCentsreads money off Orb's decimal strings by taking the first two digits after the point. Invoice fields arrive already rounded to two decimals, so that was fine there.The costs endpoint is not. It answers in full float precision, where two cents arrives as
0.01999999999999999872— and dropping the extra digits makes that one cent. That endpoint feeds the per-metric Charges column on the billing page, which every customer has seen since #7364. So affected accounts are shown a cent less than Orb bills them.Changes
Number(x) * 100.0.999is a dollar rather than 99 cents.Testing
Covers the real Orb value that exposed this (
0.01999999999999999872→ 2 cents), the half-up boundary either side (19.994/19.995), and the carries0.999and1.999.Checked against live Orb for all ten pay-as-you-go accounts. Six showed a connections charge a cent below the matching invoice line; all ten agree after the fix. To see it on the billing page, open Usage for an account whose usage lands near a cent boundary and compare the Charges column against the Orb invoice.