From ef2000e79ea6e1498bb83c5656c491a37d3dd6ee Mon Sep 17 00:00:00 2001 From: "@permadeath.com" Date: Sat, 29 Aug 2026 22:00:38 -0400 Subject: [PATCH] docs(harness): -j 2 never bounded a test run `-j` limits compilation jobs; libtest then parallelises across every core, so the rule was silently half-effective. One test binary was measured at 710% CPU while a benchmark was recording. --- CLAUDE.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index bfe0456..d0e9501 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -61,8 +61,13 @@ Confirm your work is acceptable before submitting a PR: 1. Rebase onto `origin/main` and fix any conflicts. 2. Ensure that all `prek` feedback has been fixed. -3. Run the relevant tests: `cargo test -j 2 --workspace` and - `python3 -m unittest discover -s tests -t .`. +3. Run the relevant tests: `cargo test -j 2 --workspace -- --test-threads 2` + and `python3 -m unittest discover -s tests -t .`. Both flags are needed and + they bound different things: `-j` limits how many crates compile at once, + and `--test-threads` limits how many tests run at once. Without the second, + the test binary parallelises across every core - one was measured at 710% + CPU on this machine, which is what slowed a live benchmark from 66 to 112 + seconds a match. 4. If the change could plausibly affect play, run `./sds.sh control` and say what it came out at. A harness change that was not controlled is not finished. @@ -154,6 +159,10 @@ Several agents may be running here at once, and a match is expensive. - `--jobs` defaults to 2. A match is two thinking bots and a server in one container, and three at once already contends on this machine. Look at `uptime` before raising it. +- `cargo test -j 2` does not bound a test run. `-j` limits compilation; the + test binary it produces then parallelises across every core. Pass + `-- --test-threads 2` as well. This rule was honoured in good faith and was + silently half-effective for as long as it has existed. - Cargo builds are small here (tokio and serde), so worktrees do not share a target directory. If that changes, share one deliberately rather than by accident - a shared target can answer a test from another worktree's binary. -- 2.54.0