Plan — BJ-15: E2E harness webhook clients + fixtures#
Summary#
Add Bitbucket + Jira webhook client helpers and fixtures to agent-core-e2e, mirroring the existing test/helpers/webhook-client.ts GitHub pattern, so BJ-6/BJ-7 adapters can be driven end-to-end.
Target repo#
AgentSDE/agent-core-e2e — NOT this repo. All paths below are in that repo. Target branch: rc/atlassian-integration (branch does not exist yet; implementer creates from main).
Files#
| Path | Action | Purpose |
|---|---|---|
test/helpers/bitbucket-webhook-client.ts | create | sendBitbucketWebhook(eventType, body) — POST to /webhooks/bitbucket?secret=... with X-Event-Key + X-Request-UUID headers (matches BitbucketAdapter.verifySignature) |
test/helpers/jira-webhook-client.ts | create | sendJiraWebhook(eventType, body) — POST to /webhooks/jira with X-Hub-Signature HMAC-SHA256 (reuse the signer pattern from webhook-client.ts) |
test/fixtures/bitbucket/pr_created.json | create | pullrequest:created |
test/fixtures/bitbucket/pr_updated.json | create | pullrequest:updated |
test/fixtures/bitbucket/pr_approved.json | create | pullrequest:approved |
test/fixtures/bitbucket/pr_merged.json | create | pullrequest:fulfilled |
test/fixtures/bitbucket/pr_comment.json | create | pullrequest:comment_created |
test/fixtures/bitbucket/push.json | create | repo:push |
test/fixtures/jira/issue_created.json | create | jira:issue_created |
test/fixtures/jira/issue_updated.json | create | jira:issue_updated with changelog |
test/fixtures/jira/issue_deleted.json | create | jira:issue_deleted |
test/fixtures/jira/comment_created.json | create | comment_created |
test/smoke/bitbucket.smoke.e2e-spec.ts | create | Sends one fixture via helper; asserts 200 + status === 'dispatched' |
test/smoke/jira.smoke.e2e-spec.ts | create | Sends one fixture via helper; asserts 200 + status === 'dispatched' |
Steps#
- Implement
bitbucket-webhook-client.ts— readBITBUCKET_WEBHOOK_SECRETfrom env, embed in URL query, resolveX-Event-Keyfrom a filename→event-key map (pr_created → pullrequest:created, etc.), include a randomX-Request-UUID, parse response as the sharedWebhookResponseshape used bywebhook-client.ts. - Author the 6 Bitbucket fixtures — each contains only the fields
BitbucketAdapter.normalize()actually reads (pullrequest.id,repository.full_name,actor.nickname/actor.uuid,comment.content.rawfor comment events,push.changes[*]for push). - Implement
jira-webhook-client.ts— HMAC-SHA256 sign the raw JSON body withJIRA_WEBHOOK_SECRET, send asX-Hub-Signature: sha256=<hex>. Extract the signer if duplication withwebhook-client.tsgrows. - Author the 4 Jira fixtures — each includes the
webhookEventfield plus a minimalissue/comment/changelogpayload matching whatJiraAdapter.normalize()consumes. - Add the two smoke specs under
test/smoke/— each loads one fixture viafs.readFileSync+JSON.parse, invokes its helper, and asserts the server returnsstatus: 'dispatched'.
Verification#
npm run lint+npm run buildpass inagent-core-e2e.- Every fixture file parses via
JSON.parse. - Both smoke specs return
status: 'dispatched'against a local agent-core with BJ-6 + BJ-7 merged onrc/atlassian-integration.
Risks#
- BJ-6 (#546) / BJ-7 (#547) server-side adapters must be merged first, or smoke tests will 404. If they aren't available yet, tests fail loudly — do not silently skip.
Open Questions#
- Fixtures: use real Bitbucket/Jira documented sample bodies, or the minimum shape
normalize()requires? Plan favours minimum-viable; implementer can expand if server-side validation forces it.