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

cabal check should warn about missing upper bounds #8291

Closed
jappeace opened this issue Jul 15, 2022 · 15 comments · Fixed by #8361
Closed

cabal check should warn about missing upper bounds #8291

jappeace opened this issue Jul 15, 2022 · 15 comments · Fixed by #8361
Labels
attention: pr-welcome cabal-install: cmd/check re: pvp Concerning the Haskell Package Versioning Policy re: user experience User experience (UX) issue

Comments

@jappeace
Copy link
Collaborator

According to the pvp we should specify upperbounds for all dependencies.
Since hackage in the future intents to reject packages without tight upper bounds on dependencies,
it's prudent that cabal check gives a warning for this.

@ffaf1
Copy link
Collaborator

ffaf1 commented Jul 15, 2022

cabal check mimics Hackage's requirements; when Hackage will change its upload policy, cabal check will for sure warn about missing upper bound too.

@jappeace
Copy link
Collaborator Author

Then tell them to stop sending emails about version bounds. They made my colleague upset. 😔

@ffaf1
Copy link
Collaborator

ffaf1 commented Jul 15, 2022

Thanks for bringing this to our attention. Let me check how the whole process is set up, I will get back to you as soon as I have a proposal.

@ffaf1 ffaf1 added re: user experience User experience (UX) issue re: pvp Concerning the Haskell Package Versioning Policy labels Jul 15, 2022
@ffaf1
Copy link
Collaborator

ffaf1 commented Jul 15, 2022

A way to introduce this could be by adding a PackageDistSuspiciousWarn:

-- | Like PackageDistSuspicious but will only display warnings
-- rather than causing abnormal exit when you run 'cabal check'.
| PackageDistSuspiciousWarn { explanation :: String }

If there is some consensus, I could check how this warning would impact people using stack and eventually write a PR.

@Mikolaj
Copy link
Member

Mikolaj commented Jul 15, 2022

Yes, definitely let's discuss. I wonder what the warnings are used for, so far.

@ffaf1
Copy link
Collaborator

ffaf1 commented Jul 18, 2022

@ffaf1
Copy link
Collaborator

ffaf1 commented Jul 18, 2022

Also notice how we already check for upper bounds in setup-depends

emitError nm =
PackageDistInexcusable $
"The dependency 'setup-depends: '"++nm++"' does not specify an "
++ "upper bound on the version number. Each major release of the "
++ "'"++nm++"' package changes the API in various ways and most "
++ "packages will need some changes to compile with it. If you are "
++ "not sure what upper bound to use then use the next major "
++ "version."

with PackageDistInexcusable.

@ffaf1
Copy link
Collaborator

ffaf1 commented Jul 21, 2022

Related: #5317 (opened in 2018).

@ulysses4ever
Copy link
Collaborator

A more sophisticated version of it is asked for in #1703

@jappeace
Copy link
Collaborator Author

jappeace commented Jul 22, 2022

I'd go with a simple add any upper bound to all dependencies, and point to cabal gen-bounds in the message.
Apparently this is so hard they've not figured out how to do this since 2014, so better keep it simple, right?

@Mikolaj
Copy link
Member

Mikolaj commented Jul 22, 2022

@jappeace: most of "them" were and are volunteers and most of "them" could figure out 20 such things a day, if that was their own single-user project and they could focus on exclusively it and didn't need to forge consensus.

@jappeace
Copy link
Collaborator Author

sorry it wasn't my intention to doubt the competence of the maintainers,
I just meant, let's keep it simple so we have time to do it.
I want to volunteer an implementation even, but I'm not going to deal with the imports like #1703 suggests, because that seems needlesly difficult for little gain.

@Mikolaj
Copy link
Member

Mikolaj commented Jul 22, 2022

Oh, fair enough. thank you. No opinion on #1703, but I do believe in baby steps and getting things humbly done. What do you think @ffaf1 and @ulysses4ever?

@ulysses4ever
Copy link
Collaborator

