[GH-ISSUE #874] increment the MAJOR version when you make incompatible ... changes #5681

Closed
opened 2026-06-15 12:11:49 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @bitbonk on GitHub (Sep 15, 2022).
Original GitHub issue: https://github.com/semver/semver/issues/874

The spec says right at the beginning

increment the MAJOR version when you make incompatible API changes

but what about incompatible changes that does change the API surface, e.g. when you only make incompatible behavioral changes?

Originally created by @bitbonk on GitHub (Sep 15, 2022). Original GitHub issue: https://github.com/semver/semver/issues/874 The [spec](https://semver.org/) says right at the beginning > increment the MAJOR version when you make incompatible API changes but what about incompatible changes that does change the API surface, e.g. when you only make incompatible behavioral changes?
Author
Owner

@ljharb commented on GitHub (Sep 15, 2022):

the API includes all of the behavior, not just the interface.

<!-- gh-comment-id:1247614295 --> @ljharb commented on GitHub (Sep 15, 2022): the API includes all of the behavior, not just the interface.
Author
Owner

@bitbonk commented on GitHub (Sep 15, 2022):

Shouldn't the spec be more clear about this? I am pretty sure that most people associate the interface when they read "API" (application interface).

<!-- gh-comment-id:1247618966 --> @bitbonk commented on GitHub (Sep 15, 2022): Shouldn't the spec be more clear about this? I am pretty sure that most people associate the interface when they read "API" (application _interface_).
Author
Owner

@ljharb commented on GitHub (Sep 15, 2022):

Yes, it probably should. The problem is that most people think "interface" in programming means "your function signatures and types", it actually means "any way you interact with it", which encompasses all observable behaviors and properties.

<!-- gh-comment-id:1247624475 --> @ljharb commented on GitHub (Sep 15, 2022): Yes, it probably should. The problem is that most people think "interface" in programming means "your function signatures and types", it actually means "any way you interact with it", which encompasses all observable behaviors and properties.
Author
Owner

@jwdonahue commented on GitHub (Sep 16, 2022):

The correct answer is it depends on what you are versioning. If you are versioning the interface, then any implementation details are not your concern. If you are versioning both the interface AND implementation, as-in, you're probably versioning a package, then major version bump if you make a breaking change to either the interface or the implementation. In fact, some package format changes, unrelated to your code, can be considered to be breaking changes if they break somebody's build system.

This does not apply to bugs that are mistakenly taken to be intended behavior. If your documentation says f() turns the lights on, but you have a bug that causes flickering, or the wrong color of light is emitted, per your docs, you can fix that with a patch level bump and ignore anyone who screams that they were dependent on that errant behavior. In other words, "all observable behaviors and properties" are not necessarily part of the interface, unless you make that claim in your documentation.

The spec literally states that you define what "API" means in the context of your code.

<!-- gh-comment-id:1248912189 --> @jwdonahue commented on GitHub (Sep 16, 2022): The correct answer is it depends on what you are versioning. If you are versioning the interface, then any implementation details are not your concern. If you are versioning both the interface AND implementation, as-in, you're probably versioning a package, then major version bump if you make a breaking change to either the interface or the implementation. In fact, some package format changes, unrelated to your code, can be considered to be breaking changes if they break somebody's build system. This does not apply to bugs that are mistakenly taken to be intended behavior. If your documentation says f() turns the lights on, but you have a bug that causes flickering, or the wrong color of light is emitted, per your docs, you can fix that with a patch level bump and ignore anyone who screams that they were dependent on that errant behavior. In other words, "all observable behaviors and properties" are not necessarily part of the interface, unless you make that claim in your documentation. The spec literally states that you define what "API" means in the context of your code.
Author
Owner

@bitbonk commented on GitHub (Sep 16, 2022):

That makes perfect sense, thank you!

<!-- gh-comment-id:1249486778 --> @bitbonk commented on GitHub (Sep 16, 2022): That makes perfect sense, thank you!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/semver#5681