Skip to content

fix(bitbucket): canonicalize ssh.bitbucket.org remotes in review links and Gitea detection - #30808

Merged
nwparker merged 1 commit into
stablyai:mainfrom
ejunker:fix/bitbucket-ssh-host
Oct 28, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
ejunker:fix/bitbucket-ssh-host

Conversation

@ejunker

@ejunker ejunker commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Bitbucket Cloud serves SSH from ssh.bitbucket.org, not bitbucket.org. Orca's main process already learned that in #31002, but the Source Control sidebar has its own small remote parser that still didn't. For those repos, the sidebar didn't recognize Bitbucket and built "open a pull request" links on https://ssh.bitbucket.org/..., which isn't a real website. Now the sidebar treats ssh.bitbucket.org as Bitbucket and links to bitbucket.org.

What Changed

Before: a remote like ssh://[email protected]/team/project.git or [email protected]:team/project.git parsed in the renderer as provider: null with webBaseUrl: https://ssh.bitbucket.org/team/project, so the manual "create PR" link pointed at the SSH host. Gitea's known-non-Gitea host list also didn't include ssh.bitbucket.org.

After: those remotes parse as provider: bitbucket with webBaseUrl: https://bitbucket.org/team/project, and the manual review URL is https://bitbucket.org/team/project/pull-requests/new?source=...&dest=.... Gitea no longer claims ssh.bitbucket.org.

Mechanism:

  • src/shared/git-remote-host-alias.ts: adds normalizeBitbucketRemoteHost (ssh.bitbucket.org -> bitbucket.org) and normalizeForgeWebHost, which runs the GitHub (ssh.github.com), GitLab (altssh.gitlab.com), and Bitbucket alias folds in one place.
  • remote-repo.ts (renderer), hosted-remote-url.ts, and bitbucket/repository-ref.ts (main) now all use that shared normalizer, replacing their per-file ssh.* special cases. When the remote host was an alias, the renderer builds the web origin as https://<canonical host>; otherwise it keeps building it from the remote URL as before.
  • gitea/repository-ref.ts: adds ssh.bitbucket.org to KNOWN_NON_GITEA_HOSTS.

Why

#31002 fixed provider detection in the main process, but the renderer's manual-review link path still had its own alias list, and that list had drifted. Running every consumer through one forge host normalizer keeps the main-process and renderer answers the same, and the next SSH alias only has to be added in one place. Project identity keys (git-remote-identity.ts) are untouched, so existing projects aren't re-keyed. Lookalike hosts such as ssh.bitbucket.org.example.com are still not treated as Bitbucket, because the match is exact.

Original fix by @ejunker in #30808 (authorship preserved; a maintainer follow-up consolidated the alias handling into the shared normalizer).

Linked Issue

Fixes #30783

Visual Proof

N/A: nothing in the UI looks different. Only the provider and URL Orca derives from a remote change. Output from a parser probe on parseRemoteRepo:

Before (main):

ssh://[email protected]:22/team/project.git => {"provider":null,"path":"team/project","webBaseUrl":"https://ssh.bitbucket.org/team/project"}
ssh://[email protected]/team/project      => {"provider":null,"path":"team/project","webBaseUrl":"https://SSH.Bitbucket.org/team/project"}

After (this PR):

ssh://[email protected]:22/team/project.git => {"provider":"bitbucket","path":"team/project","webBaseUrl":"https://bitbucket.org/team/project"}
ssh://[email protected]/team/project      => {"provider":"bitbucket","path":"team/project","webBaseUrl":"https://bitbucket.org/team/project"}

Unchanged in both: altssh.gitlab.com -> gitlab.com, ssh.github.com -> github.com, ssh.bitbucket.org.example.com stays unrecognized, and self-hosted Gitea and Bitbucket Server URLs keep their own origin.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Ran the probe above against main and this branch on macOS (output shown under Visual Proof).

  • Added tests in source-control-manual-review-url.test.ts for the ssh://, scp-style, and uppercase ssh.bitbucket.org forms (parsed repo plus manual PR URL, with and without a provider hint) and for the ssh.github.com SSH-over-443 forms. Added an ssh.bitbucket.org case to the Gitea non-claim test.

  • pnpm test on the gitea, bitbucket, hosted-remote-url, source-control review, and manual-review-url suites: 18 files and 142 tests pass.

  • oxlint (default, anti-slop, and code-quality native plugins), ast-grep, oxfmt, and the changed-code quality gate are clean on all touched files.

  • This is pure string parsing with no platform-specific code. Remote SSH, mobile, and mixed-version clients are unaffected because no wire or storage format changes.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

These are pure host-string normalization changes. Matching is exact, so lookalike hosts are not misclassified.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 90ac8288-37f9-4d68-b105-141aa9f39f80
📥 Commits

Reviewing files that changed from the base of the PR and between 30f5bef and 6130383.

📒 Files selected for processing: 9
  • src/main/bitbucket/repository-ref.test.ts
  • src/main/bitbucket/repository-ref.ts
  • src/main/git/hosted-remote-url.test.ts
  • src/main/git/hosted-remote-url.ts
  • src/main/gitea/repository-ref.test.ts
  • src/main/gitea/repository-ref.ts
  • src/renderer/src/components/right-sidebar/source-control/review/remote-repo.test.ts
  • src/renderer/src/components/right-sidebar/source-control/review/remote-repo.ts
  • src/shared/git-remote-host-alias.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.

