5.9 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec | |
|---|---|---|---|---|---|---|---|
| 02-frontend-workflow-resolution | Restore the remembered workflow | done | 2 |
|
plan.md | ../../specs/tasks/requirements/task-create-workflow-memory.md |
Task 02: Restore the Remembered Workflow
Intent
Map the per-workspace backend preference into shared frontend state and resolve standard Create Task workflows with last-used precedence without overriding a manual choice or an explicitly locked flow.
Acceptance
- Wire, store, boot/HTTP/WS, and queued-overlay paths preserve multiple
workflowIdsByWorkspaceentries and converge after backend publication. - Workflow resolution uses locked workflow → current-dialog manual selection → valid per-workspace last-used workflow → valid unlocked context → sole visible workflow → none.
- Restored workflows drive step loading and workflow-agent overrides, while the one-visible-workflow selector suppression and locked edit/Improve Kandev flows remain unchanged.
TDD sequence
- Add mapper and overlay tests for absent, populated, merged, stale, and synced workflow maps; confirm RED before adding the field.
- Add table-driven workflow resolver tests, including conflicting filter, manual choice, locked choice, deleted/hidden history, cross-workspace history, and sole-visible fallback; confirm RED.
- Thread the normalized preference through dialog setup/computed state, separate unlocked context from manual/locked form selection, and update dependent workflow-step/agent effects.
- Remove the component-local workflow recency sorter and run the focused frontend tests plus typecheck.
Files likely touched
apps/web/lib/types/http-user-settings.tsapps/web/lib/state/slices/settings/types.tsapps/web/lib/ssr/user-settings.tsapps/web/lib/ssr/user-settings.test.tsapps/web/hooks/use-ensure-user-settings.tsapps/web/hooks/use-ensure-user-settings.test.tsapps/web/components/state-provider.tsxapps/web/components/state-provider.test.tsxapps/web/components/task-create-dialog-handlers.tsapps/web/components/task-create-dialog-handlers.test.tsapps/web/components/task-create-dialog-defaults.tsapps/web/components/task-create-dialog-defaults.test.tsapps/web/components/task-create-dialog-types.tsapps/web/components/task-create-dialog-state.tsapps/web/components/task-create-dialog-computed.tsapps/web/components/task-create-dialog-setup.tsapps/web/components/task-create-dialog-locked-fields.tsapps/web/components/task-create-dialog-effects.tsapps/web/components/task-create-dialog-autopick.ts- Focused existing tests for state, setup, locked fields, effects, and form body
apps/web/components/task-create-dialog-form-body.tsxapps/web/components/workflow-selector-row.tsx
Dependencies
- Task 01 supplies the authoritative wire field and backend merge semantics.
Parallelism
sequential — shared state, dialog form state, and resolver wiring overlap
throughout this task.
Inputs
- Spec
What,Failure modes, and workflow-resolution scenarios. - Existing
createDefaultUserSettings,parseTaskCreateLastUsed,mergeTaskCreateLastUsedOverlay,computeSingleWorkflowFallbackId,useLockedFieldSync, anduseWorkflowAgentProfileEffectpatterns. - Task 01's final backend JSON and boot-state shapes.
Verification
cd apps/web && pnpm test -- --run lib/ssr/user-settings.test.ts hooks/use-ensure-user-settings.test.ts components/state-provider.test.tsx components/task-create-dialog-handlers.test.ts components/task-create-dialog-defaults.test.ts components/task-create-dialog-state.test.ts components/task-create-dialog-effects.test.ts components/task-create-dialog-form-body.test.tsxcd apps/web && pnpm run typecheck
Mobile parity
The change is shared state normalization inside the existing responsive dialog. It does not change composition, navigation, overlay geometry, scrolling, safe-area behavior, focus, or touch targets. The current mobile Kanban FAB flow remains the nearest exemplar and existing mobile E2E coverage remains valid; no new mobile-only test is required.
Risks
- Settings can settle after open; late restoration must not replace a workflow the user manually chose in that open cycle.
- Unlocked context and locked workflow currently share
selectedWorkflowId; separating them must not weaken locked feature/edit behavior. - Map comparisons must be content-based so overlay cleanup is not blocked by new object identities.
Output contract
Report RED evidence, changed files, focused Vitest counts, typecheck result,
mobile-parity confirmation, blockers, risks, and synchronize this task plus
plan.md status/results in the primary conversation.
Results
Mapped the backend workflow history into SSR, HTTP, WebSocket, boot, and queued-overlay state. The dialog now resolves locked, manual, remembered, contextual, and sole-visible workflows in the approved order; workflow steps and agent overrides consume the same effective ID. The component-local option sorter was removed, and locked feature flows retain their explicit selection.
TDD RED evidence included seven failing resolver cases before the resolver was implemented; overlay and settings tests then covered missing, merged, stale, and converged maps. Final verification:
cd apps/web && pnpm test -- --run lib/ssr/user-settings.test.ts lib/ws/handlers/users.test.ts hooks/use-ensure-user-settings.test.ts components/state-provider.test.tsx components/task-create-dialog-handlers.test.ts components/task-create-dialog-defaults.test.ts components/task-create-dialog-state.test.ts components/task-create-dialog-effects.test.ts components/task-create-dialog-form-body.test.tsx
9 files and 158 tests passed. cd apps/web && pnpm run typecheck also passed.
The mobile-parity contract remains unchanged: shared resolution is used by the
existing responsive dialog and no new mobile-only composition was introduced.