Skip to content

fix(sidebar): render one project-group header per group across paired hosts - #22023

Closed
DoozyX wants to merge 3 commits into
stablyai:mainfrom
DoozyX:fix/merge-cross-host-project-groups
Closed

DoozyX wants to merge 3 commits into
stablyai:mainfrom
DoozyX:fix/merge-cross-host-project-groups

Conversation

@DoozyX

@DoozyX DoozyX commented Sep 21, 2026

Copy link
Copy Markdown

ELI5

If you use Orca on two machines and pair them, every one of your project folders showed up twice in the sidebar. One copy had all your projects in it; the other was empty and did nothing when you clicked it. Now there is just one.

What Changed

Before: with a paired runtime environment connected and host grouping off, each project group rendered twice — tools, tools, work, work. One header held every project (with both machines' worktrees already merged inside each project row); its twin was empty and could not be unfolded. Neither header said which host it came from, so they were indistinguishable.

After: one header per group, holding the projects from both hosts.

Mechanism: project groups are stored and merged per host, keyed by (hostId, groupId) in project-group-catalog.ts. Two machines whose folder scans walked the same directory layout therefore hold two groups per folder — same name, different ids. Projects, meanwhile, already merge across hosts, so the merged project rows bucket under whichever single group id their repo names, leaving the other host's group with a header and no members.

appendProjectGroupSections now folds those copies into one row first:

  • New cross-host-project-group-merge.ts matches copies on the chain of normalized group names up to the root (ids and parentPath are per-host; the name chain is not), and picks a primary — the local copy when there is one, otherwise the oldest by createdAt then id, so the choice is stable across renders.
  • Repos and folder workspaces bucket through that merged identity, and subtree counts, nesting, and the collapse key follow the primary.

Preferring the local copy keeps the persisted collapse key and the header's menu actions (rename/delete/add project) on the host the user is sitting at, instead of round-tripping to a paired machine.

Nothing about the per-host store changes: both copies still exist, still carry their own owner host, and mutations still route through the existing owner routing.

Why

The duplicate header is not merely cosmetic — the empty twin is a dead click target that looks exactly like the real group, and with several groups it doubles the height of the sidebar.

Alternatives considered:

Scope note: the same duplication still shows wherever a flat group list is rendered straight from state.projectGroups — the "move project to group" menu and the new-workspace composer. Called out as follow-up in the issue rather than widened into this PR.

Linked Issue

Fixes #22022

Visual Proof

Before/after screenshots to be attached by the reporter from the paired-host setup that reproduces this (a paired environment is needed to see it at all). The before state is described and shown in #22022.

Testing

  • pnpm test src/renderer/src/components/sidebar — 309 files / 2626 tests pass.

  • New cross-host-project-group-merge.test.ts covers: two-host fold, differently named groups kept apart, full parent-chain matching (a nested tools does not merge with a top-level tools), case/whitespace, stable primary when no copy is local, and a cyclic parent chain.

  • New case in worktree-list-groups-project-groups.test.ts reproduces the report end to end through buildRows (local + runtime:m1 groups, one merged project). Verified it fails on main with the duplicate project-group:remote-group header and passes with the fix.

  • Also covered: a paired host's own group with no local counterpart still renders.

  • pnpm tc:web and the changed-code quality gate pass.

  • Platforms: logic is pure renderer row-building with no path or platform branching; exercised on macOS with one paired runtime environment (the host-id handling is the shared getProjectGroupHostId, which covers SSH and runtime hosts alike).

  • I manually tested these changes locally

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

AI Disclosure

Written with Claude Code (Opus 5); the diagnosis and the approach were reviewed by the author.

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Backwards compatibility: no persisted shape changes. A collapse key recorded against a remote copy's id simply stops matching, so that group renders expanded once — no migration needed.
  • Remote/SSH: groups from SSH-connected hosts go through the same getProjectGroupHostId, so an SSH host's groups merge with the local ones by the same rule.
  • Performance: one extra pass over the project-group list per row build (tens of entries), with memoized identity resolution.
  • Risk: two genuinely unrelated groups that share a name and the same parent chain on two different hosts now render as one row. That is the intended trade — the user could not tell them apart before either — and distinct names or distinct parents keep them separate.

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)

