Files
kandev/docs/plans/workflow-session-settings/task-01-workflow-contract-and-validation.md
T
2026-08-02 22:32:56 +01:00

2.1 KiB

id, title, status, wave, depends_on, plan, spec
id title status wave depends_on plan spec
01-workflow-contract-and-validation Add and validate the workflow session-settings contract done 1
plan.md ../../specs/workflow-session-settings/spec.md

Task 01: Add and Validate the Workflow Session-settings Contract

Acceptance

  • Backend and frontend workflow action types represent configure_session rules without provider-specific fields.
  • One shared backend validator covers create, update, and import and rejects duplicate actions/families, invalid operations or payloads, empty set rules, and coexistence with agent_profile_id.
  • Valid rules survive snapshot, export, and import byte-for-byte at the semantic JSON level without agent-profile matching.
  • Existing workflows without the action retain their current behavior and serialized shape.

TDD sequence

  1. Add failing model/import/controller tests for the accepted and rejected shapes.
  2. Add typed parsing/validation helpers and call them from every persistence boundary.
  3. Add the frontend discriminated union and serialization tests.
  4. Refactor duplicate validation logic only after the focused tests pass.

Verification

cd apps/backend && go test ./internal/workflow/models ./internal/workflow/controller ./internal/workflow/service
cd apps && pnpm --filter @kandev/web test -- --run lib/types lib/api/domains/workflow-api

Files likely touched

  • apps/backend/internal/workflow/models/models.go
  • apps/backend/internal/workflow/models/export.go
  • apps/backend/internal/workflow/models/export_test.go
  • apps/backend/internal/workflow/controller/controller.go
  • Related workflow controller/service tests
  • apps/web/lib/types/workflow-actions.ts
  • apps/web/lib/types/http.ts
  • Related frontend workflow serialization tests

Dependencies

None.

Inputs

  • Spec sections Data model, API surface, and Persistence guarantees.
  • Existing OnEnterAction, workflow-step create/update, and import validation paths.

Output contract

Report the final typed rule shape, all persistence boundaries using the validator, import/export behavior, files changed, tests run, and any compatibility concern.