4.8 KiB
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/articlesGET /api/articlesGET /api/articles/{article_id}
- Article creation requires:
brief_descriptiontarget_site_id- optional
content_type - optional
primary_keyword
- Creation behavior:
- Creates article with
ARTICLE_BRIEF_CREATED. - Attaches target site.
- Writes
ARTICLE_CREATEDworkflow event.
- Creates article with
- 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 inResult. - 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 inGET /api/articlesand visible inGET /api/articles/{article_id}with target site summary and anARTICLE_CREATEDworkflow 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/articlesreturned 405 andGET /api/articles/{article_id}returned 404 before implementation).
- Command:
- Added
- Green evidence:
- Created endpoints and repository implementations:
POST /api/articlespersistedArticleSummaryand createdARTICLE_CREATEDworkflow event.GET /api/articlesreturns persisted list.GET /api/articles/{article_id}returns detail with target site and workflow timeline.
- Validation:
POST /api/articleswith unknowntarget_site_idreturns400with detailInvalid target_site_id.
- Created endpoints and repository implementations:
- 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 typecheckpnpm --filter @pipeline/frontend test:ui
apps/frontend/tests/article_form_validation.test.mjsconfirms 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).