Skip to content

fix(mutants): split test threads between parallel jobs - #574

Merged
kixelated merged 2 commits into
mainfrom
mutants-test-threads
Nov 11, 2026
Merged

kixelated merged 2 commits into
mainfrom
mutants-test-threads

Conversation

@kixelated

@kixelated kixelated commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Problem: admin/mutants -j N oversubscribes the host. cargo-mutants 27.1's jobserver (on by default) caps the builds of all parallel jobs at the CPU count, but not their tests: each job's nextest runs nproc test threads. On a 24-core desktop, an -j 8 armv7 run alongside an -j 3 x86_64 run pushed the 1-minute load average to 95-107, with 63% CPU pressure stall.

Approach: admin/mutants reads the job count (-j N, -jN, --jobs N, --jobs=N, or CARGO_MUTANTS_JOBS, stopping at --) and sets NEXTEST_TEST_THREADS to ceil(nproc / jobs). cargo-mutants never passes --test-threads itself, so the variable reaches each job's nextest. A single-job run, as mutants.yml does, keeps nproc threads.

Impact: no public API change.

Alternatives: cargo-mutants' --jobserver-tasks limits only its own children's build tasks; nextest does not take jobserver tokens, so it cannot bound tests.

Decisions

  • Merged main (conflict with the --avx512 runner line): kept both, the threads block and main's ${avx512:+--avx512 }--run runner.
  • moq-dev/rind#538 (armv7 under qemu) shifts its --target X off before the job parsing, as --avx512 and --survivors are, so the loop sees only cargo-mutants' arguments. Under qemu each test thread is one qemu-arm process, so ceil(nproc / jobs) still bounds the processes. The threads logic needs no change there.

Validation: the argument parsing gives 24 / 3 / 3 / 8 / 8 / 6 threads for no -j, -j 8, -j8, --jobs 3, --jobs=3, and --re x -j 4 -- -j 2 on 24 CPUs. After the merge, shellcheck admin/mutants and just check (through quest gate) pass. Not measured end to end under a real -j 8 campaign.

Models

Size: XS
Implementer: Claude Code, claude-opus-5-5, low effort (iterate, XS)

🤖 Generated with Claude Code

(Written by Claude Opus 5.5 with low)

Review

Rewritten by quest review after each round.

  • Reviewer: Codex, gpt-6.1-sol, low effort
  • Session: 01a1ca11-3cd6-7cf0-bc19-60d0aed88d30, round 1
  • Head: 5e3c52f
  • Base: origin/main at ad13666
  • Score: 9/10, The change is narrowly scoped and consistent with the existing runner, with no actionable correctness or security issues found by inspection, though execution checks were excluded as instructed.
  • Findings: none

cargo-mutants' jobserver shares the CPUs between parallel jobs' builds,
but each job's nextest still ran one test per CPU, so `-j 8` ran up to
eight times as many test threads as the host has CPUs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review November 11, 2026 10:05
@coderabbitai

coderabbitai Bot commented Nov 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 53 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3b0641a9-14d1-475a-9a38-5bba4c21890c
Commits

Reviewing files that changed from the base of the PR and between a4e2d01 and 5e3c52f.

Files selected for processing: 1

  • admin/mutants
  • 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

@kixelated
kixelated added this pull request to the merge queue Nov 11, 2026
Merged via the queue into main with commit 1f17f07 Nov 11, 2026
10 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