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

Auto-heal lockfile when it's missing specs #6132

Merged
merged 2 commits into from
Dec 16, 2022

Conversation

deivid-rodriguez
Copy link
Member

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

If a lockfile is missing some specs (meaning, it includes some dependencies but not specs for those dependencies), then Bundler currently happily accepts the lockfile and crashes when it's about to install it.

We have a check for a corrupt lockfile right before installing. However, the check accounted for locked specs not satisfying locked dependencies, but not for locked specs missing for some locked dependencies.

I still need to investigate why this kind of lockfile was generated in the first place, but that shouldn't block this PR.

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

Instead of fixing this check, I decided to remove it in favor of automatically detecting the situation and re-resolve to automatically fix the lockfile rather than printing a warning but leave the problem there.

Fixes #6124.

Make sure the following tasks are checked

@deivid-rodriguez
Copy link
Member Author

We also clarified how this lockfile was generated. @ThaiGQ had a number of Gemfile.lock conflicts when merging main into a feature branch, and manual resolution of those conflicts accidentally introduced the bad lockfile.

Now Bundler will be resilient to this kind of user error 💪.

@indirect
Copy link
Member

Nice work!

@ThaiGQ
Copy link

ThaiGQ commented Dec 16, 2022

Thanks for investigating and fixing the issue @deivid-rodriguez ! 🙏
Especially since it was a result of user error on my part... 😅

@indirect
Copy link
Member

We have said “there is no such thing as user error, only a bug in the Bundler UX” since the very beginning, all the way back in 2009. Major props to @deivid-rodriguez for doing such a good job with this one! 👏🏻

We have a check for a corrupt lockfile right before installing. However,
the check accounted for locked specs not satisfying locked dependencies,
but not for locked specs missing for some locked dependencies.

Instead of fixing this check, I decided to remove it in favor of
automatically detecting the situation and re-resolve to automatically
fix the lockfile rather than printing a warning but leave the problem
there.
@deivid-rodriguez
Copy link
Member Author

Going in!

@deivid-rodriguez deivid-rodriguez merged commit aabb00d into master Dec 16, 2022
@deivid-rodriguez deivid-rodriguez deleted the fix-crash-when-lockfile-missing-deps branch December 16, 2022 14:42
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.

NoMethodError: undefined method `full_name' for nil:NilClass after upgrading to Ruby 3.1.3 and Bundler 2.3.26
3 participants