Phase 2: Refactor Tasks cluster to MCP SDK types#1217
Conversation
Replace ad hoc TaskCardProps data shape with SDK Task type across the Tasks group components and TasksScreen. - TaskCard: accept `task: Task` instead of flat props (taskId, status, method, target, progress, etc.); derive all display fields from the SDK Task object (taskId, status, ttl, createdAt, lastUpdatedAt, statusMessage); remove fields not present on SDK Task (method, target, progress as number, error, completedAt, elapsed) - TaskControls: type statusFilter as `TaskStatus | undefined`; add runtime validation guard on Select onChange - TaskListPanel: accept `Task[]` instead of `TaskCardProps[]`; pass `onCancel(taskId)` through to each TaskCard; use `task.taskId` as key - TasksScreen: accept `Task[]` + `onCancel(taskId)` callback; type internal statusFilter state as `TaskStatus | undefined` - Delete re-export of `TaskStatus` from TaskCard (import directly from SDK where needed) - Update all stories with real SDK `Task` fixtures - Update ConnectedView TasksActive story Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@claude review |
|
Claude finished @cliffhall's task in 2m 53s —— View job PR Review: Phase 2 — Refactor Tasks cluster to MCP SDK types
Overall this is a clean, well-scoped refactor — the type surface shrinks significantly and the component API is more honest about what the SDK actually provides. A few issues worth addressing before merge: Bug:
|
Progress notifications (notifications/progress) are sent separately from the Task object per the MCP spec. Add an optional progress prop typed as Pick<ProgressNotification['params'], 'progress' | 'total' | 'message'> so the parent can pass progress data when available. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Progress notifications arrive separately from the Task object, so the parent provides a map of progress data keyed by taskId. TaskListPanel and TasksScreen accept an optional progressByTaskId prop and pass the matching entry to each TaskCard. Updated Mixed story and ConnectedView TasksActive story to demonstrate the progress bar on the active "working" task. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When progress notification data is available for an active task, show the ProgressDisplay (which includes its own message). Fall back to the Task's statusMessage only when no progress data is present. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix Collapse animation: remove outer {isExpanded && ...} wrapper so
Mantine's Collapse component drives the mount/unmount animation
- Show statusMessage for all tasks, not just active ones, so failed/
cancelled tasks display their error reason without expanding
- Remove redundant "Status" detail row — the TaskStatusBadge in the
header already communicates status
- Fix ttl guard: change !== null to != null to correctly handle the
SDK's optional (undefined) field
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Thanks for the review — all actionable items addressed in 3d6280e:
|
Summary
task: Taskinstead of 14 flat props; derives all display from SDK Task fields (taskId,status,ttl,createdAt,lastUpdatedAt,statusMessage); dropsmethod,target, numericprogress,error,completedAt,elapsedwhich don't exist on the SDK Task typestatusFilterasTaskStatus | undefined; adds runtime validation guard on Select onChangeTask[]instead ofTaskCardProps[]; passesonCancel(taskId)through to each TaskCard; usestask.taskIdas keyTask[]+onCancel(taskId)callback; types internalstatusFilterasTaskStatus | undefinedTasksActivestoryDeleted/simplified types
TaskCardPropsas data shape (14 flat fields)Taskfrom SDK (7 fields)TaskStatusre-export from TaskCard@modelcontextprotocol/sdk/types.jsstringstatus filterTaskStatus | undefinedNotable changes
The SDK
Tasktype is narrower than the previousTaskCardProps— it doesn't carrymethod,target, numericprogress, orerror. These were application-level concepts that the original component invented; the real MCP Task schema usesstatusMessagefor progress/error context. Net result: -122 lines.Test plan
npm run format— passesnpm run lint— passesnpm run build(includestsc -b) — passes🤖 Generated with Claude Code