Skip to content
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

Need breaking change policy #57812

Open
srawlins opened this issue Oct 24, 2018 · 5 comments
Open

Need breaking change policy #57812

srawlins opened this issue Oct 24, 2018 · 5 comments
Labels
analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug

Comments

@srawlins
Copy link
Member

Maybe this needs to be filed and discussed in https://github.com/dart-lang/sdk instead of here. But I'll start here.

Two issues have brought up the idea of breaking changes recently:

Removing a rule is a breaking change in that it causes people's analysis_options.yaml files to now parse with an error. Changing an existing rule to complain about more things causes is breaking in that it causes currently-clean codebases to no longer be lint-free.

Adding a new rule is not a breaking change since all lint rules are opt-in.

There is a concern that releasing a version of linter with breaking changes will get rolled into the SDK, into the analyzer, which will change the behavior of dartanalyzer and the analysis server for existing code.

I say (as a volunteer on the linter and analyzer projects 😛) that such a change should not be considered a breaking change in the SDK, and should not require a major version bump by the SDK.

Why?

First, a historical reason: the analyzer has always released a steady stream of new analyzer codes, which are on by default. Releases between Dart 1.0 and 2.0 consistently featured new analyzer codes, and this was a beautiful, beautiful thing. 😄 Until recently (like, since Dart 1.24 or so), many pub packages did not use presubmit hooks that ensured code was Error-, Warning-, and Hint-free, so this was not a super visible change, in terms of "breakiness." It was a super visible change in user's IDEs, much to all of our delight.

Ergo, releasing breaking-change linter releases into the SDK's analyzer is not a change in behavior. But more importantly, this leads us into the second reason:

Second, a technical reason: breaking changes hurt developers and users only in specific cases, not universally. When a breaking change causes package foo to break (e.g. by making it un-compilable, or to crash at runtime), it can hurt both foo's developers, and foo's users. This hurts the developer of the package, which, assuming they're still around and aware of the breakage, must commit new changes, perhaps solve unspecified problems, or write non-trivial fixes. It super duper hurts users of the package, who are stuck with a broken dependency until foo*'s developers release a fix.

However, breaking changes in the linter hurt no one in such a way:

  • Deleting a lint rule does not cause foo to stop compiling or running, when downstream code depends on foo. Deleting a lint rule can cause foo's authors angst as they upgrade the Dart SDK, and can no longer run dartanalyzer (and perhaps analysis server?) because of the parse error in analysis_options.yaml. The fix however is straightforward and trivial (delete the rule from analysis_options.yaml).
  • Improving a lint rule to report more issues in foo also does not cause it to stop compiling or running when downstream code depends on foo. It can cause foo's authors angst as they upgrade the Dart SDK, and their dartanalyzer results show new results. Again, deleting the rule from analysis_options.yaml will fix the issue. Additionally, many lint issues are not hard to fix individually, though that's not universally true.

In either case, downstream users are not affected by a breaking change in linter, and developers of an affected package have very trivial fixes. Developers of an affected package are not hindered in their workflow.

The alternative

In my view, the alternative is much worse. The alternative to me seems to be this: a breaking change in the linter (changing a rule to report more, or deleting a rule) are considered breaking changes in the SDK, and can only be landed once every few years, when the Dart SDK is bumped. This includes bug fixes, such as dart-lang/linter#1218, which extends a rule to apply to arrow functions (in addition to the original block function functionality).

@srawlins
Copy link
Member Author

CC @a14n @bwilkerson @pq

@bwilkerson
Copy link
Member

... and can no longer run dartanalyzer (and perhaps analysis server?) because of the parse error in analysis_options.yaml.

Actually, both the command-line analyzer and analysis server simply ignore rules that are specified but don't exist, and will run all of the valid rules. User's won't be broken in this sense either.

@srawlins
Copy link
Member Author

Actually, both the command-line analyzer and analysis server simply ignore rules that are specified but don't exist, and will run all of the valid rules. User's won't be broken in this sense either.

Even better! 👍 👍 👍

@pq
Copy link
Member

pq commented Feb 21, 2019

More food for thought from @bwilkerson (copied from mail):

Is it ok to extend an existing lint to catch related cases, especially when the language grows, as in the case that sparked this thread?
Is it ok to fix a bug in a lint if it produces violations that used to be missed?
Is it ok to split an existing lint into multiple lints (as we recently did with the deprecation hints)?
Is it ok to merge two lints that don't need to be separate?

How do we help users migrate when breaking changes need to be made?

(The issue referenced is captured in #57909.)

@pq
Copy link
Member

pq commented Feb 21, 2019

As a point of reference, Flutter's breaking changes doc might serve as inspiration for a process once we've established what qualifies as breaking.

@pq pq added the type-enhancement A request for a change that isn't a bug label Dec 23, 2020
@srawlins srawlins added the P2 A bug or feature request we're likely to work on label Sep 22, 2022
@devoncarew devoncarew added analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. labels Nov 18, 2024
@devoncarew devoncarew transferred this issue from dart-lang/linter Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants