feat(task-021): add admin workflow template api
This commit is contained in:
@@ -53,15 +53,15 @@ Development description: Build the backend domain, persistence, and public API f
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] TDD pre-requirement: before implementation, write one failing Admin API test for creating a workflow template with two editable stages and one failing Editor mutation denial test; proceed one behavior at a time and record evidence in `Result`.
|
||||
- [ ] Workflow templates are persisted with status, version, audit metadata, and ordered stages.
|
||||
- [ ] Stage parts are persisted as structured JSON and returned unchanged through the public API.
|
||||
- [ ] Admin can update stage owner role, runner profile, inputs, outputs, acceptance criteria, human approval flag, retry policy, and stage parts.
|
||||
- [ ] Admin can reorder stages and the returned workflow reflects the new order.
|
||||
- [ ] Activation creates an immutable version increment and archives no data.
|
||||
- [ ] Archive hides workflow from Editor list but keeps Admin history visible.
|
||||
- [ ] Editor mutation attempts return the same authorization error shape used by existing Admin APIs.
|
||||
- [ ] OpenAPI/shared contracts include workflow template request/response schemas.
|
||||
- [x] TDD pre-requirement: before implementation, write one failing Admin API test for creating a workflow template with two editable stages and one failing Editor mutation denial test; proceed one behavior at a time and record evidence in `Result`.
|
||||
- [x] Workflow templates are persisted with status, version, audit metadata, and ordered stages.
|
||||
- [x] Stage parts are persisted as structured JSON and returned unchanged through the public API.
|
||||
- [x] Admin can update stage owner role, runner profile, inputs, outputs, acceptance criteria, human approval flag, retry policy, and stage parts.
|
||||
- [x] Admin can reorder stages and the returned workflow reflects the new order.
|
||||
- [x] Activation creates an immutable version increment and archives no data.
|
||||
- [x] Archive hides workflow from Editor list but keeps Admin history visible.
|
||||
- [x] Editor mutation attempts return the same authorization error shape used by existing Admin APIs.
|
||||
- [x] OpenAPI/shared contracts include workflow template request/response schemas.
|
||||
|
||||
## Verification
|
||||
|
||||
@@ -71,9 +71,9 @@ Development description: Build the backend domain, persistence, and public API f
|
||||
|
||||
## Result
|
||||
|
||||
- Status: Not started.
|
||||
- TDD plan:
|
||||
- Red evidence:
|
||||
- Green evidence:
|
||||
- Refactor notes:
|
||||
- Verification output:
|
||||
- Status: Implemented.
|
||||
- TDD plan: Use the existing pre-requirement API tests in `apps/backend/tests/integration/test_admin_workflow_templates_public_api.py`, then cover the remaining acceptance criteria with a focused API flow for reorder, activate/archive, editor visibility, admin history, and audit persistence.
|
||||
- Red evidence: Pre-implementation `PYTHONPATH=/private/tmp/pupline-backend-deps python3 -m unittest apps.backend.tests.integration.test_admin_workflow_templates_public_api` failed with two public API assertions: expected `201`/`403`, actual `404 {"detail":"Not Found"}` for missing `/api/admin/workflows`.
|
||||
- Green evidence: `PYTHONPATH=/private/tmp/pupline-backend-deps python3 -m unittest apps.backend.tests.integration.test_admin_workflow_templates_public_api` -> `Ran 3 tests ... OK`.
|
||||
- Refactor notes: Added workflow template status/contracts, admin/editor router, application service, SQLite/Postgres tables, repositories, ordered stage persistence, structured stage-part JSON, activation/archive, and audit events. Active workflow templates are readable by editors; draft/archived templates remain admin history only. Draft-only mutation preserves activated version immutability.
|
||||
- Verification output: `PYTHONPATH=/private/tmp/pupline-backend-deps python3 -m unittest apps.backend.tests.contracts.test_public_openapi_contract` -> `Ran 1 test ... OK`; `PYTHONPATH=/private/tmp/pupline-backend-deps python3 -m unittest apps.backend.tests.integration.test_schema_storage_contracts` -> `Ran 3 tests ... OK`; `PYTHONPATH=/private/tmp/pupline-backend-deps python3 -m py_compile ...` for changed backend modules -> OK. Existing broader auth suite was also attempted and still fails in `test_editor_can_create_articles_and_approve_plan_review` with `404 {"detail":"Not Found"}` while approving nonexistent plan id `00000000-0000-0000-0000-000000000123`; left unchanged.
|
||||
|
||||
Reference in New Issue
Block a user