Skip to content

feat(sidebar): main produces per-workspace PR facts, checked against the window in dev and test - #30026

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

Jinwoo-H merged 4 commits into
mainfrom
jinwoo/sidebar-review-facts

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​244 $\color{#cf222e}{\Huge{\mathbf{−}}}$​62 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​182
Prod 34 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​264 $\color{#cf222e}{\Huge{\mathbf{−}}}$​149 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​115

ELI5

The sidebar can group workspaces by the state of their pull request (In progress, In review, Done, Closed). Today only the desktop window knows each workspace's PR state, because only it holds the PR cache. This PR teaches Orca's background process ("main") to work out the same answer per workspace, so the phone can later group the same way. Nothing reads main's answer yet. In dev and test builds the window checks main's answer against its own.

What Changed

No visible change. The window still groups from its own cache.

  • One PR lookup, shared. The window's "which PR does this workspace have" rule (repo-scoped cache entry first, then the two legacy keys for local repos only, minus a PR the user unlinked) moved to src/shared/sidebar-list/workspace-review-facts.ts. The window's prGroupOf and main both call it. The cache-key module it needs moved from the renderer store to src/shared/github/github-cache-key.ts. The reader's settings argument was never used (the key ignores focus once the repo is known), so it is gone from the reveal and collapsed-group plumbing.
  • Main publishes { provider: 'github', reviewState } per workspace through a new sidebarInputs.reviewFacts RPC. It is read on demand from main's copy of the PR cache over main's own worktree list, so it has no state or timers of its own. Rows with no PR are absent. It imports no Electron and runs under orcad.
  • Main's copy of the cache is now timely and complete. Before: five call sites saved the cache after a one-second debounce that restarted on every change, and several writers (hosted-review conflict clears, metadata edits, the refresh sweep, work-item mutations, checks) never saved at all. After: one store subscription saves whenever the PR or issue cache changes, at most one second later, and a steady stream of changes cannot push the save back. It starts after the window reads the saved cache, so a failed or slow read can never overwrite main's copy with a partial one.
  • Shadow check workspace-review, registered next to the activity check. The shared counter now counts per check, so expectNoSidebarShadowMismatches waits for two fresh reads of every check. Before, with two checks, one tick satisfied it.
  • e2e sidebar-review-facts.spec.ts: a PR written into the window's cache reaches main within a second, follows state changes and removal, and the shadow stays clean.

Why

Design decisions:

  • GitHub only, matching the window. Desktop PR grouping reads only GitHub PR state. GitLab merge requests live in the hosted-review cache, which grouping never reads, so GitLab rows sit in In progress today. Publishing GitLab state would make the phone group differently from the desktop. The field is named provider so GitLab can be added as a deliberate, visible change later.
  • No linkedPR fallback. A linked PR number without a fetched state cannot change a lane: the window keeps such a row In progress. Publishing it as "unknown" would put the row in In review on the phone and disagree with the desktop. The phone's existing worktree.ps already does this.
  • Folder-card review status is not a list input. The list builder only reads prGroupOf. Folder cards render their review badge from both caches at row-render time, so that belongs with the per-row detail the feed will carry.
  • Why the window's cache and not main's fetch results. Main runs the fetches, but the window decides what to keep (fallback preservation, rejected URLs, hosted-review conflict clears, unlinking). Recording raw fetch outcomes in main would copy that policy and drift from it. Mirroring the cache the window already keeps is exact.

Linked Issue

Part of the sidebar refactor plan (step 5b). No issue.

Visual Proof

N/A. Nothing visible changes. The comparison is dev and test tooling.

Testing

  • Unit: shared lookup (key order, SSH and paired-server scoping, unlinking), main read on plain Node, persistence timing, the existing grouping and GitHub store suites.
  • e2e (hidden windows): sidebar-review-facts, the three activity shadow specs, worktree-reveal-host-sections, source-control-create-pr. 10 passed, no mismatches.
  • Positive control (not committed): main planting a state for every workspace was reported as workspace-review mismatches.
  • pnpm tc, oxlint, changed-code quality gate, focus-read ratchet (baseline pruned for the moved file), RPC catalog check.

Notes

  • SSH: SSH repos read only their host-scoped cache entries, as the window does.
  • Paired servers: their rows are excluded from this check. A server has no window, so its copy holds only what its profile had. Feeding servers is part of the server-row producer.
  • Mobile: no change. worktree.ps keeps its own PR lookup (no host scope, no unlink check); moving it onto the shared lookup would change the phone and gets its own PR.
  • Performance: production never calls the new RPC. The shadow reads main's worktree list, whose per-repo scans are cached for 30 seconds.

Jinwoo-H and others added 4 commits October 17, 2026 03:58
…the window in dev and test

Co-Authored-By: Claude <noreply@anthropic.com>
…ting an import

Co-Authored-By: Claude <noreply@anthropic.com>
…-facts

# Conflicts:
#	src/main/runtime/rpc/methods/sidebar-inputs.ts
#	src/renderer/src/env.d.ts
#	src/renderer/src/lib/sidebar-shadow/sidebar-shadow-comparison.ts
#	src/renderer/src/main.tsx
#	src/shared/rpc-contract/rpc-params-catalog.generated.ts
…-facts

# Conflicts:
#	src/main/runtime/orca-runtime.ts
#	src/main/runtime/rpc/methods/sidebar-inputs.ts
#	src/renderer/src/main.tsx
#	src/shared/rpc-contract/rpc-params-catalog.generated.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