-
Notifications
You must be signed in to change notification settings - Fork 686
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
Resetting of pre-release and build versions... #60
Comments
I'm not sure I agree. You might have multiple versions of a pre-release. |
@Tieske yep. So I think we're agreeing there's nothing to do here, right? |
Hold on, guys! :) Did I get You right? The normal version should not (is not supposed to) be incremented while it's at the development level, i.e. has some sort of pre-release or build version. Even if I'm partially/completely wrong shouldn't it (the right thing) be somehow mentioned in the Specification to avoid the ambiguity? |
Suppose we have 1.0.0 So when working on a next release, you define a prerelease tag, attached to the intended version. But only the final release version (2.0.0 in the example) really tells you what to expect. See the other issues I referenced above. Hence also my remark that pre-releases should be left out in any compatibility comparison. You may assume that there will be no major changes between RC1 and RC2, but the spec is not about assumptions, it is supposed to be a guarantee. |
@zafarkhaja forgive me for my lack of reading comprehension, but could you provide a concrete example (make up a version number scenario) of a transition that you'd expect should not be allowed that the spec allows. It's hard to speak of abstractions. A clear example like @Tieske provides is very helpful. @Tieske so if I understand you correctly, in your scenario you might have the following version sequence.
And that should be fine. We shouldn't have to reset the prerelease part. In fact, what does it even mean to reset that part, right? A prerelease string can be any alphanumeric string. |
indeed nothing.
This gets awkward, so one should never assume any compatibility on any pre-release version. Compatibility is the sole property of major/minor/patch versions according to semver, pre-release and build numbers do not add anything to that equasion. Build numbers are harmless in determining compatibility, so you can ignore them when present. Pre-release versions might contain unexpected changes (hence pre-release), so if a pre-release tag is present, don't even start to determine compatibility with other API versions.
|
@haacked I wasn't suggesting that there's something in the Specification that I thought shouldn't be allowed. Instead, I suggested that there is something that is not in the Specification and therefore should be specified. @Tieske I wasn't talking about comparisons either, at least not in this issue. What I was talking about is the behavior of all versions when one of the normal version numbers is incremented. Well, it's not really "resetting" as I have called it in the title, but I think I made it clear in the description, or not... Let me show what I mean in terms of Your example.
Here's what I propose. It should be specified in the Specification that while minor and patch versions get reset when the normal version is bumped, the pre-release and build (?) versions are incremented. I believe that the Specification should be as specific as possible because otherwise it would be hard to create a reference implementation due to ambiguities. @Tieske as to the references You provided, I must say that I absolutely agree with You and wonder why hasn't it been pulled yet? PS. Should I change the title of the issue? |
I would like to renew the discussion. What does everybody think about this? Should it be specified in the Specification what to do with pre-release and build versions when normal version is incremented? |
bump Any progress on this? |
If we look at the wording of I believe the Specification should do three things:
So, given the aforementioned scenario:
My suggested changes would yield:
Let's extend the example to see how this convention works when we include build numbers.
This shows that the next major version was considered but ultimately pushed back. Also:
This shows exactly why there is no And then we have:
This shows that the next major version was quickly shown to be too ambitious for the time being and that more moderate changes were made instead. And finally:
The Hopefully this illustrates the point that with this convention we preserve the line of succession so to speak for the major, minor, and patch numbers while allowing for breaking changes to be communicated in the version number during development. I hope this helps ! |
IMO to complex. pre-release and buildnumbers are only included as metadata. This introduces another metadata element. Finalize these discussions as per #30. Just stop making assumptions and stop comparing for compatibility once a pre-release tag has been added. |
True, it adds complexity. IMO it also seems to handle all cases while staying communicative. At the very least If we stop making assumptions about future normal versioning while working on releases then how would you determine the pre-release versions of the successor to A couple possible scenarios that can come up when using #30 (or more precisely #28) are the following: The first scenario:
The implied question here is "Where is But what about this confusing scenario:
I suppose a potential workaround would be to append build numbers to everything to disambiguate things like |
Since it is a pre-release, you have no guarantees that it's compatible. But it does communicate the intent that it should be, which is the point of SemVer. Communication of intent over any guarantees. As XKCD so eloquently pointed out, there are never any guarantees of backwards compat. I just don't see the need to introduce time as another dimension to SemVer. Let's look at the example that @Tieske addresses.
In @Tieske's example, For example, you could release:
This is common and there's nothing wrong with it. It doesn't matter that 1.0.1-beta came before or after 2.0.0. The only important part is that it communicates it's an intended minor update to 1.0.0 (though it might have breaking changes by virtue of being a beta). Now there is a slight "problem" here in that when you are ready to work on But this is really a problem of branching development. Suppose you started a branch for Am I making sense? Am I missing something? I'm trying hard to understand what changes are needed and I'm just not seeing anything yet. |
Maybe my question was different because its not as complicated. My question was if the act of bumping ( and of the version segments ) implies the pre-release tag should be dropped? If I have version
and bump the minor version Should users expect Bumping without first dropping the pre-release tag seems like a user error for me but I wanted to know if this spec defines rules for this situation explicitly. |
Honestly, I don't think the previous version has any effect on the answer. In the example you gave I don't think it matters what you do here because according to SemVer, all versions less than But suppose we're talking about release versions. You released a package with the version If it is a released version, it clearly should be |
That's not the way I interpret "A pre-release version MAY be denoted by appending a dash and a series of dot separated identifiers immediately following the patch version."
|
"Version 1.0.0 defines the public API. The way in which the version number is incremented after this release is dependent on this public API and how it changes" just for context. |
@softprops it's in rule 5
In my mind, that's pre-release. It's certainly not release. :) |
In any case, setting aside semantics, the clause "Anything may change at any time" leads me to believe it doesn't matter if you put the pre-release flag or not on anything below 1.0.0. Which I believe answers your question. |
@haacked I think you are conflating pre-release, meaning a release made before something is final for a given version, and the semantics of the major segment of the version string. If I depend on a have a library that depends on code for version 0.5.0 of a library, I can be safe from any changes made in future versions because that version won't change once published. If I depend on 0.5.0-SNAPSHOT on the other hand, it tells me that the library author may make changes before releasing 0.5.0. Those changes can potentially break my code by the release of 0.5.0. Its a pre-release and is subject to change by release time. This is fundamentally why you shouldn't depend on a pre-release version. My question stays the same even if my example is |
@softprops I don't believe that is correct according to rule number 5. Let me highlight the relevant portion.
This is referring to any release Do you have a different interpretation of rule 5 than I do? |
@softprops I believe this is a special rule for versions 0.*. In all other cases 1.0 and above, I believe you are correct in the interpretation of what changing the major version means. 😄 |
@haacked my experience is with dependency management systems that resolve based on unchanging version numbers. Some dependency managers use dynamic versions that are not specified with ~ or *'s in their dependency configuration. If I depend on version the version number 0.5.0 it doesn't matter if there are changes in 0.6.0. My projects dependency resolver will only pull in 0.5.0. I was curious about what semver's stance was on dynamic versioning and it looks like it was already brought up. It was closed because it was considered out of scope. Since it's out of scope, changes made in version 0.6.0 will have no effect on a project that depends on version 0.5.0. |
@softprops sure, but that same principle applies to any version. Consider rule 4.
So if you depend on As I understand it, SemVer treats each version as immutable once released. Perhaps this has been the source of our confusion in this discussion. |
It may be an artifact for the manager I use, ivy. version-SNAPSHOT is considered a version whose hosted contents may change. If I resolve the dependency today its contents may be different than if I resolve the same version tomorrow. I'm happy that semver considers all versions immutable! Any prerelease tag to me indicates that the release is not quite there yet so it's almost never worth depending on in your release. It's only there to test your current version against a "bleeding edge" version of a dependency. I think all of this is getting away from my original question. Let me rephrase to try and avoid more confusion. Should the act of bumping a version segment (x.y.z) on a non-normal version produce a new normal version without the prerelease tag? This is the simplified version of the original post for this issue
|
Ok, that clears things up. SemVer doesn't address "snapshot" style versions (effectively mutable). But back to your question. When you say "bumping a version segment" I read that as "releasing a new package with an incremented version segment". In that case, I think the answer is, "only if this new version is a release package and is not a pre-release package". Think of it this way. Suppose SemVer did state you must reset the pre-release version when incrementing a version. How could that make sense? Suppose you release |
It may make sense if the prerelease tag is specific to the normal version it's preceded by.
But I haven't put out an rc1 for 1.0.1 yet! The user would have to reset the prerelease tag manually. I agree it is onerous to require you to reappend a new prerelease for the new normal version but I can see not doing so will produce non-sensible versions like the one mentioned above. I'm also including additions to the prerelease tag like the build version in this reset discussion. That's an even stranger case if I don't drop the whole prerelease tag side of the version.
I now have a new version with starting at the second release candiate with 123 builds! I should also add some context here. When I say user I mean the library author while developing. I'm writing a library managing structured version this in scala projects. I want the behavior of bumping to be expected but the spec doesn't mention this what the expected behavior should be. That's what I'm trying to get to the bottom of. |
Ah, I see. Yeah, I think the spec is intentionally silent on this point. When you think about the But it's not so clear when you talk about the prerelease tag given the tag can be anything at all. From a SemVer perspective, the contents of the prerelease tag are effectively opaque and only used to determine 2 things, whether it's pre-release or not and version precedence. Going back to your example, yeah, that intuitively doesn't make sense.
But this might make sense. Maybe you've decided that the next version should really be a beta of
Or maybe your prerelease tags look like
I don't think the spec needs to (nor can) specify what to do here. Perhaps the FAQ can add a bit of guidance, but I just don't foresee this as a big problem. Use your best judgment here is what I say. :) |
It took me a long time to read all the relevant discussions and come back to this one. After all I finally am starting to realize that I might have considered the Specification too "specifically". The problem I have with it is very similar to that of @softprops and more of an implementation than a specification. I am also developing a library which is supposed to be an implementation of SemVer in Java. The following code snippet illustrates the problem I encountered: Version v1 = Version.valueOf("1.2.3-alpha+build");
Version v2 = v1.incrementMajorVersion();
String normal = v2.getNormalVersion(); // "2.0.0"
String preRelease = v2.getPreReleaseVersion(); // "" OR "alpha" OR "alpha1" OR "alpha2" ?
String build = v2.getBuildVersion(); // "" OR "build" OR "build1" OR "build2" ? I am aware of the discussions which eventually led to the PR #77 after merging of which the build version will become just a piece of metadata and will be left out of all sorts of comparisons. But the problem still remains for the build metadata if it was present in the version prior to incrementing. So the main problem here is that the Specification is not specific enough in this regard to handle the issue programmatically, and I think I understand why. There is no exact rules to follow, hence it seems like every such implementation would have to decide what to do in such cases on its own. @haacked, it would be great if some common practices regarding such cases were described in the FAQ section to help the implementations. |
@zafarkhaja +1 @haacked I agree with your points after rereading taking a different perspective than the one I have writing tooling based on the the spec. The rub for me now is that since the spec doesn't address it and implementors and tool developers writing tools based on the spec and having to arbitrarily decide whether to perform or not perform behavior in a scenario applicable to any client usage leads to inconsistent tooling. The point of having a specification is so that changing tools shouldn't have a big impact on the expected behavior for end users. It would be great if we could some how agree at least one what the expected behavior for semver tooling should be for this scenario. Regardless of the contents of the numeric version segments, I believe that the prelrease tag is indeed opaque with regards to the semver spec but it What's uncomfortable for me though is that this is just what I think. It's subjective in that regard. I was hoping to get some consensus in this gh issue because of the issues title. If the spec can't address the expected behavior then can we document it elsewhere? |
@zafarkhaja ah, I see. I think it's hard to really say anything about what I'm going to speculate here and suggest the reason you call
I don't think we have to all agree on what that label must be. |
@haacked I think we are both right tools that provide a user interface for bumping essentially. The question is if you make the second call
without the prerelease tag and |
I think that's really up to your implementation. SemVer is mostly concerned about the output of your program. Is the version SemVer compliant or not. Either implementation will produce a SemVer compliant package. The real question is will both implementations meet user expectations? In practice, I don't think you'd ever ship a One way to address this is to omit the parameter less overload. That way incrementing a major version requires an explicit choice to either make it prerelease or not by passing in a prerelease string or passing in null. |
I think semver outlines more than just compliance. It outlines expectations for the result of actions ( bumping ). Unfortunately it just outlines expectations for the LHS of the dash as a result of bump and not the RHS of the dash. Otherwise the number of replies in this gh issue we be fewer in number :) Regardless. Your last statement is what I've been looking for. Thanks! The act of bumping should explicitly specify a prelease tag or the previous prerelease tag will be dropped. It would be great to get that into a footnote of the spec so implementors are not left guess what the expected behavior should be. I think I'm good now. |
@haacked, you were right in your speculation about the intended use of the incrementor methods. Indeed, they could be used as a version bumping utility, which could bump the version in compliance with the SemVer Specification. And, by the way, good idea about the overloading thing. I myself was about to ask if anyone had an idea how to solve the dilemma and you provided one. Thank you very much :) @softprops, I agree with you on that it is somewhat inconvenient and inconsistent of the Specification not to specify about the pre-release version while specifying about the normal version. But honestly, at the moment I can't see how this could be achieved. |
Hmm, maybe I'll add a FAQ question if this comes up a lot. Or see if one of the existing examples could incorporate this scenario. I don't think this comes up too often because usually people don't increment the major version until they ship the previous version. In which case you go from
But none of these are requirements. Which is why I don't see there's much to add to the spec. :) Glad I helped clarify things. I'll think about how the spec could be more clear about this as well. |
I think we exhausted the issue and now if nobody has anything else to say on the subject it can be closed. In case somebody interested in how I solved the dilemma, I solved it by providing overloaded methods which take pre-release version as an argument (thank @haacked). Build metadata is always dropped, if present. Examples can be found at the project's README page (https://github.com/zafarkhaja/java-semver/blob/master/README.md). By the way, I've also implemented incrementors for pre-release version and build metadata as follows
|
Thanks for following up! |
According to the Specification, patch version must be reset to 0 when minor version is incremented and both patch and minor versions must be reset to 0 when major version is incremented. However, it doesn't specify the behavior of pre-release and build versions when the associated normal version is incremented. Supposedly, they shouldn't remain the same, and, if so, it should be explicitly stated in the Specification.
The text was updated successfully, but these errors were encountered: