Skip to content

Test coverage: the runtime probe is at 43% while the project is at 90%; add probe tests and a coverage floor in CI #115

Closed

Description

@vsn411

Problem: coverage run -m pytest tests (1265 tests) gives 90% line coverage over src/secfoo, but two modules are far below it and nothing in CI would notice a regression:

Module Statements Missed Coverage
src/secfoo/sensor/probe.py 355 203 43%
src/secfoo/sensor/__init__.py 21 10 52%

The probe is the piece that runs inside users' applications (secfoo instrument, python -m secfoo.sensor), where a bug is most expensive, and it is the module with the only platform-specific test failure we know of (see the macOS CI issue).

Build:

  1. Bring sensor/probe.py to at least 85%: the sys.monitoring callbacks, event batching and backpressure, reconnect after the sensor dies, the no-sensor fallback, shutdown ordering, and the frame/filename filters. Drive it through the conformance kit (secfoo sensor conformance, Probe ↔ sensor protocol and conformance kit (one contract for every runtime) #73) where possible so the tests double as protocol checks.
  2. Cover sensor/__init__.py's entry points (python -m secfoo.sensor, env-var configuration, bad values).
  3. Add pytest-cov to the dev extra, run tests with --cov=secfoo --cov-report=xml --cov-fail-under=88 in CI (a floor just under today's number; raise it in the PR that lifts the probe), and upload the XML as an artifact. Print the per-file table in the job summary so a drop is visible on the PR.
  4. Spot-check the next lowest modules after the probe (coverage report --sort=cover) and list them in the PR as follow-ups if they are under 75%.

Where to look: src/secfoo/sensor/probe.py, src/secfoo/sensor/__init__.py, tests/test_sensor/, src/secfoo/runtime/conformance/, .github/workflows/ci.yml, pyproject.toml.

Done when: probe coverage is at or above 85% with tests that assert behaviour (not just execute lines); CI fails when total coverage drops below the floor; the coverage table appears in the job summary.

Activity

  1. added
    enhancement
    help wanted
    hackathon
    difficulty: medium
    on Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty: mediumenhancementhackathonhelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions