Skip to content

ci: Sprint 0 — coverage-testability + release 0.13.12#71

Merged
maltsev-dev merged 2 commits into
masterfrom
coverage/sprint-0-testability
Jul 21, 2026
Merged

ci: Sprint 0 — coverage-testability + release 0.13.12#71
maltsev-dev merged 2 commits into
masterfrom
coverage/sprint-0-testability

Conversation

@maltsev-dev

Copy link
Copy Markdown
Member

Summary

  • Sprint 0 (CI / coverage-testability): the pytest suite is no longer gated on the 3.3s per-test time.sleep(1.1) tax in TestCircuitBreaker half-open tests. New tests/conftest.py autouse fixture _fast_sleep caps test-code time.sleep at 1ms with two opt-out paths (@pytest.mark.slow_sleep marker on a test/class, NULLRUN_FAST_SLEEP=0 env var). Three TestCircuitBreaker tests now use a _advance_clock(monkeypatch, seconds=...) helper that patches time.monotonic instead of sleeping.
  • Release 0.13.12: bumps pyproject.toml version and __version__.py docstring, adds CHANGELOG entry. CI scope only — no on-wire change, no SDK_MIN_VERSION bump, no public API change. Backends on 1.0.0 keep working unchanged.

Root cause

The pre-Sprint-0 CI uploaded a coordinator-only 0% coverage report (because coverage run -m pytest -n auto only ran coverage in the pytest coordinator, not in the xdist workers). That put the Codecov badge at 0% in the README and dragged combined coverage below the 80% floor in .codecov.yml. The half-open CB tests' time.sleep(1.1) added a 3.3s wall-clock tax per worker on every xdist run, which on Windows' single-worker-bound xdist made the suite borderline-hang.

Why this PR splits Sprint 0 + the version bump

  • e6dd730 (Sprint 0): the mechanical work — conftest, helper, marker, codecov pytest-cov config. Tagged as a commit, not a release, because version bumps require a CHANGELOG + pyproject bump and a release commit.
  • 9a11558 (this commit, 0.13.12): just the version strings. The wheel will now expose 0.13.12 with the Sprint 0 work inside it.

Verification

  • ruff check src/ — All checks passed
  • mypy src/ — Success: no issues found in 34 source files
  • pytest -n auto --cov=src/nullrun --cov-branch --cov-report=xml:coverage.xml --cov-report=term --cov-fail-under=0 — 1237 passed, 7 skipped, 29 warnings, 33.99s, combined coverage 80.87% (master 29caae9 was 79.26% via Codecov API)

Test plan

  • Local pytest run on master + this branch — 1237 passed, no regressions at the assertion level
  • ruff check src/
  • mypy src/
  • CI on the PR will run tests/test_transport.py, tests/test_transport_branches.py, etc. under pytest -n auto on all three matrix Python versions (3.10, 3.11, 3.12). Expect all green.
  • Codecov will post a real combined coverage report (~80%+) instead of the previous 0% (coordinator-only) badge.

Out of scope (tracked separately)

  • Pre-existing xdist+coverage flake on test_status.py::TestRecentErrors and TestTransport::test_stop_flush_false_skips_final_flush (~1/3 of local runs, passes in isolation and in pytest -n 0/-n 2). Sprint 0 did not introduce and did not fix it.
  • Sprints 1-5 of the coverage improvement plan (small modules, ws_dispatch, crewai 1.15 drift, runtime/transport buffer & retry-after, transport_websocket reconnect backoff, # pragma: no cover cleanup) will land on top of 0.13.12.

Closes the SDK-side item on the coverage-readiness audit.

Sprint 0 (coverage). Coverage is now reported correctly via
pytest-cov + xdist, but a handful of TestCircuitBreaker tests
use bare time.sleep(1.1) to wait out the 1.0s recovery_timeout.
That was a 3.3-second tax per worker on every xdist run, and
the suite could not be collected on Windows in a reasonable
time without the cap. The conftest autouse fixture
_fast_sleep caps test sleeps at 1ms, which is well above
the cancellable-wait regression threshold (0.05s) and zero
impact on retries (the existing per-test monkeypatch covers
the time.monotonic path).

Three TestCircuitBreaker tests now advance the wall clock
via _advance_clock(monkeypatch) instead of sleeping, so the
recovery transition fires deterministically.

Opt-out: @pytest.mark.slow_sleep on a test class keeps
the real wall clock (e.g. test_ping_chain_emits_heartbeats_on_time_schedule
needs real-time progression for the scheduler thread).

Verified: 1237 passed, 7 skipped, 29 warnings in 34.92s;
combined coverage 80.98% (vs 79.26% on master 29caae9).
Bump SDK 0.13.11 -> 0.13.12. CI scope only — no on-wire change,
no SDK_MIN_VERSION bump, no public API change. Backends on 1.0.0
keep working unchanged.

Pyproject version + __version__ + CHANGELOG entry. The
mechanical work (conftest autouse _fast_sleep, _advance_clock
helper, slow_sleep marker, codecov pytest-cov config) shipped
in commit e6dd730; this commit just re-tags that work as
0.13.12 so the published wheel exposes the new version string.

Verified: 1237 passed, 7 skipped, 29 warnings; combined coverage
80.87% (vs master 29caae9 79.26% via Codecov API; the 0%
in the README badge was the coordinator-only coverage bug
Sprint 0 already fixed in PR #70).
@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@maltsev-dev
maltsev-dev merged commit 1bfc96e into master Jul 21, 2026
5 checks passed
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