You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
go test JSON filter reports a cut-off stream as all passed #4693
filter_go_test_json counts terminal pass/fail events and ignores tests that started but never finished. When the stream stops before a failing test's fail event, the summary is green.
Take a real go test -json ./... stream with one failing test (Go 1.24.6, 27 packages) and keep the lines before {"Action":"fail","Package":"example.com/proj/zz","Test":"TestX"}. That is what timeout, a killed CI step or | head -n N leaves behind. rtk pipe -f go-test prints:
Go test: 50 passed in 27 packages
The stream contains --- FAIL: TestX and z_test.go:5: expected 1, got 2 in output events, and both are dropped. Related: #958 (a timed-out run reported as No tests found).
Reproduced on develop 5538d72 and on #4455's head.
filter_go_test_json only counts terminal pass/fail events, so a truncated stream (timeout/kill/head) before a fail event reports all-green instead of surfacing in-flight failures.
📁 Relevant files
src/filters/go_test_json.rs
Suggested Actions
Track in-progress tests (started but no terminal event) and surface them as unknown/incomplete, not passed
Parse output-type events (--- FAIL:, file:line: msg) as fallback signal when stream is cut off
Hitting this in real use, not only with a cut stream: rtk go test truncates the filter's own input at 10 MiB, so on a large go test -race run over several packages the summary is computed from a partial stream.
Seen on 0.49.0 with a large Go codebase, three runs in one session:
[rtk] warning: output exceeds 10 MiB — filter input truncated
Go test: 1685 passed in 8 packages
[rtk] warning: output exceeds 10 MiB — filter input truncated
Go test: 798 passed in 7 packages
The counts cover only the events before the cap. A test that fails after it is not in the summary, so the output reads as a green run. The warning is there, but the line under it is the one an agent acts on.
Minimal repro on 1.0.1 (rtk-oss, macOS arm64, go 1.26.1). One noisy passing test pushes the -json stream past 10 MiB, then a failing test:
$ rtk go test -count=1 ./...
[rtk] warning: output exceeds 10 MiB — filter input truncated
Go test: No tests found
[full output: ".../rtk/tee/<ts>_go_test.log"]
$ echo $?
1
The exit code is right (1), but the summary says nothing failed and does not name TestZzzFails.
Suggestion: when the input is truncated, don't print a pass/fail count as if it were complete. Either say result unknown: input truncated at 10 MiB, exit code N or fall back to the ok/FAIL package lines and --- FAIL lines, which are small even on huge runs.
Activity
rtk-wshm-sync-bot commentedon Oct 20, 2026
🔍 Automated Triage
bughighSummary
filter_go_test_json only counts terminal pass/fail events, so a truncated stream (timeout/kill/head) before a fail event reports all-green instead of surfacing in-flight failures.
📁 Relevant files
src/filters/go_test_json.rsSuggested Actions
Triaged automatically by wshm · This is an automated analysis, not a human review.
fix(go): preserve incomplete test JSON streams
busraayaksiz commentedon Oct 22, 2026
Hitting this in real use, not only with a cut stream:
rtk go testtruncates the filter's own input at 10 MiB, so on a largego test -racerun over several packages the summary is computed from a partial stream.Seen on 0.49.0 with a large Go codebase, three runs in one session:
The counts cover only the events before the cap. A test that fails after it is not in the summary, so the output reads as a green run. The warning is there, but the line under it is the one an agent acts on.
Minimal repro on 1.0.1 (rtk-oss, macOS arm64, go 1.26.1). One noisy passing test pushes the
-jsonstream past 10 MiB, then a failing test:The exit code is right (1), but the summary says nothing failed and does not name
TestZzzFails.Suggestion: when the input is truncated, don't print a pass/fail count as if it were complete. Either say
result unknown: input truncated at 10 MiB, exit code Nor fall back to theok/FAILpackage lines and--- FAILlines, which are small even on huge runs.