refactor(source-control): GitHub lives in @t3tools/source-control-github #17607
t3/source-control-bitbucket fromrefs/pull/17607/head·merged by juliusmarminge View on GitHubSixth layer of moving each source control host into its own package; stacks on #17597. GitHub is the last host left in apps/server, so after this every host is a driver.
GitHub support moves into @t3tools/source-control-github, one subpath per module, and reaches the server only through SourceControlHost:
- the REST/GraphQL transport (
GitHubApi), credentials, and quota reserve - the repository provider
- the pull request API and provider, and JSON decoding
- conditional checks and stack actions
Registries. Its driver joins BUILT_IN_SOURCE_CONTROL_DRIVERS. Both SourceControlProviderRegistry.make and PullRequestProviderRegistry.make now just iterate that list, and its order is discovery's order, so the temporary sort from #17592 is gone.
One shared GitHub quota. The built-in drivers' layer now carries GitHubApi.layerWithDependencies, so the server builds one GitHub quota reserve and rate-limit pause shared by the registry, the pull request service, and the asset route.
Smaller changes:
githubQuotais a service module, so it is renamedGitHubQuota.SourceControlHost.gitgainsexecuteandresolveCommit, which GitHub's plain-git checkout needs.TestSourceControlHostSettingslets package tests patch settings the way a client's settings write does. The credentials test uses it to change the pinned account mid-test.
Tests. Tests move with their code, with only imports and wiring changed. Two stay in the server:
- the stack-rebase test, which runs real git through
ServerSourceControlHost measure-pr-preview, which now builds the real host against a scratchServerConfig
Verified with:
tscacross apps/server and all seven packages- knip
- a frozen-lockfile install
- release smoke
- 63 test files (1471 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:
0038475· 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:
942f49cf-4cc4-4e03-b746-22ff61731a65
📥 Commits
Reviewing files that changed from the base of the PR and between 4fbba6d638484508f84a81d9e56cc8526bbc8d33 and 0038475809986e35c57b05693a04ae91b45a7892.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (50)
apps/server/package.jsonapps/server/scripts/evaluate-thread-titles.tsapps/server/scripts/measure-pr-preview.tsapps/server/src/assets/AssetAccess.test.tsapps/server/src/assets/GitHubMediaFetch.tsapps/server/src/git/GitManager.test.tsapps/server/src/pullRequest/PullRequestProviderRateLimit.test.tsapps/server/src/pullRequest/PullRequestProviderRegistry.tsapps/server/src/pullRequest/PullRequestService.tsapps/server/src/server.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/builtInDrivers.tsapps/server/src/sourceControl/githubStackRebase.test.tsapps/server/src/ws.tspackage.jsonpackages/source-control-core/src/server/SourceControlHost.tspackages/source-control-github/package.jsonpackages/source-control-github/src/server/GitHubApi.test.tspackages/source-control-github/src/server/GitHubApi.tspackages/source-control-github/src/server/GitHubCredentials.test.tspackages/source-control-github/src/server/GitHubCredentials.tspackages/source-control-github/src/server/GitHubPullRequestApi.test.tspackages/source-control-github/src/server/GitHubPullRequestApi.tspackages/source-control-github/src/server/GitHubPullRequestProvider.test.tspackages/source-control-github/src/server/GitHubPullRequestProvider.tspackages/source-control-github/src/server/GitHubQuota.test.tspackages/source-control-github/src/server/GitHubQuota.tspackages/source-control-github/src/server/GitHubSourceControlProvider.test.tspackages/source-control-github/src/server/GitHubSourceControlProvider.tspackages/source-control-github/src/server/driver.tspackages/source-control-github/src/server/gitHubAuthStatus.tspackages/source-control-github/src/server/gitHubConditionalChecks.test.tspackages/source-control-github/src/server/gitHubConditionalChecks.tspackages/source-control-github/src/server/gitHubPullRequestJson.test.tspackages/source-control-github/src/server/gitHubPullRequestJson.tspackages/source-control-github/src/server/gitHubPullRequests.tspackages/source-control-github/src/server/gitHubRepositoryResolution.test.tspackages/source-control-github/src/server/gitHubRepositoryResolution.tspackages/source-control-github/src/server/githubGraphQl.test.tspackages/source-control-github/src/server/githubGraphQl.tspackages/source-control-github/src/server/githubStackActions.test.tspackages/source-control-github/src/server/githubStackActions.tspackages/source-control-github/src/server/githubStackRebase.tspackages/source-control-github/tsconfig.jsonpackages/source-control-testing/package.jsonpackages/source-control-testing/src/TestSourceControlHost.tsscripts/release-smoke.ts
💤 Files with no reviewable changes (7)
- packages/source-control-github/src/server/githubGraphQl.test.ts
- packages/source-control-github/src/server/gitHubPullRequests.ts
- packages/source-control-github/src/server/gitHubPullRequestJson.test.ts
- packages/source-control-github/src/server/gitHubRepositoryResolution.ts
- packages/source-control-github/src/server/gitHubRepositoryResolution.test.ts
- packages/source-control-github/src/server/githubGraphQl.ts
- packages/source-control-github/src/server/gitHubAuthStatus.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
📝 Walkthrough
Walkthrough#
The pull request adds a GitHub source-control package and registers its driver with the server’s built-in drivers. GitHub services use the shared source-control host for Git, process, and settings access. Application imports, tests, scripts, and workspace support are updated.
Changes#
GitHub source-control package integration
Layer / File(s) Summary Package surface and host contract
packages/source-control-github/package.json,packages/source-control-github/tsconfig.json,packages/source-control-core/src/server/SourceControlHost.ts,packages/source-control-testing/src/TestSourceControlHost.ts,apps/server/src/sourceControl/ServerSourceControlHost.ts,apps/server/package.json,packages/source-control-testing/package.jsonThe new package defines server exports and scripts. SourceControlHostadds Git execution operations.TestSourceControlHostprovides patchable settings and Git-operation fallbacks. The server host delegates Git operations to the Git driver.GitHub services use SourceControlHost
packages/source-control-github/src/server/*GitHub credential, pull-request, provider, and stack services use package-local modules and SourceControlHostfor process, settings, and Git access. Tests provide the host throughTestSourceControlHost.Register GitHub through built-in drivers
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/*test.tsThe built-in driver list includes GitHub and provides its pull-request service layer. The registries obtain providers from built-in drivers, and server layers provide those drivers. Update application consumers and scripts
apps/server/scripts/*,apps/server/src/assets/*,apps/server/src/git/GitManager.test.ts,apps/server/src/pullRequest/*,scripts/release-smoke.tsApplication code and scripts import GitHub services from the package. The preview measurement script provides the source-control host, and release smoke checks copy the new package manifest. Priority: ➖ Normal
Estimated code review effort: 3 (Moderate) | ~30 minutes
Change: Refactor
Merge Risk: ⚪ Minimal · up to
00384This change moves GitHub source-control support into its own package and registers it as a built-in driver. No concrete merge-blocking issue was found in the supplied context.
Pre-merge checks |
3 | 1❌ Failed checks (1 warning)#
Check name Status Explanation Resolution Description check The description gives a detailed change summary and focused verification results, but it does not explicitly provide the required Problem section or Scope and approval evidence. Add an explicit Problem section with expected behavior and relevant context. Add a Scope and approval section with a linked issue or discussion and maintainer approval, or explain why this focused change qualifies for an exemption. ✅ Passed checks (3 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 identifies the main change: moving GitHub source-control functionality into @t3tools/source-control-github.
- Fix all pre-merge checks with AI
✨ 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 this507361b
juliusmarminge closed this
Sign in to join this conversation.
Approvability#
Verdict: Not approved
Macroscope's review found this PR not approvable — The PR moves GitHub source-control and pull-request production code into a new package while restructuring shared driver, host, and layer wiring. Its credential/authentication integration and cross-cutting runtime changes warrant human review despite the largely mechanical moves and updated tests.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).