<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ernesto Tagwerker (he/him)</title>
    <description>The latest articles on DEV Community by Ernesto Tagwerker (he/him) (@etagwerker).</description>
    <link>https://dev.to/etagwerker</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F69379%2F614aefdc-d82c-47eb-ba89-134cfa351a69.jpeg</url>
      <title>DEV Community: Ernesto Tagwerker (he/him)</title>
      <link>https://dev.to/etagwerker</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/etagwerker"/>
    <language>en</language>
    <item>
      <title>Moving Rails CSS From Sprockets to Propshaft</title>
      <dc:creator>Ernesto Tagwerker (he/him)</dc:creator>
      <pubDate>Thu, 26 Nov 2026 05:00:00 +0000</pubDate>
      <link>https://dev.to/fastruby/moving-rails-css-from-sprockets-to-propshaft-4pip</link>
      <guid>https://dev.to/fastruby/moving-rails-css-from-sprockets-to-propshaft-4pip</guid>
      <description>&lt;p&gt;At FastRuby.io, in some Ruby on Rails applications we have worked on, we found that the JavaScript had moved to a bundler but Sprockets still compiled the CSS through &lt;code&gt;sass-rails&lt;/code&gt;. In a &lt;a href="https://www.fastruby.io/blog/migrate-rails-app-from-sprockets-to-esbuild" rel="noopener noreferrer"&gt;previous article&lt;/a&gt;, I covered the JavaScript half of that move, and this one covers the CSS half.&lt;/p&gt;

&lt;p&gt;Recently we replaced Sprockets with &lt;a href="https://github.com/rails/propshaft" rel="noopener noreferrer"&gt;Propshaft&lt;/a&gt; and &lt;a href="https://github.com/rails/cssbundling-rails" rel="noopener noreferrer"&gt;cssbundling-rails&lt;/a&gt; in a customer’s application. Propshaft mostly fingerprints and serves files, so the Sass CLI has to compile the CSS before Rails ever sees it. The application used Bootstrap 4, vendored locally along with a few plugins, so that is the stylesheet we had to move.&lt;/p&gt;

&lt;p&gt;In this article, you will learn how to replace Sprockets with Propshaft, convert a Sprockets CSS manifest into a Sass entry point built by cssbundling-rails, and fix what breaks once Sprockets is no longer compiling your assets for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Starting Point
&lt;/h2&gt;

&lt;p&gt;The application was on Rails 7.2 and had already moved its JavaScript to esbuild with &lt;code&gt;jsbundling-rails&lt;/code&gt;, which writes &lt;code&gt;app/assets/builds/application.js&lt;/code&gt;. CSS was a different story. These were the relevant lines in the &lt;code&gt;Gemfile&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Sass integration&lt;/span&gt;
&lt;span class="n"&gt;gem&lt;/span&gt; &lt;span class="s2"&gt;"sass-rails"&lt;/span&gt;

&lt;span class="c1"&gt;# Modern JavaScript bundling with esbuild&lt;/span&gt;
&lt;span class="n"&gt;gem&lt;/span&gt; &lt;span class="s2"&gt;"jsbundling-rails"&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sprockets decided what was publicly available through &lt;code&gt;app/assets/config/manifest.js&lt;/code&gt;. Ours linked the images, the main stylesheet, every plain CSS file in the stylesheets directory, and the build output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="o"&gt;//=&lt;/span&gt; &lt;span class="n"&gt;link_tree&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;images&lt;/span&gt;
&lt;span class="o"&gt;//=&lt;/span&gt; &lt;span class="n"&gt;link&lt;/span&gt; &lt;span class="n"&gt;application&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;bootstrap4&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;css&lt;/span&gt;
&lt;span class="o"&gt;//=&lt;/span&gt; &lt;span class="n"&gt;link_directory&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;stylesheets&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;css&lt;/span&gt;
&lt;span class="o"&gt;//=&lt;/span&gt; &lt;span class="n"&gt;link_tree&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;builds&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The main stylesheet, which pulled in Bootstrap 4, was a CSS file with Sprockets directives in a comment block at the top, followed by a few plain CSS rules. The file names below are generalized, but the shape is the same as the real one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="cm"&gt;/*
*= require ./theme/contents
*= require bootstrap-select.min.css
*= require feature_styles
*= require_self
*/&lt;/span&gt;

&lt;span class="cm"&gt;/* ...a few plain CSS rules... */&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The application’s layouts loaded it with &lt;code&gt;stylesheet_link_tag "application-bootstrap4", media: "all"&lt;/code&gt;. There was also an &lt;code&gt;application.css&lt;/code&gt; file left over from a much older version of the application, full of &lt;code&gt;*= require&lt;/code&gt; lines, which no layout used anymore. We deleted it during the migration, but it is a good reminder to look for dead code before you start, since a &lt;code&gt;*= require&lt;/code&gt; line in a file nobody loads is easy to mistake for something that matters.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Propshaft Does
&lt;/h2&gt;

&lt;p&gt;Sprockets does several jobs at once. It resolves &lt;code&gt;*= require&lt;/code&gt; directives, compiles Sass and ERB, concatenates files, and fingerprints the result. Propshaft mostly just fingerprints. It looks through the asset directories of your application and its gems, adds a digest to each file name, and serves the files. In production, &lt;code&gt;assets:precompile&lt;/code&gt; copies them with their digests into &lt;code&gt;public/assets&lt;/code&gt;. It copies every file in the asset directories, not only the ones a manifest lists, which is a real difference from Sprockets. If you want to know how Rails ended up with so many asset tools, our article about &lt;a href="https://www.fastruby.io/blog/the-assets-pipeline-history" rel="noopener noreferrer"&gt;the history of the asset pipeline&lt;/a&gt; covers Sprockets, Webpacker and the rest. And if you’re not sure you need to move off Sprockets at all, &lt;a href="https://www.fastruby.io/blog/navigating-asset-management-madness" rel="noopener noreferrer"&gt;Navigating Asset Management Madness in Rails&lt;/a&gt; walks through the options for each Rails version.&lt;/p&gt;

&lt;p&gt;Propshaft does rewrite &lt;code&gt;url()&lt;/code&gt; references inside CSS files so they point to the fingerprinted images and fonts (it updates source map comments in the same way), but it doesn’t run Sass, ERB or Sprockets directives on the file. A &lt;code&gt;*= require&lt;/code&gt; line is just a comment, a &lt;code&gt;.scss&lt;/code&gt; file is just text, and ERB inside a &lt;code&gt;.css.erb&lt;/code&gt; file is never evaluated. Anything Sprockets used to generate now has to exist before Rails serves it, which is where cssbundling-rails comes in. Rails 8 made Propshaft the default for new applications, but it also works on Rails 7.0 and 7.1, and we ran it on Rails 7.2.&lt;/p&gt;

&lt;h2&gt;
  
  
  Adding cssbundling-rails and Sass
&lt;/h2&gt;

&lt;p&gt;The first step is to give the CSS its own build. We added &lt;code&gt;gem "cssbundling-rails"&lt;/code&gt; to the &lt;code&gt;Gemfile&lt;/code&gt; next to &lt;code&gt;jsbundling-rails&lt;/code&gt;, and then we added &lt;code&gt;sass&lt;/code&gt; as a development dependency in &lt;code&gt;package.json&lt;/code&gt;, along with a &lt;code&gt;build:css&lt;/code&gt; script. The script is what &lt;code&gt;cssbundling-rails&lt;/code&gt; runs, so the name matters:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"devDependencies"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"sass"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"^1.77.0"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"build:css"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"sass ./app/assets/stylesheets/application-bootstrap4.scss:./app/assets/builds/application-bootstrap4.css --no-source-map --load-path=node_modules --load-path=app/assets/stylesheets --load-path=vendor/assets/stylesheets"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The command takes an &lt;code&gt;input:output&lt;/code&gt; pair. The input is the entry point we create in the next section, and the output goes to &lt;code&gt;app/assets/builds&lt;/code&gt;, the same directory &lt;code&gt;jsbundling-rails&lt;/code&gt; already writes to. Propshaft finds the compiled file there, and because the output keeps the name &lt;code&gt;application-bootstrap4.css&lt;/code&gt;, the &lt;code&gt;stylesheet_link_tag&lt;/code&gt; calls in the layouts didn’t need to change.&lt;/p&gt;

&lt;p&gt;The three &lt;code&gt;--load-path&lt;/code&gt; flags tell Sass where to look when it sees an &lt;code&gt;@import&lt;/code&gt;. &lt;code&gt;node_modules&lt;/code&gt; is for packages installed with npm, &lt;code&gt;app/assets/stylesheets&lt;/code&gt; is for our own files, and &lt;code&gt;vendor/assets/stylesheets&lt;/code&gt; is where the Bootstrap plugin’s stylesheet lived. We also added a &lt;code&gt;build:css:watch&lt;/code&gt; script, which is the same command with &lt;code&gt;--watch&lt;/code&gt; at the end.&lt;/p&gt;

&lt;p&gt;We wrote all of this by hand, but cssbundling-rails also ships an installer for it: &lt;code&gt;bin/rails css:install:sass&lt;/code&gt;, with variants for &lt;code&gt;bootstrap&lt;/code&gt;, &lt;code&gt;bulma&lt;/code&gt;, &lt;code&gt;postcss&lt;/code&gt; and &lt;code&gt;tailwind&lt;/code&gt;. On a fresh Rails 8 app, the Sass installer creates &lt;code&gt;app/assets/stylesheets/application.sass.scss&lt;/code&gt;, adds &lt;code&gt;sass&lt;/code&gt; and a &lt;code&gt;build:css&lt;/code&gt; script to &lt;code&gt;package.json&lt;/code&gt;, and adds a CSS watcher to &lt;code&gt;Procfile.dev&lt;/code&gt;. It also deletes &lt;code&gt;app/assets/stylesheets/application.css&lt;/code&gt;, and if there is a Sprockets &lt;code&gt;manifest.js&lt;/code&gt;, it removes the &lt;code&gt;link_directory ../stylesheets .css&lt;/code&gt; line from it and adds &lt;code&gt;//= link_tree ../builds&lt;/code&gt;. The new entry point is empty, so it doesn’t convert an existing manifest for you.&lt;/p&gt;

&lt;p&gt;For a new app, or one with a simple stylesheet, the installer is the faster and less error-prone route. We skipped it for four reasons: we wanted to keep the existing &lt;code&gt;application-bootstrap4&lt;/code&gt; file name so the layouts wouldn’t change, Bootstrap 4 was vendored and not installed from npm, we needed an extra load path for &lt;code&gt;vendor/assets/stylesheets&lt;/code&gt;, and we didn’t want a tool deleting &lt;code&gt;application.css&lt;/code&gt; before we had read it. If you are in the same position, hand-edit. Otherwise, run the installer on a branch and review the diff before you commit it.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cssbundling-rails&lt;/code&gt; also hooks into &lt;code&gt;assets:precompile&lt;/code&gt;. In version 1.4.3, which is what we had installed, the task runs &lt;code&gt;css:build&lt;/code&gt; first. The gem picks the package manager from the lockfile it finds, so it ran &lt;code&gt;npm run build:css&lt;/code&gt; for us because we have a &lt;code&gt;package-lock.json&lt;/code&gt; (a project with a &lt;code&gt;yarn.lock&lt;/code&gt; would get &lt;code&gt;yarn build:css&lt;/code&gt; instead). It runs the matching install command first, &lt;code&gt;npm install&lt;/code&gt; in our case, unless you set &lt;code&gt;SKIP_YARN_INSTALL&lt;/code&gt;. Despite the name, that variable skips the install step for npm and pnpm too. If your deploy runs &lt;code&gt;assets:precompile&lt;/code&gt;, it now builds the CSS inside that task, so our article about &lt;a href="https://www.fastruby.io/blog/speed-up-assets-precompile" rel="noopener noreferrer"&gt;speeding up assets precompilation&lt;/a&gt; is worth a look if the step feels slow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Converting the Manifest to a Sass Entry Point
&lt;/h2&gt;

&lt;p&gt;Sass doesn’t know what a &lt;code&gt;*= require&lt;/code&gt; directive is, so the manifest from the first section needs to become a real Sass file. We renamed &lt;code&gt;application-bootstrap4.css&lt;/code&gt; to &lt;code&gt;application-bootstrap4.scss&lt;/code&gt; and replaced each directive with an &lt;code&gt;@import&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Entry point compiled by cssbundling-rails (Sass CLI)&lt;/span&gt;
&lt;span class="c1"&gt;// Output: app/assets/builds/application-bootstrap4.css&lt;/span&gt;

&lt;span class="c1"&gt;// Bootstrap 4 core (vendored locally) + custom styles&lt;/span&gt;
&lt;span class="k"&gt;@import&lt;/span&gt; &lt;span class="s1"&gt;'theme/contents'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Bootstrap-select plugin (from vendor/assets/stylesheets via --load-path)&lt;/span&gt;
&lt;span class="k"&gt;@import&lt;/span&gt; &lt;span class="s1"&gt;'bootstrap-select.min'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Feature-specific styles&lt;/span&gt;
&lt;span class="k"&gt;@import&lt;/span&gt; &lt;span class="s1"&gt;'feature_styles'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="cm"&gt;/* ...a few plain CSS rules... */&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are two small differences from the original. The &lt;code&gt;.css&lt;/code&gt; extension is gone from &lt;code&gt;bootstrap-select.min&lt;/code&gt;, because Sass finds the file through the load paths we configured in the previous section. And there is no equivalent of &lt;code&gt;require_self&lt;/code&gt;. In Sprockets it decided where the file’s own rules landed relative to the required files, and here the plain CSS rules simply come after the imports, which is where &lt;code&gt;require_self&lt;/code&gt; was in our manifest anyway. If yours sits in the middle of the list, move the rules to match.&lt;/p&gt;

&lt;p&gt;The build works after this change, but it’s noisy. With Sass 1.98.0, which is what our lockfile resolved to, &lt;code&gt;npm run build:css&lt;/code&gt; exits successfully and prints about 420 deprecation warnings. They come in five types (&lt;code&gt;import&lt;/code&gt;, &lt;code&gt;slash-div&lt;/code&gt;, &lt;code&gt;if-function&lt;/code&gt;, &lt;code&gt;global-builtin&lt;/code&gt; and &lt;code&gt;color-functions&lt;/code&gt;), and most come from Bootstrap 4’s own SCSS, which was written long before Sass deprecated those features. The &lt;code&gt;import&lt;/code&gt; warnings also point at our own entry point, since &lt;code&gt;@import&lt;/code&gt; itself is one of the deprecated features. Sass prints the first few of each type and then says “398 repetitive deprecation warnings omitted”. We didn’t touch the vendored Bootstrap files as part of this migration, so the warnings are still there.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;import&lt;/code&gt; warnings are the ones to keep an eye on, because Sass says &lt;code&gt;@import&lt;/code&gt; will be removed in Dart Sass 3.0.0. The vendored Bootstrap 4.5 SCSS uses &lt;code&gt;@import&lt;/code&gt; throughout and we found no &lt;code&gt;@use&lt;/code&gt; in it, so moving to &lt;code&gt;@use&lt;/code&gt; would probably mean changing Bootstrap’s own files, and we left that out of this migration. If you want to move your own stylesheets to &lt;code&gt;@use&lt;/code&gt;, our article about &lt;a href="https://www.fastruby.io/blog/Migrating-from-sass-rails-to-Dart-Sass" rel="noopener noreferrer"&gt;migrating from sass-rails to Dart Sass&lt;/a&gt; covers the &lt;code&gt;@use&lt;/code&gt; change and the Sass Migrator. Our &lt;code&gt;^1.77.0&lt;/code&gt; range for &lt;code&gt;sass&lt;/code&gt; in &lt;code&gt;package.json&lt;/code&gt; doesn’t pull in a 3.x release by itself, so nothing breaks until someone chooses to upgrade.&lt;/p&gt;

&lt;h2&gt;
  
  
  Swapping Gems and Deleting Sprockets Config
&lt;/h2&gt;

&lt;p&gt;With the CSS building on its own, the Sprockets-specific parts could go. In the &lt;code&gt;Gemfile&lt;/code&gt;, we removed &lt;code&gt;sass-rails&lt;/code&gt; and added &lt;code&gt;propshaft&lt;/code&gt; (&lt;code&gt;cssbundling-rails&lt;/code&gt; was already there from the previous step):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;&lt;span class="gd"&gt;-gem "sass-rails"&lt;/span&gt;
&lt;span class="gi"&gt;+gem "propshaft"&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then we deleted the files that only Sprockets read. The first is &lt;code&gt;app/assets/config/manifest.js&lt;/code&gt;, the one shown at the beginning. The second is &lt;code&gt;config/initializers/assets.rb&lt;/code&gt;, which held three things: an asset version, a line adding &lt;code&gt;node_modules&lt;/code&gt; to the asset load path, and a list of image extensions to precompile. We didn’t need any of it, but whether yours is safe to delete depends on which of the three you have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The image extensions are never needed. Propshaft has no precompile list and copies every image in the asset directories.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;node_modules&lt;/code&gt; line is only needed if you serve files from &lt;code&gt;node_modules&lt;/code&gt; through asset helpers, and it has a cost, because Propshaft copies everything under its asset paths. Sass finds npm packages through the &lt;code&gt;--load-path&lt;/code&gt; flags instead.&lt;/li&gt;
&lt;li&gt;The asset version still works. Propshaft mixes &lt;code&gt;config.assets.version&lt;/code&gt; into every digest, so if you bump it on purpose to expire cached assets, keep that line. Ours was Rails’ default &lt;code&gt;"1.0"&lt;/code&gt;, and deleting the file dropped it to Propshaft’s default of &lt;code&gt;"1"&lt;/code&gt;, so every digest changed once on the first deploy.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You might wonder if leaving &lt;code&gt;assets.rb&lt;/code&gt; in place would break anything. When we reproduced it in development, the application booted without errors. A line like &lt;code&gt;config.assets.precompile += [...]&lt;/code&gt; would normally fail if the setting didn’t exist, but Propshaft defines placeholders for &lt;code&gt;precompile&lt;/code&gt;, &lt;code&gt;compile&lt;/code&gt;, &lt;code&gt;debug&lt;/code&gt; and the two compressors (an empty array for &lt;code&gt;precompile&lt;/code&gt;, &lt;code&gt;nil&lt;/code&gt; for the rest), so Sprockets-era code still loads. Propshaft ignores those settings, so our precompile list did nothing, and we didn’t need the other two lines either, so we deleted the file.&lt;/p&gt;

&lt;p&gt;The last change was in &lt;code&gt;config/environments/production.rb&lt;/code&gt;. It had a commented-out &lt;code&gt;css_compressor&lt;/code&gt; line and &lt;code&gt;config.assets.compile = true&lt;/code&gt;, which told Sprockets to compile any asset missing from &lt;code&gt;public/assets&lt;/code&gt; at request time. Propshaft doesn’t compile anything, so that setting should have nothing to do anymore. We replaced both with a comment describing who does what now: esbuild builds the JavaScript, Sass builds the CSS, and Propshaft serves the results.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Broke
&lt;/h2&gt;

&lt;p&gt;Most of the migration was uneventful, but a few things didn’t survive the switch. The most important thing to know is when they fail. Propshaft raises an error when a view asks for an asset that isn’t in the load path, so these problems show up when the page renders and not when the application boots or when you precompile. These are the two errors we saw when we reproduced them, with the file names generalized:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Propshaft::MissingAssetError: The asset 'pdf_scripts.js' was not found in the load path.
Propshaft::MissingAssetError: The asset 'pdf-fonts.css' was not found in the load path.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first one came from two PDF views that included a script which did not exist in the application. We removed the helper call from both views. If you generate PDFs with &lt;code&gt;wicked_pdf&lt;/code&gt;, be aware that its own helper reports a missing asset differently. When we reproduced it by calling &lt;code&gt;wicked_pdf_javascript_include_tag&lt;/code&gt; with a script that was not there, we got &lt;code&gt;undefined local variable or method 'content' for an instance of WickedPdf::WickedPdfHelper::Assets::PropshaftAsset&lt;/code&gt; instead of &lt;code&gt;MissingAssetError&lt;/code&gt;. The message is misleading, and the cause is the same missing file.&lt;/p&gt;

&lt;p&gt;The second error came from a stylesheet named &lt;code&gt;pdf-fonts.css.erb&lt;/code&gt;. It contained nothing but an ERB comment. Propshaft doesn’t process ERB, and it looks for the file by its full name, so the &lt;code&gt;pdf-fonts.css&lt;/code&gt; that the view asked for didn’t exist. Renaming the file to &lt;code&gt;pdf-fonts.css&lt;/code&gt; was enough, since there were no ERB directives to evaluate. If you do have real ERB in your CSS, you will need to generate that file before Propshaft sees it.&lt;/p&gt;

&lt;p&gt;Two other things are not errors, but they can confuse you. The first is that &lt;code&gt;assets:precompile&lt;/code&gt; in development leaves a &lt;code&gt;public/assets/.manifest.json&lt;/code&gt; behind, and Propshaft serves from it. Propshaft warns about it (“Rails will not serve any changed assets until you delete public/assets/.manifest.json”), but it is easy to miss. When we reproduced the &lt;code&gt;.erb&lt;/code&gt; case after a precompile, the page still found a fingerprinted &lt;code&gt;pdf-fonts&lt;/code&gt; file, and the error only appeared after we deleted &lt;code&gt;public/assets&lt;/code&gt;. If you have precompiled locally, delete that directory before you decide that a fix worked or that a problem is gone. This isn’t specific to Propshaft. Sprockets and Webpacker also write manifest files when you precompile (&lt;code&gt;.sprockets-manifest-*.json&lt;/code&gt; in &lt;code&gt;public/assets&lt;/code&gt;, &lt;code&gt;manifest.json&lt;/code&gt; in &lt;code&gt;public/packs&lt;/code&gt;), and leftover precompiled assets can hide changes in development with them too.&lt;/p&gt;

&lt;p&gt;The second is that Propshaft also fingerprinted and copied &lt;code&gt;application-bootstrap4.scss&lt;/code&gt; into &lt;code&gt;public/assets&lt;/code&gt;, next to the compiled CSS. This is the copy-everything behavior from earlier, since the Sass source lives in &lt;code&gt;app/assets/stylesheets&lt;/code&gt;. As far as we could tell it’s harmless, but it surprised us.&lt;/p&gt;

&lt;h2&gt;
  
  
  Running the CSS Build
&lt;/h2&gt;

&lt;p&gt;Propshaft only serves files that already exist in its asset directories, and &lt;code&gt;app/assets/builds&lt;/code&gt; is gitignored in our application, so the compiled CSS only exists where something builds it. In practice that means every place that used to depend on Sprockets compiling on demand now needs a build step. We touched three of them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Procfile.dev
css: npm run build:css -- --watch

# Dockerfile
RUN npm run build
RUN npm run build:css

# GitHub Actions setup action
- name: Build CSS assets
  run: npm run build:css

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In development, the &lt;code&gt;Procfile.dev&lt;/code&gt; entry runs Sass in watch mode next to the Rails server and the esbuild watcher, so a change in a &lt;code&gt;.scss&lt;/code&gt; file is rebuilt, and Propshaft checks for updated assets before each request. Without the watcher, you would be looking at whatever CSS was built last. In the Dockerfile, the new line sits right after the existing JavaScript build. In CI, we added the CSS build to the shared setup action, and we added the JavaScript build there too, so the test environment has both bundles before the tests start. We needed this step because our CI never runs &lt;code&gt;assets:precompile&lt;/code&gt;, so the &lt;code&gt;css:build&lt;/code&gt; hook from earlier never fires there. cssbundling-rails also hooks &lt;code&gt;css:build&lt;/code&gt; into &lt;code&gt;test:prepare&lt;/code&gt;, &lt;code&gt;spec:prepare&lt;/code&gt; and &lt;code&gt;db:test:prepare&lt;/code&gt;, so if your CI runs one of those, your CSS may already be built. If you want to see how the Docker and &lt;code&gt;Procfile&lt;/code&gt; changes fit into a full development workflow, we described them in more detail in our article about &lt;a href="https://www.fastruby.io/blog/migrate-rails-app-from-sprockets-to-esbuild" rel="noopener noreferrer"&gt;migrating from Sprockets to esbuild&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this article, we talked about replacing Sprockets with Propshaft and cssbundling-rails. We added the gem and the &lt;code&gt;sass&lt;/code&gt; package, converted a &lt;code&gt;*= require&lt;/code&gt; manifest into a Sass entry point, removed &lt;code&gt;sass-rails&lt;/code&gt; and the Sprockets configuration files, and made sure the CSS gets built in development, Docker and CI. We also looked at what stopped working along the way: a missing script and an ERB stylesheet. A stale &lt;code&gt;public/assets&lt;/code&gt; directory hid the ERB stylesheet error until we deleted it.&lt;/p&gt;

&lt;p&gt;Propshaft does a lot less than Sprockets, so what breaks in your application depends on what Sprockets was doing for you. Before you start, search for &lt;code&gt;*= require&lt;/code&gt; directives, stylesheets that end in &lt;code&gt;.erb&lt;/code&gt;, and views that ask for assets that may not exist anymore. It’s also worth noting that everything we reproduced for this article ran in development mode, so check your production settings, such as a leftover &lt;code&gt;config.assets.compile&lt;/code&gt;, before you deploy.&lt;/p&gt;

&lt;p&gt;Has your team been struggling to move off Sprockets as part of an upgrade? &lt;a href="https://www.fastruby.io/#contactus" rel="noopener noreferrer"&gt;We can help.&lt;/a&gt;&lt;/p&gt;

</description>
      <category>rails</category>
    </item>
    <item>
      <title>Mirroring a Private Docker Image for Render</title>
      <dc:creator>Ernesto Tagwerker (he/him)</dc:creator>
      <pubDate>Mon, 23 Nov 2026 16:12:17 +0000</pubDate>
      <link>https://dev.to/fastruby/mirroring-a-private-docker-image-for-render-48gb</link>
      <guid>https://dev.to/fastruby/mirroring-a-private-docker-image-for-render-48gb</guid>
      <description>&lt;p&gt;We recently moved a client’s Ruby on Rails app from Heroku to Render. Most of the services around it were built by the client’s own Dockerfiles and scripts, but &lt;a href="https://imgproxy.net/" rel="noopener noreferrer"&gt;imgproxy&lt;/a&gt; Pro, an image processing server, ran straight from an upstream image. imgproxy publishes the Pro version to its own private registry, &lt;code class="language-plaintext highlighter-rouge"&gt;docker.imgproxy.pro&lt;/code&gt;, and on Heroku the client deployed that image with nothing but configuration on top.&lt;/p&gt;

&lt;p&gt;Setting up imgproxy Pro on Render the same way doesn’t work. If you enter that image URL for a new service in the Render dashboard, you get this message:&lt;/p&gt;

&lt;pre class="highlight"&gt;&lt;code&gt;No public image found. It looks like you may be using a private image - please add a credential or check the image URL for mistakes.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The image URL was fine, so adding a credential was the way forward. That’s where I got stuck, because Render can only authenticate to a handful of registries for private images, and imgproxy’s registry isn’t one of them. In this article, you’ll see why Render couldn’t pull the image, how I mirrored it into GitHub Container Registry with a small GitHub Actions workflow, how to keep the mirrored package private, and how to give Render a credential to pull it.&lt;/p&gt;

&lt;h2 id="why-render-couldnt-pull-the-image"&gt;Why Render couldn’t pull the image&lt;/h2&gt;

&lt;p&gt;Render can deploy a service straight from a prebuilt Docker image, and for public images, it doesn’t much care where they live: &lt;a href="https://render.com/docs/deploying-an-image" rel="noopener noreferrer"&gt;it can pull them from any registry it can reach&lt;/a&gt;. Private images are a different story. To pull one, Render needs a registry credential, and as of October 2026, it only supports credentials for five registries: Docker Hub, GitHub Container Registry (GHCR), GitLab Container Registry, Google Artifact Registry, and Amazon ECR.&lt;/p&gt;

&lt;p&gt;imgproxy Pro is a paid version of imgproxy, so its image is private, and &lt;code class="language-plaintext highlighter-rouge"&gt;docker.imgproxy.pro&lt;/code&gt; isn’t on that list. There was no credential I could give Render that would let it log in. So the image had to live somewhere Render could authenticate to. In principle, any registry on that list would do, so it came down to which one the client already used.&lt;/p&gt;

&lt;h2 id="mirroring-the-image-into-ghcr"&gt;Mirroring the image into GHCR&lt;/h2&gt;

&lt;p&gt;The client’s ops repo already published its other images to GHCR, so that was the obvious place for a copy of imgproxy Pro, at &lt;code class="language-plaintext highlighter-rouge"&gt;ghcr.io/your-org/imgproxy&lt;/code&gt;. Before automating anything, I pushed the first copy by hand. I hadn’t added an image to GHCR before, and I wanted to know how the process worked before writing a workflow around it.&lt;/p&gt;

&lt;p&gt;I pulled the tag from imgproxy’s registry, retagged it for GHCR, and pushed it. Logging in to GHCR takes a classic personal access token with the &lt;code class="language-plaintext highlighter-rouge"&gt;write:packages&lt;/code&gt; scope:&lt;/p&gt;

&lt;pre class="highlight"&gt;&lt;code&gt;docker login &lt;span class="nt"&gt;-u&lt;/span&gt; imgproxy docker.imgproxy.pro
docker pull docker.imgproxy.pro/imgproxy:vX.Y.Z
docker tag docker.imgproxy.pro/imgproxy:vX.Y.Z ghcr.io/&amp;lt;your-org&amp;gt;/imgproxy:vX.Y.Z
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$GITHUB_PAT&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | docker login ghcr.io &lt;span class="nt"&gt;--username&lt;/span&gt; &amp;lt;user&amp;gt; &lt;span class="nt"&gt;--password-stdin&lt;/span&gt;
docker push ghcr.io/&amp;lt;your-org&amp;gt;/imgproxy:vX.Y.Z
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Pulling and pushing like this only copies the platform your machine pulled. Render runs &lt;code class="language-plaintext highlighter-rouge"&gt;linux/amd64&lt;/code&gt; images, so if you do this from an Apple Silicon Mac, add &lt;code class="language-plaintext highlighter-rouge"&gt;--platform linux/amd64&lt;/code&gt; to the &lt;code class="language-plaintext highlighter-rouge"&gt;docker pull&lt;/code&gt;. The workflow below uses &lt;code class="language-plaintext highlighter-rouge"&gt;docker buildx imagetools create&lt;/code&gt; instead, which copies the image between registries without pulling it first and keeps every platform the upstream tag has.&lt;/p&gt;

&lt;p&gt;With the copy in place, the service on Render builds from a Dockerfile in the ops repo instead of deploying the image directly, so the imgproxy version lives in the repo and changes to it go through a normal merge. Most Dockerfiles do real work (I wrote about &lt;a href="https://www.fastruby.io/blog/why-to-use-a-multi-stage-dockerfile" rel="noopener noreferrer"&gt;multi-stage Dockerfiles&lt;/a&gt; for Ruby apps recently), but this one is deliberately boring. Here’s a simplified version (the organization name and version are placeholders):&lt;/p&gt;

&lt;pre class="highlight"&gt;&lt;code&gt;&lt;span class="c"&gt;# The mirror workflow reads this line, so upgrading imgproxy means changing it.&lt;/span&gt;
&lt;span class="k"&gt;ARG&lt;/span&gt;&lt;span class="s"&gt; IMGPROXY_VERSION=vX.Y.Z&lt;/span&gt;

&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; ghcr.io/your-org/imgproxy:${IMGPROXY_VERSION}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That’s the whole file. All of imgproxy’s configuration comes from environment variables, which we set in the service’s &lt;code class="language-plaintext highlighter-rouge"&gt;render.yaml&lt;/code&gt; Blueprint, so there was nothing to add to the image. Keeping the Dockerfile this thin means the mirrored image is the same image imgproxy ships, and the only thing that changes from one release to the next is the version.&lt;/p&gt;

&lt;p&gt;The &lt;code class="language-plaintext highlighter-rouge"&gt;ARG&lt;/code&gt; before &lt;code class="language-plaintext highlighter-rouge"&gt;FROM&lt;/code&gt; is what lets the version live in one place. It’s also what the mirror workflow reads to know which tag to copy, which brings us to keeping the copy up to date.&lt;/p&gt;

&lt;h2 id="keeping-the-mirror-in-sync"&gt;Keeping the mirror in sync&lt;/h2&gt;

&lt;p&gt;A copy pushed by hand is fine until imgproxy releases a new version. To avoid someone having to remember to copy every new tag, I added a GitHub Actions workflow to the ops repo that does it whenever the version changes. Here’s a simplified version of it (the organization and the secret names are placeholders):&lt;/p&gt;

&lt;pre class="highlight"&gt;&lt;code&gt;&lt;span class="c1"&gt;# .github/workflows/mirror_imgproxy.yml&lt;/span&gt;
&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Mirror imgproxy Pro&lt;/span&gt;

&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;push&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;branches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;main&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;production&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
    &lt;span class="na"&gt;paths&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;imgproxy-pro/Dockerfile&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;.github/workflows/mirror_imgproxy.yml&lt;/span&gt;

&lt;span class="na"&gt;permissions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;contents&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;read&lt;/span&gt;
  &lt;span class="na"&gt;packages&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;write&lt;/span&gt;

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;mirror&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v7&lt;/span&gt;

      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Read the imgproxy version from the Dockerfile&lt;/span&gt;
        &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;version&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
          &lt;span class="s"&gt;echo "tag=$(sed -n 's/^ARG IMGPROXY_VERSION=//p' imgproxy-pro/Dockerfile)" &amp;gt;&amp;gt; "$GITHUB_OUTPUT"&lt;/span&gt;

      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;docker/setup-buildx-action@v4&lt;/span&gt;

      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;docker/login-action@v4&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;registry&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;docker.imgproxy.pro&lt;/span&gt;
          &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.IMGPROXY_PRO_USERNAME }}&lt;/span&gt;
          &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.IMGPROXY_PRO_PASSWORD }}&lt;/span&gt;

      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;docker/login-action@v4&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;registry&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ghcr.io&lt;/span&gt;
          &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ github.actor }}&lt;/span&gt;
          &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.GITHUB_TOKEN }}&lt;/span&gt;

      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Copy the tag unless it's already mirrored&lt;/span&gt;
        &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;SOURCE&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;docker.imgproxy.pro/imgproxy:${{ steps.version.outputs.tag }}&lt;/span&gt;
          &lt;span class="na"&gt;TARGET&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ghcr.io/your-org/imgproxy:${{ steps.version.outputs.tag }}&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
          &lt;span class="s"&gt;if docker buildx imagetools inspect "$TARGET" &amp;gt; /dev/null 2&amp;gt;&amp;amp;1; then&lt;/span&gt;
            &lt;span class="s"&gt;echo "$TARGET is already mirrored, nothing to do."&lt;/span&gt;
          &lt;span class="s"&gt;else&lt;/span&gt;
            &lt;span class="s"&gt;docker buildx imagetools create --tag "$TARGET" "$SOURCE"&lt;/span&gt;
          &lt;span class="s"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The workflow only runs when the Dockerfile or the workflow itself changes on the &lt;code class="language-plaintext highlighter-rouge"&gt;main&lt;/code&gt; or &lt;code class="language-plaintext highlighter-rouge"&gt;production&lt;/code&gt; branches. It reads the version from the &lt;code class="language-plaintext highlighter-rouge"&gt;ARG&lt;/code&gt; line, logs in to both registries, and checks whether that tag is already in GHCR. If it isn’t, &lt;code class="language-plaintext highlighter-rouge"&gt;docker buildx imagetools create&lt;/code&gt; copies it over from imgproxy’s registry (Docker documents this approach in its guide to &lt;a href="https://docs.docker.com/build/ci/github-actions/copy-image-registries/" rel="noopener noreferrer"&gt;copying images between registries&lt;/a&gt;). If it is, the workflow does nothing. The push only works once the package is linked to the ops repo, which the next section covers.&lt;/p&gt;

&lt;p&gt;The workflow does run more than once for the same version. When a version bump is merged to &lt;code class="language-plaintext highlighter-rouge"&gt;main&lt;/code&gt;, the workflow copies the new tag. When &lt;code class="language-plaintext highlighter-rouge"&gt;main&lt;/code&gt; is later merged to &lt;code class="language-plaintext highlighter-rouge"&gt;production&lt;/code&gt;, the workflow runs again, finds the tag already there, and stops. Editing the workflow file also triggers a run. Copying the same tag twice wouldn’t break anything, but the check skips the repeated copy, and it means a tag that’s already mirrored never gets silently replaced if imgproxy re-pushes it upstream.&lt;/p&gt;

&lt;p&gt;Because changes reach &lt;code class="language-plaintext highlighter-rouge"&gt;main&lt;/code&gt; before &lt;code class="language-plaintext highlighter-rouge"&gt;production&lt;/code&gt;, the new tag is already in GHCR by the time Render needs it. Render deploys the imgproxy service from the &lt;code class="language-plaintext highlighter-rouge"&gt;production&lt;/code&gt; branch, so when a version bump gets there, the mirror has already copied that tag during the earlier merge to &lt;code class="language-plaintext highlighter-rouge"&gt;main&lt;/code&gt;. That holds as long as the bump goes through &lt;code class="language-plaintext highlighter-rouge"&gt;main&lt;/code&gt; first and the mirror run there succeeds.&lt;/p&gt;

&lt;p&gt;So upgrading imgproxy Pro comes down to changing &lt;code class="language-plaintext highlighter-rouge"&gt;IMGPROXY_VERSION&lt;/code&gt; in the Dockerfile and merging it like any other change.&lt;/p&gt;

&lt;h2 id="keeping-the-package-private"&gt;Keeping the package private&lt;/h2&gt;

&lt;p&gt;Since imgproxy Pro is paid software, the mirrored copy shouldn’t be readable by anyone who stumbles onto it. GHCR packages pushed to an organization &lt;a href="https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry" rel="noopener noreferrer"&gt;start out private&lt;/a&gt;, visible only to whoever published them. That’s safe, but it isn’t very useful on its own, since the mirror workflow needs to push new tags to the package.&lt;/p&gt;

&lt;p&gt;The fix is to link the package to a repository. We connected the mirror to the ops repo from the package settings and turned on “Inherit access from repository”. The package now &lt;a href="https://docs.github.com/en/packages/learn-github-packages/configuring-a-packages-access-control-and-visibility" rel="noopener noreferrer"&gt;gets the repo’s access permissions&lt;/a&gt;, and workflows in the ops repo can push to it. Linking doesn’t change visibility, though. The package stays private because it started private, not because the ops repo is private.&lt;/p&gt;

&lt;p&gt;You can tell the link worked in a few places. The package’s URL moves under the repository (&lt;code class="language-plaintext highlighter-rouge"&gt;github.com/your-org/your-ops-repo/pkgs/container/imgproxy&lt;/code&gt;), the package shows up in the repository’s sidebar, its settings list the ops repo as the repository source, and the repo appears under “Manage Actions access”. That last one is what lets the mirror workflow push new tags, as long as the repo’s role there is Write or Admin (with Read, the push step fails). To confirm the package is private, look for the “Private” label on the package page. Don’t flip it to public, even briefly. GitHub won’t let you make it private again.&lt;/p&gt;

&lt;h2 id="the-registry-credential-on-render"&gt;The registry credential on Render&lt;/h2&gt;

&lt;p&gt;The last piece is letting Render read the private package. Render stores registry credentials at the workspace level, and each one is &lt;a href="https://render.com/docs/deploying-an-image" rel="noopener noreferrer"&gt;a name, the registry, a username, and a personal access token&lt;/a&gt;. For GHCR, that means a classic personal access token with the &lt;code class="language-plaintext highlighter-rouge"&gt;read:packages&lt;/code&gt; scope, since GitHub Packages &lt;a href="https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry" rel="noopener noreferrer"&gt;authenticates with classic tokens&lt;/a&gt;. Once the credential is selected in the imgproxy service’s &lt;a href="https://render.com/docs/docker" rel="noopener noreferrer"&gt;Registry Credential setting&lt;/a&gt;, Render can pull the mirrored image when it builds from the Dockerfile.&lt;/p&gt;

&lt;p&gt;To get things working, I created that token from my own GitHub account, and the client later replaced it. If you do the same, plan that replacement from the start. A token tied to one person stops working when that person leaves the organization, loses access, or lets the token expire, and often the first sign of it is a failed deploy. A token owned by the client, ideally from an account that exists for this purpose, keeps the deploy from depending on who happens to still be on the project.&lt;/p&gt;

&lt;h2 id="conclusion"&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;In this article, we went through why Render couldn’t pull imgproxy Pro from its own registry, and how a copy in GHCR got around it: a Dockerfile that adds nothing to the upstream image, a workflow that mirrors a tag only when it isn’t there yet, a package linked to the ops repo so it inherits that repo’s access, and a registry credential Render can use. The same approach should work for any private image that lives in a registry Render can’t authenticate to. If Render isn’t where you’re headed, we’ve also written about &lt;a href="https://www.fastruby.io/blog/migrating-from-heroku-to-railway" rel="noopener noreferrer"&gt;migrating a Rails app from Heroku to Railway&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Keep in mind that a mirror is one more thing you own. The workflow keeps it in sync as long as every upgrade goes through the &lt;code class="language-plaintext highlighter-rouge"&gt;IMGPROXY_VERSION&lt;/code&gt; line, so if someone changes the image tag anywhere else, the mirror and the Dockerfile can drift apart. It also means imgproxy’s fixes, security ones included, only reach you when someone bumps the version, so the mirrored tag can quietly go stale the same way &lt;a href="https://www.fastruby.io/blog/why-patching-the-gem-didnt-fix-cve-2026-66066" rel="noopener noreferrer"&gt;any container image can&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Planning a move off Heroku? Take a look at &lt;a href="https://www.fastruby.io/blog/migrate-from-heroku" rel="noopener noreferrer"&gt;how we approach Heroku migrations&lt;/a&gt;, and &lt;a href="https://www.fastruby.io/#contactus" rel="noopener noreferrer"&gt;send us a message&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>devops</category>
      <category>ruby</category>
      <category>rails</category>
      <category>docker</category>
    </item>
    <item>
      <title>How to Prioritize Which CVEs to Fix First</title>
      <dc:creator>Ernesto Tagwerker (he/him)</dc:creator>
      <pubDate>Tue, 17 Nov 2026 14:06:31 +0000</pubDate>
      <link>https://dev.to/fastruby/how-to-prioritize-which-cves-to-fix-first-3ad</link>
      <guid>https://dev.to/fastruby/how-to-prioritize-which-cves-to-fix-first-3ad</guid>
      <description>&lt;p&gt;You run &lt;code&gt;bundler-audit&lt;/code&gt; against your app, and the list is longer than you have time for, with a good share of it flagged HIGH or CRITICAL. There are too many to patch at once, and every one looks urgent. Sorting by severity doesn’t help when everything is already labeled critical, and a list where everything is top priority gives you no priority at all.&lt;/p&gt;

&lt;p&gt;In this post, you’ll learn how to combine three public scoring signals, CVSS, the CISA KEV catalog, and EPSS, to narrow your application’s dependency advisories down to a list, and then how to check whether each flaw on that list is actually reachable in your codebase. Think of it as the systematic version of picking CVEs by hand, which is what we did in &lt;a href="https://www.fastruby.io/blog/dont_just_upgrade_rails_-_7_cves_your_rails_app_might_have_and_what_to_patch.html" rel="noopener noreferrer"&gt;Don’t Just Upgrade Rails: 7 CVEs to Patch&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why a wall of CRITICALs isn’t a plan
&lt;/h2&gt;

&lt;p&gt;The instinct is to sort by severity and start at the top. That works when “critical” is a short list, not when it is most of the report. An app that has fallen a couple of Rails versions behind can easily carry dozens of advisories across Rails itself, Rack, Nokogiri, and the rest of its &lt;code&gt;Gemfile.lock&lt;/code&gt;, and at that point severity has stopped being a filter. A “critical” in a code path you never touch and one attackers are using this week get the same color.&lt;/p&gt;

&lt;p&gt;The question you actually need answered is “which of these is likely to be exploited, and could it be exploited in my app?” No single number answers that, but a few of them together get you most of the way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three signals for how dangerous a CVE is
&lt;/h2&gt;

&lt;p&gt;None of the scoring systems below is perfect on its own. Each one answers a different question, and they are most useful read side by side.&lt;/p&gt;

&lt;h3&gt;
  
  
  CVSS: how bad the flaw could be
&lt;/h3&gt;

&lt;p&gt;The &lt;a href="https://www.first.org/cvss/" rel="noopener noreferrer"&gt;Common Vulnerability Scoring System&lt;/a&gt; is the 0 to 10 score behind the LOW, MEDIUM, HIGH, and CRITICAL labels your scanner prints. It measures the technical severity of a flaw: how it can be attacked, how complex the attack is, whether the attacker needs to be logged in, and how much damage a successful exploit does.&lt;/p&gt;

&lt;p&gt;What the base score doesn’t measure is whether anyone is exploiting the flaw, or whether it applies to your setup at all. A CVE documenting a “critical” flaw in a gem feature you never use is still scored critical. CVSS tells you how much it would hurt if it happened, so pair it with the next two signals, which speak to how likely it is to happen.&lt;/p&gt;

&lt;h3&gt;
  
  
  KEV: whether it’s already being exploited
&lt;/h3&gt;

&lt;p&gt;The &lt;a href="https://www.cisa.gov/known-exploited-vulnerabilities-catalog" rel="noopener noreferrer"&gt;CISA Known Exploited Vulnerabilities catalog&lt;/a&gt; is a list, maintained by the US Cybersecurity and Infrastructure Security Agency, of vulnerabilities with confirmed real-world exploitation. A CVE only lands on it when there is evidence that attackers are actively using it, not just that they theoretically could. For federal agencies it is binding, with a remediation deadline on every entry, and while you are probably not a federal agency, those deadlines are still a useful public signal of how seriously a given vulnerability is taken.&lt;/p&gt;

&lt;p&gt;KEV is the strongest of the three signals, but it only looks backward. It lists what has already been exploited, and a CVE can be under attack for a while before it is added. It is also common for none of the advisories in a gem scan to appear on it at all, which is exactly when the next signal earns its place.&lt;/p&gt;

&lt;h3&gt;
  
  
  EPSS: how likely it is to be exploited soon
&lt;/h3&gt;

&lt;p&gt;The &lt;a href="https://www.first.org/epss/" rel="noopener noreferrer"&gt;Exploit Prediction Scoring System&lt;/a&gt;, maintained by FIRST, estimates the probability that a CVE will see exploitation activity in the wild in the next 30 days. Scores run from 0 to 1, come with a percentile so you can see how a CVE ranks against all the others, and are recalculated daily.&lt;/p&gt;

&lt;p&gt;Where KEV looks backward, EPSS looks forward: it is the signal that can flag a CVE before it ever reaches the catalog. It is also a probability, not a verdict, so a low score means “unlikely” rather than “safe”.&lt;/p&gt;

&lt;p&gt;Together, these three give you a better idea of what could be dangerous and what attackers are paying attention to. What they can’t tell you is whether your codebase is exposed, and that takes a closer look at the flaw itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting the signals for your gems
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.fastruby.io/blog/how-to-use-bundler-audit-to-keep-dependencies-secure" rel="noopener noreferrer"&gt;bundler-audit&lt;/a&gt; checks your &lt;code&gt;Gemfile.lock&lt;/code&gt; against &lt;a href="https://github.com/rubysec/ruby-advisory-db" rel="noopener noreferrer"&gt;ruby-advisory-db&lt;/a&gt; and reports each vulnerable gem with its advisory ID, a criticality rating based on the advisory’s CVSS score, and a link to the advisory itself. If you’d rather not install anything, &lt;a href="https://audit.fastruby.io/" rel="noopener noreferrer"&gt;audit.fastruby.io&lt;/a&gt; runs the same bundler-audit check against a &lt;code&gt;Gemfile.lock&lt;/code&gt; you upload. It lists each advisory’s ID and links to the advisory, where you’ll find the severity rating. Some advisories are reported by their GitHub Security Advisory ID (&lt;code&gt;GHSA-...&lt;/code&gt;) rather than a CVE ID. KEV and EPSS are keyed by CVE, so open the advisory link and copy the CVE ID listed there. If the advisory has no CVE ID, it won’t appear in either source, and its severity rating is the only score you have. With the CVE IDs in hand, matching them against KEV is a straightforward cross-reference against the catalog’s public &lt;a href="https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json" rel="noopener noreferrer"&gt;JSON feed&lt;/a&gt;, and EPSS scores can be looked up by CVE ID the same way.&lt;/p&gt;

&lt;p&gt;One thing to keep in mind about scope: this covers what’s in your &lt;code&gt;Gemfile.lock&lt;/code&gt;. If your app runs in a container, the system libraries in the image are a separate layer with their own CVEs, and sometimes they decide whether a gem fix even works, as with &lt;a href="https://www.fastruby.io/blog/why-patching-the-gem-didnt-fix-cve-2026-66066" rel="noopener noreferrer"&gt;CVE-2026-66066&lt;/a&gt;. That layer needs its own scanner and is outside what this post covers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Is the flaw reachable in your codebase?
&lt;/h2&gt;

&lt;p&gt;Once the signals have given you a list, work through each CVE on it with the questions below. They are ordered from simplest to most involved, and a confident “no” at any step usually means you can stop there and record the CVE as not affecting you. Run them on the list rather than the full report: this is the expensive part, and it is worth spending only on the CVEs the signals say matter.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Is the vulnerable version present?&lt;/strong&gt; Check &lt;code&gt;Gemfile.lock&lt;/code&gt;, which includes your transitive dependencies, not just the gems in your &lt;code&gt;Gemfile&lt;/code&gt;. &lt;code&gt;bundler-audit&lt;/code&gt; does this for you, but it is worth confirming which version is actually locked.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Is the vulnerable code loaded?&lt;/strong&gt; Many Rails CVEs live in one specific piece of the framework: Active Storage, Action Text, a particular middleware. If your &lt;code&gt;config/application.rb&lt;/code&gt; requires frameworks individually instead of &lt;code&gt;rails/all&lt;/code&gt; and the affected one isn’t among them, or &lt;code&gt;bin/rails middleware&lt;/code&gt; shows the affected middleware isn’t in your stack, that is a strong case for “not affected”. A gem listed with &lt;code&gt;require: false&lt;/code&gt; isn’t a “not affected” case on its own, though. That option only keeps Bundler from loading the gem at boot. Your code may still load it later inside a job or rake task, another gem may load it for you (Active Storage does this with &lt;code&gt;image_processing&lt;/code&gt;), and a command-line tool like a linter runs its code without the app loading it at all. Search for where the gem is loaded and check which other gems depend on it before you rule it out.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Is it reachable?&lt;/strong&gt; Read the advisory and the fix commit, find the vulnerable method, and search for call sites. Don’t put too much trust in a clean grep: Ruby’s dynamic dispatch (&lt;code&gt;send&lt;/code&gt;) hides calls, and framework code like parameter parsing runs on every request whether your code mentions it or not. For a transitive dependency, search your other gems too. Take &lt;code&gt;addressable&lt;/code&gt;, which is in most Rails bundles because gems like WebMock and Octokit depend on it. &lt;a href="https://github.com/sporkmonger/addressable/security/advisories/GHSA-h27x-rffw-24p4" rel="noopener noreferrer"&gt;CVE-2026-35611&lt;/a&gt; is a regular expression denial of service that only affects URI template matching, so the code to look for is &lt;code&gt;Addressable::Template&lt;/code&gt; and its &lt;code&gt;match&lt;/code&gt; and &lt;code&gt;extract&lt;/code&gt; methods. &lt;code&gt;grep -rl "Addressable::Template" $(bundle list --paths)&lt;/code&gt; searches every installed gem at once. When we ran it on the app that serves this blog, it turned up two gems besides addressable itself. WebMock is in the &lt;code&gt;test&lt;/code&gt; group, so it was out. Sawyer, the HTTP client Octokit uses to talk to GitHub, runs in production, but it only builds templates to &lt;code&gt;expand&lt;/code&gt; them into URLs and never calls &lt;code&gt;match&lt;/code&gt; or &lt;code&gt;extract&lt;/code&gt;, so this CVE was a “no” at this step. &lt;a href="https://semgrep.dev/products/semgrep-supply-chain" rel="noopener noreferrer"&gt;Semgrep Supply Chain&lt;/a&gt; automates this reachability check for Ruby, which can take a lot of the manual searching off your plate, though it’s worth spot-checking its results the same way.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Can an attacker control the input?&lt;/strong&gt; A reachable flaw only matters if attacker-supplied data can get to it. Trace where the input to the vulnerable path comes from, and whether a user has to be authenticated (or an admin) before they can send it. The CVSS Attack Vector and Privileges Required metrics give you the advisory’s view of this; your job is to check it against your app.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Are the preconditions met?&lt;/strong&gt; Rails advisories often depend on configuration, along the lines of “only affects applications using X with Y enabled”. The advisory’s “Impact” and “Workarounds” sections usually spell this out, and CVSS 4.0 captures it in its Attack Requirements metric.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Is it exposed, and are there mitigations?&lt;/strong&gt; Consider whether the affected app is internet-facing, and whether a WAF rule, a proxy, or another layer already blocks the attack. An internal admin tool that’s only reachable over a VPN is less urgent than the same CVE in your public-facing app.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Record the decision.&lt;/strong&gt; Write down what you concluded and why, ideally in a machine-readable form (more on that below), so nobody has to repeat this analysis the next time the same CVE shows up in a scan. The simplest place to start is bundler-audit’s own config file: add the advisory ID under &lt;code&gt;ignore&lt;/code&gt; in a &lt;code&gt;.bundler-audit.yml&lt;/code&gt; at the root of your app, with a comment explaining why, and &lt;code&gt;bundle-audit check&lt;/code&gt; stops reporting it. For the &lt;code&gt;addressable&lt;/code&gt; CVE from step 3, that looks like this:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These questions aren’t arbitrary: each “no” in steps 1 through 6 lines up with one of the standard justifications a VEX document uses for marking a vulnerability “not affected”, from “component not present” through “inline mitigations already exist”.&lt;/p&gt;

&lt;h2&gt;
  
  
  Putting it together: what to fix first
&lt;/h2&gt;

&lt;p&gt;With the signals and the reachability check in hand, the order mostly falls out on its own:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;On the KEV list and reachable.&lt;/strong&gt; Fix these first. It is being exploited somewhere, and it can be exploited in your app. Treat the CISA remediation deadline as a reference point.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;High EPSS and reachable.&lt;/strong&gt; Not confirmed as exploited yet, but likely to be soon. These come next.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;High CVSS, low EPSS, and reachable.&lt;/strong&gt; Serious if it happens, but nobody seems to be trying. Schedule these into your regular patching rather than dropping everything.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Not reachable, whatever the scores.&lt;/strong&gt; Record why, and pick up the fix in your normal upgrade cycle. Upgrading is often cheap, and “not reachable” can stop being true the day someone enables the feature.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Within each group, break ties by exposure (production and internet-facing first), and if you maintain several apps, by how many of them carry the same vulnerable gem. And watch for upgrades that clear several advisories at once, like a Rails patch release that bumps a handful of framework gems together, since those can be worth doing ahead of the order above. How hard the upgrade is matters too: a patch-level bump is an afternoon, while a fix that only exists in the next major version of Rails is a project, and that one may need a mitigation in the meantime.&lt;/p&gt;

&lt;p&gt;One more case comes up once you start fixing: CVEs with no fixed version. Some are simply waiting on a release that hasn’t shipped yet, and those you monitor and apply the moment it lands. Others will not be fixed at all: the maintainers disputed the report, decided it reflects expected behavior, or the gem is no longer maintained. Those you document and mitigate, consciously accept, or plan to replace the gem. On a KEV, a disputed or won’t-fix call deserves a harder look than usual, since it is worth verifying against how your own app uses the gem before you trust it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keeping it from coming back
&lt;/h2&gt;

&lt;p&gt;A one-off triage clears the backlog, but it does not keep it clear. New advisories get published, new entries get added to the KEV catalog, EPSS scores shift daily, and your &lt;code&gt;Gemfile.lock&lt;/code&gt; starts falling behind the day after you update it. To keep up, run the checks in your CI pipeline, so that remediation is continuous rather than a periodic audit. The mechanism for carrying your decisions forward is VEX, short for Vulnerability Exploitability eXchange. A VEX document is a machine-readable statement about whether a given product is actually affected by a vulnerability, with a status like “not affected”, “affected”, “fixed”, or “under investigation”, plus a justification. It is the natural home for the decisions from the reachability check. Wired into CI, it lets the pipeline carry those decisions forward: findings you judged not exploitable stay suppressed on every build, while the ones that still matter keep surfacing. If your team prefers a decision framework to a document format, CISA’s &lt;a href="https://www.cisa.gov/stakeholder-specific-vulnerability-categorization-ssvc" rel="noopener noreferrer"&gt;SSVC&lt;/a&gt; (Stakeholder-Specific Vulnerability Categorization) decision tree covers similar ground, sorting each vulnerability into Track, Track*, Attend, or Act.&lt;/p&gt;

&lt;p&gt;It is worth being precise about how VEX and KEV differ, because they are easy to conflate. KEV is a global statement: this vulnerability is being exploited somewhere in the world. VEX is a local one: this vulnerability does, or does not, actually affect our product. KEV raises a finding’s priority, and VEX records what you concluded about it so you do not have to reach that conclusion by hand the next time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this post we used three signals to narrow the advisories in a &lt;code&gt;Gemfile.lock&lt;/code&gt;: CVSS for how bad a flaw could be, KEV for whether it is already being exploited, and EPSS for how likely it is to be exploited soon. Then we checked whether each flaw on the list was actually reachable in the codebase, and ranked what was left. Just keep in mind that these signals decide what to fix first, not what to ignore: a CVE that isn’t on the KEV list and has a low EPSS score today can still be dangerous tomorrow.&lt;/p&gt;

&lt;p&gt;Not sure which of your dependency advisories actually matter, or how far behind your Rails app has fallen? &lt;a href="https://www.fastruby.io/security-audit" rel="noopener noreferrer"&gt;Contact us for a security audit!&lt;/a&gt;&lt;/p&gt;

</description>
      <category>security</category>
    </item>
    <item>
      <title>SF Ruby ‘26: Ruby’s Best Years Are Ahead</title>
      <dc:creator>Ernesto Tagwerker (he/him)</dc:creator>
      <pubDate>Mon, 16 Nov 2026 05:00:00 +0000</pubDate>
      <link>https://dev.to/etagwerker/sf-ruby-26-rubys-best-years-are-ahead-aa6</link>
      <guid>https://dev.to/etagwerker/sf-ruby-26-rubys-best-years-are-ahead-aa6</guid>
      <description>&lt;p&gt;On November 10, I was in the audience at SFJAZZ when &lt;a href="https://evilmartians.com/events/irina-nazarova-sf-ruby-conference-2026" rel="noopener noreferrer"&gt;Irina Nazarova&lt;/a&gt;opened &lt;a href="https://sfruby.com" rel="noopener noreferrer"&gt;SF Ruby 2026&lt;/a&gt;. Irina is the CEO of Evil Martians, and for the last three years she has been interviewing founders who are building new companies on Ruby and Rails.&lt;/p&gt;

&lt;p&gt;A month ago I wrote about &lt;a href="https://www.fastruby.io/blog/ai-and-the-future-of-rails" rel="noopener noreferrer"&gt;DHH’s Rails World keynote&lt;/a&gt;, and I ended that post wanting to hear more about the future of Rails from the people building on it.&lt;/p&gt;

&lt;p&gt;Irina’s keynote was that talk.&lt;/p&gt;

&lt;p&gt;She opened with a video message from Garry Tan, President and CEO of Y Combinator, who couldn’t make it in person. He said one line that Irina kept coming back to for the rest of the hour:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Ruby’s best years might be ahead of us.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I left the room agreeing with him. Here is why.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fk94iu9kc6bn4o9vnypkh.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fk94iu9kc6bn4o9vnypkh.jpg" alt="Irina Nazarova on the SFJAZZ stage next to a lectern, below a large retro video game styled slide with a pixel-art Garry Tan avatar and the quote 'Ruby's best years might be ahead of us.' attributed to Garry Tan, Y Combinator" width="800" height="629"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Convention over Configuration (Garry Tan)
&lt;/h2&gt;

&lt;p&gt;Garry went through YC in 2008 and built Posterous on Rails. His point was that convention over configuration is why two people could ship a product used by millions, and that a whole generation of YC companies got built the same way.&lt;/p&gt;

&lt;p&gt;Then he connected that to today. What makes a codebase easy for an agent to work in? It should be readable, consistent, and do things the same way every time.&lt;/p&gt;

&lt;p&gt;That is what this community has been obsessed with for 20 years.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Rails conventions turned out to be an incredible gift to the models. Less to explain, less to guess, more that just works.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;He said YC is now seeing teams of fewer than 20 people build companies that used to take hundreds.&lt;/p&gt;

&lt;p&gt;His ask was simple: keep building, start the company, ship the side project, and teach the next person why beautiful code still matters, even when a robot helps write it.&lt;/p&gt;

&lt;p&gt;I’m a big fan of that framing.&lt;/p&gt;

&lt;h2&gt;
  
  
  What founders say works
&lt;/h2&gt;

&lt;p&gt;Irina asks every founder three questions: What works? What’s missing? And, since this year, what has changed with AI?&lt;/p&gt;

&lt;p&gt;This edition drew on eight founders, and a few of their answers stuck with me.&lt;/p&gt;

&lt;p&gt;Cole Robertson of Rebulk is running a Rails app on a tiny Jetson computer on a farm with no cell reception, connected over Starlink. It’s still Rails. He also said Rails has “the web primitives nailed down in a way no other framework has.”&lt;/p&gt;

&lt;p&gt;Paul Cothenet of Tern thought they would need Python to build AI workflows in production.&lt;/p&gt;

&lt;p&gt;They didn’t.&lt;/p&gt;

&lt;p&gt;His line was that Rails is still “a cheat code” for building AI features.&lt;/p&gt;

&lt;p&gt;Kieran Klaassen is building Cora, an email product, as a single-person team competing with much larger companies. He said that is only possible because of Rails.&lt;/p&gt;

&lt;p&gt;Carmine Paolino, the author of &lt;a href="https://rubyllm.com" rel="noopener noreferrer"&gt;RubyLLM&lt;/a&gt;, is reading more code than ever. I don’t know about you, but if I’m going to read a lot of code, I still prefer to read Ruby code.&lt;/p&gt;

&lt;p&gt;That last point is the one I keep repeating. We may write less code by hand, but someone still has to read it, review it, and decide whether it’s good.&lt;/p&gt;

&lt;p&gt;Readability matters more in the agentic era, not less.&lt;/p&gt;

&lt;p&gt;Irina summed up the founders’ answers in one slide: Rails is the best agentic framework for humans.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgftumjyeodvqcsi798br.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgftumjyeodvqcsi798br.jpg" alt="Irina Nazarova presenting in front of a slide titled 'Rails is the best agentic framework for humans' with three cards: 'No decisions: Convention over configuration,' 'No plumbing: Batteries included,' and 'Code I can read: It reads like English. Especially the tests.'" width="800" height="673"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A few founders also pointed out that Ruby people love Ruby people.&lt;/p&gt;

&lt;p&gt;The community might be smaller, but once you find it, hiring and building a team gets easier because people know each other.&lt;/p&gt;

&lt;h2&gt;
  
  
  What’s missing (and who’s already building it)
&lt;/h2&gt;

&lt;p&gt;This was my favorite part of the talk. Irina listed what founders say is missing, and for almost every item she had someone in the community already working on it. The exception was types: Irina’s take was that on every public benchmark so far, static types don’t help agents, and she asked for a benchmark that shows otherwise before changing her mind.&lt;/p&gt;

&lt;h3&gt;
  
  
  UI Components
&lt;/h3&gt;

&lt;p&gt;Rails has component systems, but not yet the kind of library that wins over designers and design engineers.&lt;/p&gt;

&lt;p&gt;Marco Roth is working on components built on &lt;a href="https://www.fastruby.io/blog/herb-on-rails" rel="noopener noreferrer"&gt;Herb&lt;/a&gt;, and Matt Solt recently showed&lt;a href="https://rubygems.org/gems/poetry-ui" rel="noopener noreferrer"&gt;Poetry UI&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Irina’s ask was to be more ambitious: think Figma to Herb components.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hotwire Documentation
&lt;/h3&gt;

&lt;p&gt;Founders love the calm that Hotwire brought to the frontend, but the documentation has been thin since 2021.&lt;/p&gt;

&lt;p&gt;Irina mentioned an official Rails guide in review, and &lt;a href="https://github.com/rails/rails/pull/58617" rel="noopener noreferrer"&gt;it was merged into the edge guides on November 10&lt;/a&gt;, the day the conference opened.&lt;/p&gt;

&lt;h3&gt;
  
  
  I/O Concurrency for AI workloads
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmki345d08vsjy7uc8q9x.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmki345d08vsjy7uc8q9x.jpg" alt="Slide titled 'Wants: I/O-heavy concurrency for AI' listing founder quotes on fibers, async IO, async jobs, and AI streaming, next to a 'Built this year' column: Solid Queue fibers by Carmine Paolino, RubyLLM 2.0 with model fallbacks across 17 providers, Action Cable on fibers by Vladimir Dementyev merged into Rails main, and Samuel Williams' talk 'When Rails Met Fibers' about Shopify moving Sidekick from Puma to Falcon" width="800" height="460"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AI apps make a huge number of slow I/O calls, and LLM calls are exactly the case for fibers.&lt;/p&gt;

&lt;p&gt;Carmine Paolino added fiber support to Solid Queue, so you get async jobs without adding Redis. Vladimir Dementyev’s Action Cable on fibers was merged into Rails main and ships in the next Rails.&lt;/p&gt;

&lt;p&gt;Samuel Williams, the author of Falcon, gave a talk at Deccan Queen on Rails 2026 about Shopify migrating Sidekick from Puma to Falcon. The recording is worth your time:&lt;/p&gt;

&lt;h3&gt;
  
  
  Memory
&lt;/h3&gt;

&lt;p&gt;Rails apps still use more RAM than founders would like. There is no single answer yet, but there are experiments: &lt;a href="https://github.com/yaroslav/kino" rel="noopener noreferrer"&gt;Kino&lt;/a&gt;, a Ractor-based web server for Ruby 4, and AnyCable moving WebSocket connections out of the Ruby process.&lt;/p&gt;

&lt;p&gt;In the meantime, there is a lot you can do about memory in the app you already have. We’ve written about&lt;a href="https://www.ombulabs.ai/blog/ruby/performance/using-bumbler-to-reduce-runtime-dependencies.html" rel="noopener noreferrer"&gt;using Bumbler to trim runtime dependencies&lt;/a&gt;,&lt;a href="https://www.fastruby.io/blog/bundler/memory-leaks/introducing-bundler-leak.html" rel="noopener noreferrer"&gt;finding gems that leak memory with bundler-leak&lt;/a&gt;, and the &lt;a href="https://www.fastruby.io/blog/common-problems-in-rails-performance.html" rel="noopener noreferrer"&gt;common culprits behind Rails performance issues&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  LLM Tracing
&lt;/h3&gt;

&lt;p&gt;Founders asked for first-party SDKs. OpenTelemetry already works, and Istvan Hoka’s &lt;a href="https://rubygems.org/gems/sentry-agents" rel="noopener noreferrer"&gt;&lt;code&gt;sentry-agents&lt;/code&gt;&lt;/a&gt; gem adds out-of-the-box RubyLLM instrumentation to Sentry.&lt;/p&gt;

&lt;h3&gt;
  
  
  Safe Production Access for AI Agents
&lt;/h3&gt;

&lt;p&gt;Nobody wants an agent pasting snippets into a production console.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://world.hey.com/this.week.in.rails/query-command-for-database-queries-and-more-0bee7868" rel="noopener noreferrer"&gt;&lt;code&gt;bin/rails query&lt;/code&gt;&lt;/a&gt; gives read-only database access with structured JSON output, and it was merged in April.&lt;/p&gt;

&lt;p&gt;Three years of founder feedback, and the community has an answer in progress for almost every item. That is a huge testament to the people in this room.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understand the present before building the future
&lt;/h2&gt;

&lt;p&gt;Irina’s guidance for the turbulence we’re in was refreshingly practical.&lt;/p&gt;

&lt;p&gt;Our main job right now is not to predict the distant future. It is to understand what is actually happening today: what works, for whom, and how.&lt;/p&gt;

&lt;p&gt;That means learning the recipes from teams big and small, but also learning how to evaluate whether a new tool or skill works for you.&lt;/p&gt;

&lt;p&gt;Irina sketched three kinds of engineers she sees emerging on AI-era teams: the product engineer who asks why, the high-risk engineer who owns payments, billing, and security, and the agentic platform engineer who owns the agents’ environment.&lt;/p&gt;

&lt;h3&gt;
  
  
  The High-risk Engineer
&lt;/h3&gt;

&lt;p&gt;The high-risk engineer reviews by risk, not by complexity. A button spacing change gets checked in a review app. A change to payment rules gets built and reviewed by a human engineer.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqdnu8dhqojt3a8vo0ysp.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqdnu8dhqojt3a8vo0ysp.jpg" alt="Irina Nazarova presenting in front of a slide titled 'Review by risk: payments, background jobs, critical-path latency, security,' comparing 'Button spacing: Check the result in a review app' with a short risk bar against 'Payment rules: An engineer builds and reviews this' with a nearly full risk bar" width="800" height="556"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The Agentic Platform Engineer
&lt;/h3&gt;

&lt;p&gt;The agentic platform engineer is the role I expect to see a lot more of.&lt;/p&gt;

&lt;p&gt;They own the agents’ context, tools, and permissions, run evals on what the agents produce, and turn team knowledge into skills and guardrails.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9zaibsj8vq8eio51kxac.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9zaibsj8vq8eio51kxac.jpg" alt="Slide styled like a 'Choose your fighter' screen showing a pixel-art engineer with goggles and the card 'Agentic platform engineer: Owns the agents' environment (context, tools, permissions), runs evals on what agents produce, turns team knowledge into skills and guardrails. Trait: curiosity'" width="800" height="471"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Good engineers have always read code before pasting it, and the same discipline applies to AI workflows.&lt;/p&gt;

&lt;p&gt;Irina calls it the quality loop: define what quality means for you and how to track it, observe traces and quality metrics, investigate degradations and build preventive tooling, then ship and check whether quality improved.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fy29g8e2m5egl421jqo06.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fy29g8e2m5egl421jqo06.jpg" alt="Slide titled 'Run the quality loop' with four numbered steps: 1. Define what quality means for us, and how to track it. 2. Observe traces and quality metrics. 3. Investigate degradations. Build preventive tooling. Ship. 4. Track: did quality improve? Yes: win, next metric. No: back to 3." width="800" height="484"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The good news is that the “build preventive tooling” step doesn’t have to start from scratch. The Ruby community has had code quality guardrails for years, and they work just as well on code an agent wrote as on code a human wrote.&lt;/p&gt;

&lt;p&gt;I’m a proud co-maintainer of &lt;a href="https://www.fastruby.io/blog/code-quality/code-coverage/rubycritic-4-2-0-simplecov-support.html" rel="noopener noreferrer"&gt;RubyCritic&lt;/a&gt;and &lt;a href="https://www.fastruby.io/blog/code-quality/introducing-skunk-stink-score-calculator.html" rel="noopener noreferrer"&gt;Skunk&lt;/a&gt;, which combine complexity, code smells, and test coverage into a score you can track over time.&lt;/p&gt;

&lt;p&gt;Add them to the &lt;a href="https://www.fastruby.io/blog/ruby/quality/code-quality-ruby-gems.html" rel="noopener noreferrer"&gt;other code quality gems&lt;/a&gt; and the&lt;a href="https://www.fastruby.io/blog/open-source-tooling.html" rel="noopener noreferrer"&gt;open source tools we use for Rails upgrades&lt;/a&gt;, and you have a quality loop that runs on every pull request.&lt;/p&gt;

&lt;p&gt;I strongly encourage our customers to set these guardrails up before they turn agents loose on their codebase. If quality drops, you want to know in CI, not in production, or 6 months later during a major outage.&lt;/p&gt;

&lt;p&gt;Irina also shared results from a set of agent evals run in October 2026 against Rails apps like Redmine, Forem, and Mastodon.&lt;/p&gt;

&lt;p&gt;The pattern was clear: agents fail when they hand-roll what the framework already solved.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Agents that reached for Action Cable for live updates passed. Agents that hand-rolled polling flooded the servers.&lt;/li&gt;
&lt;li&gt;Only the agents that reused the app’s existing private-network guard blocked SSRF addresses.&lt;/li&gt;
&lt;li&gt;Four out of four agents hand-wrote a migration instead of using the generator, and three of them made it irreversible.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is exactly why conventions are a gift to the models.&lt;/p&gt;

&lt;p&gt;It’s also why I keep saying someone on your team needs to understand the framework. The agent doesn’t know your migration is irreversible until a human who knows Rails looks at it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rails 8.2 is almost here
&lt;/h2&gt;

&lt;p&gt;In my Rails World post I said that a lot of the future of Rails was being built in the other talks, not the opening keynote.&lt;/p&gt;

&lt;p&gt;Two months later, Rails 8.2 still hasn’t shipped as I write this, but the &lt;a href="https://edgeguides.rubyonrails.org/8_2_release_notes.html" rel="noopener noreferrer"&gt;release notes&lt;/a&gt; are shaping up to be a big deal in three areas.&lt;/p&gt;

&lt;h3&gt;
  
  
  Frontend
&lt;/h3&gt;

&lt;p&gt;Herb &lt;a href="https://github.com/rails/rails/pull/58552" rel="noopener noreferrer"&gt;was merged into Rails core&lt;/a&gt;, so Rails 8.2 can compile your &lt;code&gt;.html.erb&lt;/code&gt; templates with an HTML-aware parser.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.fastruby.io/blog/reactionview-and-herb-in-rails-8-2" rel="noopener noreferrer"&gt;ReActionView&lt;/a&gt; builds reactive templates on top of that,&lt;a href="https://www.fastruby.io/blog/lexxy-vs-trix-for-action-text" rel="noopener noreferrer"&gt;Lexxy&lt;/a&gt; gives ActionText a modern editor, and the Hotwire guide finally gives the frontend stack official documentation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Security
&lt;/h3&gt;

&lt;p&gt;New 8.2 apps get header-based CSRF protection using the &lt;code&gt;Sec-Fetch-Site&lt;/code&gt; header by default, so same-origin requests no longer need authenticity tokens.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;has_secure_password&lt;/code&gt; gains built-in Argon2 support, which drops bcrypt’s 72-byte password limit. &lt;code&gt;Rails.app.creds&lt;/code&gt; unifies access to credentials from ENV and the encrypted credentials file. Active Storage now analyzes attachments before validation, and once 8.2 ships, the &lt;a href="https://www.fastruby.io/blog/hotcell-active-storage-rails-world" rel="noopener noreferrer"&gt;Hot Cell gems&lt;/a&gt;can sandbox image processing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Performance
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;ActiveSupport::Ractors&lt;/code&gt; is in, the first step toward &lt;a href="https://www.fastruby.io/blog/the-as-if-rule-tenderlove-rails-world" rel="noopener noreferrer"&gt;running Rails under Ractors&lt;/a&gt;. Shopify’s experiment with Writebook showed &lt;a href="https://railsatscale.com/2026-08-11-ractors-on-rails/" rel="noopener noreferrer"&gt;a pool of 8 Ractors using nearly 7x less memory&lt;/a&gt; than 8 forked Puma workers.&lt;/p&gt;

