Bundler 4.0.0が出ましたね。めでたい。ということで早速4.0.0にアップグレードしてみました。
オフィシャルの情報としての4.0.0の差分およびアップグレードガイドは ^ を見ると良いです。
実際にやったこと
bundle up --bundler=4.0.0を実行してlockファイルを更新bundle installの後にbundle binstubs bootsnapをするように追加 *1- bootsnapだけでは足りず、ridgepole等も含める必要があることに気付いたため上記を
bundle binstubs --allを使うように変更 bundle lock --add-checksumsを実行してlockファイルにCHECKSUMSを追加
binstubsの処遇は若干難しく、アップグレードガイドには
The --binstubs flag would create binstubs for all executables present inside the gems in the project. This was hardly useful since most users only use a subset of all the binstubs available to them. Also, it would force the introduction of a bunch of most likely unused files into source control. Because of this, binstubs now must be created and checked into version control individually.
とあるため、使うexecutableに絞ってbundle binstubsを実行してスリムに保ってね、というモチベーションであるということは理解しつつも、既存の系に対して適用しようとすると「どのexecutableが必要なのか」がパッと自明にわからず、一旦は安全側に倒して--allを使って全生成することとしています。
これについては同僚の
id:ohbaryeさんがruby-jpのSlackチャネルで質問してくれている *2 ので、今後何か進展があるかもしれません。

[追記]
> it would force the introduction of a bunch of most likely unused files into source control.
とあるように、生成されたexecutablesがバージョン管理の対象になって複雑性が増すことが懸念なのであれば、今回のような用途、つまりコンテナのビルドステップ内でbundle binstubs --allを実行するのはそのコンテナ内に生成物が閉じるので大きな問題ではないように思いました。
そもそもbundle installで依存ライブラリ自体はインストールされているので、binstubsでexecutableを生成しようがしまいがコンテナサイズにも大きな影響はなさそうです。
id:h-sbtさんからも「とりあえず最初の一歩としては--allを使うので良いのではないか」というアドバイスもいただきました。
[追記ここまで]
lockファイルにCHECKSUMSが追加される挙動がデフォルトになったとのことだったのでこちらも導入しました。
We shipped this security feature and turned it on by default, so that everyone benefits from the extra security assurances. So whenever you create a new lockfile, Bundler now includes a CHECKSUMS section.
Bundler will not automatically add a CHECKSUMS section to existing lockfiles, though, unless explicitly requested through bundle lock --add-checksums.
明にbundle lock --add-checksumsを実行しないと自動的にCHECKSUMSを加えてくれないとのことだったので一度だけ手動実行して適用しました。実に良い機能なので使わない手はないですね。
というわけで比較的スッとバージョンを上げることができて良かったです。どんどんやっていきましょう。
*1:コンテナ環境で動かしているのでDockerfileを編集しました
*2:https://ruby-jp.slack.com/archives/CM0DN2H28/p1764746486399459