Problem
Several test files exist under tests/ but are not declared in their parent mod.rs, so Cargo never compiles or runs them. They pass silently as zero-coverage dead weight. The symptom that surfaced this: create_test_run_state in tests/common/mod.rs was flagged `dead_code` — not because it's unused, but because all of its callers are orphaned.
Confirmed orphans
Parent mod.rs files are missing entries for these existing test files:
mod.rs |
Declares |
Missing (orphaned files) |
tests/connection/mod.rs |
command |
cache.rs, connection.rs, factory.rs, local.rs, ssh.rs |
tests/modules/packages/mod.rs |
apt, homebrew, yum_dnf |
pacman.rs, zypper.rs |
tests/playbooks/mod.rs |
(others) |
context.rs, traversal.rs, visitor.rs |
How to verify
# this currently exits 0 even though the files above are never run:
cargo test
After wiring a file in (e.g. adding mod pacman; to tests/modules/packages/mod.rs), the compiler will tell you immediately whether it still builds — some of these orphaned files may have bit-rotted against current APIs.
Suggested fix
- Add the missing
mod declarations to the three mod.rs files above.
- Run
cargo test and fix any compile failures in the newly-included files (they've been dark, so expect some drift).
- Do a broader audit for other orphans — the detection is name-based and can false-negative when a file's basename collides with a directory that is mod'd elsewhere (e.g.
connection.rs vs the connection/ dir).
Problem
Several test files exist under
tests/but are not declared in their parentmod.rs, so Cargo never compiles or runs them. They pass silently as zero-coverage dead weight. The symptom that surfaced this:create_test_run_stateintests/common/mod.rswas flagged `dead_code` — not because it's unused, but because all of its callers are orphaned.Confirmed orphans
Parent
mod.rsfiles are missing entries for these existing test files:mod.rstests/connection/mod.rscommandcache.rs,connection.rs,factory.rs,local.rs,ssh.rstests/modules/packages/mod.rsapt,homebrew,yum_dnfpacman.rs,zypper.rstests/playbooks/mod.rscontext.rs,traversal.rs,visitor.rsHow to verify
After wiring a file in (e.g. adding
mod pacman;totests/modules/packages/mod.rs), the compiler will tell you immediately whether it still builds — some of these orphaned files may have bit-rotted against current APIs.Suggested fix
moddeclarations to the threemod.rsfiles above.cargo testand fix any compile failures in the newly-included files (they've been dark, so expect some drift).connection.rsvs theconnection/dir).