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

Avoid excluding transitive dependencies of default dependencies #2937

Conversation

vinistock
Copy link
Member

@vinistock vinistock commented Nov 29, 2024

Motivation

I noticed that we were incorrectly excluding dependencies if they were transitive to both the development and the default groups. For example:

gem "irb"

group :development do
  gem "debug"
end

In this case, both debug and irb depend on reline. Since irb is a part of the default group, we should not exclude reline. The bug is that we weren't taking the transitive dependencies of the default group into account and so when we saw that debug was in the development group, we excluded it.

Implementation

Started concatenating the transitive dependencies that cannot be excluded into the list.

Automated Tests

Added a test that fails before the fix.

@vinistock vinistock added server This pull request should be included in the server gem's release notes bugfix This PR will fix an existing bug labels Nov 29, 2024 — with Graphite App
Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@vinistock vinistock marked this pull request as ready for review November 29, 2024 14:41
@vinistock vinistock requested a review from a team as a code owner November 29, 2024 14:41
@vinistock vinistock force-pushed the 11-29-avoid_excluding_transitive_dependencies_of_default_dependencies branch 2 times, most recently from 2951eae to 1931f0a Compare November 29, 2024 14:50
@vinistock vinistock force-pushed the 11-29-avoid_excluding_transitive_dependencies_of_default_dependencies branch from 1931f0a to 444c202 Compare November 29, 2024 15:23
@vinistock vinistock merged commit b0eb396 into main Nov 29, 2024
37 checks passed
@vinistock vinistock deleted the 11-29-avoid_excluding_transitive_dependencies_of_default_dependencies branch November 29, 2024 15:47
@andyw8
Copy link
Contributor

andyw8 commented Dec 20, 2024

I think this is causing a problem with platform-scoped gems:

Shopify/ruby-lsp-rails#550 (comment)

@vinistock
Copy link
Member Author

Working on a fix.

vinistock added a commit that referenced this pull request Jan 6, 2025
### Motivation

This PR fixes a mistake made in #2937. We cannot invoke `to_spec` without rescuing `Gem::MissingSpecError` because that gets raised whenever there's a gem that doesn't match platform constraints.

### Implementation

Added the missing rescue.

### Automated Tests

Added a test that fails before the fix so that we catch this next time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants