Skip to content

Conversation

@vinistock
Copy link
Member

@vinistock vinistock commented Jul 17, 2025

Motivation

Addresses #3279 (comment)

If users have gems copied inside their workspace without pointing their BUNDLE_PATH to it, requiring project add-ons will require incorrect versions of gems by accident - leading to unpredictable behaviour.

In #3279, it seems that the workspace had gems in vendor/bundle despite BUNDLE_PATH not pointing to it. In that situation, we get the reported bug. This is a pretty odd setup, but we shouldn't crash in hard to debug ways.

Implementation

The essence of the problem is discovering an add-on for the same gem twice. The correct discovery always comes from Gem.find_files, so I propose that we create an array of glob patterns to reject from the list of correctly discovered add-ons.

Then we reject any occurrences inside of the workspace that match the glob pattern, regardless of the gem version. Hopefully, this can avoid any form of requiring multiple versions of the same add-on.

Automated Tests

Added a test that reproduces the issue.

@vinistock vinistock self-assigned this Jul 17, 2025
Copy link
Member Author


How to use the Graphite Merge Queue

Add the label graphite-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

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

@vinistock vinistock added bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes labels Jul 17, 2025 — with Graphite App
@vinistock vinistock marked this pull request as ready for review July 17, 2025 20:44
@vinistock vinistock requested a review from a team as a code owner July 17, 2025 20:44
@vinistock vinistock merged commit f40a4e5 into main Jul 18, 2025
53 of 55 checks passed
@vinistock vinistock deleted the 07-17-avoid_requiring_add-ons_that_are_copied_into_the_workspace branch July 18, 2025 15:07
@connorshea
Copy link

I can confirm this fixes the problem, thank you!

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