Skip to content

feat: add per-channel health check settings - #6283

Open
DawnMoon1542 wants to merge 3 commits into
QuantumNous:mainfrom
DawnMoon1542:feat/channel-health-check-settings
Open

feat: add per-channel health check settings#6283
DawnMoon1542 wants to merge 3 commits into
QuantumNous:mainfrom
DawnMoon1542:feat/channel-health-check-settings

Conversation

@DawnMoon1542

@DawnMoon1542 DawnMoon1542 commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

⚠️ PR Notice

Important

This PR is AI-assisted. The root cause, fix scope, and typecheck results were reviewed before submission.

📝 Description

Support per-channel health check management on the Routing Reliability page.

  • Add a channel-level health check table and adjust the page layout so global monitoring options and per-channel settings live together.
  • Each channel can enable or disable scheduled tests, and optionally override:
    • disable threshold
    • re-enable on success
    • endpoint type
    • stream mode
  • Failure auto-ban continues to use the existing channel auto-ban setting.
  • Scheduled tests and "Test All Channels" skip channels with scheduled health checks disabled.
  • Single-channel manual tests remain available and use the channel endpoint/stream settings as defaults.

Related upstream discussion: #5205 / #5206 cover a simpler skip-auto-test toggle. This PR provides broader per-channel health-check controls rather than a single skip flag.

🚀 Type of change

  • 🐛 Bug fix
  • ✨ New feature
  • ⚡ Performance / Refactor
  • 📝 Documentation

🔗 Related Issue

✅ Checklist

  • Human review: I personally reviewed and finalized this description.
  • Not a duplicate: I searched existing Issues/PRs and this is not a duplicate submission.
  • Bug fix note: N/A for this feature PR.
  • Change understanding: I understand how these changes work and their impact.
  • Focused scope: This PR does not include unrelated changes.
  • Local verification: Local tests / manual validation were completed.
  • Security: No sensitive credentials are included, and the change follows project conventions.

📸 Proof of Work

Backend:

go test ./model ./controller ./service ./router -count=1
# ok

Frontend:

cd web/default
bun run typecheck
# pass
# changed files oxlint: 0 error

Summary by CodeRabbit

  • New Features

    • Added per-channel health-check settings, including endpoint type, streaming, disable thresholds, and re-enable behavior.
    • Added batch updates for channel health-check and auto-ban settings, with validation and per-item results.
    • Added permission-protected support for the new batch update endpoint.
  • Bug Fixes

    • Automatic health-check cycles now skip channels with health checks disabled.
    • Health-check actions now consistently use each channel’s effective configuration.
  • Tests

    • Added coverage for configuration overrides, validation, preservation of settings, and channel selection.

@coderabbitai

coderabbitai Bot commented Jul 18, 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

Run ID: 9979051d-c255-4eab-9ce2-d41f4f0ea7c5

📥 Commits

Reviewing files that changed from the base of the PR and between 33d99b9 and b487001.

📒 Files selected for processing (10)
  • controller/channel-test.go
  • controller/channel.go
  • controller/channel_test_internal_test.go
  • dto/channel_settings.go
  • model/channel.go
  • model/channel_health_check_test.go
  • router/channel-router.go
  • router/channel_router_test.go
  • service/channel.go
  • service/channel_enable_test.go
🚧 Files skipped from review as they are similar to previous changes (9)
  • router/channel_router_test.go
  • service/channel_enable_test.go
  • dto/channel_settings.go
  • service/channel.go
  • controller/channel.go
  • controller/channel_test_internal_test.go
  • model/channel_health_check_test.go
  • model/channel.go
  • controller/channel-test.go

Walkthrough

Per-channel health-check overrides are added to channel settings, persisted with validation, and applied to automatic channel tests. A permission-protected batch endpoint updates these settings and auto-ban values with per-item results, cache refreshes, and audit logging.

Changes

Health check configuration

Layer / File(s) Summary
Effective settings and persistence
dto/channel_settings.go, model/channel.go, model/channel_health_check_test.go
Adds per-channel health-check overrides, effective-value resolution, validated transactional JSON updates, and coverage for defaults, clamping, validation, and preservation of unrelated settings.
Automatic test policy
controller/channel-test.go, controller/channel_test_internal_test.go, service/channel.go, service/channel_enable_test.go
Automatic tests use per-channel endpoint, stream, threshold, enablement, and recovery settings, while selection skips channels with disabled automatic health checks.
Batch update API
controller/channel.go, router/channel-router.go, router/channel_router_test.go
Adds the permission-protected batch endpoint with input validation, per-item updates and results, cache refresh, and audit recording.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Scheduler
  participant performChannelTests
  participant Channel
  participant ShouldEnableChannel
  Scheduler->>performChannelTests: start automatic tests
  performChannelTests->>Channel: resolve effective health-check settings
  performChannelTests->>Channel: execute endpoint test
  Channel-->>performChannelTests: return test result
  performChannelTests->>ShouldEnableChannel: evaluate recovery policy
