On macOS a fresh test binary can hang at 0% CPU in nextest's --list while syspolicyd checks it
Symptom#
cargo nextest run prints nothing for 10 minutes. ps shows the test binary running --list --format terse (and --ignored) in state S at 0.0% CPU, while /usr/libexec/syspolicyd uses about 50% CPU. In the same period /usr/bin/python3 failed with code signature ... not valid for use in process: library load mig callout failed, and rustc reported can't find crate for tokio.
Cause#
The macOS code signature check (syspolicyd/amfid) did not answer for a freshly built executable, so its first exec blocked. It is a system state, not a test bug; it came with a load average of 30 to 47 and right after a restart.
Fix#
Stop the run (TaskStop or Ctrl-C), check the system with /usr/bin/python3 --version, and run the tests again once that works; a restart cleared it. Put a timeout on long nextest runs so a hang is noticed. Do not run cargo clean: the build cache was fine.
Evidence#
rmaestro, 2026-10-30/31: the plugin panel tests hung 10 min in --list; after stopping and rerunning they passed in 3.9 s. Later clippy failed with E0463 and python3 with the mig callout error until the machine recovered; then clippy and 1428 tests passed with no cache change.
Later case: sudo killall syspolicyd restarted the checker at once. For one user, new programs then started in about a second.
Later case: The stall came back on the next build, and killing the checker only resets it. For one user, the Developer Tools setting for the terminal app did not stop it.