Files
content-factory/tasks/005-article-intake-dashboard-detail.md
T

4.8 KiB

Task 005: Article Intake, Dashboard, And Detail Shell

Development description: Build the first user-visible workflow slice where an Editor creates an article brief, sees it on the dashboard, and opens an article detail page with workflow history.

Implementation Details

  • Backend endpoints:
    • POST /api/articles
    • GET /api/articles
    • GET /api/articles/{article_id}
  • Article creation requires:
    • brief_description
    • target_site_id
    • optional content_type
    • optional primary_keyword
  • Creation behavior:
    • Creates article with ARTICLE_BRIEF_CREATED.
    • Attaches target site.
    • Writes ARTICLE_CREATED workflow event.
  • Frontend screens:
    • Dashboard with article title/working title, target website, status, assigned editor, last updated, next required action, and publishing status.
    • New article form.
    • Article detail shell with status summary and timeline.

Public Interface

  • Editor submits a brief in the UI.
  • Dashboard updates with the created article.
  • Article detail page shows the workflow event timeline.

Acceptance Criteria

  • TDD pre-requirement: before implementation, write one failing API behavior test for creating an article and seeing ARTICLE_BRIEF_CREATED; add UI tests after API green and record evidence in Result.
  • Editor can create an article brief for a configured target site.
  • Created article appears in GET /api/articles.
  • Article detail includes target site summary and workflow history.
  • Article creation writes a workflow event with actor and timestamp.
  • Invalid target site returns a validation error.
  • Frontend form shows validation errors without losing typed brief text.

Verification

  • Run backend article API tests.
  • Run frontend component/page tests for dashboard and form.
  • Run a Docker Compose smoke flow from UI brief creation to article detail.

Result

  • Status: Completed end-to-end for Task 005 with backend + frontend shell implemented and validated.
  • TDD plan:
    • API first, UI later: start with one public FastAPI behavior test for the Editor article-intake slice.
    • Red slice: with the demo Editor header, create an article for a configured target site through POST /api/articles; then verify the created article is persisted in GET /api/articles and visible in GET /api/articles/{article_id} with target site summary and an ARTICLE_CREATED workflow event.
    • Green implementation to follow: add article persistence, list/detail HTTP handlers, target-site attachment, and workflow event writes while preserving backend layers.
    • UI tests come after the API behavior is green.
  • Red evidence:
    • Added apps/backend/tests/integration/test_article_intake_public_api.py.
    • Initial run:
      • Command: /private/tmp/pupline-backend-venv/bin/python apps/backend/tests/integration/test_article_intake_public_api.py
      • Result: failing as expected (GET /api/articles returned 405 and GET /api/articles/{article_id} returned 404 before implementation).
  • Green evidence:
    • Created endpoints and repository implementations:
      • POST /api/articles persisted ArticleSummary and created ARTICLE_CREATED workflow event.
      • GET /api/articles returns persisted list.
      • GET /api/articles/{article_id} returns detail with target site and workflow timeline.
    • Validation:
      • POST /api/articles with unknown target_site_id returns 400 with detail Invalid target_site_id.
  • Refactor notes: FSD slicing was applied:
    • features/ contains article-specific logic (validation, row/timeline transforms, form/dashboard models, and UI).
    • pages/ composes feature blocks into route-level screens.
    • app/ contains router entry points.
    • shared/ stores cross-layer API client abstractions.
  • Verification output:
    • /private/tmp/pupline-backend-venv/bin/python apps/backend/tests/integration/test_article_intake_public_api.py (all cases green after implementation, including invalid target_site_id)
    • /private/tmp/pupline-backend-venv/bin/python apps/backend/tests/contracts/test_public_openapi_contract.py
    • /private/tmp/pupline-backend-venv/bin/python apps/backend/tests/contracts/test_generated_contract_artifacts.py
    • /private/tmp/pupline-backend-venv/bin/python apps/backend/tests/contracts/test_domain_contracts.py
    • /private/tmp/pupline-backend-venv/bin/python apps/backend/tests/integration/test_auth_authorization_public_api.py
    • Frontend checks:
      • pnpm --filter @pipeline/frontend typecheck
      • pnpm --filter @pipeline/frontend test:ui
    • apps/frontend/tests/article_form_validation.test.mjs confirms brief text stays in state when validation fails on missing target site.
    • Docker smoke attempt:
      • docker compose up -d backend frontend
      • blocked by environment: permission denied on Docker daemon socket (/Users/gavrilovdev/.colima/default/docker.sock).