Skip to content

fix(set-version): reject unmatched package selectors#967

Open
ychampion wants to merge 1 commit into
killercup:masterfrom
ychampion:fix/set-version-missing-package
Open

fix(set-version): reject unmatched package selectors#967
ychampion wants to merge 1 commit into
killercup:masterfrom
ychampion:fix/set-version-missing-package

Conversation

@ychampion

Copy link
Copy Markdown

Summary

  • reject explicit package selectors that do not match a workspace member
  • validate the complete selection before changing any manifests
  • cover single, mixed, multiple, and repeated missing selectors

Why

A nonexistent --package currently exits successfully without doing anything. Mixed valid and invalid selectors can also update part of a workspace before the mistake is noticed.

Closes #888.

Validation

  • cargo test --locked --all-features
  • cargo clippy --locked --all-targets --all-features -- -D warnings
  • cargo fmt --all -- --check
  • built cargo-set-version CLI smoke tests for missing and valid selectors

Validate every explicit package selector before mutating workspace or package manifests so release automation cannot silently succeed or partially update a workspace.

Constraint: Preserve existing default workspace selection and valid explicit package behavior.
Rejected: Validate selectors during the mutation loop | Mixed valid and missing selectors could partially update manifests.
Confidence: high
Scope-risk: narrow
Directive: Keep explicit selector validation ahead of workspace-version and package writes.
Tested: cargo test --locked --all-features; cargo clippy --locked --all-targets --all-features -- -D warnings; cargo fmt --all -- --check; built CLI missing/valid selector smokes; git diff --check
Not-tested: Full CI on non-Linux platforms
@ychampion ychampion force-pushed the fix/set-version-missing-package branch from 50df9c8 to bf3582e Compare July 12, 2026 20:07
Comment on lines +19 to +26
.stdout_eq("")
.stderr_eq("Error: package missing doesn't exist\n");

assert_ui().subset_matches(current_dir!().join("out"), &project_root);
}

#[cargo_test]
fn mixed_selection_is_atomic() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please follow the pattern of our tests, including

  • One test per mod
  • Using file!["stdout.term.svg"] for snapshots

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We generally ask that people show the existing bug by adding the tests in their own commit, with them passing, then fix the issue and update the tests.

See also https://epage.github.io/dev/pr-style/#c-split

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.

Specifying nonexistent package name results in "successful" no-op run

2 participants