Skip to content
CAI
Software that uses CAICheck a score

rails/bootsnap

75.8

Strong · 5 November 2026

2.1k

lines of production code

Ruby

with C

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Features

Added bootsnap executable for precompiling gems

A new executable script has been added to the exe directory that invokes the Bootsnap CLI. This allows users to precompile gems without needing to boot the full application, streamlining the setup process for environments leveraging Bootsnap.

exe · high confidence

Bootsnap 1.26.0 introduces CLI, setup helpers, and platform support checks

Bootsnap is updated to version 1.26.0, introducing a new command-line interface (CLI) for precompiling Ruby and YAML caches, including support for parallel processing and gem precompilation. A new \bootsnap/setup\ helper simplifies initialization, while \bootsnap/bundler\ provides a utility to detect the Bundler environment. The library now explicitly checks for platform and engine support (MRI and TruffleRuby on POSIX/Windows) before enabling caches, ensuring graceful degradation on unsupported implementations. Additionally, the \LoadPathCache\ now includes a \loaded\_features\_index\ and an \unload!\ method for better cache management.

lib/bootsnap · high confidence

Parallel precompilation with cgroup-aware worker pools

Bootsnap now uses a new WorkerPool to parallelize precompilation, significantly speeding up the process on multi-core systems. The pool automatically detects the number of available processors and respects cgroup CPU limits (both v1 and v2) to avoid over-subscribing resources in containerized environments. It also includes a safety check to detect faulty fork behavior (such as in some QEMU/Docker setups) and gracefully falls back to single-threaded execution if parallelism is unstable.

lib/bootsnap/cli · high confidence

Behavioural changes

Bootsnap 1.26.0 release with Ruby 4.0.4 compatibility and YJIT cache stability

This release updates the gem to version 1.26.0, introducing several key improvements for users. It adds a hook API to customize Ruby compilation and fixes a potential Ruby SEGV if the instrumentation callback raised an error. The YAML parsing cache is now more efficient for Time, Date, and DateTime objects. A significant behavioral change addresses YJIT: the compile cache no longer invalidates when YJIT is toggled at runtime, as YJIT does not change the serialized instruction sequences. Compatibility with Ruby 4.0.4 is improved, specifically fixing the 'should not compile with coverage' error and ensuring \Bootsnap.enable\_frozen\_string\_literal\ works with coverage enabled (on Ruby 4.0.4+). The release also fixes a cache corruption issue in \bootsnap precompile\ when a cached YAML file was modified without changing its size, and corrects a regression where \CompileCache::Native.fetch\ failed with non-String path arguments. Additionally, the cache file header size was reduced from 64 to 32 bytes.

(repo-wide) · high confidence

Improved load path caching accuracy and performance with built-in feature detection

The load path cache now correctly handles Ruby's built-in features (like 'enumerator') that do not correspond to files on disk, preventing incorrect cache hits. It also introduces a LoadedFeaturesIndex to accurately track already-loaded features by short name, ensuring that adding a new $LOAD\_PATH element with a conflicting file name does not cause duplicate loads. Path scanning is optimized by using a native implementation (where available) to avoid N+1 stat calls, and the cache store now uses atomic writes and version checks to handle concurrent transactions and upgrade incompatibilities more robustly. Additionally, the cache ignores 'node\_modules' directories by default and supports relative paths in the load path.

_lib/bootsnap/load\_path\cache · high confidence

Redesigned setup API with environment variable control and new instrumentation

The \Bootsnap.setup\ method has been significantly refactored to support new configuration options including \ignore\_directories\, \readonly\, and \revalidation\ modes, while deprecating the \compile\_cache\_json\ argument. Cache directories are now organized under a unified root structure. The library now supports configuration via environment variables (e.g., \BOOTSNAP\_CACHE\_DIR\, \BOOTSNAP\_READONLY\) and allows loading an optional config file. Additionally, new \log\_stats!\ and \log!\ methods provide built-in instrumentation to monitor cache hits, misses, and other events for debugging and performance analysis.

lib · high confidence

Refactor C extension to remove CRC32 dependency and modernize build configuration

The C extension no longer includes the custom CRC32 implementation (crc32.c and bootsnap.h), resolving a symbol conflict with zlib. The build system (extconf.rb) has been updated to support TruffleRuby, conditionally apply stricter compiler flags, and detect system features like fdatasync and fstatat. Additionally, the cache key structure has been standardized to a fixed 32-byte size, and the code now uses O\_NOATIME for improved performance on supported systems.

ext · high confidence

Refactored ISeq and YAML compile caches with Ruby version-specific bug workarounds

