Skip to content

[Bug] mmx quota field naming is confusing: current_interval_usage_count actually means remaining, not usage #91

@atop0914

Description

@atop0914

Bug Description

The field current_interval_usage_count in the quota API response is misleadingly named — it actually represents the remaining quota for the current interval, not the usage.

In dist/mmx.mjs line 117, the code shows:

let{current_interval_usage_count:_, current_interval_total_count:S}=w
k = Math.max(0, S - _)  // k = used
yt = `${k.toLocaleString()} / ${S.toLocaleString()}`  // displays "used / total"

The display logic calculates used = total - usage_count, which means usage_count is actually remaining quota. The variable naming is confusing and leads to misinterpretation.

Expected Behavior

Field names should match their values:

  • current_interval_usage_count should be renamed to current_interval_remaining_count (or similar)
  • Or at minimum, add comments explaining the counterintuitive naming

Additional Inconsistency

The weekly fields use the opposite convention:

  • current_weekly_usage_count = actually means usage (used)
  • current_weekly_total_count = total
  • A = M - Q where A = remaining, M = total, Q = usage

This makes the API very confusing to parse.

Impact

Anyone reading the API response or source code will assume usage_count means "usage" (how much has been used), when it actually means "remaining". This has caused confusion in multiple contexts.

Suggested Fix

  1. Rename current_interval_usage_count to current_interval_remaining_count in the source
  2. Add JSDoc comments explaining the field meanings
  3. Alternatively, add a comment in the quota display code explaining the counterintuitive naming

Environment: N/A
CLI Version: (latest)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions