fix(cargo): preserve compiler warnings in cargo test output on passing runs#2877
Open
CryptoKrad wants to merge 1 commit into
Open
fix(cargo): preserve compiler warnings in cargo test output on passing runs#2877CryptoKrad wants to merge 1 commit into
CryptoKrad wants to merge 1 commit into
Conversation
…g runs What: CargoTestHandler (streaming) and filter_cargo_test (buffered/pipe path) previously dropped compile-phase 'warning:' blocks entirely on passing runs. Both now capture and emit warning blocks (mirroring CargoBuildHandler) and annotate the compact summary with '[N compiler warnings]'. The aggregate 'generated N warnings' count line stays stripped. Buffered path caps blocks at CAP_WARNINGS with an '+N more' marker and hard-terminates warning blocks on section markers (failures:/test result:/test /----/error) so short blocks cannot swallow subsequent sections. Why: exit-0 runs get no tee log, so dropped warnings were unrecoverable — an agent reading 'cargo test: N passed' concluded the build was clean when rustc had emitted warnings. Confirmed behaviorally pre-fix: raw 'cargo test' showed 3 warning lines; rtk showed none (review lane finding HIGH-2, docs/research/runs/rtk-review-2026-07-07 in Claude.md-improve). Verified: cargo test full suite 2394 passed / 0 failed (+ 6 integration suites green); 2 new tests (buffered + streamed handler) assert warning survival, warning-count annotation, and aggregate-line stripping; behavioral A/B on a real crate: passing-with-warnings now shows the block + count (exit 0), failing run still shows failure detail with exit 101 == raw. Open risk: pytest wrapper has the analogous success-path loss (warnings summary + stderr) — tracked as a follow-up, mitigated operationally by tee.mode=always in local config. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K5bb4GKf9CNKP9uYhFDvsz
|
|
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.
Summary
rtk cargo testsilently dropped compile-phasewarning:blocks on passing runs — an agent readingcargo test: N passedconcluded the build was clean while rustc had emitted warnings. Since exit-0 runs get no tee log, the information was unrecoverable (same class as thenever_worsesize-only guard: the lie is smaller, so it passes).CargoBuildHandler's warning capture into both paths:CargoTestHandler(streaming) now streams warning blocks live, andfilter_cargo_test(buffered/pipe) collects them, capped atCAP_WARNINGSwith an+N moremarker. The compact summary gains[N compiler warnings]; the aggregategenerated N warningsline stays stripped.failures:/test result:/test/----/error) so a short warning block can never swallow a following section.Test plan
cargo fmt --all --check && cargo clippy --all-targets && cargo test— fmt clean, clippy 0 issues, 2394 passed / 0 failed (+ integration suites green)test_filter_cargo_test_all_pass_preserves_compiler_warnings(buffered) andtest_streamed_cargo_test_handler_preserves_compiler_warnings(streaming) — assert warning survival,[N compiler warnings]annotation, and aggregate-line strippingcargo test: 3 passed (2 suites, 0.00s) [1 compiler warnings](exit 0); failing run still shows failure detail with exit 101 == raw;rtk cargo buildoutput unchanged (consistency restored between build and test)🤖 Generated with Claude Code
https://claude.ai/code/session_01K5bb4GKf9CNKP9uYhFDvsz