Skip to content

fix(sidebar): the phone reads projects and project groups from main's sidebar feed, installed with the rows - #31102

Merged
Jinwoo-H merged 10 commits into
mainfrom
sidebar-feed-project-catalog
Oct 20, 2026
Merged

Jinwoo-H merged 10 commits into
mainfrom
sidebar-feed-project-catalog

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 19 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​630 $\color{#cf222e}{\Huge{\mathbf{−}}}$​121 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​509
Prod 29 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​734 $\color{#cf222e}{\Huge{\mathbf{−}}}$​270 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​464

ELI5

The phone shows the same project list as the desktop sidebar. It used to get the list of projects and project groups from a separate copy that the desktop window sent along a little later, and sometimes the phone kept an old copy forever: a project stayed under the wrong group, or a group (the owner's "school" group) didn't show at all. Now the desktop's background process sends the projects and groups in the same update as the workspace rows, so the phone can't end up holding one without the other.

What Changed

Before: with the sidebar fed by main (the build switch that #30790 turns on), the phone got its workspace rows from main's sidebar feed but its projects, project groups, and project grouping from mobileRelay.projectSections. That was a copy the desktop window published on a timer, after the "repos changed" event that told the phone to read it again. If the phone's read beat the window's publish, it installed the old catalog. A second read requested while one was still in flight was dropped, and nothing tried again later. So after moving a project to another group on the desktop, the phone could keep showing the old grouping until something unrelated refreshed it.

After:

  • Main owns the catalog. A new projectCatalog feed domain is built from main's own store (visible repos with their group and order in the group, project groups, projects, host setups, manual repo order, project order), plus each paired server's catalog. Main now reads each paired server's catalog (repo.list, projectGroup.list, project.list, projectHostSetup.list) in the same fetch as that server's rows, but only on first contact and on the server's ready, replay or reposChanged events. It never reads the catalog on worktreesChanged (pins, unread flags, sort stamps) or on the 30-second fallback poll.
  • A server's copy of a grouped project lands in the same group. The window gives an ungrouped repo on a paired server the group of an existing copy of the same project (same git remote). That rule, applyInheritedProjectGroups, moved to src/shared/project-group-inheritance.ts, and both the window and main's builder use it. The fold across hosts uses the same shared adoption and merge functions the window's all-host fetch uses (adoptEndpointRepo, mergeFetchedHostProjectCatalog, resolveProjectHostSetupProjection).
  • The phone reads it from the feed. The catalog installs in the same batch as the rows. When the feed carries the catalog, the phone sends no mobileRelay.projectSections request.
  • Older clients keep working. mobileRelay.projectSections is still served. With the switch on it is built by the same function from main's catalog, so it no longer depends on a window, and the window no longer publishes it. A page running against a desktop that has no projectCatalog domain still falls back to that request, and that fallback now re-reads when an invalidation arrives during a read (PHONE-2).
  • The repo entries now carry the project-group fields projectGroupId and projectGroupOrder. These are the same optional fields feat(sidebar): the desktop and phone list workspaces from main in every build (flip 1/3) #30790 adds to the window's copy.
  • E2E helper (WT-3). tests/e2e/helpers/phone-feed-list.ts now runs the page's real refresh lifecycle (startHostWorktreeRefresh, with AppState passed in so it runs off-device) over the paired socket. Assertions read what the page last installed and make no requests of their own. A new spec moves a project to another group while an earlier feed reply is held, and checks that the phone converges with no manual refresh.

Why

Fixing only the in-flight guard would not fix the bigger race: the event arrived before the window had published. The owner-approved direction was to make the catalog a main-owned domain of the feed, installed at the same revision as the rows. Main already had every local, SSH and WSL catalog row in its store. The only thing it lacked was the paired servers' catalogs. The window gets those over the runtime RPC, and main's paired-server rows producer already holds that connection and its change watch, so that is where the reads were added.

Compatibility (docs/reference/remote-wire-compatibility.md):

  • New page, older desktop: the domain is absent, so the page uses mobileRelay.projectSections as before.
  • Older page, new desktop: the page ignores the unknown domain, and mobileRelay.projectSections is answered from the same catalog.

No semantics version bump: the same inputs still build the same list.

Not in this PR: the desktop window still builds its own list from its own store's catalog. Switching it to the feed's catalog needs a pending layer for the window's instant project reorders (reorderRepos updates the store before main does), or a drag would snap back for a moment. The parity suite now builds the phone's catalog with main's builder from the same world and checks that it matches the window's list row for row. That keeps the two equal until that follow-up.

Linked Issue

Review findings WT-1, WT-3 (wire and tests) and PHONE-2 (phone) from the sidebar parity review.

Visual Proof

N/A: no visible change on the desktop. On the phone the list now matches the desktop's grouping. That is covered by the e2e that compares the phone's list with the desktop's rendered rows.

Testing

  • I manually tested these changes locally

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

  • Unit: main catalog builder (hosts, order, group stamps, projection, a server copy of a grouped project inheriting the group), the paired-server catalog reads (on contact and on catalog change events, never on worktreesChanged or the poll, keeps the last catalog through a failed read), a group move reaching a phone through the feed both normally and while an earlier read is held, mobileRelay.projectSections answered from the same catalog, and the PHONE-2 hook re-read. The hook test fails on main without this change. The parity suite starts from the paired server's raw answers. It folds them through both the window's own fetch path (mergeFetchedReposForHost) and main's server read plus builder. It includes a server copy of a grouped project and a saved manual order that covers only some repos. With the group inheritance removed, 9 of its 16 cases fail.

  • E2E with ORCA_SIDEBAR_INPUTS=main (sidebar-phone-feed-list.spec.ts), all passing on this branch and with this commit cherry-picked onto feat(sidebar): the desktop and phone list workspaces from main in every build (flip 1/3) #30790 (together with sidebar-desktop-reads-main.spec.ts), including the paired-server spec, whose server repos now come from main.

  • Not run: ssh-orcad-phone-feed-list.spec.ts (needs a managed Docker host).

  • macOS only.

Review

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

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)

E2E Test added 2 commits October 20, 2026 06:32
… sidebar feed, installed with the rows

The phone built its project sections from a catalog the desktop window published through a
side channel (mobileRelay.projectSections). That copy changed on a timer after the event that told
the phone to re-read it, and a re-read asked for during a read in flight was dropped, so the phone
could keep an old grouping (a project under the wrong group, a group missing) indefinitely.

Main now publishes the catalog (repos with their group and order, project groups, projects and
host setups, every host's including paired servers') as a projectCatalog domain of the sidebar
feed, from its own store and its own reads of each paired server. The phone reads it from the same
install as the rows. mobileRelay.projectSections stays, answered from the same builder, for pages
that predate the domain; a page on a desktop without the domain still reads it, now re-reading
when an invalidation lands mid-read. The phone e2e list helper runs the page's real refresh
lifecycle instead of re-reading on every assertion, and covers a group move while a read is held.
…cks, and tolerate a world with no project rows in the parity catalog
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: 0b58500c-edbd-455d-a440-ecea3f790aa0
📥 Commits

Reviewing files that changed from the base of the PR and between 27baf08 and f07e282.

📒 Files selected for processing: 3
  • mobile/src/host-screen/use-host-project-sections.ts
  • mobile/src/host-screen/use-host-screen-controller.ts
  • mobile/src/worktree/host-worktree-refresh.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

📝 Walkthrough

The change adds shared schemas and builders for project catalogs from local and paired-server data. The runtime fetches paired-server catalogs, publishes combined catalog data through a sidebar feed domain, and classifies relay changes for catalog refreshes. Mobile and renderer sidebar code consume catalog data from the feed. Host worktree refresh receives app state as an injected dependency. Tests cover catalog validation, publication, feed consumption, and project-group updates during an in-flight feed read.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to f07e2

A transient paired-server read failure can leave the sidebar catalog incomplete until another catalog event. This is a bounded risk to accept or address before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 41.38% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 58 functions across 47 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the primary change: the phone receives projects and project groups from the main sidebar feed.
Description check Passed The description is detailed and covers the user impact, implementation, rationale, compatibility, testing, limitations, and checklist. The Linked Issue section names review findings but does not inclu…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description is detailed and covers the user impact, implementation, rationale, compatibility, testing, limitations, and checklist. The Linked Issue section names review findings but does not include an actual issue reference; this is a minor template gap and does not make the description incomplete.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • 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.

…ts group, and reads a server's catalog only on catalog events

- The window gives an ungrouped paired-server repo the group of an existing copy of the same project
  (applyInheritedProjectGroups). That function now lives in src/shared and main's catalog builder
  folds each server's repos through it, so the phone files the copy where the desktop does.
- A paired server's change watch now says whether the event can carry a catalog change. Only
  ready, a replay and reposChanged mark the catalog stale; worktreesChanged (pins, unread, sort
  stamps) reads rows only.
- The parity fixture now builds the server side from raw server answers, folded through the
  window's mergeFetchedReposForHost and through main's own server read and builder, with a server
  copy of a grouped project and a partial saved manual order. It fails without the inheritance.

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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 Minor · Retry incomplete paired-server catalog reads. · paired-server-catalog.ts:63-77

src/shared/sidebar-list/paired-server-catalog.ts:63-77
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Retry incomplete paired-server catalog reads.

fetchPairedServerCatalog returns a non-null catalog after repo.list succeeds, even when another catalog read fails or returns invalid data. PairedServerRowsProducer.fetch stores this partial catalog and clears catalogStale, so the fallback poll does not retry it.

The feed can then show missing project groups or a repository-derived project projection. Treat method_not_found as the expected fallback for older servers. Mark other rejected, failed, or invalid reads as incomplete and retry them.

♻️ Suggested fix
 export async function fetchPairedServerCatalog(
   environmentId: string,
   call: (method: string) => Promise<RuntimeRpcResponse<unknown>>,
   previous: PairedServerCatalog | null
-): Promise<PairedServerCatalog | null> {
+): Promise<{ catalog: PairedServerCatalog; complete: boolean } | null> {

Track each non-repository read separately. Set complete to false for rejected, non-method_not_found, or invalid replies. Keep it true for the intentional method_not_found compatibility fallback.

 if (catalog) {
-  entry.catalog = catalog
+  entry.catalog = catalog.catalog
+  entry.catalogStale ||= !catalog.complete
   this.revision.bump()
 }

ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6c3bce2c-02c4-4fa7-b96c-cd2935a4f060
📥 Commits

Reviewing files that changed from the base of the PR and between 865e42d and 063177a.

📒 Files selected for processing: 12
  • src/main/ipc/runtime-environments/runtime-environment-mobile-relay-hosts.ts
  • src/main/runtime/mobile-desktop-relay/mobile-desktop-relay-hosts.ts
  • src/main/runtime/mobile-desktop-relay/mobile-relay-host-catalog.test.ts
  • src/main/runtime/sidebar-inputs/paired-server-rows-producer.test.ts
  • src/main/runtime/sidebar-inputs/paired-server-rows-producer.ts
  • src/main/runtime/sidebar-inputs/sidebar-project-catalog.test.ts
  • src/renderer/src/components/sidebar/sidebar-list-parity-project-catalog.test-fixture.ts
  • src/renderer/src/components/sidebar/sidebar-list-parity.test-fixture.ts
  • src/renderer/src/store/repos/repo-catalog-identity.ts
  • src/shared/project-group-inheritance.ts
  • src/shared/sidebar-list/paired-server-catalog.ts
  • src/shared/sidebar-list/sidebar-project-catalog.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

E2E Test and others added 7 commits October 20, 2026 08:02
…catalog

# Conflicts:
#	src/main/runtime/sidebar-inputs/paired-server-rows-producer.ts
#	src/main/runtime/sidebar-inputs/workspace-rows-producer.test.ts
…catalog

# Conflicts:
#	src/renderer/src/runtime/sync-runtime-graph/graph-publication.ts
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.

1 participant