Skip to content
Source
Sign inSign up
pingdotgg/t3code

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

Mergeddarshmahadevia(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/31781/headmerged by juliusmarminge View on GitHub

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.

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. 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](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      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 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.ts
      The pattern accepts a single path component after the host. Tests add gitserver:repo.git as an SSH case and C:repo.git as a non-SSH case.

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

      Change: Bug fix

      Suggested reviewers: marcodotio, juliusmarminge

      Merge Risk: Minimal · up to a3d7e

      Remotes such as gitserver:repo.git are now recognized as SSH, and Windows drive paths stay excluded. No merge-blocking risk was identified.

      Pre-merge checks: Passed 4

      Check nameStatusExplanation
      Title checkPassedThe 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 checkPassedThe 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 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.
      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

      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.

    4. tanstack-source added labelsbug

    5. juliusmarminge added labelstakeover:in-progress

    6. 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.

      BeforeAfter
      dd3d4a4e4aa3d7e1a8f0
      Before: userless SSH hosts missingAfter: all SSH hosts recognized
      Before recordingAfter 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.
    7. juliusmarminge added labelstakeover:ready

    8. juliusmarminge removed labelstakeover:in-progress

    9. juliusmarminge merged thisbee9eb5

    10. juliusmarminge closed this

    11. juliusmarminge removed labelstakeover:ready

Sign in to join this conversation.