Repository navigation
test(sidebar): the desktop window and a phone reading the feed draw the same list (dark) - #30426
Conversation
…d workspaces as the window does (dark)
…r's check keeps (dark)
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
75d4c6a6-b12e-4b95-a61c-b021d82f2ac3
📒 Files selected for processing: 19
config/tsconfig.tc.web.jsonsrc/main/runtime/sidebar-inputs/paired-server-rows-producer.test.tssrc/main/runtime/sidebar-inputs/sidebar-inputs-feed-domains.tssrc/renderer/src/components/sidebar/sidebar-list-golden-suite.test-fixture.tsxsrc/renderer/src/components/sidebar/sidebar-list-parity.test-fixture.tssrc/renderer/src/components/sidebar/sidebar-list-parity.test.tsxsrc/renderer/src/components/sidebar/worktree-list/rows/folder-row.tsxsrc/renderer/src/components/sidebar/worktree-list/rows/item-row.tsxsrc/renderer/src/lib/sidebar-shadow/paired-server-rows-shadow.test.tssrc/renderer/src/lib/sidebar-shadow/paired-server-rows-shadow.tssrc/shared/sidebar-list/active-workspace.tssrc/shared/sidebar-list/paired-server-rows.tssrc/shared/sidebar-list/sidebar-feed-domains.tssrc/shared/sidebar-list/sidebar-feed-rows.tssrc/shared/sidebar-list/sidebar-feed-worktrees.tssrc/shared/sidebar-list/smart-sort.tssrc/shared/sidebar-list/workspace-review-facts.tssrc/shared/sidebar-list/workspace-rows.test.tssrc/shared/sidebar-list/workspace-rows.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
| /** The rows' stored lineage edges as the builder's lineage map, keyed by bare id as the window's. */ | ||
| export function readFeedLineage( | ||
| workspaces: readonly SidebarFeedWorkspace[] | ||
| ): Record<string, WorktreeLineage> { | ||
| const lineageById: Record<string, WorktreeLineage> = {} | ||
| for (const { worktree, lineage } of workspaces) { | ||
| if (lineage && !(worktree.id in lineageById)) { | ||
| // The builder validates only the edge; provenance stays the host's. | ||
| lineageById[worktree.id] = { | ||
| worktreeId: worktree.id, | ||
| ...lineage, | ||
| origin: 'manual', | ||
| capture: { source: 'manual-action', confidence: 'explicit' }, | ||
| createdAt: 0 | ||
| } | ||
| } | ||
| } | ||
| return lineageById | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '175,205p' src/shared/sidebar-list/sidebar-feed-worktrees.ts
rg -n 'readFeedLineage|worktreeLineageById|lineageById' src/shared/sidebar-list/sidebar-feed-rows.ts src/shared/sidebar-listRepository: stablyai/orca
Length of output: 7938
🏁 Script executed:
set -e
printf '%s\n' '--- feed row builder ---'
nl -ba src/shared/sidebar-list/sidebar-feed-rows.ts | sed -n '130,270p'
printf '%s\n' '--- workspace row builder ---'
nl -ba src/shared/sidebar-list/workspace-rows.ts | sed -n '120,205p'
printf '%s\n' '--- lineage projection ---'
nl -ba src/shared/sidebar-list/worktree-lineage-projection.ts | sed -n '1,240p'
printf '%s\n' '--- identity and lineage declarations/usages ---'
rg -n -F --glob '*.ts' -e 'type WorktreeLineage' -e 'interface WorktreeLineage' -e 'rowsByHostIdentity' -e 'getSidebarLineageParent' -e 'HostIdentity' -e 'worktreeMap' src/shared src | head -240
printf '%s\n' '--- feed adapter and tests ---'
nl -ba src/shared/sidebar-list/sidebar-feed-worktrees.ts | sed -n '1,210p'
rg -n -F --glob '*.test.ts' -e 'readFeedLineage' -e 'mixed' -e 'lineage' src/shared/sidebar-list | head -240
printf '%s\n' '--- PR diff for implicated file and consumers ---'
git diff 91b696b6cf09c354cae9ec3747359afdb631539b fb7839580f4c906b6d7e04a0920d590a13fa8965 -- src/shared/sidebar-list/sidebar-feed-worktrees.ts src/shared/sidebar-list/sidebar-feed-rows.ts src/shared/sidebar-list/workspace-rows.ts src/shared/sidebar-list/worktree-lineage-projection.tsRepository: stablyai/orca
Length of output: 42153
🏁 Script executed:
set -e
printf '%s\n' '--- row plan and direct nesting consumer ---'
nl -ba src/shared/sidebar-list/sidebar-row-plan.ts | sed -n '1,180p'
nl -ba src/shared/sidebar-list/visible-worktrees.ts | sed -n '1,130p'
printf '%s\n' '--- host-qualified lineage helper callers ---'
rg -n -F --glob '*.ts' -e 'getSidebarLineageParent(' -e 'getSidebarLineageAncestors(' -e 'getHostScopedWorktreeLineageInputs(' -e 'rowsByHostIdentity' src/shared/sidebar-list src | head -240
printf '%s\n' '--- plan/sidebar row identity construction ---'
rg -n -F --glob '*.ts' -e 'composeWorktreeHostIdentity' -e 'getWorktreeHostIdentity' -e 'new Map(' src/shared/sidebar-list/sidebar-row-plan.ts src/shared/sidebar-list/*.ts | head -260
printf '%s\n' '--- feed and parity test references ---'
rg -n -F --glob '*.ts' -e 'buildSidebarFeedRows' -e 'SidebarFeedDomains' -e 'pairedServerRows' -e 'workspaces:' src/shared/sidebar-list | head -260
printf '%s\n' '--- lineage and identity type declarations ---'
rg -n -F --glob '*.ts' -e 'export type WorktreeLineage' -e 'export interface WorktreeLineage' -e 'worktreeInstanceId' -e 'composeWorktreeHostIdentity' src/shared/worktree src/shared | head -240Repository: stablyai/orca
Length of output: 33512
🏁 Script executed:
set -e
nl -ba src/shared/sidebar-list/pinned-section-worktrees.ts | sed -n '1,115p'
nl -ba src/shared/resolved-worktree-lineage.ts | sed -n '1,75p'
nl -ba src/shared/worktree/lineage-types.ts | sed -n '1,42p'
nl -ba src/shared/worktree/host-qualified-identity.ts | sed -n '1,75p'Repository: stablyai/orca
Length of output: 11906
🏁 Script executed:
set -e
rg -n -F --glob '*.ts' -e 'export type Worktree' -e 'export interface Worktree' src/shared/worktree src/shared | head -40
nl -ba src/shared/worktree/types.ts | sed -n '1,135p'
nl -ba src/shared/sidebar-list/sidebar-feed-worktrees.ts | sed -n '38,112p'Repository: stablyai/orca
Length of output: 12707
Preserve lineage for duplicate host-qualified workspaces.
When two hosts publish the same worktree ID with different instances, readFeedLineage keeps only the first lineage. The later feed row has no inline lineage, so getSidebarLineageParent cannot nest it. Preserve each row's lineage on the constructed worktree so the existing instance-mismatch fallback can use the correct host's edge.
Suggested fix
- const worktree: Worktree = {
+ const worktree: Worktree & { lineage?: WorktreeLineage | null } = {
id,
...(hostId ? { hostId } : {}),
...(owner?.kind === 'runtime' ? { runtimeOwnerEnvironmentId: owner.environmentId } : {}),
...(row.instanceId !== undefined ? { instanceId: row.instanceId } : {}),
+ lineage: row.lineage ?? null,|
|
||
| /** A paired server's rows against this desktop's own cache, under the server's host-scoped keys. */ | ||
| export function buildPairedServerReviewFacts( | ||
| servers: readonly { hostId: string; rows: readonly PairedServerWorkspaceRow[] }[], | ||
| prCache: PRCacheView | ||
| ): Record<string, WorkspaceReviewFact> { | ||
| const facts: Record<string, WorkspaceReviewFact> = {} | ||
| for (const server of servers) { | ||
| const hostId = parseExecutionHostId(server.hostId)?.id | ||
| for (const row of hostId ? server.rows : []) { | ||
| const fact = | ||
| row.kind === 'git' | ||
| ? readWorkspaceReviewFact( | ||
| { branch: row.branch, linkedPR: null }, | ||
| { id: row.repoId, path: '', executionHostId: hostId }, | ||
| prCache | ||
| ) | ||
| : null | ||
| if (fact) { | ||
| facts[row.worktreeId] = fact | ||
| } | ||
| } | ||
| } | ||
| return facts | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
rg -n 'WorkspaceReviewFact|workspaceReview|reviewFacts|reviewBy|domains.review|\.review\[' src/shared/sidebar-list src/renderer/src src/main/runtime/sidebar-inputs | head -160
sed -n '115,155p' src/main/runtime/sidebar-inputs/sidebar-inputs-feed-domains.ts
sed -n '35,70p' src/shared/worktree/host-qualified-identity.tsRepository: stablyai/orca
Length of output: 10518
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- review facts producer ---'
nl -ba src/shared/sidebar-list/workspace-review-facts.ts | sed -n '1,125p'
printf '%s\n' '--- feed domains ---'
nl -ba src/main/runtime/sidebar-inputs/sidebar-inputs-feed-domains.ts | sed -n '110,145p'
printf '%s\n' '--- feed row consumer ---'
nl -ba src/shared/sidebar-list/sidebar-feed-rows.ts | sed -n '205,265p'
printf '%s\n' '--- paired row declarations/usages ---'
rg -n -F --glob '*.ts' -e 'PairedServerWorkspaceRow' -e 'pairedServerRows' -e 'worktreeId:' src/shared src/main src/renderer | head -240
printf '%s\n' '--- host identity contract and tests ---'
rg -n -F --glob '*.ts' -e 'getWorktreeHostIdentity' -e 'composeWorktreeHostIdentity' -e 'same.*host' -e 'hostId.*worktreeId' src/shared src/main src/renderer | head -240
printf '%s\n' '--- relevant fixture excerpts ---'
rg -n -F --glob '*.ts' -e 'paired' -e 'executionHostId' src/renderer/src/components/sidebar/sidebar-list-parity.test-fixture.ts src/shared/sidebar-list src/main/runtime/sidebar-inputs | head -240Repository: stablyai/orca
Length of output: 41607
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- paired-server row contract ---'
nl -ba src/shared/sidebar-list/paired-server-rows.ts | sed -n '1,130p'
printf '%s\n' '--- paired row to feed worktree conversion ---'
nl -ba src/shared/sidebar-list/sidebar-feed-worktrees.ts | sed -n '1,215p'
printf '%s\n' '--- feed row construction and consumer context ---'
nl -ba src/shared/sidebar-list/sidebar-feed-rows.ts | sed -n '1,115p'
nl -ba src/shared/sidebar-list/sidebar-feed-rows.ts | sed -n '175,252p'
printf '%s\n' '--- parity fixture rows and host identities ---'
nl -ba src/renderer/src/components/sidebar/sidebar-list-parity.test-fixture.ts | sed -n '1,205p'
printf '%s\n' '--- host identity contract/tests ---'
nl -ba src/shared/worktree/host-qualified-identity.ts | sed -n '1,120p'
rg -n -F --glob '*.test.ts' -e 'same worktree' -e 'same.*worktreeId' -e 'ssh:build-box' -e 'composeWorktreeHostIdentity' src/shared src/renderer/src/components/sidebar | head -160Repository: stablyai/orca
Length of output: 41901
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- review domain contract ---'
nl -ba src/shared/sidebar-list/sidebar-feed-domains.ts | sed -n '1,100p'
printf '%s\n' '--- complete feed planning block ---'
nl -ba src/shared/sidebar-list/sidebar-feed-rows.ts | sed -n '115,210p'
printf '%s\n' '--- review shadow producer/consumer ---'
nl -ba src/renderer/src/lib/sidebar-shadow/workspace-review-shadow.ts | sed -n '1,90p'
printf '%s\n' '--- review fact tests ---'
nl -ba src/shared/sidebar-list/workspace-review-facts.test.ts | sed -n '1,115p'
printf '%s\n' '--- all review map lookups and builders ---'
rg -n -F --glob '*.ts' -e 'domains.review.get' -e 'buildWorkspaceReviewFacts(' -e 'buildPairedServerReviewFacts(' -e 'WorkspaceReviewFactsSnapshotSchema' src/shared src/main src/renderer | head -180Repository: stablyai/orca
Length of output: 15743
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- local ownership key projection ---'
rg -n -F --glob '*.ts' -e 'function toLocallyOwnedRows' -e 'export function toLocallyOwnedRows' -e 'toLocallyOwnedRows' src/renderer/src/lib/sidebar-shadow src/shared | head -80
nl -ba src/renderer/src/lib/sidebar-shadow/workspace-activity-shadow.ts | sed -n '1,150p'
printf '%s\n' '--- workspace row key production ---'
nl -ba src/shared/sidebar-list/workspace-rows.ts | sed -n '115,190p'
rg -n -F --glob '*.ts' -e 'buildWorkspaceRows' -e 'Object.entries(buildWorkspaceRows' src/shared src/main src/renderer | head -100Repository: stablyai/orca
Length of output: 12234
Key paired-server review facts by host identity.
When two paired servers expose the same bare worktreeId, facts[row.worktreeId] overwrites one fact. The feed keeps both rows, but domains.review.get(worktree.id) applies the remaining fact to both rows. This can show the wrong PR state and group on the wrong host. Use row.key for paired facts and use that host-qualified key for runtime rows.
Suggested fix
- facts[row.worktreeId] = fact
+ facts[row.key] = fact- prGroupOf: (worktree) => prGroupOfReviewFact(domains.review.get(worktree.id)),
+ prGroupOf: (worktree) =>
+ prGroupOfReviewFact(
+ domains.review.get(
+ worktree.hostId && parseExecutionHostId(worktree.hostId)?.kind === 'runtime'
+ ? getWorktreeHostIdentity(worktree)
+ : worktree.id
+ )
+ ),
ELI5
The phone will soon draw the workspace list itself from what the desktop's background process publishes, while the desktop window draws it from its own copy. This adds a test that feeds both the same workspaces and fails if the two lists differ in any way that matters: section headers, counts, collapse keys, nesting, order, or which rows are highlighted as open. It also adds the phone's list-building function that the test checks, and fixes the differences the test found. Nothing anyone sees changes: every fix sits behind the
ORCA_SIDEBAR_INPUTS=mainbuild switch, which is off in shipped builds.What Changed
src/shared/sidebar-list/sidebar-feed-*.ts). One pure function turns an installed feed (the paged snapshot the phone installs with the shared installer) plus the catalog the phone already reads (repos, project groups, the desktop's view settings) into the same rows the desktop draws: stamp sort, the Workspace options filters,planSidebarRows, host sections and the open-workspace highlight. It reads no clock and does not depend on the build switch, since the phone page is built without it. The phone page switch (P11) will call it; nothing calls it in production yet.sidebar-list-parity.test.tsx). One store goes in. Side A is the desktop window's real hook pipeline with the switch on. Side B derives the feed with the same projections the dev/test shadow check holds equal to main's producers, pages it through main's real feed, installs it with the shared installer, and runs the phone builder (loaded with the switch off). It runs every group-by, sort, project order and pinned policy, each expanded and collapsed, plus host sections, host scopes, a repo filter, Hide sleeping, Hide default branch, Hide CLI-created, the same id open on one of two hosts, and an open local, SSH and paired-server folder workspace. The fixture covers local, SSH and paired-server rows, folder workspaces, GitHub and GitLab review rows, duplicate pins and the same id on two hosts.local|idin the feed but|idin the window, so its row and nesting-collapse keys differed. The feed now keys rows the way the window does;hostIdstill says which host owns the row.sortOrder) when a workspace has no manual position; the feed did not carry it. It does now.Why
The goldens prove the list is right; this proves the phone and desktop cannot drift apart without a test failing, before the phone switches over. The phone builder lives in shared code, not in the test, so the phone page reuses exactly what was checked. Fixes went into the producers and the builder, not the test: the fixture only stamps hosts the way the window's catalog fetch does and leaves out inputs the feed never carries.
Never compared, because no feed input carries them: the window's drag previews, search, hover hold and agent-send reveal; its imported-worktrees and new-external-worktrees cards; its create preflight; host-header health and detail. Known gaps, listed in the test and left out of the fixture: a creation a paired server runs; a paired server's activity under Hide sleeping (the window reads its own tabs); a PR unlinked on a server workspace; an SSH workspace reached through a paired server. Repos and project groups come from the catalog the phone already reads, since the feed has none for paired servers.
Linked Issue
N/A (internal refactor series, sidebar B-lite P7)
Visual Proof
N/A: no visible change. The new code runs only in tests or behind a build switch that is off in shipped builds.
Testing
pnpm tcpasses.Unit:
src/shared/sidebar-list,src/main/runtime/sidebar-inputs,src/renderer/src/lib/sidebar-shadow,src/renderer/src/components/sidebar: all pass (switch-off goldens unchanged). The new parity suite: 14 tests.Positive controls (not committed): reverting the row-key fix fails 11 of 12 tests; dropping PR facts fails 8; dropping paired-server nesting fails 11; dropping paired-server folder workspaces fails 13.
Switch on, hidden app (
ORCA_BACKGROUND_LAUNCH=1), shadow specs:sidebar-workspace-rows,paired-server-rows-shadow,sidebar-review-facts,sidebar-inputs-feed,paired-mobile-desktop-mirror-workspace-visibility,sidebar-folder-keyboard-navigation,sidebar-creation-registry,sidebar-agent-row-identity: 0 shadow mismatches.check:code-quality:changed, oxlint, anti-slop lint, focus-read ratchet, max-lines ratchet pass.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Two elegance and bug review rounds (the change, then the fix delta). Applied: paired-server folder workspaces and nesting, SSH host ids decoded, the focused server passed to the host list, the folder device filter reused, shared row mapping, the paired-server shadow checking lineage the way the server does. Left as listed known gaps: paired-server Hide sleeping, creations, unlinked PRs, SSH through a server.
Agent skill upstream boundary
Notes
SSH, folder workspaces, paired servers and GitLab are covered by the fixture. Wire: every new field is optional; older readers drop it and newer readers default it. Switch off: the phone builder has no production caller, and the producer changes run only in switch-on builds.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)