Capture lossy telemetry flags after positionals (#342) - #362
Open
sdairs wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a telemetry gap in clickhousectl where failed-parse (“lossy”) telemetry stopped at the first positional argument and therefore missed valid flags that appeared later in argv. It extends the definition-anchored argv walker to consume clap-defined positional slots without recording their values, so it can continue capturing later canonical flag names while still stopping at unknown tokens and -- to preserve privacy guarantees.
Changes:
- Teach
capture_lossy()to advance over positional arguments (including multi-value and hyphenated-value cases) without retaining any positional/flag values. - Improve lossy handling for hyphenated tokens (including short clusters) so positional-vs-flag decisions stay conservative and definition-driven.
- Add both unit tests and an end-to-end regression test covering the
cloud org usage ORG_ID --from-date ... --to-date ...reproduction and multiple positional shapes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/clickhousectl/src/telemetry.rs | Extends lossy argv walking with a positional cursor so later flags can be captured without ever recording argument values. |
| crates/clickhousectl/tests/telemetry_test.rs | Adds an end-to-end regression test ensuring flags after a positional are captured and secret argument strings never appear in telemetry payloads. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sdairs
force-pushed
the
issue-342-lossy-positional-flags
branch
from
August 5, 2026 18:28
2eccd16 to
0487a49
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--cloud org usagefailed-parse payloadTests
cargo test -p clickhousectl --bin clickhousectl lossycargo test -p clickhousectl --test telemetry_test failed_parse_after_positional_captures_later_flags_without_values -- --exactcargo test -p clickhousectlcargo clippy -p clickhousectl --all-targets -- -D warningsCloses #342