Skip to content

feat(alerts): add webhook2 channel with custom headers and timeout - #535

Merged
AbdulmalikAlayande merged 1 commit into
TegoLabs:mainfrom
marvelousjeremiah24:feat/webhook2-channel
Aug 1, 2026
Merged

AbdulmalikAlayande merged 1 commit into
TegoLabs:mainfrom
marvelousjeremiah24:feat/webhook2-channel

Conversation

@marvelousjeremiah24

Copy link
Copy Markdown
Contributor

Adds a new built-in alert channel 'webhook2' that accepts a JSON-encoded target string {url, headers?, timeoutMs?}, enabling per-config custom HTTP headers and timeout overrides without touching the existing webhook channel.

  • src/alerts/webhook2.ts: new channel implementation with parseWebhook2Target() for robust validation, custom header merging, configurable timeout (default 10 000 ms), and identical HMAC-SHA256 signing to the original webhook channel
  • src/alerts/builtins.ts: additive-only change — registers 'webhook2' alongside the existing five channels; original webhook registration is untouched
  • tests/alerts/webhook2.test.ts: 32 TDD tests covering target parsing, HTTP request shape, custom headers, HMAC signing, timeout override, success/error handling, and registry integration
  • tests/alerts/builtins.test.ts: updated channel-count and signing assertions to reflect the new six-channel registry; added webhook2 delegation and missingTargetError tests

What does this PR do?

Why?

Does this touch secret-key handling or transaction submission?

  • Yes — see notes above
  • No

Checklist

Adds a new built-in alert channel 'webhook2' that accepts a JSON-encoded
target string {url, headers?, timeoutMs?}, enabling per-config custom HTTP
headers and timeout overrides without touching the existing webhook channel.

- src/alerts/webhook2.ts: new channel implementation with parseWebhook2Target()
  for robust validation, custom header merging, configurable timeout (default
  10 000 ms), and identical HMAC-SHA256 signing to the original webhook channel
- src/alerts/builtins.ts: additive-only change — registers 'webhook2' alongside
  the existing five channels; original webhook registration is untouched
- tests/alerts/webhook2.test.ts: 32 TDD tests covering target parsing, HTTP
  request shape, custom headers, HMAC signing, timeout override, success/error
  handling, and registry integration
- tests/alerts/builtins.test.ts: updated channel-count and signing assertions to
  reflect the new six-channel registry; added webhook2 delegation and
  missingTargetError tests
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@marvelousjeremiah24, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 23 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a8e3ccff-cb51-40c0-bc9e-7c2b3b693141

📥 Commits

Reviewing files that changed from the base of the PR and between 35d9237 and 25a6e6d.

📒 Files selected for processing (4)
  • src/alerts/builtins.ts
  • src/alerts/webhook2.ts
  • tests/alerts/builtins.test.ts
  • tests/alerts/webhook2.test.ts

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.

@drips-wave

drips-wave Bot commented Jul 29, 2026

Copy link
Copy Markdown

@marvelousjeremiah24 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@gitguardian

gitguardian Bot commented Jul 29, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

Since your pull request originates from a forked repository, GitGuardian is not able to associate the secrets uncovered with secret incidents on your GitGuardian dashboard.
Skipping this check run and merging your pull request will create secret incidents on your GitGuardian dashboard.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
- - Generic High Entropy Secret ded54f4 tests/commands/guard-cli-export-import.test.ts View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@AbdulmalikAlayande
AbdulmalikAlayande merged commit dbdd9cc into TegoLabs:main Aug 1, 2026
3 of 5 checks passed
@AbdulmalikAlayande

Copy link
Copy Markdown
Collaborator

Merged into main (dbdd9cc) after local verification (tsc, lint, full suite 1244/1244, npm audit, build) and a manual smoke test confirming alerts channels lists both webhook and webhook2 correctly. Clean implementation — the JSON-blob-in-target design to avoid a schema change is a sensible tradeoff, and the original webhook channel's tests all still pass untouched. Only had to resolve a small merge conflict in the channel-count assertions (10→11 channels now that other channels landed in the meantime). Thanks!

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.

feat(alerts): add generic Webhook v2 channel with configurable retry policy

2 participants