Plan — BJ-17: E2E tier 2d-bitbucket#
Summary#
Add a new E2E module bitbucket in AgentSDE/agent-core-e2e containing one
happy-path scenario that drives the full Bitbucket intake → PR → merge cycle
against the mock Atlassian server (from BJ-16). All work lands on
rc/atlassian-integration in agent-core-e2e; no agent-core source changes.
Files#
| Path | Action | Purpose |
|---|---|---|
test/bitbucket/bitbucket.happy-path.e2e-spec.ts | create | Single @integration @bitbucket scenario: post pullrequest:created, poll WebhookDeliveryEntity, poll task phase transitions, assert mock request log, post pullrequest:fulfilled, assert close-out. |
package.json | modify | Add "test:module:bitbucket": "MODULE=bitbucket jest --config jest.module.config.js --forceExit" script alongside the existing per-module scripts. |
TEST_MODULES.md | modify | Register bitbucket in the Modules table and add src/webhook/bitbucket/** → bitbucket mapping (for e2e-targeted.yml). |
Steps#
- S1 — Scaffold the module: create
test/bitbucket/, add the npm script topackage.json, and register the module inTEST_MODULES.md. No spec logic yet. - S2 — Implement the happy-path spec: boot
AppModuleviaNestFactory, use the BJ-15 Bitbucket webhook client to POSTpullrequest:createdat${AGENT_CORE_URL}/webhooks/bitbucket, pollWebhookDeliveryEntityfor success, pollGET /internal/task/<id>until phase reachescompleted, read the BJ-16 mock request log and assert the expected Bitbucket API calls (comment, PR create, merge) occurred, then POSTpullrequest:fulfilledand assert final task state isclosed. Register the spec under@integration @bitbucketdescribe tag. ReuseCleanupServiceinafterAll.
Verification#
MODULE=bitbucket npm run test:modulepasses against the test instance (AGENT_CORE_URL=http://localhost:8777).- Mock server request log (
atlassianMock.requests()) contains a PR-create, comment, and merge call in expected order. - Both
pullrequest:createdandpullrequest:fulfilleddeliveries land with success status inWebhookDeliveryEntity; final task row reachesclosed.
Risks#
- Prerequisites still open — #550, #551, #555, #556 are all OPEN. The spec cannot import the mock server or webhook-client fixtures until BJ-15 and BJ-16 merge, and the pipeline cannot progress without BJ-10/BJ-11. Implementation must wait for those to land on
rc/atlassian-integration. - Module vs tier naming drift — issue prose says "tier 2d-bitbucket" but the codebase uses module-based organisation (
test/<module>/+MODULE=…env). Plan usesbitbucketas the module name to match convention; legacy2d-bitbucketalias is out of scope.
Open Questions#
- Should the module be tagged
@smoke(runs every PR) or@integration(runs on module-change only)? Plan assumes@integrationgiven the 10+ minute runtime and external mock dependency.