Skip to content

Route child exits through telemetry tail (#321) - #360

Open
sdairs wants to merge 2 commits into
issue-319-cancelled-exit-codefrom
issue-321-child-exit-telemetry
Open

Route child exits through telemetry tail (#321)#360
sdairs wants to merge 2 commits into
issue-319-cancelled-exit-codefrom
issue-321-child-exit-telemetry

Conversation

@sdairs

@sdairs sdairs commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Closes #321

Summary

  • Route foreground ClickHouse and both Docker psql child failures through the common telemetry and update-notice tail.
  • Preserve arbitrary child exit codes without adding a clickhousectl wrapper error, while retaining the existing normal, cancelled, and auth exit mappings.
  • Add subprocess coverage for exit-code passthrough, telemetry finalization, and update notices.

Tests

  • cargo fmt --all
  • cargo test -p clickhousectl child_exit -- --nocapture
  • cargo test -p clickhousectl
  • cargo clippy -p clickhousectl --all-targets -- -D warnings
  • cargo check -p clickhousectl --no-default-features

@sdairs
sdairs requested review from iskakaushik and rndD as code owners August 5, 2026 11:41
Comment thread crates/clickhousectl/src/local/docker.rs

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread crates/clickhousectl/src/telemetry.rs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 normal main tail (telemetry finalize + update notice) without printing a clickhousectl wrapper error.
  • Replaces std::process::exit(...) in local foreground server start and Docker psql exec paths with return 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.

Comment thread crates/clickhousectl/src/main.rs Outdated
@sdairs
sdairs force-pushed the issue-321-child-exit-telemetry branch from b55e70f to d9d13d8 Compare August 5, 2026 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local child-process passthrough exits bypass the telemetry tail

2 participants