Repository navigation
test(cli): harden output capture and signal failure diagnostics - #2216
Conversation
The helper read the pipe only after fn returned, so output above the pipe buffer deadlocked the writer. Drain concurrently, close both ends on every path including panics, and add a 1 MiB regression test with a 10s guard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Marker waits now fail with the child exit status (or still running) and its captured stderr. Child stdout is not read, preserving the blocked-stdout scenario. Timeouts are unchanged. Closes #2150 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 2 billable files and costs up to $0.50.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 46 minutes for your next included review. View limit details
Comment |
Independent review verdict: CLEAN at a41104dReviewer: fresh Claude agent (Sonnet, high effort), not the author, cold brief. The PR body was treated as a claim. Coordinator: claude-cc-reviewer. Blocking findings: none. Non-blocking notes:
What was attacked and how (local macOS,
Gate:
|
Closes #2150
Summary
This PR fixes two test-harness reliability gaps. It changes test files only, with no production code changes.
captureAppOutputdeadlock (cmd/multi_service_stats_test.go)fnsynchronously and read the pipe only afterwards. Any output larger than the pipe buffer blocked the writer forever.fnruns. A defer restores stdout and the logger, closes the writer, waits for the drain, and then closes the reader, so cleanup also happens whenfnpanics.TestCaptureAppOutputDrainsLargeOutputwrites 1 MiB throughAppLogger. It fails after 10s instead of hanging, and it restoresos.StdoutandAppLoggerint.Cleanupso a failure does not stall the rest of the package.captureRealStduses the same drain pattern but swaps stdout and stderr, not the logger.captureAppLoguses no pipe. So a separate helper is justified.GCP signal marker timeouts (
cmd/configure_gcp_signal_test.go)requireMarkerhelper replacesrequire.Eventuallyat both marker waits. The timeout stays at 10s.Evidence
All runs are local on macOS with
GOTOOLCHAIN=go1.26.9.TestCaptureAppOutputDrainsLargeOutputfails at 10.0s and the package still finishes in about 12.5s. An independent reviewer reproduced this in a scratch copy.make build,go vet ./...,go test -race ./cmd/...: pass.-count=5: pass.scripts/test-git-secrets-allowlist.sh: 44/44.🤖 Generated with Claude Code