This repository was archived by the owner on Sep 2, 2026. It is now read-only.
Repository navigation
[Spec #28] Sidebar stage groups - #66
Merged
Merged
Conversation
Widen the WorktreeGroupBy union across the store, persistence, and paired-client schemas; bucket worktrees by effective workflow stage in buildOrderedGroups with the fixed stage order and a leading 'Sans stage' lane; thread pr/issue caches through the row model so stage membership and the per-row badge derive from the same effective stage. Issue: #45
…45) Add build-rows.workflow-stage tests (membership, fixed ordering, sans first, effective-stage derivation, lineage nesting, pinned handling, badge in every mode), lane-key unit tests, card stage-badge rendering tests, cache-input gating tests, the group-by toggle option, and persistence/store cases for the new union member. Issue: #45
Children have no stage of their own: buildOrderedGroups' workflow-stage branch and getGroupKeyForWorktree bucketed every worktree by its own effective stage, splitting an unstaged child from its staged parent into 'Sans stage'. Both now resolve lane membership via a shared getWorkflowStageLaneKeyForWorktree/getWorkflowStageLaneRoot in workflow-stage-grouping.ts, walking to the root ancestor and respecting cyclicLineageIds so a cyclic chain cannot loop forever. The per-row stage badge is untouched (still the row's own effective stage). Extends build-rows.workflow-stage.test.ts: unstaged child in parent lane, differing own-declared-stage child still in root lane, multi-level chain, and cyclic lineage stability.
- New use-workflow-stage-row-drag hook + sidebar-workflow-stage-drop pure decision core, reusing decideFeatureBoardCardDrop/decideStageWrite as callerKind 'human', same as the board. - Widen FeatureBoardCardDropRequest.targetStage to WorkflowStage | null so the sidebar's 'Sans stage' lane can reuse the same core to clear a stage. - Wire stage-lane header + item-row drop targets through SectionHeader, virtual-row-dispatch, and VirtualizedWorktreeViewport. - Lineage children are a silent no-op on drop (no stage of their own). - Refusals and post-write failures toast via the same two-toast pattern as the board; no inline banner. - Confirming test that sidebar row order never elevates for awaiting-input worktrees (board-only behavior) and that sidebar grouping never imports applyAwaitingInputElevation.
64ix
marked this pull request as ready for review
August 25, 2026 10:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #28, closes #45, closes #53.
Summary
Adds a fourth sidebar group-by mode, By stage, so the generalist workspace list can be sorted by delivery stage without losing the general overview. Stage lanes follow the fixed board column order with a Sans stage lane on top, lineage children stay nested under their root inside its lane, and a small stage badge rides on staged rows in every grouping mode — including none — so the sidebar stays oriented outside the board. Dropping a workspace onto a stage lane declares that stage through the same authority guard the board uses, with blocked drops explained rather than silently dropped. Awaiting-input keeps its existing agent-state gutter indicator, and rows never reorder themselves — elevation stays board-only by design.
The three existing modes (status, repo, PR status) are untouched.
Spec & Tickets
Acceptance criteria
GROUP_BY_OPTIONSgains aworkflow-stageentry (sidebar-workspace-option-items.ts);SidebarGroupByToggle.test.tsxasserts all four render in order. The other three modes' branches are untouched —build-rows.test.tsandbuild-rows.folder-workspace-lanes.test.tsstill pass unchanged for them.WORKFLOW_STAGE_LANE_ORDER=[sans, ...WORKFLOW_STAGE_IDS], the same fixed set the board columns iterate.build-rows.workflow-stage.test.ts: "groups by declared stage with 'Sans stage' first", "orders lanes by the fixed stage pipeline regardless of encounter order". Empty lanes stay hidden, matching the existing status-lane behavior.getWorkflowStageLaneRoot(walks parent links, treats a cyclic member as rootless).build-rows.workflow-stage.test.ts: unstaged child lands in its staged parent's lane with no "Sans stage" header; a child whose own declared stage differs still follows the root; a three-level chain buckets entirely into the root's lane; cyclic lineage stays stable and does not hang.WorktreeRow.effectiveStage, populated inrow-builders.tsfor every mode's item emission (including the pinned section and the flatnonepath) — deliberately not coupled to thehasWorktreeCardDetailsgate.WorktreeCard.stage-badge.test.tsxplusbuild-rows.workflow-stage.test.ts: "renders the effective stage badge on rows in every grouping mode".getEffectiveWorkflowStageForWorktreewrapsderiveEffectiveWorkflowStage(spec #22/#38) and falls back to the declared stage.build-rows.workflow-stage.test.ts: membership derives from cached PR facts over the declared stage, an open PR promotes an undeclared worktree toreview, a closed PR sends it totriage, an open linked issue promotesidea→spec.workflow-stage-grouping.test.tscovers the lane-key/label round trip.useWorkflowStageRowDragresolves the lane's stage from the drop target's key and writesworkflowStageviaupdateWorktreeMeta. Both the group header and every row inside the lane are drop targets (mirroring status-lane behavior); item rows readrow.sectionKey, the lane they visually sit in, not their own effective stage.use-workflow-stage-row-drag.test.tsx.decideSidebarWorkflowStageDropwraps the board'sdecideFeatureBoardCardDrop, so the authority gate and its explanation strings are shared, not forked. A refusal aborts the whole gesture (all-or-nothing across a multi-select drag) and toasts the guard's own explanation; a write that resolves{ ok: false }toasts the error — the same two-toast pattern the board uses.sidebar-workflow-stage-drop.test.ts,use-workflow-stage-row-drag.test.tsx.StatusIndicator's'permission'state — sourced fromselectWorktreeAgentActivitySummary(...).hasPermission— already renders unconditionally on every sidebar row viashowStatus, in every grouping mode. See the Problem → Resolution note on the colour.build-rows.no-awaiting-elevation.test.tsasserts row order is unchanged with an awaiting worktree present, and guards againstapplyAwaitingInputElevationever being imported into sidebar grouping.sidebar-workflow-stage-drop.test.tstests the pure decision seam (accepted drop declares the stage; refused drop carries the guard's explanation and produces no write; human→shippedallowed; lineage child skipped).use-workflow-stage-row-drag.test.tsxcovers the hook seam (persists on allow, toasts and writes nothing on refusal, toasts on a failed write).Changes
Group-by mode plumbing —
'workflow-stage'added to the canonicalWorktreeGroupByunion and each of its four duplicates (renderer store, shared persisted-UI type, main-processnormalizeGroupBy, theclient-ui.setzod enum) so the mode survives a restart and a cross-client sync instead of being normalized away. The exhaustivegetFolderWorkspaceLaneKeyswitch gains aworkflow-stagecase: folder workspaces run the manual regime and never derive a stage, so they join the "Sans stage" lane.Stage lanes — new
workflow-stage-grouping.tsowns the lane vocabulary (key prefix, sans key, key↔stage round trip, labels reused fromgetFeatureBoardStageLabel, and the fixed lane order). Bucketing and single-worktree lookup both go through one resolver,getWorkflowStageLaneKeyForWorktree, so lane membership, group-reveal targeting, and collapse state cannot disagree about which lane a row lives in. Lineage-root resolution respects the existing cyclic-lineage guard.Stage badge —
WorktreeRow.effectiveStagethreads throughitem-row.tsxintoWorktreeCard, rendered as a small outlineBadgematching the sibling chips already inworktree-card-header.tsx. Populated for all modes, so it is present in the flat list too.Stage drops —
useWorkflowStageRowDragwires the group header and the lane's rows as drop targets, resolves each dragged worktree's current effective stage and derivation facts, and calls the shared decision core withcallerKind: 'human'. The board'sFeatureBoardCardDropRequest.targetStagewas widened toWorkflowStage | nullso the "Sans stage" lane can clear a stage through the same core — the guard and the de-ship consumed-merge bookkeeping already handlednull. The local/remote authority asymmetry is preserved: local IPC writes are ungated, remoteworktree.setstill gates ascallerKind: 'agent', because that wire method is shared with the CLI, MCP, and mobile and cannot distinguish a human drag.Awaiting-input — no new UI; a confirming test plus a guard against importing the board's elevation into sidebar grouping.
Problem → Resolution
WorkflowStage— the board's drop core typedtargetStageas a concrete stage. → Widened it toWorkflowStage | nullrather than forking the decision core, so "who may write which stage" cannot drift between the two surfaces.row.sectionKey, the lane they are actually rendered in.--agent-question, whose own comment explains it must stay separable from working-yellow), and no--amber/--warningtoken exists. The spec also says to reuse the existing agent-state gutter. → Reused the existing glyph and read "amber" as colloquial for it, rather than inventing a colour token. Flagging for confirmation; swapping the hue later is a one-line change.PersistedUIState.groupBy— mobile's own narrower union has noworkflow-stage, andgroupModeFromDesktopreturnsnullfor an unknown mode, whichapplyDesktopViewSettingsalready resolves to?? current.groupMode. → Left mobile's union narrow: it keeps its own grouping instead of breaking, and widening it would force a mobile stage-grouping design that is out of this spec's scope. No wire change —groupByis an existing field carrying a new value.QA plan
Sans stage, then Idea → Exploring → Spec → Implementing → Review → Shipped → Triage, with empty lanes absent.Sans stagelane appears for the child alone.Sans stage— its stage clears and the badge disappears.shippedlane that a merged PR is driving — it stays where you dropped it instead of snapping back to Shipped.shippedover RPC) — a toast names the reason and the row does not move.Sans stageuntil a stage is declared on them).Reviewer notes
buildRowscall, in all grouping modes, because the badge is required in all of them (includingnone). Each entry is aderiveEffectiveWorkflowStagecall doing PR/issue cache lookups. That work is necessary rather than wasted, but it is new per-row work on the sidebar's hot path — worth watching if list responsiveness regresses on very large workspace sets, where memoizing the map across calls would be the fix.agentcallers, and sidebar drops are alwayshuman). It is kept, and commented as such, so widening the guard surfaces the behavior instead of silently applying partial drops.