Repository navigation
Conversation
📊 Automated PR Analysis
SummaryFixes the cargo test output filter so that failed Review Checklist
Linked issues: #5063 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
This was referenced Nov 17, 2026
`filter_cargo_nextest` returned an empty string when it found no summary and no test status line, so `rtk cargo nextest list`, `show-config`, `help`, `-V` and `archive` printed nothing, and so did a `run` that fails to compile, `run --no-run`, a `run` with a rejected option and a `run` killed before its summary (the compiler error or usage message was lost, only the exit code remained). A coloured run (`--color always`, `CARGO_TERM_COLOR=always`) printed nothing either: the escape codes around `PASS`, `FAIL` and `Summary` kept them from matching at the start of a line. The filter now strips the escape codes before matching (only when the text has one), and returns the output unchanged when it has no summary and no failure block to show. A run killed after a `FAIL` line still shows its failure blocks; a run killed after only `PASS` lines is shown as nextest printed it. The summary and starting-line regexes are compiled once. The runner joins stdout and stderr to give a filter its input, so a filter that hands the text back would have printed all of it on stdout: the `Finished` line of `rtk cargo nextest list --message-format json | jq` would have broken the pipe, and nextest's stderr-only text (a compile error, `archive`'s report) would have moved to stdout. When a filter returns exactly the text it was given, the runner now prints the command's stdout on stdout and its stderr on stderr, each exactly as captured. A stdout-only filter is not compared with the joined text and is unaffected. Output handed back this way is printed in full, so there is nothing to recover: no recall entry is stored and no recovery hint is added, also when the command failed. A filter's own output is not affected. The exit code was already forwarded. A test run, passing or failing, is summarised as before; a test killed by a signal is counted in the summary but not listed, which is unchanged. The hook does not rewrite `cargo nextest`, so this only changes an explicit `rtk cargo nextest …`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e block With `--nocapture` the test harness prints a failing test's panic as it happens, outside the `failures:` section, and the cargo test filter only kept the blocks inside that section: a failed run showed `test result: FAILED` and nothing about why. A test binary that aborts prints no result at all, and what explains the abort can be on stdout or on stderr. When a run exits non-zero, tests ran (libtest printed its `running N tests` line) and no `---- name stdout ----` failure block was shown, the filter now hands its input back unchanged, and the run is printed as captured: its stdout on stdout, its stderr on stderr, line by line, with its exit code. Such a run is not shortened. A passing run, a failed run that shows its failure blocks and a run that fails to compile are summarised as before. A line that starts with `running ` but is not libtest's does not count as tests having run, so a build that fails after one keeps its compile-error summary, and a test's own such line is no longer dropped from its failure block. libtest's start line may name a shuffle seed. A run in which one failing test still prints a block (a `should_panic` test that did not panic) is summarised as before, so the reasons other tests printed outside blocks stay in the recovery copy only. cargo test is filtered as it streams. The stream runner now applies the rule the captured runner already applies: when a filter returns at exit exactly the text it was given (stdout followed by stderr), each stream is written to its own, as captured, instead of all of it going to the stream the last line came from, and no recovery hint is added, since the output shown is all that was captured. `stream::is_handed_back` defines the rule for both runners, and only the filter's answer at exit is compared: a streamed filter that showed every line live still gets its recovery hint. The other streamed handlers return the raw output only through the never-worse guard. `rtk cargo build` and `rtk cargo check` on an up-to-date crate print cargo's `Finished` line on stderr, as before (it went there as the last line read) and as cargo does. The tsc and `rtk err` filters never return their input. The fixtures are real `cargo test` output captured under `LC_ALL=C`. An end-to-end test runs `rtk cargo test` against a `cargo` stub and compares both streams and the exit code; the stub helper moves to `tests/common` so the nextest tests share it. Fixes rtk-ai#5063 Co-Authored-By: Claude Opus 5.5 <[email protected]>
KuSh
force-pushed
the
fix/cargo-d1-nocapture
branch
from
November 17, 2026 01:03
f3b1d01 to
c1a59c8
Compare
This was referenced Nov 28, 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.
Stacked on #5095: until it merges this PR also shows its commit; review the second one, "fix(cargo): show a failed test run as printed when it shows no failure block".
Summary
With
--nocapturethe test harness prints a failing test's panic as it happens, outside thefailures:section, and the cargo test filter only kept the blocks inside that section: a failed run showedtest result: FAILEDand nothing about why. A test binary that aborts prints no result at all, and what explains the abort can be on stdout or on stderr.When a run exits non-zero, tests ran (libtest printed its
running N testsline) and no---- name stdout ----failure block was shown, the filter now hands its input back unchanged and the run is printed as captured, stdout on stdout and stderr on stderr, with its exit code. The stream runner applies the rule #5095 gives the captured runner: output handed back is printed stream by stream and gets no recall hint.Behaviour changes
--nocapturerun, and a run whose test binary aborts, print what cargo printed. They are not shortened.runningis no longer dropped from its failure block, and libtest's start line may name a shuffle seed.should_panictest that did not panic) is summarised, so the reasons other tests printed outside blocks are only in the recall copy; a--no-fail-fastrun in which one binary shows failure blocks and another aborts is summarised without the abort.Test plan
cargo fmt --all,cargo clippy --all-targets,cargo test --all --no-fail-fast(5,610 passed)cargo testunderLC_ALL=Con probe crates: failing--nocaptureruns (parallel, single-threaded, tests printing on both streams, a failing doctest) and aborting binaries match raw cargo stream for stream with exit code 101 and no hint; runs with failure blocks, passing runs and compile errors print what develop printscargostub, comparing both streams and the exit codeFixes #5063
🤖 Generated with Claude Code