AI Agents SDE Task Viewer
      • Context
      • Plan
      • Prd
  1. Home
  2. AgentSDE
  3. agent-core
  4. gh-554
  5. plan
  6. context.json
context.json(4.6 KB)· Apr 23, 2026
{
  "meta": {
    "agent": "planner",
    "task_id": "554",
    "title": "BJ-14: Unit tests — Bitbucket + Jira services",
    "created_at": "2026-04-23T17:13:47Z"
  },
  "inputs": [
    {
      "name": "issue_554",
      "type": "prompt",
      "ref": "AgentSDE/agent-core#554",
      "notes": "Wave 4 testing task; depends on #548 (BJ-8) and #549 (BJ-9)"
    },
    {
      "name": "github_service_reference",
      "type": "file",
      "ref": "src/github/github.service.ts",
      "notes": "Existing service pattern — fetch + Bearer token + sleep-based 429 retry (lines 524-572)"
    },
    {
      "name": "github_service_spec_reference",
      "type": "file",
      "ref": "src/github/github.service.spec.ts",
      "notes": "Existing spec pattern using jest.spyOn(globalThis, 'fetch'); our specs deviate to nock per issue acceptance criterion"
    },
    {
      "name": "platform_auth_provider",
      "type": "file",
      "ref": "src/platform/platform-auth-provider.interface.ts",
      "notes": "PlatformAuthProvider interface: getToken({owner,repo}), getBotUsername(), platform; injection token PLATFORM_AUTH_PROVIDER"
    },
    {
      "name": "epic_539",
      "type": "link",
      "ref": "AgentSDE/agent-core#539",
      "notes": "Atlassian integration EPIC"
    }
  ],
  "outputs": [
    {
      "name": "bitbucket_spec",
      "type": "test_plan",
      "format": "text",
      "content": "Nest TestingModule with mocked PLATFORM_AUTH_PROVIDER, nock.disableNetConnect() lifecycle, one happy-path test per public BitbucketService method (18 methods), plus shared tests for Bearer header, 429 Retry-After wait+retry, 401 token refresh+retry, 5xx bubble-up."
    },
    {
      "name": "jira_spec",
      "type": "test_plan",
      "format": "text",
      "content": "Same scaffold as bitbucket_spec; base URL https://api.atlassian.com/ex/jira/${JIRA_CLOUD_ID}; 11 public methods; JIRA_CLOUD_ID set/restored in beforeEach/afterEach."
    }
  ],
  "files": [
    {
      "path": "package.json",
      "action": "modify",
      "reason": "Add nock to devDependencies — acceptance criterion requires nock for HTTP mocking"
    },
    {
      "path": "src/bitbucket/bitbucket.service.spec.ts",
      "action": "create",
      "reason": "Unit tests for BitbucketService (to be implemented in #548)"
    },
    {
      "path": "src/jira/jira.service.spec.ts",
      "action": "create",
      "reason": "Unit tests for JiraService (to be implemented in #549)"
    }
  ],
  "steps": [
    {
      "id": "S1",
      "summary": "Add nock devDependency and author BitbucketService unit tests",
      "acceptance": [
        "nock appears in package.json devDependencies and is installed",
        "src/bitbucket/bitbucket.service.spec.ts covers all 18 public methods with happy-path URL/method/body assertions",
        "Tests exist for 429 Retry-After wait+retry, 401 token refresh+retry, 5xx bubble-up, and Bearer header from authProvider.getToken()",
        "nock.disableNetConnect() enforces no real network; PLATFORM_AUTH_PROVIDER is mocked",
        "npm run test -- bitbucket.service.spec passes; npm run lint produces no warnings"
      ],
      "depends_on": []
    },
    {
      "id": "S2",
      "summary": "Author JiraService unit tests",
      "acceptance": [
        "src/jira/jira.service.spec.ts covers all 11 public methods with happy-path URL/method/body assertions",
        "Tests exist for 429 Retry-After wait+retry, 401 token refresh+retry, 5xx bubble-up, and Bearer header from authProvider.getToken()",
        "JIRA_CLOUD_ID is set and restored via beforeEach/afterEach; base URL asserts https://api.atlassian.com/ex/jira/${JIRA_CLOUD_ID}",
        "nock.disableNetConnect() enforces no real network; PLATFORM_AUTH_PROVIDER is mocked",
        "npm run test -- jira.service.spec passes; npm run lint produces no warnings"
      ],
      "depends_on": [
        "S1"
      ]
    }
  ],
  "risks": [
    {
      "risk": "#548 and #549 still OPEN — specs import services that do not yet exist on rc/atlassian-integration",
      "mitigation": "Author on the same branch after #548/#549 merge; rebase and reconcile any signature drift before CI run"
    },
    {
      "risk": "Introducing nock deviates from existing github.service.spec.ts fetch-spy convention",
      "mitigation": "Issue acceptance criterion explicitly mandates nock; isolate the new pattern to the two new files only"
    }
  ],
  "assumptions": [
    "Second consecutive 401 after one refresh bubbles up instead of retrying again",
    "Retry-After header is integer seconds only (matches GitHubService convention at github.service.ts:549)",
    "BitbucketService and JiraService will expose a private sleep() method (or similar) that tests can stub to avoid real delays, matching the GitHubService pattern"
  ],
  "open_questions": [
    "Should test file order (S1 before S2) be preserved, or can both be implemented in parallel once dependencies land?"
  ]
}
Plan