Spring, bootsnap, and frontend WTFs

My biggest WTF’s:

  1. Spring almost causes more problems than it solves for an experienced user. For a new user it can be a total nightmare, and should not be included by default.
  2. Likewise with Bootsnap. Although it’s less common, Bootsnap can cause truly awful bugs that are confusing as hell. This is more likely when switching Ruby versions, or using Docker.
  3. Webpacker + Sprockets. There should not be two asset pipelines, but Sprockets is so much simpler that I don’t blame anyone for keeping it. Webpacker even seems over-complicated compared to a plain old webpack.config.js setup. Knowing webpack, I don’t understand webpacker. Knowing nothing, I would be doubly confused. We definitely need to be moving toward webpacker, but it really needs some UX improvement AND it should probably take over app/assets, not add app/javascript.
  4. Form Objects. Why is this so weird and confusing to do in Rails that almost every project uses a form object gem of some kind? Form objects should be a first-class feature of the framework.
  5. Turbolinks. Turbolinks can be great for some projects. I buy some of the Basecamp koolade, and prefer not to write SPAs if I don’t need to. But for a new user it’s a massive source of confusion. I’ve seen it screw up experienced coders, who write awful code basically just to work around it. It makes lots of off-the-shelf widgets require extra vigilance and vetting to see if they cause any issues.

Then we get into minor stuff:

  1. I think every project I have ever worked on has needed authentication, and often a separate admin area. Rails should at least provide some guidance here even if Devise is not be included by default.
  2. On the flip-side, too many gems are included by default now. Slows boot time, confuses newbies. Many projects don’t need ActionMailer, ActiveJob, ActionCable, the rich text editor, etc. Should all be commented out in the Gemfile and opt-in IMO. I am less upset about this, because Rails is omakase and that’s fine.
  3. If it’s not already gone, please get rid of CoffeeScript. It used to be nice, but has since been made obsolete by ES6 and other better compile-to-JS languages.
  4. ActiveJob has way too many stack frames. It’s ridiculous to debug.
4 Likes

We should pay attention to Bootsnap problems if they occur and document / open bugs. In Spring I think we can explain the problem at least (it has to do with e.g changing / adding files causing missing constants correct me if I’m wrong)

For me, it had to do with changing Ruby versions or accidentally sharing the bootsnap cache between different platforms (e.g. Docker for Mac). To fix a serious bootsnap issue in production following a Ruby update, I once had to shut down the entire Passenger server before it would let me delete the bootsnap cache.

@wmakley Thank you for the detail around conditions you’ve seen cause the Bootsnap cache to become corrupted. Can you remember anything else?

Some more specific questions in case they shake anything loose:

  • Any other things that have caused Bootsnap to go weird?
  • What did the error messages you saw look like?
  • Why did you need to shut down the entire server to delete the Bootsnap cache that one time in production?

As to your other thoughts – some of them echo threads with more active discussion. I’d love it if you could check out:

and see if you have any thoughts you can share there?

1 Like

On one of my older projects, I remember getting LoadErrors when creating new helpers, especially when they were namespaced under a new directory. Thing is, the LoadError would name an existing helper file, not the new one. Restarting server fixed the problem.