Repository navigation
Conversation
quantityToScalar passed mantissas such as 1.5Gi straight to BigInt, which rejects fractions. Decimal scaling now matches Quantity.Value() and leaves integer results unchanged.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: eisen0419 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @eisen0419! |
Fixes #3152
Summary
quantityToScalarpassed mantissas fork..EandKi..Eidirectly toBigInt(...), throwingSyntaxError: Cannot convert <x> to a BigInton fractional quantities such as1.5Gi,0.5Mi,0.1k, or2.5G. Parse decimal mantissas with exactBigIntscaling and round non-zero remainders away from zero to match Kubernetesresource.Quantity.Value().quantityToScalar(quantity) suffix in ['', 'n', 'u', 'm'] -> Number scaling (unchanged, rejects NaN) suffix in ['k'..'E', 'Ki'..'Ei'] - BigInt(mantissa) * multiplier + parseDecimal(mantissa) -> significand * multiplier * 10^(exp - fracDigits) + round non-zero remainder away from zero (matches Quantity.Value() / inf.RoundUp)Evidence
Merge Danger
Door: two-way
Self-contained parser update in
src/util.ts(src/gen/untouched); integer SI quantities andn/u/m/barenumberreturn types are unchanged.Blast Radius: narrow
Scoped to
quantityToScalarand its resource helper callers (totalMemory,totalCPU,topPods,topNodes).