coproc
coproc

Reputation: 6257

semantic versioning, bug-fix-releases of previous versions and precedence in tree structure

We use semantic versioning. Suppose we have some software release with a version number of e.g. 2.1.1. Because of an API change the next release has version number 3.0.0. Now let us suppose that a bug is found which occurs both in version 2.1.1 and version 3.0.0. Since some customers still use 2.1.1 and we do not want to force them to upgrade to a version 3.0.1 or later we provide a maintainance (bug fix) release for version 2.1.1. A straight forward version number for this release could be 2.1.2. Though no such example is given in the defintion of precedence I would conclude that the rules imply 2.1.2 < 3.0.0 - meaning what? Version 2.1.2 was released after 3.0.0 and version 3.0.0 does not include all bug fixes of 2.1.2. Actually these two versions are not really orderable, the versions (and the corresponding source revisions) now have a tree structure:

  |
2.1.1        (1)
  |\
  | \
  | 2.1.2    (3)
  |
3.0.0        (2)
  |

To reflect that tree structure and avoid confusion I would prefer a version number scheme like the following:

  |
2.1.1        (1)
  |\
  | \
  | 2.1.1+m  (3)
  |
3.0.0        (2)
  |

(+m for maintainance release). According to the definition of precedence in semantic versioning this would still imply 2.1.1+m < 3.0.0, but for our customers we could add a rule that for x1.y1.z1 < x2.y2.z2 any version x1.y1.z1+m* is not comparable to x2.y2.z2 (but x1.y1.z1 < x2.y2.z2+m* still holds).

Are there any best practices for versioning a tree structure? Or did I get something wrong about semantic versioning?

Upvotes: 1

Views: 1086

Answers (1)

Burt_Harris
Burt_Harris

Reputation: 6874

No, you should not assume any release date ordering from semver precedence relations such as 2.1.2 < 3.0.0. All you can determine is that there probably have been be breaking changes between them.

If you want build date information, that would be reasonable to include in the build metadata, but that metadata has absolutely nothing to do with the semver concept of precedence. However a human might reasonably conclude that version 2.1.2+201706010005 was probably built after 3.0.0+201603151112.

Upvotes: 1

Related Questions