Repository navigation
fix(sidebar): the phone reads projects and project groups from main's sidebar feed, installed with the rows - #31102
Conversation
… 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
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🔵 Low · up to
|
…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.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 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 winRetry incomplete paired-server catalog reads.
fetchPairedServerCatalogreturns a non-null catalog afterrepo.listsucceeds, even when another catalog read fails or returns invalid data.PairedServerRowsProducer.fetchstores this partial catalog and clearscatalogStale, 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_foundas 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
completetofalsefor rejected, non-method_not_found, or invalid replies. Keep it true for the intentionalmethod_not_foundcompatibility 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
📒 Files selected for processing: 12
src/main/ipc/runtime-environments/runtime-environment-mobile-relay-hosts.tssrc/main/runtime/mobile-desktop-relay/mobile-desktop-relay-hosts.tssrc/main/runtime/mobile-desktop-relay/mobile-relay-host-catalog.test.tssrc/main/runtime/sidebar-inputs/paired-server-rows-producer.test.tssrc/main/runtime/sidebar-inputs/paired-server-rows-producer.tssrc/main/runtime/sidebar-inputs/sidebar-project-catalog.test.tssrc/renderer/src/components/sidebar/sidebar-list-parity-project-catalog.test-fixture.tssrc/renderer/src/components/sidebar/sidebar-list-parity.test-fixture.tssrc/renderer/src/store/repos/repo-catalog-identity.tssrc/shared/project-group-inheritance.tssrc/shared/sidebar-list/paired-server-catalog.tssrc/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.
…catalog # Conflicts: # src/main/runtime/sidebar-inputs/paired-server-rows-producer.ts # src/main/runtime/sidebar-inputs/workspace-rows-producer.test.ts
…ead of reading keys reflectively
…t sections without an await loop
…elper pulls in no React Native types
…catalog # Conflicts: # src/renderer/src/runtime/sync-runtime-graph/graph-publication.ts
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:
projectCatalogfeed 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 orreposChangedevents. It never reads the catalog onworktreesChanged(pins, unread flags, sort stamps) or on the 30-second fallback poll.applyInheritedProjectGroups, moved tosrc/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).mobileRelay.projectSectionsrequest.mobileRelay.projectSectionsis 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 noprojectCatalogdomain still falls back to that request, and that fallback now re-reads when an invalidation arrives during a read (PHONE-2).projectGroupIdandprojectGroupOrder. 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.tests/e2e/helpers/phone-feed-list.tsnow 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):
mobileRelay.projectSectionsas before.mobileRelay.projectSectionsis 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 (
reorderReposupdates 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
worktreesChangedor 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.projectSectionsanswered 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 withsidebar-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
Notes
ssh:<target>as the window stamps them.runtime-environment-mobile-relay-hosts.ts). The window loads every runtime environment, so on Windows such a server's rows and catalog reach the desktop window but not the phone.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)