Skip to content

test: webhook adapter tests - #30

Merged
pikann merged 2 commits into
masterfrom
feature/add-webhook-tests
Oct 25, 2026
Merged

pikann merged 2 commits into
masterfrom
feature/add-webhook-tests

Conversation

@pikann

@pikann pikann commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds unit tests for the GitHub provider's webhook adapter (spi_webhook.go). Tests only; no production code changes.

What is covered (backend/spi_webhook_test.go)

  • Review requests and assignments naming this App are addressed (ViaReviewRequest / ViaAssignment), carry the pull request page URL, and are dropped when they name somebody else.
  • Issues assigned to the App are an assignment event with title and body as text.
  • Reviews and review comments: a submitted review mentioning the bot addresses it; a dismissed review is not an event; inline comments keep path, line and comment id.
  • Pushes: created / deleted / pushed on branches; tags, notes and an empty branch name are not branch activity.
  • Dropped deliveries: ping (no repository), no sender, unused event types, comment without a comment, deleted comments, check runs that are not completed or have no result, unlabeled / label-less pull requests.
  • Senders and ids: a bot sender is reported as a bot; event ids are <delivery>:<event>; without a delivery header the id derives from the body so a redelivery stays a duplicate.
  • Signature edge cases: missing, wrong prefix, no prefix, truncated, upper-cased hex, trailing space, valid signature of another body, valid signature with another key, unknown identity, a signed body that is not JSON.
  • Mentions: more cases (case-insensitive, [bot] suffix, e-mail look-alikes, longer handles, doubled @), literal matching of regex metacharacters, and the compiled pattern is cached per handle.
  • verifyHMAC: correct signature, empty / bare prefix / wrong secret / garbage, tampered body.

Testing

cd backend
go vet ./... && go test -race ./...
tinygo build -target=wasip1 -buildmode=c-shared -o backend.wasm .

🤖 Generated with Claude Code

@pikann pikann changed the title feat: add comprehensive tests for webhook handling and event parsing test: webhook adapter tests Oct 25, 2026
@pikann
pikann merged commit ff9917e into master Oct 25, 2026
3 checks passed
@pikann
pikann deleted the feature/add-webhook-tests branch October 25, 2026 13:37
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