Skip to content

fix(go): prevent double-counted failures when test-level fail also triggers package-level fail (#958) - #1220

Merged
aeppling merged 2 commits into
rtk-ai:developfrom
ousamabenyounes:fix/issue-958
Apr 12, 2026
Merged

aeppling merged 2 commits into
rtk-ai:developfrom
ousamabenyounes:fix/issue-958

Conversation

@ousamabenyounes

@ousamabenyounes ousamabenyounes commented Apr 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #958

  • go test -json always emits a trailing package-level {"action":"fail"} after each test-level failure (no Test field). The previous code counted both events, so a run with 1 failing test showed "2 failed" in the summary header.
  • The package also appeared twice in the output: once as a [FAIL] block and again in the per-package test results section.
  • Fix: total_pkg_fail now only includes packages where package_failed=true and there are no individual test- or build-level failures — i.e. pure package-level failures (timeouts, signals, panics). The [FAIL] display section skips packages that already have test-level results below.

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test — 1376 passed, 0 failed
  • New test test_filter_go_test_no_double_count_on_test_failure — verifies header says "1 failed" not "2 failed" for a single failing test
  • New test test_filter_go_test_timeout_with_signal_quit_output — exact reproduction from issue go test timeout reported as 'No tests found' with exit code 0 #958 (signal: quit line present)
  • New test test_filter_go_test_timeout_with_passing_tests_before_kill — mixed case: some tests pass before package is killed by timeout

Files changed

File Change
src/cmds/go/go_cmd.rs Fix counting + display; add 3 edge-case tests
CHANGELOG.md Add unreleased entry

Generated by Ora Studio
Vibe coded by ousamabenyounes

@pszymkowiak pszymkowiak added bug Something isn't working effort-small Quelques heures, 1 fichier filter-quality Filter produces incorrect/truncated signal labels Apr 11, 2026
@pszymkowiak

Copy link
Copy Markdown
Collaborator

[w] wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟢 Risk low

Summary

Fixes double-counting of test failures in the Go test filter. When go test -json emits both a test-level and package-level fail event for the same failure, the previous code counted both, showing '2 failed' instead of '1 failed'. The fix ensures package-level failures are only counted when there are no individual test-level failures, and prevents duplicate display of failed packages.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #958


Analyzed automatically by wshm · This is an automated analysis, not a human review.

…cades from test failures (#958)

go test -json emits both a test-level {"action":"fail","Test":"..."}
and a trailing package-level {"action":"fail"} (no Test field) for
every failing test. The parser was counting both events, so a run with
1 failing test was reported as "2 failed" in the summary header.

Fix: total_pkg_fail now only includes packages where package_failed is
true AND there are no individual test- or build-level failures — i.e.
pure package-level failures such as timeouts and panics. Also exclude
such packages from the [FAIL] display section when test-level results
are already shown below.

Three new tests cover:
- no double-count on a regular test failure
- exact reproduction from issue #958 (signal: quit line)
- timeout with passing tests before the kill

Generated by Claude Code
Vibe coded by ousamabenyounes

Co-Authored-By: Claude <[email protected]>

@pszymkowiak pszymkowiak left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — fix is correct and minimal.

  • total_pkg_fail now correctly excludes cascade events (packages with test-level or build failures already counted)
  • Display section skips duplicate [FAIL] blocks for the same reason
  • 3 solid edge-case tests covering: double-count, exact #958 reproduction (signal: quit), and mixed pass+timeout
  • All 65 go_cmd tests pass, no regression
  • CI green across macOS/Linux/Windows

@aeppling
aeppling merged commit 4fc15ef into rtk-ai:develop Apr 12, 2026
5 checks passed
@aeppling aeppling mentioned this pull request Apr 12, 2026
thehoff pushed a commit to thehoff/contextcrawler that referenced this pull request May 14, 2026
fix(go): prevent double-counted failures when test-level fail also triggers package-level fail (rtk-ai#958)
thehoff pushed a commit to thehoff/contextcrawler that referenced this pull request May 14, 2026
fix(go): prevent double-counted failures when test-level fail also triggers package-level fail (rtk-ai#958)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working effort-small Quelques heures, 1 fichier filter-quality Filter produces incorrect/truncated signal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants