Add Zeitwerk eager loading check to CI
Summary
- Adds
Zeitwerk::Loader.eager_load_allvalidation to the CI test job - Runs after Ruby dependencies are installed and before Bun fixtures/specs
- Rebased onto current
patvice/mainafterruby_llm-mcpPR #94 was merged
Problem
Without automated Zeitwerk eager loading validation, autoloading issues can slip into production causing crashes. These issues include:
- Inflector configuration errors
- Constant definition problems
- Missing conditional checks for optional dependencies
Solution
Add a simple validation step that runs Zeitwerk::Loader.eager_load_all after dependency installation. This structural validation provides fast feedback before the rest of the test job continues.
Upstream Status
The original blocker in RubyLLM has been fixed on ruby_llm main:
- ruby_llm#504 merged on May 6, 2026 and fixes the ActiveRecord dependency/eager-loading failure.
- ruby_llm#505 was closed unmerged on March 1, 2026, so this PR no longer treats it as a blocker.
This PR remains draft until a published ruby_llm gem release includes #504. The current latest RubyGems release is ruby_llm 1.14.1 from April 2, 2026, which still predates the fix.
Testing
Local verification after rebasing still fails with the expected upstream gem issue because Bundler resolves ruby_llm 1.14.1:
uninitialized constant RubyLLM::ActiveRecord::ActsAs::ActiveSupport (NameError)
Command run locally:
RBENV_VERSION=3.4.9 rbenv exec bundle exec ruby -e "require 'ruby_llm/mcp'; Zeitwerk::Loader.eager_load_all"
Hey! Thanks for the PR -- I'm open to this if your downstream changes merged into RubyLLM
Only question is that Zeitwerk::Loader.eager_load_all is going to load all ruby files within a project. Right now it's failing in my CI due to ActiveSupport not be available when loading RubyLLM gem. That is not a hard dependency of RubyLLM or MCP gem, so I am wondering if there is not some work to do to exclude those files or had checks within.
Whatever RubyLLM provides as it solution for this, I'm happy to follow.
Looks like I commented to soon and https://github.com/patvice/ruby_llm-mcp/pull/94 provides that solution.
Happy to merge this once RubyLLM does
Sounds good, thanks! Also note this is entirely optional and pedantic, so if it's annoying later on of course feel free to remove!
https://github.com/crmne/ruby_llm/pull/504 was merged, so I'll keep an eye out for a RubyLLM release and then mark this ready for review...!
Ok, we're live: https://github.com/crmne/ruby_llm/releases/tag/1.15.0