Skip to content

feat(sidebar): main produces this host's workspace rows, checked against the window (dark) - #30184

Merged
Jinwoo-H merged 5 commits into
mainfrom
jinwoo/sidebar-workspace-rows
Oct 18, 2026
Merged

Jinwoo-H merged 5 commits into
mainfrom
jinwoo/sidebar-workspace-rows

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​524 $\color{#cf222e}{\Huge{\mathbf{−}}}$​9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​515
Prod 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​369 $\color{#cf222e}{\Huge{\mathbf{−}}}$​22 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​347

ELI5

The workspace list on the desktop and the phone will soon be built from one set of inputs that Orca's background process ("main") hands out. Main already had most of them. It did not have the plain list of this computer's own workspaces as the sidebar reads them: name, branch, pin, archive, unread, status, comment, links. This PR adds that list. Nothing uses it yet, and only a special build contains it: shipped builds compile it out.

What Changed

Before: main had no read of this host's workspace rows for the sidebar. The closest thing, worktree.ps, mixes the rows with fields it re-fills on every poll (terminal counts, last output, preview, status, agents).

After (only in an ORCA_SIDEBAR_INPUTS=main build; switch-off builds behave exactly as main):

  • One row per workspace this host lists: every git worktree (folder projects included) and every folder workspace, on the local machine, WSL, and SSH hosts. Rows are keyed by host and id (host|id), the same form the frozen sort order and paired-server rows use. A paired server's rows stay in their own domain.
  • What a row carries: catalog and metadata only.
    • Kind, repo, path, branch, display name, host.
    • The stored lineage edge and instance ids, which the shared builder validates.
    • Pin, archive, unread, workspace status, comment.
    • Manual order and creation time.
    • Creator provenance, and the kind facts the Filters switches read (default branch, automation-created, CLI-created, detached HEAD).
    • The linked issue and PR numbers from metadata, Linear and GitLab items, attachments.
    • The terminal platform, which only main knows.
  • What a row leaves out:
    • Terminal counts, preview, status and agents. These are the activity domain.
    • lastActivityAt and sortOrder. Only sorting reads them, and the temporal domain publishes the frozen order. Smart sort also rewrites every row's sortOrder on each settle, so carrying it would turn every settle into a whole-list change.
    • The branch's PR from the GitHub cache. That is the review domain.
  • One shared projection. buildWorkspaceRows (in src/shared/sidebar-list/workspace-rows.ts) builds the rows on both sides: main over the listing that worktree.ps reads, the window over its own store.
  • Visibility filter reused. The hidden-repo and imported-worktree visibility filter in getWorktreePs is pulled out unchanged into visibleResolvedWorktreeSnapshot, so worktree.ps and the rows share it.
  • Change signal, reusing the feed's ProducerRevision. The revision moves on catalog events (worktreesChanged, reposChanged) and on store saves that may touch metadata.
    • A small new store hook, onStateWritten(dirtyDomains), is called from the one place saves are scheduled.
    • Metadata saves are tagged with metadata domains. Folder workspace and lineage saves are untagged full saves.
    • Session saves are tagged with session domains, so terminal output never moves the revision.
  • Reads merge fresh. The window's own metadata writes (pin, unread, status) emit no client event, so the shared one-second listing cache can be older than the signal that triggered a read. The rows therefore merge the listing fresh. Git scans keep their own per-repo cache, and the shared cache is left alone, so worktree.ps and the temporal owner read exactly what they did before.
  • Wiring:
    • Read RPC sidebarInputs.workspaceRows in SIDEBAR_INPUT_METHODS.
    • A workspaces domain in the phone feed (sidebarInputs.read).
    • A dev/test shadow check against the window's own catalog.
  • SSH. Main lists an SSH host's rows from what it stored, whether or not the host answers, so a disconnected host's rows are kept. Its connection state is already published once, in the desktop facts domain (sshHosts).

Why

  • Shared projection, not buildRuntimeWorktreePsSummaries. Summaries fold the GitHub PR cache into linkedPR, and that cache announces no change. They also drop a folder workspace's host id. And the window would need its own second mapping to compare against them. Projecting the Worktree records both sides already hold, with one function, removes that mapping.
  • No per-row "unverifiable" mark. Copying the host's connection state onto every row would duplicate a fact the desktop facts domain already publishes, and turn each connection flap into a change to every row of that host. Paired servers likewise carry freshness once per host.
  • Fresh merge, not invalidating the shared cache. An earlier version invalidated the shared cache on metadata writes. That made the temporal owner see fresher data than the window's frozen order, and the Recent order disagreed in e2e. Merging fresh only for these reads keeps every other reader unchanged.
  • A store hook, not hooks on each writer. Metadata reaches the store through window IPC, runtime RPCs and the CLI. The save scheduler is the one place all of them pass through.

Linked Issue

N/A (internal series; sidebar B-lite plan, producer P4f).

Visual Proof

N/A: no visible change. Everything is compiled out of shipped builds, and nothing reads the new rows yet.

Testing

  • Unit:

    • The shared projection: host keys, the same repo id on two hosts, folder workspaces, paired-server rows left out, the lineage edge, parse round trip.
    • The producer on plain Node, as orcad runs. It runs the real listing cache and visibility filter, and stubs only the scan and merge:
      • local and stored SSH rows;
      • the revision moves on catalog events and metadata or full saves, never on session or settings saves;
      • reads go past the shared cache and leave it alone;
      • the phone feed carries the workspaces domain and a one-row delta after a pin.
    • The store hook against a real store: each write's domains reach it.
  • Switch on, hidden app (ORCA_BACKGROUND_LAUNCH=1), new spec tests/e2e/sidebar-workspace-rows.spec.ts:

    • Main lists the window's git and folder workspaces, and follows the window's own pin and comment writes.
    • A disconnected SSH host (seeded profile, unreachable target) keeps its stored git and folder rows, and its desktop-facts status is not connected.
  • Shadow: 0 mismatches in every domain across the 10 sidebar shadow specs, each run twice (20 passed):

    • this spec;
    • sidebar-creation-registry, sidebar-folder-keyboard-navigation, sidebar-measured-row-scroll, sidebar-review-facts, sidebar-agent-row-identity;
    • sidebar-inputs-feed, paired-server-rows-shadow, paired-mobile-desktop-mirror-workspace-visibility.
    • These cover folder workspaces, SSH rows and paired servers.
    • sidebar-folder-keyboard-navigation used to plant names and statuses straight into the window's store. It now writes the statuses through the real metadata writes, so main and the window both see them.
  • Positive control (not committed): a planted flip of every row's unread state in main was recorded as workspace-rows mismatches in both new tests.

  • Switch-off bundles (out/ from origin/main and from this branch) differ only in:

    • the store's empty listener set and the loop over it;
    • the visibility filter, moved into its own method with the same code;
    • a workspaceRows = null field;
    • the row schema, built at module load as the other sidebar domains' schemas already are;
    • the build commit string.
      The rest is minifier renames.
  • Gates: pnpm tc, check:code-quality:changed, the focus-read ratchet, oxlint, the max-lines and runtime-Electron ratchets, and the RPC catalog check.

    • Local runs of the wider src/main/runtime/rpc folder fail only on node:sqlite being missing in this test runtime, plus one paired-runtime tunnel test that times out the same way on an older checkout.
  • Platforms: macOS.

  • I manually tested these changes locally

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

Review

Two Opus passes: one on the full diff, one on the fix delta. Applied:

  • stopped invalidating the shared listing cache, and merge fresh for these reads instead;
  • the store hook only moves the revision;
  • a test on the real cache;
  • the keyboard spec writes no rename (a rename re-sorts main but not the window, which is the temporal domain's business);
  • corrected comments.

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

  • Deferred:
    • Workspace lineage (workspaceLineageByChildKey). The folder card's PR display and the context menu read it, but the shared builder does not. It joins the rows, or gets its own field, with the phone switch.
    • terminalPlatform is keyed by repo id only, as in worktree.ps. When one repo id is registered on two hosts, the last host's platform wins.
    • Other-client visibility. The rows carry creator provenance. Turning it into "from another device" stays a builder decision.
  • SSH and folder workspaces are covered as above. A paired server's rows are the paired-server domain.

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)

@coderabbitai

coderabbitai Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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: 05cf4121-6edd-4254-9e69-2b71f46a7f25
📥 Commits

Reviewing files that changed from the base of the PR and between 68808db and c8d7555.

⛔ Files ignored due to path filters: 1
  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
📒 Files selected for processing: 17
  • src/main/persistence/loading-store/profile-state-durable-writes.test.ts
  • src/main/persistence/loading-store/state-write-listeners.spec.ts
  • src/main/persistence/loading-store/store-runtime-state.ts
  • src/main/persistence/loading-store/write-scheduling.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/rpc/methods/sidebar-inputs.ts
  • src/main/runtime/runtime-store-contract.ts
  • src/main/runtime/sidebar-inputs/sidebar-inputs-feed-domains.ts
  • src/main/runtime/sidebar-inputs/workspace-rows-producer.test.ts
  • src/main/runtime/sidebar-inputs/workspace-rows-producer.ts
  • src/main/runtime/workspaces/workspace-process-listing.ts
  • src/renderer/src/lib/sidebar-shadow/workspace-rows-shadow.ts
  • src/renderer/src/main.tsx
  • src/shared/sidebar-list/workspace-rows.test.ts
  • src/shared/sidebar-list/workspace-rows.ts
  • tests/e2e/sidebar-folder-keyboard-navigation.spec.ts
  • tests/e2e/sidebar-workspace-rows.spec.ts

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

📝 Walkthrough

The change adds shared schemas and a builder for workspace rows. The main process produces snapshots from visible worktrees, folder workspaces, repositories, and lineage. State-write notifications and catalog events update the producer revision. Sidebar inputs expose snapshots through a feed domain and RPC method. Renderer shadow comparisons and tests cover row data, updates, and restart behavior.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to c8d75

No confirmed issue blocks merging. The effect of visibility-setting changes on subscribed workspace rows remains uncertain.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 17 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 main change: main now produces workspace rows for the sidebar and checks them against the window. The parenthetical build qualifier adds minor noise but does not reduc…
Description check Passed The description is complete and relevant. It explains the user-facing change, implementation, rationale, testing, platform coverage, limitations, deferred work, and checklist status. The N/A linked is…
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: Title check

Explanation

The title clearly identifies the main change: main now produces workspace rows for the sidebar and checks them against the window. The parenthetical build qualifier adds minor noise but does not reduce clarity.

Full details: Description check

Explanation

The description is complete and relevant. It explains the user-facing change, implementation, rationale, testing, platform coverage, limitations, deferred work, and checklist status. The N/A linked issue is consistent with the stated internal series, and the visual proof section provides the required reason.

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

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