Skip to content

Preserve decimal precision for WorkBuddy quota aggregation #8324

Closed

Description

@lidge-jun

Area

Multiple areas

What are you trying to accomplish?

Display WorkBuddy's aggregated credit percentage accurately when package balances lie extremely close to a whole-percent rounding boundary.

What prevents this today?

WorkBuddy package values are aggregated and exposed as JavaScript numbers. Converting an aggregate to a number can erase a decimal distinction immediately below a half-percent boundary. The dashboard's indicator is informational and uses neutral severity, but the displayed rounded value can differ by one percentage point at such a boundary.

What should OpenCodex do?

Preserve enough precision through provider aggregation, quota transport and dashboard normalization to distinguish exact ties from values just below them. Keep existing numeric DTO fields compatible, validate bounded input, and avoid using this informational balance for routing or account eligibility.

Example usage or interface

For two packages with totals 0.5 and 0.5, and remaining values 0.4975 and 0.49750000000000005, the exact remaining sum is 0.99500000000000005. The unavailable share is just under 0.5% and should display 0%; an exact 0.995 remaining balance is a tie and should display 1%.

Alternatives or workarounds

The current numeric projection is sufficient for ordinary balances and does not affect routing. A bounded optional pair of exact decimal strings for total and remaining could accompany the existing numeric fields; preserve older numeric-only responses and reject malformed or inconsistent exact metadata.

Additional context

Follow-up to #8131 and PR #8323. Consider whether exact values are needed for used, frozen and group totals as well, including enterprise fallback and subnormal values. Ordinary JSON.parse can already lose the original precision of an unquoted numeric token, so a design claiming exact input preservation must account for the parsing boundary; quoted decimal values can retain their text. Bound digit count, scale, exponent, package and group counts before arbitrary-precision arithmetic, and test DTO/cache round trips, malformed values and below-half/tie/over-total cases.

Checks

  • I searched existing issues and documentation.
  • This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
  • I removed secrets and personal data.

Activity

  1. added
    enhancement
    on Nov 8, 2026
  2. added
    account-pool
    on Nov 8, 2026
  3. coderabbitai commented on Nov 8, 2026

    @coderabbitai
    Contributor
    🔗 Related PRs

    #7604 - feat(workbuddy): add subscription and credit support [open]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  4. shu-chen-dot-ca commented on Nov 9, 2026

    @shu-chen-dot-ca
    Contributor

    I'm taking this one on.

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

    account-poolenhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions