fix(health): force alert notifications on health command#156
Conversation
|
Warning Review limit reached
More reviews will be available in 4 minutes and 35 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Warning
|
| Layer / File(s) | Summary |
|---|---|
Alert cooldown force override src/monitor/alerts.ts, src/__tests__/alerts.test.ts |
triggerAlert signature extended to accept options?: { force?: boolean }. Cooldown bypass logic now checks options.force to skip suppression. Tests verify initial trigger, cooldown suppression, and force: true bypass behavior. |
Propagating force alert through container/pod retrieval src/docker/containers.ts, src/kubernetes/pods.ts |
getRunningContainers and getRunningPods now accept options?: { forceAlert?: boolean } and forward it to all triggerAlert calls (restarting, exited/failed containers, and failed pods). |
Health command integration and testing src/commands/health.ts, src/__tests__/health.test.ts |
fetchHealthRows accepts and forwards forceAlert option to retrieval functions. Both watch mode and one-time health checks call fetchHealthRows with { forceAlert: true }. Health test assertions verify the option propagation. |
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~12 minutes
Poem
🐰 A cooldown that bends to the will so strong,
Force-true alerts sing their urgent song,
Through containers, pods, and health checks they flow,
Each layer coordinating a swift override show,
Tests mock and verify the bounce-back's just right! 💫
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title accurately describes the main change: enabling forced alert notifications when the health command runs, which matches the PR's core objective of bypassing cooldown for manual health checks. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| 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.
Comment @coderabbitai help to get the list of available commands and usage tips.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@src/__tests__/alerts.test.ts`:
- Around line 29-35: The test sets global.fetch at module scope via mockFetch
and never restores it; change the setup to use vi.stubGlobal('fetch', mockFetch)
instead of assigning global.fetch and add cleanup in afterEach by calling
vi.unstubAllGlobals() (or afterAll if preferred) so mocks don't leak between
tests; update references around mockFetch, the describe('alerts monitoring')
block, and beforeEach/afterEach accordingly.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: f0460242-1f2e-4db9-a016-6fdda1074c0c
📒 Files selected for processing (6)
src/__tests__/alerts.test.tssrc/__tests__/health.test.tssrc/commands/health.tssrc/docker/containers.tssrc/kubernetes/pods.tssrc/monitor/alerts.ts
There was a problem hiding this comment.
Code Health Improved
(1 files improve in Code Health)
Our agent can fix these. Install it.
Gates Passed
3 Quality Gates Passed
View Improvements
| File | Code Health Impact | Categories Improved |
|---|---|---|
| health.ts | 8.37 → 8.55 | Complex Method, Bumpy Road Ahead |
Quality Gate Profile: The Bare Minimum
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.
This PR updates the alerts module and the health command so that manual executions of
kdm healthbypass the usual cooldown tracker and always trigger notification alerts immediately.Summary by CodeRabbit
Release Notes
New Features
Tests