Skip to content

Extra usage widgets use wrong unit assumptions for usage API response #387

Closed

Description

@roribio

Summary

The ExtraUsageRemaining and ExtraUsageUtilization widgets make incorrect unit assumptions about fields returned by the usage API, producing wrong displayed values for pay-as-you-go users.

Details

In src/widgets/ExtraUsageRemaining.ts:

  • The code assumes extraUsageLimit is in cents but extraUsageUsed is in dollars.
  • In practice, both fields are in cents. The current math subtracts a cents value from a dollars value, producing a wildly inflated "remaining" amount.

In src/widgets/ExtraUsageUtilization.ts:

  • The code multiplies extraUsageUtilization by 100, assuming it's a fraction (0–1).
  • In practice, extraUsageUtilization is already a percentage (0–100). Multiplying by 100 produces values that get clamped to 100% almost immediately.

Expected behavior

  • "Overage Left" should reflect the true remaining overage budget in dollars.
  • "Overage Utilization" should reflect the actual percentage reported by the API.

Fix

PR incoming that divides extraUsageUsed by 100 before subtracting, and removes the * 100 on extraUsageUtilization.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions