Skip to content

refactor(source-control): Bitbucket lives in @t3tools/source-control-bitbucket - #17597

Merged
juliusmarminge merged 2 commits into
t3/source-control-gitlabfrom
t3/source-control-bitbucket
Oct 9, 2026
Merged

juliusmarminge merged 2 commits into
t3/source-control-gitlabfrom
t3/source-control-bitbucket

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

This 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, ensureRemote
  • listLocalBranchNames, fetchRemoteBranch, fetchRemoteTrackingBranch, setBranchUpstream, switchRef
  • remotes

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

@juliusmarminge
juliusmarminge added this pull request to stack #17582 October 9, 2026 20:21
@github-actions github-actions Bot added the vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. label Oct 9, 2026
@juliusmarminge juliusmarminge added the macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews label Oct 9, 2026
@github-actions github-actions Bot added the size:L 100-499 changed lines (additions + deletions). label Oct 9, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

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.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ No successful main baseline 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: success

Scenario 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.

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

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 b108c25 and db90eb5.


⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml

📒 Files selected for processing (32)
  • apps/server/package.json
  • apps/server/scripts/evaluate-thread-titles.ts
  • apps/server/src/pullRequest/PullRequestProviderRateLimit.test.ts
  • apps/server/src/pullRequest/PullRequestProviderRegistry.ts
  • apps/server/src/server.ts
  • apps/server/src/sourceControl/BitbucketApi.test.ts
  • apps/server/src/sourceControl/ServerSourceControlHost.ts
  • apps/server/src/sourceControl/SourceControlDiscovery.test.ts
  • apps/server/src/sourceControl/SourceControlProviderRegistry.test.ts
  • apps/server/src/sourceControl/SourceControlProviderRegistry.ts
  • apps/server/src/sourceControl/SourceControlRepositoryService.test.ts
  • apps/server/src/sourceControl/SourceControlRepositoryService.ts
  • apps/server/src/sourceControl/builtInDrivers.ts
  • apps/server/src/ws.ts
  • docs/internals/pull-request-file-revisions.md
  • package.json
  • packages/source-control-bitbucket/package.json
  • packages/source-control-bitbucket/src/server/BitbucketApi.ts
  • packages/source-control-bitbucket/src/server/BitbucketPullRequestApi.test.ts
  • packages/source-control-bitbucket/src/server/BitbucketPullRequestApi.ts
  • packages/source-control-bitbucket/src/server/BitbucketPullRequestProvider.test.ts
  • packages/source-control-bitbucket/src/server/BitbucketPullRequestProvider.ts
  • packages/source-control-bitbucket/src/server/BitbucketSourceControlProvider.test.ts
  • packages/source-control-bitbucket/src/server/BitbucketSourceControlProvider.ts
  • packages/source-control-bitbucket/src/server/bitbucketPullRequestJson.test.ts
  • packages/source-control-bitbucket/src/server/bitbucketPullRequestJson.ts
  • packages/source-control-bitbucket/src/server/bitbucketPullRequests.ts
  • packages/source-control-bitbucket/src/server/driver.ts
  • packages/source-control-bitbucket/tsconfig.json
  • packages/source-control-core/src/server/SourceControlHost.ts
  • packages/source-control-testing/src/TestSourceControlHost.ts
  • scripts/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 SourceControlHost interface. 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 tests
SourceControlHost adds 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.ts
A new workspace package exports Bitbucket server modules and defines a Bitbucket driver. BitbucketApi uses SourceControlHost for 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.md
Bitbucket 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 db90e

This 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 | Passed 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely describes the main change: moving Bitbucket support into the dedicated source-control package.
Description check Passed 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 and others added 2 commits October 9, 2026 14:38
…bitbucket

The Bitbucket REST client, repository provider, pull request API and
provider, and JSON decoding move into their own package. Its driver joins
BUILT_IN_SOURCE_CONTROL_DRIVERS, so neither registry, server.ts nor ws.ts
names Bitbucket.

Bitbucket checks out pull requests and finds its repository with git, so
SourceControlHost gains a git facet: the nine git operations checkout
needs, plus a two-stage remotes lookup that keeps the repository-resolve
and remote-list failures distinct, as Bitbucket reports them. The server
implements it with GitVcsDriver and VcsDriverRegistry;
TestSourceControlHost fails any git call a test did not supply.

The BitbucketApi test stays in the server because it exercises the real
host with mocked git services.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cket API

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge
juliusmarminge force-pushed the t3/source-control-bitbucket branch from b108c25 to db90eb5 Compare October 9, 2026 21:41
@juliusmarminge
juliusmarminge merged commit 8d1858d into main Oct 9, 2026
34 of 54 checks passed
@juliusmarminge
juliusmarminge deleted the t3/source-control-bitbucket branch October 9, 2026 21:50
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Oct 10, 2026
## What's Changed
* chore(deps): upgrade Effect to 4.0.2 by @juliusmarminge in pingdotgg/t3code#17571
* fix(devices): recover stalled video without losing simulator input by @juliusmarminge in pingdotgg/t3code#17566
* fix(web): keep checkout stable while pr actions load by @maria-rcks in pingdotgg/t3code#16625
* fix(mobile): show waiting thread status by @maria-rcks in pingdotgg/t3code#16693
* feat(web): add parent thread breadcrumb navigation by @maria-rcks in pingdotgg/t3code#16666
* fix(server): restart inactivity after snoozed threads wake by @maria-rcks in pingdotgg/t3code#16674
* feat(desktop): passkeys in the in-app browser on macOS by @juliusmarminge in pingdotgg/t3code#16952
* fix(client): load earlier turns works for MCP threads over T3 Connect by @juliusmarminge in pingdotgg/t3code#17599
* refactor(client): sign relay request URLs built from the HttpApi contract by @juliusmarminge in pingdotgg/t3code#17602
* refactor(source-control): add @t3tools/source-control-core by @juliusmarminge in pingdotgg/t3code#17573
* refactor(source-control): Forgejo lives in @t3tools/source-control-forgejo by @juliusmarminge in pingdotgg/t3code#17581
* refactor(source-control): Azure DevOps lives in @t3tools/source-control-azure-devops by @juliusmarminge in pingdotgg/t3code#17592
* refactor(source-control): GitLab lives in @t3tools/source-control-gitlab by @juliusmarminge in pingdotgg/t3code#17594
* refactor(source-control): Bitbucket lives in @t3tools/source-control-bitbucket by @juliusmarminge in pingdotgg/t3code#17597
* refactor(source-control): GitHub lives in @t3tools/source-control-github by @juliusmarminge in pingdotgg/t3code#17607
* refactor(usage): transcript readers come from their drivers by @juliusmarminge in pingdotgg/t3code#17576
* refactor(usage): OpenCode usage comes from provider-opencode by @juliusmarminge in pingdotgg/t3code#17577
* refactor(usage): Cursor account usage comes from provider-cursor by @juliusmarminge in pingdotgg/t3code#17578
* refactor(usage): Antigravity usage is a reader on its driver by @juliusmarminge in pingdotgg/t3code#17579
* refactor(usage): usage readers use Effect FileSystem and SqlClient by @juliusmarminge in pingdotgg/t3code#17615
* fix(web): composer context strip pads both edges evenly by @limineol in pingdotgg/t3code#17562
* test(usage): v4 cache upgrade test waits for the migrated cache write by @Mnigos in pingdotgg/t3code#17553
* feat(mobile): support Duo in the shared iOS app by @juliusmarminge in pingdotgg/t3code#12648
* refactor(source-control): GitManager reads provider resolvers, not host kinds by @juliusmarminge in pingdotgg/t3code#17617
* refactor(source-control): PullRequestService reads GitHub resolvers, not its kind by @juliusmarminge in pingdotgg/t3code#17619
* refactor(source-control): Forgejo identity and Azure DevOps addressing move into their packages by @juliusmarminge in pingdotgg/t3code#17624
* refactor: home directory comes from a HostProcessHomeDirectory reference by @juliusmarminge in pingdotgg/t3code#17628
* refactor(shared): host process references live in a HostProcess module by @juliusmarminge in pingdotgg/t3code#17641
* feat(web): filter PR comments by bots and resolved threads by @juliusmarminge in pingdotgg/t3code#17645
* fix(clients): remove redundant prefix from PR watch status by @extoci in pingdotgg/t3code#17635
* fix(web): pending requests wait until you stop typing by @maria-rcks in pingdotgg/t3code#17637
* fix(models): remove new badges from Claude Opus and Sonnet 5.5 by @extoci in pingdotgg/t3code#17646
* fix(ui): keep focus and selection borders visible across the app by @maria-rcks in pingdotgg/t3code#16675
* fix(mobile): prevent row presses during native back swipes by @juliusmarminge in pingdotgg/t3code#17648
* fix(server): Codex shadow homes replace stray sqlite maintenance locks by @juliusmarminge in pingdotgg/t3code#17663
* feat(desktop): T3 Code can be your default web browser on macOS by @juliusmarminge in pingdotgg/t3code#17587
* test(server): the ACP process-tree test no longer collides with the runner's own pid by @yordis in pingdotgg/t3code#17647
* fix(web): keep branch restore action inline in narrow composers by @Saikrishna1876 in pingdotgg/t3code#14811
* fix(web): composer banner actions stay inline whenever they fit by @maria-rcks in pingdotgg/t3code#17640


**Full Changelog**: pingdotgg/t3code@v0.0.46-nightly.20261009.2886...v0.0.46-nightly.20261010.2908

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.46-nightly.20261010.2908
github-actions Bot added a commit to davidvanderklay/t3code-flake that referenced this pull request Oct 10, 2026
## What's Changed
* chore(deps): upgrade Effect to 4.0.2 by @juliusmarminge in pingdotgg/t3code#17571
* fix(devices): recover stalled video without losing simulator input by @juliusmarminge in pingdotgg/t3code#17566
* fix(web): keep checkout stable while pr actions load by @maria-rcks in pingdotgg/t3code#16625
* fix(mobile): show waiting thread status by @maria-rcks in pingdotgg/t3code#16693
* feat(web): add parent thread breadcrumb navigation by @maria-rcks in pingdotgg/t3code#16666
* fix(server): restart inactivity after snoozed threads wake by @maria-rcks in pingdotgg/t3code#16674
* feat(desktop): passkeys in the in-app browser on macOS by @juliusmarminge in pingdotgg/t3code#16952
* fix(client): load earlier turns works for MCP threads over T3 Connect by @juliusmarminge in pingdotgg/t3code#17599
* refactor(client): sign relay request URLs built from the HttpApi contract by @juliusmarminge in pingdotgg/t3code#17602
* refactor(source-control): add @t3tools/source-control-core by @juliusmarminge in pingdotgg/t3code#17573
* refactor(source-control): Forgejo lives in @t3tools/source-control-forgejo by @juliusmarminge in pingdotgg/t3code#17581
* refactor(source-control): Azure DevOps lives in @t3tools/source-control-azure-devops by @juliusmarminge in pingdotgg/t3code#17592
* refactor(source-control): GitLab lives in @t3tools/source-control-gitlab by @juliusmarminge in pingdotgg/t3code#17594
* refactor(source-control): Bitbucket lives in @t3tools/source-control-bitbucket by @juliusmarminge in pingdotgg/t3code#17597
* refactor(source-control): GitHub lives in @t3tools/source-control-github by @juliusmarminge in pingdotgg/t3code#17607
* refactor(usage): transcript readers come from their drivers by @juliusmarminge in pingdotgg/t3code#17576
* refactor(usage): OpenCode usage comes from provider-opencode by @juliusmarminge in pingdotgg/t3code#17577
* refactor(usage): Cursor account usage comes from provider-cursor by @juliusmarminge in pingdotgg/t3code#17578
* refactor(usage): Antigravity usage is a reader on its driver by @juliusmarminge in pingdotgg/t3code#17579
* refactor(usage): usage readers use Effect FileSystem and SqlClient by @juliusmarminge in pingdotgg/t3code#17615
* fix(web): composer context strip pads both edges evenly by @limineol in pingdotgg/t3code#17562
* test(usage): v4 cache upgrade test waits for the migrated cache write by @Mnigos in pingdotgg/t3code#17553
* feat(mobile): support Duo in the shared iOS app by @juliusmarminge in pingdotgg/t3code#12648
* refactor(source-control): GitManager reads provider resolvers, not host kinds by @juliusmarminge in pingdotgg/t3code#17617
* refactor(source-control): PullRequestService reads GitHub resolvers, not its kind by @juliusmarminge in pingdotgg/t3code#17619
* refactor(source-control): Forgejo identity and Azure DevOps addressing move into their packages by @juliusmarminge in pingdotgg/t3code#17624
* refactor: home directory comes from a HostProcessHomeDirectory reference by @juliusmarminge in pingdotgg/t3code#17628
* refactor(shared): host process references live in a HostProcess module by @juliusmarminge in pingdotgg/t3code#17641
* feat(web): filter PR comments by bots and resolved threads by @juliusmarminge in pingdotgg/t3code#17645
* fix(clients): remove redundant prefix from PR watch status by @extoci in pingdotgg/t3code#17635
* fix(web): pending requests wait until you stop typing by @maria-rcks in pingdotgg/t3code#17637
* fix(models): remove new badges from Claude Opus and Sonnet 5.5 by @extoci in pingdotgg/t3code#17646
* fix(ui): keep focus and selection borders visible across the app by @maria-rcks in pingdotgg/t3code#16675
* fix(mobile): prevent row presses during native back swipes by @juliusmarminge in pingdotgg/t3code#17648
* fix(server): Codex shadow homes replace stray sqlite maintenance locks by @juliusmarminge in pingdotgg/t3code#17663
* feat(desktop): T3 Code can be your default web browser on macOS by @juliusmarminge in pingdotgg/t3code#17587
* test(server): the ACP process-tree test no longer collides with the runner's own pid by @yordis in pingdotgg/t3code#17647
* fix(web): keep branch restore action inline in narrow composers by @Saikrishna1876 in pingdotgg/t3code#14811
* fix(web): composer banner actions stay inline whenever they fit by @maria-rcks in pingdotgg/t3code#17640


**Full Changelog**: pingdotgg/t3code@v0.0.46-nightly.20261009.2886...v0.0.46-nightly.20261010.2908

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.46-nightly.20261010.2908
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant