Skip to content

ci(coverage): scope 70% floor to monolithic run, not per-shard#31

Merged
Doctacon merged 3 commits into
mainfrom
ci/per-shard-coverage-scope
Apr 23, 2026
Merged

ci(coverage): scope 70% floor to monolithic run, not per-shard#31
Doctacon merged 3 commits into
mainfrom
ci/per-shard-coverage-scope

Conversation

@Doctacon
Copy link
Copy Markdown
Owner

Summary

CI has been red on every merge since 7e37296 (feat(ci): strict mypy per-package + 70% coverage floor). The global --cov-fail-under=70 in pyproject.toml [tool.pytest.ini_options] addopts is inherited by every per-shard pytest job, and each shard only exercises its own source — noaa/usgs/databox internals all report 0% in the ebird shard, dragging the total to ~19%.

This PR keeps the 70% floor but moves enforcement off the shards:

  • Shard jobs (tests-core, tests-ebird, tests-noaa, tests-usgs) override addopts to drop --cov-fail-under=70 while keeping --cov --cov-report=term-missing so coverage is still visible.
  • New tests-all job runs uv run pytest across the whole workspace and inherits --cov-fail-under=70 — the one place where every source is actually under test. Local run: 75.86% total.

No code behavior change. Preserves the 70% floor intent from 7e37296 while making it actually enforceable.

Test plan

  • uv run pytest locally → 75.86% coverage, floor reached
  • tests-all CI job passes 70% floor
  • Shard jobs pass without coverage enforcement noise
  • Docs workflow and other checks green

🤖 Generated with Claude Code

Doctacon and others added 3 commits April 22, 2026 18:49
The 70% coverage floor set in 7e37296 was inherited by every per-shard
pytest job via pyproject.toml `addopts`. Each shard only exercises its
own source, so total coverage across `[tool.coverage.run] source` never
gets close to 70% (ebird shard bottoms out at ~19% because noaa/usgs/
databox internals all report 0%). Every merge has been red since.

Two changes:

1. Shard jobs (`tests-core`, `tests-ebird`, `tests-noaa`, `tests-usgs`)
   now override `addopts` to drop `--cov-fail-under=70` while keeping
   `--cov --cov-report=term-missing` so the coverage artifact is still
   visible in the log.

2. New `tests-all` job runs `uv run pytest` across the whole workspace
   and inherits the unchanged `--cov-fail-under=70`. This is the one
   place the floor is enforced, and it's the one place where every
   source is actually under test. Local run: 75.86% total.

No code behavior change. Preserves the 70% floor intent from 7e37296
while making it actually enforceable.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
… take effect

Follow-up to the previous commit on this branch. Dropping `--cov-fail-under`
from the pytest `addopts` override isn't enough: pytest-cov invokes
`coverage.Coverage().report()` which reads `fail_under` directly from
`[tool.coverage.report]` in pyproject.toml regardless of whether the CLI
flag is present. That's why shard jobs still exited 1 after the previous
commit (4 tests passed, coverage.py then raised CoverageException).

Removing `fail_under = 70` here keeps the floor intact: the `tests-all`
job still passes `--cov-fail-under=70` via the inherited `addopts`, and
pytest-cov enforces that flag directly.

Also regenerates `docs/dictionary/analytics/platform_health.md` — it was
stale on origin/main (missing `main._dlt_loads` and `main.events` as
externals), breaking the `generate_docs.py --check` docs job.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…pend

Running the whole workspace in one pytest session triggers pytest-recording
VCR cassette mismatches because cassette matching is global in-process —
a noaa test's request can match an ebird/usgs cassette loaded earlier in
the session. Each shard is self-consistent but the combined run isn't.

Switch `tests-all` to:
  coverage erase
  coverage run --append -m pytest <shard_1>
  coverage run --append -m pytest <shard_2>
  ...
  coverage report --fail-under=70

Per-shard pytest invocations isolate VCR state; `--append` accumulates
coverage across them. Local sim: 119 tests pass, 76% total coverage.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@Doctacon Doctacon merged commit c29383e into main Apr 23, 2026
15 checks passed
@Doctacon Doctacon deleted the ci/per-shard-coverage-scope branch April 23, 2026 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant