Skip to content

ci: parallel pytest (xdist) + uv installs for the heavy jobs - #196

Merged
Cipher208 merged 2 commits into
masterfrom
ci/xdist-uv
Nov 4, 2026
Merged

Cipher208 merged 2 commits into
masterfrom
ci/xdist-uv

Conversation

@Cipher208

Copy link
Copy Markdown
Owner

Why

Measured on run 41868292328: the four heavy jobs spend 83% of their wall in a sequential pytest run (coverage 283s, test legs ~190–224s), plus pip re-resolving deps (31–37s each). Caching was already doing its job (NER models: 5s via pip URL cache) — the lever is parallelism + faster installs.

What

  1. Deterministic collection — test_source_time's parametrize evaluated time.time(), so every xdist worker collected a different test id (Different tests were collected). Replaced with a literal; semantics unchanged (the test asserts the numeric ts is forwarded as-is).
  2. Test hygiene xdist exposed — migrated_cm in test_s17_stage1_tail.py migrated the GLOBAL base; the chain test validated whatever other tests wrote there. Now isolated on tmp_path (restored on teardown). Two recall_zero_results tests fed on the shared base via a lazy-ensure table — ensure_zero_result before the DELETE.
  3. -n auto on the test matrix and coverage jobs. Locally: 2868 passed in ~75s (sequential: ~305s) — 3 consecutive green parallel runs + green sequential.
  4. uv installs (uv sync --locked + uv run) for typecheck/test/coverage/docs; the aiosqlite pin is redundant (uv.lock holds 0.22.1, uv lock --check already gates in lint). lint/quality/audit/build untouched.

This PR's own CI is the proof: all jobs green, with visibly lower walls for test (3.12) and coverage.

The four heavy jobs spent 83% of their wall in a sequential pytest run
(283s coverage, ~224s per test-matrix leg) while pip re-resolved deps.

- make collection deterministic: the source-time parametrize evaluated
  time.time(), giving every xdist worker its own collection
- isolate migrated_cm onto tmp_path (restored on teardown) and
  ensure_zero_result before the recall_zero_results DELETE — both fed on
  the shared global base and floated once tests stopped interleaving
- add -n auto to the test matrix and coverage jobs (2868 passed in ~75s
  locally, 4x the sequential wall)
- typecheck/test/coverage/docs now use uv sync --locked + uv run; the
  aiosqlite pin is redundant (uv.lock holds 0.22.1, uv lock --check runs
  in lint)
@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

install_ner_models.py shells out to 'sys.executable -m pip install <wheel
URLs>'; a uv-created venv has no pip, so all four converted jobs failed at
that step. 'uv venv --seed' before 'uv sync' gives the venv pip (verified
locally: sync keeps the seeded pip), and setup-python's pip cache keeps the
model wheels warm between runs.
@Cipher208
Cipher208 merged commit 8973290 into master Nov 4, 2026
19 checks passed
@Cipher208
Cipher208 deleted the ci/xdist-uv branch November 4, 2026 19:33
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