I'm a big fan of do the simple thing first. I'm not sure if this warning should be on by default or hidden behind a flag (e.g. cabal check --pedantic). But I'm fine with either.

@ffaf1
Copy link
Collaborator

ffaf1 commented Jul 22, 2022

I agree with “simple things first”. With the new and improved™ structured errors, a third party tool (e.g. stack) can decide to ignore specific checks easily and reliably, so this should be uncontroversial.

I would personally not hide it behind a flag, for UX reasons. I would be pretty miffed to invoke cabal check, upload a package, get a prodding email from trustees (no matter how polite) only to discover I had to use an additional flag.

If @jappeace wants to take a stab at it, this is a good place where to start:

check (not (hasUpperBound baseDependency)) $
PackageDistInexcusable BaseNoUpperBounds

jappeace added a commit to SupercedeTech/cabal that referenced this issue Aug 3, 2022
fixes haskell#8291
presumably this will make it nag at anyone for forgetting
to add upper bounds to their packages.
jappeace added a commit to SupercedeTech/cabal that referenced this issue Aug 3, 2022
fixes haskell#8291
presumably this will make it nag at anyone for forgetting
to add upper bounds to their packages.

add changelog

(presumably)
jneira pushed a commit to jappeace/cabal that referenced this issue Aug 17, 2022
fixes haskell#8291
presumably this will make it nag at anyone for forgetting
to add upper bounds to their packages.

add changelog

(presumably)
jappeace added a commit to jappeace/cabal that referenced this issue Aug 24, 2022
fixes haskell#8291
presumably this will make it nag at anyone for forgetting
to add upper bounds to their packages.

add changelog

(presumably)

wait what?

move toDependencyVersionsMap to utils section

add nicer error message

simplify checking logic, add more comments

only emit missing upper bounds if bigger then one

don't add bound to internal libraries

filter out self from the dependency map

I think this is an external library so it needs an upper bound now?

add test for multilib

fix test suite by ignoring the warning

... probably not the best approach

change link to pvp instead of parsonsmatt

better wording on missing upper bound error

remove spurious parenthesis

change map creation from monad to list comprehension

use foldmap to get rid of maybe, fix compile error

rewrite from do notation to list comprehension

fix test suite failing
jappeace added a commit to jappeace/cabal that referenced this issue Aug 31, 2022
fixes haskell#8291
presumably this will make it nag at anyone for forgetting
to add upper bounds to their packages.

add changelog

(presumably)

wait what?

move toDependencyVersionsMap to utils section

add nicer error message

simplify checking logic, add more comments

only emit missing upper bounds if bigger then one

don't add bound to internal libraries

filter out self from the dependency map

I think this is an external library so it needs an upper bound now?

add test for multilib

fix test suite by ignoring the warning

... probably not the best approach

change link to pvp instead of parsonsmatt

better wording on missing upper bound error

remove spurious parenthesis

change map creation from monad to list comprehension

use foldmap to get rid of maybe, fix compile error

rewrite from do notation to list comprehension

fix test suite failing

fix compile error

factor out double filter call in a && expression
jappeace added a commit to jappeace/cabal that referenced this issue Oct 12, 2022
fixes haskell#8291
presumably this will make it nag at anyone for forgetting
to add upper bounds to their packages.

add changelog

(presumably)

wait what?

move toDependencyVersionsMap to utils section

add nicer error message

simplify checking logic, add more comments

only emit missing upper bounds if bigger then one

don't add bound to internal libraries

filter out self from the dependency map

I think this is an external library so it needs an upper bound now?

add test for multilib

fix test suite by ignoring the warning

... probably not the best approach

change link to pvp instead of parsonsmatt

better wording on missing upper bound error

remove spurious parenthesis

change map creation from monad to list comprehension

use foldmap to get rid of maybe, fix compile error

rewrite from do notation to list comprehension

fix test suite failing

fix compile error

