fix(deps): update semver to v3#962
Conversation
Signed-off-by: Nikita Z <nkzk95@gmail.com>
Signed-off-by: Nikita Z <nkzk95@gmail.com>
Signed-off-by: Nikita Z <nkzk95@gmail.com>
Signed-off-by: Nikita Z <nkzk95@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughImports updated to Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pkg/version/version_test.go (1)
83-112: Consider adding caret (^) operator tests for0.xconstraints to document expected behavior.The code uses Masterminds/semver/v3, where caret ranges for
0.xversions have specific semantics:^0.2.3expands to>=0.2.3 <0.3.0and^0.0.3expands to>=0.0.3 <0.0.4. Adding a couple of test cases for these would make the compatibility expectations explicit—especially helpful since v3 changed caret behavior from earlier versions.Would documenting the current behavior (v3 semantics) via tests work for this PR, or would you prefer to align with a different semver version's behavior?
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@pkg/version/version_test.go` around lines 83 - 112, Add two table-driven tests in pkg/version/version_test.go to document Masterminds/semver v3 caret semantics for 0.x: create a "CaretZeroMinor" case that uses constraint "^0.2.3" and asserts that a version like "v0.2.5" is allowed and "v0.3.0" is not (i.e. ^0.2.3 => >=0.2.3 <0.3.0), and a "CaretZeroPatch" case that uses constraint "^0.0.3" and asserts that "v0.0.3" is allowed but "v0.0.4" is not (i.e. ^0.0.3 => >=0.0.3 <0.0.4); follow the existing test table pattern used by the other cases (e.g., "ValidSpaceSeparatedRange", "CommaSeparatedRangedConstraint") so the behavior is explicitly recorded.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@pkg/version/version_test.go`:
- Around line 83-112: Add two table-driven tests in pkg/version/version_test.go
to document Masterminds/semver v3 caret semantics for 0.x: create a
"CaretZeroMinor" case that uses constraint "^0.2.3" and asserts that a version
like "v0.2.5" is allowed and "v0.3.0" is not (i.e. ^0.2.3 => >=0.2.3 <0.3.0),
and a "CaretZeroPatch" case that uses constraint "^0.0.3" and asserts that
"v0.0.3" is allowed but "v0.0.4" is not (i.e. ^0.0.3 => >=0.0.3 <0.0.4); follow
the existing test table pattern used by the other cases (e.g.,
"ValidSpaceSeparatedRange", "CommaSeparatedRangedConstraint") so the behavior is
explicitly recorded.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0612cff0-100d-4d2b-ab8e-99a494e5fa5a
⛔ Files ignored due to path filters (3)
go.modis excluded by none and included by nonego.sumis excluded by!**/*.sumand included by nonepkg/version/fake/mocks.gois excluded by!**/fake/**and included by**/*.go
📒 Files selected for processing (4)
pkg/version/version.gopkg/version/version_test.gopkg/xpkg/client.gopkg/xpkg/lint.go
Signed-off-by: Nikita Z <nkzk95@gmail.com>
jbw976
left a comment
There was a problem hiding this comment.
I'm seeing failures in lint and unit tests check, e.g.:
> Running phase: checkPhase
> pkg/version/fake/mocks.go:21:2: could not import github.com/Masterminds/semver/v3 (pkg/version/version.go:21:2: cannot find module providing package github.com/Masterminds/semver/v3: import lookup disabled by -mod=vendor) (typecheck)
> "github.com/Masterminds/semver/v3"
does this maybe need a nix run #.tidy?
Signed-off-by: Nikita Z <nkzk95@gmail.com>
Signed-off-by: Nikita Z <nkzk95@gmail.com>
|
jbw976
left a comment
There was a problem hiding this comment.
sweet, everything is green now! 💪
thanks for continuing to drive this and get it to the finish line! 🙇♂️
Description of your changes
Updates semver package to v3.
This adds support for properly detecting comma/space separated version constraint ranges - added test cases for this.
The casing in semver error messages has changed, which required me to also fix the "invalid semantic version"-test.
Background: Based on feedback in crossplane/crossplane#7050, I started to look if i can reuse pkg/xpkg, and see that this update would be needed anyway.
I have:
./nix.sh flake checkto ensure this PR is ready for review.backport release-x.ylabels to auto-backport this PR.Need help with this checklist? See the cheat sheet.