Fix #518: preserve BrokenPipe through JSON rendering - #529
Conversation
📝 WalkthroughWalkthroughThe CLI now treats stdout broken-pipe errors from JSON and JSONL output as quiet exits with code ChangesQuiet broken-pipe handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
All reported issues were addressed across 7 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
Addressed the Cubic review against
Verification: |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
crates/relayburn-cli/tests/json_broken_pipe.rs (1)
46-89: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueOptional: extract shared spawn/read-prefix/assert logic.
Both tests spawn
burn, read a fixed-size prefix, drop stdout, and assertoutput.status.success()with a similar failure message. Consider extracting a small helper that takes the CLI args and expected prefix bytes to reduce duplication.Also applies to: 91-137
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/relayburn-cli/tests/json_broken_pipe.rs` around lines 46 - 89, Optionally extract the duplicated child-process setup and early-stdout-close assertion from the tests around large_json_output_exits_zero_when_consumer_closes_early and the corresponding test near lines 91–137 into a small helper. Have it accept the CLI arguments and expected prefix bytes, then spawn burn, read and validate the prefix, drop stdout, wait for completion, and assert successful exit while preserving the existing diagnostic message.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@crates/relayburn-cli/tests/json_broken_pipe.rs`:
- Around line 46-89: Optionally extract the duplicated child-process setup and
early-stdout-close assertion from the tests around
large_json_output_exits_zero_when_consumer_closes_early and the corresponding
test near lines 91–137 into a small helper. Have it accept the CLI arguments and
expected prefix bytes, then spawn burn, read and validate the prefix, drop
stdout, wait for completion, and assert successful exit while preserving the
existing diagnostic message.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: aca9e9d5-6427-4b3d-88f6-d94e701f7b16
📒 Files selected for processing (7)
CHANGELOG.mdCargo.tomlcrates/relayburn-cli/src/commands/stamps.rscrates/relayburn-cli/src/commands/update.rscrates/relayburn-cli/src/render/error.rscrates/relayburn-cli/src/render/json.rscrates/relayburn-cli/tests/json_broken_pipe.rs
|
Validated the final CodeRabbit feedback:
No code change is needed. |
Summary
Preserves the underlying
io::ErrorKindwhen serde_json writers fail, allowing stdout JSON and JSONL renderers to recognizeBrokenPipeand exit quietly when downstream consumers close early.Scopes quiet EPIPE handling to stdout output. File and FIFO export failures remain reported and nonzero. This change is intentionally JSON-only; human-output broken-pipe handling remains separate.
Adds multi-megabyte early-closing consumer regressions for
sessions list --jsonand stdoutstamps export, including an assertion that all seeded session rows are retained.Verification
cargo fmt --all -- --checkcargo test --workspaceFixes #518
🤖 Generated with Claude Code