factor out double filter call in a && expression
andreabedini pushed a commit to jappeace/cabal that referenced this issue Oct 17, 2022
fixes haskell#8291
presumably this will make it nag at anyone for forgetting
to add upper bounds to their packages.

add changelog

(presumably)

wait what?

move toDependencyVersionsMap to utils section

add nicer error message

simplify checking logic, add more comments

only emit missing upper bounds if bigger then one

don't add bound to internal libraries

filter out self from the dependency map

I think this is an external library so it needs an upper bound now?

add test for multilib

fix test suite by ignoring the warning

... probably not the best approach

change link to pvp instead of parsonsmatt

better wording on missing upper bound error

remove spurious parenthesis

change map creation from monad to list comprehension

use foldmap to get rid of maybe, fix compile error

rewrite from do notation to list comprehension

fix test suite failing

fix compile error

factor out double filter call in a && expression
kokobd pushed a commit to jappeace/cabal that referenced this issue Nov 11, 2022
fixes haskell#8291
presumably this will make it nag at anyone for forgetting
to add upper bounds to their packages.

add changelog

(presumably)

wait what?

move toDependencyVersionsMap to utils section

add nicer error message

simplify checking logic, add more comments

only emit missing upper bounds if bigger then one

don't add bound to internal libraries

filter out self from the dependency map

I think this is an external library so it needs an upper bound now?

add test for multilib

fix test suite by ignoring the warning

... probably not the best approach

change link to pvp instead of parsonsmatt

better wording on missing upper bound error

remove spurious parenthesis

change map creation from monad to list comprehension

use foldmap to get rid of maybe, fix compile error

rewrite from do notation to list comprehension

fix test suite failing

fix compile error

factor out double filter call in a && expression
jappeace added a commit to jappeace/cabal that referenced this issue Dec 1, 2022
fixes haskell#8291
presumably this will make it nag at anyone for forgetting
to add upper bounds to their packages.

add changelog

(presumably)

wait what?

move toDependencyVersionsMap to utils section

add nicer error message

simplify checking logic, add more comments

only emit missing upper bounds if bigger then one

don't add bound to internal libraries

filter out self from the dependency map

I think this is an external library so it needs an upper bound now?

add test for multilib

fix test suite by ignoring the warning

... probably not the best approach

change link to pvp instead of parsonsmatt

better wording on missing upper bound error

remove spurious parenthesis

change map creation from monad to list comprehension

use foldmap to get rid of maybe, fix compile error

rewrite from do notation to list comprehension

fix test suite failing

fix compile error

factor out double filter call in a && expression
@mergify mergify bot closed this as completed in #8361 Dec 4, 2022
mergify bot pushed a commit that referenced this issue Dec 4, 2022
* Add check for upper bound on any package

fixes #8291
presumably this will make it nag at anyone for forgetting
to add upper bounds to their packages.

add changelog

(presumably)

wait what?

move toDependencyVersionsMap to utils section

add nicer error message

simplify checking logic, add more comments

only emit missing upper bounds if bigger then one

don't add bound to internal libraries

filter out self from the dependency map

I think this is an external library so it needs an upper bound now?

add test for multilib

fix test suite by ignoring the warning

... probably not the best approach

change link to pvp instead of parsonsmatt

better wording on missing upper bound error

remove spurious parenthesis

change map creation from monad to list comprehension

use foldmap to get rid of maybe, fix compile error

rewrite from do notation to list comprehension

fix test suite failing

fix compile error

factor out double filter call in a && expression

* set expectation

* Modify test so it gives a list of expected libs

rename public-multilib-3 to all-upper-bound
the test had little to do with multilib.

* Update comment on ignoring warnigns

* use map instead of if

* Undo map change

add comment on why that doesn't work

* Add description and maintainer fields

* make description longer then synopsis in all-upper-bound.cabal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
attention: pr-welcome cabal-install: cmd/check re: pvp Concerning the Haskell Package Versioning Policy re: user experience User experience (UX) issue
Projects
None yet
4 participants