-
Notifications
You must be signed in to change notification settings - Fork 229
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
Warn when publishing a null-safety compatible package with non-null-safe dependencies #2438
Comments
Shouldn't this be an error? |
I believe we want to support mixed-mode packages? @jonasfj ? |
Mixed-mode has to be supported for package cycles to be able to publish. The vast majority of package cycles are introduced due to Allowing publishing of mixed mode packages in general is very problematic. We want to discourage it as much as possible without completely blocking any valid use cases that require it. |
I would like to propose that we add a new class of "warning" to pub, which is one that requires an explicit flag in order to bypass it. This decreases the chance that people publish these packages by ensuring they actually read the warning message (in order to know what flag to pass to bypass it). We should include with this warning some text along the lines of:
|
I'd extend that warning to include something about how if you didn't run your tests in sound null safety mode you are increasing the risk of shipping bugs. |
While it's likely that a dependency migrating will break you, it's not necessary a given, is it?
This is certainly an interesting idea, but I think it's an orthogonal concern. Filed #2535 |
If you publish a migrated package with unmigrated dependencies there are a few bad things that might happen:
|
I would argue that it is extremely likely you will be broken. There are any number of potential ways in which this can happen.
This is why all NNBD releases really need to be breaking change releases. |
I think there is an or missing here: or we put enough guardrails in place that we feel confident that either everybody migrates in order (i.e. soundly) or they migrate unsoundly knowing they are likely to get broken. |
It's not only the authors who will be broken. They can break anyone downstream of them. I also think it's likely that authors will accidentally ship breaking changes. The breaking version bump is safer for non-migrated downstream dependencies too. |
@jonasfj is this done? |
Yes! |
When a package is published we should warn if:
Note. The second condition can be simplified into: if the package has dependency on a non-null-safety complaint package. Tracing import-paths might be preferred, because it creates fewer false positive warnings -- but it might also be too complicated.
We need to make this warning because it is highly likely that when the dependency is published in a non-null-safety compliant version the interface will be broken (whether intentionally or not).
The text was updated successfully, but these errors were encountered: