Skip to content

Restore transitiveness of version comparison#2651

Merged
1 commit merged intomasterfrom
fix_comparison
Apr 15, 2019
Merged

Restore transitiveness of version comparison#2651
1 commit merged intomasterfrom
fix_comparison

Conversation

@deivid-rodriguez
Copy link
Copy Markdown
Contributor

Description:

This is an alternative to #2597 fix to #2595.

I strongly think this is the best way to fix this, even if it could create some incompatibility with some gems relying on things like "~> 5.x" being lower than all 5.0.0 prereleases.

As explained in that discussion, the official way that's recommended in the docs to match all prereleases is "~> 5.a", because "a" is the first string in lexicographical order.

I created PRs to the two gems I found relying on this:

I would consider this a bug fix and ship it normally on a bug fix release, but I can understand if others prefer a more conservative approach.

Tasks:

  • Describe the problem / feature
  • Write tests
  • Write code to solve the problem
  • Get code review from coworkers / friends

I will abide by the code of conduct.

@deivid-rodriguez
Copy link
Copy Markdown
Contributor Author

I rebased this PR and it hit a bug in bundler's master specs which is getting fixed in rubygems/bundler#7089. I'll rebase again once that lands.

By comparing canonical versions.
@greysteil
Copy link
Copy Markdown
Contributor

greysteil commented Apr 14, 2019

I'm 👍 on shipping this as a bug fix. With the current setup (before this PR):

Gem::Version.new("1.0.beta") >= Gem::Version.new("1.0.0.beta")
# => true
Gem::Version.new("1.0.beta") >= Gem::Version.new("1.0.0.alpha")
# => false

That's really surprising - it means that currently version comparison isn't transitive.

@deivid-rodriguez
Copy link
Copy Markdown
Contributor Author

Happy we're in the same page here! 🎉 I should've probably pinged you about this before.

@deivid-rodriguez
Copy link
Copy Markdown
Contributor Author

Any more opinions here? It would be great to ship this with the next bugfix release!

@segiddins
Copy link
Copy Markdown
Contributor

👍🏻

@bronzdoc
Copy link
Copy Markdown
Contributor

@bundlerbot r+

ghost pushed a commit that referenced this pull request Apr 15, 2019
2651: Restore transitiveness of version comparison r=bronzdoc a=deivid-rodriguez

# Description:

This is an alternative to #2597 fix to #2595.

I strongly think this is the best way to fix this, even if it _could_ create some incompatibility with some gems relying on things like "~> 5.x" being lower than _all_ 5.0.0 prereleases.

As explained in that discussion, the official way that's recommended in the docs to match all prereleases is "~> 5.a", because "a" is the first string in lexicographical order.

I created PRs to the two gems I found relying on this:

* rails/activemodel-serializers-xml#17
* rails/rails-controller-testing#45

I would consider this a bug fix and ship it normally on a bug fix release, but I can understand if others prefer a more conservative approach.

# Tasks:

- [x] Describe the problem / feature
- [x] Write tests
- [x] Write code to solve the problem
- [ ] Get code review from coworkers / friends

I will abide by the [code of conduct](https://github.com/rubygems/rubygems/blob/master/CODE_OF_CONDUCT.md).

Co-authored-by: John Hawthorn <john@hawthorn.email>
@ghost
Copy link
Copy Markdown

ghost commented Apr 15, 2019

Build succeeded

@ghost ghost merged commit 9836549 into master Apr 15, 2019
@ghost ghost deleted the fix_comparison branch April 15, 2019 14:51
jeffwidman added a commit to jeffwidman/dependabot-core that referenced this pull request Mar 31, 2022
This was added in
dependabot@cdb346e
as a temporary workaround until ruby/rubygems#2651 shipped.

It looks like that shipped in Ruby Gems 3.1.0, and Dependabot is
currently on Ruby Gems `3.2.20`: https://github.com/dependabot/dependabot-core/blob/9c090f6fe573aa3b6b05d20920c7c48f5f00403f/Dockerfile#L77

So this should be safe to remove.

Note that I removed the code workaround from the original commit, but
not the test cases... so they should catch any regressions.
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants