Skip to content
Source
Sign inSign up
pingdotgg/t3code

refactor(source-control): GitHub lives in @t3tools/source-control-github #17607

Mergedjuliusmarmingemerged 2 commits intot3/source-control-bitbucket fromrefs/pull/17607/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

Sixth 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:

  • githubQuota is a service module, so it is renamed GitHubQuota.
  • SourceControlHost.git gains execute and resolveCommit, which GitHub's plain-git checkout needs.
  • TestSourceControlHostSettings lets 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 scratch ServerConfig

Verified with:

  • tsc across 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

    2. juliusmarminge added labelsmacroscope-review

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      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).
    4. github-actions[bot](GitHub profile, opens in a new tab)commented

      Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire—5.0 KiB—6.8 KiB✅
      CodexThread snapshot wire—3.8 KiB—4.9 KiB✅
      CodexLive turn WebSocket wire—1.2 KiB—2.0 KiB✅
      CodexLive turn WebSocket decoded—20.9 KiB—29.3 KiB✅
      CodexLive turn messages—2—8✅
      ClaudeTotal thread wire—5.0 KiB—6.8 KiB✅
      ClaudeThread snapshot wire—3.8 KiB—4.9 KiB✅
      ClaudeLive turn WebSocket wire—1.2 KiB—2.0 KiB✅
      ClaudeLive turn WebSocket decoded—21.2 KiB—29.3 KiB✅
      ClaudeLive turn messages—2—8✅

      Baseline: unavailable · PR result: 0038475 · 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.

    5. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      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: 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.yaml is excluded by !**/pnpm-lock.yaml

      📒 Files selected for processing (50)
      • apps/server/package.json
      • apps/server/scripts/evaluate-thread-titles.ts
      • apps/server/scripts/measure-pr-preview.ts
      • apps/server/src/assets/AssetAccess.test.ts
      • apps/server/src/assets/GitHubMediaFetch.ts
      • apps/server/src/git/GitManager.test.ts
      • apps/server/src/pullRequest/PullRequestProviderRateLimit.test.ts
      • apps/server/src/pullRequest/PullRequestProviderRegistry.ts
      • apps/server/src/pullRequest/PullRequestService.ts
      • apps/server/src/server.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/builtInDrivers.ts
      • apps/server/src/sourceControl/githubStackRebase.test.ts
      • apps/server/src/ws.ts
      • package.json
      • packages/source-control-core/src/server/SourceControlHost.ts
      • packages/source-control-github/package.json
      • packages/source-control-github/src/server/GitHubApi.test.ts
      • packages/source-control-github/src/server/GitHubApi.ts
      • packages/source-control-github/src/server/GitHubCredentials.test.ts
      • packages/source-control-github/src/server/GitHubCredentials.ts
      • packages/source-control-github/src/server/GitHubPullRequestApi.test.ts
      • packages/source-control-github/src/server/GitHubPullRequestApi.ts
      • packages/source-control-github/src/server/GitHubPullRequestProvider.test.ts
      • packages/source-control-github/src/server/GitHubPullRequestProvider.ts
      • packages/source-control-github/src/server/GitHubQuota.test.ts
      • packages/source-control-github/src/server/GitHubQuota.ts
      • packages/source-control-github/src/server/GitHubSourceControlProvider.test.ts
      • packages/source-control-github/src/server/GitHubSourceControlProvider.ts
      • packages/source-control-github/src/server/driver.ts
      • packages/source-control-github/src/server/gitHubAuthStatus.ts
      • packages/source-control-github/src/server/gitHubConditionalChecks.test.ts
      • packages/source-control-github/src/server/gitHubConditionalChecks.ts
      • packages/source-control-github/src/server/gitHubPullRequestJson.test.ts
      • packages/source-control-github/src/server/gitHubPullRequestJson.ts
      • packages/source-control-github/src/server/gitHubPullRequests.ts
      • packages/source-control-github/src/server/gitHubRepositoryResolution.test.ts
      • packages/source-control-github/src/server/gitHubRepositoryResolution.ts
      • packages/source-control-github/src/server/githubGraphQl.test.ts
      • packages/source-control-github/src/server/githubGraphQl.ts
      • packages/source-control-github/src/server/githubStackActions.test.ts
      • packages/source-control-github/src/server/githubStackActions.ts
      • packages/source-control-github/src/server/githubStackRebase.ts
      • packages/source-control-github/tsconfig.json
      • packages/source-control-testing/package.json
      • packages/source-control-testing/src/TestSourceControlHost.ts
      • scripts/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.json
      The new package defines server exports and scripts. SourceControlHost adds Git execution operations. TestSourceControlHost provides 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 SourceControlHost for process, settings, and Git access. Tests provide the host through TestSourceControlHost.
      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.ts
      The 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.ts
      Application 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 00384

      This 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 | Passed 3 | Failed 1

      ❌ Failed checks (1 warning)

      Check nameStatusExplanationResolution
      Description checkWarningThe 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 nameStatusExplanation
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Title checkPassedThe 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.
    6. juliusmarminge merged this507361b

    7. juliusmarminge closed this

Sign in to join this conversation.