-
Notifications
You must be signed in to change notification settings - Fork 697
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
Flag to force the use of the latest allowed package #8387
Comments
Note, using the latest version for every dependency won't work without extra heuristics, e.g. it's also a case that some latest versions cannot be picked, e.g. latest |
Yes, it is just a heuristic and won’t apply in all cases, unfortunately. I thought of a syntax for constraint, but With But would I have to list that flag manually for all dependencies of (I don’t have great answers yet) |
Right. In my packages I would probably use this flag only when testing against the latest version of GHC, so maybe in most cases that’s fine? |
It's not, e.g. there is |
Largest in the used package indices (i.e. Hackage in most cases). That's what people care about, that the latest/largest package version from Hackage can be used. |
Hmm, that's not quite what I want to achieve here. Maybe there are good reasons to explicitly exclude an existing new version of some dependency (why else would we even have upper bounds else). But it's always wrong™ to include a new major version of a dependency when it was never part of a successful build, is it? So that's the question: can we automatically check that all upper bounds as specified by the package are actually realizable and indeed compile and work? Testing that is a property that, once green, stays green (assuming PVP is followed). The property “works against latest ok hackage” is not stable in that sense. I guess build-against-all-latest-on-hackage is also useful (e.g. in as a step before creating a version-bumping-PR), and if it's easier, fine with me. |
Actually, the latest is not the best package to test. Assume the dependency is bumped from So here is a variant of the proposal, easier to implement. It only helps when package authors use the This way, the idea behind Another benefit of this is that it is even more stable against Hackage changes. Does that hold (more) water? |
Is this prefer-newest dual to #8261? |
Hmm, not quite, I think. It says
but it starts with “the solver has a choice”, so it sounds it’s just about preferring one possible option over another option. (but I might be wrong) What I think we want here is to force a specific version, and fail if it is not possible, rather than silently using an older version. |
@nomeata it makes sense, but remember that I'm not sure whether constraints can be "expanded" late in the current solver design, I doubt, and I'd rather not do that. Instead, it would be enough to have a prototype a tool to dump the required |
Yes, that is a very reasonable approach! :-) |
That would be great. Currently, I grep through the output of |
I am not sure I understand the problem 🤔🧐 Re forcing cabal-install to pick the latest version of a (direct or transitive) dependency: doesn't Re figuring out what is imposing an upper bound on Kinda worked but perhaps there's a simpler way to look at this problem. Also I'm pretty sure I had written an O(n^2) algorithm 😂. |
This uses the latest existing version, which may be different than the latest allowed version by the present package. Here is code demonstrating what I want to do, if that's clearer: https://github.com/nomeata/cabal-force-upper-bound :-) |
gotcha! I had missed this, thank you for repeating it for me :) |
I am thinking about how to make dependency upgrades more automatic and more reliable (https://mobile.twitter.com/nomeata/status/1558859792919191552).
Imagine we have a tool or bot that creates tentatively PRs that extend the dependency ranges of your package
pkg
, e.g. fromfoo <2.0
tofoo <2.1
. Ideally, if the CI for this change is green it should be ok to merge it (after also checking the changelog for semantic changes, of course).But right now, a typical CI setup will not provide that: If
pkgs
also depends onbar
, and all versions ofbar
depend onfoo <2.0
, then Cabal will continue to pickfoo-1
, the build will succeed, and the PR may be merged. But oncebar
allowsfoo-2.0
, now Cabal will pick that, and an incompatibility might cause the build or the tests to break – but now on master or on Hackage.When doing dependency bumps locally, I'd use
--constraint="foo>=2.0"
to avoid this. But what can we do in automatic CI?I could imagine a flag
--constrain-latest-deps=pkgs
that instructs the Cabal solver to use, for every dependency ofpkgs
, exactly the highest known version that is withinpkgs
’s version bounds. I can then use this flag in CI, and know that my upper version bounds are actually realizable.Would that be useful, doable and welcome?
The text was updated successfully, but these errors were encountered: