Skip to content

ci(coverage): wire PostgreSQL store tests into the coverage gate #759

Description

@eoinfennessy

Background

store/postgres.rs is excluded from the coverage-check gate
(Makefile) because its 27 tests are
#[ignore]d — they require a live DATABASE_URL that the coverage
job doesn't provide. That exclusion currently covers the whole file
(~1000 lines), not just the untestable parts, so future regressions
in the ~700 lines of pre-existing production code (connection setup,
CRUD, row conversion, schema validation) are invisible to the 95%
line-coverage threshold.

Flagged by praxis-bot on #570: #570 (comment)

#739 already added a postgres.yaml CI workflow that runs the
ignored postgres unit/integration tests against a real service
container, but that run is separate from make coverage-check and
isn't instrumented for coverage.

Proposed approach

cargo-llvm-cov supports accumulating coverage across multiple test
invocations via --no-report, then producing one merged report:

cargo llvm-cov clean --workspace
cargo llvm-cov --no-report --workspace ...                                    # normal suite
DATABASE_URL=... cargo llvm-cov --no-report -p praxis-ai-apis store::tests::pg_ -- --ignored   # postgres unit tests
cargo llvm-cov report --json --output-path coverage.json                      # merged report

This would let coverage-check include store/postgres.rs without
the blanket exclusion. It requires:

  • Adding a postgres service container to .github/workflows/coverage.yaml
    (mirroring the one already in postgres.yaml).
  • Splitting the coverage-check Makefile target into the --no-report
    accumulation passes above plus a final merged report.
  • Removing the store/postgres\.rs exclusion from the
    --ignore-filename-regex in Makefile.

Trade-off to weigh

This makes the coverage gate depend on a live database for every PR,
adding container startup time to a job that currently runs without
external services.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions