refactor(source-control): Bitbucket lives in @t3tools/source-control-bitbucket #17597
t3/source-control-gitlab fromrefs/pull/17597/head·merged by juliusmarminge View on GitHubThis is the fifth layer of moving each source control host into its own package. It stacks on #17594.
Bitbucket support moves into @t3tools/source-control-bitbucket, one subpath per module:
- the REST client (
BitbucketApi) - the repository provider
- the pull request API and provider
- the JSON decoding
Its driver joins BUILT_IN_SOURCE_CONTROL_DRIVERS. Neither registry, server.ts, nor ws.ts names Bitbucket any more. GitHub is the only host left in the server.
SourceControlHost gains a git facet. Bitbucket is the first host that needs git directly: it finds its repository from the checkout's remotes and checks out pull requests with plain git. The facet holds only the operations that requires:
readConfigValue,resolvePrimaryRemoteName,ensureRemotelistLocalBranchNames,fetchRemoteBranch,fetchRemoteTrackingBranch,setBranchUpstream,switchRefremotes
remotes has two stages: resolving the repository and listing its remotes. That keeps BitbucketRepositoryVcsResolveError and BitbucketRepositoryRemotesListError distinct, so its error messages are unchanged. The server implements the facet with GitVcsDriver and VcsDriverRegistry. TestSourceControlHost fails any git call a test did not supply.
The BitbucketApi test stays in apps/server. It runs the real ServerSourceControlHost with mocked git services and asserts which of them the API calls. The other Bitbucket tests move with their code, with only imports and wiring changed.
Verified with:
tsc(apps/server and the packages)- knip
- a frozen-lockfile install
- release smoke
- 59 test files (1405 tests)
🤖 Generated with Claude Code — Claude Opus 5.5 in T3 Code
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
juliusmarminge added labelsmacroscope-review
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
ℹ️ No successful
mainbaseline artifact is available yet. This run establishes the initial measurement.Provider Metric Main baseline This PR Impact PR ceiling Codex Total thread wire — 5.0 KiB — 6.8 KiB ✅ Codex Thread snapshot wire — 3.8 KiB — 4.9 KiB ✅ Codex Live turn WebSocket wire — 1.2 KiB — 2.0 KiB ✅ Codex Live turn WebSocket decoded — 20.9 KiB — 29.3 KiB ✅ Codex Live turn messages — 2 — 8 ✅ Claude Total thread wire — 5.0 KiB — 6.8 KiB ✅ Claude Thread snapshot wire — 3.8 KiB — 4.9 KiB ✅ Claude Live turn WebSocket wire — 1.2 KiB — 2.0 KiB ✅ Claude Live turn WebSocket decoded — 21.2 KiB — 29.3 KiB ✅ Claude Live turn messages — 2 — 8 ✅ Baseline: unavailable · PR result:
db90eb5· Source CI: successScenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
- Codex decoded thread snapshot: 108.5 KiB
- Claude decoded thread snapshot: 108.8 KiB
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Team
- Run ID:
622bc15b-5c4b-4eb8-81c7-49d91a42054b
📥 Commits
Reviewing files that changed from the base of the PR and between b108c251b38292982175658c60ea7172f5423ebf and db90eb506efd5e6c992b42a4b5c383d329f38d56.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (32)
apps/server/package.jsonapps/server/scripts/evaluate-thread-titles.tsapps/server/src/pullRequest/PullRequestProviderRateLimit.test.tsapps/server/src/pullRequest/PullRequestProviderRegistry.tsapps/server/src/server.tsapps/server/src/sourceControl/BitbucketApi.test.tsapps/server/src/sourceControl/ServerSourceControlHost.tsapps/server/src/sourceControl/SourceControlDiscovery.test.tsapps/server/src/sourceControl/SourceControlProviderRegistry.test.tsapps/server/src/sourceControl/SourceControlProviderRegistry.tsapps/server/src/sourceControl/SourceControlRepositoryService.test.tsapps/server/src/sourceControl/SourceControlRepositoryService.tsapps/server/src/sourceControl/builtInDrivers.tsapps/server/src/ws.tsdocs/internals/pull-request-file-revisions.mdpackage.jsonpackages/source-control-bitbucket/package.jsonpackages/source-control-bitbucket/src/server/BitbucketApi.tspackages/source-control-bitbucket/src/server/BitbucketPullRequestApi.test.tspackages/source-control-bitbucket/src/server/BitbucketPullRequestApi.tspackages/source-control-bitbucket/src/server/BitbucketPullRequestProvider.test.tspackages/source-control-bitbucket/src/server/BitbucketPullRequestProvider.tspackages/source-control-bitbucket/src/server/BitbucketSourceControlProvider.test.tspackages/source-control-bitbucket/src/server/BitbucketSourceControlProvider.tspackages/source-control-bitbucket/src/server/bitbucketPullRequestJson.test.tspackages/source-control-bitbucket/src/server/bitbucketPullRequestJson.tspackages/source-control-bitbucket/src/server/bitbucketPullRequests.tspackages/source-control-bitbucket/src/server/driver.tspackages/source-control-bitbucket/tsconfig.jsonpackages/source-control-core/src/server/SourceControlHost.tspackages/source-control-testing/src/TestSourceControlHost.tsscripts/release-smoke.ts
💤 Files with no reviewable changes (8)
- packages/source-control-bitbucket/src/server/bitbucketPullRequestJson.test.ts
- packages/source-control-bitbucket/src/server/BitbucketSourceControlProvider.test.ts
- packages/source-control-bitbucket/src/server/bitbucketPullRequests.ts
- apps/server/src/ws.ts
- packages/source-control-bitbucket/src/server/BitbucketPullRequestProvider.ts
- packages/source-control-bitbucket/src/server/BitbucketSourceControlProvider.ts
- packages/source-control-bitbucket/src/server/bitbucketPullRequestJson.ts
- apps/server/src/sourceControl/SourceControlProviderRegistry.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
📝 Walkthrough
Walkthrough#
The change moves Bitbucket source-control and pull-request components into a dedicated workspace package, registers its driver with built-in drivers, and routes provider Git operations through an expanded
SourceControlHostinterface. Server wiring and tests use the package exports, and the test host supports explicit Git-operation overrides.Changes#
Bitbucket source-control package integration
Layer / File(s) Summary SourceControlHost Git interface
packages/source-control-core/src/server/SourceControlHost.ts,apps/server/src/sourceControl/ServerSourceControlHost.ts,packages/source-control-testing/src/TestSourceControlHost.ts, related testsSourceControlHostadds Git-operation contracts. The server host delegates these operations to the Git driver and resolves the VCS driver for remote listing. The test host accepts optional Git-operation overrides and fails on unexpected calls.Bitbucket package and driver
packages/source-control-bitbucket/*,apps/server/package.json,apps/server/src/sourceControl/BitbucketApi.test.ts,scripts/release-smoke.tsA new workspace package exports Bitbucket server modules and defines a Bitbucket driver. BitbucketApiusesSourceControlHostfor settings and Git access, including remote discovery. Package tests and release-smoke workspace files are updated.Server driver registration
apps/server/src/sourceControl/builtInDrivers.ts,apps/server/src/sourceControl/SourceControlProviderRegistry.ts,apps/server/src/pullRequest/PullRequestProviderRegistry.ts,apps/server/src/server.ts,apps/server/src/ws.ts,apps/server/src/sourceControl/SourceControlRepositoryService.ts, related tests,apps/server/scripts/evaluate-thread-titles.ts,docs/internals/pull-request-file-revisions.mdBitbucket joins the built-in driver registrations. Direct Bitbucket provider construction and API-layer wiring are removed from the server registries. Server code and tests resolve Bitbucket modules through package exports. Priority: ➖ Normal
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Refactor
Merge Risk: ⚪ Minimal · up to
db90eThis refactor moves Bitbucket support into its own package and registers it through the built-in drivers. No concrete merge-blocking risk was identified in the supplied changes.
Pre-merge checks |
4✅ Passed checks (4 passed)
Check name Status Explanation Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Title check The title clearly and concisely describes the main change: moving Bitbucket support into the dedicated source-control package. Description check The description clearly explains the problem, implementation, affected components, and verification results. It does not include an explicit Scope and approval section or approval link, but the remain…
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
- Commit to this branch
- Create a new PR
📝 Generate docstrings
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
- Commit to this branch
- Create a new PR
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment `@coderabbitai help` to get the list of available commands.juliusmarminge merged this8d1858d
juliusmarminge closed this
Sign in to join this conversation.
Approvability#
Verdict: Not approved
Macroscope's review found this PR not approvable — This relocates Bitbucket support while changing shared source-control host contracts, provider-driver registration, layer construction, and credential access boundaries. The behavior is intended to remain equivalent, but the cross-cutting infrastructure refactor warrants human review.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).