10 KiB
id, title, status, wave, depends_on, plan, requirements, acceptance_criteria, system_design
| id | title | status | wave | depends_on | plan | requirements | acceptance_criteria | system_design | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 01-import-profile-selection | Implement workflow import profile selection | done | 1 | plan.md |
|
|
|
Task 01: Implement workflow import profile selection
Summary
Deliver the manual import flow from preview through profile selection to persisted workflows. Use TDD for the service, HTTP contract, and client state, then verify both browser compositions.
In scope
- Implement the preview and explicit JSON import contracts in the linked design.
- Wire eligible profile lookup with caller context and exact-ID validation.
- Preserve all session targets and validate the selected batch before persistence.
- Implement shared import state and desktop/phone selection surfaces.
- Add translated loading, empty, conflict, retry, and success states.
- Update public import documentation with browser selection and legacy API distinctions.
Out of scope
The exclusions in the plan apply. Do not create profiles, change profile configuration, or alter sync behavior.
Acceptance
- The supplied Feature structure imports after explicit selection for Implement. PR still targets that step after reload.
- Exact matches proceed automatically. Missing, stale, unauthorized, and malformed selections cannot cause partial validation writes or guessed replacements.
- Desktop and phone users complete the flow, recover from errors, and retain selections through valid retries. Locale and focused regression checks pass.
ASCII UI preview
These excerpts use the labels from the full preview. They cover AC-TASKS-IMPORT-PROFILES-001.1, .3, .6, .8, and .9.
UI-01 Desktop:
Choose agent profiles
Feature > Implement
Requested: Codex / gpt-5.6-luna / agent-full-access
[Choose a profile v]
[Back] [Cancel] [Import]
UI-02 Phone: UI-03 Phone picker:
< Back Choose profiles X < Back Implement
Feature > Implement [Search profiles]
Requested agent/model/mode [Profile / agent / model / mode]
[Choose a profile >] [Another profile]
(scrolling step list) (scrolling candidate list)
[Import] + safe-area padding
UI-03 replaces UI-02 within one drawer. Back preserves selections. Headers and primary actions stay fixed. Each active view has one vertical scroll region. The YAML dialog and UI-01 use the same wider desktop size, with a compact secondary file chooser. Pickers start closed. Selected triggers use one line, while candidate rows retain their detailed labels. Import stays disabled while a required selection is empty or submission is pending. An empty catalog provides settings access and Retry. A profile conflict identifies the affected step inline. Compare rendered desktop and phone views with these structural requirements during E2E verification.
Verification
Run each command from the repository root. The managed E2E runner rebuilds the application. Use the recorded exact suite names for the new unit tests.
(cd apps && pnpm install --frozen-lockfile)
(cd apps/backend && go test ./internal/workflow/service ./internal/workflow/controller ./internal/workflow/handlers -count=1)
(cd apps/backend && go test ./internal/backendapp -run 'TestBuildAgentProfileMatcher|TestWorkflowImportProfileCatalog' -count=1)
(cd apps/web && pnpm exec vitest run app/settings/workspace/use-workflow-import.test.ts app/settings/workspace/workflow-import-profile-selection.test.tsx)
(cd apps/web && pnpm run typecheck)
(cd apps/web && pnpm exec eslint app/settings/workspace/workspace-workflows-client.tsx app/settings/workspace/workspace-workflows-dialogs.tsx app/settings/workspace/use-workflow-import.ts app/settings/workspace/workflow-import-profile-selection.tsx app/actions/workspaces.ts lib/types/http.ts)
(cd apps/web && pnpm run i18n:check)
(cd apps/web && pnpm e2e:run --project chromium tests/workflow/workflow-import-export.spec.ts)
(cd apps/web && pnpm e2e:run --project mobile-chrome tests/workflow/mobile-workflow-import-export.spec.ts)
node --test scripts/validate-public-docs.test.mjs
node scripts/validate-public-docs.mjs
python3 scripts/list-docs.py validate
python3 scripts/lint-spec-files.py --all
git diff --check
The new backend wiring test must be named TestWorkflowImportProfileCatalog or use that prefix.
The new Vitest files and E2E file must exist before their commands run.
If implementation requires additional focused files, update the command list to cover them.
No broad QA or review gate is part of this task.
Files likely touched
apps/backend/internal/workflow/service/service.go- New
apps/backend/internal/workflow/service/import_profile_selection.goand corresponding test file apps/backend/internal/workflow/controller/controller.goapps/backend/internal/workflow/handlers/handlers.go- New
apps/backend/internal/workflow/handlers/import_profile_selection.goand corresponding test file apps/backend/internal/backendapp/services.goandagent_profile_matcher_test.goapps/web/app/actions/workspaces.tsapps/web/lib/types/http.tsapps/web/app/settings/workspace/workspace-workflows-client.tsxapps/web/app/settings/workspace/workspace-workflows-dialogs.tsx- New
apps/web/app/settings/workspace/use-workflow-import.tsand corresponding test file - New
apps/web/app/settings/workspace/workflow-import-profile-selection.tsxand corresponding test file apps/web/src/locales/*/workflows.jsonapps/web/e2e/tests/workflow/workflow-import-export.spec.ts- New
apps/web/e2e/tests/workflow/mobile-workflow-import-export.spec.ts docs/public/workflow-import-export.md- This plan, work order, and paired design for final status and evidence
Dependencies
None. Work is sequential within this vertical slice.
Risks
The import helper is shared with sync. Preserve its current contract. The current profile hook also applies runtime health and feature filters. It must not silently redefine server import eligibility. Generic API errors can discard response details. Verify structured conflicts through the actual HTTP action. Do not claim transaction atomicity for storage failures beyond the existing import contract.
Parallelism
sequential
Inputs
- Requirements
- System design
apps/backend/AGENTS.mdandapps/web/AGENTS.md- Existing workflow import service tests and
e2e/tests/workflow/workflow-import-export.spec.ts components/kanban/mobile-menu-sheet.tsxfor viewport and scroll geometrycomponents/settings/workflow-session-target-surfaces.tsxfor profile rows/tdd,/e2e,/mobile-parity, and/docs-maintainer
Results
UX correction on 2026-09-17: pickers now start closed, selected profile labels use one line, and both desktop dialogs use a 48 rem maximum width. The file button uses a secondary style with a 28 px desktop height and a 44 px phone height. The YAML editor starts taller and has bounded scrolling.
The closed-picker assertion failed before the hook change and passed afterward. Final checks for this correction passed:
- Focused Vitest command above: 15 tests.
- Desktop E2E command above: 8 tests, including width, file-button size, normal profile click, and selected-label containment.
- Mobile E2E command above: 1 test, including the file-button touch target.
- Typecheck, targeted ESLint, specification lint, catalog validation, and
git diff --check.
The first desktop E2E run rebuilt the application. Final desktop and mobile runs reused that build with --no-build after test-only additions.
Implemented the browser workflow import profile-resolution flow end to end. The backend now previews eligible global profiles, validates explicit profile bindings and revisions before persistence, and preserves direct profile IDs and session targets. The web client now provides localized desktop and phone selection surfaces, retry and conflict recovery, and generation-safe import state. Public import documentation describes the preview, browser envelope, profile conflicts, and raw YAML behavior.
Review fixups preserve a non-null empty profile catalog, invalidate canceled previews and late file reads, keep final submission ownership through draft edits, and keep the selection surface mounted during pending submission. Storage failures compensate by deleting already-created steps and the new workflow. Focused regressions cover empty-catalog HTTP serialization, malformed binding validation, partial-step rollback, rendered desktop and phone empty/loading states, deferred cancellation and reopen, late file-read results, stable busy status, in-flight edit/repeated-submit protection, coarse pointer tablet drawers, picker Escape navigation, and the 767 px touch-target boundary.
Verification passed:
- Backend focused workflow, controller, handler, and profile-catalog tests, including the empty eligible-catalog HTTP array regression.
- Focused frontend Vitest suite: 15 tests passed, including rendered desktop and phone empty/loading states, the deferred final-submit dialog path, deferred cancellation and reopen, late file-read results, stable busy status, and in-flight edit/repeated-submit protection.
- Focused backend import suite passed, including malformed binding rejection, workflow-field rollback, and partial-step rollback.
- Frontend typecheck, ESLint, i18n checks, and E2E production build.
- Desktop Chromium workflow import E2E: 8 tests passed.
- Mobile Chromium workflow import E2E: 1 test passed, including picker Escape navigation, coarse-pointer drawer behavior, and the 767 px control boundary.
- Public-doc validation, specification validation and lint, and
git diff --check.