Skip to content

fix(quota): correct current_interval_usage_count to hold actual usage#69

Open
xandersbell wants to merge 1 commit intoMiniMax-AI:mainfrom
xandersbell:main
Open

fix(quota): correct current_interval_usage_count to hold actual usage#69
xandersbell wants to merge 1 commit intoMiniMax-AI:mainfrom
xandersbell:main

Conversation

@xandersbell
Copy link
Copy Markdown

@xandersbell xandersbell commented Apr 9, 2026

Summary

API fields current_interval_usage_count and current_weekly_usage_count actually hold remaining quota (not usage as the name implies). This caused mmx quota show --output json to expose semantically incorrect data.

Root cause

The upstream API itself returns remaining quota in fields named current_interval_usage_count / current_weekly_usage_count. The ideal fix would be upstream renaming the fields to match their actual semantics.

Why this approach

We evaluated two options:

  1. Add new semantically correct fields (e.g. current_interval_remaining_count): Cleaner semantics but changes the JSON schema, breaking any downstream consumers that depend on exact field names.
  2. Fix existing field values in-place: No schema change, no new fields — only corrects the values to match what the field names imply. Respects the original API contract.

We chose option 2.

Changes (no schema change — only fix field values)

src/commands/quota/show.ts

  • --output json: current_interval_usage_count now holds actual usage (total - original_value). Same for weekly fields.
  • --quiet: Uses fixed values for correct used/remaining display.
  • Table rendering already correct — no changes needed.

test/commands/quota/show.test.ts: 5 test cases covering all output modes.

Closes #68

API fields current_interval_usage_count and current_weekly_usage_count actually
hold remaining quota (not usage as the name implies). This caused --output json
to expose semantically incorrect data.

Changes (no schema change — only fix field values):
- --output json: usage_count now holds actual usage (total - original_value)
- --quiet: correct used/remaining computation using fixed values
- table rendering already correct (was treating usage_count as remaining)

Closes MiniMax-AI#68
@xandersbell xandersbell changed the title fix(quota): treat usage_count fields as remaining quota in JSON output fix(quota): correct current_interval_usage_count to hold actual usage Apr 9, 2026
@xandersbell xandersbell closed this Apr 9, 2026
@xandersbell xandersbell reopened this Apr 9, 2026
@xandersbell
Copy link
Copy Markdown
Author

Commit history note

Initial version of this PR introduced new fields (current_interval_remaining_count, current_weekly_remaining_count) to carry the semantically correct values alongside the original fields.

After discussion we reverted to fixing only the existing field values in-place — no new fields, no schema change. This approach respects the original API contract and avoids breaking any downstream consumers that may depend on the exact field names.

@xandersbell
Copy link
Copy Markdown
Author

Note: The root cause is upstream — the API itself returns remaining quota in fields named current_interval_usage_count / current_weekly_usage_count. This CLI fix is a compensating correction since the API layer cannot be modified. The ideal fix would be upstream renaming the fields to match their actual semantics.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: quota --output json field current_interval_usage_count shows remaining quota, not usage

1 participant