Skip to content

fix: surface build failures in go test summary#274

Merged
pszymkowiak merged 1 commit intortk-ai:masterfrom
riclib:fix/go-test-build-failures
Feb 28, 2026
Merged

fix: surface build failures in go test summary#274
pszymkowiak merged 1 commit intortk-ai:masterfrom
riclib:fix/go-test-build-failures

Conversation

@riclib
Copy link
Contributor

@riclib riclib commented Feb 28, 2026

Summary

  • go test -json emits build failures as build-output/build-fail actions with ImportPath (not Package/Test), followed by a package-level fail with a FailedBuild field
  • The JSON parser only counted failures when event.test.is_some(), so build errors were silently dropped from the summary — showing "891 passed" when a package failed to compile
  • Now parses build-output, build-fail, and FailedBuild fields from the Go test JSON protocol
  • Build failures count toward the failure total and display with [build failed] plus compiler error lines

Before:

✓ Go test: 891 passed in 74 packages

After:

Go test: 891 passed, 1 failed in 74 packages
═══════════════════════════════════════

📦 stream [build failed]
  handler_test.go:64:9: undefined: undefinedVariable

Test plan

  • Introduced intentional compile error (var _ = undefinedVariable) in a test file
  • Verified rtk previously showed ✓ 891 passed (masking the failure)
  • Verified rtk now shows 891 passed, 1 failed with the build error details
  • Verified clean run still shows ✓ 904 passed in 73 packages
  • cargo build --release succeeds with no new warnings

🤖 Generated with Claude Code

`go test -json` emits build failures as `build-output`/`build-fail`
actions with `ImportPath` (not `Package`/`Test`), followed by a
package-level `fail` with a `FailedBuild` field. The JSON parser
only counted failures when `event.test.is_some()`, so build errors
were silently dropped from the summary — showing "891 passed" when
a package failed to compile.

Now parses `build-output`, `build-fail`, and `FailedBuild` fields.
Build failures count toward the total and display with `[build failed]`
plus the compiler error lines.

Before:
  ✓ Go test: 891 passed in 74 packages

After:
  Go test: 891 passed, 1 failed in 74 packages
  ═══════════════════════════════════════

  📦 stream [build failed]
    handler_test.go:64:9: undefined: undefinedVariable

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pszymkowiak
Copy link
Collaborator

Good catch. go test -json emits build-output/build-fail events (with ImportPath, not Package) when compilation fails — these were silently dropped before. The fix correctly handles both
the buffering of build error lines and the package-level failure flag.

39 go_cmd tests pass. LGTM.

@pszymkowiak pszymkowiak merged commit b405e48 into rtk-ai:master Feb 28, 2026
maxkulish added a commit to maxkulish/rtk that referenced this pull request Mar 2, 2026
Bug fixes (4):
- fix(registry): move "fi"/"done" to IGNORED_EXACT to prevent shadowing
  find commands (rtk-ai#246)
- fix(hook): filter docker compose rewrites to supported subcommands
  only (ps/logs/build), avoid hard failures on up/down/exec (rtk-ai#245)
- fix(git): add is_blob_show_arg() to prevent duplicate output on
  git show rev:path style args (rtk-ai#248)
- fix(go): surface build failures (build-output/build-fail/FailedBuild)
  in go test -json summary (rtk-ai#274)

Features (2):
- feat(mypy): add rtk mypy command with grouped error output, 80% token
  reduction; delegate from lint_cmd.rs; add hook rewrites and registry
  entries (rtk-ai#109)
- feat(gain): add --project/-p flag to scope rtk gain stats to the
  current working directory; add shorten_path() display helper (rtk-ai#128)

Tests: 501 passed (10 new tests added)
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.

2 participants