… hosts

Projects merge across hosts, project groups did not. Two hosts whose folder
scans produced same-named groups rendered two identical headers, one of which
held every project row and the other nothing at all — an unfoldable empty row
with no way to tell the two apart.

Fold the per-host copies of a group into one row, matched on the chain of
names up to the root, and bucket repos and folder workspaces through that
merged identity. The local copy owns the row when there is one, so the
collapse key and menu actions stay on the host the user is sitting at.

Fixes stablyai#22022
@DoozyX
DoozyX force-pushed the fix/merge-cross-host-project-groups branch from 4e49260 to 821ae87 Compare September 21, 2026 15:35
@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

📝 Walkthrough

Walkthrough

The sidebar now merges project-group copies across hosts by normalized name and parent-chain identity. It assigns collision-safe row IDs when hosts reuse group IDs. Repository, folder-workspace, search, and reveal paths use host-scoped lookups and merged row IDs. Tests cover cross-host rendering, duplicate IDs, hierarchy, cycles, lookup resolution, and navigation.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to 51a96

When project-group metadata is temporarily unavailable for one host, its repository can be hidden or shown under another host's group. Use a collision-safe unresolved key before merging.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the user impact, mechanism, rationale, scope, linked issue, testing, and checklist status. However, the required visual proof for this UI behavior change is not attached; the … Attach before-and-after screenshots or a video from the paired-host setup, then mark the visual proof checklist item as complete. If visual proof cannot be provided, use N/A only if the change has no visual or interaction impact, which do…
Docstring Coverage ⚠️ Warning Docstring coverage is 48.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 25 functions across 10 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: rendering one project-group header across paired hosts.
Linked Issues check ✅ Passed Issue #22022 requires one sidebar header for matching project groups across paired hosts, with projects from both hosts under that header. The merge logic matches normalized names and complete parent …
Out of Scope Changes check ✅ Passed The changed source files and tests support issue #22022. Host-scoped lookup changes prevent incorrect group resolution when hosts reuse IDs. Reveal, collapse, row-key, and command-palette changes keep…
Full details: Description check

Explanation

The description explains the user impact, mechanism, rationale, scope, linked issue, testing, and checklist status. However, the required visual proof for this UI behavior change is not attached; the text only says screenshots will be added.

Resolution

Attach before-and-after screenshots or a video from the paired-host setup, then mark the visual proof checklist item as complete. If visual proof cannot be provided, use N/A only if the change has no visual or interaction impact, which does not apply here.


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 24d4a322-7b5d-451f-b72e-7491fc3bbfbf

📥 Commits

Reviewing files that changed from the base of the PR and between 4aaa6c7 and 821ae871463d28446f3f9403e3a4fae9b505de33.

📒 Files selected for processing (4)
  • src/renderer/src/components/sidebar/worktree-list-groups-project-groups.test.ts
  • src/renderer/src/components/sidebar/worktree-list/grouping/cross-host-project-group-merge.test.ts
  • src/renderer/src/components/sidebar/worktree-list/grouping/cross-host-project-group-merge.ts
  • src/renderer/src/components/sidebar/worktree-list/grouping/project-group-sections.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

The sidebar fix itself is sound, but two things should be settled before merge: the branch carries nine unrelated commits (~3.7k added lines across the skills and emulator subsystems) that would land under a fix(sidebar) title, and the merged header key diverges from the collapse/reveal/palette key helpers for rows owned by the non-primary host copy.

Reviewed changes

Reviewed the full branch diff (48 files, 10 commits) against main.

  • Cross-host project-group merge — new cross-host-project-group-merge.ts folds same-identity group copies from different hosts into one MergedProjectGroup (primary = the local copy, else the oldest by createdAt/id); project-group-sections.ts resolves repo and folder-workspace buckets, child parents, and the header/collapse key through that primary.
  • Tests — merge unit tests plus an end-to-end buildRows case that reproduces the duplicate project-group:remote-group header from #22022.
  • Skills port (unrelated to the title) — ports brainstorming, debug, delivery, review, tdd, verify from agent-deck, adds stubs/guides, regenerates resources/skills/*, and gives the orchestration coordinator a context lifecycle.
  • Emulator (unrelated to the title) — adds serve-sim-simulatorkit-link.ts to symlink SimulatorKit.framework from the installed Xcode.

⚠️ Nine unrelated commits ride along with the sidebar fix

The branch is 10 commits ahead of main; only 4e492608d2 is the sidebar fix. The other nine are a separate skills port and an emulator change, all authored the same day on a base that already carried them. Merging this PR as-is lands all of it under a fix(sidebar) title, and the "small and focused" checklist box does not reflect the actual diff. If these were meant to be separate, rebase the sidebar commit onto main (or retarget the PR base at the branch that owns the other work).

Technical details
# Unrelated commits in the PR range

## Affected sites
- `skill-guides/*`, `skill-stubs/*`, `skills/*/SKILL.md`, `resources/skills/current-manifest.json`,
  `resources/skills/snapshot-registry.json`, `config/scripts/*skill-guidance*.mjs`,
  `config/scripts/generate-bundled-skill-guides.mjs` — skills port, ~45 files.
- `src/main/emulator/serve-sim-simulatorkit-link.ts` and
  `src/main/emulator/serve-sim-simulatorkit-link.test.ts` — new Xcode SimulatorKit linking.
- `src/cli/bundled-skill-guides.ts` — regenerated bundled guides.

## Required outcome
- The PR should contain only the sidebar fix, or its title/body/checklist should
  describe the full scope.

## Suggested approach
- Rebase `fix/merge-cross-host-project-groups` onto current `main` keeping only
  `4e492608d2`, or split the other nine commits into their own PR(s).

ℹ️ Same-host duplicate names now merge

Because the merge identity is the name chain and ignores the host, two groups on the same host that share a name and parent chain (e.g. two folder-scan roots both named platform under different parentPaths) now render as one row. That is a wider behavior change than the two-host case the PR risk note describes; it is probably acceptable, but worth stating explicitly. The new case/whitespace test locks it in.

Technical details
# Same-host dedup is implicit

## Affected sites
- `src/renderer/src/components/sidebar/worktree-list/grouping/cross-host-project-group-merge.ts:29,42` — identity uses the `name` chain only.
- `cross-host-project-group-merge.test.ts:91-98` — asserts two local (`'Adaptam'` / `' adaptam '`) copies merge.

## Required outcome
- Either document that same-host same-name groups intentionally collapse, or include
  the host in the identity so only cross-host copies merge.

## Open questions for the human
- Are duplicate same-name groups on one host a supported state, or already prevented in the UI?

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ The branch was rebased to a single commit — the nine unrelated skills/emulator commits are gone and the PR is now 4 files, all sidebar. That resolves the scope concern from the prior review.

Reviewed changes

This pass reviewed the rebased head 821ae87 (1 commit, 4 files). The sidebar source is byte-identical to the version examined at 4e49260, so the two inline findings from the prior review still stand and are not repeated here.

ℹ️ Prior inline findings remain open at this head

The rebase changed no sidebar code, so both earlier comments still apply unchanged: the merged header key (project-group:<primaryId>) diverges from the raw-id keys used by the collapse/reveal helpers and the Cmd+J palette, and the merge identity joins name segments with an unescaped /.

Technical details
# Unchanged since the prior review

## Affected sites
- `src/renderer/src/components/sidebar/worktree-list/grouping/project-group-sections.ts:37-44,119` — header/collapse key uses `primary.id` (unchanged).
- `src/renderer/src/components/sidebar/worktree-list/grouping/cross-host-project-group-merge.ts:42` — `${parentIdentity}/${name}` (unchanged).
- `src/renderer/src/components/sidebar/worktree-list/grouping/worktree-group-keys.ts:62-79`,
  `navigation/reveal-ancestors.ts:48-65`, `navigation/folder-reveal.ts:75-87`,
  `components/cmd-j/palette-project-results.ts:84-97` — still derive keys from raw ids.

## Required outcome
- Same as the prior review; see review #5268922627.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

…t group

Review follow-ups on the cross-host group merge:

- Collapse/reveal/palette keys came from the raw per-host group id while the
  header renders the merged primary's, so revealing a row owned by the paired
  host never expanded its header and its palette entry dead-ended.
- Group ids are unique per host, not globally. Membership now resolves through
  (host, id), and an id two hosts reuse for different rows resolves to neither
  instead of guessing.
- Two same-named groups on one host are two real groups; an identity a single
  host claims twice no longer merges at all.
- Identity segments are length-prefixed: a folder-scan group name is a relative
  path, so `packages/shared` and `shared` under `packages` used to collide.
@DoozyX

DoozyX commented Sep 21, 2026

Copy link
Copy Markdown
Author

Follow-up commit ff114a1 resolves all four review findings; each thread has a reply with the specifics.

  • Reveal/collapse/palette keys (pullfrog, major) — the three key helpers and the Cmd+J palette now resolve a raw group id to the merged primary through a shared memoized index, so their key space matches the rendered header. Covered by a test that fails without the change.
  • Host scope through membership (CodeRabbit, major) — lookups are keyed on (hostId, groupId); an id two hosts reuse for different rows resolves to neither instead of guessing.
  • Same-host duplicates (CodeRabbit, minor) — an identity a single host claims twice is left entirely unmerged; only cross-host copies fold.
  • Identity encoding (pullfrog, minor) — segments are length-prefixed, so a folder-scan group literally named packages/shared no longer collides with shared under packages.

Also confirmed working against the real reproduction: a local build of this branch is installed on the reporter's machine with the paired m1 host, and each group now renders once.

Verification: pnpm test src/renderer/src/components/sidebar src/renderer/src/components/cmd-j — 326 files / 2821 tests pass; pnpm tc:web and the changed-code quality gate clean.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: d9e142e8-2488-4d65-ace8-bbf73b668856

📥 Commits

Reviewing files that changed from the base of the PR and between 821ae871463d28446f3f9403e3a4fae9b505de33 and ff114a11a096bc3e3ee4e02f0d735c7552d47526.

📒 Files selected for processing (8)
  • src/renderer/src/components/cmd-j/palette-project-results.ts
  • src/renderer/src/components/sidebar/worktree-list-groups-nested-project-groups.test.ts
  • src/renderer/src/components/sidebar/worktree-list/grouping/cross-host-project-group-merge.test.ts
  • src/renderer/src/components/sidebar/worktree-list/grouping/cross-host-project-group-merge.ts
  • src/renderer/src/components/sidebar/worktree-list/grouping/project-group-sections.ts
  • src/renderer/src/components/sidebar/worktree-list/grouping/worktree-group-keys.ts
  • src/renderer/src/components/sidebar/worktree-list/navigation/folder-reveal.ts
  • src/renderer/src/components/sidebar/worktree-list/navigation/reveal-ancestors.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found. Both prior findings are addressed cleanly at ff114a1.

Reviewed changes

Reviewed the delta from the prior pullfrog review (821ae87) to ff114a1 (8 files touched by this commit) against main.

  • Merged identity index — cross-host-project-group-merge.ts gained buildMergedProjectGroupIndex, memoized on the project-group array identity, exposing a host-scoped lookup and an id-only lookup that returns null when two hosts reuse one id for different rows, plus findMergedProjectGroup / resolveMergedProjectGroupId.
  • Host-aware bucketing — project-group-sections.ts resolves repo and folder-workspace group ids through the merged index using each row's owning host, and derives child parents from the primary.
  • Key alignment — getGroupKeysForWorktree, getSidebarRowRevealAncestorKeys, getFolderWorkspaceRevealGroupKeys, and the Cmd+J palette now resolve raw ids to the merged primary, closing the collapse/reveal/palette divergence flagged in the prior review.
  • Identity encoding — name-chain segments are length-prefixed, so a group literally named packages/shared no longer collides with shared under packages.
  • Same-host guard — an identity a single host claims twice is left entirely unmerged; tests cover that, the flattened collision, id-reuse ambiguity, and a paired-host reveal.

ℹ️ Two same-id groups on different hosts still render under one header key

The new host-scoped disambiguation stops two hosts that reuse one group id from cross-resolving, but both disambiguated rows still carry primary.id === id, so the sidebar emits two headers with the same project-group:<id> key and the first one consumes the shared repo bucket, leaving the second empty. This is pre-existing key construction rather than something these commits introduced, and it needs an actual id collision between hosts (normally impossible with UUID ids) to appear — noted only because the new commit adds an id-reuse test, so the scenario is now explicitly contemplated.

Technical details
# Same-id rows share a header key

## Affected sites
- `src/renderer/src/components/sidebar/worktree-list/grouping/project-group-sections.ts:147` — `getProjectGroupHeaderKey(projectGroup.id)` uses the raw primary id.
- `src/renderer/src/components/sidebar/worktree-list/grouping/project-group-sections.ts:70` — repo entries resolve to `shared-id` for both hosts, so `groupByProjectGroupId` holds one bucket; the first header drains it and `delete`s the key (`:167`), the second renders empty.
- `cross-host-project-group-merge.test.ts:173-182` — asserts the two same-id rows stay distinct, which is exactly the state that produces the duplicate key.

## Required outcome
- A rendered header key must uniquely identify a row even when two hosts reuse one group id.

## Open questions for the human
- Can real `ProjectGroup.id`s collide across hosts, or are they always UUIDs? If always UUIDs, this stays theoretical and needs no change.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Group ids are unique per host, not globally, so three lookups could cross
to another host's unrelated group:

- findMergedProjectGroup fell back to the id-only map after a host-scoped
  miss, which could file a repo under a different host's group entirely.
- getGroupKeysForWorktree, getProjectGroupAncestorKeys and
  getFolderWorkspaceRevealGroupKeys walked the parent chain through a bare
  id map, so a reveal could expand the wrong header.
- Two merged rows whose primaries reuse one id rendered under the same
  project-group:<id> key and shared one repo bucket, leaving the second
  header empty.

Merged rows now carry a rowId, host-qualified only when a second row's
primary reuses that id; the sidebar keys headers, buckets and collapse
state on it while ownership and mutations keep routing through primary.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: f3ab764d-4fbc-4e1a-850a-12fa10ef9e4d

📥 Commits

Reviewing files that changed from the base of the PR and between ff114a11a096bc3e3ee4e02f0d735c7552d47526 and 51a963a9999e785a0478b6ebcbe2d81e291143aa.

📒 Files selected for processing (9)
  • src/renderer/src/components/cmd-j/palette-project-results.ts
  • src/renderer/src/components/sidebar/folder-workspace-host-id.ts
  • src/renderer/src/components/sidebar/worktree-list-groups-nested-project-groups.test.ts
  • src/renderer/src/components/sidebar/worktree-list/grouping/cross-host-project-group-merge.test.ts
  • src/renderer/src/components/sidebar/worktree-list/grouping/cross-host-project-group-merge.ts
  • src/renderer/src/components/sidebar/worktree-list/grouping/project-group-sections.ts
  • src/renderer/src/components/sidebar/worktree-list/grouping/worktree-group-keys.ts
  • src/renderer/src/components/sidebar/worktree-list/navigation/folder-reveal.ts
  • src/renderer/src/components/sidebar/worktree-list/navigation/reveal-ancestors.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/renderer/src/components/sidebar/worktree-list/grouping/worktree-group-keys.ts
  • src/renderer/src/components/sidebar/worktree-list/navigation/reveal-ancestors.ts
  • src/renderer/src/components/sidebar/worktree-list/navigation/folder-reveal.ts
  • src/renderer/src/components/sidebar/worktree-list/grouping/cross-host-project-group-merge.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

): string | null =>
projectGroupId === null
? null
: (findMergedProjectGroup(mergedIndex, projectGroupId, hostId)?.rowId ?? projectGroupId)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '35,190p' src/renderer/src/components/sidebar/worktree-list/grouping/project-group-sections.ts
sed -n '90,245p' src/renderer/src/components/sidebar/worktree-list/grouping/cross-host-project-group-merge.ts
rg -n "resolveMergedRowId|remainingRepos|mergedRowIds|projectGroupId" src/renderer/src/components/sidebar/worktree-list/grouping/project-group-sections.ts src/renderer/src/components/sidebar/worktree-list-groups-*.test.ts

Repository: stablyai/orca

Length of output: 18508


🏁 Script executed:

sed -n '450,525p' src/renderer/src/components/sidebar/worktree-list-groups-nested-project-groups.test.ts
sed -n '1,110p' src/renderer/src/components/sidebar/worktree-list-groups-nested-project-groups.test.ts
sed -n '1,85p' src/renderer/src/components/sidebar/worktree-list/grouping/project-group-sections.ts
sed -n '150,185p' src/renderer/src/components/sidebar/worktree-list/grouping/project-group-sections.ts

Repository: stablyai/orca

Length of output: 10167


Keep unresolved host-scoped groups out of existing row buckets.

When findMergedProjectGroup misses, this fallback uses the raw projectGroupId. If another host has a merged row with that rowId, the repository enters that row's bucket. The mergedRowIds check then excludes it from remainingRepoEntries, so it is not rendered as ungrouped while its metadata loads.

Use a host-qualified unresolved key or an explicit unresolved state that cannot match a merged rowId.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — one documentation nit inline.

Reviewed changes

Reviewed the delta from the prior pullfrog review (ff114a1) to 51a963a (10 files, 3 commits) against main.

  • Unique row ids — MergedProjectGroup gained rowId, host-qualified only when two merged rows reuse one primary id; the sidebar now keys headers, buckets, and collapse state on it instead of primary.id, closing the residual same-key collision from the prior pass.
  • Host-scoped resolution — buildProjectGroupHostIndex / findProjectGroupByHost walk raw parent chains without crossing hosts, and findMergedProjectGroup no longer falls back to an id-only match once a host is supplied.
  • Shared resolver — getFolderWorkspaceProjectGroupHostId moved into folder-workspace-host-id.ts; folder-reveal, reveal-ancestors, worktree-group-keys, and the Cmd+J palette resolve raw ids through the merged index to the row id.
  • Tests — end-to-end buildRows case where two hosts reuse one group id (distinct headers and buckets), host-qualified miss, row-id uniqueness/fallback, host-index scoping and memoization.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

* host are two real groups the user can tell apart and move projects between, so
* an identity any single host claims twice is left entirely unmerged.
*/
type MergedProjectGroupRow = Omit<MergedProjectGroup, 'rowId'>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The JSDoc above this alias is the doc for mergeProjectGroupsAcrossHosts ("Fold the per-host copies ... #22022"), but inserting MergedProjectGroupRow between them moved it onto an internal type and left the exported function undocumented. Move the comment back above the function and give the alias a one-line note.

@DoozyX
DoozyX force-pushed the fix/merge-cross-host-project-groups branch from 51a963a to eb2f13c Compare September 24, 2026 07:06
@DoozyX DoozyX closed this Oct 23, 2026
@DoozyX
DoozyX deleted the fix/merge-cross-host-project-groups branch November 15, 2026 10:55
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]: Project groups render twice with a paired host — one copy is empty and unfoldable

1 participant