AI Agents SDE Task Viewer
      • Context
      • Plan
      • Prd
  1. Home
  2. AgentSDE
  3. agent-core
  4. gh-555
  5. plan
  6. plan.md
plan.md(3.7 KB)· Apr 23, 2026· 2 min read
  • Summary
  • Target repo
  • Files
  • Steps
  • Verification
  • Risks
  • Open Questions

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#

PathActionPurpose
test/helpers/bitbucket-webhook-client.tscreatesendBitbucketWebhook(eventType, body) — POST to /webhooks/bitbucket?secret=... with X-Event-Key + X-Request-UUID headers (matches BitbucketAdapter.verifySignature)
test/helpers/jira-webhook-client.tscreatesendJiraWebhook(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.jsoncreatepullrequest:created
test/fixtures/bitbucket/pr_updated.jsoncreatepullrequest:updated
test/fixtures/bitbucket/pr_approved.jsoncreatepullrequest:approved
test/fixtures/bitbucket/pr_merged.jsoncreatepullrequest:fulfilled
test/fixtures/bitbucket/pr_comment.jsoncreatepullrequest:comment_created
test/fixtures/bitbucket/push.jsoncreaterepo:push
test/fixtures/jira/issue_created.jsoncreatejira:issue_created
test/fixtures/jira/issue_updated.jsoncreatejira:issue_updated with changelog
test/fixtures/jira/issue_deleted.jsoncreatejira:issue_deleted
test/fixtures/jira/comment_created.jsoncreatecomment_created
test/smoke/bitbucket.smoke.e2e-spec.tscreateSends one fixture via helper; asserts 200 + status === 'dispatched'
test/smoke/jira.smoke.e2e-spec.tscreateSends one fixture via helper; asserts 200 + status === 'dispatched'

Steps#

  1. Implement bitbucket-webhook-client.ts — read BITBUCKET_WEBHOOK_SECRET from env, embed in URL query, resolve X-Event-Key from a filename→event-key map (pr_created → pullrequest:created, etc.), include a random X-Request-UUID, parse response as the shared WebhookResponse shape used by webhook-client.ts.
  2. 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.raw for comment events, push.changes[*] for push).
  3. Implement jira-webhook-client.ts — HMAC-SHA256 sign the raw JSON body with JIRA_WEBHOOK_SECRET, send as X-Hub-Signature: sha256=<hex>. Extract the signer if duplication with webhook-client.ts grows.
  4. Author the 4 Jira fixtures — each includes the webhookEvent field plus a minimal issue/comment/changelog payload matching what JiraAdapter.normalize() consumes.
  5. Add the two smoke specs under test/smoke/ — each loads one fixture via fs.readFileSync + JSON.parse, invokes its helper, and asserts the server returns status: 'dispatched'.

Verification#

  • npm run lint + npm run build pass in agent-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 on rc/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.
ContextPrd