Repository navigation
Description
Task
T-017· Milestone M1 — Foundation · Size S · Priority P0 · Epic #1Implements NFR-MNT-001
Branch
test/t-017-test-infrastructure-hypothesis-profiles-factories— one task = one branch = one PR (doc 32 §6)
Summary
Provide the shared test scaffolding of doc 18 §5 so every later task writes tests the same way: Hypothesis profiles (ci=200, nightly=2000 examples), domain object factories, a tests/fakes/ package and a session-scoped PostgreSQL 17 Testcontainers fixture.
Context / motivation
Without shared fixtures each agent invents its own, producing duplicated and flaky tests. A single Postgres fixture with per-test transactional isolation keeps integration tests fast (< 6 min budget, doc 18 §2).
Scope
In scope
backend/tests/conftest.py: Hypothesis profiles viasettings.register_profile, selected byHYPOTHESIS_PROFILEenv.backend/tests/factories.py: builders forScenario,Observation,Trace(straight-line synthetic),OracleResult,RunOutcome.backend/tests/fakes/__init__.py(empty package, later filled by port tasks).backend/tests/integration/conftest.py:postgres_urlsession fixture usingtestcontainers.postgres.PostgresContainer('postgres:17'), skipped with a clear reason when Docker is unavailable;ROBOPROBE_TEST_DATABASE_URLoverride for CI service containers.pytest-xdistcompatible (no shared mutable state).
Implementation guidance
- Factories are plain functions with keyword overrides (no factory-boy dependency). Make the synthetic trace builder accept
n,dt, and per-column overrides so oracle tests can craft edge cases. - 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
-
pytest -m integrationspins up Postgres 17 locally and in CI. - Profiles switch with
HYPOTHESIS_PROFILE=nightly. - Factories produce valid frozen models (validated by tests).
- 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
- Self-tests for factories and the Postgres fixture (
SELECT version()returns 17.x).
Dependencies
Blocked by: #12 (T-001), #15 (T-002a)
Blocks: #28 (T-006a), #59 (T-010a), #69 (T-019)
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:
backend/tests/conftest.pybackend/tests/factories.pybackend/tests/fakes/__init__.pybackend/tests/integration/conftest.py
Owns shared test helpers; later tasks add new factories in their own test modules or append to factories.py (small, append-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-017 (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 §2 · doc 18 §5 · doc 18 §3
Requirements: NFR-MNT-001 (traceability: doc 28)
External:
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsDone
Activity
ci.yml: lint, typecheck, backend unit/property/contract matrix, integration, web tests #28