Repository navigation
Description
Task
T-107· Milestone M7 — API · Size S · Priority P1 · Epic #7Implements NFR-MNT-001
Branch
test/t-107-seeded-test-datasets-and-60— one task = one branch = one PR (doc 32 §6)
Summary
Produce a deterministic small dataset (1 campaign, 60 runs, 3 modes, risk map, experiment) used by API tests, MSW fixtures and Playwright E2E, plus a large synthetic generator (10 000 runs) for performance tests.
Context / motivation
Doc 18 §5: shared fixtures; prevents each UI/API task from inventing its own data.
Scope
In scope
scripts/seed_demo.py --size small|large(via services, not raw SQL) + exportedseed_small.sql.- MSW JSON fixtures exported from the seeded API (
web/src/test/fixtures/*.json).
Implementation guidance
scripts/seed_demo.py --size small|large --seed 20261119 --database-url ...creates data through application services (space register → campaign create → inline k2d campaign → analysis → tiny experiment) so seeds always respect invariants;largeuses the benchmark backend to produce 10 000 runs quickly.small: 1 campaign, 60 runs, 3 modes, 1 risk map, 1 analysis, 1 tiny experiment; export withpg_dump --data-only --column-insertsintobackend/tests/fixtures/db/seed_small.sql(doc 18 §5) plusseed_small_artifacts.tar.zst(traces for 3 medoid runs only, ≤ 2 MB).- MSW fixtures:
scripts/export_web_fixtures.pycalls the seeded API and writesweb/src/test/fixtures/*.json(campaigns, runs page, run detail, modes, importance, risk slice, comparison); regenerate whenever OpenAPI changes. - Loading helper
tests/fixtures/db/load_seed.py, used by API tests, E2E global setup and the perf job. - Standards: respect the layering contracts (doc 16 §2) and conventions in doc 34; no hard-coded tunables — thresholds/defaults come from typed settings (doc 27); no magic numbers (ruff
PLR2004); public APIs typed (mypy strict) and documented.
Acceptance criteria
- Seed loads in < 10 s; deterministic.
- Fixtures validate against OpenAPI DTOs.
- Fixtures regenerate deterministically (hash compare).
- Artefact tarball ≤ 2 MB.
- Tests listed below added and green in CI; coverage of new code meets the gate in doc 18 §3.
- Docs, config reference and CHANGELOG
Unreleasedupdated where behaviour, keys or interfaces changed. - Definition of Done (doc 32 §3) satisfied.
Tests required
tests/integration/test_seed_data.py.
Dependencies
Blocked by: #137 (T-075a)
Blocks: #160 (T-106), #186 (T-117)
Parallelization notes
Files / paths owned by this task — avoid editing other paths; shared files (pyproject.toml entry points, cli/main.py, api/routers/__init__.py, router.tsx, docker/compose.yaml, ci.yml) are append-only:
scripts/seed_demo.pybackend/tests/fixtures/db/seed_small.sqlweb/src/test/fixtures/**
Test data only.
Definition of Done
Per doc 32 §3 and AGENTS.md §5: lint, format, mypy strict and import-linter green; tests added and passing; docs updated; PR template completed with Closes #<this issue>; Conventional Commit messages referencing T-107 (doc 16 §6); commits authored only by the repository owner identity (AGENTS.md §4); CI green; reviewer checklist (doc 32 §5.1) satisfied.
References
Design docs: doc 18 §5 · doc 18 §4.10 · doc 12 §3.3
Requirements: NFR-MNT-001 (traceability: doc 28)
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsBacklog
Activity
report.jsonand analysis artefacts #137e2e.ymlworkflow #186test(fixtures): refresh live failure-mode payload (T-107) (#320)