Skip to content

feat(webhooks): webhook notification module for score delivery#58

Merged
hummbl-dev merged 2 commits intomainfrom
feat/claude/webhooks
Apr 19, 2026
Merged

feat(webhooks): webhook notification module for score delivery#58
hummbl-dev merged 2 commits intomainfrom
feat/claude/webhooks

Conversation

@hummbl-dev
Copy link
Copy Markdown
Owner

Summary

  • New src/arbiter/webhooks.py module: WebhookPayload dataclass, send_webhook() with stdlib urllib.request, HMAC-SHA256 signing via X-Arbiter-Signature header, auto-detect Slack/Discord from URL
  • format_slack() (Block Kit) and format_discord() (embeds) format helpers with grade-aware colors/emoji
  • --webhook and --webhook-secret flags added to score, score-url, and certify subcommands
  • webhook-test subcommand with --dry-run, --format, and --secret options for connectivity testing
  • 29 tests covering serialization, HMAC signing, Slack/Discord formatting, send success/failure, and CLI registration

Test plan

  • 29 new tests in tests/test_webhooks.py all pass
  • Full suite (662 tests) passes with no regressions
  • Manual: arbiter webhook-test https://hooks.slack.com/... --dry-run prints Block Kit JSON
  • Manual: arbiter score /path --webhook https://discord.com/api/webhooks/... delivers embed

🤖 Generated with Claude Code

Claude (agent) and others added 2 commits April 18, 2026 23:02
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>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 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".

Comment thread tests/test_webhooks.py Outdated
result = subprocess.run(
[sys.executable, "-m", "arbiter", "webhook-test", "--help"],
capture_output=True, text=True, timeout=10,
cwd="/Users/others/PROJECTS/arbiter-wt-webhooks",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Comment thread src/arbiter/__main__.py
return

secret = args.secret or ""
ok = send_webhook(args.url, payload, secret=secret)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@hummbl-dev hummbl-dev merged commit a271f52 into main Apr 19, 2026
3 checks passed
@hummbl-dev hummbl-dev deleted the feat/claude/webhooks branch April 19, 2026 03:05
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