Skip to content

增加定时测试排除渠道 ID 配置 - #4269

Closed
uskyu wants to merge 1 commit into
QuantumNous:mainfrom
uskyu:feat/channel-test-exclusion-ids
Closed

增加定时测试排除渠道 ID 配置#4269
uskyu wants to merge 1 commit into
QuantumNous:mainfrom
uskyu:feat/channel-test-exclusion-ids

Conversation

@uskyu

@uskyu uskyu commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

变更描述

当前“测试所有通道 / 定时测试所有通道”会对部分图片、视频等高成本渠道发起真实上游测试请求,容易带来不必要的巡检成本。

这个 PR 增加了一个轻量的排除配置:管理员可以在“系统设置 -> 监控设置”中通过逗号分隔的渠道 ID 配置排除列表,让这些渠道跳过批量/定时测试,但不影响单个渠道的手动测试,也不需要手动禁用渠道。

变更类型

  • 新功能 (New feature)
  • Bug 修复 (Bug fix)
  • 性能优化 / 重构 (Refactor)
  • 文档更新 (Documentation)

关联任务

  • Closes #(如有)

具体改动

  • 新增 monitor_setting.auto_test_channel_excluded_ids 配置项
  • 在批量测试逻辑中跳过命中的渠道 ID,避免发起真实测试请求
  • 监控设置页新增“定时测试排除渠道 ID”输入框
  • 补充中英等语言文案
  • 增加一个最小单测,覆盖排除 ID 的解析逻辑

兼容性说明

  • 不修改数据库结构
  • 不需要迁移
  • 复用现有 options 配置表保存该配置
  • 默认值为空,升级后不配置时保持现有行为不变

提交前检查项

  • 我已人工整理并撰写此描述,没有直接粘贴未经处理的 AI 输出
  • 我已搜索现有的 Issues / PRs,确认不是重复提交
  • 我已理解这些改动的工作原理及可能影响
  • 本 PR 未包含与当前任务无关的代码改动
  • 已在本地完成验证
  • 代码中不包含敏感信息

运行证明 / 验证结果

  • go test ./setting/operation_setting/...
  • npm run build

Summary by CodeRabbit

  • New Features

    • Add option to exclude specific channels from automated/scheduled tests by entering comma-separated channel IDs; excluded channels are skipped during scheduled runs.
  • UI

    • New settings input for excluded channel IDs in monitoring settings with helper text.
  • Documentation

    • Added translations for the new setting (en, fr, ja, ru, vi, zh-CN, zh-TW).
  • Tests

    • Added unit test verifying parsing of excluded channel IDs.

@coderabbitai

coderabbitai Bot commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2e5c4e4c-cf60-4184-a552-f48231ecd871

📥 Commits

Reviewing files that changed from the base of the PR and between 6811eaa and b8939b6.

📒 Files selected for processing (12)
  • controller/channel-test.go
  • setting/operation_setting/monitor_setting.go
  • setting/operation_setting/monitor_setting_test.go
  • web/src/components/settings/OperationSetting.jsx
  • web/src/i18n/locales/en.json
  • web/src/i18n/locales/fr.json
  • web/src/i18n/locales/ja.json
  • web/src/i18n/locales/ru.json
  • web/src/i18n/locales/vi.json
  • web/src/i18n/locales/zh-CN.json
  • web/src/i18n/locales/zh-TW.json
  • web/src/pages/Setting/Operation/SettingsMonitoring.jsx
✅ Files skipped from review due to trivial changes (9)
  • web/src/i18n/locales/en.json
  • web/src/components/settings/OperationSetting.jsx
  • controller/channel-test.go
  • web/src/i18n/locales/vi.json
  • web/src/i18n/locales/ru.json
  • setting/operation_setting/monitor_setting_test.go
  • web/src/i18n/locales/zh-TW.json
  • web/src/i18n/locales/zh-CN.json
  • web/src/i18n/locales/ja.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • setting/operation_setting/monitor_setting.go

Walkthrough

Adds a new MonitorSetting field to list excluded channel IDs, parsing logic to produce an exclusion map, updates the scheduled channel test loop to skip/log excluded channels, adds UI input and i18n keys, and includes a unit test for the parser.

Changes

