Skip to content

Fix plugin new version not registering#9355

Merged
hsbt merged 1 commit intoruby:masterfrom
Shopify:ec-plugin-register
Mar 4, 2026
Merged

Fix plugin new version not registering#9355
hsbt merged 1 commit intoruby:masterfrom
Shopify:ec-plugin-register

Conversation

@Edouard-chin
Copy link
Contributor

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

When a plugin in the Gemfile is updated to a new version, it will be downloaded but will not be registered. This means that the old version of the plugin will be loaded when Bundler is invoked and the new version is completely ignored.

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

Context

The problem is in the Index#installed? method that only checks for the plugin name in the index. If it finds one, it skips the registration.

Solution

Check whether the registed plugin load paths matche the new plugin one. If not, register the new plugin which will override the previous one in the index.

Make sure the following tasks are checked

- ### Problem

  When a plugin in the Gemfile is updated to a new version, it will
  be downloaded but will not be registered. The old version of the
  plugin will be loaded when Bundler is invoked.

  ### Context

  The problem is in the `Index#installed?` method that only checks for
  the plugin name in the index. If it finds one, it skips the
  registration.

  ### Solution

  Check whether the registed plugin load paths matche the new plugin
  one. If not, register the new plugin which will override the
  previous one in the index.
@plugin_paths[name]
end

def up_to_date?(spec)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opted to create a new method instead of modifying the installed? one, because installed? is also used in the uninstall method. In this case, we don't care about the version of the plugin, we just want to know whether the plugin name exists in the index.

if index.installed?(name)

Copy link
Member

@hsbt hsbt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sensed. Thanks always!

@hsbt hsbt merged commit 0561869 into ruby:master Mar 4, 2026
93 checks passed
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.

2 participants