fix(dotnet): stop duplicating failures on failing test runs (#2501)#2502
Merged
aeppling merged 2 commits intoJun 22, 2026
Merged
Conversation
On failing `dotnet test` runs the orchestrator prepended the full raw stdout ahead of the filtered summary. The `Failed Tests:` section already reproduces each failure (name + message + clipped stack) parsed from TRX/console, so every failure was printed twice — inflating output +65% vs raw, scaling linearly with failure count (issue rtk-ai#2501). Gate the raw-stdout prepend behind `test_needs_raw_fallback`: skip it when the structured section carries detail, keep it when the filter is blind (no failures parsed, or a parsed failure has empty detail — e.g. a self-closing <UnitTestResult> with no <ErrorInfo>, or a build failure / crash where nothing reaches failed_tests). Extracts two pure, unit-tested fns (`test_needs_raw_fallback`, `compose_failure_output`) so the orchestration decision is covered without running dotnet. Closes rtk-ai#2501 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
Hey @Tailoo , thanks for addressing this issue. Another concurrent PR #2511 , in favor of this one for the cleaner factoring. Blocker before merge: test_needs_raw_fallback drops the raw fallback whenever every listed failure carries detail, but never checks the list is complete against summary.failed. Fix: keep the raw fallback when the structured section is numerically incomplete, add a failed_tests.len() < summary.failed clause to the condition. |
test_needs_raw_fallback dropped the raw stdout prepend whenever every parsed failure carried detail, but never checked the list was complete against summary.failed. A run reporting 5 failures but parsing only 3 detailed blocks would silently lose the 2 unparsed failures. Add a `failed_tests.len() < summary.failed` clause so the raw fallback is kept when the structured section is numerically incomplete. Add a regression test and fix an inconsistent existing fixture (failed: 5 with a single parsed entry) that the new clause correctly flagged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
aeppling
approved these changes
Jun 22, 2026
Contributor
|
Hey, this look good to me, thanks for contributing to RTK :) |
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
Fixes #2501 — on failing
dotnet testruns the orchestrator prepended the full raw stdout ahead of the filtered summary. TheFailed Tests:section already reproduces each failure (name + message + clipped stack) parsed from TRX/console, so every failure was printed twice — inflating output +65% vs raw, scaling linearly with failure count.Fix
Gate the raw-stdout prepend behind a new
test_needs_raw_fallback:Failed Tests:section already carries detail → dedup.failed_tests), or a parsed failure has empty detail (e.g. a self-closing<UnitTestResult>with no<ErrorInfo>). Nothing is lost.build/restore/ passthrough keep prior behavior (needs_raw_fallback = true).Why this shape
The bug lived in
run_dotnet_with_binlog— the one dotnet layer with no test coverage (it spawns realdotnet). Consistent with the existing dotnet test pattern, the decision is extracted into two pure, unit-tested fns rather than adding a net-new orchestration/e2e harness (no dotnet filter has one):test_needs_raw_fallback(&summary) -> boolcompose_failure_output(success, needs_raw_fallback, stdout, stderr, filtered) -> StringRegression analysis (traced through code)
failed_testsdetailscounts_unavailableWarnings:/Errors:sections come from the build summary, independent of the prepend → still shown once.Tests
7 new unit tests (all green), covering the dedup decision and every fallback branch.
cargo fmt+cargo clippy --all-targetsclean,cargo test --allpasses.🤖 Generated with Claude Code