Skip to content
This repository has been archived by the owner on Apr 18, 2018. It is now read-only.

doc: API stability policy #50

Merged
merged 2 commits into from
Apr 10, 2015
Merged

doc: API stability policy #50

merged 2 commits into from
Apr 10, 2015

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented Apr 10, 2015

re: #37

Expanded language around the API stability policy

re: #37

Expanded language around
@jasnell
Copy link
Member Author

jasnell commented Apr 10, 2015

@arb
Copy link

arb commented Apr 10, 2015

While it isn't what I want the policy to be, it is much clearer than it was which is good.

APIs and default behaviors in the Node.js Core Library, Application Binary Interface, Dependencies and binary abstractions must not change within LTS Releases unless the change is required to address a critical security update.
The Node.js Core Library API, Application Binary Interface and Binary Abstraction layer each expose methods, events, behaviors and default values that together comprise the implicit Node.js "Public API". This "Public API" is used by application and module developers and changes will have direct impact on the Community.

Methods exposed by the API can have either strongly or weakly types input parameters and return values. Methods may also throw any number of exceptions or trigger certain sequences of events or side effects. When such types, exceptions, events or side-effects are *documented*, they become part of the Node.js *Explicit API*.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weakly types input parameters

typed

@jasnell
Copy link
Member Author

jasnell commented Apr 10, 2015

@arb nothing is set in stone. how would you change it?

fixing typos and refining the implicit api exceptions.
@jasnell
Copy link
Member Author

jasnell commented Apr 10, 2015

@Fishrock123 better after the new commit?

@arb
Copy link

arb commented Apr 10, 2015

I agree with @cjihrig - if you are using a public API method in an undocumented or unexpected way, that's on you when it breaks. There shouldn't be a major bump when you add validation or change the function so it no longer works the undocumented way. There is a lot of code that lingers around because people started using something wrong and now it's in there for good...

Seems like that is not the prevailing opinion though.

@Fishrock123
Copy link
Member

Yeah that's better.

@jasnell
Copy link
Member Author

jasnell commented Apr 10, 2015

@arb... I tend to agree with both points of view which is why this attempts to add some wiggle room for exceptional cases.

@mikeal
Copy link

mikeal commented Apr 10, 2015

if you are using a public API method in an undocumented or unexpected way, that's on you when it breaks

It's easy to say things like this but the reality is that if enough people are using/depending on an API, documented or not, we can't break it. If a change breaks a significant portion of the ecosystem it won't make it in, there's no moral or technical high ground we can find that justifies breaking the ecosystem. This is why @chrisdickinson has been trying to find ways of creating truly "internal only" modules so that we don't continue to put ourselves in a position where we have to support what was meant to be a private internal API.

@Fishrock123
Copy link
Member

(Speaking of which, io.js now has support for internal modules.)

@jasnell
Copy link
Member Author

jasnell commented Apr 10, 2015

Merging this change. Keep in mind that this can be iterated on further.

jasnell added a commit that referenced this pull request Apr 10, 2015
@jasnell jasnell merged commit a6bf588 into master Apr 10, 2015

Backwards incompatible changes to *Explicit* APIs that have previously been included in a Release *must* follow a clear and predictable deprecation process in which the existing documented API: (a) is clearly marked for deprecation and (b) can change only after the next *semver-major* version increase.

Backwards incompatible changes to *Implicit* APIs that have been included in a Release *should* be handled the same as *Explicit* API changes. However, exception to this rule can be allowed if: (a) the proposed change can be reliably demonstrated to have minimal impact *in practice*, (b) the proposed change is intended to reconcile *implemented* behavior with *documented* behavior (i.e. the documentation says one thing but the code does another and either the code or documentation need to be updated), (c) it is clear that the Implicit API being modified had originally been intended for internal use as part of the underlying implementation as opposed to being targeted at developers, or (d) it can be demonstrated that the Implicit API never worked correctly to begin with.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nits, belatedly:

(b) the proposed change is intended to reconcile implemented behavior with documented behavior (i.e. the documentation says one thing but the code does another and either the code or documentation need to be updated)

Documentation is a derivation of code, not the other way around. Changing code to match docs – especially if the change causes breakage – should follow the same process as explicit API changes. IOW: Changing docs to match behavior stands to break nobodies code, changing code to match docs can break code – which should be avoided without a deprecation cycle.

(c) it is clear that the Implicit API being modified had originally been intended for internal use as part of the underlying implementation as opposed to being targeted at developers

I'm thinking here of things like _readableState, or _events within EventEmitter – those things, while private implementation details, are so widely used throughout the ecosystem that any change to those should probably be preceded by a lengthy deprecation cycle (or polyfilling those features back in.)

@chrisdickinson
Copy link

LGTM, with a few nits.

@arb: the end result is the same – if you're using implicit APIs, you may eventually have to change your code. Core has to move more slowly in order to get to that point, though, because so much (otherwise well-intentioned) code relies on those implicit APIs, and those dependencies can be incredibly distant from any given user's control. Deprecation cycles give the community the chance to identify problem modules in their dep trees and put pressure on those modules to update, or to create an alternative to that module.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants