Skip to content

[1127] feature: task-dnd-ux (2/3) - #46

Closed
myk1yt wants to merge 27 commits into
mainfrom
pr/b09-task-org-ipc-v2
Closed

[1127] feature: task-dnd-ux (2/3)#46
myk1yt wants to merge 27 commits into
mainfrom
pr/b09-task-org-ipc-v2

Conversation

@myk1yt

@myk1yt myk1yt commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Stack Position

Description

https://youtube.com/shorts/6kx-bNScYew?feature=share

Full Feature Description

  • Feature Branch: feature/task-dnd-ux
  • Feature Name: Task Organization and Drag-and-Drop UX
  • Purpose: Resolves the problem where, as history grows, finding related tasks and maintaining priority becomes difficult, and manual organization state can get mixed across workspaces or disappear as UI-only state. Preserves manual folders, pins, root/subtask grouping, and stable ordering in workspace-scoped storage, and exposes them through a drag-and-drop UI that supports both pointer and keyboard interaction.
  • Full Change Description: B08 implements the folder/pin/membership/order contract with atomic persistence, revision conflict handling, and corrupt-file recovery. B09 receives create/rename/move/pin/reorder/delete requests as typed webview messages, passes them to the store, and publishes authoritative extension state. B10 implements history grouping, dialog, pin control, DnD surface/hook, optimistic update with rollback, empty/error state, and locale and visual coverage.
  • Impact Scope: Affects task-organization.ts, TaskOrganizationStore.ts, safeWriteJson.ts, taskOrganizationMessageHandler.ts, ClineProvider.ts, HistoryView.tsx, ExtensionStateContext.tsx.
  • Errors and Edge Cases: Writes are serialized with read-modify-write inside a lock and atomic replacement, returning revision mismatch as a retryable conflict. Future schemas are not overwritten. Folders and pins from workspace A must not appear in workspace B. Stale task IDs and stale drag sources are treated as recoverable no-ops. Pointer cancel restores the previous order, and optimistic UI reconciles with extension-confirmed state. Keyboard users must also be able to perform drag, drop, and cancel.
  • Testing Method: Run B08's schema/default/workspace isolation/atomic write/concurrency/future-version tests, B09's typed request/validation/write-failure/state-refresh tests, and B10's component/context/DnD/accessibility/locale/visual tests. Manually perform folder creation, pointer and keyboard move, cancel, pin, rename, delete, and view reopen, verifying that two workspaces' states do not mix.

Why Split Into 17 PRs

Instead of submitting this feature as a single unified PR, it was split into individual PRs because as code size grows, safely reviewing a PR becomes very difficult. The feature was broken into mutually exclusive individual PRs so that each can be reviewed independently.

What This PR Specifically Changes

Validates typed create/rename/move/pin/reorder/delete requests, passes them to the store, and publishes success/recoverable error and authoritative extension state to the webview. Does not include UI components.

Included Files

  • src/core/webview/taskOrganizationMessageHandler.ts
  • src/core/webview/webviewMessageHandler.ts
  • src/core/webview/ClineProvider.ts
  • src/core/webview/__tests__/taskOrganizationMessageHandler.spec.ts

Exclusion Scope

  • History visual component and DnD hook
  • Duplicate implementation of B08 store/contract
  • All items in the common removal rules

Summary by CodeRabbit

New Features

  • Organize tasks into custom folders, including renaming, removal, and task movement.
  • Pin frequently used tasks, folders, and task groups for quick access.
  • Organization changes persist across sessions and synchronize with task history.
  • Validation and clear feedback help manage invalid actions, conflicts, and pin limits.

Reliability

  • Improved recovery from interrupted or corrupted updates while protecting saved data.
  • Organization changes remain consistent across simultaneous updates.

Upstream PR: Zoo-Code-Org#1127

Zoo (VP) and others added 27 commits August 7, 2026 02:06
…ence

- Add Zod-based type contracts in packages/types/src/task-organization.ts
- Add TaskOrganizationStore with atomic read-modify-write via safeUpdateJson
- Add safeUpdateJson helper to src/utils/safeWriteJson.ts
- Add taskOrganization to GlobalFileNames
- Export TaskOrganizationStore types from @roo-code/types
- Add ExtensionMessage/WebviewMessage fields for task organization
- 29 tests covering CRUD, folder management, pinning, and concurrency
- Fix all no-explicit-any lint errors with proper type narrowing
…vider state assembly

- Add taskOrganizationMessageHandler.ts: validates mutation requests via Zod,
  applies through TaskOrganizationStore, posts typed results to webview
- Add taskOrganizationMessageHandler.spec.ts: 6 tests covering validation,
  success, store rejection, and unexpected error paths
- Wire taskOrganizationMutation case in webviewMessageHandler.ts
- Integrate TaskOrganizationStore into ClineProvider: constructor init, dispose,
  getTaskOrganizationStore() getter, reconcile on history writes, and
  taskOrganization state in getStateToPostToWebview()
- Add TaskOrganizationStore for atomic persistence
- Add DnD controller and UI components with dnd-kit
- Add folder creation and drag-drop composition
- Add pin buttons with ErrorBoundary protection
- Add selection mode folder actions and DeleteFoldersDialog
- Convert to whole-card drag with interactive control guard
- Add localization for DnD UX redesign features
- Stabilize DnD components and Welcome screen integration
…nd folders

Three bugs caused workspace A's tasks/pins/folders to leak into workspace B:

1. HistoryPreview passed undefined as cwd to buildGroupedOrganizationProjection,
   disabling workspace filtering entirely in the preview.

2. HistoryView's renderPinnedHeader iterated ALL organization.pins (global state)
   without workspace filtering. Pinned tasks from other workspaces displayed raw
   task IDs as labels (the 'encrypted numbers' symptom).

3. buildGroupedOrganizationProjection always included folder projections even when
   all members belonged to other workspaces, causing empty folders from workspace A
   to appear in workspace B.

Fix: pass cwd to the projection in HistoryView, filter pins by workspace when
showAllWorkspaces is false, and skip folders with no visible members when cwd
is provided. Genuinely empty folders (zero taskIds) are preserved.
Distinguish cwd === undefined (show all workspaces) from cwd === empty
string (no workspace open). Previously !cwd treated both identically,
causing workspace-specific folders and pins to appear when no workspace
was open.

- isVisibleInWorkspace: !cwd → cwd === undefined
- folder skip condition: cwd && ... → cwd !== undefined && ...
… role=button to SubtaskRow

- DraggableTaskEntry deliberately strips role from dnd-kit attributes so
  the wrapper is not matched by interactive selectors; update the two
  tests to assert the actual contract (no role/aria-pressed, tabindex=0,
  aria-roledescription=draggable) instead of role=button.
- SubtaskRow's keyboard-interactive row (tabIndex + Enter/Space handler)
  lacked role=button; add it for a11y correctness. Safe for
  TaskOrganizationPointerSensor since [role=button] is not in its
  INTERACTIVE_SELECTOR.

Fixes 4 failing platform-unit-test specs on PR #31 CI (ubuntu+windows).
…r reloads

- save(): reject writes whose base revision is already on disk (>= instead
  of >) so two processes computing next=N+1 from the same base cannot both
  commit; the second now fails with TASK_ORG/PERSISTENCE/005 instead of
  silently overwriting the first.
- load(): keep the in-memory state on transient read errors (e.g. the
  directory watcher firing mid temp+rename) instead of resetting to empty,
  which previously made the next mutation compute from an empty aggregate.
- reloadFromWatcher(): fire onChange whenever the reloaded aggregate
  differs in content, not only when the revision increases, so the victim
  of a same-revision lost update still gets its webview notified.
The TaskHistoryStore.onWrite closure dereferenced
this.taskOrganizationStore, which is only assigned a few lines after the
history store is constructed. A history write landing in that window threw
a TypeError (caught and logged, reconcile skipped). Guard the dereference
so the reconcile is skipped cleanly until the store exists.
… merges

The dedicated taskOrganizationUpdated handler drops stale revisions, but
the full-state merge path spread newRest unconditionally, so a state push
assembled before a mutation commit could arrive after the broadcast and
regress the webview to an older revision (folder/pin UI flickers back and
the next DnD mutation then gets a spurious TASK_ORG/CONFLICT/002). Apply
the same revision guard to the taskOrganization field in
mergeExtensionState.
…ty-cwd semantics

- HistoryView: folder pins were exempt from workspace filtering, so a
  folder whose members all belong to another workspace still rendered as
  a pinned shortcut in Current Workspace mode. Keep a folder pin only
  when the folder is visible in the workspace-scoped projection (at least
  one visible member, or genuinely empty), matching
  buildGroupedOrganizationProjection.
- taskOrganizationModel: filterByWorkspace treated cwd === "" as
  unfiltered, contradicting the documented "no workspace open" semantics.
  cwd === undefined is now the only unfiltered mode; "" filters to tasks
  without a workspace, matching buildGroupedOrganizationProjection.
…uire (PR Zoo-Code-Org#1127)

CI failures:
1. Code QA Roo Code run 31229055807: @roo-code/vscode-e2e#lint failed with
   unused 'vscode' import in task-org-ipc.test.ts.
2. E2E Tests (Mocked) run 31229055772: all 5 Task Organization IPC tests
   failed with 'Cannot find module ../../../src/core/webview/ClineProvider'
   because the compiled test (apps/vscode-e2e/out/suite/) cannot resolve the
   extension's TS sources.

Fix:
- Add getVisibleProviderForTesting() to RooCodeAPI (packages/types) and
  implement it in src/extension/api.ts returning the sidebar ClineProvider.
- Rework task-org-ipc.test.ts to obtain the provider via the public API and
  drive mutations through the real TaskOrganizationStore + Zod schema (the
  same pipeline handleTaskOrganizationMessage uses), with structural typing.
- Remove the unused vscode import (lint fix).
- Use currentRevision - 2 for the stale-revision conflict test so baseRevision
  is deterministically stale even when the store has only one committed
  revision.
Runs: https://github.com/Zoo-Code-Org/Zoo-Code/actions/runs/31229055807
      https://github.com/Zoo-Code-Org/Zoo-Code/actions/runs/31229055772
@myk1yt myk1yt closed this Aug 12, 2026
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.

2 participants