cmux NEXT: a new window's sidebar shows only its own workspaces in the band

Merged
AU
15d ago
+93-4

Summary

A new cmux NEXT window opened with dozens of other windows' workspaces listed under Home and App Store. When you dragged one of those workspaces to another window, it still showed in the old window.

Cause: the sidebar document is one per home session and shared by every window. The workspace list was already filtered to the window's own workspaces, but the band above it (the top region: Add to Top, a drop on the band, Pinned, custom sections) drew every workspace item in every window. On the reporter's nightly, sec_top held 34 workspaces next to Home and App Store, so every window showed them.

Fix:

  • Each window draws the sidebar layout without the workspace items another window owns (open or closed), in any items section (SidebarLayoutDocument.scopedToWindow, SidebarRows.visibleLayout(_:window:machines:registry:)).
  • Home, apps, links, closed workspaces and other devices' refs still show in every window. The stored document is unchanged.
  • Close Section Workspaces on a band section closes only what the active window draws.
  • Only on the sidebar-document path. The older sidebar_layout owner sends index ops counted on the stored layout, so it keeps drawing the layout whole.

Behavior change to note: a workspace in the band now shows only in its own window. Pins of a closed window's workspaces come back when that window is reopened.

Changelog

  • Fixed: a new window no longer shows other windows' pinned or top-band workspaces in its sidebar.

Testing

Regression, cmux-ci on Xcode 26.6: scripts/ci/package-test-lane.sh suite Packages/macOS/CmuxNext SidebarLayoutWindowScopeTests (in CmuxNextAppTests).

  • Red on the test commit 398dbba0: it fails to compile, value of type 'SidebarLayoutDocument' has no member 'scopedToWindow'.
  • Green on head e923a54d: 2/2 pass. SidebarSelectionVerbsTests 7/7 pass.

Tagged build 22783-new-window-clean-sidebar: job a7d210dfb337a3d0ddaac395 at e923a54d, published to HQ.

Observed / Not run

  • Observed: the reporter's nightly sidebar store (read-only) had 34 workspace items in sec_top, which matches the extra rows in the screenshot. prepush-gate: no new violations. The red and green runs above.
  • Not run: tagged-app dogfood and the macOS visual review (pending). No App-level test with a real WindowRegistry: the ownership lookup WorkspaceLayoutRefs.ownedElsewhere is covered by review only.

🤖 Generated with Claude Code