Repository navigation
fix(bitbucket): canonicalize ssh.bitbucket.org remotes in review links and Gitea detection - #30808
Conversation
|
No actionable comments were generated in the recent review. ℹ️ Recent review info
Walkthrough
Priority: Severity of issue fixed: Medium Merge Risk:
|
BichengWang
left a comment
There was a problem hiding this comment.
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]>
6130383 to
bfbb446
Compare
ELI5
Bitbucket Cloud serves SSH from
ssh.bitbucket.org, notbitbucket.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 onhttps://ssh.bitbucket.org/..., which isn't a real website. Now the sidebar treatsssh.bitbucket.orgas Bitbucket and links tobitbucket.org.What Changed
Before: a remote like
ssh://[email protected]/team/project.gitor[email protected]:team/project.gitparsed in the renderer asprovider: nullwithwebBaseUrl: 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 includessh.bitbucket.org.After: those remotes parse as
provider: bitbucketwithwebBaseUrl: https://bitbucket.org/team/project, and the manual review URL ishttps://bitbucket.org/team/project/pull-requests/new?source=...&dest=.... Gitea no longer claimsssh.bitbucket.org.Mechanism:
src/shared/git-remote-host-alias.ts: addsnormalizeBitbucketRemoteHost(ssh.bitbucket.org->bitbucket.org) andnormalizeForgeWebHost, 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, andbitbucket/repository-ref.ts(main) now all use that shared normalizer, replacing their per-filessh.*special cases. When the remote host was an alias, the renderer builds the web origin ashttps://<canonical host>; otherwise it keeps building it from the remote URL as before.gitea/repository-ref.ts: addsssh.bitbucket.orgtoKNOWN_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 asssh.bitbucket.org.example.comare 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):
After (this PR):
Unchanged in both:
altssh.gitlab.com->gitlab.com,ssh.github.com->github.com,ssh.bitbucket.org.example.comstays 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
mainand this branch on macOS (output shown under Visual Proof).Added tests in
source-control-manual-review-url.test.tsfor thessh://, scp-style, and uppercasessh.bitbucket.orgforms (parsed repo plus manual PR URL, with and without a provider hint) and for thessh.github.comSSH-over-443 forms. Added anssh.bitbucket.orgcase to the Gitea non-claim test.pnpm teston 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
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
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)