Skip to content

fix(go): keep fuzz failing-input and re-run lines in test output - #4438

Open
Ashutosh-Panda2004 wants to merge 1 commit into
rtk-ai:developfrom
Ashutosh-Panda2004:fix/go-fuzz-failure-lines
Open

Ashutosh-Panda2004 wants to merge 1 commit into
rtk-ai:developfrom
Ashutosh-Panda2004:fix/go-fuzz-failure-lines

Conversation

@Ashutosh-Panda2004

Copy link
Copy Markdown

When a fuzz target fails, rtk go test showed only the assertion line. The two lines that make the failure reproducible — where the failing input was saved and the re-run command — were filtered out: they match neither the location nor the failure-keyword patterns in select_go_test_failure_lines, and the blank line after the assertion resets the follow-up context before they arrive.

The filter now treats the corpus-path line and the To re-run: header as failure lines, and keeps the command line that follows the header, the same way the line after a file location is already kept. A regression test covers the stream shape a fuzz crash produces.

Local verification: cargo fmt --all -- --check and cargo clippy --all-targets are clean, and cargo test --all passes (3853 unit tests, including the new one). One integration test, unwritable_hooks_dir_never_breaks_the_hook in tests/copilot_selfheal_test.rs, fails in my sandbox — it fails identically on unmodified develop, because tests run as root there and the chmod-based unwritable directory stays writable. I also reproduced the issue end to end with Go 1.26.6 before and after: the filtered output now shows the assertion, the corpus path and the re-run command.

Closes #4434

When a fuzz target fails, go test -json reports where the failing
input was saved and how to re-run it:

    Failing input written to testdata/fuzz/FuzzRev/f7d774048ada30d0
    To re-run:
    go test -run=FuzzRev/f7d774048ada30d0

select_go_test_failure_lines kept neither: both lines match no
location or failure-keyword pattern, and a blank separator line after
the assertion resets the follow-up context before they arrive. The
filtered output showed only the assertion, sending the user to the
tee log for the two lines they actually need.

Treat the corpus-path line and the "To re-run:" header as failure
lines, and keep the line after "To re-run:" as context, the same way
the line after a file location is kept.
@CLAassistant

CLAassistant commented Oct 3, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟢 Risk low

Summary

Fixes the Go test output filter so that when a fuzz target fails, the 'Failing input written to...' line and the 'To re-run:' header plus its command line are preserved instead of being stripped. Adds a regression test covering the real JSON stream shape produced by a Go fuzz crash.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #4434


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 go testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rtk go test: a failing fuzz run drops the failing-input path and the re-run command

2 participants