Skip to content

tests/std_filter_tests/ has not been compiled since October 2025 #520

Description

@leynos

Summary

tests/std_filter_tests/ contains 66 test functions across 13 files that
have not been compiled since 2025-10-26. They are tracked in git, they look
maintained, and they run nowhere.

Evidence

The directory is absent from the test-binary list:

$ cargo nextest list --list-type binaries-only | grep -i filter
$ # (no output)

There is no [[test]] stanza for it in Cargo.toml, no tests/std_filter_tests.rs
entry file, and no other file under tests/ declares those modules.

Root cause

Commit b2d46d6 ("Tightens lint policy, documents API, and hardens runtime
paths", #222, 2025-10-26) renamed the entry file into the directory it points at:

tests/{std_filter_tests.rs => std_filter_tests/mod.rs} | 2 ++

Two things broke at once, and neither produced a diagnostic:

  1. The test binary disappeared. Cargo builds one integration-test binary per
    tests/*.rs. Moving the only top-level entry file into a subdirectory left
    nothing for Cargo to build, so the suite stopped existing rather than
    starting to fail.

  2. Every #[path] prefix became wrong. mod.rs still declares its
    submodules relative to the old location:

    #[path = "std_filter_tests/collection_filters.rs"]
    mod collection_filters;

    From inside tests/std_filter_tests/, that resolves to
    tests/std_filter_tests/std_filter_tests/collection_filters.rs, which does
    not exist. Were the binary restored without fixing these, it would fail to
    compile.

This is the failure mode where a rename is silently correct to the compiler
because the thing it broke is no longer built at all.

Coverage lost

File Area
collection_filters.rs collection filters
command_filters/grep_filter_tests.rs grep filter
command_filters/shell_filter_tests.rs shell filter
command_filters/windows_filter_tests.rs Windows shell bypass, streaming, metacharacters
hash_filters.rs hash filters
io_filters.rs I/O filters
network_functions.rs network functions
path_filters.rs expanduser, realpath, relative_to, with_suffix
which_filter_tests.rs, which_filter_common.rs which resolver

Some of this is covered elsewhere — expanduser has a BDD scenario, and the
which resolver has stdlib_which_tests — but the overlap has not been
assessed. Assessing it is part of the work: restoring 66 tests that duplicate
existing coverage is not automatically worth it, and knowing which are unique is
the point.

Why it matters now

This surfaced while addressing a review finding on #505. Codex reported an
unannotated std::env::var_os("PATH") in
tests/std_filter_tests/command_filters/windows_filter_tests.rs, reasoning that
"a Windows make lint compiles the module with -D warnings and rejects the
existing lookup". That reasoning is sound but the premise is not: no make lint compiles that file, on any platform, because Cargo never builds it. The
annotation added in #505 is correct in substance and harmless, but it does not
fix a live failure.

Related: #518 proposes Windows CI. That would not have caught this either — the
gap is Cargo target wiring, not platform coverage.

Suggested work

  1. Restore the target: move mod.rs back to tests/std_filter_tests.rs, or add
    an explicit [[test]] stanza with path.
  2. Fix the #[path] prefixes, which are wrong under either arrangement.
  3. Expect compile failures and test failures. Nine months of drift against code
    that has moved considerably — EnvLock, EnvVarGuard, the which resolver
    refactor in Refactor which resolver: OS-specific workspace fallback #241, and the localization work in Externalize Fluent localization; Windows test context refactor + audit #260 all landed since.
  4. Assess overlap with existing coverage before repairing each file. Delete what
    is genuinely redundant rather than resurrecting it out of completeness.
  5. Add a guard so this cannot recur silently. A test asserting the expected set
    of test binaries, or a check that every tests/*/mod.rs has a corresponding
    target, would have caught it the day it broke.

Acceptance criteria

  • cargo nextest list --list-type binaries-only includes the suite.
  • Every retained file compiles and passes.
  • Files whose coverage is genuinely duplicated elsewhere are deleted, with
    the duplication named in the commit message.
  • A guard exists against an orphaned test tree recurring unnoticed.
  • The #[expect(clippy::disallowed_methods)] added to
    windows_command_setup in Enforce the environment mandate with clippy disallowed-methods (#504) #505 is re-checked once the file is actually
    compiled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtesting

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions