Skip to content

fix(go): preserve explicitly requested verbose test output - #3992

Open
tianhaotian wants to merge 2 commits into
rtk-ai:developfrom
tianhaotian:fix/go-test-verbose-output
Open

tianhaotian wants to merge 2 commits into
rtk-ai:developfrom
tianhaotian:fix/go-test-verbose-output

Conversation

@tianhaotian

Copy link
Copy Markdown
Contributor

Summary

  • Preserve passing-test logs and stderr when go test explicitly requests verbosity (-v, -test.v, their double-dash aliases and boolean values), using the existing passthrough runner without injecting -json.
  • Honor repeated verbosity flags, test argument boundaries and value-taking flags so a selector or output path such as -v=false is not mistaken for a verbosity switch. Document the behavior.
  • Add portable flag-policy unit tests and Unix subprocess regressions covering original argv, stdout, stderr, exit status and default compression.

Fixes #3985.

Test plan

  • cargo fmt --all --check
  • cargo clippy --all-targets
  • cargo test --all — 3573 passed, 8 ignored.
  • cargo test --all -- --ignored --test-threads=1 — all 8 additional tests passed.
  • Red/green check: the new subprocess regression originally received only Go test: 1 passed in 1 packages; the final version preserves the passing-test marker and original stdout exactly, along with stderr and exit codes 0/1.
  • Manual testing: 18 comparisons against real go test covering verbose/quiet flag forms, pass/fail runs and flag-like -o/-coverprofile values. Exit codes and the required diagnostics match.
  • Default compression comparison with captured real Go NDJSON: before/after output is identical; 1945 raw bytes become 32 bytes (98.35% reduction against the JSON input).
  • Hyperfine, unchanged default mode replaying that fixture, 15 runs: 11.8 ms before / 11.4 ms after with debug binaries. This is a regression check, not a release-startup claim.

Validated locally on macOS arm64 with Rust 1.98.0. Flag-policy unit tests are platform-independent; subprocess shim tests use cfg(unix). Windows and Linux coverage remains with the repository CI.

@rtk-wshm-sync-bot rtk-wshm-sync-bot Bot added bug Something isn't working cli testing go labels Sep 12, 2026
@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟡 Risk medium

Summary

Fixes go test output handling so that explicitly requested verbose flags (-v, -test.v, their double-dash aliases, and =true/=false value forms) trigger a passthrough runner that preserves original stdout, stderr, and exit codes instead of injecting -json. Flag parsing correctly respects test argument boundaries (-args, --) and value-taking flags so selectors/paths like -v=false aren't misinterpreted, and adds unit and subprocess regression tests plus doc updates.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #3985


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cli go testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rtk go test -v ignores the explicit -v flag and drops all passing-test output, breaking grep-based gates

1 participant