Files
content-factory/tasks/023-workflow-template-binding-and-demo-readiness.md
T

5.4 KiB

Task 023: Workflow Template Binding And Demo Readiness

Development description: Bind Admin-managed workflow templates into the demo product flow so article/site configuration references an active workflow template and the final demo checklist proves workflow management is not an isolated Admin CRUD surface.

Implementation Details

  • Backend binding:
    • Add active workflow template reference to target site configuration or article creation input, following the existing product model.
    • Validate that article creation cannot reference archived or missing workflow templates.
    • Preserve existing article workflow status behavior while exposing the configured workflow template snapshot in article detail.
    • Store the workflow template version/snapshot used by each article so later template edits do not rewrite historical article context.
  • Frontend binding:
    • Article creation/site configuration shows the selected active workflow template.
    • Article detail shows the configured workflow template and stage summary in the workflow/history area.
  • Demo readiness:
    • Update demo seed data with at least one active workflow template.
    • Update demo checklist/protocol to include Admin workflow creation/editing and article creation using the active workflow.
    • Keep the existing end-to-end publishing path working.

Public Interface

  • Admin can configure which active workflow template is used by a site or article.
  • Editor can see which workflow template governs an article.
  • Demo reviewers can prove the Admin workflow builder affects the article flow.

Acceptance Criteria

  • TDD pre-requirement: before implementation, write one failing public API test showing article creation stores the active workflow template snapshot; proceed one behavior at a time and record evidence in Result.
  • Seed data includes an active workflow template with stages matching the demo pipeline.
  • Article creation records the workflow template id, version, and stage summary snapshot.
  • Article creation rejects archived/missing workflow template references.
  • Article detail exposes workflow template summary to the frontend.
  • Site configuration or article creation UI allows selecting an active workflow template.
  • Existing end-to-end demo publishing smoke still passes.
  • Final demo readiness protocol includes manual steps for Admin workflow create/edit/reorder/activate and Editor article flow using that workflow.

Verification

  • Run backend article creation workflow-template binding tests.
  • Run existing end-to-end demo stack smoke test.
  • Run frontend model tests for the selected workflow template display.
  • Run final manual demo checklist and record the protocol.

Result

  • Status: Implemented.
  • TDD plan: Use apps/backend/tests/integration/test_workflow_template_binding_public_api.py as the public API red test for article creation with an active workflow template, archived/missing template validation, and immutable detail snapshot after workflow archival. Then wire persistence/contracts, seed data, frontend intake/detail display, and demo protocol updates.
  • Red evidence: PYTHONPATH=/private/tmp/pupline-backend-deps python3 -m unittest apps.backend.tests.integration.test_workflow_template_binding_public_api -v failed with all 3 tests returning 422 extra_forbidden for workflow_template_id.
  • Green evidence: PYTHONPATH=/private/tmp/pupline-backend-deps python3 -m unittest apps.backend.tests.integration.test_workflow_template_binding_public_api -v -> Ran 4 tests ... OK.
  • Refactor notes: Added optional article workflow_template_id, stored workflow template id/version plus immutable JSON snapshot, active-template validation, seeded active demo workflow stages, generated OpenAPI/shared TypeScript contracts, article intake active-workflow selector, and article detail snapshot display. Existing article workflow statuses remain unchanged.
  • Verification output:
    • PYTHONPATH=/private/tmp/pupline-backend-deps python3 -m unittest apps.backend.tests.integration.test_workflow_template_binding_public_api -v -> Ran 4 tests ... OK.
    • PYTHONPATH=/private/tmp/pupline-backend-deps python3 -m unittest apps.backend.tests.contracts.test_generated_contract_artifacts apps.backend.tests.contracts.test_public_openapi_contract -v -> Ran 3 tests ... OK.
    • PYTHONPATH=/private/tmp/pupline-backend-deps python3 -m unittest apps.backend.tests.integration.test_end_to_end_demo_stack_smoke_public_api -v -> Ran 1 test ... OK.
    • node apps/frontend/tests/article_form_validation.test.mjs -> passed.
    • node apps/frontend/tests/article_detail.model.test.mjs -> passed.
    • pnpm --filter @pipeline/frontend test:ui -> passed.
    • pnpm typecheck -> passed.
    • BACKEND_URL=http://localhost:13800 FRONTEND_URL=http://localhost:13300 RUNNER_URL=http://localhost:13810 WAIT_SECONDS=120 bash tests/smoke/public-health.sh -> public health smoke ok.
    • PYTHONPATH=/private/tmp/pupline-backend-deps python3 -m unittest apps.backend.tests.integration.test_auth_authorization_public_api.AuthAuthorizationPublicApiTest.test_editor_can_create_articles_and_approve_plan_review -v -> Ran 1 test ... OK after correcting the stale hard-coded missing plan id fixture to approve the generated public API plan.
    • PYTHONPATH=/private/tmp/pupline-backend-deps python3 -m unittest discover apps/backend/tests -v -> Ran 87 tests ... OK (skipped=1).
    • docs/demo-readiness-protocol-2026-05-22.md records the final Task 023 demo readiness protocol.