63 lines
2.4 KiB
Markdown
63 lines
2.4 KiB
Markdown
# Task 003: Postgres Schema And Seed Data
|
|
|
|
Development description: Create the initial relational schema, migrations, indexes, and seed data for articles, sites, workflow state, jobs, research manifests, publishing versions, and audit events.
|
|
|
|
## Implementation Details
|
|
|
|
- Add migration tooling for the FastAPI backend, such as Alembic.
|
|
- Create tables:
|
|
- `users`
|
|
- `target_sites`
|
|
- `script_config_versions`
|
|
- `articles`
|
|
- `boundary_questions`
|
|
- `article_plans`
|
|
- `plan_sections`
|
|
- `evidence_items`
|
|
- `claims`
|
|
- `article_drafts`
|
|
- `assets`
|
|
- `workflow_events`
|
|
- `agent_jobs`
|
|
- `research_run_manifests`
|
|
- `publish_commits`
|
|
- `prompt_versions`
|
|
- Store article/domain status in domain tables as authoritative state.
|
|
- Store LangGraph checkpoints separately from domain tables if checkpointing is implemented in this task.
|
|
- Seed:
|
|
- One Admin user.
|
|
- One Editor user.
|
|
- One Git-backed Next target site.
|
|
- One active publishing YAML/script config version.
|
|
- Add indexes for article dashboard queries, job queues, workflow timeline, and site lookup by slug.
|
|
|
|
## Public Interface
|
|
|
|
- `alembic upgrade head` creates the schema.
|
|
- Backend repository methods can create/read seeded target sites and users.
|
|
|
|
## Acceptance Criteria
|
|
|
|
- [ ] TDD pre-requirement: before implementing migrations, write one failing integration test through repository/public backend interfaces for seeded site lookup; add further tests one behavior at a time and record red-green evidence in `Result`.
|
|
- [ ] Migrations run cleanly on an empty Postgres database.
|
|
- [ ] Seed data is idempotent.
|
|
- [ ] Article/domain tables hold authoritative article statuses.
|
|
- [ ] Script/config versions store author, timestamp, diff, rollback target, activation timestamp, YAML, and transform script.
|
|
- [ ] Research manifests store S3 prefixes, source URLs, object keys, content hashes, artifact types, and metadata references.
|
|
- [ ] Publish commits store repository URL, branch, commit SHA, content bundle manifest, and status.
|
|
|
|
## Verification
|
|
|
|
- Run migration tests against a disposable Postgres database.
|
|
- Run seed command twice and verify no duplicates.
|
|
- Run repository integration tests.
|
|
|
|
## Result
|
|
|
|
- Status: Pending execution.
|
|
- TDD plan: To be filled during execution.
|
|
- Red evidence: To be filled during execution.
|
|
- Green evidence: To be filled during execution.
|
|
- Refactor notes: To be filled during execution.
|
|
- Verification output: To be filled during execution.
|