&lt;p&gt;Active Job now enqueues after the transaction commits by default, and parallel tests get work stealing so idle workers pick up the slack.&lt;/p&gt;

&lt;p&gt;That is a lot of attention on the view layer, on security defaults, and on the memory problem founders keep bringing up. It’s the future of Rails I was hoping to hear about in Austin.&lt;/p&gt;

&lt;h2&gt;
  
  
  Welcoming the next person
&lt;/h2&gt;

&lt;p&gt;The part of the talk I didn’t expect was about who gets to build with Rails next.&lt;/p&gt;

&lt;p&gt;Irina’s observation is that every non-technical person in a tech organization is now looking at charts of GitHub commits and wondering if they could build something themselves.&lt;/p&gt;

&lt;p&gt;Rails is well positioned for that. A product manager with a coding agent and a framework full of conventions can build tools for themselves, their team, or their product.&lt;/p&gt;

&lt;p&gt;What’s missing is the tooling and the safe boundaries to let them contribute without breaking production. Read-only access like &lt;code&gt;bin/rails query&lt;/code&gt; is part of that answer.&lt;/p&gt;

&lt;p&gt;SF Ruby closed with a Rails Girls event on November 12, and Irina’s ask to the room was “Invite a teammate. Come mentor.” The conference also listed 119 open positions at 56 Ruby companies, 8 of them entry-level.&lt;/p&gt;

&lt;p&gt;That is what an ecosystem with its best years ahead of it looks like.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Irina’s keynote in San Francisco was inspiring because it was about Rails, and about the founders, maintainers, and newcomers building on it.&lt;/p&gt;

&lt;p&gt;Both Garry and Irina agree on the core idea: Rails conventions are a gift to the models.&lt;/p&gt;

&lt;p&gt;Irina’s talk showed all of us the other half, that the community is actively closing the gaps founders run into, and that the next Rails release is going to make the framework faster, safer, and better on the frontend.&lt;/p&gt;

&lt;p&gt;I’m excited about the future of Rails in this agentic era. I’m excited to keep building. ❤️&lt;/p&gt;

&lt;p&gt;Are you figuring out how AI agents, Rails 8.2, and Ruby 4 fit into your application’s roadmap? &lt;a href="https://www.fastruby.io/contact" rel="noopener noreferrer"&gt;Let’s talk!&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ruby</category>
    </item>
    <item>
      <title>Four AI Stack Risks bundler-audit Won’t Flag</title>
      <dc:creator>Ernesto Tagwerker (he/him)</dc:creator>
      <pubDate>Tue, 10 Nov 2026 05:00:00 +0000</pubDate>
      <link>https://dev.to/fastruby/four-ai-stack-risks-bundler-audit-wont-flag-39p</link>
      <guid>https://dev.to/fastruby/four-ai-stack-risks-bundler-audit-wont-flag-39p</guid>
      <description>&lt;p&gt;Many of the Ruby on Rails apps we work on now have an AI layer of some kind. Sometimes it’s a single RubyLLM chat in a background job, sometimes it’s an MCP client wired into a support tool, and on most teams there’s a coding agent running in somebody’s editor. That layer gets the same security process as the rest of the app, which usually means &lt;a href="https://www.fastruby.io/blog/how-to-use-bundler-audit-to-keep-dependencies-secure" rel="noopener noreferrer"&gt;bundler-audit&lt;/a&gt; in CI and a Ruby upgrade when somebody gets to it.&lt;/p&gt;

&lt;p&gt;The last few weeks produced four separate problems in that layer. None of them has an advisory against a Ruby gem, so a dependency scanner stays green for all four. Two come from reading the source of ruby_llm-mcp, a community MCP client gem, one is a version constraint, and one is a compromised editor extension that isn’t a Ruby problem at all, but runs on the machines where our Rails credentials live.&lt;/p&gt;

&lt;p&gt;In this article, we’ll go through each one: what happened, how to tell whether it affects your app, and what to do about it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Your MCP Client Compiles Someone Else’s Regexes
&lt;/h2&gt;

&lt;p&gt;On October 23, Ruby released fixes for memory corruption bugs in its regexp parser and compiler, covering four CVEs (CVE-2026-89078, CVE-2026-93577, CVE-2026-97229 and CVE-2026-110264) with three changes in Ruby. They were found by GitLab, which compiles regexes from CI/CD configuration, but the bugs live in Ruby itself. On October 29, CISA added CVE-2026-97229 to its &lt;a href="https://www.cisa.gov/known-exploited-vulnerabilities-catalog" rel="noopener noreferrer"&gt;Known Exploited Vulnerabilities catalog&lt;/a&gt; with a due date of November 1 for federal agencies, and the entry notes that “other products can potentially be affected by the same underlying Ruby/Onigmo Integer Overflow issue in CI/CD Regular Expression Compiler.”&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://www.ruby-lang.org/en/news/2026/10/23/regexp-fixes-for-gitlab-cves/" rel="noopener noreferrer"&gt;Ruby advisory&lt;/a&gt; is precise about who is exposed: “These bugs are reached only when an application compiles a regular expression from a string that an attacker controls, for example by passing it to &lt;code&gt;Regexp.new&lt;/code&gt;, &lt;code&gt;Regexp.union&lt;/code&gt; or &lt;code&gt;Regexp.compile&lt;/code&gt;, or by interpolating it into a regexp literal such as &lt;code&gt;/#{input}/&lt;/code&gt;. Applications that only use regular expressions written by their own developers are not affected.” It is just as precise about the mitigations that don’t work: “Regexp.timeout does not protect against these bugs,” and “Limiting the length of patterns does not reliably protect against them either, because some of them can be triggered by short patterns.”&lt;/p&gt;

&lt;p&gt;So the question for a Rails team is where your app compiles a regex it didn’t write. In a Ruby AI app, one answer is the JSON Schema &lt;code&gt;pattern&lt;/code&gt; keyword.&lt;/p&gt;

&lt;p&gt;An MCP server describes its tools in its &lt;code&gt;tools/list&lt;/code&gt; response, and each tool carries an &lt;code&gt;inputSchema&lt;/code&gt; (and optionally an &lt;code&gt;outputSchema&lt;/code&gt;) as a JSON Schema document. We looked at the server side of this in &lt;a href="https://www.fastruby.io/blog/running-a-ruby-mcp-server-in-production" rel="noopener noreferrer"&gt;Running a Ruby MCP Server in Production&lt;/a&gt;. On the client side, if you connect to a remote MCP server, those schemas are written by whoever runs it. The community &lt;a href="https://github.com/patvice/ruby_llm-mcp" rel="noopener noreferrer"&gt;ruby_llm-mcp&lt;/a&gt; gem validates them with &lt;a href="https://github.com/davishmcclurg/json_schemer" rel="noopener noreferrer"&gt;json_schemer&lt;/a&gt;. This is its &lt;a href="https://github.com/patvice/ruby_llm-mcp/blob/v1.0.1/lib/ruby_llm/mcp/schema_validator.rb" rel="noopener noreferrer"&gt;&lt;code&gt;SchemaValidator&lt;/code&gt; module&lt;/a&gt; at v1.0.1, trimmed to the parts that matter here:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;module&lt;/span&gt; &lt;span class="nc"&gt;RubyLLM&lt;/span&gt;
  &lt;span class="k"&gt;module&lt;/span&gt; &lt;span class="nc"&gt;MCP&lt;/span&gt;
    &lt;span class="k"&gt;module&lt;/span&gt; &lt;span class="nc"&gt;SchemaValidator&lt;/span&gt;
      &lt;span class="n"&gt;module_function&lt;/span&gt;

      &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;valid_schema?&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;nil?&lt;/span&gt;

        &lt;span class="nf"&gt;schemer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="kc"&gt;true&lt;/span&gt;
      &lt;span class="k"&gt;rescue&lt;/span&gt; &lt;span class="nc"&gt;StandardError&lt;/span&gt;
        &lt;span class="kc"&gt;false&lt;/span&gt;
      &lt;span class="k"&gt;end&lt;/span&gt;

      &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;schemer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nc"&gt;JSONSchemer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="k"&gt;end&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;valid_schema?&lt;/code&gt; never validates anything against the schema. It only builds it. That matters because json_schemer does its parsing eagerly. The code is spread across a few files in json_schemer 2.5.0, the newest version ruby_llm-mcp’s &lt;code&gt;~&amp;gt; 2.4&lt;/code&gt; constraint allows. Each keyword in a schema becomes a &lt;code&gt;JSONSchemer::Keyword&lt;/code&gt;, and &lt;a href="https://github.com/davishmcclurg/json_schemer/blob/v2.5.0/lib/json_schemer/keyword.rb#L8-L15" rel="noopener noreferrer"&gt;&lt;code&gt;Keyword#initialize&lt;/code&gt;&lt;/a&gt; ends with &lt;code&gt;@parsed = parse&lt;/code&gt;. For the &lt;code&gt;pattern&lt;/code&gt; keyword, &lt;a href="https://github.com/davishmcclurg/json_schemer/blob/v2.5.0/lib/json_schemer/draft202012/vocab/validation.rb#L160-L162" rel="noopener noreferrer"&gt;&lt;code&gt;Pattern#parse&lt;/code&gt;&lt;/a&gt; is &lt;code&gt;root.resolve_regexp(value)&lt;/code&gt;. The &lt;a href="https://github.com/davishmcclurg/json_schemer/blob/v2.5.0/lib/json_schemer/configuration.rb#L23" rel="noopener noreferrer"&gt;default configuration&lt;/a&gt; sets &lt;code&gt;regexp_resolver&lt;/code&gt; to &lt;code&gt;'ruby'&lt;/code&gt;, which json_schemer &lt;a href="https://github.com/davishmcclurg/json_schemer/blob/v2.5.0/lib/json_schemer/schema.rb#L29" rel="noopener noreferrer"&gt;resolves with &lt;code&gt;Regexp.new(pattern)&lt;/code&gt;&lt;/a&gt;. So constructing the schema object is the regex compile, and no data needs to go through it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/patvice/ruby_llm-mcp/blob/v1.0.1/lib/ruby_llm/mcp/tool.rb#L31-L47" rel="noopener noreferrer"&gt;&lt;code&gt;RubyLLM::MCP::Tool#initialize&lt;/code&gt;&lt;/a&gt; runs the server’s &lt;code&gt;inputSchema&lt;/code&gt; through &lt;a href="https://github.com/patvice/ruby_llm-mcp/blob/v1.0.1/lib/ruby_llm/mcp/tool.rb#L196-L231" rel="noopener noreferrer"&gt;&lt;code&gt;normalize_if_invalid&lt;/code&gt;&lt;/a&gt;, which walks every nested hash in the schema and calls &lt;code&gt;SchemaValidator.valid_schema?&lt;/code&gt; at each level. That happens when the tool object is built from the server’s response, before a model has been asked anything and before any tool is called. The &lt;code&gt;outputSchema&lt;/code&gt; goes through json_schemer again &lt;a href="https://github.com/patvice/ruby_llm-mcp/blob/v1.0.1/lib/ruby_llm/mcp/tool.rb#L77-L80" rel="noopener noreferrer"&gt;when a tool result with structured content comes back&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;rescue StandardError&lt;/code&gt; looks like a guard, and it does catch a malformed pattern that raises &lt;code&gt;RegexpError&lt;/code&gt;. It can’t do anything about memory corruption inside the compiler, and when it does catch something, it hides it by returning &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This chain has limits, and they matter. There is no advisory against ruby_llm-mcp or json_schemer, and the CVEs are GitLab’s against Ruby. We established the path by reading the code at the v1.0.1 tag, not by crashing anything, and we haven’t confirmed that a crafted pattern reaches the vulnerable code in the compiler after json_schemer’s handling. What we can say is that the precondition Ruby describes, compiling a pattern you didn’t author, is met.&lt;/p&gt;

&lt;p&gt;The fix doesn’t depend on any of that. Upgrade to Ruby 4.0.9, 3.4.12 or 3.3.13, which contain all of these fixes. Then, if you want to know where else you compile untrusted patterns, this grep is a reasonable starting point:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;grep -rnE &lt;span class="s2"&gt;"JSONSchemer\.schema|JSON::Validator|Regexp\.(new|union|compile)"&lt;/span&gt; app lib config

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For each hit, ask who wrote the string. A schema you wrote by hand is in Ruby’s “not affected” bucket. A schema that came over the network, from a user, or from a database column that users can edit is not.&lt;/p&gt;

&lt;p&gt;It’s also worth knowing that RubyLLM 2.1 ships its own MCP client. Its gemspec has no json_schemer dependency, and we didn’t find anywhere in its &lt;code&gt;lib/ruby_llm/mcp&lt;/code&gt; directory that compiles a regex from a server-supplied string (every regex in that directory is a literal written by the gem’s authors, in files like &lt;code&gt;resource_template.rb&lt;/code&gt; and &lt;code&gt;http.rb&lt;/code&gt;). That’s a narrow observation about this one class of problem, not an audit. The &lt;a href="https://github.com/crmne/ruby_llm/blob/v2.1.1/docs/_reference/ecosystem.md" rel="noopener noreferrer"&gt;RubyLLM ecosystem page&lt;/a&gt; notes that ruby_llm-mcp “defines the same &lt;code&gt;RubyLLM::MCP&lt;/code&gt; constant, so an application uses one or the other,” so moving to the built-in client means replacing ruby_llm-mcp rather than adding a second gem. The two can’t share a bundle anyway: ruby_llm-mcp 1.0.1 depends on &lt;code&gt;ruby_llm ~&amp;gt; 1.9&lt;/code&gt;, so it won’t install alongside any RubyLLM 2.x release, let alone 2.1.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Bearer Token in Your Debug Logs
&lt;/h2&gt;

&lt;p&gt;The second issue is in the same gem and is much less exotic. In ruby_llm-mcp 1.0.1, the streamable HTTP transport builds headers for every outbound request in &lt;a href="https://github.com/patvice/ruby_llm-mcp/blob/v1.0.1/lib/ruby_llm/mcp/native/transports/streamable_http.rb#L271-L286" rel="noopener noreferrer"&gt;&lt;code&gt;build_common_headers&lt;/code&gt;&lt;/a&gt;. When an OAuth provider is configured, these are the two lines that apply the token:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Authorization"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;to_header&lt;/span&gt;
&lt;span class="nc"&gt;RubyLLM&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;MCP&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;debug&lt;/span&gt; &lt;span class="s2"&gt;"Applied OAuth authorization header: #{token.to_header}"&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The second line logs the complete &lt;code&gt;Bearer ...&lt;/code&gt; string on every request to the MCP server.&lt;/p&gt;

&lt;p&gt;It’s only written at debug level, and the defaults are reasonable: the gem’s logger writes to &lt;code&gt;$stdout&lt;/code&gt; at &lt;code&gt;INFO&lt;/code&gt;. It switches to &lt;code&gt;DEBUG&lt;/code&gt; when the &lt;code&gt;RUBYLLM_MCP_DEBUG&lt;/code&gt; environment variable is set, or when you configure &lt;code&gt;log_level&lt;/code&gt; or pass in your own logger at debug level. Think about when someone sets that variable, though. It’s usually when an OAuth connection to an MCP server isn’t working, which is exactly when a token is in play. On Heroku and most container platforms, &lt;code&gt;$stdout&lt;/code&gt; goes straight to your log drain, so the token ends up in whatever aggregator, error tracker or support bundle reads those logs, and it stays there for as long as they keep logs.&lt;/p&gt;

&lt;p&gt;There’s no advisory or maintainer statement about this, and 1.0.1 (released July 21) is still the newest version, so there isn’t an upgrade to reach for. What you can do:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Check whether &lt;code&gt;RUBYLLM_MCP_DEBUG&lt;/code&gt; is set in any environment, including staging and review apps, and whether any initializer sets the gem’s &lt;code&gt;log_level&lt;/code&gt; to debug or points its logger at &lt;code&gt;Rails.logger&lt;/code&gt; while that logger is at debug.&lt;/li&gt;
&lt;li&gt;Search your retained logs for the literal string &lt;code&gt;Applied OAuth authorization header: Bearer&lt;/code&gt;. The SSE transport logs the same prefix without the token, so matching on the full string avoids false alarms.&lt;/li&gt;
&lt;li&gt;Rotate any token that shows up, and revoke the grant on the MCP server’s side if it supports that.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A log statement next to a header assignment is worth a look in any HTTP client code, not just MCP code. In the codebases we’ve encountered, a debug line like this one is a far more common way for a credential to leak than a subtle protocol mistake.&lt;/p&gt;

&lt;h2&gt;
  
  
  Version Constraints on RubyLLM
&lt;/h2&gt;

&lt;p&gt;The third one isn’t a vulnerability, but it decides which version of your main AI dependency you’re actually running, and therefore which fixes you get.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/crmne/ruby_llm" rel="noopener noreferrer"&gt;RubyLLM&lt;/a&gt; released 2.1.0 on October 8, 2.1.1 on October 11 and 2.2.0 on November 10. When 2.1 came out, two popular gems that build on it constrained it differently:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/chatwoot/ai-agents" rel="noopener noreferrer"&gt;ai-agents&lt;/a&gt; 0.13.0 depends on &lt;code&gt;ruby_llm ~&amp;gt; 2.0.0&lt;/code&gt;, which means &lt;code&gt;&amp;gt;= 2.0.0, &amp;lt; 2.1.0&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/OlympiaAI/raix" rel="noopener noreferrer"&gt;raix&lt;/a&gt; 3.0.0 depends on &lt;code&gt;ruby_llm ~&amp;gt; 2.0&lt;/code&gt;, which means &lt;code&gt;&amp;gt;= 2.0, &amp;lt; 3.0&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The difference is a single &lt;code&gt;.0&lt;/code&gt;, and it made ai-agents 0.13.0 incompatible with every RubyLLM 2.1 release. Staying on the previous version didn’t help either: ai-agents 0.12.0 depends on &lt;code&gt;ruby_llm ~&amp;gt; 1.14&lt;/code&gt;. For almost a month, there was no ai-agents release that installed alongside RubyLLM 2.1.x. And ruby_llm-mcp, the gem from the first two sections, is pinned harder still: 1.0.1 depends on &lt;code&gt;ruby_llm ~&amp;gt; 1.9&lt;/code&gt;, so anyone using it is on RubyLLM 1.x and gets none of the 2.x releases.&lt;/p&gt;

&lt;p&gt;How a pin like that shows up depends on where you start. If your app is already on a RubyLLM release the pin excludes, adding ai-agents fails with a resolution error, which at least tells you something. If you add ai-agents first, or update both together, the resolver has to pick an older ruby_llm for the whole bundle (2.0.x with ai-agents 0.13.0, or 1.x with 0.12.0), including for any other gem that would have been happy with the newer one. Nothing fails, and the only place it shows up is the lockfile.&lt;/p&gt;

&lt;p&gt;It turns out the narrow constraint was doing its job. A Chatwoot maintainer opened &lt;a href="https://github.com/chatwoot/ai-agents/pull/80" rel="noopener noreferrer"&gt;a pull request to allow RubyLLM 2.1&lt;/a&gt; on October 26, and its description explains why the pin was there: RubyLLM 2.1 calls &lt;code&gt;tool.class.deferred?&lt;/code&gt; when a chat registers tools, ai-agents wraps tools in a class that isn’t a &lt;code&gt;RubyLLM::Tool&lt;/code&gt;, so every agent with a tool raised &lt;code&gt;NoMethodError&lt;/code&gt; and handoffs failed. The PR fixed that and widened the constraint to &lt;code&gt;&amp;gt;= 2.0, &amp;lt; 2.2&lt;/code&gt;. It was merged on November 2 and released in ai-agents 0.14.0 on November 4.&lt;/p&gt;

&lt;p&gt;That lasted six days. RubyLLM 2.2.0 came out on November 10, and &lt;code&gt;&amp;lt; 2.2&lt;/code&gt; excludes it, so ai-agents is again holding the bundle one minor version behind, while raix’s &lt;code&gt;~&amp;gt; 2.0&lt;/code&gt; already allows 2.2.0. The upper bound looks deliberate given what happened with 2.1, and it means the same cycle can repeat on every RubyLLM minor release. Before adding or upgrading any gem in this part of the stack, check what each one asks for:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;grep -n &lt;span class="s2"&gt;"ruby_llm ("&lt;/span&gt; Gemfile.lock

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Gemfile.lock&lt;/code&gt; lists every gem’s dependencies with their constraints, so this shows you which gem is holding the version down. In a stack where the base gem releases roughly monthly and several wrappers sit on top of it, the tightest constraint in the bundle is the version you actually run. If you want both ai-agents and RubyLLM’s built-in MCP client from the first section, ai-agents 0.14.0 gets you there on RubyLLM 2.1.x, but not yet on 2.2. Relaxing the constraint yourself is a gamble, since 0.13.0 broke on 2.1 for the reason the PR describes, and the next minor release could need a similar change.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Coding Agent Extension That Shipped a Backdoor
&lt;/h2&gt;

&lt;p&gt;The last one isn’t about Ruby, but it lands on the laptops where our &lt;code&gt;master.key&lt;/code&gt;, Heroku tokens and production database URLs live. We covered a related exposure, editor configuration running code the moment you open a repo, in &lt;a href="https://www.fastruby.io/blog/opening-a-repo-is-now-an-execution-event" rel="noopener noreferrer"&gt;Opening a Repo Is Now an Execution Event&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;On October 29, a tampered build of Anthropic’s Claude Code editor extension was distributed through Cursor’s extension marketplace from about 2:27am to 1:35pm PT. According to &lt;a href="https://cursor.com/blog/claude-code-extension-security-notice" rel="noopener noreferrer"&gt;Cursor’s security notice&lt;/a&gt;, the affected versions were 2.1.312 and 2.1.313 installed from that marketplace, and “These malicious versions of the extension were not developed by Anthropic.” &lt;a href="https://www.microsoft.com/en-us/security/blog/2026/10/30/inside-malicious-claude-code-branded-cursor-extension-persistent-ssh-backdoor/" rel="noopener noreferrer"&gt;Microsoft’s analysis&lt;/a&gt; states that the Visual Studio Marketplace and npm packages were not affected.&lt;/p&gt;

&lt;p&gt;The malicious build tries to add an attacker’s Ed25519 key to &lt;code&gt;~/.ssh/authorized_keys&lt;/code&gt; with the comment &lt;code&gt;svc-telemetry&lt;/code&gt;, opens a reverse SSH tunnel to &lt;code&gt;134.209.82.225&lt;/code&gt;, and sets up persistence through a macOS LaunchAgent, a Linux crontab &lt;code&gt;@reboot&lt;/code&gt; entry, or a Windows scheduled task. It also beacons host details and, in Microsoft’s words, “matching environment-variable names, not values.” That’s not much comfort on its own, because anyone with an SSH session on the machine can read the values themselves.&lt;/p&gt;

&lt;p&gt;Cursor’s notice does narrow the exposure. Turning on the local SSH service “requires admin rights, which the malicious extension does not have on most macOS and Windows hosts,” and on those hosts “the attacker could not have logged in through the tunnel.” So the machines most at risk are the ones where Remote Login was already on, or where Cursor was running with admin rights. Cursor still asks everyone who installed one of the affected versions to check, and there are two details worth knowing before you do.&lt;/p&gt;

&lt;p&gt;First, the version number only catches half of it. Nothing official ever shipped a 2.1.313: npm’s registry keeps a timestamp for every published version, including unpublished ones, and it has no entry for that number. The legitimate release is 2.1.312, published to npm on October 27 and still listed on Open VSX. So looking for 2.1.313 flags the hosts that took the fake version and silently passes the ones that took a tampered copy of the real one.&lt;/p&gt;

&lt;p&gt;Second, Cursor’s notice lists the affected platforms as Windows and macOS, but its own IOC list includes a Linux cron entry (&lt;code&gt;@reboot /bin/sh "&amp;lt;HOME&amp;gt;/.config/.smt"&lt;/code&gt;), and Microsoft describes Linux crontab persistence too. Check Linux machines as well.&lt;/p&gt;

&lt;p&gt;Searching for the indicator rather than the version works everywhere. On macOS and Linux:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;grep -n &lt;span class="s2"&gt;"svc-telemetry"&lt;/span&gt; ~/.ssh/authorized_keys
ls -la ~/.config/.smt ~/.config/.smtk /tmp/.stk_* &lt;span class="s2"&gt;"$TMPDIR"&lt;/span&gt;/.stk_* 2&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null
crontab -l 2&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null &lt;span class="o"&gt;|&lt;/span&gt; grep -n &lt;span class="s2"&gt;".smt"&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If anything turns up, follow the remediation steps in Cursor’s notice, which include platform scripts. It also warns that uninstalling the extension may not be enough, because the persistence scripts can keep running on their own. Then rotate everything that was reachable from that machine, working from a different one: Rails credentials and the &lt;code&gt;master.key&lt;/code&gt;, cloud and Heroku tokens, GitHub tokens and SSH keys, and any API keys in &lt;code&gt;.env&lt;/code&gt; files. We still don’t know how the attacker got publishing access to Cursor’s marketplace.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The AI layer of a Rails app now pulls in input and tooling that our usual checks were never built to see. A remote MCP server’s schemas reach Ruby’s regexp compiler before any tool is called, a debug line in an MCP client writes bearer tokens to stdout, a wrapper gem’s version constraint decides which RubyLLM you run, and a coding agent extension on a developer’s laptop shipped an SSH backdoor. None of them produced an advisory that bundler-audit could match.&lt;/p&gt;

