-
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
Handling package retraction #4033
Comments
I agree pub outdated could show something. We do that for discontinued. That is probably an oversight.
We don't delete the version from the cache. You are still free to use it if it is in the pubspec.lock. |
So what about going back to a non-retracted version? I can agree it's pretty rare (though this is just an anecdote, some metrics on this would be interesting), but would it be worth adding a way to go back easily? Using |
|
Another way would be to add a "pinning" constraint in pubspec.yaml (so a dependency on a specific version), that can be done with I think this case is rare enough, that we don't need commands for it. Manually editing the pubspec.lock is not that hard IMO. |
I don't recall |
By "latest" I mean newest. In most cases there will be a newer version than the retracted one available. Only if no such version exists |
So you're saying, if the package author hasn't published a version after the retracted one, then |
I just confirmed this. I thought upgrade would always steer away from retracted versions if possible, but it actually allows the current version to be retracted. This makes sense for @szakarias is this what we want? The following test confirms this: import 'package:test/test.dart';
import '../descriptor.dart' as d;
import '../test_pub.dart';
void main() {
test(
'Upgrade will downgrade if current version is retracted, and no newer versions exists',
() async {
final server = await servePackages();
server.serve('foo', '1.0.0');
server.serve('foo', '1.5.0');
await d.appDir(dependencies: {'foo': '^1.0.0'}).create();
await pubGet(args: ['foo'], output: contains('+ foo 1.5.0'));
server.retractPackageVersion('foo', '1.5.0');
await pubUpgrade(output: contains('< foo 1.0.0'));
});
} Fails with
|
In the documentation https://dart.dev/tools/pub/publishing#retract we strongly encourage to publish a new version before retracting so I would think that in most cases there is a new version. In this (hopefully rare) case, we could consider downgrading if possible. |
Question is how hard it would be to implement. If I remember correctly we currently leave retracted versions out if the solve entirely unless:
If we want to implement the potential downgrade (downgrade unless no older versions exist) we would have to change the prioritization of retracted packages, and that would be a heuristic at most (not guaranteeing that we get the lower version)... |
It's not just a matter of implementation. There are many corner cases to consider when there is no newer version available. I am not sure we want this downgrade, because it cannot solve all these cases. I might be better to consider ways to advise users how to migrate away from retracted versions. |
We've decided that we don't want to do downgrading at this point. We will be adding some documentation on which flows you can use to migrate away from retracted versions when no newer version exists. Basically you can either do The documentation is tracked here dart-lang/site-www#5315 |
Well, I still think that retracted versions should be pointed out by the pub tool. Perhaps it can also link to the new documentation in the case that you're on a retracted version of a package too. |
I agree, it should also be pointed out in |
Btw. this is related to an earlier issue: #3887 |
) Partly fixes dart-lang/pub#4033 --------- Co-authored-by: Marya <111139605+MaryaBelanger@users.noreply.github.com> Co-authored-by: Parker Lougheed <parlough@gmail.com>
…rt-lang#5361) Partly fixes dart-lang/pub#4033 --------- Co-authored-by: Marya <111139605+MaryaBelanger@users.noreply.github.com> Co-authored-by: Parker Lougheed <parlough@gmail.com>
When a package gets retracted, there is little tooling to get back to a supported version, which is semi-fair considering how rare it is. However, when it does happen, it's annoying. I'm proposing a couple of things.
pub outdated
pub downgrade
then runningpub upgrade
againOther questions
How does
pub cache
handle reverts? Would I have to delete the folder in the cache for the reverted version if the author were to re-use the same version?The text was updated successfully, but these errors were encountered: