fix(billing): surface quota saturation events for admin auditing
Thread int32 saturation clamps from tiered settlement and video task recompute into the consume/task logs under admin_info, so oversized or malformed billing inputs stay auditable. Clamp negative audio duration before token conversion and gate the saturation UI markers on admin.
This commit is contained in:
@@ -3,6 +3,8 @@ package billingexpr
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
|
||||
"github.com/QuantumNous/new-api/common"
|
||||
)
|
||||
|
||||
type RequestInput struct {
|
||||
@@ -57,6 +59,11 @@ type TieredResult struct {
|
||||
ActualQuotaAfterGroup int `json:"actual_quota_after_group"`
|
||||
MatchedTier string `json:"matched_tier"`
|
||||
CrossedTier bool `json:"crossed_tier"`
|
||||
// Clamp records an int32 saturation event during quota conversion so the
|
||||
// caller can surface it on the consume log for admin auditing. Nil when no
|
||||
// clamping occurred. Not serialized: the marker is attached separately via
|
||||
// the shared quota-saturation audit path.
|
||||
Clamp *common.QuotaClamp `json:"-"`
|
||||
}
|
||||
|
||||
// ExprHashString returns the SHA-256 hex digest of an expression string.
|
||||
|
||||
Reference in New Issue
Block a user