&lt;p&gt;For most teams, the most urgent step is the Ruby upgrade, since CISA has listed one of those bugs as exploited in the wild (in GitLab). After that, it’s worth reading your AI gems with the same suspicion you’d apply to any code that handles data from outside your app, because many of them are young and moving fast. For the supply-chain side of the same problem, &lt;a href="https://www.fastruby.io/blog/hidden-dangers-in-your-gemfile" rel="noopener noreferrer"&gt;The Hidden Dangers in Your Gemfile&lt;/a&gt; covers recent RubyGems attacks and how to protect against them.&lt;/p&gt;

&lt;p&gt;Is your team behind on Ruby versions, or not sure what your AI gems are pulling into the bundle? Our &lt;a href="https://www.fastruby.io/monthly-ruby-maintenance" rel="noopener noreferrer"&gt;Bonsai for Ruby&lt;/a&gt; monthly maintenance service keeps Ruby and your dependencies current, so fixes like these land without a fire drill.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>security</category>
      <category>rubygems</category>
    </item>
    <item>
      <title>What We Check Before Migrating Off Heroku</title>
      <dc:creator>Ernesto Tagwerker (he/him)</dc:creator>
      <pubDate>Tue, 03 Nov 2026 05:00:00 +0000</pubDate>
      <link>https://dev.to/fastruby/what-we-check-before-migrating-off-heroku-1d4e</link>
      <guid>https://dev.to/fastruby/what-we-check-before-migrating-off-heroku-1d4e</guid>
      <description>&lt;p&gt;We recently moved a client’s Ruby on Rails app off Heroku: a Rails API with Sidekiq workers and several services around it. Before we changed anything, we spent about a week on discovery. We had a kickoff call with the client’s team on a Monday, and then two of us paired for the rest of the week to map the infrastructure and draft a migration plan.&lt;/p&gt;

&lt;p&gt;Nothing about that app followed one pattern. Its services were deployed in different ways, and some of the things that mattered most for the migration, like the tools outside Heroku that read from the database and the service that promoted code to production, didn’t show up in the Heroku dashboard at all.&lt;/p&gt;

&lt;p&gt;In this article, you will learn what we inventory before moving an app off Heroku, where to look beyond what Heroku shows you, and what our own discovery missed. Almost none of it depends on where you are going: it applies whether your target is Render, &lt;a href="https://www.fastruby.io/blog/deploying-rails-on-fly" rel="noopener noreferrer"&gt;Fly.io&lt;/a&gt;, AWS, or something else.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with the people, then verify
&lt;/h2&gt;

&lt;p&gt;We started with a kickoff call where the client’s team gave us an overview of the pieces: the main app, the services around it, and the tools they relied on. It was a high-level conversation, and after it the details were up to us. We went through each repo and each dyno on Heroku ourselves to find out what actually runs where. People describe what they think about every day, and the pieces they don’t think about are often the ones that break a migration.&lt;/p&gt;

&lt;p&gt;Some of what you need to know, Heroku can’t tell you. We worked out part of it ourselves and asked the client’s team about the rest. Before planning any downtime, it helps to know who the customers are, where they are located, and whether there are known peak events, so you can pick a window that will hurt the least.&lt;/p&gt;

&lt;p&gt;Who wrote what is something you can mostly find out on your own: we looked through the commit history of the repos to see who had worked on which part, so we knew who to send questions to later. Why the architecture looks the way it does is a question only the team can answer. Some choices are constraints you need to keep, and others are leftovers you can drop, and you want to know which is which before you rebuild them somewhere else.&lt;/p&gt;

&lt;p&gt;It’s also worth asking whether the app has a maintenance page, and which jobs run on a schedule on staging and on production, since those keep running during a cutover unless someone pauses or moves them.&lt;/p&gt;

&lt;p&gt;A few third-party tools also came up, and it wasn’t obvious at first how each one connected to the app. We ended up sorting every tool that came up into three groups:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Tools that run on Heroku, which we move.&lt;/li&gt;
&lt;li&gt;Tools that run elsewhere but depend on something we move, which the client’s team updates.&lt;/li&gt;
&lt;li&gt;Tools the migration doesn’t touch.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The second group needs the most attention, because those tools stop working if nobody updates them after the move. For us, that was an ETL sync and an AI code-review bot, both reading from the database. The client’s team wanted to update them themselves, which was fine, but we still had to find out how each one connected so everyone knew who owned what before cutover day.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Heroku tells you
&lt;/h2&gt;

&lt;p&gt;Once we knew what to look for, we went through every app in the Heroku dashboard, on both staging and production: the add-ons attached to each one, its config vars, and its dynos with their process types and sizes.&lt;/p&gt;

&lt;p&gt;During discovery, we only listed the config vars. They turned into an audit later, when we were getting ready to move each service. For each variable, we searched the codebase to see whether anything still used it, and confirmed with the client’s team when the code didn’t make it clear. Only the variables that were still in use had to be set on the new platform. Compare them between staging and production while you’re at it, since some may be set differently in each environment.&lt;/p&gt;

&lt;p&gt;We did the same with the dynos: we looked at their types and sizes during discovery, and confirmed them when each service moved, so that it would have roughly the same resources on the new platform as it had on Heroku.&lt;/p&gt;

&lt;p&gt;If you have more than a couple of apps, or you’d rather keep a copy of what you found, the Heroku CLI shows the same information. &lt;code&gt;heroku addons&lt;/code&gt; lists what is attached to an app, &lt;code&gt;heroku config&lt;/code&gt; lists its config vars, &lt;code&gt;heroku ps&lt;/code&gt; shows its process types with the size and number of dynos for each one, and &lt;code&gt;heroku pg:info&lt;/code&gt; shows the Postgres version, plan, and data size:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;heroku addons &lt;span class="nt"&gt;-a&lt;/span&gt; your-app-production
heroku config &lt;span class="nt"&gt;-a&lt;/span&gt; your-app-production
heroku ps &lt;span class="nt"&gt;-a&lt;/span&gt; your-app-production
heroku pg:info &lt;span class="nt"&gt;-a&lt;/span&gt; your-app-production

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Looping over &lt;code&gt;heroku pg:info&lt;/code&gt; is also a quick way to &lt;a href="https://www.fastruby.io/blog/upgrading-a-deprecated-heroku-postgres-database" rel="noopener noreferrer"&gt;check the Postgres version of every app you have&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Config vars hold secrets, so be careful about where that output ends up. If you only need the names, for a checklist or to compare environments, you can print the keys and diff them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;diff &amp;lt;&lt;span class="o"&gt;(&lt;/span&gt;heroku config &lt;span class="nt"&gt;--json&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt; your-app-staging | jq &lt;span class="nt"&gt;-r&lt;/span&gt; &lt;span class="s1"&gt;'keys[]'&lt;/span&gt; | &lt;span class="nb"&gt;sort&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
     &amp;lt;&lt;span class="o"&gt;(&lt;/span&gt;heroku config &lt;span class="nt"&gt;--json&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt; your-app-production | jq &lt;span class="nt"&gt;-r&lt;/span&gt; &lt;span class="s1"&gt;'keys[]'&lt;/span&gt; | &lt;span class="nb"&gt;sort&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Every component is its own migration
&lt;/h2&gt;

&lt;p&gt;Heroku shows you what runs there, but not how each piece got there. On our project, the services weren’t all deployed the same way. The image proxy, for example, ran straight from an upstream container image, with only configuration on top, while other services had build steps of their own. On Heroku they all look like any other process type, and nothing there tells you which one depends on someone else’s image and which one depends on a build you will have to reproduce.&lt;/p&gt;

&lt;p&gt;That difference decides what the move looks like. For a service that runs from an upstream image, you need to know where the image comes from and whether the new platform can pull it. For a service with its own build, whether that’s a Dockerfile, a buildpack, or a shell script, you need to read it, because it is often the only place where the build is written down.&lt;/p&gt;

&lt;p&gt;Reading the code is part of discovery, so we went through each repo. The YAML config files described the services they deployed, and they answered many of our questions about how each one was built. When something in them didn’t make sense, that became a question for the client’s team.&lt;/p&gt;

&lt;p&gt;Treat each component as a small migration of its own, with its own build step, config, and move order, instead of assuming that what works for the main app will work for everything around it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Add-ons, workers, and scheduled jobs
&lt;/h2&gt;

&lt;p&gt;For most add-ons, moving means provisioning the equivalent service on the new platform and changing a URL in the config vars. The ones to look for are add-ons with no direct equivalent. Ours was a Memcached add-on, which many platforms don’t offer as a managed service, so we replaced it with a Redis cache.&lt;/p&gt;

&lt;p&gt;During a migration, there is usually a period where both platforms can run the app. Web processes and workers can run on both for a while, as long as they talk to the same Redis, but scheduled jobs should run on exactly one platform at a time. List everything that runs on a schedule, whether it’s Heroku Scheduler, a clock process in the &lt;code&gt;Procfile&lt;/code&gt;, or a gem like sidekiq-cron, and decide where each one runs during the transition. Check, too, which jobs must never run twice at once and whether anything in the code prevents it, since two copies of a job that calls a rate-limited API can use up a quota that one was designed to stay under.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploys, DNS, and alerting
&lt;/h2&gt;

&lt;p&gt;Check how code reaches production. The Heroku pipeline showed a staging app and a production app, but promotion between them was handled outside Heroku, by a third-party automation that promoted a commit from staging after a set period. The client’s team also relied on review apps, so those went on our list of things to rebuild.&lt;/p&gt;

&lt;p&gt;Find out who controls DNS. The client’s domains were at a third-party registrar, pointing at Heroku’s DNS targets, and the client’s team made the change at cutover. Lower the TTL on every record you’ll change, and do it well ahead of the window: at least as far ahead as the record’s current TTL. Resolvers can keep serving the old value for that long, so with a 24-hour TTL, you’d lower it at least a day before.&lt;/p&gt;

&lt;p&gt;Finally, look at alerting and traffic. The client’s alerts went to Slack and PagerDuty, so decide which triggers to pause during each window and who turns them back on. We used the app’s tracing and database metrics to find the hours with the least traffic, then confirmed those traffic cycles with the client’s team.&lt;/p&gt;

&lt;h2&gt;
  
  
  What discovery missed
&lt;/h2&gt;

&lt;p&gt;A week of discovery didn’t find everything. Two things got past us, and for each of them there was a check that would have caught it earlier.&lt;/p&gt;

&lt;h3&gt;
  
  
  Extensions in a different schema in production
&lt;/h3&gt;

&lt;p&gt;The first one was in the database. Between August 2022 and mid-2023, Heroku &lt;a href="https://help.heroku.com/ZOFBHJCJ/heroku-postgres-extension-schema-restrictions" rel="noopener noreferrer"&gt;installed Postgres extensions into its own &lt;code&gt;heroku_ext&lt;/code&gt; schema&lt;/a&gt;, and extensions created during that time are still there unless someone asked Heroku Support to move them. On this app, production’s &lt;code&gt;hstore&lt;/code&gt;, &lt;code&gt;cube&lt;/code&gt;, and &lt;code&gt;earthdistance&lt;/code&gt; extensions lived in &lt;code&gt;heroku_ext&lt;/code&gt;, while staging’s lived in &lt;code&gt;public&lt;/code&gt;, and nobody knew the two environments differed. The staging rehearsal went smoothly because staging had nothing in &lt;code&gt;heroku_ext&lt;/code&gt;, but once we moved the production database, the app failed at runtime with this error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;permission denied for schema heroku_ext

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What would have caught it is comparing the two databases before moving either one. In &lt;code&gt;psql&lt;/code&gt;, &lt;code&gt;\dx&lt;/code&gt; lists the installed extensions with their versions and schemas, and &lt;code&gt;\dn+&lt;/code&gt; lists the schemas with their access privileges. Running both on staging and on production and comparing the output would have shown the difference in a few minutes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Redis connections from Heroku timing out
&lt;/h3&gt;

&lt;p&gt;The second one was Redis. We initially planned to move Redis to the new platform during the database downtime, while the web app was still running on Heroku. That meant the app had to reach the new Redis instances from Heroku over external connections, and it errored while waiting on the &lt;code&gt;AUTH&lt;/code&gt; response, because the default timeout is one second.&lt;/p&gt;

&lt;p&gt;We were moving to Render, and the cause was specific to how &lt;a href="https://render.com/docs/key-value" rel="noopener noreferrer"&gt;Render Key Value&lt;/a&gt;, its Redis-compatible service, handles connections from outside Render. Key Value only accepts internal connections by default. Once you allow external ones, each new connection has to log in with &lt;code&gt;AUTH&lt;/code&gt; before it can do anything else. Normal commands were fast, but &lt;code&gt;AUTH&lt;/code&gt; took between one and four seconds, longer than the client’s one-second timeout, and the app kept just under 400 connections open at any given time. The client treats &lt;code&gt;AUTH&lt;/code&gt; like any other command, so the only fix on the app’s side was a longer timeout for every command, which would also make real Redis problems slower to surface. Moving only part of the data wasn’t an option either: Redis held the Sidekiq job state and the GraphQL subscriptions, and every instance of the app had to use the same Redis.&lt;/p&gt;

&lt;p&gt;So we changed the plan: move the full app first, keep using Heroku’s Redis for a bit after the move, and then take a short downtime to move Redis as well. The check that would have caught this earlier is connecting from the app’s own Redis client, with its own config, over the network path it will actually use during the transition, before you plan a window around it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What discovery should leave you with
&lt;/h2&gt;

&lt;p&gt;By the end of discovery, you want a written answer for every component: how it runs today, what it connects to, and what replaces it on the new platform. A table is the simplest way to keep that in one place. For the app we moved, it looks something like this:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;How it runs today&lt;/th&gt;
&lt;th&gt;Connected to&lt;/th&gt;
&lt;th&gt;Replacement on the new platform&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Postgres&lt;/td&gt;
&lt;td&gt;Heroku Postgres&lt;/td&gt;
&lt;td&gt;web, workers, ETL sync&lt;/td&gt;
&lt;td&gt;managed Postgres&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Web (Rails API)&lt;/td&gt;
&lt;td&gt;Heroku buildpack&lt;/td&gt;
&lt;td&gt;DNS, alerting&lt;/td&gt;
&lt;td&gt;container image built in CI&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Workers and cron&lt;/td&gt;
&lt;td&gt;Heroku buildpack&lt;/td&gt;
&lt;td&gt;Redis&lt;/td&gt;
&lt;td&gt;same image as web&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Redis&lt;/td&gt;
&lt;td&gt;two attached add-ons&lt;/td&gt;
&lt;td&gt;web, workers&lt;/td&gt;
&lt;td&gt;managed Redis&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cache&lt;/td&gt;
&lt;td&gt;Memcached add-on&lt;/td&gt;
&lt;td&gt;web&lt;/td&gt;
&lt;td&gt;Redis cache&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Image proxy&lt;/td&gt;
&lt;td&gt;upstream container image&lt;/td&gt;
&lt;td&gt;web&lt;/td&gt;
&lt;td&gt;the same upstream image&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ETL sync&lt;/td&gt;
&lt;td&gt;owned by the client’s team&lt;/td&gt;
&lt;td&gt;Postgres&lt;/td&gt;
&lt;td&gt;updated by the client’s team&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Once we had answers for every component, we were free to propose the order of the migration, and the table pointed to it. We moved both databases first, staging and then production. Next came the supporting services on staging, the telemetry pieces and the image proxy, and then the staging web app and workers together with Redis.&lt;/p&gt;

&lt;p&gt;Production followed a similar pattern: the telemetry pieces and the image proxy first, then the web app and workers, which we brought up on Render independently of what was running on Heroku while DNS still pointed there and the app kept using Heroku’s Redis. The last step was a second cutover, where the client’s team changed DNS and we migrated Redis.&lt;/p&gt;

&lt;p&gt;That order held up. The one time the order itself caused a problem was when we tried to move Redis early, during the database downtime.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this article, we went through what we inventory before moving an app off Heroku. Heroku’s dashboard and CLI only cover part of that inventory. The things that mattered most on our migration lived in other repos, at the DNS registrar, in tools outside Heroku that read from the database, and in the workflow that promoted code to production. Sorting out early who owns each of those, and giving every component a row in the table, is what let us propose the migration order with confidence.&lt;/p&gt;

&lt;p&gt;Not every app needs a week. If yours is a web process and a database, the move can take &lt;a href="https://www.fastruby.io/blog/migrating-from-heroku-to-railway" rel="noopener noreferrer"&gt;about an hour&lt;/a&gt;. Even our week of discovery missed two things. A staging rehearsal catches a lot, but only for what staging and production actually share, so compare the two before you trust the rehearsal.&lt;/p&gt;

&lt;p&gt;Planning a move off Heroku? Take a look at &lt;a href="https://www.fastruby.io/blog/migrate-from-heroku" rel="noopener noreferrer"&gt;how we approach Heroku migrations&lt;/a&gt;, and &lt;a href="https://www.fastruby.io/#contactus" rel="noopener noreferrer"&gt;send us a message&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>devops</category>
    </item>
    <item>
      <title>Making AI Agents Safe to Retry</title>
      <dc:creator>Ernesto Tagwerker (he/him)</dc:creator>
      <pubDate>Tue, 27 Oct 2026 13:39:27 +0000</pubDate>
      <link>https://dev.to/fastruby/making-ai-agents-safe-to-retry-1e2f</link>
      <guid>https://dev.to/fastruby/making-ai-agents-safe-to-retry-1e2f</guid>
      <description>&lt;p&gt;Over in the OmbuLabs.ai blog, &lt;a href="https://www.ombulabs.ai/blog/react-agent" rel="noopener noreferrer"&gt;our post on the ReAct pattern in Ruby&lt;/a&gt; walked through building an agent that reasons about a task, calls tools, and acts on the results, all inside a single Ruby script. That’s fine for a command-line experiment. It’s a different story once that same agent needs to run inside a Rails app, triggered by a web request, where a multi-step reasoning loop can easily take longer than any request should stay open.&lt;/p&gt;

&lt;p&gt;The obvious fix is to move the agent into a background job. Sidekiq already handles work that takes a while, so an agent’s loop of thinking, searching, and acting should fit right in. It does, mostly, but a job’s retry semantics were built around retrying a database write, not a chain of API calls that has real, sometimes irreversible, side effects.&lt;/p&gt;

&lt;p&gt;In this article, you’ll learn why an agent’s reasoning loop doesn’t survive a naive move into a background job, how to make its side effects idempotent against Sidekiq retries, and how to stream its progress to the user while it runs.&lt;/p&gt;

&lt;h2 id="why-agents-dont-belong-in-the-request-cycle"&gt;Why Agents Don’t Belong in the Request Cycle&lt;/h2&gt;

&lt;p&gt;Picture a support ticket coming into a Rails app. A reasonable first instinct is to trigger an agent right there in the controller: it reads the ticket, searches internal docs for anything relevant, drafts a reply, and tags the ticket before the response ever renders. Each of those is a step in the ReAct loop, thought, action, observation, repeated until the agent decides it’s done.&lt;/p&gt;

&lt;p&gt;The trouble is that each step is also a network call to an LLM provider, plus whatever tool it decides to use. One search, one draft, one tag isn’t so bad. A ticket that needs two rounds of searching before the agent has enough context to draft a reply is a different story, and there’s no way to know in advance how many rounds a given ticket will need. On Heroku, &lt;a href="https://devcenter.heroku.com/articles/request-timeout" rel="noopener noreferrer"&gt;a web request has 30 seconds&lt;/a&gt; before the router gives up and returns an H12 timeout, and that’s an optimistic budget for a loop whose length depends on what the model decides to do next.&lt;/p&gt;

&lt;p&gt;Holding a web worker open for that long is also just wasteful. Puma has a fixed number of worker threads, and every request stuck waiting on an agent is a thread that isn’t serving anyone else. This is the same argument that’s applied to slow jobs since long before agents existed: &lt;a href="https://www.ombulabs.ai/blog/sidekiq/processing-a-csv-file-in-batch-with-sidekiq.html" rel="noopener noreferrer"&gt;a 10,000+ row CSV upload was enough to time out a browser&lt;/a&gt;. It’s just that an agent’s loop is often slower and less predictable than a fixed-size file.&lt;/p&gt;

&lt;p&gt;Sidekiq is the obvious place to put this kind of work: queue a job, return a response immediately, let the ticket update once the job finishes. The rest of this article is about what happens once you actually do that.&lt;/p&gt;

&lt;h2 id="moving-the-agent-into-a-sidekiq-job"&gt;Moving the Agent into a Sidekiq Job&lt;/h2&gt;

&lt;p&gt;We’ll build on the same shape as the ReAct pattern post: an agent with a few tools, looping through thought, action, and observation until it’s done. Here, the tools are specific to ticket triage, searching internal docs, drafting a reply, and tagging the ticket:&lt;/p&gt;

&lt;pre class="highlight"&gt;&lt;code&gt;&lt;span class="c1"&gt;# app/services/ticket_triage/tools.rb&lt;/span&gt;
&lt;span class="k"&gt;module&lt;/span&gt; &lt;span class="nn"&gt;TicketTriage&lt;/span&gt;
  &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Tools&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;initialize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ticket&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="vi"&gt;@ticket&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ticket&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;search_docs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="no"&gt;InternalDocs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="ss"&gt;:summary&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;rescue&lt;/span&gt; &lt;span class="no"&gt;InternalDocs&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Error&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;
      &lt;span class="s2"&gt;"Search failed: &lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;message&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;draft_reply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="vi"&gt;@ticket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;draft_reply: &lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;status: &lt;/span&gt;&lt;span class="s2"&gt;"drafted"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="s2"&gt;"Draft saved."&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;tag_ticket&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="vi"&gt;@ticket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;tags: &lt;/span&gt;&lt;span class="n"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="s2"&gt;"Tagged with &lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;", "&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;."&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The function definitions follow the same JSON shape Claude expects, one per tool:&lt;/p&gt;

&lt;pre class="highlight"&gt;&lt;code&gt;&lt;span class="no"&gt;FUNCTION_DEFINITIONS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="ss"&gt;name: &lt;/span&gt;&lt;span class="s2"&gt;"search_docs"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;description: &lt;/span&gt;&lt;span class="s2"&gt;"Search internal documentation for relevant context"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;input_schema: &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="ss"&gt;type: &lt;/span&gt;&lt;span class="s2"&gt;"object"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="ss"&gt;properties: &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="ss"&gt;query: &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="ss"&gt;type: &lt;/span&gt;&lt;span class="s2"&gt;"string"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;description: &lt;/span&gt;&lt;span class="s2"&gt;"What to search for"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="ss"&gt;required: &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"query"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="ss"&gt;name: &lt;/span&gt;&lt;span class="s2"&gt;"draft_reply"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;description: &lt;/span&gt;&lt;span class="s2"&gt;"Save a draft reply to the ticket"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;input_schema: &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="ss"&gt;type: &lt;/span&gt;&lt;span class="s2"&gt;"object"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="ss"&gt;properties: &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="ss"&gt;content: &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="ss"&gt;type: &lt;/span&gt;&lt;span class="s2"&gt;"string"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;description: &lt;/span&gt;&lt;span class="s2"&gt;"The drafted reply text"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="ss"&gt;required: &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="ss"&gt;name: &lt;/span&gt;&lt;span class="s2"&gt;"tag_ticket"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;description: &lt;/span&gt;&lt;span class="s2"&gt;"Apply tags to the ticket for routing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;input_schema: &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="ss"&gt;type: &lt;/span&gt;&lt;span class="s2"&gt;"object"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="ss"&gt;properties: &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="ss"&gt;tags: &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="ss"&gt;type: &lt;/span&gt;&lt;span class="s2"&gt;"array"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;items: &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="ss"&gt;type: &lt;/span&gt;&lt;span class="s2"&gt;"string"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="ss"&gt;required: &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"tags"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;freeze&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The agent itself is close to the &lt;code class="language-plaintext highlighter-rouge"&gt;ReActAgent&lt;/code&gt; class from the earlier post, adapted to work on a single ticket instead of a blog topic:&lt;/p&gt;

&lt;pre class="highlight"&gt;&lt;code&gt;&lt;span class="c1"&gt;# app/services/ticket_triage/agent.rb&lt;/span&gt;
&lt;span class="k"&gt;module&lt;/span&gt; &lt;span class="nn"&gt;TicketTriage&lt;/span&gt;
  &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;initialize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ticket&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="vi"&gt;@ticket&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ticket&lt;/span&gt;
      &lt;span class="vi"&gt;@tools&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Tools&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ticket&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="vi"&gt;@messages&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;run&lt;/span&gt;
      &lt;span class="vi"&gt;@messages&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="ss"&gt;role: &lt;/span&gt;&lt;span class="s2"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="ss"&gt;content: &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="ss"&gt;type: &lt;/span&gt;&lt;span class="s2"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;text: &lt;/span&gt;&lt;span class="s2"&gt;"Triage this ticket:&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="vi"&gt;@ticket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;body&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}]&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;

      &lt;span class="kp"&gt;loop&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
        &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;complete&lt;/span&gt;
        &lt;span class="k"&gt;break&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;content&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all?&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:type&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="ss"&gt;:text&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="vi"&gt;@messages&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="ss"&gt;role: &lt;/span&gt;&lt;span class="s2"&gt;"assistant"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;content: &lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;content&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;content&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;each&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
          &lt;span class="k"&gt;next&lt;/span&gt; &lt;span class="k"&gt;unless&lt;/span&gt; &lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:type&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="ss"&gt;:tool_use&lt;/span&gt;

          &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dispatch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:name&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:input&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
          &lt;span class="vi"&gt;@messages&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="ss"&gt;role: &lt;/span&gt;&lt;span class="s2"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="ss"&gt;content: &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="ss"&gt;type: &lt;/span&gt;&lt;span class="s2"&gt;"tool_result"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;tool_use_id: &lt;/span&gt;&lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:id&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="ss"&gt;content: &lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_s&lt;/span&gt; &lt;span class="p"&gt;}]&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;end&lt;/span&gt;
      &lt;span class="k"&gt;end&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;

    &lt;span class="kp"&gt;private&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;dispatch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tool_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;tool_name&lt;/span&gt;
      &lt;span class="k"&gt;when&lt;/span&gt; &lt;span class="s2"&gt;"search_docs"&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt; &lt;span class="vi"&gt;@tools&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search_docs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:query&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
      &lt;span class="k"&gt;when&lt;/span&gt; &lt;span class="s2"&gt;"draft_reply"&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt; &lt;span class="vi"&gt;@tools&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;draft_reply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:content&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
      &lt;span class="k"&gt;when&lt;/span&gt; &lt;span class="s2"&gt;"tag_ticket"&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt; &lt;span class="vi"&gt;@tools&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;tag_ticket&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:tags&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
      &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="s2"&gt;"Unknown tool"&lt;/span&gt;
      &lt;span class="k"&gt;end&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;complete&lt;/span&gt;
      &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="ss"&gt;model: &lt;/span&gt;&lt;span class="s2"&gt;"claude-sonnet-5"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="ss"&gt;max_tokens: &lt;/span&gt;&lt;span class="mi"&gt;1024&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="ss"&gt;system: &lt;/span&gt;&lt;span class="no"&gt;SYSTEM_PROMPT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="ss"&gt;messages: &lt;/span&gt;&lt;span class="vi"&gt;@messages&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="ss"&gt;tools: &lt;/span&gt;&lt;span class="no"&gt;FUNCTION_DEFINITIONS&lt;/span&gt;
      &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;client&lt;/span&gt;
      &lt;span class="vi"&gt;@client&lt;/span&gt; &lt;span class="o"&gt;||=&lt;/span&gt; &lt;span class="no"&gt;Anthropic&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;api_key: &lt;/span&gt;&lt;span class="no"&gt;ENV&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"ANTHROPIC_API_KEY"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Wrapping this in a job is, at first, almost anticlimactic:&lt;/p&gt;

