Files
plane/apps/web/core/components/integrations
M. PalanikannanandGitHub cad5033eb9 [SILO-1098] feat: Bitbucket Data Center integration (#6272)
* docs: add Bitbucket Data Center integration PRD

* feat(etl): add Bitbucket Data Center ETL module and integration keys

* feat(silo): add Bitbucket Data Center integration controllers and workers

* test(silo): add Bitbucket sync helper and PR comment handler coverage

* feat(packages): add Bitbucket shared types, ETL helpers, constants, and i18n

- Add Bitbucket integration types (packages/types)
- Add Bitbucket ETL sync helpers (packages/etl)
- Add BITBUCKET_INTEGRATION feature flag (packages/constants)
- Add bitbucket_integration i18n translations (packages/i18n)

* refactor(silo): extract store-task-key utility from worker manager

- Extract buildStoreTaskKey/parseStoreTaskKey into dedicated module
- Add unit tests for store-task-key parsing and building
- Simplify manager.ts by delegating key logic to new module
- Fix lint warnings: replace any with unknown, fix misused-promises, floating-promises

* refactor(silo): clean up Bitbucket helpers and extract sync utils to ETL

- Add repoSlug/projectKey fields to webhook payload parsing
- Remove duplicated extractBitbucketBaseUrl and escapeRegExp from sync.ts
- Delegate sync helpers to @plane/etl/bitbucket package

* test(silo): add Bitbucket E2E test suite and reset infrastructure

- Add comprehensive E2E tests for PR state transitions (merge, close, multi-ref)
- Add Bitbucket API helpers for creating branches, PRs, merges in tests
- Add reset-e2e-state script for cleaning up test branches and PRs
- Add test:e2e and e2e:reset npm scripts
- Increase vitest hookTimeout for long-running E2E tests
- Add Bitbucket integration test for ETL package
- Register E2E env vars in turbo.json globalEnv

* feat(web): add Bitbucket Data Center integration frontend

- Add Bitbucket settings page, route, and layout adjustments
- Add Bitbucket authentication flow (connect form, org selection)
- Add PR state mapping UI (create, edit, project mapping)
- Add Bitbucket services, stores, and hooks
- Add Bitbucket to marketplace integrations list and tile
- Add Bitbucket SVG logo asset
- Bypass SILO_INTEGRATIONS feature flag for testing

* fix(bitbucket): sanitize PR comment HTML and fix unsafe JSON.parse type

- Add sanitizeHtml method using sanitizeHTMLThroughSchema to content parser
- Sanitize comment HTML before syncing PR comments to Plane
- Type JSON.parse result as unknown to satisfy no-unsafe-assignment

* fix(silo): clean up PR comment formatting and fix lint warnings

- Only render closing/non-closing sections when they have items
- Remove trailing newlines from linked issue list items
- Replace any types with Record<string, unknown> and proper casts

* feat(bitbucket): add user connection and disconnect API endpoints

- Add GET /auth/user-status/:workspaceId/:userId for connection status
- Add POST /auth/connect-user to connect user via personal access token
- Add POST /auth/user-disconnect/:workspaceId/:userId to disconnect user
- Disable false-positive react-hooks/rules-of-hooks lint for decorator usage

* test(bitbucket): improve E2E test reliability

- Increase poll timeout to 60s and add labels to pollUntil calls
- Add waitForIntegrationIdle helper for settling cascading syncs
- Add idle waits between tests to prevent cross-test interference
- Fix no-base-to-string lint warning in error formatting

* feat(web): add Bitbucket personal account connection UI

- Add TBitbucketUserCredential type for user connection status
- Add auth service methods for fetch/connect/disconnect user credentials
- Add MobX store with userCredentialsMap and related actions
- Add ConnectPersonalAccount component with PAT form and disconnect flow
- Show personal account section only when workspace is connected

* bitbucket frontend

* bitbucket ui repo

* chore: add bidirectional sync toggle

* chore: revert e2e tests, PRD, turbo.json and unrelated silo changes from bitbucket PR

* chore: revert lint changes in silo worker manager, fix isBitbucketEnabled check

* fix: remove bitbucket feature flag overrides, use standard integration pattern

* fix: reusing code and format fix

* fix: type error

* fix: minor bugs

* fix: sanitize Bitbucket colon-separated event types in Redis store keys

Bitbucket event types (e.g. pr:modified, pr:opened) contain colons which
break the TaskManager's Redis key parsing (splits on ':' delimiter).

Sanitize type/jobId in the controller by replacing colons with underscores
for safe key construction. The original event type is preserved in
data.action and read by the worker as the source of truth.

* feat: auto webhook registration and org+user oauth

* fix: format

* refactor: rename bitbucket to bitbucket-dc across entire codebase

Reserve the plain 'bitbucket' namespace for future Bitbucket Cloud integration.

- Enum: BITBUCKET → BITBUCKET_DC, BITBUCKET_USER → BITBUCKET_DC_USER
- Feature flag: BITBUCKET_INTEGRATION → BITBUCKET_DC_INTEGRATION
- i18n key: bitbucket_integration → bitbucket_dc_integration
- Routes: /api/bitbucket/ → /api/bitbucket-dc/
- Workers: bitbucket-webhook → bitbucket-dc-webhook
- Directories: bitbucket/ → bitbucket-dc/ (silo, web)
- Python constants: key/slug/redirect_uri updated
- SWR cache keys, entity connection map, store property renamed

* fix: use underscore in bitbucket_dc integration key for i18n and enum matching

* fix: use underscore in bitbucket_dc app key to match silo enum convention

The Python APPLICATIONS dict used 'bitbucket-dc' (hyphen) as the key,
but getPlaneAppDetails() lowercases the TS enum BITBUCKET_DC to
'bitbucket_dc' (underscore). This caused DB lookups for
'x-bitbucket_dc-id' to miss rows keyed as 'x-bitbucket-dc-id'.

Aligns with github_enterprise/gitlab_enterprise which already use
underscores.

* fix: bitbucket pr link

* try catch for comments

* fix: stopping comment sync

* refactor: resolve PR review comments for Bitbucket DC integration

- Rename migration to 0012_create_bitbucket_dc_app.py
- Remove zod schemas and types/index.ts, use @plane/types directly
- Move constants/helpers out of controller to helpers.ts
- Refactor parseRepositoryReferenceFromEntityData with getFirstString
- Use integrationConnectionHelper instead of raw apiClient
- Inline app-specific types where used

* refactor(bitbucket-dc): address PR review — convention fixes and cleanup

- Remove dead PAT auth routes (connectOrganization, connectUser)
- Delete services/service.ts, create helpers/service.ts using integrationConnectionHelper
- Update helpers/index.ts barrel to export service
- Split bb-plane.worker.ts into event-handlers/ (issue.handler, issue-comment.handler)
- Remove all commented-out code in bitbucket-dc.worker.ts and bb-plane.worker.ts
- Add TBitbucketWorkspaceConnectionConfig, project/webhookId to entity_data in @plane/types
- Create web/core/types/integrations/bitbucket.ts
- Use EBitbucketEntityConnectionType enum in entity.store.ts
- Add clarifying comment for PR reference caching in pr-comment.handler.ts
- Fix unused catch param and require-await lint warnings

* refactor(bitbucket-dc): address remaining PR review comments

- Move disconnect logic from controller to OAuth strategy with webhook cleanup
- Move buildBitbucketService to helpers/service.ts
- Remove 4 duplicate auth/disconnect routes from controller (now via OAuth routes)
- Replace global BITBUCKET_WEBHOOK_SECRET env with per-connection webhookSecret
- Update verifyBitbucketWebhook to use per-connection secret like GitHub Enterprise
- Remove isBitbucketEnabled, treat as always-available like GitHub Enterprise
- Add PROVIDERS_WITH_SHARED_CALLBACK guard in OAuth routes
- Migrate frontend to use BitbucketOAuthService exclusively, remove BitbucketAuthService
- Add webhookSecret field to TBitbucketWorkspaceConnectionData.appConfig type

* fix(bitbucket-dc): resolve oauth guard and sync review feedback

* feat(bitbucket-dc): webhook secret end-to-end, multi-tenant webhook resolution, reuse ETL types

- Add webhookSecret field to connect form, auth service, auth store, and BitbucketOAuthConfig type
- Persist webhookSecret through OAuth strategy into workspace connection data
- Replace base-URL-only webhook resolution with repository-aware resolver
  (resolveBitbucketWorkspaceConnectionForWebhook) to fix multi-tenant risk
- Replace local PullRequestWebhookActions with BitbucketPullRequestWebhookAction from @plane/etl
- Export decodeOAuthState/encodeOAuthState from ETL and reuse in strategy, controller, routes

* fix(bitbucket-dc): add commented-out comment sync wiring for future enablement

* fix(bitbucket-dc): format connect-form.tsx

* fix: webhooksecret

* fix: migration now points properly

* fix: placeholder fix
2026-03-18 21:38:06 +05:30
..