fix(quota): render weekly boost (150%) and unlimited (status=3) quota#177
Merged
Conversation
The /v1/token_plan/remains endpoint returns two signals the renderer
ignored:
- weekly_boost_permille (千分制, e.g. 1500 ⇒ ×1.5 ⇒ display up to 150%)
- current_weekly_status === 3 ⇒ weekly quota is unlimited
Previously, the weekly row always used the raw remaining percent, so
a 1.5x boost plan showed 100% instead of 150%, and an unlimited plan
was visually indistinguishable from a normal 100% account.
Changes:
- api.ts: add weekly_boost_permille?, current_interval_status?,
current_weekly_status? to QuotaModelRemain
- quota-table.ts: multiply weekly percent by boost_permille/1000,
render '无限' / 'unlimited' for status=3, raise display ceiling to
200% to accommodate boosted values
- quota-table.test.ts: cover 150% boost, 200% clamp, unlimited CN/EN
Review: render weekly boost (150%) and unlimited (status=3) quotaPR #177 — Adds rendering of Checks
Changes by file
Observations (non-blocking)
Verdict✅ Approve — all required checks green, smoke test passes, code is clean. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two rendering bugs in
mmx quota showagainst the/v1/token_plan/remainsendpoint.The endpoint exposes signals the renderer previously ignored:
weekly_boost_permille(千分制, e.g.1500⇒ ×1.5 ⇒ display up to 150%)current_weekly_status === 3⇒ weekly quota is unlimitedBefore:
周剩余 [██████████] 100%instead of150%100%, visually identical to a normal 100% accountAfter:
周剩余 [██████████] 150%for boost plans周剩余 [██████████] 无限/Wk left [██████████] unlimitedfor status=3 plans (CN/EN region aware)Changes
src/types/api.ts: addweekly_boost_permille?,current_interval_status?,current_weekly_status?toQuotaModelRemainsrc/output/quota-table.ts: multiply weekly percent byboost_permille/1000; render "无限"/"unlimited" forstatus=3; raiseMAX_DISPLAY_PCTto 200 to accommodate boosted valuestest/output/quota-table.test.ts: cover 150% boost, 200% clamp, unlimited (CN + EN)Verification
bun test test/output/quota-table.test.ts→ 6/6 passbunx tsc --noEmit→ cleanbun run build→dist/mmx.mjs150KB,dist/sdk.mjs53KB周剩余 [██████████] 150%周剩余 [██████████] 无限