-
-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detect version mismatches between shard.yml and git tags #341
Conversation
Can you illustrate the motivation for this? Is there a specific reason or just because it feels right? 😄 I had considered such a strict matching and it sure is correct that a tagged release should report the tagged version in the spec file. To put some numbers on this: The database of shardbox.org currently lists 5311 releases, 768 of them report a different version in the spec file than the git tag. That's 14%. These mismatches are hard to fix retroactively because you would have to revisit each tagged commit, append a fix commit and update the tag. And then the main repo ends up with different tags than its clones. All in all it would probably be better to not be hypercritical about this. The relevant part for resolving versions is the actual tagged commit. The version property in the spec can be understood as primarily informational to convey this information to the checked out working dir. Ideally, it should be accurate. But it doesn't affect the function of shards when it doesn't match. |
This is not true - I made sure to only error if the installed version was wrong. Shard authors would simply need to tag a single new release and have everyone upgrade. How many of that 14% are the latest release? The version should either be enforced or removed. It's clearly not actually used in the resolver. I'm fine with warning on this for a release, then making it an error next shards release. |
Currently 71 shards report a different version in the spec file of their latest release. Out of 822 total shards, that's about 9%. |
I like this, but I would try to enforce it in some other way. Maybe we can have a shards tag command. But doing it on install can be a bit disruptive. |
I think we should warn, at least, then we can discuss switching to an error later. |
Warning is good. Then authors can be notified of this mismatch. |
What's the function of the I'm not strictly saying that we should remove it... I want to understand the motivation to have it. |
@waj A version tag freezes a release, but it doesn't mean that it's always "wrong" otherwise. For example:
TBH I think the version tag came after the version field. It's merely a mean to easily find and extract the release from the Git history. |
Issuing a warning sounds fine. And for the future it would help to implement #29 and maybe even a tool that completely manages the release process. |
@ysbaddaden yes, I agree, specially with point 1. With "wrong" I mean that if I'm planning to release a version and I update the So yes, I agree with this PR but only with a warning. Outdated version in a |
Well, mismatched versions with tags does break I think it'd be better to start disallowing them at a certain point. |
@RX14 but that's a bug we could fix :) |
I guess, though I also consider that mismatched versions are accepted a "bug". |
Changed the error into a warning. |
src/molinillo_solver.cr
Outdated
@@ -71,7 +71,7 @@ module Shards | |||
raise Error.new("Error shard name (#{spec.name}) doesn't match dependency name (#{dependency.name})") | |||
end | |||
if spec.mismatched_version? | |||
raise Error.new("Error shard version (#{spec.original_version}) doesn't match tag version (#{spec.version})") | |||
Log.warn { "Shard version (#{spec.original_version}) doesn't match tag version (#{spec.version})" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This message should probably also include dependency.name
.
Two of the same obvious feedback at the same time :) My bad, the shard name is definitely required. |
Should be ready to go now? Shame this didn't make the release though. |
It is expected that there will be another release of shards before 1.0. Let's release what we have today. I'm sending the release PR soon. |
or you could press merge :) |
No without reviewing it first (which I hadn't :-) ). There are more changes to come in a next release. |
Detect version mismatches between shard.yml and git tags
No description provided.