Loading
sequenceDiagram
  participant Client
  participant BatchUpdateChannelHealthCheck
  participant UpdateHealthCheckSettings
  participant ChannelCache
  Client->>BatchUpdateChannelHealthCheck: submit channel updates
  BatchUpdateChannelHealthCheck->>UpdateHealthCheckSettings: update each item
  UpdateHealthCheckSettings-->>BatchUpdateChannelHealthCheck: return item result
  BatchUpdateChannelHealthCheck->>ChannelCache: refresh after success
  BatchUpdateChannelHealthCheck-->>Client: return aggregate results
Loading

Poem

I’m a rabbit with settings to spare,
Per-channel checks now hop through the air.
Thresholds and streams fall neatly in line,
Batch updates succeed, one item at a time.
The cache gets a refresh—what a treat!
Audit logs thump with a carrot-sweet beat.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% 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 accurately summarizes the main change: adding per-channel health check settings.
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.
✨ 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.

@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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@web/default/src/features/system-settings/models/channel-health-check-table.tsx`:
- Around line 686-715: Add accessible aria-labels to every per-row health-check
control, including the scheduled and auto-ban Switches plus threshold,
re-enable, endpoint, and stream Selects. Build each label from the column
purpose and the current channel context, updating the control definitions in the
table configuration while preserving their existing values and change handlers.

In `@web/default/src/i18n/locales/ru.json`:
- Line 5186: Update the “Follow global” translation in the Russian locale to
clearly express inheriting or using the global setting, replacing the unnatural
“Как глобально” wording with an appropriate phrase such as “Следовать глобальным
настройкам”.

In `@web/default/src/i18n/locales/zh-TW.json`:
- Around line 5174-5193: Update the zh-TW translations in the locale entries by
translating “All statuses” into Traditional Chinese and replacing the Simplified
“复查” character with Traditional “複” in both recheck-related strings, preserving
the existing translation meaning.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4a4123df-7785-4548-bc30-5704b7828d94

📥 Commits

Reviewing files that changed from the base of the PR and between 5a6c53d and 189b6bf.

📒 Files selected for processing (23)
  • controller/channel-test.go
  • controller/channel.go
  • controller/channel_test_internal_test.go
  • dto/channel_settings.go
  • model/channel.go
  • model/channel_health_check_test.go
  • router/channel-router.go
  • router/channel_router_test.go
  • service/channel.go
  • service/channel_enable_test.go
  • web/default/src/features/channels/api.ts
  • web/default/src/features/channels/components/dialogs/channel-test-dialog.tsx
  • web/default/src/features/channels/lib/channel-actions.ts
  • web/default/src/features/channels/types.ts
  • web/default/src/features/system-settings/models/channel-health-check-table.tsx
  • web/default/src/features/system-settings/models/routing-reliability-section.tsx
  • web/default/src/i18n/locales/en.json
  • web/default/src/i18n/locales/fr.json
  • web/default/src/i18n/locales/ja.json
  • web/default/src/i18n/locales/ru.json
  • web/default/src/i18n/locales/vi.json
  • web/default/src/i18n/locales/zh-TW.json
  • web/default/src/i18n/locales/zh.json

Comment thread web/default/src/i18n/locales/ru.json Outdated
Comment thread web/default/src/i18n/locales/zh-TW.json Outdated
Support per-channel health check management with a channel-level
configuration table and layout updates on the Routing Reliability page.
Each channel can enable or disable scheduled tests and override the
disable threshold, re-enable-on-success policy, endpoint type, and
stream mode. Failure auto-ban continues to use the channel auto-ban
setting.

Scheduled tests and "Test All Channels" skip channels with scheduled
health checks disabled. Single-channel manual tests remain available
and use the channel endpoint/stream settings as defaults.
Refresh channel baselines for undrafted rows when server data changes,
sync the routing reliability save baseline when defaults reload, and
preserve newer in-flight channel drafts after a successful partial save.
为渠道健康检查表格的行内 Switch/Select/Input 增加带渠道上下文的
aria-label;修正俄语 Follow global 译法,并将 zh-TW 中未翻译的
All statuses 与简体「复查」改为繁体对应文案。
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