&lt;pre class="highlight"&gt;&lt;code&gt;&lt;span class="c1"&gt;# app/jobs/ticket_triage_job.rb&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;TicketTriageJob&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;ApplicationJob&lt;/span&gt;
  &lt;span class="n"&gt;queue_as&lt;/span&gt; &lt;span class="ss"&gt;:default&lt;/span&gt;

  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;perform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ticket_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;ticket&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Ticket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ticket_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="no"&gt;TicketTriage&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ticket&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And the call site, wherever a ticket gets created:&lt;/p&gt;

&lt;pre class="highlight"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;create&lt;/span&gt;
  &lt;span class="vi"&gt;@ticket&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Ticket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ticket_params&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="no"&gt;TicketTriageJob&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;perform_later&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="vi"&gt;@ticket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;redirect_to&lt;/span&gt; &lt;span class="vi"&gt;@ticket&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The controller returns right away, the agent does its work on a Sidekiq worker, and the ticket’s &lt;code class="language-plaintext highlighter-rouge"&gt;draft_reply&lt;/code&gt; and &lt;code class="language-plaintext highlighter-rouge"&gt;tags&lt;/code&gt; show up whenever the job finishes. This is the version that works when everything goes right. The next section is about what happens when it doesn’t.&lt;/p&gt;

&lt;h2 id="retries-replay-the-whole-loop"&gt;Retries Replay the Whole Loop&lt;/h2&gt;

&lt;p&gt;Sidekiq’s default behavior on an unhandled exception is to re-enqueue the job and try again later, with a backoff, up to 25 times unless you configure otherwise. This works well for the kind of job Sidekiq was originally built around: something like resizing an uploaded image or writing a row, where the whole method is safe to run again from the top, or already guards itself with a &lt;code class="language-plaintext highlighter-rouge"&gt;find_or_create_by&lt;/code&gt; or a unique index.&lt;/p&gt;

&lt;p&gt;&lt;code class="language-plaintext highlighter-rouge"&gt;TicketTriageJob#perform&lt;/code&gt; doesn’t have that property, because Sidekiq has no idea what happened inside the agent’s loop. It only knows whether &lt;code class="language-plaintext highlighter-rouge"&gt;perform&lt;/code&gt; raised or returned. If the database connection drops while tagging the ticket, after the agent has already searched the docs and drafted a reply, the job as a whole raises, and Sidekiq schedules a full retry of &lt;code class="language-plaintext highlighter-rouge"&gt;perform&lt;/code&gt;, not a retry of “just that last step.”&lt;/p&gt;

&lt;p&gt;Here’s roughly what that looks like across the two attempts:&lt;/p&gt;

&lt;pre class="highlight"&gt;&lt;code&gt;Attempt 1:
💬 Thought: Let me search for relevant documentation first.
🔧 Action: search_docs({query: "refund policy digital goods"})
📝 Observation: Refunds are issued within 14 days...

💬 Thought: I have enough context to draft a reply.
🔧 Action: draft_reply({content: "Thanks for reaching out! Per our..."})
📝 Observation: Draft saved.

💬 Thought: This looks like a billing issue, let me tag it.
🔧 Action: tag_ticket({tags: ["billing", "refund"]})
📝 Observation: ActiveRecord::ConnectionTimeoutError: could not obtain a database connection within 5.000 seconds
[job raises, Sidekiq schedules a retry]

Attempt 2:
💬 Thought: Let me search for relevant documentation first.
🔧 Action: search_docs({query: "refund policy digital goods"})
📝 Observation: Refunds are issued within 14 days...

💬 Thought: I have enough context to draft a reply.
🔧 Action: draft_reply({content: "Hi there, thank you for contacting us..."})
📝 Observation: Draft saved.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Two things went wrong here that would be easy to miss in a quick look at the logs. The search happened twice, which is a wasted API call and a few cents, not a disaster on its own. The draft happened twice, and because the model isn’t deterministic between calls, the second draft isn’t the same text as the first, it just quietly replaced it. If &lt;code class="language-plaintext highlighter-rouge"&gt;draft_reply&lt;/code&gt; had gone one step further and actually sent the reply to the customer instead of just saving it, attempt two would have sent a second, different email for the same ticket.&lt;/p&gt;

&lt;p&gt;None of this is a Sidekiq bug. Sidekiq is doing exactly what it promises: retrying the job. The mismatch is that “the job” here is a loop with several external, stateful side effects glued together, and retrying it as one unit assumes every step inside is either free to repeat or already protects itself. Neither is true yet in this version.&lt;/p&gt;

&lt;h2 id="making-the-agents-side-effects-idempotent"&gt;Making the Agent’s Side Effects Idempotent&lt;/h2&gt;

&lt;p&gt;The fix isn’t to stop Sidekiq from retrying, it’s to make each side-effecting tool check whether it already did its job before doing it again. &lt;code class="language-plaintext highlighter-rouge"&gt;search_docs&lt;/code&gt; doesn’t need this, it only reads, so repeating it wastes a little time and a little API budget but changes nothing. &lt;code class="language-plaintext highlighter-rouge"&gt;draft_reply&lt;/code&gt; and &lt;code class="language-plaintext highlighter-rouge"&gt;tag_ticket&lt;/code&gt; do need it, because each one writes something that a second, different write would silently clobber or duplicate:&lt;/p&gt;

&lt;pre class="highlight"&gt;&lt;code&gt;&lt;span class="c1"&gt;# app/services/ticket_triage/tools.rb&lt;/span&gt;
&lt;span class="k"&gt;module&lt;/span&gt; &lt;span class="nn"&gt;TicketTriage&lt;/span&gt;
  &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Tools&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;initialize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ticket&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="vi"&gt;@ticket&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ticket&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;search_docs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="no"&gt;InternalDocs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="ss"&gt;:summary&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;rescue&lt;/span&gt; &lt;span class="no"&gt;InternalDocs&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Error&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;
      &lt;span class="s2"&gt;"Search failed: &lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;message&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;draft_reply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"Already drafted, skipping."&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="vi"&gt;@ticket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;draft_reply&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;present?&lt;/span&gt;

      &lt;span class="vi"&gt;@ticket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;draft_reply: &lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;status: &lt;/span&gt;&lt;span class="s2"&gt;"drafted"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="s2"&gt;"Draft saved."&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;tag_ticket&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"Already tagged, skipping."&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="vi"&gt;@ticket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;present?&lt;/span&gt;

      &lt;span class="vi"&gt;@ticket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;tags: &lt;/span&gt;&lt;span class="n"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="s2"&gt;"Tagged with &lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;", "&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;."&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The guard clause in each method reads the ticket’s own state as the record of what already happened, rather than adding a separate idempotency-key table. This works here because the ticket’s fields double as their own completion markers: a &lt;code class="language-plaintext highlighter-rouge"&gt;draft_reply&lt;/code&gt; isn’t just an input to the next step, it’s proof the step already ran. A job whose side effects don’t leave that kind of trace on an existing record, sending a Slack message with no corresponding column to check, say, would need something more explicit, like a &lt;code class="language-plaintext highlighter-rouge"&gt;processed_steps&lt;/code&gt; array on the ticket, or a Redis key set right before the external call.&lt;/p&gt;

&lt;p&gt;The short string each guard returns matters as much as the guard itself. It goes back into the agent’s message history as a normal tool result, so the model reads “Already drafted, skipping.” the same way it would read “Draft saved.”, and moves on to the next step instead of getting stuck or trying the same action again. Replaying attempt two from the earlier trace with these guards in place, the search still runs twice (harmless), the draft short-circuits on the second attempt (no second, different email going out), and the tag, which is what actually failed the first time, gets a real chance to succeed.&lt;/p&gt;

&lt;h2 id="streaming-progress-to-the-user"&gt;Streaming Progress to the User&lt;/h2&gt;

&lt;p&gt;The agent is now safe to retry, but from the ticket page it’s invisible. Someone looking at the ticket while the job runs sees nothing change for however long the loop takes, then the draft reply and tags appear all at once. That’s a worse experience than the synchronous version was, even though it’s more robust underneath.&lt;/p&gt;

&lt;p&gt;Turbo Streams can close that gap without adding a polling endpoint or a websocket layer of our own. The usual Hotwire pattern broadcasts from an ActiveRecord callback, and &lt;a href="https://www.ombulabs.ai/blog/rails/hotwire/hotwire-demo.html" rel="noopener noreferrer"&gt;broadcasting directly from a job used to be the trickier path&lt;/a&gt; when we first tried it. What’s different here is that &lt;code class="language-plaintext highlighter-rouge"&gt;TicketTriageJob&lt;/code&gt; runs once and finishes, it isn’t a self-rescheduling poller broadcasting on every tick indefinitely, so calling &lt;code class="language-plaintext highlighter-rouge"&gt;Turbo::StreamsChannel.broadcast_append_to&lt;/code&gt; directly from the agent, the way we do below, stays simple for this bounded sequence of steps. We broadcast a small update at each step of the loop:&lt;/p&gt;

&lt;pre class="highlight"&gt;&lt;code&gt;&lt;span class="c1"&gt;# app/services/ticket_triage/agent.rb&lt;/span&gt;
&lt;span class="k"&gt;module&lt;/span&gt; &lt;span class="nn"&gt;TicketTriage&lt;/span&gt;
  &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;run&lt;/span&gt;
      &lt;span class="n"&gt;broadcast_step&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Starting triage..."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

      &lt;span class="vi"&gt;@messages&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="ss"&gt;role: &lt;/span&gt;&lt;span class="s2"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="ss"&gt;content: &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="ss"&gt;type: &lt;/span&gt;&lt;span class="s2"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;text: &lt;/span&gt;&lt;span class="s2"&gt;"Triage this ticket:&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="vi"&gt;@ticket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;body&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}]&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;

      &lt;span class="kp"&gt;loop&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
        &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;complete&lt;/span&gt;
        &lt;span class="k"&gt;break&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;content&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all?&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:type&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="ss"&gt;:text&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="vi"&gt;@messages&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="ss"&gt;role: &lt;/span&gt;&lt;span class="s2"&gt;"assistant"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;content: &lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;content&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;content&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;each&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
          &lt;span class="k"&gt;next&lt;/span&gt; &lt;span class="k"&gt;unless&lt;/span&gt; &lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:type&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="ss"&gt;:tool_use&lt;/span&gt;

          &lt;span class="n"&gt;broadcast_step&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Calling &lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:name&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;..."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
          &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dispatch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:name&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:input&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
          &lt;span class="n"&gt;broadcast_step&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

          &lt;span class="vi"&gt;@messages&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="ss"&gt;role: &lt;/span&gt;&lt;span class="s2"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="ss"&gt;content: &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="ss"&gt;type: &lt;/span&gt;&lt;span class="s2"&gt;"tool_result"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;tool_use_id: &lt;/span&gt;&lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:id&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="ss"&gt;content: &lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_s&lt;/span&gt; &lt;span class="p"&gt;}]&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;end&lt;/span&gt;
      &lt;span class="k"&gt;end&lt;/span&gt;

      &lt;span class="n"&gt;broadcast_step&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Triage complete."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;

    &lt;span class="kp"&gt;private&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;broadcast_step&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="no"&gt;Turbo&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;StreamsChannel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;broadcast_append_to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="vi"&gt;@ticket&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="ss"&gt;target: &lt;/span&gt;&lt;span class="s2"&gt;"agent_activity"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="ss"&gt;partial: &lt;/span&gt;&lt;span class="s2"&gt;"tickets/agent_step"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="ss"&gt;locals: &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="ss"&gt;text: &lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;

    &lt;span class="c1"&gt;# dispatch, complete, and client stay as they were&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The partial being appended is about as plain as a Turbo Stream target gets:&lt;/p&gt;

&lt;pre class="highlight"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;%# app/views/tickets/_agent_step.html.erb %&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;p&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"agent-step"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="cp"&gt;%&amp;gt;&lt;/span&gt;&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And the ticket’s show page just needs to subscribe to the stream and give the broadcasts somewhere to land:&lt;/p&gt;

&lt;pre class="highlight"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="n"&gt;turbo_stream_from&lt;/span&gt; &lt;span class="vi"&gt;@ticket&lt;/span&gt; &lt;span class="cp"&gt;%&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"agent_activity"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="c"&gt;&amp;lt;!-- agent steps get appended here as the job runs --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Whoever has the ticket open watches the activity fill in step by step instead of staring at an unchanged page. One thing worth deciding deliberately rather than by default: &lt;code class="language-plaintext highlighter-rouge"&gt;result.to_s&lt;/code&gt; broadcasts whatever the tool returned, including the full text of a drafted reply. That’s fine for an internal support queue, but if this pattern gets reused somewhere a customer might see the stream, broadcast a short status (“Draft ready for review”) instead of the tool’s raw output.&lt;/p&gt;

&lt;p&gt;That covers live progress for whoever has the ticket open, which is a different need from knowing what each step cost after the fact. If you also want to track token usage, latency, and dollar cost per call, see &lt;a href="https://www.fastruby.io/blog/instrumenting-llm-calls-in-rails-with-event-notify" rel="noopener noreferrer"&gt;Tracking LLM Latency &amp;amp; Cost with Rails Events&lt;/a&gt;, which wires that up with the Rails 8.1 Event Reporter.&lt;/p&gt;

&lt;h2 id="conclusion"&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Getting an agent out of the request cycle and into Sidekiq was the easy part, and it’s also the part that looks finished before it actually is. The &lt;code class="language-plaintext highlighter-rouge"&gt;TicketTriageJob&lt;/code&gt; from the second section runs, and runs correctly, right up until something fails partway through and Sidekiq does exactly what it’s supposed to do: retry the whole thing. Making that safe meant treating the ticket’s own fields as a record of which steps already happened, so a retried loop skips what’s done instead of repeating it. Making it visible meant broadcasting each step over Turbo Streams as it happens, since a job that’s safe to retry silently is still a bad experience if it looks frozen for a minute at a time.&lt;/p&gt;

&lt;p&gt;None of this is free complexity. A tool that only reads, or an agent that makes a single classification call and returns, doesn’t need idempotency guards because there’s nothing stateful to duplicate. These patterns earn their keep specifically when an agent’s loop can run more than once, touches something outside the database, and takes long enough that a user is watching it happen, which describes more production agent work than not, but not all of it. It’s also worth confirming an agent is the right feature for the job in the first place, before any of this gets built, and we’ve covered &lt;a href="https://www.fastruby.io/blog/from-ai-opportunity-to-ai-feature" rel="noopener noreferrer"&gt;how to prioritize which AI features to build in a Rails app&lt;/a&gt; elsewhere. Streaming progress to the user, as covered here, is also a different problem from tracing what an agent did for your own debugging after the fact, &lt;a href="https://www.ombulabs.ai/blog/why-llm-applications-need-tracing" rel="noopener noreferrer"&gt;we’ve written separately about why LLM applications need that kind of observability&lt;/a&gt; too.&lt;/p&gt;

&lt;p&gt;Running agents in production and hitting failure modes like these? &lt;a href="/#contact-us"&gt;Let’s talk about it&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>ruby</category>
    </item>
    <item>
      <title>Bootstrap 4 to 5, One Controller at a Time</title>
      <dc:creator>Ernesto Tagwerker (he/him)</dc:creator>
      <pubDate>Fri, 23 Oct 2026 16:13:41 +0000</pubDate>
      <link>https://dev.to/fastruby/bootstrap-4-to-5-one-controller-at-a-time-183j</link>
      <guid>https://dev.to/fastruby/bootstrap-4-to-5-one-controller-at-a-time-183j</guid>
      <description>&lt;p&gt;You’ve decided your Ruby on Rails app needs to move from Bootstrap 4 to Bootstrap 5. Bootstrap 4 is &lt;a href="https://getbootstrap.com/docs/4.6/end-of-life/" rel="noopener noreferrer"&gt;end of life&lt;/a&gt; and no longer receives bug fixes or security updates. Maybe you also want to get jQuery out of your front end, or maybe a component you need only exists in version 5. The catch is that Bootstrap 5 renames classes and data attributes, and that touches many of the views in the app. In a large application, changing all of them in a single pull request is hard to review, hard to test, and hard to roll back.&lt;/p&gt;

&lt;p&gt;We recently borrowed the idea behind the &lt;a href="///blog/upgrade-rails/dual-boot/dual-boot-with-rails-6-0-beta.html"&gt;Dual-Boot technique&lt;/a&gt;, running two versions of a dependency side by side, for something other than Rails: Bootstrap itself. Instead of upgrading everything at once, we kept both versions in the app and moved one controller at a time, for many of the same reasons that you might &lt;a href="https://dev.to/blog/can-you-upgrade-in-increments"&gt;upgrade Rails in increments&lt;/a&gt;. In this article, you will learn how to run Bootstrap 4 and 5 side by side in one Rails app, how to pick the version per controller with a layout, and how to sequence the migration into small pull requests.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two Bootstrap versions in one app
&lt;/h2&gt;

&lt;p&gt;The first obstacle is that both versions are published under the same package name, so you can’t have &lt;code&gt;bootstrap&lt;/code&gt; at 4.x and 5.x in the same &lt;code&gt;package.json&lt;/code&gt;. npm aliases solve that. We kept the original packages as they were and installed the Bootstrap 5 versions under new names:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"dependencies"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"bootstrap"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"^4.5.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"bootstrap-select"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"^1.13.18"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"bootstrap5"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"npm:bootstrap@^5.3.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"bootstrap-select5"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"npm:bootstrap-select@^1.14.0-beta3"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Anything that wraps Bootstrap needs the same treatment, which is why &lt;code&gt;bootstrap-select&lt;/code&gt; has an alias too. The &lt;code&gt;1.14&lt;/code&gt; release of &lt;code&gt;bootstrap-select&lt;/code&gt; that supports Bootstrap 5 was still a beta when we did this, so check whether a stable release is available before you copy these versions. After &lt;code&gt;npm install&lt;/code&gt;, both versions live in &lt;code&gt;node_modules&lt;/code&gt;, one under &lt;code&gt;bootstrap&lt;/code&gt; and one under &lt;code&gt;bootstrap5&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The next step is to give each version its own entry point. For CSS, we have one Sass file per version, and the Bootstrap 5 one imports everything through the alias:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="c1"&gt;// application-bootstrap5.scss&lt;/span&gt;
&lt;span class="k"&gt;@import&lt;/span&gt; &lt;span class="s1"&gt;'app-bootstrap5/variables'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;@import&lt;/span&gt; &lt;span class="s1"&gt;'bootstrap5/scss/bootstrap'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;@import&lt;/span&gt; &lt;span class="s1"&gt;'app-bootstrap5/main'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;@import&lt;/span&gt; &lt;span class="s1"&gt;'bootstrap-select5/dist/css/bootstrap-select'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The order matters here: our variable overrides come before Bootstrap, so they can replace its defaults. The Bootstrap 4 entry file looks the same but imports the original packages, and both compile to separate files in &lt;code&gt;app/assets/builds&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;One caveat is that &lt;code&gt;@import&lt;/code&gt; has been deprecated in Dart Sass since version 1.80.0, and it is planned for removal in 3.0.0, so you will see deprecation warnings. We silence them for now with the &lt;code&gt;--silence-deprecation=import&lt;/code&gt; flag in our &lt;code&gt;sass&lt;/code&gt; command. Moving to &lt;code&gt;@use&lt;/code&gt; is a separate piece of work that can wait until the Bootstrap migration is done.&lt;/p&gt;

&lt;p&gt;JavaScript follows the same pattern, and it assumes the app already bundles with esbuild (we covered that migration in &lt;a href="https://dev.to/blog/migrate-rails-app-from-sprockets-to-esbuild"&gt;Migrating From Sprockets to esbuild in Rails&lt;/a&gt;). We pass both entry files to esbuild in the same &lt;code&gt;build&lt;/code&gt; script, so each version ends up with its own bundle in &lt;code&gt;app/assets/builds&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"build"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"esbuild app/javascript/application.js app/javascript/application-bs5.js --bundle --sourcemap --format=iife --outdir=app/assets/builds --minify"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The old entry point, &lt;code&gt;application.js&lt;/code&gt;, is untouched. The new one, &lt;code&gt;application-bs5.js&lt;/code&gt;, imports Bootstrap 5 through the alias and exposes it on &lt;code&gt;window&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// application-bs5.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nc"&gt;Popper&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'@popperjs/core'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;bootstrap&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'bootstrap5'&lt;/span&gt;

&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Popper&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Popper&lt;/span&gt;
&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;bootstrap&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bootstrap&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Setting &lt;code&gt;window.bootstrap&lt;/code&gt; here is not only a convenience. As we’ll see in the section on shared code, it is also how other scripts can tell which bundle they are running in. Our real entry file goes on to load the rest of the app’s scripts, but the Bootstrap part is just those few lines. At this point nothing in the app has changed, because no page loads the new bundles yet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Choosing the version with a layout
&lt;/h2&gt;

&lt;p&gt;Rails already has a natural place to decide which assets a page loads: the layout. We kept the existing &lt;code&gt;application&lt;/code&gt; layout exactly as it was, still loading the Bootstrap 4 stylesheet and the original JavaScript bundle, and added a second layout next to it. Here is a trimmed version of the new one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight erb"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
  &lt;span class="cp"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="n"&gt;stylesheet_link_tag&lt;/span&gt; &lt;span class="s2"&gt;"application-bootstrap5"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;media&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"all"&lt;/span&gt; &lt;span class="cp"&gt;%&amp;gt;&lt;/span&gt;
  &lt;span class="cp"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="n"&gt;javascript_include_tag&lt;/span&gt; &lt;span class="s2"&gt;"application-bs5"&lt;/span&gt; &lt;span class="cp"&gt;%&amp;gt;&lt;/span&gt;
  &lt;span class="cp"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="n"&gt;csrf_meta_tags&lt;/span&gt; &lt;span class="cp"&gt;%&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;body&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"app-bootstrap5"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="cp"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="cp"&gt;%&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A controller opts in with a single line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ReportsController&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nc"&gt;ApplicationController&lt;/span&gt;
  &lt;span class="n"&gt;layout&lt;/span&gt; &lt;span class="s2"&gt;"application_bs5"&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s the whole switch. Unless an action overrides it, every action in that controller renders with Bootstrap 5, and every other controller keeps rendering with Bootstrap 4. A pull request that migrates one controller should mostly affect only the pages that controller serves, as long as the shared partials it touches keep working under both versions. We named the layouts with a &lt;code&gt;_bs5&lt;/code&gt; suffix on purpose, and as we’ll see in the next section, that naming convention ends up being useful in code.&lt;/p&gt;

&lt;p&gt;If a group of controllers shares a base controller, leave the base controller on the old layout and set the new one on each child controller as you migrate it. The base controller switches last.&lt;/p&gt;

&lt;h2&gt;
  
  
  Shared partials and helpers
&lt;/h2&gt;

&lt;p&gt;Layouts take care of the page shell, but partials and helpers are shared between controllers, and a partial used by one migrated controller and one unmigrated controller has to render correctly under both versions. This is the part of the approach that needs the most care.&lt;/p&gt;

&lt;p&gt;The first thing we added was a helper that tells a view which version it is being rendered under. Since we named the layouts with a &lt;code&gt;_bs5&lt;/code&gt; suffix, it can just ask the controller:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;module&lt;/span&gt; &lt;span class="nc"&gt;ApplicationHelper&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;bs5_layout?&lt;/span&gt;
    &lt;span class="n"&gt;controller&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;class&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_layout&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;to_s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;end_with?&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"_bs5"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The underscore in &lt;code&gt;_layout&lt;/code&gt; is a hint that it is an internal Rails method, not a public API, so it could change between Rails versions. We are comfortable with that because the helper is transitional code that gets deleted at the end, but it’s worth a quick check if you upgrade Rails in the middle of the migration. The helper also expects layouts declared as plain strings, as in our controllers. &lt;code&gt;_layout&lt;/code&gt; holds whatever was passed to &lt;code&gt;layout&lt;/code&gt;, and when that is a symbol (the name of a method that picks the layout) or a proc, the layout is only decided at request time, so there is no layout name to check for the &lt;code&gt;_bs5&lt;/code&gt; suffix. For example, with this declaration &lt;code&gt;_layout&lt;/code&gt; returns &lt;code&gt;:pick_layout&lt;/code&gt;, the name of the method, and the helper would report Bootstrap 4 even for users who get the Bootstrap 5 layout:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;PostsController&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nc"&gt;ApplicationController&lt;/span&gt;
  &lt;span class="n"&gt;layout&lt;/span&gt; &lt;span class="ss"&gt;:pick_layout&lt;/span&gt;

  &lt;span class="kd"&gt;private&lt;/span&gt;

  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;pick_layout&lt;/span&gt;
    &lt;span class="n"&gt;current_user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;beta?&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s2"&gt;"application_bs5"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"application"&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Shared partials can now branch on &lt;code&gt;bs5_layout?&lt;/code&gt; wherever the markup differs. For example, a table header that used &lt;code&gt;thead-light&lt;/code&gt; in Bootstrap 4 needs &lt;code&gt;table-light&lt;/code&gt; in Bootstrap 5, and a collapse toggle needs &lt;code&gt;data-bs-toggle&lt;/code&gt; instead of &lt;code&gt;data-toggle&lt;/code&gt;. We also gave our dropdown helpers a &lt;code&gt;bs5:&lt;/code&gt; keyword argument that defaults to &lt;code&gt;false&lt;/code&gt;, because Bootstrap 5 renamed &lt;code&gt;custom-select&lt;/code&gt; to &lt;code&gt;form-select&lt;/code&gt;. Existing callers keep working without changes, and migrated views pass &lt;code&gt;bs5: true&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Our rule was that the first pull request that renders a shared partial converts it, and the partial has to work under both versions until the migration is done. Partials that only migrated controllers render can be converted outright, with no branching. We also kept a list of every branch we added, so we could remove them later.&lt;/p&gt;

