Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Don't mutate original error trees when determining version_conflict_message #6650

Merged
merged 1 commit into from
Aug 15, 2018
Merged

Don't mutate original error trees when determining version_conflict_message #6650

merged 1 commit into from
Aug 15, 2018

Conversation

greysteil
Copy link
Contributor

@greysteil greysteil commented Aug 6, 2018

I know I'm messing with private APIs here, so have no right to expect this PR merged!

Currently, when Bundler generates its error message for a version conflict, it mutates the requirement_trees array on the underlying Molinillo::VersionConflict error.

I would really like it if it didn't. Dependabot taps into that error to understand what went wrong with resolution and unlock any dependencies that are blocking resolution. The code where we do so is here.

I don't think that there's any downside to not mutating here. Resolution has finished (and failed) at this stage, so trying to reduce memory usage doesn't really matter.

🙏

@segiddins
Copy link
Member

👍🏻

@bundlerbot
Copy link
Collaborator

☔ The latest upstream changes (presumably #6647) made this pull request unmergeable. Please resolve the merge conflicts.

@greysteil
Copy link
Contributor Author

@deivid-rodriguez - I wrote this so wont merge it myself, but would be great to have it in 1.16.4.

@segiddins
Copy link
Member

@bundlerbot r+

@bundlerbot
Copy link
Collaborator

📌 Commit 750012c has been approved by segiddins

@bundlerbot
Copy link
Collaborator

⌛ Testing commit 750012c with merge fc60fe4...

bundlerbot added a commit that referenced this pull request Aug 15, 2018
Don't mutate original error trees when determining version_conflict_message

*I know I'm messing with private APIs here, so have no right to expect this PR merged!*

Currently, when Bundler generates its error message for a version conflict, it mutates the `requirement_trees` array on the underlying `Molinillo::VersionConflict` error.

I would really like it if it didn't. Dependabot taps into that error to understand what went wrong with resolution and unlock any dependencies that are blocking resolution. The code where we do so is [here](https://github.com/dependabot/dependabot-core/blob/9abcb85ba69b408b11b56572dd13ab89d0c55b8c/lib/dependabot/file_updaters/ruby/bundler/lockfile_updater.rb#L142-L167).

I don't think that there's any downside to not mutating here. Resolution has finished (and failed) at this stage, so trying to reduce memory usage doesn't really matter.

🙏
@bundlerbot
Copy link
Collaborator

☀️ Test successful - status-travis
Approved by: segiddins
Pushing fc60fe4 to master...

@bundlerbot bundlerbot merged commit 750012c into rubygems:master Aug 15, 2018
@colby-swandale colby-swandale added this to the 1.16.4 milestone Aug 16, 2018
colby-swandale pushed a commit that referenced this pull request Aug 16, 2018
Don't mutate original error trees when determining version_conflict_message

*I know I'm messing with private APIs here, so have no right to expect this PR merged!*

Currently, when Bundler generates its error message for a version conflict, it mutates the `requirement_trees` array on the underlying `Molinillo::VersionConflict` error.

I would really like it if it didn't. Dependabot taps into that error to understand what went wrong with resolution and unlock any dependencies that are blocking resolution. The code where we do so is [here](https://github.com/dependabot/dependabot-core/blob/9abcb85ba69b408b11b56572dd13ab89d0c55b8c/lib/dependabot/file_updaters/ruby/bundler/lockfile_updater.rb#L142-L167).

I don't think that there's any downside to not mutating here. Resolution has finished (and failed) at this stage, so trying to reduce memory usage doesn't really matter.

🙏

(cherry picked from commit fc60fe4)
colby-swandale added a commit that referenced this pull request Aug 22, 2018
* 1-16-stable:
  Version 1.16.4 with changelog
  Auto merge of #6668 - eregon:fix-encoding-spec-from-6661, r=deivid-rodriguez
  Add encoding magic comment to gemfile spec
  Auto merge of #6662 - bundler:indirect/update-authors, r=colby-swandale
  Auto merge of #6650 - greysteil:dont-mutate-original-trees, r=segiddins
  Auto merge of #6661 - eregon:consistent-encoding-for-reading-files, r=deivid-rodriguez
  Auto merge of #6652 - bundler:seg-molinillo-0.6.6, r=segiddins
  Auto merge of #6645 - bundler:colby/require-etc, r=colby-swandale
  Auto merge of #6636 - ojab:1-16-stable, r=indirect
  Auto merge of #6624 - bundler:no-document, r=colby-swandale
  Auto merge of #6621 - ralphbolo:patch-1, r=segiddins
  Auto merge of #6613 - kemitchell:mention-show-sorts-in-doc, r=colby-swandale
  Auto merge of #6570 - akihiro17:prerelease-dependency, r=segiddins
  Auto merge of #6568 - greysteil:conservative-groups, r=segiddins
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants