fix: don't hand nextest a phantom-only filterset in run - #81
Open
cargo-affected-bot wants to merge 1 commit into
Open
fix: don't hand nextest a phantom-only filterset in run#81cargo-affected-bot wants to merge 1 commit into
run#81cargo-affected-bot wants to merge 1 commit into
Conversation
Deleting a test produces a hunk over exactly its own stored range, so it lands in `affected` — and when nothing else changed, it is the whole selection. It is also gone from `nextest list`, so the generated default-filter matches nothing and nextest's exit 4 propagates: a stale cache row reported as a test failure. `run` now hands nextest `Selection::live_selected()` and short-circuits with exit 0 when that is empty, noting the count either way. `status` renders the same note in the conditional tense so its prediction still matches what `run` does. `collect --diff` is untouched: it keeps phantoms deliberately and prunes their rows afterwards.
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.
Deleting a test makes
cargo affected runexit 4 witherror: no tests to run.Deleting a test function produces a diff hunk over exactly the lines its own stored coverage range covers, so the deleted test is selected as
affected— and if the deletion is the only change, it is the whole selection. It is also gone from the currentnextest list, so the generateddefault-filtermatches nothing, and nextest's "no tests to run" exit propagates throughrun_tests. A stale cache row is reported to the caller as a test failure.collect --diffhas never had this problem: it passes--no-tests=warnand usesDiffPlan::live_selected_countafterwards to tell an all-phantom rerun from a runner-shim failure.runhad no equivalent.Repro
Against the two-module scratch project the functional suite uses, with the whole
test_multiplyblock deleted and nothing else changed:Exit code 4.
Change
Selection::live_selected()(new, inselection.rs) isselected()restricted to tests still in the listing.runhands nextest that subset instead of the full selection, and short-circuits with exit 0 when it is empty — there is no run to make, and asking nextest to run a phantom-only filterset can only produce the exit above. Both paths emit a note naming the count and pointing atcargo affected collectto drop the rows.statusgets the same note, in the conditional tense. Without it the dry run would predict a test thatrunnow visibly skips, which is the invariant #71 established.collect --diffis untouched — it keeps phantoms in its filterset deliberately, and prunes their rows afterwards.Tests
run_with_all_phantom_selection_exits_zero(functional) collects, deletestest_multiply, and asserts exit 0 plus the two new messages. Verified failing against pre-fixsrc/:run with an all-phantom selection must exit 0, got Some(4), witherror: no tests to runin the captured output.Two unit tests in
selection.rspinlive_selected()'s filtering and the notice's singular/plural agreement.cargo testis green (114 unit + 42 functional);cargo clippy --all-targetsis clean.Relationship to #39 / #41
Same exit-4 failure class, different trigger, disjoint fix. #41 keeps filter-mismatched tests (positional filters,
-E,#[ignore]) out of the selection by keying offfilter-match.status; its own comment notes that phantoms are deliberately not inlisting.excludedand stay inaffected. This handles that remaining source. The two should merge cleanly enough — #41 edits the top ofcomputeand the imports inrun.rs; this editsimpl Selectionand the tail ofrun().