Skip to content

fix(shared): recognize SSH remotes with a single path component - #31781

Open
darshmahadevia wants to merge 1 commit into
pingdotgg:mainfrom
darshmahadevia:fix/single-component-ssh-remotes
Open

darshmahadevia wants to merge 1 commit into
pingdotgg:mainfrom
darshmahadevia:fix/single-component-ssh-remotes

Conversation

@darshmahadevia

Copy link
Copy Markdown

Git 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.ts and SourceControlProvider.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.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 6, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at cb90a27

Macroscope's review found this PR approvable — Recognizes single-component SSH remotes such as 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.

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

@coderabbitai

coderabbitai Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

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 SSH and non-SSH URL cases.

Changes: SSH Remote Detection

Layer / File(s) Summary
Pattern and classification cases
packages/shared/src/sourceControl.ts, packages/shared/src/sourceControl.test.ts
The pattern accepts a single path component after the host. Tests add three expected SSH cases and four expected non-SSH cases.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: marcodotio

Merge Risk: Minimal · up to cb90a

Single-component SSH remotes are recognized. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title clearly describes the main change to SSH remote detection.
Description check Passed The description covers the problem, change, scope, verification results, and unverified cases. It does not use the template's section headings.
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.
Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between c52df24 and cb90a27.

Files selected for processing: 2

  • packages/shared/src/sourceControl.test.ts
  • packages/shared/src/sourceControl.ts

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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant