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

Fix bundler/inline not resolving properly if gems not preinstalled #6282

Merged
merged 1 commit into from
Jan 21, 2023

Conversation

deivid-rodriguez
Copy link
Member

@deivid-rodriguez deivid-rodriguez commented Jan 17, 2023

What was the end-user or developer problem that led to this PR?

After 2.4.4, some bundler/inline cases no longer work.

What is your fix for the problem, implemented in this PR?

In inline mode, we resolve twice. First, we do a local resolution, and if that fails (local resolution failed, some resolved spec is not installed), we try again remotely.

Due to a recent refactoring, we were eagerly passing source requirements for resolution to a resolution context that would be reused for both of the above resolutions. However, the source requirements are different in the above two modes, so we need to make sure to calculate source requirements lazily when resolving.

However, that solution caused some issues with git sources, because it turns out during calculation of source requirements, we sort sources based on their to_s representation, and calling #to_s on git sources actually causes side effects: the displayed revision is memoized in the source. That was causing git sources to no longer be updated correctly. I changed this sorting of sources to not rely on #to_s to fix this derivated problem.

Closes #6281.

Make sure the following tasks are checked

@deivid-rodriguez deivid-rodriguez force-pushed the fix-inline-issue branch 3 times, most recently from ac013d8 to 3b84473 Compare January 19, 2023 00:21
In inline mode, we resolve twice. First, we do a local resolution, and
if that fails (either because local resolution failed, or because some
resolved spec is not installed), we try again remotely.

Due to a recent refactoring, we were eagerly passing source requirements
for resolution to a resolution context that would be reused for both of
the above resolutions. However, the source requirements are different in
the above two modes, because local resolution uses a global aggregated
source, instead of explicit sources for each name.

The solution is to change local resolution to also use explicit source
requirements.
@deivid-rodriguez deivid-rodriguez changed the title Fix regression in bundler/inline Fix bundler/inline not resolving properly if gems not preinstalled Jan 19, 2023
@deivid-rodriguez deivid-rodriguez changed the title Fix bundler/inline not resolving properly if gems not preinstalled Fix bundler/inline not resolving properly if gems not preinstalled Jan 19, 2023
@deivid-rodriguez
Copy link
Member Author

I found a much simpler approach.

Instead of lazily passing source requirements, so that each resolution uses the ones it needs, I made source requirements independent of whether we resolve locally or remotely.

@deivid-rodriguez deivid-rodriguez merged commit 633a968 into master Jan 21, 2023
@deivid-rodriguez deivid-rodriguez deleted the fix-inline-issue branch January 21, 2023 10:18
deivid-rodriguez added a commit that referenced this pull request Jan 21, 2023
Fix `bundler/inline` not resolving properly if gems not preinstalled

(cherry picked from commit 633a968)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bundler 2.4.4 unable to resolve dependencies when used inline
1 participant