Skip to content

fix(pipe): preserve non-JSON Go test reports - #4455

Open
yeahjack wants to merge 12 commits into
rtk-ai:developfrom
yeahjack:fix/go-test-pipe-text
Open

yeahjack wants to merge 12 commits into
rtk-ai:developfrom
yeahjack:fix/go-test-pipe-text

Conversation

@yeahjack

@yeahjack yeahjack commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Recognize an event-only Go test JSON stream before applying the pipe -f go-test JSON filter
  • Preserve plain text, unrelated/malformed JSON, and mixed text/JSON input in full, including failures after many successful package lines
  • Reuse the existing GoTestEvent schema for recognition; leave the Go runner and its JSON result/fuzz/build parsers unchanged

Closes #4418. This is the plain-text follow-up to merged #1444 and does not change the list/fuzz routing addressed by #4430 / #4437 / #4438.

Spec-driven re-review

Acceptance was derived from #4418, the repository's lossless fallback principle, and Go's event schema before inspecting this implementation.

  • G1: Preserve unsupported input completely. Covered by plain_failure_after_many_successes_is_preserved_in_full, plain_success_empty_and_non_event_json_are_not_misclassified, mixed_json_and_text_keeps_every_line, and the added raw_fallback_preserves_line_endings_and_unterminated_text (CRLF, Unicode, whitespace, no trailing newline).
  • G2: Each nonblank record must have a recognized action and supported event shape before filtering. The new output_shaped_json_without_output_is_not_a_test_report exposed one missed case: an object with Action/Package but no Output lost its diagnostic and became No tests found. It failed on the original PR implementation (6 CLI tests passed, 1 failed). A five-line guard now leaves output/build-output records without their required payload unchanged; all 7 CLI tests pass. Matching wrapper unit cases cover the same boundary.
  • G3: Existing success/failure and build summaries remain unchanged. Covered by valid_json_events_still_use_the_existing_filter, added padded_json_and_build_failures_keep_existing_summaries, and existing Go parser tests. The runner, list/fuzz routing, and renderer are unchanged.

Package-less go tool test2json input is conservatively retained raw; Package is optional in that tool's format, so this is a lossless fallback, not a claim that such JSON is malformed. This recognizer checks individual event shapes, not sequence completeness. pipe cannot recover the upstream command's status. No plain-text parser or new framework is added.

Verification

  • cargo fmt --all --check, cargo clippy --offline --all-targets, and cargo test --offline --all passed: 4,122 tests passed; 8 pre-existing ignored tests were not run
  • The 7 focused built-CLI regression tests passed
  • Original develop baseline loses plain/mixed reports; the missing-payload case fails on the initial PR and passes after the fix
  • Local execution was Linux. No Go language toolchain or local performance benchmark was available; JSON fixtures and the existing parser tests cover Go formatting

CI run 37336140553 passed for fb79b81d570ec3249cc17a66b5a2af0a7baee94f, including Windows/macOS/Linux tests, formatting, clippy, benchmark and security jobs. CLA status passed. The target-branch job is intentionally skipped for the develop base. The optional AI documentation review was skipped because its repository API key is not configured; the job reports success.

The spec-driven self-review has no remaining known in-scope finding. Ready for maintainer review.

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

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟢 Risk low

Summary

This PR fixes the rtk pipe -f go-test filter to detect whether stdin is actually a complete Go test JSON event stream before applying the Go test JSON filter, preserving plain text, malformed/unrelated JSON, and mixed text/JSON input unchanged. It adds a new is_go_test_json recognizer reusing the existing GoTestEvent schema, leaving the underlying Go test parser and build/fuzz routing untouched.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #4418


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

@yeahjack
yeahjack marked this pull request as ready for review October 5, 2026 16:00
@yeahjack
yeahjack force-pushed the fix/go-test-pipe-text branch from 28051d2 to e11a981 Compare October 19, 2026 10:25
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 pipe testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rtk pipe -f go-test reports plain-text go test output as "No tests found"

1 participant