Repository navigation
feat(sidebar): main publishes desktop focus, pins, project and host order, and SSH/WSL host state, checked against the window in dev and test - #30018
Conversation
…rder, and SSH/WSL host state, checked against the window in dev and test
…me pins as workspaces
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
🧹 Nitpick comments: 1
src/renderer/src/lib/sidebar-shadow/desktop-facts-shadow.ts: 1
72-78: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valuePinned-ID comparison can hide a missing window pin.
toLocallyOwnedRowskeeps only IDs the window knows as local or SSH rows. A pin that main reports for a workspace the window does not list is dropped. The window side of the map is built with the same filter. Both sides therefore omit that pin, and the shadow never reports it. ThepinnedWorkspaceIdsdoc in the schema says pins may name unlisted workspaces. This is an intentional limit, but it weakens the shadow's coverage. Add a comment that states this blind spot.
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
e095ac7c-77cf-498b-9246-17633b0d4323
⛔ Files ignored due to path filters: 1
src/shared/rpc-contract/rpc-params-catalog.generated.tsis excluded by!**/*.generated.*
📒 Files selected for processing: 11
src/main/runtime/rpc/methods/sidebar-inputs.tssrc/main/runtime/sidebar-inputs/desktop-sidebar-facts.test.tssrc/main/runtime/sidebar-inputs/desktop-sidebar-facts.tssrc/renderer/src/env.d.tssrc/renderer/src/lib/sidebar-shadow/desktop-facts-shadow.test.tssrc/renderer/src/lib/sidebar-shadow/desktop-facts-shadow.tssrc/renderer/src/lib/sidebar-shadow/sidebar-shadow-comparison.tssrc/renderer/src/lib/sidebar-shadow/workspace-activity-shadow.tssrc/renderer/src/main.tsxsrc/shared/sidebar-list/desktop-sidebar-facts.tstests/e2e/sidebar-measured-row-scroll.spec.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
ELI5
The workspace list on the desktop and the phone should be built from one source: Orca's background process ("main"). A few things the list needs already live in main's saved data, but nothing hands them out in one place: which workspace the desktop has open, which workspaces are pinned, the order of projects and of host sections, and whether each SSH or WSL host is connected. This PR adds one read that returns all of them. Nothing uses it yet. In dev and test builds the window checks main's answer against its own, so we can prove they match before anything switches over.
What Changed
No visible change. Production builds behave exactly as before: nothing reads the new method and the comparison does not run.
sidebarInputs.desktopFacts(src/main/runtime/sidebar-inputs/desktop-sidebar-facts.ts, shape insrc/shared/sidebar-list/desktop-sidebar-facts.ts). It is read on demand from what main already stores, with no new state:desktopActive {hostId, worktreeId}: the desktop's open workspace, from the local session slice that the window already saves (these are global session fields, so they live on the local slice only).pinnedWorkspaceIds: pins from worktree metadata, read per host through the existing host-filtered helper, plus pinned folder workspaces.repoOrder: this host's visible projects with the saved manual order applied, the same rule the window uses.workspaceHostOrder: the saved host-section order.sshHosts(label and connection status per configured target, from the SSH registry the window also lists) andwslHosts(connection state per WSL host, empty where WSL hosts cannot exist).orcad.src/renderer/src/lib/sidebar-shadow/desktop-facts-shadow.ts): one comparison per fact, keyed so a disagreement names it (desktopActive,repoOrder,pinned:<id>,host:<id>, ...). Paired-server rows and projects are left out on both sides; that server owns them.comparisons()now counts a round only when every domain compared, so the e2e helper's "two comparisons" still means each domain was checked twice now that there are two domains.Why
This is the last producer step in the sidebar plan (5e). Unlike activity facts, every one of these already lives in main, so the smallest correct step is to publish them in the shape the shared list builder needs and prove they match. No change log or revision yet; the phone feed PR adds invalidation for every domain together.
Alternatives considered:
worktree psrows. Rejected: that listing runs a git scan; pins are metadata and can be read without one.Linked Issue
Part of the sidebar refactor plan (step 5e). No issue.
Visual Proof
N/A. Nothing visible changes. The comparison is development tooling and does not run in production builds.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Unit: main's reader (focus, per-host pins including a store without host-qualified metadata, manual order with unranked projects, host order, SSH and WSL state) and the window reader.
e2e (hidden window, macOS):
sidebar-agent-row-identity,sidebar-folder-keyboard-navigation,sidebar-measured-row-scrollpass with zero shadow mismatches.Positive control (not committed): main publishing a wrong active workspace and dropping a pin was caught in the folder and measured-row specs, naming
desktopActiveandpinned:<id>.pnpm tc, RPC census tests, changed-code quality gate, focus-read ratchet, oxlint.AI Disclosure
Review
Agent skill upstream boundary
Notes
SSH: SSH status comes from the same registry the window lists, and paired-server rows are excluded on both sides. Folder workspaces: pins include folder workspaces. Wire: one new method, an old host without it is skipped.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)