The instruction sequence (ISeq) and YAML compile caches have been significantly refactored to improve reliability and compatibility across different Ruby versions. The ISeq cache now uses a modular \Compiler\ class that detects and applies specific workarounds for Ruby bugs \#18250 and \#22023, ensuring correct compilation behavior on affected versions (e.g., Ruby 3.0.x and 3.3/3.4/4.0 with Prism). It also handles code coverage mode more gracefully, warning users or falling back to non-cached compilation when necessary. The YAML cache has been rewritten to use MessagePack for serialization, replacing the previous Marshal fallback for unsupported types. It now strictly validates YAML tags, supports \symbolize\_names\ and \freeze\ options from Psych 4+, and handles custom types like \Date\, \DateTime\, \Regexp\, and \Bigint\ explicitly. These changes ensure that cached bytecode and YAML data are robust against encoding issues, platform-specific bugs, and changes in Ruby's internal YAML parser.

_lib/bootsnap/compile\cache · high confidence

Refactored Kernel\#require and removed ActiveSupport integration

The \Kernel\#require\ implementation has been rewritten to bypass the cache entirely when Bootsnap is disabled or when a feature is already loaded, and to handle fallback scans by checking the loaded features index before falling back to the native loader. The previous \Kernel\#load\ and \Module\#autoload\ patches have been removed. Additionally, the integration with \ActiveSupport::Dependencies\ has been deleted, meaning Bootsnap no longer monkey-patches ActiveSupport's autoload and dependency resolution mechanisms.

_lib/bootsnap/load\_path\_cache/core\ext · high confidence

Refine test runner scripts and add minimal support test helper

The test execution environment has been updated to improve reliability and consistency. The \bin/testunit\ script now uses \exec\ to replace the shell process with Ruby, ensuring proper signal handling, and enables Ruby warnings (\-w\) to catch potential issues during test runs. A new \bin/test-minimal-support\ script has been added to facilitate testing against minimal Ruby support configurations by setting up the environment and running Bootsnap. Additionally, the \bin/console\ script now includes a \frozen\_string\_literal\ pragma for better string handling.

bin · high confidence

Test coverage

Added bootsnap setup helper for tests; Added integration tests for app boot, Kernel require behavior, and YJIT cache interaction; Added test fixtures for coverage and frozen string literal integration; Added tests for ISeq and YAML compile cache behaviors; Added tests for Kernel\#require and Kernel\#load caching behavior; Expanded test coverage for Bootsnap setup, CLI, and cache behavior; Expanded test coverage for LoadPathCache components.

Dependencies

Bootsnap 0.2.0: Ruby 2.7+ requirement, msgpack upgrade, and dependency restructuring

Bootsnap now requires Ruby 2.7 or higher and drops support for earlier versions. The runtime dependency on msgpack has been updated to version 1.5, and the snappy dependency has been removed. Development dependencies such as bundler, rake, rubocop, and minitest have been moved from the gemspec to the Gemfile, and the gem's homepage and metadata have been updated to reflect its move to the Rails organization.

(dependencies) · high confidence

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 76 → 76 (+0.2)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.

Lenses

  • Code Health 75 → 75 (+0.0)
  • Architecture 100 → 100 (+0.0)
  • Maturity 71 → 72 (+1.0)
  • Readiness 74 → 74 (+0.0)
  • Security 94 → 91 (-3.7)

Resolved (2)

  • Duplicate implementation across version-specific patches. While technically necessary for compatibility, the API surface exposes two identical method signatures on parallel types (Psych4.Patch and Psych3.Patch). This forces consumers to know which patch to use or implies that YAML.patch() should handle the dispatch, making the individual patch methods redundant if they are only ever called via the main YAML interface.
  • Off-boarding risk: anonymized user #1

New (1)

  • Off-boarding risk: anonymized user #1

Changes since last survey

  • 7 commits — 7 feature/other, 0 fixes

By area

  • (repo) — 3 commits
  • .github/workflows — 2 commits
  • (root) — 1 commit
  • lib/bootsnap — 1 commit

Notable commits

  • change: CI: run Ruby < 3.2 on ubuntu-24.04 now that ubuntu-latest is 26.04
  • change: Merge pull request #578 from byroot/windows-binmode
  • change: Merge pull request #581 from czj/ci-old-rubies-on-ubuntu-24.04
  • change: Merge pull request #582 from byroot/compiler-no-cache
  • change: Read and write loadpath cache in binmode
  • change: Release 1.26.1
  • change: Support custom compilers even whith caching disabled

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

rails/bootsnap was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 5 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 681429d8efbed10d85168a83c6b5558b6dd667e5 — the exact code this score is about.
  • Scored under rubric-2026.11.2 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.2+preprod-5c4e66d9318b.