Your package has a bug. Its API in some scenarios doesn’t follow the documentation and the intended behaviour. It has been that way since it was v1.0.0. You fix it to match the documentation. Should the next release be:
- Major / 2. Minor / 3. Patch?
Your package has a bug. Its API in some scenarios doesn’t follow the documentation and the intended behaviour. It has been that way since it was v1.0.0. You fix it to match the documentation. Should the next release be:
The absolute first thing you should do is ensure your tests are improved, so that at least one fails with the current code and passes when it is corrected to how it should have worked.
Next, if possible, canvas your users. Sometimes that's easy, eg if it's a paid-for licence, you potentially have contact details for every customer. If it's an OOS library though, you might have no idea who uses it. But if you can warn them, do so and act on their feedback as to whether it'll break their code or not.
If you can't canvas the users, you'll need to estimate the likelihood of it breaking someone's code. How obscure a bug is it? Just saying "it's been there since v1" doesn't give much of a clue to this. How many years ago did v1 get released? How many 10s, 100s, 100,000s of users do you have? If the discrepancy is disadvantageous to the user, then the likelihood of you breaking things is inversely proportional to no. of users * time. If though, the code functions in a way that is advantageous, then it'll be proportional (and I'd argue you should fix the docs in that case, not the code).
If it's very likely to break code in a big way, for many users, make it a major release. If it's really unlikely to break code, make it a patch. But also, take into account the likely reaction to this fix. Have hundreds of folk complained about it? If so, tend toward a major release just to promote the fact that it's now fixed. If no one has reported it, again lean toward a patch.
In conclusion you need to weigh up a bunch of factors specific to your situation and choose one. And remember, no matter which one you pick, someone will complain; that's just human nature :)
In the case you describe, there is a mismatch between the public API that is documented and its actual behaviour. As presented, to me bumping the patch version looks like the way to go.
But it is not necessarily that clear-cut.
There are a couple of questions in the SemVer FAQ that discuss the matter :
In short, context is key. What is the clearest way to put your point across to the public API consumers? How much of an impact would the fix be to them?
To reiterate, in my opinion bumping patch should be enough. That and properly documenting the bug. The use of SemVer does not mean public API consumers can safely upgrade from one version to another just by looking at the version number ; SemVer is about compatibility and upgrade effort, not safety. So they should check the documentation, including changelogs and known issues (that can be detected between the moment the version is release and they choose to upgrade) before doing the upgrade, and test to make sure the upgrade does not break their application before committing to it.
But ultimately, do what is less likely to alienate your public API consumers, which you know better than I do.
make
realized after a couple of weeks …
– Jörg W Mittag
Mar 21 '18 at 10:04
semver only has three rules. and really it boils down to one.
Otherwise, you can argue about whether you are adding a feature or not and use minor or patch as you choose.
If you break the first rule, you break everyone who uses your library's dependency chains.
You force them to specific exact versions rather than 1.x
People will stop using your software.