Skip to content

fix: clarify affinity disabled channel retry message - #4453

Merged
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
seefs001:fix/affinity-disabled-retry-message
Apr 26, 2026
Merged

fix: clarify affinity disabled channel retry message#4453
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
seefs001:fix/affinity-disabled-retry-message

Conversation

@seefs001

@seefs001 seefs001 commented Apr 25, 2026

Copy link
Copy Markdown
Collaborator

⚠️ 提交说明 / PR Notice

Important

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

📝 变更描述 / Description

(简述:做了什么?为什么这样改能生效?请基于你对代码逻辑的理解来写,避免粘贴未经整理的内容)

修改渠道亲和性命中的渠道被禁用的提示文案
“渠道亲和性命中的渠道已被禁用,已按规则停止重试,请联系管理员处理“

🚀 变更类型 / Type of change

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

🔗 关联任务 / Related Issue

  • Closes # (如有)

✅ 提交前检查项 / Checklist

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

📸 运行证明 / Proof of Work

(请在此粘贴截图、关键日志或测试报告,以证明变更生效)

Summary by CodeRabbit

  • Bug Fixes
    • Improved error messaging when a preferred channel becomes disabled, with translations in English, Simplified Chinese, and Traditional Chinese.

@coderabbitai

coderabbitai Bot commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

This PR adds a new i18n message key MsgDistributorAffinityChannelDisabled to provide a specific error message when a channel selected via affinity is disabled. The constant is added to the keys file, translated into three languages, and the distributor middleware is updated to use this more specific message.

Changes

Cohort / File(s) Summary
I18n Constants
i18n/keys.go
Added new exported constant MsgDistributorAffinityChannelDisabled with value "distributor.affinity_channel_disabled".
I18n Locale Translations
i18n/locales/en.yaml, i18n/locales/zh-CN.yaml, i18n/locales/zh-TW.yaml
Added translations for distributor.affinity_channel_disabled key in English, Simplified Chinese, and Traditional Chinese locales, providing user-facing error messages for the affinity channel disabled scenario.
Distributor Middleware
middleware/distributor.go
Updated forbidden error response to use the new specific i18n key MsgDistributorAffinityChannelDisabled instead of the generic MsgDistributorChannelDisabled.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A message most specific, for channels affinity-bound,
When disabled they become, no retry is found—
Three tongues now speak the truth,
With grace and careful proof! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. 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: updating the error message for when a channel selected by affinity is disabled to be more specific and user-friendly.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
i18n/locales/en.yaml (1)

260-260: Optional: minor phrasing polish.

"retry was stopped by rule" reads awkwardly in English. Consider a more idiomatic phrasing such as "retries have been halted per policy" to better match the Chinese source ("已按规则停止重试").

✏️ Proposed wording
-distributor.affinity_channel_disabled: "The channel selected by channel affinity has been disabled, and retry was stopped by rule. Please contact the administrator"
+distributor.affinity_channel_disabled: "The channel selected by channel affinity has been disabled; retries have been halted per policy. Please contact the administrator."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@i18n/locales/en.yaml` at line 260, Update the translation value for the key
distributor.affinity_channel_disabled to use more idiomatic English; replace
"retry was stopped by rule" with phrasing like "retries have been halted per
policy" so the full message reads: "The channel selected by channel affinity has
been disabled, and retries have been halted per policy. Please contact the
administrator" — locate the key distributor.affinity_channel_disabled in en.yaml
and update its string accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@i18n/locales/en.yaml`:
- Line 260: Update the translation value for the key
distributor.affinity_channel_disabled to use more idiomatic English; replace
"retry was stopped by rule" with phrasing like "retries have been halted per
policy" so the full message reads: "The channel selected by channel affinity has
been disabled, and retries have been halted per policy. Please contact the
administrator" — locate the key distributor.affinity_channel_disabled in en.yaml
and update its string accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4e18f30b-c343-4195-bcc5-7dbf3110d0f4

📥 Commits

Reviewing files that changed from the base of the PR and between f2f3410 and 3553072.

📒 Files selected for processing (5)
  • i18n/keys.go
  • i18n/locales/en.yaml
  • i18n/locales/zh-CN.yaml
  • i18n/locales/zh-TW.yaml
  • middleware/distributor.go

@Calcium-Ion
Calcium-Ion merged commit 097a50e into QuantumNous:main Apr 26, 2026
2 checks passed
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