feat(webhooks): webhook notification module for score delivery#58
feat(webhooks): webhook notification module for score delivery#58hummbl-dev merged 2 commits intomainfrom
Conversation
Send score results to Slack, Discord, or generic webhook endpoints. Supports HMAC-SHA256 signing, auto-format detection from URL, and a webhook-test subcommand for connectivity verification. - New src/arbiter/webhooks.py with WebhookPayload, format_slack, format_discord, send_webhook (stdlib urllib, 10s timeout) - --webhook/--webhook-secret flags on score, score-url, certify - webhook-test subcommand with --dry-run and --format options - 29 tests covering serialization, signing, formatting, send/fail Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3359c63056
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| result = subprocess.run( | ||
| [sys.executable, "-m", "arbiter", "webhook-test", "--help"], | ||
| capture_output=True, text=True, timeout=10, | ||
| cwd="/Users/others/PROJECTS/arbiter-wt-webhooks", |
There was a problem hiding this comment.
Remove machine-specific cwd from webhook-test CLI test
This test hard-codes cwd to /Users/others/PROJECTS/arbiter-wt-webhooks, which only exists on one machine; in other environments (including CI) subprocess.run(...) raises FileNotFoundError before the CLI is exercised, so the new test fails regardless of actual webhook behavior. Use a repo-relative working directory (or omit cwd) so the assertion reflects command registration instead of local filesystem layout.
Useful? React with 👍 / 👎.
| return | ||
|
|
||
| secret = args.secret or "" | ||
| ok = send_webhook(args.url, payload, secret=secret) |
There was a problem hiding this comment.
Apply --format override when sending webhook-test payload
The webhook-test --format flag is documented as a forced format, but in non---dry-run mode the code always calls send_webhook(args.url, ...), which re-detects format from URL and ignores the user-provided override; this breaks testing for Slack/Discord payloads on custom domains (or tunneled endpoints) and can print a misleading success message with the requested format even when a different payload was sent.
Useful? React with 👍 / 👎.
Summary
src/arbiter/webhooks.pymodule:WebhookPayloaddataclass,send_webhook()with stdliburllib.request, HMAC-SHA256 signing viaX-Arbiter-Signatureheader, auto-detect Slack/Discord from URLformat_slack()(Block Kit) andformat_discord()(embeds) format helpers with grade-aware colors/emoji--webhookand--webhook-secretflags added toscore,score-url, andcertifysubcommandswebhook-testsubcommand with--dry-run,--format, and--secretoptions for connectivity testingTest plan
tests/test_webhooks.pyall passarbiter webhook-test https://hooks.slack.com/... --dry-runprints Block Kit JSONarbiter score /path --webhook https://discord.com/api/webhooks/...delivers embed🤖 Generated with Claude Code