feat(core): range constraints for internal dependencies#181
feat(core): range constraints for internal dependencies#181goulvenclech wants to merge 4 commits intomainfrom
Conversation
🧭 Changeset detectedMerging this PR will release the following updates: sampo (Cargo) — minor version bumpMinor changes
Note: Constraint validation is currently implemented for Cargo packages only. Other ecosystems will skip validation with an informative message until constraint extraction is implemented for them. sampo-core (Cargo) — minor version bumpMinor changes
Note: Constraint validation is currently implemented for Cargo packages only. Other ecosystems will skip validation with an informative message until constraint extraction is implemented for them. sampo-github-action (Cargo) — minor version bumpMinor changes
Note: Constraint validation is currently implemented for Cargo packages only. Other ecosystems will skip validation with an informative message until constraint extraction is implemented for them. |
|
Open questions :
|
The usual way to install |
74bf19f to
6c36c8d
Compare
Fixes #175 . Sampo no longer overwrites range constraints for internal dependencies (or skips them silently in some cases). During release planning, if a planned version bump doesn't satisfy a range constraint (e.g. bumping
footo2.0.0when another package requiresfoo = "^1.0"), you'll get either an error (for packages infixedorlinkedgroups) or a warning, instead of silently skipping. Pinned versions (e.g.foo = "1.2.3") are still bumped automatically.Note: Constraint validation is currently implemented for Cargo packages only. Other ecosystems will skip validation with an informative message until constraint extraction is implemented for them.
What has changed?
crates/sampo-core/src/adapters/cargo.rs: Addedshould_update_dependency_version()helper — pinned versions (bare semver) are updated, range constraints (^,~,*, etc.) are preserved. Addedis_dependency_pinned()andraw_dep_version()helpers. Updatedupdate_standard_dependency_item,update_inline_dependency, andupdate_table_dependencyto use them.crates/sampo-core/src/release.rs:validate_dependency_constraints()now uses real constraints fromManifestMetadata::get_dependency_constraint()for Cargo packages instead of hardcoded"*". Removed#[allow(dead_code)].crates/sampo-core/src/types.rs:ConstraintCheckResultenum andConstraintViolationstruct.crates/sampo-core/src/errors.rs:ConstraintViolationerror variant.crates/sampo-core/src/adapters.rs:check_dependency_constraintmethod onPackageAdapter.crates/sampo-core/src/adapters/{npm,hex,pypi}.rs: Stubs returningSkipped.crates/sampo-core/src/lib.rs: Export new types.How is it tested?
crates/sampo-core/src/adapters/cargo/cargo_tests.rs: 10 new tests for range constraint preservation (caret, tilde, wildcard — satisfied & unsatisfied, all dependency formats). Plus the existing 22 constraint-checking tests.crates/sampo-core/src/release_tests.rs: 4 new integration tests — range preserved through release, pinned updated through release, constraint violation blocks release in fixed groups, constraint violation warns but succeeds without groups.crates/sampo-core/src/types.rs: Unit tests forConstraintCheckResultmethods andDisplayimplementations.How is it documented?
crates/sampo/README.md: Added note about range constraint support in internal dependencies.