Elixir libraries using widen strategy and ~> 0.x version spec result in nonsensical ~> 0.x or ~> 0.x+1
#45393
Unanswered
tomekowal
asked this question in
Request Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
How are you running Renovate?
Self-hosted Renovate CLI
Which platform you running Renovate on?
GitLab (.com or self-hosted)
Which version of Renovate are you using?
43.59.0
Please tell us more about your question or problem
I am using Renovate with Elixir applications and libraries.
It works mostly fine, but it has an issue where for dependencies pre 1.0 and widen strategy, e.g.
~> 0.2when a new version comes, it creates a PR with~> 0.2 or ~> 0.3. This is incorrect behaviour because~> 0.2means in Elixir (the same as in Ruby)>= 0.2 and < 1.0. In general, the operator says "give me version higher or equal to specified, but only allow bumping the right-most number", so~> 0.2allows0.3but disallows1.0. If you have three parts~> 0.1.2. It will match0.1.4, but not0.2.x.I tried to debug the issue and it seems conceptual.
in
lib/modules/versioning/hex/index.tsthere is a function calledhex2npmthat turns~>into npm's', but they have slightly different semantics. NPM's'means "pin the leftmost NON ZERO element", so they work almost the same, except the case where there are exactly two parts and the first one is zero, e.g.~> 0.x.E.g.
~> 0.2allows version0.3and'0.2does NOT allow0.3.I asked Claude to create a repo with reproduction https://github.com/tomekowal/renovate-hex-widen-repro/pulls?q=sort%3Aupdated-desc+is%3Apr+state%3Aopen+
I made a branch with a fix https://github.com/tomekowal/renovate/tree/fix/hex-two-part-tilde-zero-major
but I understand the policy is to not pollute this repository with unwanted PRs until you confirm the issue is real. Let me know if I can help. Also, feel free to just copy the code and modify at as you see fit. It was already super dense, so the back and forth review cycle might be slowing you down. I don't care about scoring contribution, I would just love to see the issue fixed for the benefit of Renovate and Elixir community ❤️
Logs (if relevant)
No response
All reactions