Skip to content

refactor(source-control): GitManager reads provider resolvers, not host kinds - #17617

Merged
juliusmarminge merged 2 commits into
mainfrom
t3/source-control-gitmanager-capabilities
Oct 9, 2026
Merged

juliusmarminge merged 2 commits into
mainfrom
t3/source-control-gitmanager-capabilities

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

The first cleanup layer. GitManager checked provider.kind === "github" or "forgejo" in four places, so host behavior lived in generic server code. Each check is now a resolver on SourceControlProvider that the host's own package implements. Generic code asks the provider a question; it doesn't test a flag that only one host would ever set.

Resolver Implemented by Replaces
headBranchProbe({ headSelectors, state }) → { headSelectors, limit } GitHub drops owner:branch selectors and reads 100 kind === "github" ? 100 : 1/20 plus the GitHub-only selector filter. Hosts without it ask about every selector, reading 1 (open) or 20 (any state).
readChangeRequestTemplate({ cwd, treeish }) GitHub's .github/pull_request_template.md convention followChangeRequestTemplates && kind === "github"
repositoryNameFromRemoteUrl(url) Forgejo strips an installation mount from HTTP paths providerKind === "forgejo"

Supporting changes:

  • PR template detection moves into the GitHub package. apps/server/src/sourceControl/PrTemplateDetection.ts becomes @t3tools/source-control-github/server/gitHubChangeRequestTemplate and reads through the host's git. SourceControlHost.git.execute now accepts the output limits it needs. Its test stays in the server, because it runs real git.
  • GitHub's reasoning moves with its values. The comments explaining GitHub's probe values now sit in the GitHub package.
  • The remote-path parse moves to core as repositoryPathFromRemoteUrl.
  • bindProviderContext spreads the provider, so new resolvers pass through without editing it.
  • One moved test now follows the Effect conventions. The Forgejo review test came over in refactor(source-control): Forgejo lives in @t3tools/source-control-forgejo #17581 unchanged from main. It faked HTTP with an async fetch behind FetchHttpClient and read request bodies with JSON.parse. It now uses HttpClient.make(...) and decodes through Schema, with the same assertions.

Behavior is unchanged: every host keeps the values it had. Existing tests already pin GitHub's --limit 100, the selector filter, template following, and Forgejo's mounted paths. They pass, and the only edits are to fixtures.

Verified:

  • tsc across apps/server and five packages
  • knip
  • a frozen-lockfile install
  • the tests for the whole open stack: 52 files, 1211 tests
  • the Effect-shortcut grep finds no hits in this layer's added lines

🤖 Generated with Claude Code — Claude Opus 5.5 in T3 Code

@juliusmarminge juliusmarminge changed the title t3/source control gitmanager capabilities refactor(source-control): GitManager reads provider capabilities, not host kinds Oct 9, 2026
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XXL 1,000+ changed lines (additions + deletions). labels Oct 9, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 3fd41c7

Macroscope's review found this PR approvable — This is a contained source-control refactor that moves existing GitHub and Forgejo behavior behind provider capabilities without changing product defaults or introducing new workflows. Updated tests cover the relocated template handling and provider-specific URL behavior.

You can add or adjust custom eligibility rules. Learn more.

@juliusmarminge
juliusmarminge added this pull request to stack #17620 October 9, 2026 22:11
@juliusmarminge
juliusmarminge force-pushed the t3/source-control-gitmanager-capabilities branch 2 times, most recently from e1398d3 to 604a15a Compare October 9, 2026 22:21
@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: 8242d173-47a0-4848-8fb3-6557d9dc4cc6

📥 Commits

Reviewing files that changed from the base of the PR and between 604a15a and 3fd41c7.


📒 Files selected for processing (8)
  • apps/server/src/git/GitManager.test.ts
  • apps/server/src/git/GitManager.ts
  • apps/server/src/sourceControl/gitHubChangeRequestTemplate.test.ts
  • packages/source-control-core/src/server/SourceControlHost.ts
  • packages/source-control-core/src/server/SourceControlProvider.ts
  • packages/source-control-github/package.json
  • packages/source-control-github/src/server/GitHubSourceControlProvider.ts
  • packages/source-control-github/src/server/gitHubChangeRequestTemplate.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.



📝 Walkthrough

Walkthrough

Source-control providers now expose optional capabilities for repository parsing and change-request behavior. GitManager uses provider services to resolve repository names, select head-branch probes, set result limits, and read templates. Forgejo and GitHub provide provider-specific implementations.

