Repository navigation
fix(projects/sidebar): prefer origin for project identity; prune stale project-group collapse keys - #29792
fix(projects/sidebar): prefer origin for project identity; prune stale project-group collapse keys#29792rizub wants to merge 4 commits into
Conversation
📝 Walkthrough
Severity of issue fixed: Medium Merge Risk: 🟡 Moderate · up to
|
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
224019d8-ed01-4149-ba45-d37cf2201b2e
📒 Files selected for processing: 4
src/renderer/src/components/sidebar/host-section-collapse.tssrc/renderer/src/components/sidebar/worktree-list/listing/use-collapsed-groups.tssrc/shared/project-host-setup-projection.test.tssrc/shared/project-host-setup-projection.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.
| const fromRemote = | ||
| parseGitHubRemoteUrl(repo.gitRemoteIdentity?.remoteUrl) ?? | ||
| parseGitHubCanonicalKey(repo.gitRemoteIdentity?.canonicalKey) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '35,48p;140,230p' src/shared/project-host-setup-projection.ts
sed -n '100,155p' src/shared/git-remote-identity.ts
rg -n 'github.com-work|GHES|enterprise|ssh alias|Host github' src/shared/project-host-setup-projection* src/shared/git-remote-identity* | head -100Repository: stablyai/orca
Length of output: 6757
🏁 Script executed:
set -e
printf '%s\n' '--- projection identity selection ---'
sed -n '1,75p' src/shared/project-host-setup-projection.ts
printf '%s\n' '--- host parsing and normalization ---'
sed -n '135,235p' src/shared/project-host-setup-projection.ts
printf '%s\n' '--- remote normalization ---'
sed -n '1,180p' src/shared/git-remote-identity.ts
printf '%s\n' '--- relevant tests ---'
sed -n '150,380p' src/shared/project-host-setup-projection.test.ts
printf '%s\n' '--- base to head diff for these files ---'
git diff 42dfd813fedb9497e3df23fc100f810e5f4cdab7 7b87869d832c62ea82a0ead58b029da7f2b7a236 -- src/shared/project-host-setup-projection.ts src/shared/git-remote-identity.ts src/shared/project-host-setup-projection.test.tsRepository: stablyai/orca
Length of output: 42625
🏁 Script executed:
set -e
printf '%s\n' '--- alias helper and references ---'
sed -n '1,260p' src/shared/git-remote-host-alias.ts
printf '%s\n' '--- alias helper tests/references ---'
rg -n -F --glob '*.{ts,tsx}' -e 'isUnresolvedSshHostAlias' -e 'normalizeGitHubRemoteHost' -e 'github.com-work' -e 'git-remote-host-alias' src || test "$?" -eq 1
printf '%s\n' '--- focused test blocks ---'
rg -n -F --glob '*.{ts,tsx}' -e 'alias' -e 'SSH' -e 'ssh' src/shared/git-remote-host-alias* src/shared/project-host-setup-projection.test.ts src/shared/git-remote-identity.test.ts || test "$?" -eq 1Repository: stablyai/orca
Length of output: 9451
🏁 Script executed:
set -e
printf '%s\n' '--- GitHub remote identity parsing ---'
sed -n '1,190p' src/main/github/github-remote-identity-parsing.ts
printf '%s\n' '--- parser tests around SSH aliases ---'
sed -n '80,155p' src/main/github/github-remote-identity-parsing.test.ts
printf '%s\n' '--- SSH config alias resolution implementation and callers ---'
rg -n -F --glob '*.{ts,tsx}' -e 'gitHubSshConfigHostAlias' -e 'resolveWithSsh' -e 'resolvedSshHostname' -e 'github.com-work' src/main src/shared || test "$?" -eq 1Repository: stablyai/orca
Length of output: 23071
🏁 Script executed:
set -e
printf '%s\n' '--- remote identity enrichment ---'
sed -n '1,190p' src/main/repo-git-remote-identity-enrichment.ts
printf '%s\n' '--- GitHub SSH alias resolution ---'
sed -n '1,220p' src/main/github/github-ssh-host-alias-resolution.ts
printf '%s\n' '--- GitHub repository identity alias handling ---'
sed -n '220,285p' src/main/github/github-enterprise-repository.tsRepository: stablyai/orca
Length of output: 16574
Resolve SSH aliases before using remote identity.
parseGitHubRemoteUrl accepts github.com-work through the github- prefix. Therefore, [email protected]:org/repo.git can produce github:github.com-work/org/repo and override upstream or avatar metadata. canonicalKey has the same problem because it is derived from the raw remote URL.
When an SSH alias is unresolved, both provider-identity parsers must return null and allow upstream or avatar metadata to provide the fallback. Use the resolved SSH hostname when one is available. Do not reject every non-default SSH host, because direct GHES hosts such as github.acme.test are supported identities.
| const fromRemote = | ||
| parseGitHubRemoteUrl(repo.gitRemoteIdentity?.remoteUrl) ?? | ||
| parseGitHubCanonicalKey(repo.gitRemoteIdentity?.canonicalKey) | ||
| if (fromRemote) { | ||
| return fromRemote | ||
| } |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '1,145p' src/shared/project-host-setup-projection.ts
sed -n '145,250p' src/shared/project-host-setup-projection.ts
rg -n 'gitRemoteIdentity|upstream|gitlab|bitbucket|non-GitHub' src/shared/project-host-setup-projection.test.ts | head -105Repository: stablyai/orca
Length of output: 12000
The origin-first identity selection does not apply to non-GitHub origins.
When gitRemoteIdentity is valid but points to a non-GitHub host, both remote parsers return null. The function then selects the GitHub upstream or avatar identity. getProjectIdentityKey therefore returns github:<upstream> instead of git:<canonicalKey>, so unrelated repositories that share GitHub fork-parent metadata can collide, while the same origin without that metadata receives a different project ID.
The origin-first contract must also use the provider-neutral gitRemoteIdentity when the origin is not a recognized GitHub remote. The fix must preserve GitHub origin parsing and the existing upstream/avatar fallback only when no usable remote identity exists.
Summary
gitRemoteIdentity(origin) over GitHub fork-parentupstream/ parent avatar when deriving project provider identity, so org remotes that are still marked as forks share one project id across Local + VPS hosts.project-group:<uuid>entries incollapsedGroupswhen the group no longer exists, so the TanStack sidebar virtualizer stops measuring ghost rows after group reshuffles.Fixes #29789
Related: #13945, #21309
Why
On multi-host setups,
orca repo addof an org remote that GitHub still lists as a fork was stamped asgithub:<parent>locally while the VPS stayed ongithub:<org>/<repo>. Dual workspaces never merged, andsetup-existing-folderfailed with identity mismatch. Separately, deleting/reparenting project groups left stalecollapsedGroupskeys that corrupted sidebar layout until a manual wipe.Test plan
project-host-setup-projectionunit tests pass (includes new org-fork + dual-host case)org/repoand GitHub parent=user/repoon two hosts → one project with Local + remote setupssetup-existing-folderagainst the org project id succeeds for that foldergitRemoteIdentity) still project as before