Repository navigation
ci(affected): don't fail Windows job on empty test selection - #2839
Merged
Merged
Conversation
The advisory `affected tests (windows)` job failed on every PR whose diff overlapped no recorded coverage. On Windows the cargo-affected selection always carries the `#[cfg_attr(windows, ignore)]` tests: `collect` runs the suite through `nextest run`, which skips ignored tests, so they never earn coverage rows and get re-flagged `new` on every run. `nextest run` then skips them as ignored too — zero tests execute, and nextest's default `--no-tests` behavior treats that as exit 4. Set `NEXTEST_NO_TESTS=warn` so an empty selection exits 0 with a log breadcrumb. An empty affected selection is a legitimate outcome — a diff can touch nothing with recorded coverage. The separate `os error 206` failure mode (a long nextest command line overflowing the Windows ~32 KB limit) was fixed upstream in cargo-affected and needs no change here. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
worktrunk-bot
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The advisory
affected tests (windows, advisory)job incifailed on every recent PR — Linux and macOS passed on the same runs. Two distinct Windows-only failure modes.Mode 1 —
os error 206(The filename or extension is too long).cargo-affectedpassed itscargo nextesttest-filter list as inline-Earguments; with a large affected set the command line overflowed Windows' ~32 KBCreateProcesscap. Already fixed upstream in cargo-affected (#37 — selection now travels via a--config-file). This job installs cargo-affected unpinned from the default branch, so it self-healed once that landed — no change needed here.Mode 2 —
error: no tests to run→ exit 1. This is what this PR fixes. The repo has tests attributed#[cfg_attr(windows, ignore)]. On Windows they compile into the test binary but are skipped at run time.cargo affected collectgathers coverage viacargo nextest run, which skips ignored tests — so those tests never earn coverage rows. cargo-affected's "new test" detection diffscargo nextest list(lists ignored tests) against the coverage DB, so it re-flags them asnewand selects them on every Windows run.cargo nextest runthen skips them as ignored too — zero tests execute, and nextest's default--no-testsbehavior (auto→fail) makes that exit 4. When a PR's diff overlaps no recorded coverage, the whole selection collapses to just these phantom tests and the job fails.Fix
Set
NEXTEST_NO_TESTS=warnon the🎯 Run affected testsstep. An empty affected selection is a legitimate outcome — a diff genuinely can touch nothing with recorded coverage — so it should pass, not fail.warnexits 0 while leaving a breadcrumb in the log, keeping the calibration signal honest. It governs only the zero-selection outcome: a real test failure still exits non-zero and still fails the job.The env-var form (vs. a CLI passthrough) doesn't depend on cargo-affected forwarding trailing args, and
cargo nextest list— which has no--no-testsarg — silently ignores it.Follow-up (not in this PR)
Two cargo-affected bugs worth filing upstream: (1) tests that
nextest runalways skips can never earn coverage and are flaggednewforever; (2)nextest listruns without the build features thatnextest runuses, so new-test detection enumerates a different test set than the run.