A same-second edit can leave a crate fresh, so a new test never runs
Symptom#
A newly added #[test] does not run. cargo test -p <crate> <name> prints running 0 tests ... N filtered out and cargo test -p <crate> -- --list does not list the new test, even though the file on disk has it and the build reported success.
Cause#
Cargo decides a crate is fresh from fingerprint timestamps. When the edit's mtime is not newer than the last build (an edit and a build in the same second, or a tool that writes an older mtime), cargo skips the recompile and runs the previous test binary, which has no new test.
Fix#
Touch the edited file, then re-run: touch crates/<crate>/src/<file>.rs && cargo test -p <crate> <name>. Confirm the test exists with cargo test -p <crate> -- --list | grep <name> before believing any pass or failure.
Evidence#
In rgit on 2026-10-19, after appending mod fold_tests with diff_fold_unchanged to crates/rgit-model/src/build.rs, cargo test -p rgit-model diff_fold_unchanged said running 0 tests ... 35 filtered out and -- --list showed only the 35 old tests. touch crates/rgit-model/src/build.rs forced a recompile and the test then ran. The same happened again after later edits, and touch fixed each time.