Skip to content

fix(cargo): show nextest output the run filter does not recognise - #5095

Open
KuSh wants to merge 1 commit into
rtk-ai:developfrom
KuSh:fix/cargo-d2-nextest
Open

KuSh wants to merge 1 commit into
rtk-ai:developfrom
KuSh:fix/cargo-d2-nextest

Conversation

@KuSh

@KuSh KuSh commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

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, a run killed before its summary and a coloured run: the nextest filter returned an empty string whenever it found no summary and no test status line.

The filter now strips escape codes before matching and hands the output back unchanged when it has no summary and no failure block to show. When a filter hands back exactly the text it was given, the runner prints the command's stdout on stdout and its stderr on stderr, as captured, so rtk cargo nextest list --message-format json | jq works and nextest's stderr-only text (a compile error, archive's report) stays on stderr. That output is shown whole, so no recall entry is stored for it.

Behaviour changes

  • Every nextest operation other than a test run, and a run the filter cannot summarise, prints what nextest printed, on the same streams, with its exit code.
  • A coloured run is summarised like a plain one.
  • A run killed after a FAIL line shows its failure blocks; one killed after only PASS lines is shown as printed.
  • Any filter that returns its input unchanged now gets the same stream-faithful printing, with no recall hint.
  • The hook does not rewrite cargo nextest, so only an explicit rtk cargo nextest … changes.

Test plan

  • cargo fmt --all, cargo clippy --all-targets, cargo test --all --no-fail-fast (5597 passed)
  • Compared with real cargo-nextest 0.9.143 under LC_ALL=C: every operation above matches raw nextest stream for stream and exit code; passing and failing runs are summarised as on develop
  • Each new guard fails a test when removed

🤖 Generated with Claude Code

`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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant