Route child exits through telemetry tail (#321) - #360
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e712a6b. Configure here.
There was a problem hiding this comment.
Pull request overview
This PR addresses #321 by ensuring “child exit code passthrough” command paths (foreground local ClickHouse and Docker psql exec flows) no longer bypass the common telemetry finalization + update-notice tail in main, while still preserving the child’s original exit code.
Changes:
- Introduces
Error::ChildExit(i32)to carry an arbitrary child exit code through the normalmaintail (telemetry finalize + update notice) without printing a clickhousectl wrapper error. - Replaces
std::process::exit(...)in local foreground server start and Dockerpsqlexec paths withreturn Err(Error::ChildExit(...)). - Adds a subprocess regression test ensuring a non-zero foreground ClickHouse child exit still triggers telemetry + update notice and preserves the exact exit code.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/clickhousectl/tests/telemetry_test.rs | Adds a Unix-only subprocess test verifying child exit-code passthrough still reaches telemetry finalization and update notice output. |
| crates/clickhousectl/src/telemetry.rs | Updates telemetry payload/outcome documentation to explicitly classify arbitrary child exits as "error". |
| crates/clickhousectl/src/main.rs | Adjusts tail behavior to avoid printing wrapper errors for passthrough child exits (but currently contains a compile-breaking move). |
| crates/clickhousectl/src/local/mod.rs | Routes foreground ClickHouse server child failures through Error::ChildExit instead of early process::exit. |
| crates/clickhousectl/src/local/docker.rs | Routes Docker psql exec non-zero exit codes through Error::ChildExit instead of early process::exit. |
| crates/clickhousectl/src/error.rs | Adds Error::ChildExit(i32) and maps it to an unchanged process exit code, with unit test coverage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b55e70f to
d9d13d8
Compare

Closes #321
Summary
Tests
cargo fmt --allcargo test -p clickhousectl child_exit -- --nocapturecargo test -p clickhousectlcargo clippy -p clickhousectl --all-targets -- -D warningscargo check -p clickhousectl --no-default-features