fix(billing): extend quantity validation and saturating conversions to remaining paths

Bound max-tokens fields across all relay format validators, saturate
tiered-expression rounding and audio/tool/task token conversions, and
route legacy remix ratios through the guarded setter.
This commit is contained in:
CaIon
2026-07-07 01:08:52 +08:00
parent d0bd8aac74
commit c9943d37ad
13 changed files with 155 additions and 30 deletions
+6
View File
@@ -291,6 +291,12 @@ func TestQuotaRound(t *testing.T) {
{999.4999, 999},
{999.5, 1000},
{1e9 + 0.5, 1e9 + 1},
// Oversized expression results must saturate at int32 bounds
// instead of wrapping into a negative charge.
{3.6893488147419103e19, math.MaxInt32},
{-3.6893488147419103e19, math.MinInt32},
{math.Inf(1), math.MaxInt32},
{math.NaN(), 0},
}
for _, tt := range tests {
got := billingexpr.QuotaRound(tt.in)