Cohort / File(s) Summary
Backend: monitor setting & tests
setting/operation_setting/monitor_setting.go, setting/operation_setting/monitor_setting_test.go
Add AutoTestChannelExcludedIds string to MonitorSetting and GetAutoTestChannelExcludedIDMap() to parse mixed delimiters into map[int]bool; add unit test covering delimiters, invalid tokens, and negative/zero filtering.
Backend: channel test controller
controller/channel-test.go
testAllChannels now retrieves exclusion map and early-skips/logs channels present in the map, avoiding test execution and related updates for those channels.
Frontend: settings UI
web/src/components/settings/OperationSetting.jsx, web/src/pages/Setting/Operation/SettingsMonitoring.jsx
Add monitor_setting.auto_test_channel_excluded_ids to settings state and render a new input for comma-separated excluded channel IDs, wired to existing save flow.
i18n: locales
web/src/i18n/locales/en.json, .../fr.json, .../ja.json, .../ru.json, .../vi.json, .../zh-CN.json, .../zh-TW.json
Add label and helper/placeholder translation keys for the scheduled-tests excluded-channel-IDs field across listed locales.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Frontend
    participant Backend
    participant MonitorSetting
    participant ChannelLoop
    participant Logger

    User->>Frontend: Update excluded IDs (e.g. "3,5,8")
    Frontend->>Backend: Save operation settings
    Backend->>MonitorSetting: Persist AutoTestChannelExcludedIds
    Note over Backend,MonitorSetting: Scheduled test trigger
    Backend->>MonitorSetting: GetAutoTestChannelExcludedIDMap()
    MonitorSetting-->>Backend: map{3:true,5:true,8:true}
    Backend->>ChannelLoop: Iterate channels
    ChannelLoop->>ChannelLoop: check channel.Id in exclusion map
    alt channel excluded
        ChannelLoop->>Logger: SysLog skip channel.Id
        ChannelLoop-->>Backend: continue (skip test)
    else channel not excluded
        ChannelLoop->>Backend: testChannel(...)
        Backend-->>ChannelLoop: test result / update RT
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Suggested reviewers

  • creamlike1024
  • xyfacai
  • seefs001

Poem

🐰 I nibble digits split by line and space,
I hop past burrows marked in place,
Some IDs rest, some wake and run,
A log, a skip — the tests have fun,
Tiny rabbit, tidy trace.

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title "增加定时测试排除渠道 ID 配置" accurately summarizes the main change: adding a configuration feature to exclude channel IDs from scheduled tests.

✏️ 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)
web/src/i18n/locales/en.json (1)

1140-1140: Optional wording polish for natural English

Current copy is understandable, but “Channel IDs excluded from scheduled tests” reads more naturally in UI.

✍️ Suggested wording
-    "定时测试排除渠道 ID": "Excluded channel IDs for scheduled tests",
+    "定时测试排除渠道 ID": "Channel IDs excluded from scheduled tests",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/src/i18n/locales/en.json` at line 1140, Update the English translation
value for the key "定时测试排除渠道 ID" in the locales file: replace "Excluded channel
IDs for scheduled tests" with the more natural UI phrasing "Channel IDs excluded
from scheduled tests" so the displayed copy reads more naturally.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@web/src/i18n/locales/en.json`:
- Line 1140: Update the English translation value for the key "定时测试排除渠道 ID" in
the locales file: replace "Excluded channel IDs for scheduled tests" with the
more natural UI phrasing "Channel IDs excluded from scheduled tests" so the
displayed copy reads more naturally.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 55abaebc-1f5e-4499-82e8-e5673a22e6c7

📥 Commits

Reviewing files that changed from the base of the PR and between 8aaec8b and 2c44971.

📒 Files selected for processing (12)
  • controller/channel-test.go
  • setting/operation_setting/monitor_setting.go
  • setting/operation_setting/monitor_setting_test.go
  • web/src/components/settings/OperationSetting.jsx
  • web/src/i18n/locales/en.json
  • web/src/i18n/locales/fr.json
  • web/src/i18n/locales/ja.json
  • web/src/i18n/locales/ru.json
  • web/src/i18n/locales/vi.json
  • web/src/i18n/locales/zh-CN.json
  • web/src/i18n/locales/zh-TW.json
  • web/src/pages/Setting/Operation/SettingsMonitoring.jsx

@uskyu
uskyu force-pushed the feat/channel-test-exclusion-ids branch from 2c44971 to 6811eaa Compare April 15, 2026 15:25
@uskyu
uskyu force-pushed the feat/channel-test-exclusion-ids branch from 6811eaa to b8939b6 Compare April 15, 2026 15:32
@uskyu

uskyu commented Apr 15, 2026

Copy link
Copy Markdown
Contributor Author

@seefs001 你好,这个 PR 现在已经可以 review 了,签名和 checks 都处理好了。这个改动主要是给定时测试增加排除渠道 ID 配置,默认行为不变。有空的话麻烦帮看一下,感谢。

@uskyu

uskyu commented Apr 26, 2026

Copy link
Copy Markdown
Contributor Author

关闭此 PR,功能暂不需要

@uskyu uskyu closed this Apr 26, 2026
@uskyu
uskyu deleted the feat/channel-test-exclusion-ids branch April 26, 2026 08:17
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.

1 participant