Skip to content

Report invalid local versions directly - #345

Open
sdairs wants to merge 1 commit into
codex/issue-323-openapi-driftfrom
codex/issue-340-local-use-error
Open

Report invalid local versions directly#345
sdairs wants to merge 1 commit into
codex/issue-323-openapi-driftfrom
codex/issue-340-local-use-error

Conversation

@sdairs

@sdairs sdairs commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • distinguish invalid version syntax from version lookup misses
  • render parser diagnostics directly instead of prefixing them with No matching version found for:
  • add focused unit coverage for invalid spec shapes and a subprocess regression test for local use

Why

parse_version_spec used Error::NoMatchingVersion for both parser failures and genuine resolution misses. That error variant adds a lookup-specific prefix, so an input such as not.a.version produced a double-wrapped, garbled message.

Impact

clickhousectl local use not.a.version now reports:

Error: invalid version 'not.a.version': all parts must be numeric

Genuine lookup misses continue to use the existing No matching version found for: message.

Stack

This PR is stacked on #343 and should be reviewed as the delta from codex/issue-323-openapi-drift.

Closes #340.

Validation

  • cargo fmt --all --check
  • cargo build -p clickhousectl --all-targets
  • cargo test -p clickhousectl
  • cargo clippy -p clickhousectl --all-targets -- -D warnings

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 fixes error plumbing in the local version-spec parsing path so that invalid version syntax is reported directly (as an “invalid version …” message) instead of being misclassified as a version lookup miss, which previously caused a double-wrapped/garbled error message for inputs like not.a.version.

Changes:

  • Introduce a dedicated Error::InvalidVersion variant and update parse_version_spec to use it for syntax/shape failures.
  • Tighten unit tests around invalid spec shapes to assert on the precise error variant and message.
  • Add an integration (subprocess) regression test ensuring local use not.a.version is not wrapped with “No matching version found for: …”.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
crates/clickhousectl/tests/local_version_error_test.rs Adds a subprocess regression test validating user-facing stderr and ensuring no lookup-wrapper is applied for invalid specs.
crates/clickhousectl/src/version_manager/spec.rs Switches parse failures from NoMatchingVersion to InvalidVersion and strengthens unit assertions for invalid inputs.
crates/clickhousectl/src/error.rs Adds Error::InvalidVersion(String) for unwrapped parser/validation diagnostics.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sdairs
sdairs force-pushed the codex/issue-340-local-use-error branch from ed30721 to 1ae545f Compare August 3, 2026 18:42
@sdairs
sdairs marked this pull request as ready for review August 3, 2026 18:42
@sdairs
sdairs requested review from iskakaushik and rndD as code owners August 3, 2026 18:42
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 use with an unparseable version prints a double-wrapped error message

2 participants