Skip to content

fix(go): preserve incomplete test JSON streams - #4742

Open
Redestiny wants to merge 1 commit into
rtk-ai:developfrom
Redestiny:fix/go-test-preserve-incomplete-streams
Open

Redestiny wants to merge 1 commit into
rtk-ai:developfrom
Redestiny:fix/go-test-preserve-incomplete-streams

Conversation

@Redestiny

Copy link
Copy Markdown

Summary

A truncated go test -json stream can already contain --- FAIL: TestX and its diagnostic but still be summarized as Go test: 1 passed in 2 packages, because only terminal test events are counted.

  • Require each observed package to end in a package-level pass, fail, or skip before summarizing. Preserve the original stream if a package is unfinished or a JSON record is malformed, including a cut-off record after an otherwise completed package.
  • Add a real Go output fixture with its reproduction source, parser regressions for truncation and interleaved packages, and end-to-end rtk pipe -f go-test tests. Completed pass/fail/skip runs retain the existing summaries.

Fixes #4693.

Test plan

  • Parser and CLI regressions confirmed failing on the original implementation, then passing with the fix. The original CLI reports Go test: 1 passed in 2 packages; the fixed CLI preserves the truncated stream byte-for-byte.
  • cargo fmt --all --check
  • cargo fmt --manifest-path proxy/Cargo.toml --all --check
  • cargo clippy --all-targets --locked
  • cargo test --all --locked — 5,036 passed, 0 failed, 8 ignored.
  • Manual before/after CLI comparison using Go 1.26.10 output. The complete fixture keeps the same summary and 95.6% byte reduction.

Validation ran locally on Linux with Rust 1.99.1 and debug symbols disabled.

AI disclosure: OpenAI Codex was used to investigate, implement, and validate this contribution.

Require each package to end with a package-level pass, fail, or skip event before summarizing the run. Preserve the original stream when a package result or JSON record is incomplete so failure diagnostics are not hidden by a partial success count.

Add real Go output fixtures, parser regression coverage, and pipe CLI tests.

Fixes rtk-ai#4693

Assisted-by: OpenAI Codex
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@rtk-wshm-sync-bot rtk-wshm-sync-bot Bot added bug Something isn't working go testing labels Oct 22, 2026
@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟢 Risk low

Summary

Fixes a Go test JSON filter bug where truncated go test -json streams could be summarized as if all tests completed, hiding failures whose terminal events were cut off. Now each package must reach a terminal pass/fail/skip event (and JSON must parse cleanly) before the stream is summarized; otherwise the original output is preserved byte-for-byte. Adds a real Go fixture, parser regression tests for truncation/interleaved packages, and end-to-end CLI tests.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #4693


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

@pszymkowiak

Copy link
Copy Markdown
Collaborator

Thanks for the contribution! Before we can review and merge this, the CLA needs to be signed. The CLAassistant bot left the link above, it only takes a minute. Once it's signed we'll pick the review up.

@KuSh KuSh added the needs-cla label Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working go needs-cla testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

go test JSON filter reports a cut-off stream as all passed

4 participants