Skip to content

fix(users): 用户列表额度列改回钱包口径 - #120

Merged
mergify[bot] merged 1 commit into
suanova:mainfrom
skeeey:fix/users-list-wallet-quota
Sep 28, 2026
Merged

mergify[bot] merged 1 commit into
suanova:mainfrom
skeeey:fix/users-list-wallet-quota

Conversation

@skeeey

@skeeey skeeey commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

#110 把「剩余额度/总额度」列的口径从钱包额度换成了有效订阅 token
额度,且没有回退:UserQuotaCell 在订阅总额与已用均为 0 时渲染「无余额」,
而 FillUsersSubscriptionQuotaStats 只统计 status=active 且未过期的 user_subscriptions。钱包/组织计费、没有订阅数据的站点因此整列恒显示
「无余额」(例如 root 钱包 99962113/37887 也显示无余额)。

改回钱包口径:remaining = quota,total = quota + used_quota,total 为 0 时才显示「无余额」;订阅信息继续由同页「订阅余额」列展示。

  • user-quota-cell: 恢复 used/remaining props,去掉 total/unlimited
  • users-columns / ops-users-table: 传 used_quota/quota, ops 列 accessorKey 由 subscription_remain_quota 改回 quota
  • 新增 quota-column 回归测试:无订阅用户按钱包渲染、有订阅时仍按钱包 口径、全 0 时才显示无余额

Summary by CodeRabbit

  • Updates
    • User tables now show wallet quota as the remaining amount and usage, regardless of subscription status. Subscription balances remain available in their separate column.
    • Quota displays now use numeric values instead of “Unlimited.” A “No Quota” badge appears when both used and remaining wallet quota are zero.

suanova#110 把「剩余额度/总额度」列的口径从钱包额度换成了有效订阅 token
额度,且没有回退:UserQuotaCell 在订阅总额与已用均为 0 时渲染「无余额」,
而 FillUsersSubscriptionQuotaStats 只统计 status=active 且未过期的
user_subscriptions。钱包/组织计费、没有订阅数据的站点因此整列恒显示
「无余额」(例如 root 钱包 99962113/37887 也显示无余额)。

改回钱包口径:remaining = quota,total = quota + used_quota,total 为 0
时才显示「无余额」;订阅信息继续由同页「订阅余额」列展示。

- user-quota-cell: 恢复 used/remaining props,去掉 total/unlimited
- users-columns / ops-users-table: 传 used_quota/quota,
  ops 列 accessorKey 由 subscription_remain_quota 改回 quota
- 新增 quota-column 回归测试:无订阅用户按钱包渲染、有订阅时仍按钱包
  口径、全 0 时才显示无余额

Co-Authored-By: Claude Code <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: suanova/cuberouter/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 77d931c2-06d0-45e2-99fd-dcc29ff60e0f

📥 Commits

Reviewing files that changed from the base of the PR and between 87bb415 and e03f0d9.

📒 Files selected for processing (4)
  • web/src/features/ops-users/components/ops-users-table.tsx
  • web/src/features/users/components/__tests__/quota-column.test.tsx
  • web/src/features/users/components/user-quota-cell.tsx
  • web/src/features/users/components/users-columns.tsx

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The quota cell now derives its total from wallet usage and remaining quota. Both user tables pass wallet values to the cell. Tests verify the users table’s quota display with and without a subscription, and when the wallet total is zero.

Changes

Wallet quota display

Layer / File(s) Summary
Derive quota display from wallet values
web/src/features/users/components/user-quota-cell.tsx
The cell derives total quota from used and remaining values. It calculates the remaining percentage from that total, shows “No Quota” when the total is zero, and formats remaining quota numerically.
Pass wallet quota values to table cells
web/src/features/users/components/users-columns.tsx, web/src/features/ops-users/components/ops-users-table.tsx, web/src/features/users/components/__tests__/quota-column.test.tsx
Both table columns pass wallet usage and remaining quota to the cell. Tests cover display with and without a subscription, and when wallet usage and remaining quota are both zero.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: clyang82

Merge Risk: ⚪ Minimal · up to e03f0

The quota column displays wallet balances as intended. No identified issue blocks merging after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: restoring the users-list quota column to use wallet-based values.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mergify
mergify Bot merged commit 58cf0e2 into suanova:main Sep 28, 2026
7 checks passed
@mergify

mergify Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@skeeey
skeeey deleted the fix/users-list-wallet-quota branch October 16, 2026 14:10
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.

2 participants