Downgrade bundler mismatches to a warning#2621
Conversation
e3ef29e to
6b5662b
Compare
| end | ||
| bvf.stub(:bundler_version, v("2.a")) do | ||
| assert_equal %w[2 2.a 2.0 2.1.1], util_filter_specs(specs).map(&:version).map(&:to_s) | ||
| assert_equal %w[2 1 1.0 1.0.1.1 2.a 2.0 2.1.1 3 3.a 3.0 3.1.1], util_prioritize_specs(specs) |
There was a problem hiding this comment.
Shouldn't 2.a try 2, but then try 2.a before falling back to 1?
There was a problem hiding this comment.
Oh, I see... it is that 2 is available, so it's moved to the front. And if 2 was not available, 2.a would be moved to the front instead. Is that right?
There was a problem hiding this comment.
That's exactly right.
The new strategy would be to find the first compatible version and move it to the front, but leave the array untouched if no compatible version is found. The difference with the old strategy is that no bundler versions are ever filtered out, so the array will never be left empty, and thus we'll never cause an error.
We could do further prioritization here as you suggested in the first comment, but only the first spec in this array gets actually used, so it seemed unnecessary.
|
Got it. Sounds good to me!
…On Feb 22, 2019, 1:31 AM -0800, David Rodríguez ***@***.***>, wrote:
@deivid-rodriguez commented on this pull request.
In test/rubygems/test_gem_bundler_version_finder.rb:
> end
bvf.stub(:bundler_version, v("2.a")) do
- assert_equal %w[2 2.a 2.0 2.1.1], util_filter_specs(specs).map(&:version).map(&:to_s)
+ assert_equal %w[2 1 1.0 1.0.1.1 2.a 2.0 2.1.1 3 3.a 3.0 3.1.1], util_prioritize_specs(specs)
That's exactly right.
The new strategy would be to find the first compatible version and move it to the front, but leave the array untouched if no compatible version is found. The difference with the old strategy is that no bundler versions are ever filtered out, so the array will never be left empty, and thus we'll never cause an error.
We could do further prioritization here as you suggested in the first comment, but only the first spec in this array gets actually used, so it seemed unnecessary.
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub, or mute the thread.
|
|
I also agreed with this strategy. |
|
@bundlerbot r+ |
2621: Downgrade bundler mismatches to a warning r=hsbt a=deivid-rodriguez # Description: closes #2592. The behavior described in that issue is expected, we really prefer the BUNDLED_WITH version in the lock file to be used when running a bundled application. However, at the current time, it is too much to fail because of mismatches here, so I propose to downgrade this to a warning for the time being. The strategy I followed is to, instead of filtering out bundler versions not matching the major version of the "BUNDLED WITH" bundler, we we put a version matching it (if it exists) in front of the matching specs, so that is the one to be picked up. Otherwise a warning is raised. By not removing any versions, we make sure we no longer fail because of not finding an appropriate bundler version. Commit per commit review recommended, since I needed a few refactorings before implementing the fix. # 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: David Rodríguez <deivid.rodriguez@riseup.net>
Build succeeded |
2694: Revert downgrading bundler mismatches to a warning r=deivid-rodriguez a=deivid-rodriguez This reverts commit dad8d25, reversing changes made to b4063c6. # Description: #2621 broke bundler's build. I'm going to investigate why but in the meantime I don't want to have a red master in bundler so I'm reverting this. I wonder if we should test rubygems against a vendored bundler that contains the code in bundler's master. Probably too much overhead 🤷♂️. # Tasks: - [x] Describe the problem / feature - [ ] 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: David Rodríguez <deivid.rodriguez@riseup.net>
2695: Add a job to test bundler's master r=bronzdoc a=deivid-rodriguez # Description: #2621 broke our bundler's master build without us noticing in advance. I'd like to add one job that would've allowed us to catch this. # Tasks: - [x] Describe the problem / feature - [ ] 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: David Rodríguez <deivid.rodriguez@riseup.net>
|
@deivid-rodriguez Can you restore this pull-request for the future plan? |
6996: Downgrade version mismatches to warnings r=indirect a=deivid-rodriguez Closes #6993. Complements ruby/rubygems#2621. ### What was the end-user problem that led to this PR? The problem was that bundler 2 has become too unfriendly because it errors out when the running version does not match the version in the BUNDLED WITH section in the lockfile. ### What was your diagnosis of the problem? My diagnosis is that we still believe that making sure the exact same bundler version is always run for a specific application is a good thing, because it ensures resolution is always the same because it's resolved by the exact same code that generated the lockfile. BUT, we need to ensure this in a more user friendly way, for example by auto-switching and auto-installing the right bundler version without any user intervention. ### What is your fix for the problem, implemented in this PR? My fix is to downgrade this hard error to a warning that does not prevent bundler from running. ### Why did you choose this fix out of the possible options? I chose this fix because it still shows the mismatch but allows bundler to run, thus being a bit friendlier. Hopefully this won't be needed once bundler is smart enough to autoswitch and autoinstall. Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
Description:
closes #2592.
The behavior described in that issue is expected, we really prefer the BUNDLED_WITH version in the lock file to be used when running a bundled application.
However, at the current time, it is too much to fail because of mismatches here, so I propose to downgrade this to a warning for the time being.
The strategy I followed is to, instead of filtering out bundler versions not matching the major version of the "BUNDLED WITH" bundler, we we put a version matching it (if it exists) in front of the matching specs, so that is the one to be picked up. Otherwise a warning is raised. By not removing any versions, we make sure we no longer fail because of not finding an appropriate bundler version.
Commit per commit review recommended, since I needed a few refactorings before implementing the fix.
Tasks:
I will abide by the code of conduct.