fix(shared): recognize SSH remotes with a single path component #31781
main fromrefs/pull/31781/head·merged by juliusmarminge View on GitHubGit accepts gitserver:repo.git as SSH, taking the user from SSH config. T3's shared detector requires a slash inside the repository path, so this valid remote reads as non-SSH and parseGitRemoteHost returns null. The equivalent git@gitserver:repo.git already works.
Allow zero additional path components in the existing matcher. Extend its existing test tables for relative, absolute, and trailing-slash paths and for Windows drive, local path, empty path, and remote-helper exclusions.
This is a very small, focused obvious-bug fix: one regex quantifier rejects an existing transport's valid spelling. It corrects shared SSH detection and host recognition without changing repository identity normalization, SSH alias expansion, contracts, or settings. No frontend component or documentation changes are needed.
Duplicate search covered userless SSH, SCP remotes, and single-component paths. Related work: #29457 added multi-component detection; #14919 expands SSH aliases and normalizes identities; #30798 repairs IPv6 clone conversion. None fixes this matcher.
Verification on macOS arm64, Node 22.20.0, Git 2.54.0; upstream main c52df24d285a:
vp test run packages/shared/src/sourceControl.test.ts: before, 3 failed / 14 passed; after, 17 passed. All three failures were the new valid SSH forms.- Neighboring
sourceControlDefinitions.test.tsandSourceControlProvider.test.ts: 14 passed. vp run check:changed: format, lint, both knip passes, affected typechecks, and focused tests passed. Typechecking emitted existing schema-brand suggestions.git diff --check: passed.
Native Git proof used a temporary GIT_SSH_COMMAND executable that printed arguments and exited without connecting. git ls-remote gitserver:repo.git passed it host gitserver and command git-upload-pack 'repo.git'. Absolute and trailing-slash forms also selected SSH and preserved their paths.
Direct execution of the original and updated modules confirmed:
gitserver:repo.git SSH false -> true; host null -> gitserver
gitserver:/repo.git SSH false -> true; host null -> gitserver
gitserver:repo.git/ SSH false -> true; host null -> gitserver
The production parseGitRemoteHost now returns host/hostname gitserver for each form. Existing multi-component remotes remain SSH; Windows/local paths and remote-helper syntax stay excluded.
Not verified: live SSH authentication/fetches, native Windows/Linux execution, or a running client. This changes no UI markup or styling; proof exercises the parser and its host-resolution consumer directly.
Implemented and verified with GPT-6.1 Sol through the Codex harness in T3 Code.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XS
Approvability#
Verdict: Approved at
cb90a27Macroscope's review found this PR approvable — Recognizes single-component SSH remotes such as
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).gitserver:repo.git, allowing existing host-discovery and transport-selection logic to handle them consistently. The change is narrowly scoped and retains existing Windows-drive and remote-helper exclusions.No actionable comments were generated in the recent review.
Walkthrough
-
The userless SCP-style SSH remote pattern now accepts paths with one or more components. Tests add one SSH case and one non-SSH case.
Changes: SSH Remote Detection
Layer / File(s) Summary Pattern and classification cases
packages/shared/src/sourceControl.ts,packages/shared/src/sourceControl.test.tsThe pattern accepts a single path component after the host. Tests add gitserver:repo.gitas an SSH case andC:repo.gitas a non-SSH case.Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers:
marcodotio,juliusmarminge
Merge Risk:
Minimal · up toa3d7e-
Remotes such as
gitserver:repo.gitare now recognized as SSH, and Windows drive paths stay excluded. No merge-blocking risk was identified.
Pre-merge checks:
4-
Check name Status Explanation Title check The title names the main change: the shared SSH remote detector now accepts SSH remotes whose path has a single component, such as gitserver:repo.git. The raw summary confirms the regex quantifier cha… Description check The description covers the problem, the change, the scope, and verification. The Problem and Change content is clear: Git accepts userless SCP-style SSH remotes with one path component, but the detect… 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. Full details: Title check
-
Explanation
The title names the main change: the shared SSH remote detector now accepts SSH remotes whose path has a single component, such as gitserver:repo.git. The raw summary confirms the regex quantifier change and the added test cases match this scope. The title uses the conventional commit form the template recommends.
Full details: Description check
-
Explanation
The description covers the problem, the change, the scope, and verification. The Problem and Change content is clear: Git accepts userless SCP-style SSH remotes with one path component, but the detector rejects them, so parseGitRemoteHost returns null. The Scope section explains why this is a small obvious-bug fix and links related PRs (
#29457,#14919,#30798) rather than a bug issue, which the template allows when no issue exists. Verification is detailed, with before/after test counts, a native Git proof, and a list of what was not verified. The description does not explicitly state an issue link for the bug, but the template allows an explanation for small obvious fixes, and the author gave one. The description also includes the model and harness line that the template requests. The description is mostly complete and meets the template.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: dd3d4a4
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
03132048-90bd-4b5f-903b-2b077092e30c
Commits-
Reviewing files that changed from the base of the PR and between cb90a27b814ad8da151eacfe1fd2feca4bc13c4d and a3d7e1a8f0d209e8b893f46204d5bd667995dc59.
Files selected for processing: 1-
packages/shared/src/sourceControl.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-
-
tanstack-source added labelsbug
juliusmarminge added labelstakeover:in-progress
Evidence#
Created four one-commit repositories with the reported origins, seeded projects and replay threads through the app commands, opened each in Chromium, and captured actual received git status snapshots. Fresh databases, 1280×800 viewport, light theme on both commits. The labeled observer panel displays received data, not product UI. Base misses the three userless hosts; head recognizes all four as gitserver. scenarios:prove exited 0.
Before After dd3d4a4e4a a3d7e1a8f0 

Before recording After recording Scenario source · Sanitized runner proof
Not shown:
- Windows drive paths, local paths, empty paths, and remote-helper syntax were not exercised in this real-app run; the scenario covered the three reported SSH forms and explicit-user control.
juliusmarminge added labelstakeover:ready
juliusmarminge removed labelstakeover:in-progress
juliusmarminge merged thisbee9eb5
juliusmarminge closed this
juliusmarminge removed labelstakeover:ready
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes