perf(tests): per-worker template repo cuts Windows CI fixture cost - #43
Conversation
…d of git-initing per test The project fixture spawned 5 git subprocesses per test x 412 tests; on Windows CI that cost ~3s of setup per test and capped the xdist speedup at ~1.5x (4 workers contending on slow process spawn + fsync). A session-scoped template (one build per xdist worker) copytree'd per test drops that to zero spawns; core.fsync=none in the template's local config is inherited by copies and their worktrees, cheapening the remaining inline commits. Copied repos verified clean (porcelain status/diff re-hash the stat-dirty index) and fully relocatable (no absolute paths in a fresh non-worktree repo); identity stays local config so the identity-unset test and ledger commit helpers behave unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 25 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
🤖 Augment PR SummarySummary: Refactors the Changes: Introduces a session-scoped 🤖 Was this summary useful? React with 👍 or 👎 |
Why
Follow-up to #42. Windows test jobs only scaled ~1.5× under xdist (265s vs 412s serial): the
projectfixture git-inits a fresh repo per test — 5 subprocess spawns × 412 tests — and on Windows that's ~3s of setup per test (slow process spawn + fsync, 4 workers contending on disk). The--durationstable on the #42 run showed exactly this: ~3ssetupentries for test_verify_worktree/test_cli/test_engine.What
tests/conftest.pyonly:_project_templatefixture builds the identical sandbox once per xdist worker (same files, same 5 git commands, identity kept in local config so copies inherit it).projectnowshutil.copytrees the template — zero git spawns per test (~25 small files, tens of ms on Windows).core.fsync=nonein the template's local config, inherited by copies and their worktrees, cheapening the ~100 remaining inline add/commit calls.Safety, verified against the code
verify.pyare porcelain (status --porcelain,git diff --quiet, OID compare, throwawayGIT_INDEX_FILE) which re-hash stat-dirty entries;diff-index/diff-filesplumbing appears nowhere. Also proven empirically: a copytree'd repo reports clean porcelain status..git/worktrees/*is created per-copy, so the realgit worktree addtests are unaffected.rev_parse_headassertions are same-repo; identical initial SHAs across copies are harmless.test_verify.py)--unsets local config, which the copy carries exactly as before.Verified locally
Full suite green serial (1321 passed, 108s — down from ~125s) and 3× under
-n 4/-n auto(28–33s). Targeted canaries green: identity-unset + finalize-commit + commit-paths, all worktree suites (103 passed), ledger-commit suites (77 passed).--durations=15now shows no setup entries at all. trunk check clean.Expected on this PR's Windows jobs: test phase ~265s → ~100–150s. The one ~3s template build per worker shows up on whichever test runs first — by design.
🤖 Generated with Claude Code