Skip to content

Add Twilio HealthCheck to Boilerplate (#12297)#12300

Merged
msynk merged 1 commit into
bitfoundation:developfrom
Cyrus-Sushiant:12297-add-twilio-healthcheck
May 3, 2026
Merged

Add Twilio HealthCheck to Boilerplate (#12297)#12300
msynk merged 1 commit into
bitfoundation:developfrom
Cyrus-Sushiant:12297-add-twilio-healthcheck

Conversation

@Cyrus-Sushiant
Copy link
Copy Markdown
Member

@Cyrus-Sushiant Cyrus-Sushiant commented May 1, 2026

closes #12297

Summary by CodeRabbit

  • New Features
    • Added Twilio SMS health check monitoring. The system now automatically monitors Twilio SMS service configuration and account status to ensure reliable message delivery. Comprehensive health checks verify account activation, detect service degradation if accounts are inactive, and gracefully skip monitoring when SMS functionality is not configured.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 1, 2026

Walkthrough

A new Twilio health-check service was added to the Boilerplate template that verifies Twilio SMS configuration and account status. The service returns a healthy/skipped result if SMS is not configured, checks Twilio account details if configured, and reports account status accordingly. The health check was registered in the service collection.

Changes

Cohort / File(s) Summary
Twilio Health Check
src/Templates/Boilerplate/.../Infrastructure/Services/TwilioHealthCheck.cs, src/Templates/Boilerplate/.../Program.Services.cs
Added new TwilioHealthCheck service that implements IHealthCheck to verify Twilio configuration and account status. Service returns skipped if not configured, healthy if account is active, degraded for other statuses, and unhealthy on exceptions. Registered as "sms" health check with "live" tag in service collection.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A health-check hops forth, checking Twilio's cheer,
SMS services now crystal clear,
If Twilio's active, we jump with delight,
Our boilerplate runs, everything's right!

🚥 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 accurately summarizes the main change: adding a Twilio HealthCheck to the Boilerplate template, which is clearly reflected in the code additions.
Linked Issues check ✅ Passed The PR successfully implements the core objective from issue #12297: adding a built-in Twilio HealthCheck to the Boilerplate template that verifies Twilio configuration and functionality at runtime.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the Twilio HealthCheck feature; no unrelated or out-of-scope modifications were introduced.

✏️ 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
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Infrastructure/Services/TwilioHealthCheck.cs`:
- Around line 18-19: The health check in TwilioHealthCheck currently treats any
non-true Sms?.Configured as “skipped” healthy, which hides partial configuration
errors; update the logic in the TwilioHealthCheck (the method that reads
settings.Sms?.Configured) to distinguish three cases: (1) fully unconfigured —
keep returning Healthy with the skip message, (2) fully configured — perform the
normal Twilio check and return Healthy/Unhealthy based on the probe, and (3)
partially configured — return HealthCheckResult.Unhealthy with a clear message
listing which required Twilio fields (e.g., AccountSid, AuthToken,
From/PhoneNumber) are missing or empty so partial setups are surfaced. Ensure
you reference and validate the actual properties on settings.Sms before deciding
to skip versus fail.
- Around line 14-22: The health check in TwilioHealthCheck.CheckHealthAsync
calls AccountResource.FetchAsync without honoring the passed cancellationToken,
so wrap the fetch in a cancellable/timeout pattern (e.g., start the fetch task
and await Task.WhenAny(fetchTask, Task.Delay(timeout, cancellationToken))) and
if the delay/cancellation completes first, abort waiting and return an
Unhealthy/Degraded HealthCheckResult indicating a timeout/cancellation; ensure
you pass/observe the incoming cancellationToken (or a linked
CancellationTokenSource) when creating the timeout Task so the method returns
promptly on cancellation and does not hang indefinitely.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d998f683-cb80-4fd5-bb8a-22089aa40cf7

📥 Commits

Reviewing files that changed from the base of the PR and between faf3838 and 914f120.

📒 Files selected for processing (2)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Infrastructure/Services/TwilioHealthCheck.cs
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Program.Services.cs

@msynk msynk merged commit 23aaca2 into bitfoundation:develop May 3, 2026
3 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.

Add Twilio HealthCheck to Boilerplate template

3 participants