Skip to content

Test coverage: HTTP API and api/cli (farm/api) #569

@cursor

Description

@cursor

Context

FastAPI / WebSocket code under farm/api/ is excluded from the coverage report in .coveragerc while the repo enforces a 90% gate on the simulation core.

This issue tracks API-layer test coverage (controllers, server wiring, CLI entrypoints that live under api).

Scope (paths)

  • farm/api/server.py
  • farm/api/simulation_controller.py
  • farm/api/experiment_controller.py
  • farm/api/analysis_controller.py
  • farm/api/cli.py
  • (Examples under farm/api/examples.py are already omitted at [run]; tests can still reference patterns from there.)

Suggested approach

  • Use httpx.AsyncClient + ASGITransport or Starlette/FastAPI TestClient against the ASGI app.
  • Mock long-running simulation work where needed; keep tests deterministic.
  • Cover WebSocket handlers with short-lived connections and mocked backends where practical.

Acceptance criteria

  • Integration-style tests marked appropriately if they need DB or network fakes.
  • Trim .coveragerc [report] omit for files that reach stable coverage without breaking --cov-fail-under=90.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions