r/ruby • u/dorcus_maximus • May 16 '24
When maintainers abandon / ignore their gems...can anything be done?
I'm sure this has been addressed multiple time but I didn't easily find what I was looking for...
A little while ago I fixed a gem that was broken. It was broken in the sense that it was no longer compatible with a large number of other gems that would be used alongside it and for which it shared dependencies. It hadn't seen any meaningful maintenance in 7 or 8 years. Using it meant using (very) old versions of a lot of other gems. In my case, not using it would require a lot more dev time than simply fixing it would. Not a good situation. Anyway, I fixed it. In this case, the owner of the gem at least made me a maintainer of the repo, though I'm still not the owner of the gem (can't push new versions). At least they haven't completely abandoned all responsibility and still published my fixes as a new gem. No problem.
I've now run into a similar situation again. Simple code that is a plugin for a gem that has 20+M downloads. But the thing that it is a plugin for has moved on with a major version release which happened almost five years ago. This plugin hasn't kept up. There doesn't seem to be any other gem out there that does the same job. I fixed the plugin and submitted a PR. In a case like this, is there any recourse at all if the maintainer / owner is completely unresponsive or inactive? Other than just releasing it as a new gem with a new name?
57
u/ieee1394one May 16 '24
Fork or copy and rerelease. You may want to keep it private if you can’t maintain it long term to avoid the same issue for someone else.
6
u/Gnascher May 16 '24 edited May 16 '24
First, whenever I bring a gem into a project, I usually create a wrapper for it. In that wrapper I'll generalize the functionality and expose methods that leverage the functionality I need and use those methods in my application code.
The benefit of this is that if this gem goes away for whatever reason (or majorly changes its API in a major version release, for example), my in-house code is based upon the generic wrapper, and we can either write the functionality we're using from the gem ourselves, or replace it with a new gem that provides the same functionality without having to make sweeping changes to our application code. Even if the wrapper is nothing more than subclassing the Gem's main class or using it as an include/extend, it gives a centralized place to re-map the interface if the gem changes, or you need to swap out the gem without having to find instances of its use throughout your application.
In some cases where the functionality the gem provides is complex, and we don't want to re-write its functionality for ourselves or can't find a community fork or another gem that provides similar functionality, we'll fork the gem and maintain it internally.
In a few cases we have taken "ownership" of a gem after it's been abandoned, and became the maintainers, either through direct transfer or a fork, but this is generally a less desirable situation. We'd only consider this in a case where the gem's functionality is complex, unique, and critical enough to our application's central function that committing community-wide maintenance resources to it makes sense to our organization.
The lesson here is wrap your gems. It does add a little bit of overhead up-front, but it's an investment in tech-debt reduction that can really pay off down the line whenever the unexpected happens (which is not all that uncommon in the open-source community). It helps prevent the "lock-in" phenomenon where you're so tightly coupled with externally maintained code that wholesale changes to that external code could be disastrous to your application, or when a better implementation comes along in another gem but you can't take advantage of it because its API differs significantly from the current gem and you'd have to make major changes across your application to switch.
Another benefit to wrapping gems is that often a gem won't provide exactly the functionality you want. Having a centralized wrapper provides a place to modify and/or extend that behavior and have it immediately take effect throughout your application without monkey patching or hunting down code throughout your codebase.
Yet another benefit of wrapping your gems is when you discover a bug in the gem's code. Yes, submit a bug report (or even a patch if you can), but as we all know gem maintainers have their own agendas and your bug either may not be a high priority for them, or it may even be a "feature" in their opinion. When you have a wrapper, you can easily implement your own workaround that will be instantly available system-wide in your application while you wait for the bug to work it's way through the maintainer's roadmap.
Finally, you can write tests against your wrapper, and know that the functionality the wrapper exposes behaves exactly as you expect it to, even if you change the underlying gem, or introduce your own overrides and extensions.
21
u/wflanagan May 16 '24
When an ecosystem gets to a certain age, these things happen. There's no economic incentive and if you leave the project, they're NOT going to continue working on it.
The biggest one I saw was Resque a while back. They had a 2.0 fork, we based our code upon, because it was going to be the future. They beta'd and beta'd and then abandoned that fork, so we had to take it over (privately). We moved to Sidekiq eventually as that seemed to be the prevailing wind.
It was HUGE pain and cost us man weeks.
On many other gems, if I can, I just duplicate the part of the function i need locally. It's easier to own the piece I need versus using other code. This is the same reason as cool as some other capabilities are, I just try to use the stock stack of Rails.
14
u/armahillo May 16 '24
This happened with the
cancangem many years ago. Original maintainer left the project around when Rails 4 was released.The community forked it to
cancancanand carried it onwards.1
u/dorcus_maximus May 17 '24
I guess what I *wish* for is that there was some established means for owners to make a "will" for projects. Example: If I am confirmed dead or this project has no commits in N number or years or no issues or PRs have been addressed in N years then <some responsible entity that may not exist yet> may act as trustee and assign ownership to some other responsible person. I'm just spitballing and this certainly isn't perfect...just trying to outline something that might be better than nothing.
6
u/riktigtmaxat May 16 '24
A lot of the time it could be go to have a little think over why the project has been abandoned.
For a lot of them its that whatever need it filled doesn't really exist anymore or that the the author doesn't actually have any interest in it anymore or doesn't have interest in being a maintainer and the deluge of stupid that entails.
If you think the project still has redeeming value and you want to maintain it create a fork. If you dont want to keep your code private.
4
u/davetron5000 May 16 '24
Other option is to inline the parts of it you use into your app.
2
u/therealadam12 May 16 '24
This topic has been on my mind a fair bit lately as well. Proactively, I think engaging with the maintainers (and the library's community if one exists) of your primary dependencies is beneficial. Help them answer issues, discussions, etc.
There was an official process at one point where you could reach out to Rubygems.org to adopt maintainership of libraries that appeared abandoned. I am not sure if they still do this, especially with XZ/other supply attacks a concern as of late. It's worth exploring if you're willing to take over maintainership.
I've been wondering if something like the OpenJSF would work in the Ruby ecosystem, and what that would look like. In case you don't know, OpenJSF is now the steward for Node, jQuery, and many other impact libraries. There are many libraries that I'd consider impact-level in the Ruby community and the ability for them to have a path forward should their leadership change would be great.
2
u/jrochkind May 17 '24
That's pretty much it.
Alternately, you can just point your Gemfile at your branch on github, unreleased.
gem "original_gem_name", git: 'https://github.com/yourname/reponame', branch: "your_fork_branch"
1
u/[deleted] May 19 '24 edited May 19 '24
First and foremost, I preface all my asks with an offer to sponsor the maintainer on GitHub, or I go ahead and sponsor them to go their attention. Money always talks, and even $10/mo can get somebody hyped to help. Typically my asks are simple e.g. "can you merge this PR and cut a release?" or "can you cut a new release?"
If they didn't respond, then I'd fork and fix the bug, and point my Gemfile to the fork on GitHub by commit hash. After forking, I'd send an ownership request on Rubygems if I decide I'd like to take over maintaining it rather than pester them on GH or email. If that fails, and you want to maintain it for everyone, release it under a new but similar name (e.g. cancan and cancancan).
1
u/westonganger May 21 '24
You can lookup the maintainers email address using git to look at any commit details and/or look at the gemspec file for an email address.
Once you have their email you can reach out and offer to maintain the gem. I have successfully taken over multiple projects like this.
Just make a good case for yourself and why you will be a good maintainer. You likely want to retain the original authors namespace to preserve their hard work so you can just be added as another co-author/co-contributor on GitHub.
-2
u/fantasticfears May 16 '24
Not everything needs to be maintained when it’s mature.