Skip to content

fix: report package-level failures (timeouts, signals) in go test summary#959

Merged
aeppling merged 1 commit intortk-ai:developfrom
tmchow:osc/958-fix-timeout-summary
Apr 9, 2026
Merged

fix: report package-level failures (timeouts, signals) in go test summary#959
aeppling merged 1 commit intortk-ai:developfrom
tmchow:osc/958-fix-timeout-summary

Conversation

@tmchow
Copy link
Copy Markdown
Contributor

@tmchow tmchow commented Apr 1, 2026

When go test times out or gets killed by a signal, the JSON stream contains a package-level {"action":"fail"} with no Test field and no FailedBuild field. The parser in filter_go_test_json (go_cmd.rs:447) only handled test-level fails (event.test.is_some()) and build-level fails (event.failed_build.is_some()), so this event fell through silently. The summary saw 0 passes + 0 fails and reported "No tests found."

Before:

$ rtk go test -timeout 3s -run TestHang ./...
Go test: No tests found

After:

$ rtk go test -timeout 3s -run TestHang ./...
Go test: 0 passed, 1 failed in 1 packages
═══════════════════════════════════════

hangtest [FAIL]
  FAIL	hangtest	5.240s

Changes in go_cmd.rs:

  • PackageResult struct: added package_failed and package_fail_output fields
  • "fail" handler: added else branch for package-level failures that aren't test or build failures
  • "output" handler: captures package-level output (timeout messages, signal info) when event.test is None
  • Summary: counts package failures in has_failures and displays them with captured output

The exit code was already correct (Go exits 1, rtk propagates it at line 94). Only the summary message was wrong.

Fixes #958

This contribution was developed with AI assistance (Claude Code).

@tmchow tmchow changed the base branch from master to develop April 1, 2026 04:54
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 3, 2026

CLA assistant check
All committers have signed the CLA.

@tmchow
Copy link
Copy Markdown
Contributor Author

tmchow commented Apr 3, 2026

Why is the GitHub actions being required to sign the CLA?! 🤔

…mary

When go test times out or is killed by a signal, the JSON stream
contains a package-level {"action":"fail"} with no Test field and no
FailedBuild field. The parser only handled test-level and build-level
failures, so this event was silently dropped. The summary then saw
0 passes + 0 fails and reported "No tests found" instead of the
actual failure.

The fix adds handling for package-level failures: a new else branch
in the fail handler, package-level output capture in the output
handler, and inclusion in the summary count and display.

Before: "Go test: No tests found"
After:  "Go test: 0 passed, 1 failed in 1 packages" with the
        timeout output shown under the package name.

Fixes rtk-ai#958

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tmchow tmchow force-pushed the osc/958-fix-timeout-summary branch from 5db8a6e to c85a387 Compare April 7, 2026 21:10
@tmchow
Copy link
Copy Markdown
Contributor Author

tmchow commented Apr 7, 2026

Rebased on the latest develop. This should be ready for review when you get a chance.

@aeppling are you the right person to ping?

Copy link
Copy Markdown
Collaborator

@pszymkowiak pszymkowiak left a comment

Choose a reason for hiding this comment

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

Tested locally:

  • Compilation: OK (release build)
  • Unit tests: 4/4 go_cmd tests pass including new test_filter_go_test_timeout_package_fail
  • Real timeout test: Confirmed fix works — rtk go test -timeout 3s on a hanging test now correctly reports 0 passed, 1 failed with exit code 1 (was: No tests found exit code 0)
  • No regression: Normal passing tests still report correctly

Clean fix, well-scoped, good test coverage.

@aeppling aeppling merged commit 0b1c32b into rtk-ai:develop Apr 9, 2026
10 checks passed
@tmchow
Copy link
Copy Markdown
Contributor Author

tmchow commented Apr 9, 2026

thanks @pszymkowiak and @aeppling !

@aeppling aeppling mentioned this pull request Apr 11, 2026
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.

go test timeout reported as 'No tests found' with exit code 0

4 participants