Skip to content

fix(keys): restore auto group badge and guard cross-group badge - #6809

Open
zkasuran wants to merge 1 commit into
QuantumNous:mainfrom
zkasuran:fix/autogroup-badge-6804
Open

fix(keys): restore auto group badge and guard cross-group badge#6809
zkasuran wants to merge 1 commit into
QuantumNous:mainfrom
zkasuran:fix/autogroup-badge-6804

Conversation

@zkasuran

@zkasuran zkasuran commented Aug 13, 2026

Copy link
Copy Markdown

⚠️ 提交说明 / PR Notice

Important

  • 请提供人工撰写的简洁摘要,避免直接粘贴未经整理的 AI 输出。

📝 变更描述 / Description

The Group column cell for auto keys on /keys was showing the Cross-group
badge on every auto key and no longer showing the badge that marks the key as
auto. A previous "temporarily disable AutoGroupBadge" refactor commented out
<AutoGroupBadge /> and, in the same hunk, dropped the crossGroupRetry guard
around the Cross-group badge, so the badge stopped reflecting each key's
cross_group_retry state and auto keys with no ratio data ended up with an
empty-looking group cell.

This restores the two removed lines in api-key-group-cell.tsx: it renders
AutoGroupBadge again and wraps the Cross-group StatusBadge in
{props.crossGroupRetry && ...}. crossGroupRetry was already declared on the
props and passed from api-keys-columns.tsx, it just was not read. This matches
the per-token backend semantics (Token.CrossGroupRetry, read in
service/channel_select.go, forced false for non-auto groups in
controller/token.go) and turns the component's own committed test file green
(it asserts two Auto frames when a ratio is present and one when it is not, plus
that Cross-group only appears with the flag on). Scope is this one cell.

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix) - 请关联对应 Issue,避免将设计取舍、理解偏差或预期不一致直接归类为 bug
  • ✨ 新功能 (New feature) - 重大特性建议先通过 Issue 沟通
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 非重复提交: 我已搜索现有的 IssuesPRs,确认不是重复提交。
  • Bug fix 说明: 若此 PR 标记为 Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。
  • 变更理解: 我已理解这些更改的工作原理及可能影响。
  • 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核结果。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

Ran from web/:

# component's own committed test, in isolation, AFTER the fix
$ bun test src/features/keys/components/__tests__/api-key-group-cell.test.tsx
 4 pass
 0 fail
Ran 4 tests across 1 file.

# same test BEFORE the fix (the regression this PR restores)
 1 pass
 3 fail   # lines 130, 167, 189 (the three failures CI reports on main)

$ bun run typecheck      # tsgo -b
(exit 0, no diagnostics)

$ bun run build          # rsbuild build
(exit 0, bundle emitted)

$ bunx oxlint -c .oxlintrc.json src/features/keys/components/api-key-group-cell.tsx
(exit 0, no warnings)

AI assistance (Claude) was used to write this change. The author, who is not
one of this repository's historical core developers, reviewed and verified it
locally before submitting. Verified in web/: bun run typecheck is clean,
bun run build succeeds, the component's committed test
api-key-group-cell.test.tsx goes from 3 failing to 4 passing (run in
isolation), matching the three failures the frontend CI gate reports on main.

Summary by CodeRabbit

  • Bug Fixes
    • Corrected group status badges to accurately reflect automatic grouping.
    • The “Cross-group” badge now appears only when cross-group retry is enabled.
    • Automatic groups now display their appropriate badge.

The auto group cell rendered the Cross-group badge unconditionally and
left AutoGroupBadge commented out, so auto keys lost their group badge
and every auto key claimed cross-group retry. Re-enable AutoGroupBadge
and gate the Cross-group badge on the per-key crossGroupRetry flag,
matching the backend semantics and the cell's committed test.

Closes QuantumNous#6804
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0c1e1b84-bdae-49ca-bb62-6a78114722c9

📥 Commits

Reviewing files that changed from the base of the PR and between ccd535e and 0229cd4.

📒 Files selected for processing (1)
  • web/src/features/keys/components/api-key-group-cell.tsx

Walkthrough

The API key group cell now renders AutoGroupBadge for automatic groups and displays the “Cross-group” badge only when crossGroupRetry is enabled.

Changes

API key group badge rendering

Layer / File(s) Summary
Group badge rendering
web/src/features/keys/components/api-key-group-cell.tsx
The cell enables AutoGroupBadge and conditionally renders the “Cross-group” badge based on crossGroupRetry.

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

Mergeability Score: ⚪ Minimal · up to 0229c

This restores the correct badges for auto keys and gates the Cross-group badge by its state, with no actionable merge-blocking risk remaining after normal checks and review.

Possibly related PRs

  • QuantumNous/new-api#6590: Both changes update automatic-group and cross-group badge rendering in api-key-group-cell.tsx.

Suggested reviewers: calcium-ion

Poem

A rabbit hops through keys so bright,
An auto badge returns to sight.
Cross-group waits for retry true,
With motion smooth and spacing neat too.
“The group cell now tells what’s due!”

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Linked Issues check ❓ Inconclusive The summary confirms the two primary badge fixes, but it does not verify layout, animation, overflow, ratio fallback, or test requirements from issue #6804. Provide diff or test evidence that confirms ratio-unavailable rendering, animated behavior, overflow-visible, three-badge layout, and the required component tests.
✅ 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 restoring the auto-group badge and conditionally rendering the cross-group badge.
Out of Scope Changes check ✅ Passed The changes are limited to the specified frontend component and directly address the badge-rendering requirements in issue #6804.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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] Auto-group API keys: group badge missing and "Cross-group" badge rendered unconditionally

1 participant