Walkthrough

The change adds host normalization for ssh.bitbucket.org and applies it to backend and renderer Bitbucket remote parsing. URL-style and SCP-style SSH remotes are recognized as Bitbucket remotes. Generated web URLs use the canonical bitbucket.org host. Gitea parsing excludes ssh.bitbucket.org.

Priority: Normal

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 61303

SSH remotes using the new Bitbucket hostname are recognized while generated browser links remain canonical. No concrete merge risk is established in the supplied review context.

Pre-merge checks: Passed 4
Check name Status Explanation
Linked Issues check Passed The changes satisfy issue #30783. normalizeBitbucketRemoteHost maps ssh.bitbucket.org to canonical bitbucket.org. Provider detection, Bitbucket repository parsing, and renderer remote parsing su…
Out of Scope Changes check Passed The changes remain within issue #30783. The shared normalizer, provider exclusions, renderer handling, and related automated tests directly support Bitbucket detection and canonical links. No unrelate…
Title check Passed The title names the main change: Bitbucket SSH remotes on ssh.bitbucket.org are canonicalized to bitbucket.org in review links and Gitea detection. It matches the changeset, which adds normalizeBitbuc…
Description check Passed The description follows the template well. It includes ELI5, What Changed (before and after), Why, Linked Issue (Fixes #30783), Visual Proof (N/A with reason and parser probe output), Testing with che…
Full details: Linked Issues check

Explanation

The changes satisfy issue #30783. normalizeBitbucketRemoteHost maps ssh.bitbucket.org to canonical bitbucket.org. Provider detection, Bitbucket repository parsing, and renderer remote parsing support both ssh:// and scp-style remotes. Gitea excludes the new host. Tests cover these forms and canonical web links.

Full details: Out of Scope Changes check

Explanation

The changes remain within issue #30783. The shared normalizer, provider exclusions, renderer handling, and related automated tests directly support Bitbucket detection and canonical links. No unrelated implementation or project identity-key changes are included.

Full details: Title check

Explanation

The title names the main change: Bitbucket SSH remotes on ssh.bitbucket.org are canonicalized to bitbucket.org in review links and Gitea detection. It matches the changeset, which adds normalizeBitbucketRemoteHost, updates remote-repo, hosted-remote-url, bitbucket repository-ref, and adds the host to Gitea's known non-Gitea list. The title is in the conventional fix(scope) form and is a single sentence. At 90 characters it is slightly long but still clear.

Full details: Description check

Explanation

The description follows the template well. It includes ELI5, What Changed (before and after), Why, Linked Issue (Fixes #30783), Visual Proof (N/A with reason and parser probe output), Testing with checked boxes, the Agent skill upstream boundary section, Notes, and Checklist. It explains the mechanism and the alternatives considered. The AI Disclosure and Review sections are empty, but the AI Disclosure section can be skipped for non-team contributors, and the Review section is a heading with no content, which is a minor gap.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@BichengWang BichengWang left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 6130383a618491032418bfee8f730d7268654b6e, including all nine changed files and the provider selection/manual PR-link call paths. I found no blocking correctness issue in this change. I checked the existing discussion and inline feedback; there was no earlier review from me or outstanding inline finding to repeat.

I ran 82 offline assertions against the production parsing and URL-building functions. These cover both SSH URL and SCP forms, port 443, mixed-case hostnames, git+ssh, whitespace/trailing slashes, existing bitbucket.org remotes, file/commit/manual PR URLs, and rejection of lookalike hosts such as ssh.bitbucket.org.attacker.test. The alias consistently resolves to Bitbucket, Gitea declines it, and browser URLs use bitbucket.org; GitHub, GitLab, and a custom Gitea host retain their existing results. The same matrix fails immediately on upstream main because the alias returns null.

The validation script mocked only the remote-probe cache factory to avoid loading execution services; it exercised the actual parser and URL-builder implementations. I could not run the repository Vitest suites: the offline install lacks the cached @vitest/[email protected] tarball. No live forge/API or rendered UI validation was performed. The diff adds no OS-specific filesystem/process behavior, wire changes, or persistence changes; SSH-host routing stays in the existing probe layer, and host recognition remains exact rather than suffix-based.

…s and Gitea detection

Fold every forge SSH host alias (ssh.github.com, altssh.gitlab.com,
ssh.bitbucket.org) through one shared normalizeForgeWebHost so main-process
provider detection and renderer manual review links agree. Remotes on
ssh.bitbucket.org now open bitbucket.org pull request forms instead of
ssh.bitbucket.org URLs, and Gitea no longer claims the host.

Co-authored-by: Neil <[email protected]>
@nwparker
nwparker force-pushed the fix/bitbucket-ssh-host branch from 6130383 to bfbb446 Compare October 28, 2026 08:02
@nwparker nwparker changed the title fix(bitbucket): recognize remotes on the ssh.bitbucket.org SSH host fix(bitbucket): canonicalize ssh.bitbucket.org remotes in review links and Gitea detection Oct 28, 2026
@nwparker
nwparker merged commit 780ab3d into stablyai:main Oct 28, 2026
48 of 49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Bitbucket remotes on ssh.bitbucket.org aren't recognized

3 participants