Skip to content

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

Merged
Jinwoo-H merged 2 commits into
mainfrom
jinwoo/sidebar-desktop-facts
Oct 17, 2026
Merged

Jinwoo-H merged 2 commits into
mainfrom
jinwoo/sidebar-desktop-facts

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​232 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​232
Prod 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​245 $\color{#cf222e}{\Huge{\mathbf{−}}}$​7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​238

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.

  • New read sidebarInputs.desktopFacts (src/main/runtime/sidebar-inputs/desktop-sidebar-facts.ts, shape in src/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) and wslHosts (connection state per WSL host, empty where WSL hosts cannot exist).
    • Status values stay plain strings, so a status a newer host adds never breaks an older reader.
    • Imports no Electron, so it runs the same in orcad.
  • Shadow check (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.
  • Shadow mechanism, two small changes: a read-on-demand domain has no revision, so the revision is optional; and 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.
  • e2e: the measured-row spec now pins a workspace before its shadow assertion, so the pin path runs end to end.

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:

  • Reading pins off the worktree ps rows. Rejected: that listing runs a git scan; pins are metadata and can be read without one.
  • Using the store's SSH target list. Rejected: it includes targets a paired server owns, which the registry list and the window leave out.

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-scroll pass 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 desktopActive and pinned:<id>.

  • pnpm tc, RPC census tests, changed-code quality gate, focus-read ratchet, oxlint.

AI Disclosure

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

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

  • 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)

…rder, and SSH/WSL host state, checked against the window in dev and test
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

The change adds a runtime RPC method and a shared schema for desktop sidebar facts. The renderer builds corresponding facts from window state and compares them with runtime facts through a new shadow domain. Comparison rounds count only when every domain check succeeds. Tests cover runtime fact collection, renderer fact construction, and a pinned-worktree end-to-end fixture.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 4e749

This adds an on-demand read of desktop sidebar facts and a dev/test comparison; production behavior is unchanged. No merge-blocking risk was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 11 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 summarizes the main change: publishing desktop sidebar facts from main and checking them against the window. It is specific, though longer than necessary.
Description check Passed The description is detailed and covers the change, rationale, testing, visual proof, compatibility considerations, and checklist. It does not provide a linked issue despite the template requirement, a…
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 change, rationale, testing, visual proof, compatibility considerations, and checklist. It does not provide a linked issue despite the template requirement, and the standard lint, typecheck, test, and build checklist item remains unchecked.

  • Fix all pre-merge checks with AI
✨ 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.

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

🧹 Nitpick comments: 1
src/renderer/src/lib/sidebar-shadow/desktop-facts-shadow.ts: 1

72-78: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Pinned-ID comparison can hide a missing window pin.

toLocallyOwnedRows keeps 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. The pinnedWorkspaceIds doc 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
📥 Commits

Reviewing files that changed from the base of the PR and between 0f9c12d and 4e74982.

⛔ Files ignored due to path filters: 1
  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
📒 Files selected for processing: 11
  • src/main/runtime/rpc/methods/sidebar-inputs.ts
  • src/main/runtime/sidebar-inputs/desktop-sidebar-facts.test.ts
  • src/main/runtime/sidebar-inputs/desktop-sidebar-facts.ts
  • src/renderer/src/env.d.ts
  • src/renderer/src/lib/sidebar-shadow/desktop-facts-shadow.test.ts
  • src/renderer/src/lib/sidebar-shadow/desktop-facts-shadow.ts
  • src/renderer/src/lib/sidebar-shadow/sidebar-shadow-comparison.ts
  • src/renderer/src/lib/sidebar-shadow/workspace-activity-shadow.ts
  • src/renderer/src/main.tsx
  • src/shared/sidebar-list/desktop-sidebar-facts.ts
  • tests/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.

@Jinwoo-H
Jinwoo-H merged commit 6c7ed18 into main Oct 17, 2026
39 checks passed
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