iOS: inline Move to Group context-menu picker for workspaces

Merged
AZ
4mo ago
+538-3

Moving a workspace into a group on iOS previously required drag-and-drop, which is fiddly on the phone and impossible when a drag is hard to start (long lists, collapsed groups). Long-pressing a workspace row now shows a Move to Group submenu with one entry per workspace group on that Mac; the current group renders checked and disabled, and grouped workspaces also get Remove from Group.

Selection routes through the exact drag-and-drop path: MobileWorkspaceMovePolicy.normalizedIntent for validity, the optimistic joinGroupAtEnd move chain, and the existing workspace.move RPC, so the picker can never offer a move the drop path would reject, and gating (pending-move cap, search/filter flattening, foreground-Mac-only mutations in All Computers) is identical. A new pure model, MobileWorkspaceGroupMoveMenu, computes the entries (same-Mac filtering with the aggregation empty-vs-nil stamp quirk handled) and is unit-tested; the picker appears in both row pipelines (UIKit table coordinator context menu and the SwiftUI row .contextMenu).

Anchor workspaces get no picker (an anchor moves with its group, matching the host's workspace.move rejection). Remove from Group maps to workspace.move without group_id, which the host resolves as ungroup + move to end of the root list — the same order the optimistic prediction applies locally.

Localization: mobile.workspace.moveToGroup and mobile.workspace.removeFromGroup added to the iOS catalog (en, ja), matching the macOS sidebar's existing contextMenu.workspaceGroup.moveTo/.remove strings.

Tests: 9 new MobileWorkspaceGroupMoveMenuTests (all 247 CmuxMobileShellModel tests green locally) and a coordinator test asserting the submenu structure per capability/anchor/grouped state.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


[!NOTE]
Medium Risk
Touches workspace list mutation UX and extends the grouped move path, but actions still go through the established policy, optimistic ordering, and workspace.move RPC with capability and Mac-scoping gates.

Overview
Adds a Move to Group context-menu path on iOS workspace rows so grouping no longer depends on drag-and-drop alone.

A new MobileWorkspaceGroupMoveMenu model builds picker entries (same-Mac groups, current group checked/disabled, Remove from Group when valid) using MobileWorkspaceMovePolicy.normalizedIntent, matching drag-and-drop rules. Anchor workspaces get no menu; orphan groupID values cannot remove until the group exists in the snapshot.

joinGroupAtEnd now accepts an optional group id (nil = leave group) and is shared by drop-into-group and the menu. The UIKit table coordinator and SwiftUI WorkspaceNavigationRow both wire lazy groupMoveMenu / moveToGroup callbacks with the same reorder gating as drags. English and Japanese strings were added for the new menu labels.

Reviewed by Cursor Bugbot for commit b6d07f4e11ab7b360485f9640bd6a8fcf91a9150. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Adds an inline “Move to Group” context-menu picker on iOS so a workspace can join or leave a group without drag-and-drop. Keeps move behavior identical to drag-and-drop, including gating and ordering.

  • New Features
    • Long-press a workspace to open “Move to Group” with one item per group on the same Mac; current group is checked and disabled, and “Remove from Group” is shown when applicable.
    • Uses the same path as drag-and-drop: MobileWorkspaceMovePolicy + optimistic joinGroupAtEnd + workspace.move RPC, so invalid moves are never offered.
    • Available in both UIKit table menus and SwiftUI row .contextMenu.
    • Anchor workspaces don’t show the picker; removing from a group ungroups and moves to end of the root list.
    • Added iOS localization entries for mobile.workspace.moveToGroup and mobile.workspace.removeFromGroup, plus unit/UI tests for menu logic and structure.

Summary by CodeRabbit

  • New Features

    • Added workspace context-menu and navigation-row actions for moving workspaces between groups.
    • Added support for moving workspaces into ungrouped destinations or removing them from groups.
    • Group menus now show valid destinations, current membership, and unavailable options.
    • Added English and Japanese labels for group movement actions.
  • Bug Fixes

    • Prevented unsupported group anchors and invalid destinations from appearing as move options.
  • Tests

    • Added coverage for grouped, ungrouped, cross-device, anchor, and removal scenarios.