Changes

Provider capabilities and GitManager integration

Layer / File(s) Summary
Provider capability contracts
packages/source-control-core/src/server/SourceControlProvider.ts, packages/source-control-core/src/server/SourceControlHost.ts
The provider contract adds shared remote-URL path parsing and optional capabilities for repository names, head-branch probes, and template reading. The Git execution input adds output-size and truncation-marker options.
Provider-specific capabilities
packages/source-control-forgejo/src/server/ForgejoSourceControlProvider.ts, packages/source-control-forgejo/src/server/ForgejoSourceControlProvider.test.ts, packages/source-control-github/src/server/GitHubSourceControlProvider.ts, packages/source-control-github/src/server/gitHubChangeRequestTemplate.ts, packages/source-control-github/package.json, apps/server/src/sourceControl/gitHubChangeRequestTemplate.test.ts
Forgejo registers repository-name parsing, and its review-submission test uses an HttpClient mock. GitHub provides head-branch probe settings and template reading. The GitHub template detector is exported as detect through the package export.
GitManager uses provider capabilities
apps/server/src/sourceControl/SourceControlProviderRegistry.ts, apps/server/src/git/GitManager.ts, apps/server/src/git/GitManager.test.ts
The registry preserves provider service properties. GitManager uses provider services for repository parsing, selector selection, result limits, and template reading. GitManager tests configure provider capabilities and template reading.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor


Merge Risk: ⚪ Minimal · up to 3fd41

The provider-capability change is mergeable after normal checks; no material behavior regression was established.

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 refactor: GitManager now uses provider resolvers instead of host-kind checks.
Description check Passed The description clearly explains the problem, implementation changes, affected capabilities, compatibility behavior, and verification results. It does not provide a separate scope-and-approval referen…


✨ Finishing Touches
📝 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.

@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:XXL 1,000+ changed lines (additions + deletions). labels Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 20.9 KiB 20.9 KiB 0 B (0.0%) 29.3 KiB ✅
Codex Live turn messages 2 2 0 (0.0%) 8 ✅
Claude Total thread wire 5.0 KiB 5.0 KiB +24 B (+0.5%) 6.8 KiB ✅
Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB +24 B (+2.0%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 21.2 KiB 21.2 KiB +41 B (+0.2%) 29.3 KiB ✅
Claude Live turn messages 1 2 +1 (+100.0%) 8 ✅

Baseline: c85dc64 · PR result: 3fd41c7 · 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.

juliusmarminge and others added 2 commits October 9, 2026 16:06
…st kinds

GitManager branched on `provider.kind === "github"` and `"forgejo"` for
four host behaviors. Each one is now a resolver on SourceControlProvider
that the host's own package implements:

- headBranchProbe: which head selectors to ask about and how many results
  to read. GitHub drops `owner:branch` selectors and reads 100; a host
  without one asks about every selector, reading 1 open / 20 any state.
- readChangeRequestTemplate: the repository's PR template. GitHub's
  convention (`.github/pull_request_template.md` and friends) moves from
  apps/server/src/sourceControl/PrTemplateDetection.ts into the GitHub
  package as gitHubChangeRequestTemplate, reading through the host's git.
- repositoryNameFromRemoteUrl: Forgejo keeps only owner/repo from an HTTP
  path with an installation mount.

Generic code asks the provider a question instead of testing a flag that
only one host ever sets. The reasoning for GitHub's values moves into the
GitHub package. The pure remote-path parse moves to core as
repositoryPathFromRemoteUrl. bindProviderContext spreads the provider, so
new resolvers pass through. SourceControlHost.git.execute accepts output
limits, which the template reader needs.

Behavior is unchanged: every host keeps the values it had.

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

The moved Forgejo review test faked HTTP with an async fetch function behind
FetchHttpClient and read request bodies with JSON.parse. It now provides
HttpClient.make and decodes bodies through Schema, with the same assertions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge
juliusmarminge force-pushed the t3/source-control-gitmanager-capabilities branch from 604a15a to 3fd41c7 Compare October 9, 2026 23:13
@juliusmarminge juliusmarminge changed the title refactor(source-control): GitManager reads provider capabilities, not host kinds refactor(source-control): GitManager reads provider resolvers, not host kinds Oct 9, 2026
@juliusmarminge
juliusmarminge merged commit 49f849e into main Oct 9, 2026
31 checks passed
@juliusmarminge
juliusmarminge deleted the t3/source-control-gitmanager-capabilities branch October 9, 2026 23:22
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

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