&lt;p&gt;Remote JavaScript responses (&lt;code&gt;*.js.erb&lt;/code&gt;) were the one place where branching on the layout doesn’t work. They get rendered by whichever controller handled the request, but the markup they inject lands in a page that could be using either version, so their output has to stay neutral. Modals were the main case. Bootstrap 4 opens them through a jQuery plugin and Bootstrap 5 uses a plain JavaScript API, so we wrapped both behind two small functions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;showModal&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;selector&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;options&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;el&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;selector&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;bootstrap&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;bootstrap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Modal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getOrCreateInstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;el&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;show&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$(&lt;/span&gt;&lt;span class="n"&gt;el&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;modal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Bootstrap 5 bundle sets &lt;code&gt;window.bootstrap&lt;/code&gt; and the Bootstrap 4 bundle doesn’t, so the function can tell which API to call. &lt;code&gt;hideModal&lt;/code&gt; works the same way, and both are also exposed on &lt;code&gt;window&lt;/code&gt; so remote responses can call them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sequencing the controllers
&lt;/h2&gt;

&lt;p&gt;With the switch in place, the remaining question is the order. We started with the smallest controllers that depended the least on the rest of the application, because those are the easiest to migrate and to test. They were also where we worked out the workflow and the conventions that the rest of the app would follow. From there we moved on to more complex controllers and left the hardest ones for last. By then we had already run into most of the problems they would raise, and had solved them, so even the hardest controllers were easier than they would have been at the start.&lt;/p&gt;

&lt;p&gt;The first pull request is the foundation. It adds the &lt;code&gt;bs5_layout?&lt;/code&gt; helper, converts the shared partials the first controllers need (a sidebar, a history table, a search modal in our case), and migrates only a few pages that use them. Nothing in it is exciting, but it gives every later pull request something to build on. After that, each pull request migrates one controller or a small group of related ones, sets their layout, and converts any views and partials that only they render. Small pull requests like these are the same approach we recommend for most Rails upgrades, as we explain in &lt;a href="///blog/rails/upgrades/rails-upgrade-strategies.html"&gt;Two Commonly Used Rails Upgrade Strategies&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Our goal for each pull request was visual parity: the migrated pages should look the same as they did under Bootstrap 4, and a person compared them side by side before the change went further. We targeted all of these pull requests at a long-lived base branch for the migration instead of &lt;code&gt;main&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Removing the old version
&lt;/h2&gt;

&lt;p&gt;The last step is a cleanup pull request, and it is the reason we kept the list of transitional code. Once every controller that shares a base controller declares a &lt;code&gt;_bs5&lt;/code&gt; layout, the base controller switches to the new layout, the old layout file is deleted, and the individual &lt;code&gt;layout&lt;/code&gt; declarations go away because the base class now covers them. Then we go through the list: the &lt;code&gt;bs5_layout?&lt;/code&gt; helper and every call to it, the &lt;code&gt;bs5:&lt;/code&gt; flags, and each branch in a shared partial, keeping the Bootstrap 5 variant every time. If you are curious about the general idea of cleaning up after a dual-boot, we wrote about it in &lt;a href="https://dev.to/blog/finishing-an-upgrade"&gt;Finishing an Upgrade&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Once nothing renders with the old layouts, the Bootstrap 4 entry points, its packages, and the npm aliases can be removed too. It’s worth planning for that part early, since renaming &lt;code&gt;bootstrap5&lt;/code&gt; back to &lt;code&gt;bootstrap&lt;/code&gt; touches every import.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this article, we talked about migrating a Rails app from Bootstrap 4 to Bootstrap 5 without a big-bang rewrite. We installed both versions side by side with npm aliases, gave each one its own CSS and JavaScript entry points, and let the layout decide which one a controller uses. We handled shared partials with a &lt;code&gt;bs5_layout?&lt;/code&gt; helper, and then moved through the controllers in small pull requests, starting with the smallest.&lt;/p&gt;

&lt;p&gt;It’s important to note that this approach trades one big risk for a lot of small debt. Every &lt;code&gt;bs5_layout?&lt;/code&gt; branch and every &lt;code&gt;bs5:&lt;/code&gt; flag is code you will have to remove later. Keep the list of transitional code from the first pull request, and plan the cleanup before you start the migration.&lt;/p&gt;

&lt;p&gt;Has your team been struggling with an upgrade? &lt;a href="https://www.fastruby.io/#contactus" rel="noopener noreferrer"&gt;We can help!&lt;/a&gt;&lt;/p&gt;

</description>
      <category>rails</category>
      <category>bootstrap</category>
    </item>
    <item>
      <title>Can You Remove DatabaseCleaner?</title>
      <dc:creator>Ernesto Tagwerker (he/him)</dc:creator>
      <pubDate>Wed, 21 Oct 2026 13:16:02 +0000</pubDate>
      <link>https://dev.to/fastruby/can-you-remove-databasecleaner-e1n</link>
      <guid>https://dev.to/fastruby/can-you-remove-databasecleaner-e1n</guid>
      <description>&lt;p&gt;DatabaseCleaner was a very popular gem that helped you keep a clean database between tests. However, newer versions of Rails removed the need for this tool for most cases. Even so, many applications that always used it still use it to this day. Let’s talk about what it does, why it was needed, and why you probably don’t need it anymore, and when you still might.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is it
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/DatabaseCleaner/database_cleaner" rel="noopener noreferrer"&gt;DatabaseCleaner&lt;/a&gt; is a gem that you can use to ensure that every test you run starts with the expected database state. DatabaseCleaner supports different databases: relational databases (MySQL, PostgreSQL, SQLite, MariaDB, for example), MongoDB, and Redis. In this article we’ll focus on relational databases which is the default in general for Rails apps using ActiveRecord and the main use case we see for our clients.&lt;/p&gt;

&lt;p&gt;The DatabaseCleaner project provides a specific gem to work with applications using ActiveRecord: &lt;a href="https://github.com/DatabaseCleaner/database_cleaner-active_record" rel="noopener noreferrer"&gt;database_cleaner-active_record&lt;/a&gt;. This provides 3 strategies for database resets: transaction (the default), truncation, and deletion.&lt;/p&gt;

&lt;p&gt;The main use case for DatabaseCleaner was to handle tests that required multiple threads or processes (for example, a Capybara test that needs both a Ruby/Rails thread controlling the test, and a second thread running your Rails app for the browser to click around and interact with it).&lt;/p&gt;

&lt;h3&gt;
  
  
  Transaction Strategy
&lt;/h3&gt;

&lt;p&gt;This is the strategy that most Rails developers should be familiar with already. Rails itself has a &lt;code&gt;use_transactional_fixtures/use_transactional_tests&lt;/code&gt; configuration (supported by both Minitest and RSpec).&lt;/p&gt;

&lt;p&gt;The main idea for this strategy is to wrap each test in a transaction and roll it back at the end of the test. Note that this is the same thing Rails already does with its native configuration: if you are already using this strategy, you have a clue that you might be able to remove this gem and use the Rails native feature.&lt;/p&gt;

&lt;h3&gt;
  
  
  Truncation Strategy
&lt;/h3&gt;

&lt;p&gt;This strategy does NOT use transactions. Instead, it will run a &lt;code&gt;TRUNCATE&lt;/code&gt; database statement on each table. The main benefit of this strategy is that, since it does not use transactions, multiple threads can interact with the database and see the same state. The main trade-off is that truncation takes extra time to run, especially when it truncates every table and not just the ones involved in a given test.&lt;/p&gt;

&lt;p&gt;Another problem with this strategy is that, if the database depends on seed data, the truncation does not know which records changed. It removes all records, so the data needs to be added back, which takes even more time.&lt;/p&gt;

&lt;h3&gt;
  
  
  Deletion Strategy
&lt;/h3&gt;

&lt;p&gt;This is similar to the &lt;code&gt;truncation&lt;/code&gt; strategy, but the main difference is that it does NOT reset the incremental ID tracking for the tables. After a table is truncated, the next new record added will have ID “1” (if we are using an auto-incrementing int/bigint column as the primary key). After the contents of a table are deleted, the next auto-generated ID will be the one that follows the last ID that was generated.&lt;/p&gt;

&lt;p&gt;Other than that, it has similar benefits and drawbacks as the &lt;code&gt;truncation&lt;/code&gt; strategy: it’s useful when you cannot use transactions, but it adds extra database queries that take more time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rails changes, shared database connection
&lt;/h2&gt;

&lt;p&gt;At RailsConf 2017, Eileen Uchitelle gave a talk showing all the improvements made in Rails 5.1 related to system tests (also known as end-to-end or e2e tests). There’s a specific moment of that talk that is relevant here: &lt;a href="https://youtu.be/sSn4B8orX70?si=lRyASEesdBhiuTYJ&amp;amp;t=1213" rel="noopener noreferrer"&gt;DatabaseCleaner not required&lt;/a&gt;. She explains the main problem that was solved: sharing the same database connection between the test thread and the app server thread.&lt;/p&gt;

&lt;p&gt;As you can see, this has been solved since 2017, Rails 5.1, 9 years ago.&lt;/p&gt;

&lt;h3&gt;
  
  
  So, can I remove it?
&lt;/h3&gt;

&lt;p&gt;The short answer is: most likely, yes. But keep reading because there are still some edge cases where you might want it, or you may need to do a bit of extra work after removing it.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;As mentioned before, this is focused only on the &lt;code&gt;database_cleaner-active_record&lt;/code&gt; gem (it would be similar for the &lt;code&gt;database_cleaner-sequel&lt;/code&gt; gem) as it can be replaced with Rails’ built in transaction handling. If you use DatabaseCleaner for other databases like MongoDB or Redis you shouldn’t make a decision based on this.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Removing DatabaseCleaner
&lt;/h2&gt;

&lt;p&gt;So, what are the steps to remove it? First, you need to understand why you are using DatabaseCleaner in the first place. Most applications simply add DatabaseCleaner with the basic setup, but we have seen applications with a more complex setup. Some use custom Rake tasks that run DatabaseCleaner between browser tests, as part of custom integrations with tools that Rails does not support out of the box (like Cypress, Playwright, Protractor, or Testcafe).&lt;/p&gt;

&lt;h3&gt;
  
  
  Edge cases
&lt;/h3&gt;

&lt;p&gt;If you have a custom setup for system or e2e tests, you may still need DatabaseCleaner or something like it.&lt;/p&gt;

&lt;p&gt;For example: one of our clients had a custom setup to run browser tests using Protractor. The tests were started from a Rake task that internally started a Rails application in one process and then, once the server booted, it started a JavaScript process running Protractor tests.&lt;/p&gt;

&lt;p&gt;Between each test, the Protractor runner would run a rake task to clear the database.&lt;/p&gt;

&lt;h3&gt;
  
  
  Things to pay attention to
&lt;/h3&gt;

&lt;p&gt;The easiest way to test if you really need DatabaseCleaner is to remove the gem and any related setup code, configure &lt;code&gt;use_transactional_tests = true&lt;/code&gt; (or &lt;code&gt;use_transactional_fixtures&lt;/code&gt;), and run your tests.&lt;/p&gt;

&lt;p&gt;If everything works, run them a few more times and you are good to go.&lt;/p&gt;

&lt;p&gt;But it may not “just work”, the test suite can depend on some state that was always ensured by the extra work done by DatabaseCleaner and we need to address that.&lt;/p&gt;

&lt;p&gt;Some tests may depend on specific IDs. When using the truncation strategy, we always get the auto-generated primary-key value starting from 1 (if we are using an auto-incremental type), so tests can end up relying on records having specific IDs. You’ll have to fix them to work with any ID (or you may want to update a record’s ID in the setup step of the test).&lt;/p&gt;

&lt;p&gt;Tests can also be order-dependent. If DatabaseCleaner was configured to run in an &lt;code&gt;after(:all)&lt;/code&gt; hook instead of an &lt;code&gt;after(:each)&lt;/code&gt; hook, there might be some order-dependency in the tests that required the database to only be cleared after all the tests of a given test file were done. In those cases you’ll have to make sure each test has the correct setup to run alone. This is also really important if you plan to add parallel testing or randomized test ordering, and we recommend both!&lt;/p&gt;

&lt;p&gt;Finally, check for any non-default DatabaseCleaner configuration. The &lt;code&gt;truncation&lt;/code&gt; and &lt;code&gt;deletion&lt;/code&gt; strategies &lt;a href="https://github.com/DatabaseCleaner/database_cleaner-active_record#strategy-configuration-options" rel="noopener noreferrer"&gt;support different options&lt;/a&gt;. It is important to know why some of those options were configured, as they may be important and may require additional setup for specific tests.&lt;/p&gt;

&lt;p&gt;These are not the only possible issues, as every application is different and other problems can show up when you remove DatabaseCleaner.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Case Study
&lt;/h2&gt;

&lt;p&gt;Recently, we worked for a client that wanted us to see if we could improve their tests. They already had a parallel test setup (using the &lt;code&gt;flatware&lt;/code&gt; gem in this case), but, as I mentioned in &lt;a href="https://www.fastruby.io/blog/speed-up-tests-from-40-to-4-minutes.html" rel="noopener noreferrer"&gt;my article about parallelization&lt;/a&gt;, parallel testing is not the only improvement that can be done.&lt;/p&gt;

&lt;p&gt;While reviewing logs and analyzing the tests, we noticed many &lt;code&gt;TRUNCATE&lt;/code&gt; database statements, each only took milliseconds, but this gets slower the more tables you have, since each table requires one more &lt;code&gt;TRUNCATE&lt;/code&gt;, and it multiplies by the amount of tests you have!&lt;/p&gt;

&lt;p&gt;The application uses Capybara, RSpec, and MySQL, and we ran a quick experiment: remove anything related to DatabaseCleaner, set &lt;code&gt;config.use_transactional_fixtures = true&lt;/code&gt; in the rails_helper.rb file, and run the tests both as a single process and with parallelization. We had some test failures of course, but only around 15 failures in a test suite with 10k+ tests which was easy to fix.&lt;/p&gt;

&lt;p&gt;These are the numbers for the whole test suite (10k+ tests), both with and without parallelization, and with and without DatabaseCleaner:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;rspec&lt;/code&gt; with DatabaseCleaner: 25m28s&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;rspec&lt;/code&gt; with Rails’ transactional tests: 20m15s (20% reduction)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;flatware rspec&lt;/code&gt; with DatabaseCleaner: 3m34s&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;flatware rspec&lt;/code&gt; with Rails’ transactional tests: 2m15s (37% reduction)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;The &lt;code&gt;rspec&lt;/code&gt; command runs all tests in a single process. The &lt;code&gt;flatware rspec&lt;/code&gt; command runs all tests in multiple parallel processes. All these tests were run on a 14-core M4 machine.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The results show a noticeable speed improvement, both for single-process and parallel processing!&lt;/p&gt;

&lt;p&gt;It is important to note that the main reason for these percentages is that the application was using the &lt;code&gt;truncation&lt;/code&gt; strategy and a MySQL database: multiply each &lt;code&gt;TRUNCATE&lt;/code&gt; statement by the number of tables and by the number of tests, and even a 1ms database query for a single table can easily add up to tens and hundreds of seconds that we are now avoiding. With PostgreSQL, DatabaseCleaner uses a single &lt;code&gt;TRUNCATE&lt;/code&gt; statement targeting all tables, which might be faster.&lt;/p&gt;

&lt;p&gt;The reason this app was using the &lt;code&gt;truncation&lt;/code&gt; strategy was that it was added way before Rails 5.1 solved the shared transactions problem, and it was never reviewed after that.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Removing DatabaseCleaner for this application had many benefits and no negative side-effects.&lt;/p&gt;

&lt;p&gt;The tests run faster locally, which is always good, but it’s even more important now with agentic programming, speeding up the feedback for agents that will run our tests multiple times.&lt;/p&gt;

&lt;p&gt;Tests run faster in CI. The main benefits are a faster green CI state, which allows PRs to merge sooner, and reduced compute time, which saves money.&lt;/p&gt;

&lt;p&gt;We have fewer dependencies and less code. We were able to remove a gem and the extra code used to configure it. Now we know that if Rails changes in a way that makes DatabaseCleaner incompatible (this happened &lt;a href="https://github.com/DatabaseCleaner/database_cleaner-active_record/blob/main/CHANGELOG.md#v220-2024-07-12" rel="noopener noreferrer"&gt;when Rails 7.2 was released&lt;/a&gt;), we don’t need to worry about it!&lt;/p&gt;

&lt;p&gt;Even if you don’t get the speed benefits for your particular setup (if you were already using the default transaction strategy), the last benefit alone can be a good reason to check if you can remove it.&lt;/p&gt;

&lt;p&gt;Do you think your test suite could run faster? We can help with that, &lt;a href="https://dev.to/contact"&gt;send us a message!&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ruby</category>
    </item>
    <item>
      <title>Herb on Rails</title>
      <dc:creator>Ernesto Tagwerker (he/him)</dc:creator>
      <pubDate>Tue, 22 Sep 2026 09:00:00 +0000</pubDate>
      <link>https://dev.to/fastruby/herb-on-rails-1pp8</link>
      <guid>https://dev.to/fastruby/herb-on-rails-1pp8</guid>
      <description>&lt;p&gt;ERB does not know that it is generating HTML. It finds the &lt;code&gt;&amp;lt;% %&amp;gt;&lt;/code&gt; tags, evaluates the Ruby inside them, and concatenates everything else as plain text. Whether the result is valid markup has never been its problem.&lt;/p&gt;

&lt;p&gt;Herb changes that. On August 25, 2026, the Ruby on Rails core team merged &lt;a href="https://github.com/rails/rails/pull/58552" rel="noopener noreferrer"&gt;Add Herb as an HTML-aware ERB implementation&lt;/a&gt;, which brings in &lt;a href="https://herb-tools.dev" rel="noopener noreferrer"&gt;Herb&lt;/a&gt;, an ERB implementation that parses HTML and ERB into a single syntax tree and uses &lt;a href="https://github.com/ruby/prism" rel="noopener noreferrer"&gt;Prism&lt;/a&gt; for the Ruby inside the tags. Broken markup can now fail while the template compiles, instead of reaching a browser.&lt;/p&gt;

&lt;p&gt;In this article, you will learn what Herb is, how to audit your own views with it today, what it can fix for you, what it cannot, and what it costs to run. We used the FastRuby.io views as the test subject.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Herb actually is
&lt;/h2&gt;

&lt;p&gt;Herb is not one tool, it is a parser with a lot of things built on top of it. The parser is written in C, it handles HTML and ERB together, and it hands the Ruby inside the tags to Prism. Everything else in the project is a consumer of that one syntax tree. We have leaned on syntax trees for this kind of work before, when we &lt;a href="https://www.fastruby.io/blog/extracting-rails-deprecation-warnings" rel="noopener noreferrer"&gt;extracted every deprecation warning out of the Rails source&lt;/a&gt;, and the appeal is the same: a parser knows things a regular expression can only guess at.&lt;/p&gt;

&lt;p&gt;That second half is easy to overlook. Every &lt;code&gt;&amp;lt;% %&amp;gt;&lt;/code&gt; tag in your application gets parsed as Ruby, including the ones inside branches that almost never render. GitHub found invalid Ruby this way &lt;a href="https://hawksley.org/2026/05/06/adopting-herb-at-github.html" rel="noopener noreferrer"&gt;while adopting Herb&lt;/a&gt;, in template code they had never run outside of production. If your views have accumulated conditionals for states nobody has hit in years, that Ruby has probably never been parsed by anything.&lt;/p&gt;

&lt;p&gt;The gem installs a CLI that exposes most of it:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;herb analyze&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Parse and compile every template in a directory, then report&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;herb lint&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Rule-based linting, including autocorrection&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;herb format&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Reformat templates&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;herb playground&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Open a template’s parse tree in the browser playground&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;herb report&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Generate a bug report you can paste into an issue&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;herb diff&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Show the minimal set of syntax tree differences between files&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;herb dev&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Start a dev server that watches for changes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;herb actionview check&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Check that &lt;code&gt;render&lt;/code&gt; calls resolve to real partials&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;herb actionview graph&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Show the render dependency graph&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;herb lsp&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Start the language server for your editor&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Some of those delegate to Node packages under the hood, so the linter and formatter are the same code whether you reach them from Ruby or from &lt;code&gt;npx&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That shared parser is the part worth understanding, because it is what makes the Rails change more than a swapped dependency. Your editor, your linter, your formatter, and now your template compiler can all agree on what a template means.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://herb-tools.dev/blog/whats-new-in-herb-v0-9" rel="noopener noreferrer"&gt;Herb v0.9&lt;/a&gt; added a set of &lt;code&gt;erb-safety-*&lt;/code&gt; rules that cover the security checks from &lt;code&gt;better-html&lt;/code&gt; and &lt;code&gt;erb_lint&lt;/code&gt;, which matters if you have been relying on either of those.&lt;/p&gt;

&lt;h2&gt;
  
  
  Running Herb on our own views
&lt;/h2&gt;

&lt;p&gt;Install the gem and point it at your views:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gem install herb
herb analyze app/views

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It parses every template, tries to compile each one, and groups what it finds into sections. The ten possible sections are in the table below, and which ones you see depends on what is wrong with your templates:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Seen&lt;/th&gt;
&lt;th&gt;Section&lt;/th&gt;
&lt;th&gt;What it means&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;Template errors&lt;/td&gt;
&lt;td&gt;Real problems in your markup&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;Strict mode parse errors&lt;/td&gt;
&lt;td&gt;Valid but loose HTML, like omitted closing tags&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;Analyze parse errors&lt;/td&gt;
&lt;td&gt;Problems found while analyzing the tree&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;Validation errors&lt;/td&gt;
&lt;td&gt;Security, nesting, or accessibility issues; the template still compiles&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;Unexpected parse errors&lt;/td&gt;
&lt;td&gt;Probably a parser bug&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Strict mode compilation errors&lt;/td&gt;
&lt;td&gt;Compiles only with strict mode off&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Parser crashed&lt;/td&gt;
&lt;td&gt;The parser itself blew up&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Timed out&lt;/td&gt;
&lt;td&gt;The file took too long to parse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Compilation errors&lt;/td&gt;
&lt;td&gt;Could not be compiled to Ruby at all&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Invalid Ruby output&lt;/td&gt;
&lt;td&gt;The engine emitted Ruby that does not parse&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Our run against the FastRuby.io views identified the five marked in the first column, along with twenty-one templates containing issues. This is a reasonable outcome for an application whose views have been accumulating since 2017.&lt;/p&gt;

&lt;p&gt;What caught my attention was the “Reportable issues” block Herb prints after those sections. It pulls out the files that landed in the categories it treats as probable bugs in itself, under a note saying they “likely failed due to issues in Herb, not in your templates”. Two of ours landed there, both from the unexpected parse errors row. That seems like a good way to make the Herb gem more robust over time, and the CLI hands you both halves of the job, one to share as an issue and the other to debug it yourself:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;herb report&lt;/code&gt; prints a Markdown bug report with the gem, Prism, and &lt;code&gt;libherb&lt;/code&gt; versions, your Ruby and platform, the categorized error list, and the template source, ready to paste into an issue.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;herb playground&lt;/code&gt; compresses the template into the fragment of a URL and opens it in the &lt;a href="https://herb-tools.dev/playground" rel="noopener noreferrer"&gt;playground&lt;/a&gt;, where you can inspect the tree the parser built and the diagnostics it produced. Browsers do not send the fragment part of a URL to the web server, so the template travels no further than your own browser, which matters when the file belongs to a client.&lt;/p&gt;

&lt;p&gt;As for the errors themselves, they are readable. Here is one of ours:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Analyze parse errors:
 These files have issues detected during analysis. Review the errors and update your templates.

 app/views/static/rails_3_0_vulnerabilities.html.erb:
   ⚠ MissingClosingTagError at 18:2 - Opening tag `&amp;lt;section&amp;gt;` at (18:3) doesn't have a matching closing tag `&amp;lt;/section&amp;gt;` in the same scope.
   ⚠ MissingOpeningTagError at 2131:2 - Found closing tag `&amp;lt;/section&amp;gt;` at (2131:4) without a matching opening tag in the same scope.
   ⚠ MissingOpeningTagError at 2132:0 - Found closing tag `&amp;lt;/div&amp;gt;` at (2132:2) without a matching opening tag in the same scope.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The run ends with a summary that counts how many files were checked, how many came out clean, and separate tallies for the parser and the engine. Those two tallies are worth reading separately, since “parses but will not compile” and “will not parse at all” are different problems with different fixes.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you can fix automatically
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;herb analyze&lt;/code&gt; tells you what is broken. Fixing the smaller stuff is the linter’s job:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;herb lint &lt;span class="s2"&gt;"app/views/**/*.erb"&lt;/span&gt;
herb lint &lt;span class="s2"&gt;"app/views/**/*.erb"&lt;/span&gt; --fix

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On our views that found 1,404 offenses, 547 of them autocorrectable: unescaped entities, indentation, spaces inside tags, missing trailing newlines. What &lt;code&gt;--fix&lt;/code&gt; will not touch is anything structural. The 143 offenses from &lt;code&gt;parser-no-errors&lt;/code&gt;, the rule that overlaps with what stops a template from compiling, are all yours to fix by hand, and that is the right call, since an extra &lt;code&gt;&amp;lt;/div&amp;gt;&lt;/code&gt; could mean “delete this line” or “add the opening tag twenty lines up”.&lt;/p&gt;

&lt;p&gt;Both commands run on defaults until you give them a config, which you generate with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;herb lint --init

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That writes a &lt;code&gt;.herb.yml&lt;/code&gt; file that pins the Herb version, so a later upgrade does not enable new rules behind your back. The rest of the file is commented out but worth reading through once. You can enable or disable individual rules, exclude paths for specific rules, set the severity that causes the run to fail, toggle the security, nesting, and accessibility validators, and choose the template engine, with &lt;code&gt;herb&lt;/code&gt; as one of the options.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you get, and what it costs
&lt;/h2&gt;

&lt;p&gt;From your application’s rendering point of view, Herb and Erubi are the same thing: same public API, same job, no templates to rewrite.&lt;/p&gt;

&lt;p&gt;What changes is the tooling around them. Because the &lt;code&gt;herb&lt;/code&gt; gem is now a dependency of &lt;code&gt;actionview&lt;/code&gt;, the analysis, the linter, the formatter, the render graph, and the language server all come along with it. Some of that existed before as third-party gems, &lt;code&gt;erb_lint&lt;/code&gt; and &lt;code&gt;better-html&lt;/code&gt; among them, but none of it shipped with Rails, so nobody has to be talked into adding a gem for good practices.&lt;/p&gt;

&lt;p&gt;The review thread points at Herb arriving opt-in first and becoming a framework default in some later version. That is reason enough to get ahead of it. Run the linter now, check that your views compile through Herb, and wire it into CI alongside RuboCop or whatever else you already run there, so the work happens before the release day instead of after it. A missing closing tag stops being something a reader finds for you months later.&lt;/p&gt;

&lt;p&gt;The trade is compile time. Herb does more work than Erubi, so a template takes longer to compile, and on our views the difference is measured in milliseconds per template.&lt;/p&gt;

&lt;p&gt;Where that lands is the part worth understanding. Rails compiles a template the first time something renders it and caches the compiled method for the life of the process, so the cost is paid once per template. Every request after that is identical, because the Ruby that Herb generates is the same Ruby, byte for byte. Nothing about serving a page is slower once the template has been compiled.&lt;/p&gt;

&lt;p&gt;It is also early days. Marco Roth, who built Herb, has noted that it has not had much performance optimization yet, and that he believes it can be improved.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;We pointed Herb at an application whose views have been accumulating since 2017, and it found real problems in twenty-one templates, including markup we had been shipping for years. The run took a few seconds and needed nothing beyond a &lt;code&gt;gem install&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That is what we would suggest doing now, well before any of this becomes a default. Views are where upgrade work tends to hide, and we have written before about &lt;a href="https://www.fastruby.io/blog/handling-erb-syntax-changes-for-form-helpers" rel="noopener noreferrer"&gt;ERB syntax changes catching teams mid-upgrade&lt;/a&gt;. Herb has earned a spot next to the &lt;a href="https://www.fastruby.io/blog/open-source-tooling" rel="noopener noreferrer"&gt;open source tools we already reach for on upgrades&lt;/a&gt;. The linter will clear the cosmetic offenses for you, the structural ones are hand work, and knowing which is which is most of the planning. Once you have cleared them, both &lt;code&gt;herb analyze&lt;/code&gt; and &lt;code&gt;herb lint&lt;/code&gt; exit non-zero when something fails, so either one can sit in CI and keep the next broken template out of the branch.&lt;/p&gt;

&lt;p&gt;Marco Roth is presenting &lt;a href="https://rubyonrails.org/world/2026/sessions/herb-rails-8-2" rel="noopener noreferrer"&gt;Herb in Rails 8.2: Your ERB views, now HTML-aware&lt;/a&gt; at Rails World on September 24.&lt;/p&gt;

&lt;p&gt;Is your team getting ready for the next version of Rails, or still catching up on the last one? &lt;a href="https://www.fastruby.io/#contactus" rel="noopener noreferrer"&gt;We can help!&lt;/a&gt;&lt;/p&gt;

</description>
      <category>rails</category>
      <category>herb</category>
      <category>frontend</category>
    </item>
    <item>
      <title>Irish Chess Union Upgrades to Rails 8.1</title>
      <dc:creator>Ernesto Tagwerker (he/him)</dc:creator>
      <pubDate>Thu, 17 Sep 2026 04:00:00 +0000</pubDate>
      <link>https://dev.to/etagwerker/irish-chess-union-upgrades-to-rails-81-1ml1</link>
      <guid>https://dev.to/etagwerker/irish-chess-union-upgrades-to-rails-81-1ml1</guid>
      <description>&lt;p&gt;Founded in 1912, the Irish Chess Union (ICU) is the governing body for chess across the island of Ireland. It has about 2,500 members and run entirely by volunteers.&lt;/p&gt;

&lt;p&gt;Its website, &lt;a href="https://www.icu.ie/" rel="noopener noreferrer"&gt;icu.ie&lt;/a&gt;, has been maintained by webmaster Jonathan O’Connor since 2015. Earlier this year, Jonathan reached out to us. He wanted help taking the ICU’s Rails application from 7.0 to 8.1.&lt;/p&gt;

&lt;p&gt;We used Claude Code and our open source &lt;a href="https://github.com/ombulabs/claude-code_rails-upgrade-skill" rel="noopener noreferrer"&gt;Claude Code Rails Upgrade Skill&lt;/a&gt; to get it done. We also recorded the sessions as a video series, so other teams could see the methodology in practice.&lt;/p&gt;

&lt;p&gt;In this article, we’ll walk through the upgrade, one version at a time, and share what Jonathan thought of the process.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa26ogyyq80ti8kfwooiv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa26ogyyq80ti8kfwooiv.png" alt="The Irish Chess Union homepage at icu.ie" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Here was our challenge
&lt;/h2&gt;

&lt;p&gt;The ICU’s application was built and is maintained by professionals, just not on the clock. Everyone involved works on it nights and weekends, as volunteers. It was written mostly by Mark Orr, a ratings officer who had just retired and wanted to give back to the community.&lt;/p&gt;

&lt;p&gt;That project became learning Ruby on Rails and building the ICU a website from scratch. He wrote about 90% of the code that’s still running today. Jonathan took over as webmaster in 2015.&lt;/p&gt;

&lt;p&gt;He’d learned Ruby a few years earlier, on a six-week trip to Rwanda building credit card payment systems. Rails’ conventions weren’t as disorienting to him as they are to developers who come to it cold.&lt;/p&gt;

&lt;p&gt;He kept the application current on his own for a while. When he upgraded it from Rails 3 to 5, he did it the patient way: bumping the Gemfile one patch version at a time, running the test suite, and fixing whatever the deprecation warnings in the logs pointed at.&lt;/p&gt;

&lt;p&gt;His colleague Ben Murray later carried it from 5.0 to 7.0. Then Jonathan tried to take it from 7.0 to 7.1 by himself. The same approach that had worked for years stopped working.&lt;/p&gt;

&lt;p&gt;He’d been away from daily Rails work since 2016. The deprecation warnings piled up faster than he could make sense of them.&lt;/p&gt;

&lt;p&gt;“It was a lot harder,” he said. Eventually it became impossible to tell which warnings actually mattered.&lt;/p&gt;

&lt;h2&gt;
  
  
  Here’s how we solved it
&lt;/h2&gt;

&lt;p&gt;We used the same methodology we’ve documented for years: &lt;a href="///blog/upgrade-rails/dual-boot/dual-boot-with-rails-6-0-beta.html"&gt;dual-boot the app&lt;/a&gt; with the &lt;a href="https://github.com/fastruby/next_rails" rel="noopener noreferrer"&gt;&lt;code&gt;next_rails&lt;/code&gt;&lt;/a&gt; gem, and upgrade one minor Rails version at a time, never skipping a hop.&lt;/p&gt;

&lt;p&gt;For the ICU, that meant an unhurried climb from 7.0 to 7.1, then 7.2, then 8.0, and finally 8.1. Each hop got its own pull request. Each one had a green test suite against both Rails versions before we merged it and moved to the next.&lt;/p&gt;

&lt;p&gt;Here’s what that looks like under the hood, for anyone who hasn’t dual-booted a Ruby app before:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Faj8a6x48ezm627sbfxz6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Faj8a6x48ezm627sbfxz6.png" alt="How dual booting works: two Gemfiles, two Rails versions, verified independently" width="799" height="478"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before we touched the Rails version at all, we spent some time on groundwork.&lt;/p&gt;

&lt;p&gt;We set up GitHub Actions, so the ICU had CI for the first time. We patched the Docker configuration, so the app could build against either Gemfile.&lt;/p&gt;

&lt;p&gt;That kind of scaffolding is easy to underestimate. It’s usually what makes the rest of the upgrade boring, in a good way.&lt;/p&gt;

&lt;p&gt;This was also a great opportunity to share with the community how we leverage our open source Claude Code Rails Upgrade Skill, instead of just publishing it and hoping people would try it themselves. In 3 different pairing sessions, we drove Claude to use the skill to handle the mechanical work that happens in every upgrade project.&lt;/p&gt;

&lt;p&gt;Claude handled a lot of the mechanical work in each hop: previewing what &lt;code&gt;rails app:update&lt;/code&gt; would change, running the test suite against both Gemfiles, and flagging deprecation warnings before they piled up.&lt;/p&gt;

&lt;p&gt;Our engineers, &lt;a href="https://dev.to/blog/authors/hmdros"&gt;Henrique Medeiros&lt;/a&gt;, &lt;a href="https://dev.to/blog/authors/arieljuod"&gt;Ariel Juodziukynas&lt;/a&gt;, &lt;a href="https://dev.to/blog/authors/aisayo"&gt;Aysan Isayo&lt;/a&gt;, and &lt;a href="https://dev.to/blog/authors/juanvqz"&gt;Juan Vasquez&lt;/a&gt;, made the judgment calls the skill is deliberately not built to make on its own.&lt;/p&gt;

&lt;p&gt;One of those calls was a small shim in the ICU’s codebase. Even Jonathan, after nearly a decade of maintaining the app, said he never would have found it on his own.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“There’s one thing I would never have found, even if I kept working at trying to figure out how to do the upgrade myself, and that was this shim in our code,” Jonathan said. “I think that’s one of the places where you earn your keep, because these are tricks that people won’t know, since they’re not doing upgrades every day.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Part of why the rest of the upgrade went smoothly is that the ICU’s codebase is, in Jonathan’s own words, unusually well-behaved.&lt;/p&gt;

&lt;p&gt;No monkeypatches. No reopened core classes. No weird code in weird places.&lt;/p&gt;

&lt;p&gt;And on top of that: A real test suite with both model and integration coverage.&lt;/p&gt;

&lt;p&gt;None of that is guaranteed for an application built by a single volunteer. But Mark Orr and Jonathan had both stuck close to the Rails way, and it showed in how predictable each hop turned out to be.&lt;/p&gt;

&lt;p&gt;The ICU never had to pause its own work, either.&lt;/p&gt;

&lt;p&gt;Jonathan’s small team of volunteer contributors kept shipping features throughout the upgrade. The app’s Stripe integration, the dependency that worried us most going in since it handles ICU’s membership payments, never broke stride.&lt;/p&gt;

&lt;h2&gt;
  
  
  See the results
&lt;/h2&gt;

&lt;p&gt;Now the ICU is current on Rails 8.1.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“I didn’t notice any issues at all. There were no breakages at all. You made maybe seven or eight pull requests, probably thirty or forty commits over that time, and they just fitted seamlessly into all our changes. Nothing ever broke. And thank you so much for setting up our Docker, because now we have our tests running on GitHub, which is brilliant.”&lt;/p&gt;

&lt;p&gt;Jonathan O’Connor, Webmaster, Irish Chess Union&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here’s one of those pull requests, upgrading the app to Rails 7.2:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkjo4dh1z8qald1xsex9m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkjo4dh1z8qald1xsex9m.png" alt="Pull request #157, upgrading the ICU application to Rails 7.2" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Eight pull requests, somewhere around thirty to forty commits, and &lt;strong&gt;zero breakages&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That’s not a coincidence. It’s what a sequential, dual-booted upgrade against a clean codebase and a stable test suite looks like when it goes right.&lt;/p&gt;

&lt;p&gt;There’s also a quieter story here, about who can afford this kind of work.&lt;/p&gt;

&lt;p&gt;A volunteer-run federation with no engineering budget to speak of got a five-version Rails upgrade done. Not because the work got easier, but because one senior engineer driving Claude Code and our upgrade skill can now get much closer to what it used to take two.&lt;/p&gt;

&lt;p&gt;This is a real shift we’re seeing across our upgrade engagements, and it’s a big part of why an organization like the ICU can now afford this kind of work at all.&lt;/p&gt;

&lt;p&gt;If you’re trying to make this case internally, &lt;a href="///blog/rails/upgrade/how-to-pitch-an-upgrade-to-your-boss.html"&gt;here’s some advice on how to pitch a Rails upgrade to your boss&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Watch the pairing sessions
&lt;/h2&gt;

&lt;p&gt;We recorded four sessions from this project, so you can watch the actual pairing work instead of just reading about it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Part 1: Setting up CI
&lt;/h3&gt;

&lt;p&gt;Henrique Medeiros and I spend about an hour setting up CI for the ICU’s application: wiring up GitHub Actions and using Claude Code to work through the setup issues that came up along the way:&lt;/p&gt;

&lt;h3&gt;
  
  
  Part 2: Dual booting and API compatibility
&lt;/h3&gt;

&lt;p&gt;Henrique and I dig into dual booting and the API differences between Rails 7.0 and 7.1.&lt;/p&gt;

&lt;p&gt;We set up &lt;code&gt;next_rails&lt;/code&gt; and a &lt;code&gt;Gemfile&lt;/code&gt; symlink strategy, chase down a few gem compatibility issues using &lt;a href="https://www.railsbump.org/" rel="noopener noreferrer"&gt;RailsBump.org&lt;/a&gt;, and configure GitHub Actions and Docker to run the test suite against both Rails versions:&lt;/p&gt;

&lt;h3&gt;
  
  
  Part 3: Upgrading to Rails 7.2, and getting ready for 8.0
&lt;/h3&gt;

&lt;p&gt;Juan Vasquez and I carry the app from Rails 7.1 to 7.2, while preparing the codebase for Rails 8.0.&lt;/p&gt;

&lt;p&gt;We walk through how the upgrade skill checks the current patch version, confirms dual boot is set up, and generates an upgrade report, then track down a &lt;a href="https://github.com/irishchessunion/icu_www_app/pull/157" rel="noopener noreferrer"&gt;Capybara and Selenium WebDriver compatibility issue&lt;/a&gt; that turns out to have nothing to do with Rails itself:&lt;/p&gt;

&lt;h3&gt;
  
  
  Recap: A quick recap of the entire upgrade project
&lt;/h3&gt;

&lt;p&gt;Jonathan and I talk about the project end to end: the ICU’s volunteer culture, why the upgrade stalled at Rails 7.1, the results, and Jonathan’s own take on where AI helps and where he still won’t let it near ICU’s data.&lt;/p&gt;

&lt;p&gt;Keep an eye out for the Easter egg: a shim in the ICU’s codebase that Jonathan says he’d never have thought of himself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The ICU’s upgrade worked because the methodology did the heavy lifting, not the AI on its own. Our AI tooling certainly help speed things up! 🚀&lt;/p&gt;

&lt;p&gt;Dual booting, sequential hops, a deprecation-first approach: none of that is new.&lt;/p&gt;

&lt;p&gt;What’s new is that Claude Code, guided by a skill that encodes those opinions, can now execute most of it, while our engineers focus on the handful of judgment calls, like that one shim, that still need a human who’s done this before.&lt;/p&gt;

&lt;p&gt;It’s worth saying plainly: this went smoothly in part because the ICU’s codebase was clean and well-tested.&lt;/p&gt;

&lt;p&gt;A messier application, full of monkeypatches and flaky tests, would have taken longer.&lt;/p&gt;

&lt;p&gt;Has your team been putting off a Rails upgrade? &lt;a href="https://www.fastruby.io/contact" rel="noopener noreferrer"&gt;Let’s talk&lt;/a&gt; and get your up to the latest stable versions of Ruby and Rails!&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;p&gt;All of the pull requests below were merged into the ICU’s &lt;code&gt;master&lt;/code&gt; branch, and the full history is public:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/irishchessunion/icu_www_app/pull/117" rel="noopener noreferrer"&gt;#117: Remove deprecation warnings&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/irishchessunion/icu_www_app/pull/134" rel="noopener noreferrer"&gt;#134: Set up GitHub Actions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/irishchessunion/icu_www_app/pull/145" rel="noopener noreferrer"&gt;#145: Docker setup configuration patches&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/irishchessunion/icu_www_app/pull/150" rel="noopener noreferrer"&gt;#150: Dual boot the application (Rails 7.0 and 7.1)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/irishchessunion/icu_www_app/pull/152" rel="noopener noreferrer"&gt;#152: Upgrade to Rails 7.1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/irishchessunion/icu_www_app/pull/157" rel="noopener noreferrer"&gt;#157: Upgrade to Rails 7.2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/irishchessunion/icu_www_app/pull/165" rel="noopener noreferrer"&gt;#165: Upgrade to Rails 8.0&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/irishchessunion/icu_www_app/pull/184" rel="noopener noreferrer"&gt;#184: Upgrade to Rails 8.1&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can find the ICU’s full application source code at &lt;a href="https://github.com/irishchessunion/icu_www_app" rel="noopener noreferrer"&gt;github.com/irishchessunion/icu_www_app&lt;/a&gt;, and our own upgrade skill at &lt;a href="https://github.com/ombulabs/claude-code_rails-upgrade-skill" rel="noopener noreferrer"&gt;github.com/ombulabs/claude-code_rails-upgrade-skill&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you want the version-by-version details behind each hop, our &lt;a href="///blog/rails/upgrade/rails-upgrade-series.html"&gt;Rails Upgrade Series&lt;/a&gt; covers every jump from 2.3 onward.&lt;/p&gt;

</description>
      <category>rails</category>
      <category>opensource</category>
      <category>ruby</category>
    </item>
    <item>
      <title>Fortify Rails - Defending Your Ruby on Rails Applications from Bad Actors</title>
      <dc:creator>Ernesto Tagwerker (he/him)</dc:creator>
      <pubDate>Mon, 26 Jun 2023 12:34:56 +0000</pubDate>
      <link>https://dev.to/fastruby/fortify-rails-defending-your-ruby-on-rails-applications-from-bad-actors-25j2</link>
      <guid>https://dev.to/fastruby/fortify-rails-defending-your-ruby-on-rails-applications-from-bad-actors-25j2</guid>
      <description>&lt;p&gt;On Monday June 12th, 2023, FastRuby.io partnered with &lt;a href="https://expeditedsecurity.com/" rel="noopener noreferrer"&gt;Expedited Security&lt;/a&gt; to talk about how to secure your Ruby on Rails application.&lt;/p&gt;

&lt;p&gt;In this free webinar &lt;a href="https://mastodon.social/@etagwerker" rel="noopener noreferrer"&gt;Ernesto Tagwerker&lt;/a&gt; (FastRuby.io) and &lt;a href="https://ruby.social/@mbuckbee" rel="noopener noreferrer"&gt;Mike Buckbee&lt;/a&gt; (Expedited Security) discussed topics of interest related to &lt;a href="https://fastruby.io/blog/tags/security" rel="noopener noreferrer"&gt;Rails security&lt;/a&gt; (exploitable ActiveRecord code, vulnerable dependencies, botnets, DDoS, a breakdown of common threats, and more).&lt;/p&gt;

&lt;p&gt;You’ll also get a sneak peak of &lt;a href="https://wafris.org/" rel="noopener noreferrer"&gt;Wafris&lt;/a&gt;, an Open Source service to prevent attackers and dark traffic to your application and of our new &lt;a href="https://www.fastruby.io/security-audit?utm_source=blog&amp;amp;utm_medium=organic&amp;amp;utm_campaign=webinar" rel="noopener noreferrer"&gt;Rails Security Audit&lt;/a&gt;, a service to detect vulnerabilities and exploitable code in your app!&lt;/p&gt;

&lt;p&gt;Check out the recording of the Fortify Rails webinar here: &lt;a href="https://www.youtube.com/embed/KkXTw7UDR9w" rel="noopener noreferrer"&gt;https://www.youtube.com/embed/KkXTw7UDR9w&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here are the slides on exploitable code and insecure dependencies: &lt;a href="https://speakerdeck.com/etagwerker/fortify-rails-webinar" rel="noopener noreferrer"&gt;https://speakerdeck.com/etagwerker/fortify-rails-webinar&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to read more about Ruby and Rails security tooling check out this article: &lt;a href="https://www.fastruby.io/blog/rails/security/ruby-security-toolkit.html" rel="noopener noreferrer"&gt;4 Essential Security Tools To Level Up Your Rails Security&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Need a trusted third party to give you a prioritized list of security issues? Check out our &lt;a href="https://www.fastruby.io/security-audit?utm_source=blog&amp;amp;utm_medium=organic&amp;amp;utm_campaign=webinar" rel="noopener noreferrer"&gt;Rails Security Audit&lt;/a&gt; service. &lt;/p&gt;

</description>
      <category>rails</category>
      <category>security</category>
    </item>
  </channel>
</rss>
