{
"meta": {
"agent": "planner",
"task_id": "553",
"title": "BJ-13: Unit tests — Bitbucket + Jira adapters",
"created_at": "2026-04-23T17:12:28Z"
},
"inputs": [
{
"name": "issue",
"type": "link",
"ref": "https://github.com/AgentSDE/agent-core/issues/553",
"notes": "BJ-13 — EPIC #539 Wave 4"
},
{
"name": "dep-bj6",
"type": "link",
"ref": "https://github.com/AgentSDE/agent-core/issues/546",
"notes": "BitbucketAdapter implementation (OPEN)"
},
{
"name": "dep-bj7",
"type": "link",
"ref": "https://github.com/AgentSDE/agent-core/issues/547",
"notes": "JiraAdapter implementation (OPEN)"
},
{
"name": "reference-spec",
"type": "file",
"ref": "src/webhook/adapters/github.adapter.spec.ts",
"notes": "Existing spec to mirror — DI wiring, signature + normalize structure"
},
{
"name": "platform-interface",
"type": "file",
"ref": "src/webhook/adapters/platform-adapter.interface.ts",
"notes": "PlatformAdapter + NormalizationResult contract"
}
],
"outputs": [
{
"name": "bitbucket-spec",
"type": "test_plan",
"format": "text",
"content": "Jest spec covering verifySignature (secret query + IP allowlist) and normalize for 7 Bitbucket events plus bot-self and /agentsde detection."
},
{
"name": "jira-spec",
"type": "test_plan",
"format": "text",
"content": "Jest spec covering HMAC verifySignature and normalize for 5 Jira events plus bot-self and /agentsde detection."
}
],
"files": [
{
"path": "src/webhook/adapters/__fixtures__/bitbucket/pullrequest-created.json",
"action": "create",
"reason": "Fixture for pr_opened event"
},
{
"path": "src/webhook/adapters/__fixtures__/bitbucket/pullrequest-updated.json",
"action": "create",
"reason": "Fixture for pr_updated event"
},
{
"path": "src/webhook/adapters/__fixtures__/bitbucket/pullrequest-approved.json",
"action": "create",
"reason": "Fixture for approved event"
},
{
"path": "src/webhook/adapters/__fixtures__/bitbucket/pullrequest-changes-requested.json",
"action": "create",
"reason": "Fixture for changes_requested event"
},
{
"path": "src/webhook/adapters/__fixtures__/bitbucket/pullrequest-fulfilled.json",
"action": "create",
"reason": "Fixture for pr_merged event"
},
{
"path": "src/webhook/adapters/__fixtures__/bitbucket/pullrequest-comment-created.json",
"action": "create",
"reason": "Fixture for issue_comment event including /agentsde + bot-self cases"
},
{
"path": "src/webhook/adapters/__fixtures__/bitbucket/repo-push.json",
"action": "create",
"reason": "Fixture for push event"
},
{
"path": "src/webhook/adapters/__fixtures__/jira/issue-created.json",
"action": "create",
"reason": "Fixture for intake event"
},
{
"path": "src/webhook/adapters/__fixtures__/jira/issue-updated.json",
"action": "create",
"reason": "Fixture for issue_updated event (with changelog)"
},
{
"path": "src/webhook/adapters/__fixtures__/jira/issue-deleted.json",
"action": "create",
"reason": "Fixture for task_cancelled event"
},
{
"path": "src/webhook/adapters/__fixtures__/jira/comment-created.json",
"action": "create",
"reason": "Fixture for issue_comment event including /agentsde + bot-self cases"
},
{
"path": "src/webhook/adapters/__fixtures__/jira/issuelink-created.json",
"action": "create",
"reason": "Fixture for link_created event"
},
{
"path": "src/webhook/adapters/bitbucket.adapter.spec.ts",
"action": "create",
"reason": "Full unit test suite for BitbucketAdapter"
},
{
"path": "src/webhook/adapters/jira.adapter.spec.ts",
"action": "create",
"reason": "Full unit test suite for JiraAdapter"
},
{
"path": "src/webhook/adapters/github.adapter.spec.ts",
"action": "inspect",
"reason": "Reference pattern for TestingModule + assertions"
}
],
"steps": [
{
"id": "S1",
"summary": "Bitbucket fixtures + adapter spec (verifySignature, all 7 events, bot-self, /agentsde, unsupported)",
"acceptance": [
"7 realistic fixture JSONs exist under __fixtures__/bitbucket/",
"bitbucket.adapter.spec.ts covers verifySignature good + bad secret + IP allowlist cases",
"One it() per X-Event-Key asserts correct eventType/issueNumber/prNumber",
"Bot-self comment returns { event: null } with reason mentioning AGENT_USERNAME",
"/agentsde and legacy /agent directive detection covered on pullrequest:comment_created",
"Unknown X-Event-Key returns { event: null, reason } without throwing",
"npm run test passes for this spec; npm run lint reports zero warnings"
],
"depends_on": []
},
{
"id": "S2",
"summary": "Jira fixtures + adapter spec (HMAC verifySignature, all 5 events, bot-self, /agentsde, unsupported)",
"acceptance": [
"5 realistic fixture JSONs exist under __fixtures__/jira/ including a changelog payload",
"jira.adapter.spec.ts covers HMAC good signature, missing header, bad signature, tampered body",
"One it() per webhookEvent asserts correct eventType",
"jira:issue_updated spec inspects changelog for label transitions",
"Bot-self comment_created returns { event: null } with reason mentioning AGENT_USERNAME",
"/agentsde directive detection covered on comment_created",
"Unknown webhookEvent returns { event: null, reason } without throwing",
"npm run test passes for this spec; npm run lint reports zero warnings"
],
"depends_on": []
}
],
"risks": [
{
"risk": "BJ-6 (#546) and BJ-7 (#547) are still OPEN — specs cannot compile until the adapter files land on rc/atlassian-integration.",
"mitigation": "Delivery phase must wait for both PRs to merge. If a test run is attempted earlier, fail fast with a clear message rather than scaffolding placeholder adapters."
},
{
"risk": "Adapter implementations may diverge from the event maps documented in the parent issues, causing fixture mismatches.",
"mitigation": "Source fixtures from Atlassian webhook documentation and re-read adapter source before writing each it() — avoid inventing fields."
}
],
"assumptions": [
"Branch target is rc/atlassian-integration (per issue).",
"verifyHmacSha256 helper is extracted to src/webhook/crypto.ts by #547 and re-used by JiraAdapter.",
"Bot self-filter resolves username via PLATFORM_AUTH_PROVIDER.getBotUsername(), consistent with GitHubAdapter."
],
"open_questions": []
}